1"use strict";(self.webpackChunksmart_test=self.webpackChunksmart_test||[]).push([[915],{833915:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Tl});var o=n(716491),i=n(489379),l=n(965471),a=n(244414);const r=(0,l.A)((0,a.jsx)("path",{d:"M8.4 18.2c.38.5.6 1.12.6 1.8 0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3c.44 0 .85.09 1.23.26l1.41-1.77c-.92-1.03-1.29-2.39-1.09-3.69l-2.03-.68c-.54.83-1.46 1.38-2.52 1.38-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3c0 .07 0 .14-.01.21l2.03.68c.64-1.21 1.82-2.09 3.22-2.32V5.91C9.96 5.57 9 4.4 9 3c0-1.66 1.34-3 3-3s3 1.34 3 3c0 1.4-.96 2.57-2.25 2.91v2.16c1.4.23 2.58 1.11 3.22 2.32L18 9.71V9.5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-1.06 0-1.98-.55-2.52-1.37l-2.03.68c.2 1.29-.16 2.65-1.09 3.69l1.41 1.77c.38-.18.79-.27 1.23-.27 1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.68.22-1.3.6-1.8l-1.41-1.77c-1.35.75-3.01.76-4.37 0z"}),"Hub"),s=(0,l.A)((0,a.jsx)("path",{d:"M4 6h18V4H4c-1.1 0-2 .9-2 2v11H0v3h14v-3H4zm19 2h-6c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1m-1 9h-4v-7h4z"}),"Devices"),c=(0,l.A)((0,a.jsx)("path",{d:"M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m-3.6 13.9 1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2z"}),"DirectionsRun"),d=(0,l.A)((0,a.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M9 17H7v-7h2zm4 0h-2V7h2zm4 0h-2v-4h2z"}),"Assessment");var p=n(511227);const x=(0,l.A)((0,a.jsx)("path",{d:"M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61M13 14h-2V8h2z"}),"Timer"),m=(0,l.A)((0,a.jsx)("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"}),"ShowChart");var u=n(549939),f=n(301308),h=n(397497),v=n(902235),g=n(182053),b=n(369019),A=n(784142),y=n(991434),j=n(796583),S=n(240033),w=n(428170),k=n(279739),F=n(18216),C=n(625979),z=n(19647),I=n(770006),N=n(23266),R=n(870610),D=n(274745),M=n(8145),T=n(965429),W=n(225277),O=n(157339),E=n(409950),L=n(490067),B=n(482829),U=n(516896),P=n(249950),H=n(6815),V=n(85549),K=n(580478),_=n(315328),q=(n(289366),n(783274)),Y=n(325333),G=n(93038),X=n(177166),J=n(236089),Q=n(793153),$=n(477642),Z=n(704804),ee=n(587565),te=n(439497),ne=n(729635),oe=n(499532),ie=n(263589),le=n(514836),ae=n(840155),re=n(867811),se=n(600650),ce=n(792211),de=n(856149),pe=n(198523),xe=n(149985),me=n(366960),ue=n(148863),fe=n(480773),he=n(57855),ve=n(908511),ge=n(771333),be=n(223442),Ae=n(126592),ye=n(404548),je=n(201348),Se=n(194453),we=n(180045),ke=n(24184),Fe=n(719223),Ce=n(360018),ze=n(84979);const Ie="operator",Ne="labAdmin",Re="use",De="tenant",Me=()=>{var e;const{companyWithUserInfoData:t}=(0,_.h)()||{},n=(0,Ce.xz)(),o=null===t||void 0===t||null===(e=t.smartRole)||void 0===e?void 0:e.roleType,i=o===ze.Ay.RoleSuperAdmin,l=o===ze.Ay.RoleAdmin,a=i||l;let r;return r=i?Ie:l?Ne:n?Re:De,{onPrem:n,isSuperAdmin:i,isCompanyAdmin:l,canManage:a,canUse:a||n,isTenant:!i&&!l&&!n,tier:r}},Te={display:"inline-flex",alignItems:"center",borderRadius:999,backgroundColor:"#f8fafc",border:"1px solid #e2e8f0",color:"#475569",fontWeight:600,lineHeight:1.5,whiteSpace:"nowrap",flexShrink:0,verticalAlign:"middle"},We={gap:.4,px:.65,py:.1,fontSize:"0.62rem"},Oe={gap:.65,px:1.05,py:.3,fontSize:"0.75rem"},Ee={WINDOWS:{label:"Windows",tint:"#0f7bd4"},LINUX:{label:"Linux",tint:"#f59e0b"},MAC:{label:"macOS",tint:"#334155"},MACOS:{label:"macOS",tint:"#334155"},DARWIN:{label:"macOS",tint:"#334155"}},Le=e=>String(e||"").trim().toUpperCase();function Be(e){let{os:t,size:n=14,sx:l}=e;const r=Le(t),s=(0,i.A)({width:n,height:n,flexShrink:0,display:"block"},l);return"WINDOWS"===r?(0,a.jsx)(o.A,{component:"svg",viewBox:"0 0 24 24",sx:s,"aria-hidden":!0,children:(0,a.jsx)("path",{fill:"#0f7bd4",d:"M3 5.4l7.6-1.05v7.2H3zM11.4 4.23L21 2.9v8.65h-9.6zM3 12.45h7.6v7.2L3 18.6zM11.4 12.45H21v8.65l-9.6-1.33z"})}):"MAC"===r||"MACOS"===r||"DARWIN"===r?(0,a.jsx)(o.A,{component:"svg",viewBox:"0 0 24 24",sx:s,"aria-hidden":!0,
1children:(0,a.jsx)("path",{fill:"#334155",d:"M16.3 12.6c0-2 1.6-3 1.7-3.1-1-1.4-2.4-1.6-2.9-1.6-1.2-.1-2.4.7-3 .7s-1.6-.7-2.6-.7c-1.3 0-2.6.8-3.3 2-1.4 2.4-.4 6 1 8 .7 1 1.5 2.1 2.5 2 1-.1 1.4-.6 2.6-.6s1.5.6 2.6.6 1.7-1 2.4-1.9c.7-1.1 1-2.2 1-2.2s-1.9-.7-2-2.9zM14.4 6.3c.5-.7.9-1.6.8-2.5-.8 0-1.8.5-2.4 1.2-.5.6-1 1.6-.8 2.5.9.1 1.8-.4 2.4-1.2z"})}):"LINUX"===r?(0,a.jsxs)(o.A,{component:"svg",viewBox:"0 0 24 24",sx:s,"aria-hidden":!0,children:[(0,a.jsx)("path",{fill:"#1e293b",d:"M12 2c-2.7 0-4.4 2-4.4 4.9v3.2c0 1-.4 1.9-1 2.7-1.1 1.5-1.8 3-1.8 4.5C4.8 20 8 21.8 12 21.8s7.2-1.8 7.2-4.5c0-1.5-.7-3-1.8-4.5-.6-.8-1-1.7-1-2.7V6.9C16.4 4 14.7 2 12 2z"}),(0,a.jsx)("ellipse",{cx:"12",cy:"15.6",rx:"3.4",ry:"4.6",fill:"#f8fafc"}),(0,a.jsx)("circle",{cx:"10.4",cy:"6.6",r:".95",fill:"#f8fafc"}),(0,a.jsx)("circle",{cx:"13.6",cy:"6.6",r:".95",fill:"#f8fafc"}),(0,a.jsx)("path",{fill:"#f59e0b",d:"M12 7.6l1.7 1.15L12 9.9l-1.7-1.15z"}),(0,a.jsx)("path",{fill:"#f59e0b",d:"M9.1 20.6c-.5.6-1.4.9-2 .6-.5-.3-.4-1 .2-1.6l1.3-1.2zM14.9 20.6c.5.6 1.4.9 2 .6.5-.3.4-1-.2-1.6l-1.3-1.2z"})]}):(0,a.jsx)(o.A,{component:"svg",viewBox:"0 0 24 24",sx:s,"aria-hidden":!0,children:(0,a.jsx)("circle",{cx:"12",cy:"12",r:"5",fill:"#cbd5e1"})})}function Ue(e){let{os:t,full:n=!1}=e;const l=n?Oe:We,r=n?15:11,s=(e=>{var t;return(null===(t=Ee[Le(e)])||void 0===t?void 0:t.label)||e||""})(t);return s&&"\u2014"!==s?(0,a.jsxs)(o.A,{component:"span",sx:(0,i.A)((0,i.A)({},Te),l),children:[(0,a.jsx)(Be,{os:t,size:r}),s]}):(0,a.jsx)(g.A,{variant:"body2",color:"text.disabled",children:"\u2014"})}var Pe=n(134603);const He=["icon","children","onClick","disabled","sx"],Ve=["icon","children","onClick","disabled","sx"],Ke=["children","onClick","title","active","size","sx"],_e={brand:"#2f6bff",brandHi:"#4f7bff",ink:"#0f172a",slate800:"#1e293b",slate700:"#334155",slate600:"#475569",slate500:"#64748b",slate400:"#94a3b8",slate300:"#cbd5e1",slate200:"#e2e8f0",slate100:"#f1f5f9",slate50:"#f8fafc",emerald:"#10b981",emeraldDk:"#059669",sky:"#0ea5e9",skyDk:"#0284c7",amber:"#f59e0b",rose:"#f43f5e",roseLt:"#f87171",violet:"#8b5cf6",orange:"#f97316",termBg:"#0d1526",sidebar:"#0b1526",mainBg:"#fbfbfc",cardBorder:"rgba(226,232,240,.85)"},qe=!1,Ye=("SAAS".toUpperCase(),{scrollbarWidth:"none",scrollbarColor:"transparent transparent",transition:"scrollbar-color .18s","&::-webkit-scrollbar":{width:0,height:0,transition:"width .12s, height .12s"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:8,border:"2px solid transparent",backgroundClip:"content-box",transition:"background-color .18s"},"&:hover":{scrollbarWidth:"thin",scrollbarColor:"#cbd5e1 transparent"},"&:hover::-webkit-scrollbar":{width:8,height:8},"&:hover::-webkit-scrollbar-thumb":{background:"#cbd5e1",backgroundClip:"content-box"},"&:hover::-webkit-scrollbar-thumb:hover":{background:"#94a3b8",backgroundClip:"content-box"}}),Ge=(e,t)=>{const n=K.A.getText(e);return n&&n!==e?n:t};function Xe(e){let{icon:t,children:n,onClick:o,disabled:l,sx:r}=e,s=(0,we.A)(e,He);return(0,a.jsxs)(ke.A,(0,i.A)((0,i.A)({onClick:o,disabled:l,sx:(0,i.A)({display:"inline-flex",alignItems:"center",gap:1,fontSize:"0.82rem",fontWeight:600,color:_e.slate600,px:1.5,py:1,borderRadius:2.25,transition:"background .15s,color .15s","&:hover":{bgcolor:_e.slate100,color:_e.slate800},"&.Mui-disabled":{opacity:.4},"& svg":{fontSize:16,color:_e.slate400}},r)},s),{},{children:[t,n]}))}function Je(e){let{icon:t,children:n,onClick:o,disabled:l,sx:r}=e,s=(0,we.A)(e,Ve);return(0,a.jsxs)(ke.A,(0,i.A)((0,i.A)({onClick:o,disabled:l,sx:(0,i.A)({display:"inline-flex",alignItems:"center",gap:1,fontSize:"0.82rem",fontWeight:600,color:"#fff",bgcolor:_e.brand,px:2,py:1,borderRadius:2.25,boxShadow:"0 1px 2px rgba(47,107,255,.25)",transition:"filter .15s,box-shadow .15s","&:hover":{filter:"brightness(1.08)",boxShadow:"0 3px 10px rgba(47,107,255,.3)"},"&.Mui-disabled":{opacity:.5},"& svg":{fontSize:16}},r)},s),{},{children:[t,n]}))}function Qe(e){let{children:t,onClick:n,title:o,active:l,size:r=34,sx:s}=e,c=(0,we.A)(e,Ke);const d=(0,a.jsx)(ke.A,(0,i.A)((0,i.A)({onClick:n,sx:(0,i.A)({width:r,height:r,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:2,color:l?_e.brand:_e.slate500,bgcolor:l?"#e0edff":"transparent","&:hover":{bgcolor:l?"#e0edff":_e.slate100,color:l?_e.brand:_e.slate700},"& svg":{fontSize:18}},s)},c),{},{children:t}));return o?(0,a.jsx)(q.A,{title:o,arrow:!0,placement:"top",enterDelay:1e3,enterNextDelay:1e3,children:(0,a.jsx)("span",{style:{display:"inline-flex"},children:d})}):d}function $e(e){let{checked:t,indeterminate:n,onChange:i,title:l}=e;const r=t||n;return(0,a.jsxs)(o.A,{component:"span",role:"checkbox","aria-checked":n?"mixed":!!t,title:l,onClick:e=>{e.stopPropagation(),i&&i(!t)},sx:{width:18,height:18,flex:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",border:"1.5px solid ".concat(r?_e.brand:_e.slate300),borderRadius:1.5,bgcolor:r?_e.brand:"#fff",cursor:"pointer",position:"relative",transition:"all .15s","&:hover":{borderColor:r?_e.brand:_e.slate400}},children:[t&&!n&&(0,a.jsx)(o.A,{component:"span",sx:{width:4,height:9,mt:"-2px",border:"solid #fff",borderWidth:"0 2px 2px 0",transform:"rotate(45deg)"}}),n&&(0,a.jsx)(o.A,{component:"span",sx:{width:9,height:2,bgcolor:"#fff",borderRadius:.5}})]})}function Ze(e){let{segs:t,right:n,active:i,onSeg:l,live:r=!0}=e;return(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap",px:2,minHeight:52,py:.5,borderRadius:3,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff"},children:[r&&(0,a.jsxs)(o.A,{sx:{display:"inline-flex",alignItems:"center",gap:.75,fontSize:"0.62rem",fontWeight:800,letterSpacing:"0.06em",color:_e.emerald},children:[(0,a.jsx)(o.A,{sx:{width:6,height:6,borderRadius:"50%",bgcolor:_e.emerald,boxShadow:"0 0 0 3px ".concat(_e.emerald,"33")}}),"LIVE"]}),(0,a.jsx)(o.A,{sx:{display:"flex",alignItems:"center",gap:2.5,flexWrap:"wrap"},children:t.map((e=>
1{const t=i===e.key;return(0,a.jsxs)(ke.A,{onClick:()=>l&&l(e.key),sx:{display:"inline-flex",alignItems:"center",gap:.9,borderRadius:1.5,px:.5,py:.25,opacity:i&&!t?.55:1,"&:hover":{opacity:1}},children:[(0,a.jsx)(o.A,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:e.color}}),(0,a.jsx)(o.A,{component:"span",style:{fontWeight:800,fontSize:"0.95rem",color:_e.ink},sx:{lineHeight:1.2},children:e.value}),(0,a.jsx)(o.A,{component:"span",style:{fontWeight:400,color:_e.slate500},sx:{fontSize:"0.82rem"},children:e.label})]},e.key)}))}),(0,a.jsx)(o.A,{sx:{flex:1}}),n]})}function et(e){let{children:t}=e;return(0,a.jsx)(o.A,{component:"span",style:{color:_e.slate400,fontWeight:700,fontSize:"0.6875rem"},sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",mb:.75},children:t})}function tt(e){let{options:t,value:n,onChange:i}=e;return(0,a.jsx)(o.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:t.map((e=>{let[t,o]=e;const l=n===t;return(0,a.jsx)(ke.A,{onClick:()=>i(t),sx:{px:1,py:.5,borderRadius:1.5,fontSize:"0.72rem",fontWeight:700,transition:"all .15s",bgcolor:l?_e.brand:_e.slate100,color:l?"#fff":_e.slate500,"&:hover":{bgcolor:l?_e.brand:_e.slate200}},children:o},t)}))})}function nt(e){let{label:t,active:n,onClick:o}=e;return(0,a.jsx)(ke.A,{onClick:o,sx:{px:1,py:.5,borderRadius:1.5,fontSize:"0.72rem",fontWeight:700,transition:"all .15s",bgcolor:n?_e.brand:_e.slate100,color:n?"#fff":_e.slate500,"&:hover":{bgcolor:n?_e.brand:_e.slate200}},children:t})}function ot(e){let{value:t,onChange:n,options:i,icons:l}=e;return l?(0,a.jsx)(M.A,{select:!0,size:"small",fullWidth:!0,value:t,onChange:e=>n(e.target.value),SelectProps:{sx:{"& .MuiSelect-select":{display:"flex",alignItems:"center",gap:.75,fontSize:"0.8125rem",color:_e.slate700,py:.85}}},sx:{"& .MuiOutlinedInput-root":{borderRadius:2,bgcolor:"#fff"},"& .MuiOutlinedInput-notchedOutline":{borderColor:_e.slate200},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:_e.brand}},children:i.map((e=>{let[t,n]=e;
1return(0,a.jsxs)(N.A,{value:t,sx:{display:"flex",alignItems:"center",gap:1,fontSize:"0.8125rem"},children:[l[t]||null,n]},t)}))}):(0,a.jsxs)(o.A,{sx:{position:"relative"},children:[(0,a.jsx)(o.A,{component:"select",value:t,onChange:e=>n(e.target.value),sx:{width:"100%",appearance:"none",border:"1px solid ".concat(_e.slate200),borderRadius:2,px:1.5,pr:4,py:.75,fontSize:"0.8125rem",bgcolor:"#fff",color:_e.slate700,fontFamily:"inherit",cursor:"pointer","&:focus":{outline:"none",borderColor:_e.brand}},children:i.map((e=>{let[t,n]=e;return(0,a.jsx)("option",{value:t,children:n},t)}))}),(0,a.jsx)(o.A,{component:"span",sx:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:_e.slate400,fontSize:"0.7rem"},children:"\u25be"})]})}function it(e){let{value:t,onChange:n,placeholder:i,width:l=300}=e;const r=!(!t||!String(t).length);return(0,a.jsxs)(o.A,{sx:{position:"relative",width:{xs:"100%",sm:l},flexShrink:0,"&:hover .df-search-clear, &:focus-within .df-search-clear":{opacity:1,pointerEvents:"auto"}},children:[(0,a.jsx)(Fe.default,{sx:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:_e.slate400,fontSize:18,pointerEvents:"none"}}),(0,a.jsx)(o.A,{component:"input",value:t,onChange:e=>n(e.target.value),placeholder:i,spellCheck:!1,sx:{width:"100%",pl:4.5,pr:4.5,py:1,borderRadius:2,border:"1px solid ".concat(_e.slate200),fontSize:"0.82rem",fontFamily:"inherit",color:_e.slate800,boxSizing:"border-box","&::placeholder":{color:_e.slate400},"&:focus":{outline:"none",borderColor:_e.brand,boxShadow:"0 0 0 3px ".concat(_e.brand,"22")}}}),r&&(0,a.jsx)(ke.A,{className:"df-search-clear",onClick:()=>n(""),"aria-label":Ge("clear","Clear"),sx:{position:"absolute",right:6,top:"50%",transform:"translateY(-50%)",width:24,height:24,borderRadius:1.5,color:_e.slate400,opacity:0,pointerEvents:"none",transition:"opacity .15s, color .15s, background-color .15s","&:hover":{color:_e.slate600,bgcolor:_e.slate100}},children:(0,a.jsx)($.default,{sx:{fontSize:16}})})]})}var lt=n(795331);const at="#2f6bff",rt="#1e293b",st="#334155",ct="#475569",dt="#64748b",pt="#94a3b8",xt="#cbd5e1",mt="#e2e8f0",ut="#f1f5f9",ft="#f8fafc",ht="#047857",vt="#059669",gt="#10b981",bt="#ecfdf5",At="#e11d48",yt="#fff1f2",jt="#f59e0b",St="#eff6ff",wt="1.4.4";function kt(e){if(!e)return"\u2014";const t=Math.max(0,(Date.now()-e)/1e3);return t<60?Ge("deviceFarmTimeJustNow","just now"):t<3600?"".concat(Math.floor(t/60)," ").concat(Ge("deviceFarmTimeMinAgo","min ago")):t<86400?"".concat(Math.floor(t/3600)," ").concat(Ge("deviceFarmTimeHourAgo","h ago")):"".concat(Math.floor(t/86400)," ").concat(Ge("deviceFarmTimeDayAgo","d ago"))}function Ft(e){var t,n,o,i,l,a;const r="MAINTENANCE"===e.status?"ONLINE":e.status,s=!(null===(t=e.health)||void 0===t||!t.draining)||"MAINTENANCE"===e.status,c=e.health||{},d={};return"ONLINE"!==r||void 0===c.api&&void 0===c.cdn&&void 0===c.appium||(!1===c.api?d.API="down":!0===c.api&&(d.API="up"),!1===c.cdn?d.CDN="down":!0===c.cdn&&(d.CDN="up"),!1===c.appium?d.Appium="down":!0===c.appium&&(d.Appium="up")),{id:e.id,name:e.name||"#".concat(e.id),ownerCompanyId:null!==(n=e.ownerCompanyId)&&void 0!==n?n:null,os:e.os||"\u2014",agent:(null===(o=e.health)||void 0===o?void 0:o.agentVersion)||null,health:d,devices:null!==(i=e.deviceCount)&&void 0!==i?i:0,monitoring:"boolean"===typeof(null===(l=e.health)||void 0===l?void 0:l.monitoring)?e.health.monitoring:null,ip:(null===(a=e.health)||void 0===a?void 0:a.ip)||null,hb:e.lastHeartbeatAt?kt(new Date(e.lastHeartbeatAt).getTime()):"\u2014",createdMs:e.createDate?new Date(e.createDate).getTime():null,hbOnline:"ONLINE"===r,status:"ONLINE"===r?"ONLINE":"OFFLINE",drain:s,_raw:e}}const Ct=[{k:"monon",tk:"deviceFarmActMonOn",label:"Enable monitoring",icon:(0,a.jsx)(xe.default,{fontSize:"small"})},{k:"monoff",tk:"deviceFarmActMonOff",label:"Disable monitoring",icon:(0,a.jsx)(me.default,{fontSize:"small"})},{sep:1},{k:"alerts",tk:"deviceFarmActAlertRule",label:"Alert rule",icon:(0,a.jsx)(ue.default,{fontSize:"small"}),notif:1},{sep:1},{k:"killemu",tk:"deviceFarmActKillEmu",label:"Shut down emulators",icon:(0,a.jsx)(fe.default,{fontSize:"small"})},{k:"rebootdev",tk:"deviceFarmActRebootDev",label:"Restart devices",icon:(0,a.jsx)(Z.default,{fontSize:"small"})},{sep:1},{k:"installcmd",tk:"deviceFarmActInstallCmd",label:"Copy install c
1ommand",icon:(0,a.jsx)(ae.default,{fontSize:"small"})}],zt=[{k:"drain",tk:"deviceFarmActDrain",label:"Drain (maintenance)",icon:(0,a.jsx)(he.default,{fontSize:"small"})},{k:"resume",tk:"deviceFarmActResume",label:"Resume scheduling",icon:(0,a.jsx)(ve.default,{fontSize:"small"})},{sep:1},{k:"agent",tk:"deviceFarmActRestartAgent",label:"Restart node agent",icon:(0,a.jsx)(ge.default,{fontSize:"small"})},{sep:1},{k:"delete",tk:"deviceFarmActDeleteNode",label:"Delete node",icon:(0,a.jsx)(Ae.default,{fontSize:"small"}),danger:1}],It=[{k:"nodes",tk:"deviceFarmActExportNodes",label:"Node list (.xlsx)",icon:(0,a.jsx)(be.default,{fontSize:"small"})},{k:"selected",tk:"deviceFarmActExportSelected",label:"Selected nodes (.xlsx)",icon:(0,a.jsx)(ye.default,{fontSize:"small"}),needsSel:1},{k:"farm",tk:"deviceFarmActExportFarm",label:"Nodes + real devices (.xlsx)",icon:(0,a.jsx)(je.default,{fontSize:"small"})}];function Nt(e){let{health:t}=e;const n=Object.keys(t||{});if(!n.length)return(0,a.jsx)(Rt,{color:pt,bg:ft,border:mt,icon:(0,a.jsx)(pe.default,{sx:{fontSize:15}}),label:Ge("deviceFarmHealthNoData","No data")});const o=n.map((e=>t[e])),i=n.filter((e=>"down"===t[e]));if(i.length){const e=Ge("deviceFarmHealthCheck","Check"),t=1===i.length?"".concat(e," \xb7 ").concat(i[0]):2===i.length?"".concat(e," \xb7 ").concat(i[0],", ").concat(i[1]):"".concat(e," \xb7 ").concat(i[0]," +").concat(i.length-1);return(0,a.jsx)(Rt,{color:At,bg:yt,border:"#fecdd3",icon:(0,a.jsx)(ce.default,{sx:{fontSize:15}}),label:t})}return!o.includes("up")&&o.includes("off")?(0,a.jsx)(Rt,{color:pt,bg:ft,border:mt,icon:(0,a.jsx)(te.default,{sx:{fontSize:15}}),label:Ge("deviceFarmHealthStopped","Stopped")}):(0,a.jsx)(Rt,{color:ht,bg:bt,border:"#a7f3d0",icon:(0,a.jsx)(de.default,{sx:{fontSize:15}}),label:Ge("deviceFarmHealthHealthy","Healthy")})}function Rt(e){let{color:t,bg:n,border:i,icon:l,label:r}=e;return(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.6,whiteSpace:"nowrap",border:"1px solid ".concat(i),bgcolor:n,color:t,px:1,py:"3px",borderRadius:99,fontSize:"0.72rem",fontWeight:700,"& svg":{color:t}},children:[l,r]})}function Dt(e){let{status:t,drain:n}=e;const i="ONLINE"===t,l=i?n?jt:gt:pt;return(0,a.jsxs)(o.A,{sx:{position:"relative",width:10,height:10,flexShrink:0},children:[i&&(0,a.jsx)(o.A,{sx:{position:"absolute",inset:0,borderRadius:"50%",bgcolor:n?"#fbbf24":"#34d399",opacity:.75,animation:"df-ping 1.2s cubic-bezier(0,0,.2,1) infinite","@keyframes df-ping":{"75%,100%":{transform:"scale(2)",opacity:0}
1}}}),(0,a.jsx)(o.A,{sx:{position:"relative",width:10,height:10,borderRadius:"50%",bgcolor:l}})]})}const Mt={textTransform:"none",fontWeight:600,fontSize:"0.82rem",color:ct,px:1.5,py:.75,borderRadius:1.5,"&:hover":{bgcolor:ut,color:rt},"& .MuiButton-startIcon svg, & .MuiButton-endIcon svg":{color:pt}};function Tt(e){var t,l;let{canManage:r=!0,rawNodes:s=[],devices:c=null,deviceTotals:d=null,onRefresh:p,onNodeCommand:x,onDeleteNodes:m,onManageAction:u,onNodeView:f,onNodeLogs:h,onCreateNode:v,onOpenDevices:b,onRemoteShell:A,onCopyFarmKey:y,onRename:j}=e;(0,Ce.xz)();const[S,w]=(0,E.useState)(""),[k,C]=(0,E.useState)({col:"status",dir:"asc"}),[z,I]=(0,E.useState)(1),[T,W]=(0,E.useState)(null),[O,L]=(0,E.useState)(""),[B,U]=(0,E.useState)((()=>new Set)),[P,H]=(0,E.useState)(!0),[V,K]=(0,E.useState)({el:null,kind:null}),_=(0,E.useRef)(null),[ce,de]=(0,E.useState)(0);(0,E.useEffect)((()=>{const e=_.current;if(!e||"undefined"===typeof ResizeObserver)return;const t=new ResizeObserver((e=>{var t,n;const o=null===(t=e[0])||void 0===t||null===(n=t.contentRect)||void 0===n?void 0:n.width;o&&de(Math.round(o))}));return t.observe(e),()=>t.disconnect()}),[]);const pe=ce>0&&ce<1180,xe=ce>0&&ce<980,me=ce>0&&ce<700,[ue,fe]=(0,E.useState)({el:null,node:null}),he=()=>fe({el:null,node:null}),[ve,ge]=(0,E.useState)({status:new Set,os:"any",monitoring:"any",agent:"any"}),be=(0,E.useMemo)((()=>(Array.isArray(s)?s:[]).map(Ft)),[s]),Ae=(0,E.useMemo)((()=>{var e,t,n;const o=be.filter((e=>e.drain)).length;return{online:be.filter((e=>"ONLINE"===e.status&&!e.drain)).length,draining:o,offline:be.filter((e=>"ONLINE"!==e.status)).length,devTotal:null!==(e=null!==(t=null===c||void 0===c?void 0:c.length)&&void 0!==t?t:null===d||void 0===d?void 0:d.total)&&void 0!==e?e:be.reduce(((e,t)=>e+(t.devices||0)),0),devConnected:c?c.filter((e=>"ONLINE"===e.status||"BUSY"===e.status)).length:null!==(n=null===d||void 0===d?void 0:d.active)&&void 0!==n?n:null}}),[be,c,d]),ye=((0,E.useMemo)((()=>Array.from(new Set(be.map((e=>e.os)).filter((e=>e&&"\u2014"!==e)))).sort()),[be]),ve.status.size,ve.os,ve.monitoring,ve.agent,(e,t)=>{const n=e.createdMs,o=t.createdMs;return null==n&&null==o?t.id-e.id:null==n?1:null==o?-1:o-n||t.id-e.id}),je=(0,E.useMemo)((()=>{let e=be.slice();const t=S.trim().toLowerCase();t&&(e=e.filter((e=>"".concat(e.name," ").concat(e.os).toLowerCase().includes(t)))),ve.status.size&&(e=e.filter((e=>ve.status.has((e=>e.drain?"draining":"ONLINE"!==e.status?"offline":"online")(e))))),"any"!==ve.os&&(e=e.filter((e=>e.os===ve.os))),"enabled"===ve.monitoring?e=e.filter((e=>!0===e.monitoring)):"disabled"===ve.monitoring&&(e=e.filter((e=>!1===e.monitoring))),"latest"===ve.agent?e=e.filter((e=>e.agent===wt)):"outdated"===ve.agent&&(e=e.filter((e=>e.agent&&e.agent!==wt)));const n="asc"===k.dir?1:-1;return e.sort(((e,t)=>{if("status"===k.col){const o=("ONLINE"===e.status?0:1)-("ONLINE"===t.status?0:1);return o?o*n:ye(e,t)}return"name"===k.col?e.name.localeCompare(t.name)*n:"os"===k.col?(e.os.localeCompare(t.os)||e.name.localeCompare(t.name))*n:"agent"===k.col?((e.agent||"").localeCompare(t.agent||"")||e.name.localeCompare(t.name))*n:"devices"===k.col?(e.devices-t.devices)*n||e.id-t.id:ye(e,t)*n})),e}),[be,S,k,ve]),we=Math.max(1,Math.ceil(je.length/10)),ke=je.slice(10*(z-1),10*z),Fe=ke.map((e=>e.id)),ze=Fe.length>0&&Fe.every((e=>B.has(e))),Ie=!ze&&Fe.some((e=>B.has(e))),Ne=(e,t)=>K({el:e.currentTarget,kind:t}),Re=e=>{let{label:t,icon:n,onClick:o,disabled:l=!1,dropdown:r=!1}=e;return xe?(0,a.jsx)(q.A,{title:t,arrow:!0,placement:"top",enterDelay:600,children:(0,a.jsx)("span",{children:(0,a.jsx)(Y.A,{size:"small",disabled:l,onClick:o,sx:{width:34,height:34,borderRadius:1.5,color:dt,"&:hover":{bgcolor:ut,color:st},"&.Mui-disabled":{opacity:.4},"& svg":{fontSize:19}},children:n})})}):(0,a.jsx)(F.A,{sx:(0,i.A)((0,i.A)({},Mt),{},{"&.Mui-disabled":{opacity:.4}}),disabled:l,startIcon:n,endIcon:r?(0,a.jsx)(ie.default,{}):void 0,onClick:o,children:t})},De=()=>K({el:null,kind:null}),Me=B.size,Te=e=>{let{col:t,label:n,sortable:l,sx:r}=e;return(0,a.jsxs)(o.A,{component:"th",onClick:l?()=>(e=>C((t=>({col:e,dir:t.col===e&&"asc"===t.dir?"desc":"asc"}))))(t):void 0,sx:(0,i.A)({px:2,py:1.5,fontWeight:600,fontSize:"0.8rem",color:dt,textAlign:"left",whiteSpace:"nowrap",userSelect:"none",cursor:l?"pointer":"default",position:"sticky",top:0,zIndex:2,bgcolor:"#EFF1F5","&:hover":l?{color:st}:{}},r),children:[n,l&&k.col===t&&(0,a.jsx)(o.A,{component:"span",sx:{ml:.4,fontSize:"0.7rem",color:at},children:"asc"===k.dir?"\u2191":"\u2193"})]})},We=(e,t,n,o)=>(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,placement:"top",title:e,arrow:!0,children:(0,a.jsx)("span",{children:(0,a.jsx)(Y.A,{size:"small",disabled:o,onClick:n,sx:{width:32,height:32,color:pt,borderRadius:1.5,"&:hover":{bgcolor:ut,color:st},"& svg":{fontSize:18}},children:t})})}),[Oe,Ee]=(0,E.useState)(null),[Le,Be]=(0,E.useState)(null),Pe=(0,E.useRef)(null);(0,E.useEffect)((()=>()=>{Pe.current&&clearTimeout(Pe.current)}),[]);const He=e=>{Ee(e),Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout((()=>Ee(null)),2e3)},[Ve,Ke]=(0,E.useState)(!1),_e=async e=>{const t=(O||"").trim();if(t&&!Ve){Ke(!0);try{!1!==await j(e,t)&&W(null)}finally{Ke(!1)}}},Xe=(e,t,n,o,i)=>{const l=Oe===e;return(0,a.jsx)(q.A,{title:l?n:t,arrow:!0,placement:"top",open:l||Le===e,onOpen:()=>Be(e),onClose:()=>Be(null),enterDelay:1e3,enterNextDelay:1e3,children:(0,a.jsx)("span",{children:(0,a.jsx)(Y.A,{size:"small",onMouseLeave:()=>Be((t=>t===e?null:t)),onClick:async()=>{try{await i(),He(e)}catch(t){}},sx:{width:32,height:32,borderRadius:1.5,color:l?vt:pt,transition:"color .15s, background-color .15s","&:hover":{bgcolor:l?bt:ut,color:l?vt:st},"& svg":{fontSize:18}},children:o})})},e)},Je=(0,E.useRef)(null);(0,E.useEffect)((()=>()=>{Je.current&&clearTimeout(Je.current)}),[]);const Qe=(e,t,n,o,i)=>{const l=Oe===e;return(0,a.jsx)(q.A,{title:l?n:"",arrow:!0,placement:"top",open:l,disableHoverListener:!0,disableFocusListener:!0,disableTouchListener:!0,children:(0,a.jsxs)(N.A,{onClick:async()=>{try{await i(),He(e)}catch(t){return}Je.current&&clearTimeout(Je.current),Je.current=setTimeout(he,2e3)},sx:{fontSize:"0.85rem",gap:1.25,color:l?vt:st,transition:"color .15s","& svg":{fontSize:18,color:l?vt:pt,transition:"color .15s"},"&:hover":{color:l?vt:rt,"& svg":{color:l?vt:st}}},children:[o,t]})})},$e=async(e,t,o,i,l,a,r)=>{const s=new((await n.e(264).then(n.t.bind(n,559264,23))).default.Workbook);s.creator="SmartTest",s.created=new Date;const c=s.addWorksheet(t,{views:[{state:"frozen",ySplit:6}]}),d=l.length,p=(e=>{let t="",n=e;for(;n>0;){const e=(n-1)%26;t=String.fromCharCode(65+e)+t,n=Math.floor((n-e-1)/26)}return t})(d);c.columns=l.map(((e,t)=>({width:(null===r||void 0===r?void 0:r[t])||18})));let x="";
1try{x=(new Date).toLocaleString()}catch(g){x=""}[["SmartTest Device Farm",16,!0,"2f6bff",24],[o,12,!0,"1e293b",18],["Generated: ".concat(x),10,!1,"64748b",15],[i||"",10,!1,"64748b",15]].forEach(((e,t)=>{let[n,o,i,l,a]=e;const r=c.getRow(t+1);r.getCell(1).value=n,r.getCell(1).font={name:"Calibri",size:o,bold:i,color:{argb:"FF".concat(l)}},r.getCell(1).alignment={vertical:"middle"},r.height=a,c.mergeCells("A".concat(t+1,":").concat(p).concat(t+1))})),c.getRow(5).height=6;const m=c.getRow(6);m.values=l,m.height=22,m.eachCell((e=>{e.font={name:"Calibri",size:11,bold:!0,color:{argb:"FFFFFFFF"}},e.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FF2F6BFF"}},e.alignment={horizontal:"center",vertical:"middle",wrapText:!0},e.border={top:{style:"thin",color:{argb:"FF2F6BFF"}},bottom:{style:"thin",color:{argb:"FF2F6BFF"}},left:{style:"thin",color:{argb:"FFFFFFFF"}},right:{style:"thin",color:{argb:"FFFFFFFF"}}}})),a.forEach(((e,t)=>{const n=c.getRow(7+t);n.values=e.map((e=>null==e?"\u2014":e)),n.height=18;for(let o=1;o<=d;o+=1){const i=n.getCell(o);i.font={name:"Calibri",size:10,color:{argb:"FF334155"}},i.alignment={vertical:"middle",horizontal:"number"===typeof e[o-1]?"center":"left"},i.border={top:{style:"thin",color:{argb:"FFE2E8F0"}},bottom:{style:"thin",color:{argb:"FFE2E8F0"}},left:{style:"thin",color:{argb:"FFE2E8F0"}},right:{style:"thin",color:{argb:"FFE2E8F0"}}},t%2===1&&(i.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFF8FAFC"}})}})),c.autoFilter={from:"A6",to:"".concat(p,"6")};const u=await s.xlsx.writeBuffer(),f=new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),h=URL.createObjectURL(f),v=document.createElement("a");v.href=h,v.download=e,v.click(),setTimeout((()=>URL.revokeObjectURL(h)),1e3)},et=e=>{const t=e.health||{},n=Object.keys(t);if(!n.length)return"No data";const o=n.filter((e=>"down"===t[e]));return o.length?"Check: ".concat(o.join(", ")):"Healthy"};return(0,a.jsxs)(o.A,{ref:_,sx:{fontFamily:"Inter, sans-serif"},children:[(0,a.jsx)(o.A,{sx:{mb:2},children:(0,a.jsx)(Ze,{segs:[{key:"online",label:Ge("deviceFarmOnline","Online"),value:Ae.online,color:gt},{key:"draining",label:Ge("deviceFarmNodesDraining","Draining"),value:Ae.draining,color:jt},{key:"offline",label:Ge("deviceFarmOffline","Offline"),value:Ae.offline,color:pt}],right:(0,a.jsxs)(o.A,{component:"span",style:{color:dt},sx:{fontSize:"0.8125rem",lineHeight:1.5},children:[Ae.devTotal," ",Ge("deviceFarmDevicesWord","devices"),null!=Ae.devConnected?" \xb7 ".concat(Ae.devConnected," ").concat(Ge("deviceFarmConnectedWord","connected")):""]})})}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75,mb:1.5,flexWrap:"wrap"},children:[(0,a.jsx)(o.A,{sx:{mr:.5,minWidth:0},children:(0,a.jsx)(it,{value:S,onChange:e=>{w(e),I(1)},placeholder:Ge("deviceFarmSearchNode","Search node / OS\u2026"),width:xe?200:320})}),(0,a.jsx)(o.A,{sx:{flex:1}}),Re({label:Ge("deviceFarmRefresh","Refresh"),icon:(0,a.jsx)(Z.default,{}),onClick:()=>p&&p()}),r&&(0,a.jsxs)(a.Fragment,{children:[Re({label:Ge("deviceFarmManage","Manage"),icon:(0,a.jsx)(ee.default,{}),disabled:0===Me,dropdown:!0,onClick:e=>Ne(e,"manage")}),Re({label:Ge("deviceFarmNodeStates","Node states"),icon:(0,a.jsx)(te.default,{}),disabled:0===Me,dropdown:!0,onClick:e=>Ne(e,"states")})]}),Re({label:Ge("deviceFarmExport","Export"),icon:(0,a.jsx)(ne.default,{}),dropdown:!0,onClick:e=>Ne(e,"export")}),r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{sx:{width:"1px",height:24,bgcolor:mt,mx:.5}}),(0,a.jsx)(q.A,{title:Ge("deviceFarmCreateNode","Create Node"),arrow:!0,placement:"top",enterDelay:1e3,enterNextDelay:1e3,disableHoverListener:!me,children:(0,a.jsx)(F.A,{variant:"contained",disableElevation:!0,startIcon:(0,a.jsx)(oe.default,{}),onClick:()=>v&&v(),sx:(0,i.A)((0,i.A)({},(0,lt.Mk)(at)),{},{fontSize:"0.82rem",px:2,minWidth:0,flexShrink:0,whiteSpace:"nowrap"}),children:me?Ge("deviceFarmNodeWord","Node"):Ge("deviceFarmCreateNode","Create Node")})})]})]}),(0,a.jsx)(o.A,{sx:(0,i.A)({border:"1px solid ".concat(ut),borderRadius:2.5,overflow:"auto",maxHeight:{xs:"none",md:"calc(100vh - 360px)"},minHeight:160},Ye),children:(0,a.jsxs)(o.A,{component:"table",sx:{width:"100%",minWidth:pe?720:900,borderCollapse:"collapse",fontSize:"0.9rem"},children:[(0,a.jsx)(o.A,{component:"thead",children:(0,a.jsxs)(o.A,{component:"tr",sx:{borderBottom:"1px solid ".concat(mt),bgcolor:"#EFF1F5"},children:[(0,a.jsx)(o.A,{component:"th",sx:{px:2,py:1.5,width:48,position:"sticky",top:0,zIndex:2,bgcolor:"#EFF1F5"},children:(0,a.jsx)(G.A,{size:"small",checked:ze,indeterminate:Ie,onChange:()=>U((e=>{const t=new Set(e);return ze?Fe.forEach((e=>t.delete(e))):Fe.forEach((e=>t.add(e))),t}
1)),sx:{p:0,color:xt,"&.Mui-checked, &.MuiCheckbox-indeterminate":{color:at}}})}),(0,a.jsx)(Te,{col:"name",label:Ge("deviceFarmColName","Name"),sortable:!0}),(0,a.jsx)(Te,{col:"os",label:Ge("deviceFarmColOs","OS"),sortable:!0,sx:{width:112}}),(0,a.jsx)(Te,{col:"agent",label:Ge("deviceFarmColAgent","Agent"),sortable:!0,sx:{width:104}}),(0,a.jsx)(Te,{col:"status",label:Ge("deviceFarmColHealth","Health"),sortable:!0,sx:{width:190}}),(0,a.jsx)(Te,{col:"devices",label:Ge("deviceFarmColDevices","Devices"),sortable:!0,sx:{width:104}}),(0,a.jsx)(Te,{label:Ge("deviceFarmColMonitoring","Monitoring"),sx:{width:112}}),(0,a.jsx)(Te,{label:Ge("deviceFarmColIp","IP address"),sx:{width:124}}),(0,a.jsx)(Te,{label:Ge("deviceFarmColHeartbeat","Last Heartbeat"),sx:{width:128}}),(0,a.jsx)(Te,{label:Ge("deviceFarmColActions","Actions"),sx:{width:pe?64:150,textAlign:"right",pr:2}})]})}),(0,a.jsxs)(o.A,{component:"tbody",children:[ke.map((e=>{const t=e.agent&&e.agent!==wt;return(0,a.jsxs)(o.A,{component:"tr",sx:{borderBottom:"1px solid ".concat(ut),bgcolor:B.has(e.id)?"rgba(239,246,255,0.6)":"transparent","&:hover":{bgcolor:B.has(e.id)?"rgba(239,246,255,0.6)":"#fafbfc","& .node-rename-btn":{opacity:1}}},children:[(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5},children:(0,a.jsx)(G.A,{size:"small",checked:B.has(e.id),onChange:()=>{return t=e.id,U((e=>{const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}));var t},sx:{p:0,color:xt,"&.Mui-checked":{color:at}}})}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5,fontWeight:500,color:rt,maxWidth:{xs:170,sm:240,md:300,lg:360,xl:460}},children:(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25,minWidth:0},children:[(0,a.jsx)(Dt,{status:e.status,drain:e.drain}),T===e.id?(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.5,minWidth:0,flex:1},children:[(0,a.jsx)(M.A,{autoFocus:!0,size:"small",value:O,onChange:e=>L(e.target.value),onKeyDown:t=>{"Enter"===t.key&&(O||"").trim()&&_e(e._raw),"Escape"===t.key&&W(null)},inputProps:{title:O||"",style:{fontSize:"0.875rem",padding:"7px 10px"}},sx:{flex:1,minWidth:{xs:120,sm:180},maxWidth:380}}),(0,a.jsx)(Y.A,{size:"small",disabled:!(O||"").trim()||Ve,onClick:()=>_e(e._raw),sx:{width:30,height:30,color:pt,flexShrink:0,"& svg":{fontSize:18},"&:hover":{color:vt,bgcolor:bt},"&.Mui-disabled":{color:xt}},children:(0,a.jsx)(Q.default,{})}),(0,a.jsx)(Y.A,{size:"small",onClick:()=>W(null),sx:{width:30,height:30,color:pt,flexShrink:0,"& svg":{fontSize:18},"&:hover":{color:At,bgcolor:yt}},children:(0,a.jsx)($.default,{})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:e.name||"",arrow:!0,children:(0,a.jsx)(g.A,{sx:{fontSize:"0.9rem",fontWeight:500,minWidth:0,flexShrink:1},noWrap:!0,children:e.name})}),r&&j&&(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:Ge("deviceFarmRename","Rename"),arrow:!0,placement:"top",children:(0,a.jsx)(Y.A,{size:"small",className:"node-rename-btn",onClick:()=>{var t;L((null===(t=e._raw)||void 0===t?void 0:t.name)||e.name||""),W(e.id)},sx:{width:28,height:28,flexShrink:0,color:pt,opacity:0,transition:"opacity .12s, color .12s, background-color .12s","& svg":{fontSize:16},"&:hover":{color:at,bgcolor:St},"&:focus-visible":{opacity:1}},children:(0,a.jsx)(J.default,{})})})]})]})}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5},children:(0,a.jsx)(Ue,{os:e.os,full:!0})}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5},children:e.agent?(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:t?"".concat(Ge("deviceFarmAgentUpdateAvailable","Update available \u2014 latest is")," v").
1concat(wt):Ge("deviceFarmAgentUpToDate","Up to date"),arrow:!0,children:(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-block",px:.7,py:.2,borderRadius:1,fontFamily:"monospace",fontSize:"0.75rem",lineHeight:1.6,whiteSpace:"nowrap",color:t?"#b45309":ct,bgcolor:t?"#fffbeb":ft,border:"1px solid ".concat(t?"#fde68a":mt)},children:["v",e.agent]})}):(0,a.jsx)(o.A,{component:"span",sx:{color:xt,fontSize:"0.85rem"},children:"\u2014"})}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5},children:(0,a.jsx)(Nt,{health:e.health})}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5},children:e.devices>0?(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,placement:"top",title:Ge("deviceFarmViewNodeDevices","View this node's devices"),arrow:!0,children:(0,a.jsxs)(o.A,{component:"button",type:"button",onClick:()=>b&&b(e._raw),sx:{display:"inline-flex",alignItems:"center",gap:.5,px:.9,py:.3,borderRadius:999,fontFamily:"inherit",fontSize:"0.8rem",fontWeight:700,lineHeight:1.4,color:at,bgcolor:St,border:"1px solid #dbeafe",cursor:"pointer",transition:"background-color .15s, border-color .15s, box-shadow .15s","&:hover":{bgcolor:"#dbeafe",borderColor:at},"&:focus-visible":{outline:"none",boxShadow:"0 0 0 3px ".concat(at,"33")}},children:[(0,a.jsx)(X.default,{sx:{fontSize:13}}),e.devices]})}):(0,a.jsx)(o.A,{component:"span",sx:{color:xt,fontSize:"0.85rem"},children:"\u2014"})}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5,color:null==e.monitoring?xt:ct,fontSize:"0.85rem"},children:null==e.monitoring?"\u2014":e.monitoring?Ge("deviceFarmEnabled","Enabled"):Ge("deviceFarmDisabled","Disabled")}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5},children:e.ip?(0,a.jsx)(q.A,{placement:"top",arrow:!0,title:Oe==="ip:".concat(e.id)?Ge("deviceFarmIpCopied","IP address copied to clipboard"):Ge("deviceFarmCopyIp","Copy IP address"),open:Oe==="ip:".concat(e.id)||Le==="ip:".concat(e.id),onOpen:()=>Be("ip:".concat(e.id)),onClose:()=>Be(null),enterDelay:1e3,enterNextDelay:1e3,children:(0,a.jsx)(o.A,{component:"span",onMouseLeave:()=>Be((t=>t==="ip:".concat(e.id)?null:t)),onClick:async()=>{try{await navigator.clipboard.writeText(e.ip),He("ip:".concat(e.id))}catch(t){}},sx:{display:"inline-block",fontFamily:"monospace",fontSize:"0.78rem",lineHeight:1.6,whiteSpace:"nowrap",color:Oe==="ip:".concat(e.id)?vt:dt,cursor:"pointer",transition:"color .15s","&:hover":{color:Oe==="ip:".concat(e.id)?vt:rt}},children:e.ip})}):(0,a.jsx)(o.A,{component:"span",sx:{color:xt},children:"\u2014"})}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5,color:"ONLINE"===e.status?ct:pt,fontSize:"0.85rem",whiteSpace:"nowrap"},children:e.hb}),(0,a.jsx)(o.A,{component:"td",sx:{px:2,py:1.5},children:pe?(0,a.jsx)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end"},children:(0,a.jsx)(q.A,{title:Ge("deviceFarmMore","More"),arrow:!0,placement:"top",enterDelay:600,children:(0,a.jsx)(Y.A,{size:"small",onClick:t=>fe({el:t.currentTarget,node:e}),sx:{width:32,height:32,borderRadius:1.5,color:pt,"&:hover":{bgcolor:ut,color:st},"& svg":{fontSize:18}},children:(0,a.jsx)(Se.default,{})})})}):(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:.25},children:[We("Node view",(0,a.jsx)(le.default,{}),(()=>(f||h)&&(f||h)(e._raw))),r&&We("Remote shell",(0,a.jsx)(ae.default,{}),(()=>A&&A(e._raw)),!A),Xe("id:".concat(e.id),Ge("deviceFarmCopyNodeId","Copy node ID"),Ge("deviceFarmNodeIdCopied","Node ID copied to clipboard"),(0,a.jsx)(re.default,{}),(()=>navigator.clipboard.writeText(String(e.id)))),r&&y&&Xe("key:".concat(e.id),Ge("deviceFarmCopyApiKey","Copy API key"),Ge("deviceFarmFarmKeyCopied","API key copied to clipboard"),(0,a.jsx)(se.default,{}),(()=>y(e._raw)))]})})]},e.id)})),0===ke.length&&(0,a.jsx)(o.A,{component:"tr",children:(0,a.jsx)(o.A,{component:"td",colSpan:10,sx:{py:5,textAlign:"center",color:pt,fontSize:"0.85rem"},children:Ge("deviceFarmNoNodeMatch","No node matches your search.")})})]})]})}),je.length>0&&(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:1.5,fontSize:"0.85rem"},children:[(0,a.jsx)(g.A,{sx:{color:dt,fontSize:"0.85rem"},children:"".concat(Ge("deviceFarmShowing","Showing")," ").concat(10*(z-1)+1,"\u2013").concat(Math.min(10*z,je.length)," ").concat(Ge("deviceFarmOfLower","of")," ").concat(je.length)}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,a.jsx)(F.A,{size:"small",disabled:z<=1,onClick:()=>I((e=>e-1)),sx:(0,i.A)((0,i.A)({},Mt),{},{minWidth:0,px:1}),children:"\u2039"}),Array.from({length:we},((e,t)=>t+1)).map((e=>(0,a.jsx)(F.A,{size:"small",onClick:()=>I(e),sx:{minWidth:30,px:.5,textTransform:"none",fontWeight:600,borderRadius:1.5,color:e===z?"#fff":ct,bgcolor:e===z?at:"transparent","&:hover":{bgcolor:e===z?at:ut}},children:e},e))),(0,a.jsx)(F.A,{size:"small",disabled:z>=we,onClick:()=>I((e=>e+1)),sx:(0,i.A)((0,i.A)({},Mt),{},{minWidth:0,px:1}),children:"\u203a"})]})]}),(0,a.jsx)(R.A,{anchorEl:V.el,open:"manage"===V.kind,onClose:De,slotProps:{paper:{sx:{width:256,borderRadius:2,mt:.5}}},children:Ct.filter((e=>!e.notif||qe)).map(((e,t)=>e.sep?(0,a.jsx)(D.A,{sx:{my:.5}},"s".concat(t)):(0,a.jsxs)(N.A,{onClick:()=>{De(),(e=>{const t=be.filter((e=>B.has(e.id))).map((e=>e._raw));u&&u(e,t)})(e.k)},sx:{fontSize:"0.85rem",gap:1.25,color:st,"& svg":{fontSize:18,color:pt}},children:[e.icon,Ge(e.tk,e.label)]},e.k)))}),(0,a.jsx)(R.A,{anchorEl:V.el,open:"states"===V.kind,onClose:De,slotProps:{paper:{sx:{width:240,borderRadius:2,mt:.5}}},children:zt.map(((e,t)=>e.sep?(0,a.jsx)(D.A,{sx:{my:.5}},"s".concat(t)):(0,a.jsxs)(N.A,{onClick:()=>
1{if(De(),"delete"===e.k)return void(()=>{const e=be.filter((e=>B.has(e.id))).map((e=>e._raw));m&&m(e,(()=>U(new Set)))})();const t={drain:"drain",resume:"resume",agent:"restart"};var n;t[e.k]&&(n=t[e.k],be.filter((e=>B.has(e.id))).map((e=>e._raw)).forEach((e=>x&&x(e,n))))},sx:{fontSize:"0.85rem",gap:1.25,color:e.danger?At:st,"& svg":{fontSize:18,color:e.danger?At:pt}},children:[e.icon,Ge(e.tk,e.label)]},e.k)))}),(0,a.jsx)(R.A,{anchorEl:V.el,open:"export"===V.kind,onClose:De,slotProps:{paper:{sx:{width:256,borderRadius:2,mt:.5}}},children:It.map((e=>(0,a.jsxs)(N.A,{disabled:e.needsSel&&0===Me,onClick:()=>(e=>{De();const t=["Name","OS","Agent","Health","Devices","Monitoring","IP address","Last heartbeat","Status"],n=[26,14,12,22,10,13,16,16,12],o=e=>[e.name,e.os,e.agent||"\u2014",et(e),e.devices,null==e.monitoring?"\u2014":e.monitoring?"Enabled":"Disabled",e.ip||"\u2014",e.hb,e.drain?"Draining":e.status],i="".concat(Ae.online," online \xb7 ").concat(Ae.draining," draining \xb7 ").concat(Ae.offline," offline \xb7 ").concat(Ae.devTotal," devices");if("nodes"===e){const e=be.map(o);$e("nodes.xlsx","Nodes","Node list","".concat(e.length," rows \xb7 ").concat(i),t,e,n)}else if("selected"===e){const e=be.filter((e=>B.has(e.id))).map(o);$e("nodes-selected.xlsx","Selected nodes","Selected nodes","".concat(e.length," selected \xb7 ").concat(i),t,e,n)}else if("farm"===e){const e=["Node","Node OS","Device","UDID","Model","Platform","OS version","Status"],t=[24,14,26,30,20,14,13,12],n=[];be.forEach((e=>{(c||[]).filter((t=>String(t.nodeId)===String(e.id)&&!/EMULATOR|SIMULATOR/i.test(t.deviceKind||""))).forEach((t=>n.push([e.name,e.os,t.displayName||t.name||t.udid,t.udid,t.model,t.platform,t.osVersion,t.status])))})),$e("nodes-real-devices.xlsx","Nodes + devices","Nodes + real devices","".concat(be.length," nodes \xb7 ").concat(n.length," real devices"),e,n,t)}})(e.k),sx:{fontSize:"0.85rem",gap:1.25,color:st,"& svg":{fontSize:18,color:pt}},children:[e.icon,Ge(e.tk,e.label),e.needsSel&&Me?" (".concat(Me,")"):""]},e.k)))}),(0,a.jsxs)(R.A,{anchorEl:ue.el,open:Boolean(ue.el),onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:220,borderRadius:2,mt:.5}}},children:[(0,a.jsxs)(N.A,{onClick:()=>{const e=ue.node;he(),e&&(f||h)&&(f||h)(e._raw)},sx:{fontSize:"0.85rem",gap:1.25,color:st,"& svg":{fontSize:18,color:pt,transition:"color .15s"},"&:hover":{color:rt,"& svg":{color:st}}},children:[(0,a.jsx)(le.default,{}),Ge("deviceFarmNodeView","Node view")]}),r&&(0,a.jsxs)(N.A,{disabled:!A,onClick:()=>{const e=ue.node;he(),e&&A&&A(e._raw)},sx:{fontSize:"0.85rem",gap:1.25,color:st,"& svg":{fontSize:18,color:pt,transition:"color .15s"},"&:hover":{color:rt,"& svg":{color:st}}},children:[(0,a.jsx)(ae.default,{}),Ge("deviceFarmRemoteShell","Remote shell")]}),Qe("menu:id:".concat(null===(t=ue.node)||void 0===t?void 0:t.id),Ge("deviceFarmCopyNodeId","Copy node ID"),Ge("deviceFarmNodeIdCopied","Node ID copied to clipboard"),(0,a.jsx)(re.default,{}),(()=>{var e;return navigator.clipboard.writeText(String(null===(e=ue.node)||void 0===e?void 0:e.id))})),r&&y&&Qe("menu:key:".concat(null===(l=ue.node)||void 0===l?void 0:l.id),Ge("deviceFarmCopyApiKey","Copy API key"),Ge("deviceFarmFarmKeyCopied","API key copied to clipboard"),(0,a.jsx)(se.default,{}),(()=>{var e;return y(null===(e=ue.node)||void 0===e?void 0:e._raw)}))]})]})}var Wt=n(641666);function Ot(e){let{open:t,onClose:n,onRefresh:l,existingNames:r=[]}=e;const[s,c]=(0,E.useState)({name:"",os:"LINUX"}),[d,p]=(0,E.useState)(!1),x=(0,B.Ay)(),m=E.useMemo((()=>new Set((r||[]).filter(Boolean).map((e=>String(e).trim().toLowerCase())))),[r]),u=s.name.trim(),f=u.length>0&&m.has(u.toLowerCase());(0,E.useEffect)((()=>{t&&(c({name:"",os:"LINUX"}),p(!1))}),[t]);const h=async()=>{var e;if(null!==(e=s.name)&&void 0!==e&&e.trim())if(f)(0,O.M8)(Ge("farmErrNodeNameTaken","A node with this name already exists in this company."),{variant:"warning"});else{p(!0);try{const e=await U.A.createNode((0,i.A)({name:s.name.trim(),os:s.os},null!=x?{companyId:x}:{}));let o=!1;const a=(null===e||void 0===e?void 0:e.registrationToken)||"";if(a)try{await navigator.clipboard.writeText(a),o=!0}catch(t){o=!1}(0,O.M8)(o?Ge("deviceFarmNodeCreatedKeyCopied","Node olu\u015fturuldu \u2014 API key panoya kopyaland\u0131"):Ge("deviceFarmNodeCreated","Node olu\u015fturuldu \u2014 API key\u2019i listeden kopyalayabilirsiniz"),{variant:"success"}),l&&l(),n&&n()}catch(o){(0,O.M8)((0,Wt.gt)(o,{fallbackKey:"deviceFarmNodeCreateError"}),{variant:(0,Wt.kL)(o)?"warning":"error"})}finally{p(!1)}}else(0,O.M8)(Ge("deviceFarmNodeNameRequired","Node name is required"),{variant:"warning"})},v={"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:_e.brand}},g={display:"flex",alignItems:"center",gap:1};return(0,a.jsxs)(j.A,{open:t,onClose:n,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:{xs:2,sm:3},m:{xs:1.5,sm:4},width:{xs:"calc(100% - 24px)",sm:"100%"}}}
1,children:[(0,a.jsx)(S.A,{sx:{fontWeight:800,color:_e.ink,pb:1,px:{xs:2,sm:3},fontSize:{xs:"1.05rem",sm:"1.25rem"}},children:Ge("deviceFarmEnrollTitle","Enroll a new node")}),(0,a.jsx)(w.A,{sx:{px:{xs:2,sm:3},"&&&":{pt:1.25}},children:(0,a.jsxs)(o.A,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},alignItems:{xs:"stretch",sm:"flex-start"},gap:{xs:2,sm:1.5},mt:.5},children:[(0,a.jsx)(o.A,{sx:{flex:{xs:"1 1 auto",sm:"1 1 60%"},minWidth:0},children:(0,a.jsx)(M.A,{label:Ge("name","Name"),value:s.name,onChange:e=>c((0,i.A)((0,i.A)({},s),{},{name:e.target.value})),onKeyDown:e=>{"Enter"!==e.key||d||h()},fullWidth:!0,autoFocus:!0,error:f,helperText:f?Ge("farmErrNodeNameTaken","A node with this name already exists in this company."):" ",sx:v})}),(0,a.jsx)(o.A,{sx:{flex:{xs:"1 1 auto",sm:"1 1 40%"},minWidth:0},children:(0,a.jsxs)(M.A,{select:!0,label:Ge("deviceFarmColOs","OS"),value:s.os,onChange:e=>c((0,i.A)((0,i.A)({},s),{},{os:e.target.value})),fullWidth:!0,sx:v,SelectProps:{sx:{"& .MuiSelect-select":{display:"flex",alignItems:"center",gap:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},children:[(0,a.jsxs)(N.A,{value:"LINUX",sx:g,children:[(0,a.jsx)(Be,{os:"LINUX",size:16}),Ge("deviceFarmOsLinux","Linux (Android emulator + USB)")]}),(0,a.jsxs)(N.A,{value:"MAC",sx:g,children:[(0,a.jsx)(Be,{os:"MAC",size:16}),Ge("deviceFarmOsMac","macOS (iOS + Android)")]}),(0,a.jsxs)(N.A,{value:"WINDOWS",sx:g,children:[(0,a.jsx)(Be,{os:"WINDOWS",size:16}),Ge("deviceFarmOsWindows","Windows")]})]})})]})}),(0,a.jsxs)(k.A,{sx:{px:{xs:2,sm:3},pb:{xs:2,sm:2.5},pt:0},children:[(0,a.jsx)(F.A,{onClick:n,sx:{textTransform:"none",color:_e.slate600},children:Ge("cancel","Cancel")}),(0,a.jsx)(F.A,{variant:"contained",disableElevation:!0,onClick:h,disabled:d||!s.name.trim()||f,sx:(0,i.A)((0,i.A)({},(0,lt.Mk)(_e.brand)),{},{minWidth:104}),children:Ge("create","Create")})]})]})}var Et=n(777782),Lt=n(408244),Bt=n(320188),Ut=n(585093),Pt=n(53777),Ht=n(96623),Vt=n(383094),Kt=n(450940),_t=n(194187),qt=n(737223),Yt=n(674535),Gt=n(262145),Xt=n(947728),Jt=n(881705),Qt=n(186423),$t=n(847832),Zt=n(901620);const en=["Google","Samsung","Apple","Xiaomi","Generic"];function tn(e,t){const n="".concat(e||""," ").concat(t||"").toLowerCase();return/pixel|nexus|google/.test(n)?"Google":/samsung|galaxy|sm-/.test(n)?"Samsung":/iphone|ipad|apple/.test(n)?"Apple":/xiaomi|redmi|poco|mi\s/.test(n)?"Xiaomi":"Generic"}const nn={active:{g:["#059669","#065f46"],dot:_e.emerald,text:_e.emeraldDk,label:"Busy",key:"deviceFarmStateBusy",tip:"Busy \u2014 a session is running",tipKey:"deviceFarmStateBusyTip"},idle:{g:["#0284c7","#075985"],dot:_e.sky,text:_e.skyDk,label:"Available",key:"deviceFarmStateAvailable",tip:"Available \u2014 ready to take a session",tipKey:"deviceFarmStateAvailableTip"},offline:{g:["#94a3b8","#475569"],dot:_e.slate400,text:_e.slate400,label:"Offline",key:"deviceFarmStateOffline",tip:"Offline \u2014 device not reachable",tipKey:"deviceFarmStateOfflineTip"}};function on(e){let{enabled:t=!0,gap:n=24}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const[o,i]=(0,E.useState)(null),l=(0,E.useCallback)((()=>{const o=e.current;if(!o||!t)return void i(null);const l=Math.max(220,Math.round(window.innerHeight-o.getBoundingClientRect().top-n));i((e=>e===l?e:l))}),[e,t,n]);return(0,E.useLayoutEffect)((()=>{var n;if(l(),!t)return;window.addEventListener("resize",l);const o="undefined"!==typeof ResizeObserver?new ResizeObserver(l):null;return o&&null!==(n=e.current)&&void 0!==n&&n.parentElement&&o.observe(e.current.parentElement),o&&document.body&&o.observe(document.body),()=>{window.removeEventListener("resize",l),o&&o.disconnect()}}),[l,t,e]),o}const ln="deviceFarm.devices.filters.v2",an="deviceFarm.devices.filterOpen.v1",rn="deviceFarm.devices.tagFilter.v1";function sn(e){const t=dn(rn);if(!t||"object"!==typeof t||Array.isArray(t))return[];const n=t[e];return Array.isArray(n)?n.filter((e=>null!=e&&""!==e)):[]}const cn={q:"",avail:"any",usage:Lt.bg,nodesSel:[],real:!0,emu:!1,brands:[],os:"any",osVer:"any",res:"any"};function dn(e){try{const t=window.localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(t){return null}}function pn(e,t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(n){}}const xn=Ye,mn=[["any","All"],["available","Available"],["busy","Busy"],["offline","Offline"]];function un(e){let{devices:t,nodes:n,focusNodeId:l,onFocusNodeApplied:r,sessionByDevice:s,onUseDevice:c,onDeviceAlerts:d,onDeviceDetails:p,onBulkInstall:x,onRefresh:m,onNotifications:u,notifCount:f=0}=e;const[h,v]=(0,E.useState)((()=>function(){const e=dn(ln);if(!e||"object"!==typeof e||Array.isArray(e))return null;const t=e=>Array.isArray(e)?e:[];return{q:"string"===typeof e.q?e.q:"",avail:(n=e.avail,o=["any","available","busy","offline"],i="any",o.includes(n)?n:i),usage:(0,Lt.P4)(e.usage)?e.usage:Lt.bg,nodesSel:new Set(t(e.nodesSel)),real:!0===e.real,emu:!0===e.emu,brands:new Set(t(e.brands).filter((e=>
1"string"===typeof e))),os:"string"===typeof e.os?e.os:"any",osVer:"string"===typeof e.osVer?e.osVer:"any",res:"string"===typeof e.res?e.res:"any"};var n,o,i}()||(0,i.A)((0,i.A)({},cn),{},{nodesSel:new Set,brands:new Set}))),[b,A]=(0,E.useState)((()=>{const e=dn(an);return"boolean"!==typeof e||e}));(0,E.useEffect)((()=>{pn(ln,{q:h.q,avail:h.avail,usage:h.usage,nodesSel:[...h.nodesSel],real:h.real,emu:h.emu,brands:[...h.brands],os:h.os,osVer:h.osVer,res:h.res})}),[h]),(0,E.useEffect)((()=>{pn(an,b)}),[b]);const y="undefined"!==typeof window&&"function"===typeof window.matchMedia,j=(0,E.useRef)(null),S=(0,E.useRef)(null),[w,k]=(0,E.useState)((()=>!y||window.matchMedia("(min-width:1200px)").matches));(0,E.useEffect)((()=>{if(!y)return;const e=window.matchMedia("(min-width:1200px)"),t=e=>k(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}),[y]);const F=on(j,{enabled:w,gap:18}),C=on(S,{enabled:w,gap:18}),[z,I]=(0,E.useState)(null),[N,R]=(0,E.useState)(null),[D,M]=(0,E.useState)((()=>sn("inc"))),[T,W]=(0,E.useState)((()=>sn("exc"))),O=(0,E.useMemo)((()=>(t||[]).map((e=>e.id)).filter((e=>null!=e))),[t]),{usedTags:L,getDeviceTagIds:B,linksByDevice:U,linksLoaded:P,refresh:H}=(0,Zt.A)(O);(0,E.useEffect)((()=>{pn(rn,{inc:D,exc:T})}),[D,T]),(0,E.useEffect)((()=>{if(!P)return;const e=new Set((L||[]).map((e=>String(e.id))));M((t=>t.every((t=>e.has(String(t))))?t:t.filter((t=>e.has(String(t)))))),W((t=>t.every((t=>e.has(String(t))))?t:t.filter((t=>e.has(String(t))))))}),[P,L]);const V=(0,E.useRef)(r);(0,E.useEffect)((()=>{V.current=r}),[r]),(0,E.useEffect)((()=>{var e;null!=l&&(v((e=>(0,i.A)((0,i.A)({},e),{},{nodesSel:new Set([l])}))),null===(e=V.current)||void 0===e||e.call(V))}),[l]);const _=(0,E.useMemo)((()=>Object.fromEntries((n||[]).map((e=>[e.id,e])))),[n]),q=(0,E.useMemo)((()=>(t||[]).map((e=>function(e,t){var n,o;const i=/EMULATOR|SIMULATOR/i.test(e.deviceKind||"")?"emulator":"real",l="IOS"===e.platform?"iOS":"ANDROID"===e.platform?"Android":e.platform||"\u2014",a=Object.keys(t||{}).length>0;return{uid:e.id,name:e.displayName||e.name||e.udid||"#".concat(e.id),udid:e.udid,model:e.model,node:(null===(n=t[e.nodeId])||void 0===n?void 0:n.name)||(a&&null!=e.nodeId?"#".concat(e.nodeId):"\u2014"),nodeId:e.nodeId,kind:i,os:l,osVer:e.osVersion||"",res:e.resolution||e.screenResolution||null,status:(r=e.status,"BUSY"===r?"active":"ONLINE"===r||"AVAILABLE"===r?"idle":"offline"),nodeOffline:"OFFLINE"===(null===(o=t[e.nodeId])||void 0===o?void 0:o.status),battery:"number"===typeof e.batteryLevel?e.batteryLevel:null,brand:tn(e.name,e.model),blocked:!!e.blocked,poolType:e.poolType,usageMode:(0,Lt.Sf)(e),raw:e};var r}(e,_)))),[t,_]),Y=e=>v((t=>(0,i.A)((0,i.A)({},t),e))),G=(0,E.useMemo)((()=>{let e=0;return"any"!==h.avail&&e++,h.usage!==Lt.bg&&e++,h.nodesSel.size&&e++,h.real&&e++,h.emu&&e++,e+=h.brands.size,"any"!==h.os&&e++,"any"!==h.osVer&&e++,"any"!==h.res&&e++,e}),[h]),J=D.length>0||T.length>0,Q=(0,E.useMemo)((()=>{const e=new Set;return q.forEach((t=>{"any"!==h.os&&t.os!==h.os||!t.osVer||e.add(t.osVer)})),[...e].sort(((e,t)=>parseFloat(t)-parseFloat(e)))}),[q,h.os]),ee=(0,E.useMemo)((()=>{const e=new Set;return q.forEach((t=>{t.res&&e.add(t.res)})),[...e].sort()}),[q]),te=(0,E.useMemo)((()=>{const e={available:"idle",busy:"active",offline:"offline"};return q.filter((t=>{if("any"!==h.avail&&t.status!==e[h.avail])return!1;if(h.usage!==Lt.bg&&(0,Lt.Sf)(t)!==h.usage)return!1;if(h.nodesSel.size&&!h.nodesSel.has(t.nodeId))return!1;if((h.real||h.emu)&&!(h.real&&"real"===t.kind||h.emu&&"emulator"===t.kind))return!1;if(h.brands.size&&!h.brands.has(t.brand))return!1;if("any"!==h.os&&t.os!==h.os)return!1;if("any"!==h.osVer&&String(t.osVer)!==String(h.osVer))return!1;if("any"!==h.res&&t.res!==h.res)return!1;if(h.q){const e=h.q.toLowerCase();if(![t.name,t.model,t.udid,t.node].some((t=>(t||"").toLowerCase().includes(e))))return!1}return!0})).sort(((e,t)=>("offline"===e.status?1:0)-("offline"===t.status?1:0)))}),[q,h]),ne=(0,E.useMemo)((()=>(0,Qt.J)(te,(e=>B(e.uid)),D,T)),[te,B,D,T]),oe=(0,E.useMemo)((()=>({total:q.length,avail:q.filter((e=>"idle"===e.status)).length,busy:q.filter((e=>"active"===e.status)).length,off:q.filter((e=>"offline"===e.status)).length})),[q]),ie=e=>{I(null);const t=[["Name","UDID","Model","Platform","OS","Kind","Node","Status"],...("all"===e?q:ne).map((e=>[e.name,e.udid,e.model,e.os,e.osVer,e.kind,e.node,nn[e.status].label]))].map((e=>e.map((e=>'"'.concat(String(null!==e&&void 0!==e?e:"").replace(/"/g,'""'),'"'))).join(","))).join("\n"),n=new Blob([t],{type:"text/csv"}),o=URL.createObjectURL(n),i=document.createElement("a");i.href=o,i.download="devices-".concat(e,".csv"),i.click(),URL.revokeObjectURL(o)},le=(0,a.jsx)(Ze,{segs:[{key:"available",label:Ge("deviceFarmStatAvailable","Available"),value:oe.avail,color:_e.sky},{key:"busy",label:Ge("deviceFarmStatBusy","Busy"),value:oe.busy,color:_e.emerald},{key:"offline",label:Ge("deviceFarmStatOffline","Offline"),value:oe.off,color:_e.slate400}],active:"any"===h.avail?null:h.avail,onSeg:e=>Y({avail:h.avail===e?"any":e}),right:(0,a.jsxs)(g.A,{component:"button",onClick:()=>Y({avail:"any"}),sx:{fontSize:"0.8125rem",fontWeight:"any"===h.avail?700:400,color:"any"===h.avail?_e.
1ink:_e.slate500,cursor:"pointer",background:"none",border:"none"},children:[oe.total," ",Ge("deviceFarmDevicesTotal","devices total")]})});return(0,a.jsxs)(o.A,{sx:{fontFamily:"Inter, sans-serif"},children:[(0,a.jsx)(o.A,{sx:{mb:2},children:le}),(0,a.jsxs)(o.A,{sx:{display:"flex",flexDirection:{xs:"column",lg:"row"},gap:{xs:2,lg:b?2:.75},alignItems:{xs:"stretch",lg:"flex-start"},minWidth:0},children:[b?(0,a.jsxs)(o.A,{sx:{width:{xs:"100%",lg:272},flexShrink:0,borderRadius:3,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff",display:"flex",flexDirection:"column",maxHeight:C?"".concat(C,"px"):"none",overflow:"hidden"},ref:S,children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1.5,borderBottom:"1px solid ".concat(_e.slate100)},children:[(0,a.jsxs)(o.A,{component:"span",style:{color:_e.slate800,fontWeight:700,fontSize:"0.8125rem"},sx:{display:"flex",alignItems:"center",gap:1},children:[(0,a.jsx)(Yt.default,{sx:{fontSize:16,color:_e.slate400}}),Ge("deviceFarmFilters","Filters")]}),(0,a.jsx)(Qe,{size:28,title:Ge("deviceFarmHide","Hide"),onClick:()=>A(!1),children:(0,a.jsx)(Gt.default,{})})]}),(0,a.jsxs)(o.A,{sx:(0,i.A)({p:2,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto"},xn),children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsx)(o.A,{component:"span",style:{color:_e.slate400,fontWeight:600,fontSize:"0.6875rem"},children:G?"".concat(G," ").concat(Ge("deviceFarmActive","active")):Ge("deviceFarmNoFilters","No filters")}),!!G&&(0,a.jsxs)(g.A,{component:"button",type:"button",onClick:()=>Y({avail:"any",usage:Lt.bg,nodesSel:new Set,real:!1,emu:!1,brands:new Set,os:"any",osVer:"any",res:"any"}),sx:{display:"inline-flex",alignItems:"center",gap:.35,px:.7,py:.2,borderRadius:999,fontFamily:"inherit",fontSize:"0.6875rem",fontWeight:700,lineHeight:1.35,color:_e.brand,bgcolor:"rgba(47,107,255,0.08)",border:"1px solid rgba(47,107,255,0.20)",cursor:"pointer",transition:"background-color .15s, border-color .15s","&:hover":{bgcolor:"rgba(47,107,255,0.16)",borderColor:_e.brand},"&:focus-visible":{outline:"none",boxShadow:"0 0 0 3px ".concat(_e.brand,"33")}},children:[(0,a.jsx)($.default,{sx:{fontSize:12}}),Ge("deviceFarmClearAll","Clear all")]})]}),(0,a.jsxs)(o.A,{children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterAvailability","Availability")}),(0,a.jsx)(tt,{options:mn.map((e=>{let[t,n]=e;return[t,Ge("deviceFarmAvail_".concat(t),n)]})),value:h.avail,onChange:e=>Y({avail:e})})]}),(0,a.jsxs)(o.A,{sx:{pt:1.5,borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterUsage","Usage")}),(0,a.jsx)(tt,{options:Lt.on.map((e=>{let[t,n]=e;return[t,Ge("deviceFarmUsage_".concat(t),n)]})),value:h.usage,onChange:e=>Y({usage:e})})]}),(n||[]).length>0&&(0,a.jsxs)(o.A,{sx:{pt:1.5,borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterNodes","Nodes")}),(0,a.jsx)(fn,{label:Ge("deviceFarmAllNodes","All nodes"),on:0===h.nodesSel.size,bold:!0,onClick:()=>Y({nodesSel:new Set})}),n.map((e=>(0,a.jsx)(fn,{label:e.name,on:h.nodesSel.has(e.id),onClick:()=>{const t=new Set(h.nodesSel);t.has(e.id)?t.delete(e.id):t.add(e.id),Y({nodesSel:t})}},e.id)))]}),(0,a.jsxs)(o.A,{sx:{pt:1.5,borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterType","Type")}),(0,a.jsx)(fn,{label:Ge("deviceFarmTypeReal","Real"),icon:(0,a.jsx)(X.default,{sx:{fontSize:16,color:_e.slate400}}),on:h.real,onClick:()=>Y({real:!h.real})}),(0,a.jsx)(fn,{label:Ge("deviceFarmTypeEmulator","Emulator"),icon:(0,a.jsx)(Ut.default,{sx:{fontSize:16,color:_e.slate400}}),on:h.emu,onClick:()=>Y({emu:!h.emu})})]}),(0,a.jsxs)(o.A,{sx:{pt:1.5,borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterBrand","Brand")}),(0,a.jsx)(o.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:en.map((e=>(0,a.jsx)(nt,{label:e,active:h.brands.has(e),onClick:()=>{const t=new Set(h.brands);t.has(e)?t.delete(e):t.add(e),Y({brands:t})}},e)))})]}),(0,a.jsxs)(o.A,{sx:{pt:1.5,borderTop:"1px solid ".concat(_e.slate100),display:"flex",flexDirection:"column",gap:1.25},children:[(0,a.jsxs)(o.A,{children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterOs","Operating system")}),(0,a.jsx)(ot,{value:h.os,onChange:e=>Y({os:e,osVer:"any"}),options:[["any",Ge("deviceFarmAnyOs","Any OS")],["Android","Android"],["iOS","iOS"]],icons:{Android:(0,a.jsx)(Pe.jE,{platform:"ANDROID",size:16}),iOS:(0,a.jsx)(Pe.jE,{platform:"IOS",size:16})}})]}),(0,a.jsxs)(o.A,{children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterOsVersion","OS version")}),(0,a.jsx)(ot,{value:h.osVer,onChange:e=>Y({osVer:e}),options:[["any",Ge("deviceFarmAnyVersion","Any version")],...Q.map((e=>[String(e),"".concat("any"===h.os?"":"".concat(h.os," ")).concat(e)
1]))],icons:"any"===h.os?void 0:Object.fromEntries(Q.map((e=>[String(e),(0,a.jsx)(Pe.jE,{platform:h.os,size:16},String(e))])))})]}),ee.length>0&&(0,a.jsxs)(o.A,{children:[(0,a.jsx)(et,{children:Ge("deviceFarmFilterResolution","Screen resolution")}),(0,a.jsx)(ot,{value:h.res,onChange:e=>Y({res:e}),options:[["any",Ge("deviceFarmAnyResolution","Any resolution")],...ee.map((e=>[e,e]))]})]})]})]})]}):(0,a.jsx)(Qe,{size:28,title:G?"".concat(Ge("deviceFarmShowFilters","Show filters")," (").concat(G,")"):Ge("deviceFarmShowFilters","Show filters"),onClick:()=>A(!0),sx:(0,i.A)({position:"relative",overflow:"visible",border:"1px solid ".concat(_e.slate200),bgcolor:"#fff",flexShrink:0,alignSelf:"flex-start",borderRadius:2,color:_e.slate500,transition:"color .15s, border-color .15s, background-color .15s","&:hover":{color:_e.brand,borderColor:_e.brand,bgcolor:"#eff6ff"}},G?{"&::after":{content:'""',position:"absolute",top:-3,right:-3,width:8,height:8,borderRadius:"50%",bgcolor:_e.brand,border:"2px solid #fff",boxSizing:"content-box",pointerEvents:"none"}}:{}),children:(0,a.jsx)(Yt.default,{sx:{fontSize:15}})}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,mb:2,flexWrap:"wrap"},children:[(0,a.jsx)(it,{value:h.q,onChange:e=>Y({q:e}),placeholder:Ge("deviceFarmSearchDevice","Search name / model / udid\u2026")}),(0,a.jsx)(o.A,{sx:{flex:1}}),(0,a.jsx)(Qe,{title:Ge("deviceFarmFilterByTags","Filter by tags"),onClick:e=>R(e.currentTarget),sx:(0,i.A)({"& svg":{fontSize:16},color:_e.slate400,position:"relative",overflow:"visible"},J?{"&::after":{content:'""',position:"absolute",top:2,right:2,width:8,height:8,borderRadius:"50%",bgcolor:_e.brand,border:"2px solid #fff",boxSizing:"content-box",pointerEvents:"none"}}:null),children:(0,a.jsx)(Xt.default,{})}),(0,a.jsx)(Jt.A,{open:Boolean(N),anchorEl:N,onClose:()=>R(null),tags:L,includeIds:D,excludeIds:T,onChange:(e,t)=>
1{M(e),W(t)},getText:K.A.getText}),m&&(0,a.jsx)(Xe,{icon:(0,a.jsx)(Z.default,{}),onClick:m,children:Ge("deviceFarmRefresh","Refresh")}),qe,(0,a.jsxs)(o.A,{sx:{position:"relative"},children:[(0,a.jsxs)(Xe,{icon:(0,a.jsx)(qt.default,{}),onClick:e=>I(e.currentTarget),children:[Ge("deviceFarmExport","Export")," \u25be"]}),z&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{onClick:()=>I(null),sx:{position:"fixed",inset:0,zIndex:20}}),(0,a.jsxs)(o.A,{sx:{position:"absolute",right:0,mt:1,width:240,bgcolor:"#fff",borderRadius:2.5,boxShadow:"0 12px 32px -12px rgba(15,23,42,.35)",border:"1px solid ".concat(_e.slate100),py:.75,zIndex:30},children:[(0,a.jsx)(hn,{onClick:()=>ie("filtered"),children:Ge("deviceFarmExportFiltered","Filtered results (.csv)")}),(0,a.jsx)(hn,{onClick:()=>ie("all"),children:Ge("deviceFarmExportAll","All devices (.csv)")})]})]})]}),(0,a.jsx)(o.A,{component:"span",sx:{width:"1px",height:24,bgcolor:_e.slate200,mx:.5}}),x&&(0,a.jsx)(Je,{icon:(0,a.jsx)(_t.default,{}),onClick:()=>x(ne.map((e=>e.raw))),children:Ge("deviceFarmBulkInstallBtn","Bulk install")})]}),(0,a.jsx)(g.A,{sx:{fontSize:"0.8125rem",color:_e.slate500,mb:1},children:ne.length?"".concat(Ge("deviceFarmShowing","Showing")," ").concat(ne.length," / ").concat(oe.total," ").concat(Ge("deviceFarmDevicesWord","devices")):Ge("deviceFarmNoResults","No results")}),ne.length?(0,a.jsx)(o.A,{sx:(0,i.A)((0,i.A)({display:"grid",maxHeight:F?"".concat(F,"px"):"none",overflowY:F?"auto":"visible",overflowX:"hidden",alignContent:"start",pr:{lg:.5}},xn),{},{gridTemplateColumns:{xs:"minmax(0,1fr)",md:"repeat(2, minmax(0,1fr))",xl:"repeat(3, minmax(0,1fr))"},gap:1.5,alignItems:"stretch"}),ref:j,children:ne.map((e=>(0,a.jsx)(vn,{d:e,holder:(s||{})[e.uid]||null,onUse:c,onAlerts:d,onDetails:p,tagLinks:U[String(e.uid)]||[],onTagsChanged:H},e.uid)))}):(0,a.jsxs)(o.A,{sx:{borderRadius:3,border:"1px dashed ".concat(_e.slate300),p:5,textAlign:"center",color:_e.slate400},children:[(0,a.jsx)(X.default,{sx:{fontSize:32,mb:1}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.875rem"},children:Ge("deviceFarmNoDevicesMatch","No devices match your filters.")})]})]})]})]})}function fn(e){let{label:t,icon:n,on:i,bold:l,onClick:r}=e;return(0,a.jsxs)(o.A,{component:"button",onClick:r,sx:{width:"100%",display:"flex",alignItems:"center",gap:1,py:.5,background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[(0,a.jsx)(o.A,{component:"span",sx:{width:16,height:16,flexShrink:0,borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:i?_e.brand:"transparent",border:i?"none":"1px solid ".concat(_e.slate300),color:"#fff",fontSize:11},children:i?"\u2713":""}),n,(0,a.jsx)(g.A,{component:"span",sx:{fontSize:"0.82rem",fontWeight:l?600:400,color:_e.slate700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]})}function hn(e){let{children:t,onClick:n}=e;return(0,a.jsx)(o.A,{component:"button",onClick:n,sx:{width:"100%",textAlign:"left",px:1.75,py:1,fontSize:"0.82rem",color:_e.slate700,background:"none",border:"none",cursor:"pointer","&:hover":{bgcolor:_e.slate50}},children:t})}function vn(e){var t;let{d:n,holder:l,onUse:r,onAlerts:s,onDetails:c,tagLinks:d,onTagsChanged:p}=e;const x=nn[n.status],m="offline"===n.status&&n.nodeOffline?Ge("deviceFarmStateNodeOffline","Node offline"):Ge(x.key,x.label),u="offline"===n.status&&n.nodeOffline?Ge("deviceFarmStateNodeOfflineTip","The node agent is not reporting to the backend \u2014 every device on this node is unreachable"):Ge(x.tipKey,x.tip),f="offline"===n.status&&n.nodeOffline,h=f?_e.amber:x.text,v={active:{bg:"#ecfdf5",bd:"#a7f3d0"},idle:{bg:"#eff6ff",bd:"#bae6fd"},offline:{bg:_e.slate50,bd:_e.slate200}},g=f?{bg:"#fffbeb",bd:"#fde68a"}:v[n.status]||v.offline,b="emulator"===n.kind,A=b?Ut.default:"iOS"===n.os?Bt.default:X.default,y="offline"===n.status,j=n.raw||{},S=j.busyReason?{kind:"RUN"===j.busyReason?"run":"user",label:j.busyOtherTenant?Ge("deviceFarmBusyOtherTenant","In use by another customer"):j.busyMine?Ge("deviceFarmBusyByYou","You are using it right now"):j.busyHolder||("RUN"===j.busyReason?Ge("deviceFarmBusyHolderRun","In use by a test run"):Ge("deviceFarmBusyUnknownHolder","User unknown")),startedAt:j.busySince||null,mine:Boolean(j.busyMine),live:"INTERACTIVE"===j.busyReason}:null,w=S&&S.live?S:l||S,k=function(e){if(!e)return null;const t=new Date(e).getTime();if(!t||Number.isNaN(t))return null;const n=Math.floor((Date.now()-t)/6e4);if(n<1)return null;if(n<60)return"".concat(n,"m");const o=Math.floor(n/60);return o<24?"".concat(o,"h"):"".concat(Math.floor(o/24),"d")}(w&&w.startedAt||(null===(t=n.raw)||void 0===t?void 0:t.lastSeenAt)),F=w&&"run"===w.kind?Vt.default:Kt.default;return(0,a.jsxs)(o.A,{sx:{borderRadius:3,border:"1px solid ".concat(_e.slate200),bgcolor:y?_e.slate50:"#fff",p:{xs:1.5,sm:2},display:"flex",gap:{xs:1.25,sm:2},alignItems:"stretch",height:"100%",minWidth:0,transition:"box-shadow .15s, border-color .15s","&:hover":{boxShadow:"0 8px 20px -14px rgba(15,23,42,.3)",borderColor:_e.slate300}},children:[(0,a.jsxs)(o.A,{sx:{position:"relative",opacity:y?.75:1,width:{xs:64,sm:84},minHeight:{xs:128,sm:168},maxHeight:190,my:"auto",borderRadius:"16px",flexShrink:0,overflow:"hidden",boxShadow:"inset 0 2px 6px rgba(0,0,0,.25)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.75,background:"linear-gradient(160deg, ".concat(x.g[0],", ").concat(x.g[1],")")},children:[(0,a.jsx)(o.A,{sx:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",width:30,height:3.5,bgcolor:"rgba(255,255,255,.3)",borderRadius:2}}),(0,a.jsx)(A,{sx:{fontSize:28,color:"rgba(255,255,255,.7)"}}),(0,a.jsx)(o.A,{component:"span",style:{color:"rgba(255,255,255,.92)"},sx:{fontSize:"0.85rem",fontWeight:700,lineHeight:1},children:String(n.osVer||"").split(".")[0]}),n.res&&(0,a.jsx)(o.A,{component:"span",title:n.res,style:{color:"#fff"},sx:{position:"absolute",bottom:6,left:"50%",transform:"translateX(-50%)",maxWidth:"calc(100% - 8px)",overflow:"hidden",
1whiteSpace:"nowrap",fontSize:"0.6rem",lineHeight:1.4,fontFamily:"monospace",letterSpacing:"-0.02em",px:.6,py:"1px",borderRadius:.75,bgcolor:"rgba(15,23,42,.45)"},children:n.res})]}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:u,arrow:!0,children:(0,a.jsx)(o.A,{sx:(0,i.A)({width:8,height:8,borderRadius:"50%",bgcolor:f?_e.amber:x.dot,flexShrink:0},"active"===n.status&&{animation:"dfPulse 1.5s ease-in-out infinite","@keyframes dfPulse":{"0%,100%":{opacity:1},"50%":{opacity:.35}}})})}),(0,a.jsx)(o.A,{component:"span",style:{fontWeight:700,fontSize:"1rem",color:_e.slate800},sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3},title:n.name,children:n.name}),(0,a.jsx)(Et.A,{value:n.udid,disabled:!n.udid,variant:"boxed",accent:"green",buttonSize:24,iconSize:14,copyLabel:Ge("deviceFarmCopyUdid","Copy device UDID"),wrapperSx:{flexShrink:0},tooltipProps:{enterDelay:1e3,enterNextDelay:1e3}}),(0,a.jsx)(o.A,{sx:{flex:1}})]}),(0,a.jsx)(o.A,{sx:{display:"flex",mb:1},children:(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:u,arrow:!0,children:(0,a.jsxs)(o.A,{component:"span",style:{color:h,fontWeight:700,fontSize:"0.75rem"},sx:{display:"inline-flex",alignItems:"center",gap:.6,maxWidth:"100%",px:.9,py:.35,borderRadius:999,bgcolor:g.bg,border:"1px solid ".concat(g.bd),overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,a.jsx)(o.A,{component:"span",sx:(0,i.A)({width:7,height:7,borderRadius:"50%",flexShrink:0,bgcolor:f?_e.amber:x.dot},"active"===n.status&&{animation:"dfPulse 1.5s ease-in-out infinite","@keyframes dfPulse":{"0%,100%":{opacity:1},"50%":{opacity:.35}}})}),m,n.blocked?" \xb7 ".concat(Ge("deviceFarmBlocked","blocked")):"",k?" \xb7 ".concat(k," ").concat(Ge("deviceFarmAgo","ago")):""]})})}),(0,a.jsxs)(o.A,{sx:{display:"flex",flexWrap:"wrap",gap:.6,mb:1},children:[(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5,fontSize:"0.72rem",border:"1px solid ".concat(_e.slate200),borderRadius:.75,px:.9,py:.35,color:_e.slate600,whiteSpace:"nowrap"},children:[(0,a.jsx)(Pe.jE,{platform:n.os,size:13}),n.os," ",n.osVer]}),(0,a.jsx)(o.A,{component:"span",sx:(0,i.A)({fontSize:"0.72rem",borderRadius:.75,px:.9,py:.35},b?{border:"1px solid ".concat(_e.slate200),color:_e.slate500}:{border:"1px solid #a7f3d0",color:_e.emeraldDk,bgcolor:"#ecfdf5"}),children:b?Ge("deviceFarmEmulator","emulator"):Ge("deviceFarmReal","real")}),(0,Lt.Ez)(n.usageMode)&&(0,a.jsx)(o.A,{component:"span",title:Ge(Lt.i2[n.usageMode],""),sx:{fontSize:"0.72rem",borderRadius:.75,px:.9,py:.35,border:"1px solid ".concat(Lt.jW[n.usageMode].bd),color:Lt.jW[n.usageMode].fg,bgcolor:Lt.jW[n.usageMode].bg},children:Ge((0,Lt.KB)(n.usageMode),n.usageMode===Lt.Ay.AUTOMATION?"automation":"manual")})]}),(0,a.jsx)(o.A,{sx:{fontSize:"0.8rem",color:_e.slate500,display:"flex",flexDirection:"column",gap:.4},children:(0,a.jsx)(o.A,{sx:{display:"flex",alignItems:"center",minHeight:26},children:(0,a.jsx)($t.A,{deviceId:n.uid,links:d,onChanged:p})})}),w&&w.label&&(0,a.jsxs)(o.A,{title:w.label,sx:{mt:"auto",mb:1,display:"flex",alignItems:"center",gap:.75,minWidth:0,px:1,py:.6,borderRadius:1.5,border:"1px solid ".concat(w.mine?"#a7f3d0":_e.slate200),bgcolor:w.mine?"#ecfdf5":_e.slate50},children:[(0,a.jsx)(F,{sx:{fontSize:16,color:w.mine?_e.emeraldDk:_e.slate400,flexShrink:0}}),(0,a.jsx)(o.A,{component:"span",style:{color:w.mine?_e.emeraldDk:_e.slate600,fontSize:"0.78rem",fontWeight:600},sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.live&&(0,a.jsx)(o.A,{component:"span",style:{color:_e.slate500,fontSize:"0.7rem"},sx:{flexShrink:0,ml:"auto"},children:Ge("deviceFarmBusyHolderLive","In live use")})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75,mt:w&&w.label?0:"auto",pt:w&&w.label?0:1.5},children:[(0,a.jsxs)(o.A,{component:"button",onClick:e=>y?c&&c(n.raw,e.currentTarget):r?r(n.raw):c&&c(n.raw,e.currentTarget),sx:{flex:1,color:_e.brand,border:"1px solid ".concat(_e.brand),fontSize:"0.85rem",fontWeight:600,px:1,py:1,borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",gap:.6,background:"none",cursor:"pointer","&:hover":{bgcolor:"#eff6ff"}},children:[y?(0,a.jsx)(Pt.default,{sx:{fontSize:17}}):(0,a.jsx)(ve.default,{sx:{fontSize:17}}),y?Ge("deviceFarmDetails","Details"):Ge("deviceFarmUseDevice","Use device")]}),qe]})]})]})}var gn=n(171525),bn=n(446639),An=n(381095),yn=n(268354),jn=n(660158),Sn=n(144813),wn=n(416335),kn=n(710734),Fn=n(487305),Cn=n(96319),zn=n(534478),In=n(134904),Nn=n(111963),Rn=n(742324),Dn=n(953227),Mn=n(794310),Tn=n(225169),Wn=n(587866),On=n(841328),En=n(327835);const Ln=(e,t)=>{const n=K.A.getText(e);return n&&n!==e?n:t},Bn="#2f6bff",Un="#0f172a",Pn="#334155",Hn="#64748b",Vn="#94a3b8",Kn="#cbd5e1",_n="#e2e8f0",qn="#f1f5f9",Yn="#f8fafc",Gn="#10b981",Xn="#f43f5e",Jn="#f59e0b",Qn="#0d1526",$n="#f1f5f9",Zn="#cbd5e1",eo="#94a3b8",to="#64748b";function no(e){let{values:t,color:n,height:o=26}=e;const i=120,l=36;if(!t||t.length<2)return(0,a.jsx)("svg",{viewBox:"0 0 ".concat(i," ").concat(l),preserveAspectRatio:"none",style:{width:"100%",height:o},children:(0,a.jsx)("line",{x1:"0",y1:18,x2:i,y2:18,stroke:"#cbd5e1",strokeWidth:"2",strokeDasharray:"4 5",vectorEffect:"non-scaling-stroke"})});const r=Math.min(...t),s=Math.max(...t)-r||1,c=t.length,d=t.map(((e,t)=>
1[3+t/(c-1)*114,3+30*(1-(e-r)/s)])).map(((e,t)=>"".concat(t?"L":"M"," ").concat(e[0].toFixed(1)," ").concat(e[1].toFixed(1)))).join(" "),p="df-spark-".concat(n.replace("#",""));return(0,a.jsxs)("svg",{viewBox:"0 0 ".concat(i," ").concat(l),preserveAspectRatio:"none",style:{width:"100%",height:o},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0",stopColor:n,stopOpacity:"0.22"}),(0,a.jsx)("stop",{offset:"1",stopColor:n,stopOpacity:"0"})]})}),(0,a.jsx)("path",{d:"".concat(d," L ").concat(117," ").concat(l," L ").concat(3," ").concat(l," Z"),fill:"url(#".concat(p,")")}),(0,a.jsx)("path",{d:d,fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})}const oo=[{key:"cpu",type:"chart",label:"CPU",unit:"%",tint:Bn,icon:(0,a.jsx)(Dn.default,{}),get:e=>e.hostCpu},{key:"gpu",type:"chart",label:"GPU",unit:"%",tint:"#8b5cf6",icon:(0,a.jsx)(Mn.default,{}),get:e=>e.hostGpu},{key:"mem",type:"chart",label:"Memory",unit:"%",tint:Gn,icon:(0,a.jsx)(Tn.default,{}),get:e=>e.hostMemPct},{key:"connected",type:"stat",label:"Connected devices",tint:"#0ea5e9",icon:(0,a.jsx)(X.default,{}),sub:"connected",getStat:e=>e.filter((e=>"ONLINE"===e.status||"BUSY"===e.status)).length},{key:"emulators",type:"stat",label:"Running emulators",tint:"#8b5cf6",icon:(0,a.jsx)(Wn.default,{}),sub:"running",getStat:e=>e.filter((e=>/EMULATOR|SIMULATOR/i.test(e.deviceKind||"")&&("ONLINE"===e.status||"BUSY"===e.status))).length}],io=[{key:"agent",label:"Node agent",local:!0},{key:"appium",label:"Appium",healthKey:"appium",kind:"appium"},{key:"info",label:"Info",info:!0}];function lo(e){if(null===e||void 0===e||!e.lastHeartbeatAt)return"\u2014";const t=new Date(e.lastHeartbeatAt),n=Math.max(0,(Date.now()-t.getTime())/1e3);return n<60?"just now":n<3600?"".concat(Math.floor(n/60)," min ago"):n<86400?"".concat(Math.floor(n/3600)," h ago"):"".concat(Math.floor(n/86400)," d ago")}function ao(e){var t,n,l;let{open:r,node:s,devices:c,onClose:d,onOpenDevices:p,onRename:x}=e;const m=(0,B.Ay)(),[u,f]=(0,E.useState)(!1),[h,v]=(0,E.useState)(!1),b=async()=>{const e=(A||"").trim();if(e&&!h){v(!0);try{!1!==await x(s,e)&&f(!1)}finally{v(!1)}}},[A,y]=(0,E.useState)(""),[S,w]=(0,E.useState)("right"),[k,F]=(0,E.useState)("agent"),[C,z]=(0,E.useState)(""),[I,D]=(0,E.useState)(!1),[T,W]=(0,E.useState)(null),[O,L]=(0,E.useState)({cpu:!0,gpu:!0,mem:!0,connected:!0,emulators:!0}),[P,H]=(0,E.useState)({cpu:[],gpu:[],mem:[]}),[V,K]=(0,E.useState)(null),[_,X]=(0,E.useState)(null),[$,Z]=(0,E.useState)(""),[te,oe]=(0,E.useState)(""),[ie,le]=(0,E.useState)(""),[ae,re]=(0,E.useState)(!1),se=(0,E.useRef)(null),ce=(0,E.useRef)(null),de=async e=>{if(null!==s&&void 0!==s&&s.id){Z(e),oe("");try{await U.A.sendNodeCommand(s.id,e),oe({appium_start:Ln("deviceFarmAppiumStartSent","Appium ba\u015flatma komutu g\xf6nderildi."),appium_stop:Ln("deviceFarmAppiumStopSent","Appium durdurma komutu g\xf6nderildi."),appium_restart:Ln("deviceFarmAppiumRestartSent","Appium yeniden ba\u015flatma komutu g\xf6nderildi.")}[e]||Ln("deviceFarmCommandSent","Komut g\xf6nderildi."))}catch(t){oe(Ln("deviceFarmCommandFailed","Komut g\xf6nderilemedi."))}finally{Z("")}}},pe={width:26,height:26,color:Hn,"& svg":{fontSize:15},"&:hover":{color:Pn,bgcolor:qn}},xe=V||(null===s||void 0===s?void 0:s.health)||{},me=(0,E.useMemo)((()=>(c||[]).filter((e=>String(e.nodeId)===String(null===s||void 0===s?void 0:s.id)))),[c,null===s||void 0===s?void 0:s.id]),ue="ONLINE"===(null===s||void 0===s?void 0:s.status)||"MAINTENANCE"===(null===s||void 0===s?void 0:s.status),fe=!!xe.draining||"MAINTENANCE"===(null===s||void 0===s?void 0:s.status),he="appium"===k?!!xe.appium:ue,ve="appium"===k,be="appium_start"===$||"appium_stop"===$,Ae=ve?he?Ln("deviceFarmAppiumStop","Appium durdur"):Ln("deviceFarmAppiumStart","Appium ba\u015flat"):Ln("deviceFarmAgentToggleNa","Node agent uzaktan ba\u015flat\u0131l\u0131p durdurulamaz \u2014 yeniden ba\u015flatmak i\xe7in \u21bb kullan\u0131n"),ye={bgcolor:"#0d1526",color:"#cbd5e1",borderRadius:2,p:1.5,height:"bottom"===S?"30vh":"full"===S?"54vh":"calc(100vh - 470px)",minHeight:260,overflowY:"auto",fontFamily:"ui-monospace, Menlo, Consolas, monospace",fontSize:"0.72rem",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},je=(e,t,n,i)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,mb:1},children:[(0,a.jsxs)(o.A,{sx:{display:"inline-flex",alignItems:"center",gap:.6,fontSize:"0.75rem",fontWeight:700,color:e?Gn:Xn},children:[(0,a.jsx)(o.A,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:e?Gn:Xn}}),e?t:n]}),i?(0,a.jsxs)(g.A,{sx:{fontSize:"0.72rem",color:Hn},children:["\xb7 ",i]}):null]}),Se=(0,E.useMemo)((()=>async()=>
1{if(null!==s&&void 0!==s&&s.id){D(!0);try{U.A.requestNodeLogs(s.id).catch((()=>{}));const e=await U.A.getNodeLogs(s.id);z("string"===typeof e?e:(null===e||void 0===e?void 0:e.logsText)||(null===e||void 0===e?void 0:e.logs)||"")}catch(e){z("")}finally{D(!1)}}}),[null===s||void 0===s?void 0:s.id]);if((0,E.useEffect)((()=>{r&&null!==s&&void 0!==s&&s.id&&"agent"===k&&Se()}),[r,null===s||void 0===s?void 0:s.id,k,Se]),(0,E.useEffect)((()=>{se.current&&(se.current.scrollTop=se.current.scrollHeight)}),[C]),(0,E.useEffect)((()=>{if(!r||"appium"!==k||null===s||void 0===s||!s.id)return;let e=!0;const t=async()=>{if(e){re(!0);try{const t=await U.A.getNodeAppiumLog(s.id);e&&le("string"===typeof(null===t||void 0===t?void 0:t.log)?t.log:"")}catch(t){}finally{e&&re(!1)}}};t();const n=setInterval(t,3e3);return()=>{e=!1,clearInterval(n)}}),[r,k,null===s||void 0===s?void 0:s.id]),(0,E.useEffect)((()=>{ce.current&&(ce.current.scrollTop=ce.current.scrollHeight)}),[ie]),(0,E.useEffect)((()=>{r&&(w("right"),F("agent"),H({cpu:[],gpu:[],mem:[]}),K(null))}),[r,null===s||void 0===s?void 0:s.id]),(0,E.useEffect)((()=>{if(!r||null===s||void 0===s||!s.id||!m)return;let e=!0;const t=e=>{e&&H((t=>{const n=(e,t)=>null==t||Number.isNaN(Number(t))?e:[...e,Number(t)].slice(-24);return{cpu:n(t.cpu,e.hostCpu),gpu:n(t.gpu,e.hostGpu),mem:n(t.mem,e.hostMemPct)}}))};t(s.health);const n=setInterval((async()=>{try{const n=await U.A.listNodes(m),o=(Array.isArray(n)?n:(null===n||void 0===n?void 0:n.data)||(null===n||void 0===n?void 0:n.nodes)||[]).find((e=>String(e.id)===String(s.id)));e&&null!==o&&void 0!==o&&o.health&&(t(o.health),K(o.health))}catch(n){}}),5e3);return()=>{e=!1,clearInterval(n)}}),[r,null===s||void 0===s?void 0:s.id,m]),!s)return null;const we="bottom"===S?"bottom":"left"===S?"left":"right",Fe="full"===S?{width:"100vw",height:"100vh"}:"bottom"===S?{height:440,width:"100vw"}:{width:620,maxWidth:"96vw",height:"100vh"},Ce=(e,t,n)=>(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:t,arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:()=>w(e),sx:{width:30,height:30,borderRadius:1.5,color:S===e?Bn:Hn,bgcolor:S===e?"#e0edff":"transparent","&:hover":{bgcolor:S===e?"#e0edff":qn},"& svg":{fontSize:17}},children:n})}),ze=e=>null==e||""===e?"\u2014":e,Ie=null!=xe.hostMemTotalMb?"".concat((xe.hostMemTotalMb/1024).toFixed(0)," GB \xb7 ").concat(ze(xe.hostMemPct),"% used"):"\u2014",Ne=null!=xe.hostDiskTotalGb?"".concat(xe.hostDiskTotalGb," GB \xb7 ").concat(ze(xe.hostDiskPct),"% used"):"\u2014",Re=[{g:Ln("deviceFarmInfoSystem","System"),rows:[{l:Ln("deviceFarmInfoHostname","Hostname"),v:s.hostName||s.name||"#".concat(s.id),mono:!0},{l:Ln("deviceFarmInfoStatus","Status"),v:ue?fe?"Draining":"Online":"Offline"},{l:Ln("deviceFarmInfoOs","OS"),v:s.os||"\u2014"},{l:Ln("deviceFarmInfoScheduling","Scheduling"),v:ue?fe?"Draining (no new sessions)":"Accepting sessions":"\u2014"},{l:Ln("deviceFarmInfoMonitoring","Monitoring"),v:"boolean"===typeof xe.monitoring?xe.monitoring?"Enabled":"Disabled":"\u2014"},{l:Ln("deviceFarmInfoIp","IP address"),v:ze(xe.ip),mono:!0},{l:Ln("deviceFarmInfoHeartbeat","Last heartbeat"),v:lo(s)}]},{g:Ln("deviceFarmInfoHardware","Hardware"),rows:[{l:Ln("deviceFarmInfoCpuLoad","CPU load"),v:null!=xe.hostCpu?"".concat(xe.hostCpu,"%"):"\u2014"},{l:Ln("deviceFarmInfoMemory","Memory"),v:Ie},{l:Ln("deviceFarmInfoGpuLoad","GPU load"),v:null!=xe.hostGpu?"".concat(xe.hostGpu,"%"):"\u2014"},{l:Ln("deviceFarmInfoDisk","Disk"),v:Ne}]},{g:Ln("deviceFarmInfoRuntime","Runtime"),rows:[{l:Ln("deviceFarmInfoAgent","Agent version"),v:xe.agentVersion?"df-agent v".concat(xe.agentVersion):"\u2014",mono:!0},{l:Ln("deviceFarmInfoAppium","Appium"),v:ze(xe.appiumVersion),mono:!0},{l:Ln("deviceFarmInfoAdb","ADB"),v:ze(xe.adbVersion),mono:!0},{l:Ln("deviceFarmInfoNodeJs","Node.js"),v:ze(xe.nodeVersion),mono:!0},{l:Ln("deviceFarmInfoConnectedDevices","Connected devices"),v:String(null!==(t=s.deviceCount)&&void 0!==t?t:0)}]}];return(0,a.jsxs)(gn.Ay,{anchor:we,open:r,onClose:d,PaperProps:{sx:(0,i.A)((0,i.A)({},Fe),{},{fontFamily:"Inter, sans-serif",display:"flex",flexDirection:"column"})},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.5,borderBottom:"1px solid ".concat(_n)},children:[(0,a.jsx)(o.A,{sx:{width:9,height:9,borderRadius:"50%",bgcolor:ue?fe?Jn:Gn:Vn,flexShrink:0}}),(0,a.jsxs)(o.A,{sx:{minWidth:0,flex:1},children:[u&&x?(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,a.jsx)(M.A,{autoFocus:!0,size:"small",value:A,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&b(),"Escape"===e.key&&f(!1)},inputProps:{title:A||"",style:{fontSize:"0.9rem",fontWeight:700,padding:"4px 8px"}},sx:{minWidth:180}}),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,t
1itle:Ln("save","Kaydet"),arrow:!0,children:(0,a.jsx)("span",{children:(0,a.jsx)(Y.A,{size:"small",disabled:!(A||"").trim()||h,onClick:b,sx:{width:26,height:26,"& svg":{fontSize:16}},children:(0,a.jsx)(Q.default,{})})})}),(0,a.jsx)(Y.A,{size:"small",onClick:()=>f(!1),sx:{width:26,height:26,"& svg":{fontSize:16}},children:(0,a.jsx)(Cn.default,{})})]}):(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.5,minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.95rem",fontWeight:700,color:Un,lineHeight:1.15},noWrap:!0,children:s.name||"#".concat(s.id)}),x&&(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ln("deviceFarmNodeRenameTooltip","Ad\u0131 de\u011fi\u015ftir"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:()=>{y(s.name||""),f(!0)},sx:{width:24,height:24,color:Vn,"& svg":{fontSize:14}},children:(0,a.jsx)(J.default,{})})})]}),(0,a.jsxs)(g.A,{sx:{fontSize:"0.72rem",color:Hn},noWrap:!0,children:["Node #",s.id," \xb7 ",s.os||"\u2014"," \xb7"," ",ue?fe?Ln("deviceFarmStateDraining","draining"):Ln("deviceFarmStateOnline","online"):Ln("deviceFarmStateOffline","offline")," ","\xb7 ",Ln("deviceFarmLastHeartbeatLower","last heartbeat")," ",lo(s)]})]}),Ce("left",Ln("deviceFarmDockLeft","Sola yasla"),(0,a.jsx)(zn.default,{})),Ce("bottom",Ln("deviceFarmDockBottom","Alta yasla"),(0,a.jsx)(In.default,{})),Ce("right",Ln("deviceFarmDockRight","Sa\u011fa yasla"),(0,a.jsx)(zn.default,{sx:{transform:"scaleX(-1)"}})),Ce("full",Ln("deviceFarmDockFull","Tam ekran"),(0,a.jsx)(Nn.default,{})),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ln("deviceFarmClose","Close"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:d,sx:{width:30,height:30,color:Hn,"& svg":{fontSize:18}},children:(0,a.jsx)(Cn.default,{})})})]}),(0,a.jsxs)(o.A,{sx:{flex:1,overflowY:"auto",p:2},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.68rem",fontWeight:700,letterSpacing:"0.06em",color:Vn},children:Ln("deviceFarmSectionOverview","GENERAL OVERVIEW")}),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ln("deviceFarmCustomizeCards","Kartlar\u0131 \xf6zelle\u015ftir"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:e=>W(e.currentTarget),sx:{width:28,height:28,color:Hn,"& svg":{fontSize:16}},children:(0,a.jsx)(ee.default,{})})})]}),!oo.some((e=>O[e.key]))&&(0,a.jsx)(o.A,{sx:{mb:2,px:1.5,py:1.25,borderRadius:2,border:"1px dashed ".concat(_n),bgcolor:Yn},children:(0,a.jsx)(o.A,{component:"span",style:{color:Vn,fontSize:"0.78rem"},children:Ln("deviceFarmNoMetricSelected","Metrik se\xe7ilmedi \u2014 g\xf6stermek istedi\u011finiz kartlar\u0131 sa\u011f \xfcstteki \xf6zelle\u015ftir men\xfcs\xfcnden se\xe7in.")})}),(0,a.jsx)(o.A,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:1,mb:oo.some((e=>O[e.key]))?2:0},children:oo.filter((e=>O[e.key])).map((e=>{if("stat"===e.type){const t=ue?e.getStat(me):null,n=null!=t;return(0,a.jsxs)(ke.A,{onClick:()=>{p&&(p(s),d&&d())},focusRipple:!0,sx:{display:"block",textAlign:"left",width:"100%",border:"1px solid rgba(226,232,240,.85)",borderRadius:2,bgcolor:"#fff",p:1.25,minWidth:0,transition:"transform .15s ease, box-shadow .15s ease, border-color .15s ease","&:hover":{transform:"translateY(-2px)",borderColor:e.tint,boxShadow:"0 6px 18px -10px rgba(15,23,42,.35)"}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75,mb:.75,width:"100%"},children:[(0,a.jsx)(o.A,{sx:{width:20,height:20,borderRadius:1.25,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"".concat(e.tint,"14"),color:e.tint,flexShrink:0,"& svg":{fontSize:12}},children:e.icon}),(0,a.jsx)(g.A,{sx:{fontSize:"0.625rem",fontWeight:500,color:Hn},noWrap:!0,children:Ln("deviceFarmCard_".concat(e.key),e.label)})]}),(0,a.jsxs)(g.A,{sx:{fontSize:"1rem",fontWeight:700,color:n?Un:Kn,lineHeight:1,letterSpacing:"-0.01em"},children:[n?t:"\u2014",n&&(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.6875rem",fontWeight:600,ml:.5,color:Vn}
1,children:Ln("deviceFarmCardSub_".concat(e.key),e.sub)})]})]},e.key)}const t=ue?e.get(xe):null,n=null!=t;return(0,a.jsxs)(ke.A,{onClick:()=>X(e.key),focusRipple:!0,sx:{display:"block",textAlign:"left",width:"100%",border:"1px solid rgba(226,232,240,.85)",borderRadius:2,bgcolor:"#fff",p:1.25,minWidth:0,transition:"transform .15s ease, box-shadow .15s ease, border-color .15s ease","&:hover":{transform:"translateY(-2px)",borderColor:e.tint,boxShadow:"0 6px 18px -10px rgba(15,23,42,.35)"},"&:hover .nv-mcard-max":{color:Hn}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75,mb:.75,width:"100%"},children:[(0,a.jsx)(o.A,{sx:{width:20,height:20,borderRadius:1.25,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"".concat(e.tint,"14"),color:e.tint,flexShrink:0,"& svg":{fontSize:12}},children:e.icon}),(0,a.jsx)(g.A,{sx:{fontSize:"0.625rem",fontWeight:500,color:Hn},noWrap:!0,children:e.label}),(0,a.jsx)(Fn.default,{className:"nv-mcard-max",sx:{fontSize:10,color:Kn,ml:"auto",flexShrink:0,transition:"color .15s"}})]}),(0,a.jsxs)(g.A,{sx:{fontSize:"1rem",fontWeight:700,color:n?Un:Kn,lineHeight:1,letterSpacing:"-0.01em",mb:.75},children:[n?t:"\u2014",n&&(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.6875rem",fontWeight:600,ml:.35,color:Vn},children:e.unit})]}),(0,a.jsx)(no,{values:P[e.key],color:e.tint,height:24})]},e.key)}))}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.68rem",fontWeight:700,letterSpacing:"0.06em",color:Vn},children:"LOGS"}),ue&&(0,a.jsxs)(o.A,{sx:{display:"inline-flex",alignItems:"center",gap:.4,fontSize:"0.62rem",fontWeight:700,color:Gn},children:[(0,a.jsx)(o.A,{sx:{width:5,height:5,borderRadius:"50%",bgcolor:Gn}}),Ln("deviceFarmLive","Live")]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",gap:.25,alignItems:"center"},children:[("agent"===k||"appium"===k)&&(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:"".concat(null===(n=io.find((e=>e.key===k)))||void 0===n?void 0:n.label," \u2014 ").concat(Ln("deviceFarmRestartService","yeniden ba\u015flat")),arrow:!0,children:(0,a.jsx)("span",{children:(0,a.jsx)(Y.A,{size:"small",disabled:"appium"===k&&!!$,onClick:async()=>{if("appium"!==k){if("agent"===k&&null!==s&&void 0!==s&&s.id)try{await U.A.sendNodeCommand(s.id,"restart")}catch(e){}}else de("appium_restart")},sx:pe,children:"appium"===k&&"appium_restart"===$?(0,a.jsx)(bn.A,{size:13}):(0,a.jsx)(ge.default,{})})})}),("agent"===k||"appium"===k)&&(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ae,arrow:!0,children:(0,a.jsx)("span",{children:(0,a.jsx)(Y.A,{size:"small",disabled:!ve||!!$,onClick:()=>ve&&de(he?"appium_stop":"appium_start"),sx:he?(0,i.A)((0,i.A)({},pe),{},{"&:hover":{color:Xn,bgcolor:qn}}):pe,children:be?(0,a.jsx)(bn.A,{size:13}):he?(0,a.jsx)(En.default,{}):(0,a.jsx)(On.default,{})})})}),("agent"===k||"appium"===k)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ln("deviceFarmLogClear","Temizle"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:()=>"appium"===k?le(""):z(""),sx:pe,children:(0,a.jsx)(Rn.default,{})})}),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ln("deviceFarmLogDownload","\u0130ndir"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:()=>{const e=new Blob([("appium"===k?ie:C)||""],{type:"text/plain"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download="".concat((null===s||void 0===s?void 0:s.name)||(null===s||void 0===s?void 0:s.id),"-").concat(k,".log"),n.click(),URL.revokeObjectURL(t)},sx:pe,children:(0,a.jsx)(ne.default,{})})})]})]})]}),(0,a.jsx)(o.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5,mb:1},children:io.map((e=>{const t=e.healthKey&&!1===xe[e.healthKey]&&ue,n=k===e.key;return(0,a.jsxs)(o.A,{onClick:()=>F(e.key),sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1.25,py:.5,borderRadius:1.5,fontSize:"0.75rem",fontWeight:600,cursor:"pointer",color:n?Bn:Hn,bgcolor:n?"#eaf2ff":"transparent","&:hover":{bgcolor:n?"#eaf2ff":qn}},children:[e.info&&(0,a.jsx)(Pt.default,{sx:{fontSize:14}}),t&&(0,a.jsx)(o.A,{sx:{width:6,height:6,borderRadius:"50%",bgcolor:Xn}}),e.label]},e.key)}))}),"info"===k?(0,a.jsxs)(o.A,{sx:{bgcolor:Qn,borderRadius:2.5,border:"1px solid ".concat(to,"33"),display:"flex",flexDirection:"column",height:"bottom"===S?"30vh":"full"===S?"68vh":"calc(100vh - 400px)",minHeight:280},children:[(0,a.jsx)(o.A,{sx:{display:"flex",justifyContent:"flex-end",p:1.5,pb:1,flexShrink:0},children:(0,a.jsxs)(o.A,{onClick:()=>{const e=Re.flatMap((e=>["[".concat(e.g.toUpperCase(),"]"),...e.rows.map((e=>"".concat(e.l,": ").concat(e.v))),""])),t=new Blob([e.join("\n")],{type:"text/plain"}),n=URL.createObjectURL(t),o=document.createElement("a");o.href=n,o.download="".concat((null===s||void 0===s?void 0:s.name)||(null===s||void 0===s?void 0:s.id),"-info.txt"),o.click(),URL.revokeObjectURL(n)},sx:{display:"inline-flex",alignItems:"center",gap:.6,px:1.25,py:.6,borderRadius:1.5,border:"1px solid ".concat(to,"55"),color:$n,fontSize:"0.72rem",fontWeight:600,cursor:"pointer","&:hover":{borderColor:Bn,color:"#fff"},"& svg":{fontSize:14,color:"inherit"}},children:[(0,a.jsx)(ne.default,{}),Ln("deviceFarmDownloadInfo","Download info")]})}),(0,a.jsx)(o.A,{sx:{px:1.75,pb:1.75,overflowY:"auto",flex:1,minHeight:0},children:Re.map((e=>(0,a.jsxs)(o.A,{sx:{borderRadius:2,mb:1.25,overflow:"hidden",border:"1px solid ".concat(to,"33"),"&:last-of-type":{mb:0}},children:[(0,a.jsx)(o.A,{component:"div",sx:{px:1.5,py:.85,fontSize:"0.6rem",fontWeight:800,letterSpacing:"0.1em",textTransform:"uppercase",color:"".concat(Zn," !important"),bgcolor:"".concat(to,"2b")},children:e.g}),e.rows.map(((e,t)=>{const n="\u2014"===e.v;return(0,a.jsxs)(o.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2,px:1.5,py:.85,borderTop:t?"1px solid ".concat(to,"2b"):"none"},children:[(0,a.jsx)(o.A,{component:"span",style:{color:eo},sx:{fontSize:"0.76rem",flexShrink:0},children:e.l}),(0,a.jsx)(o.A,{component:"span",style:{color:n?to:$n},sx:{fontSize:"0.78rem",fontWeight:600,textAlign:"right",fontFamily:e.mono?"ui-monospace, Menlo, Consolas, monospace":"inherit",wordBreak:"break-all"},children:e.v})]},e.l)}))]},e.g)))})]}):null!==(l=io.find((e=>e.key===k)))&&void 0!==l&&l.local?(0,a.jsxs)(o.A,{children:[je(ue,Ln("deviceFarmAgentRunning","\xc7al\u0131\u015f\u0131yor"),Ln("deviceFarmAgentDown","Kapal\u0131")),(0,a.jsx)(o.A,{ref:se,sx:ye,children:I?(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,color:"#64748b"},children:[(0,a.jsx)(bn.A,{size:13,sx:{color:"#64748b"}})," ",Ln("deviceFarmLogsLoading","Loglar y\xfckleniyor\u2026")]}):C||Ln("deviceFarmLogsEmpty","Log yok (node offline / veri gelmedi).")})]}):(0,a.jsxs)(o.A,{children:[je(!!xe.appium,Ln("deviceFarmAppiumRunning","\xc7al\u0131\u015f\u0131yor"),Ln("deviceFarmAppiumDown","Kapal\u0131"),te),(0,a.jsx)(o.A,{ref:ce,sx:ye,children:ie||(ae?Ln("deviceFarmAppiumLogLoading","Appium logu al\u0131n\u0131yor\u2026"):Ln("deviceFarmAppiumLogEmpty","Appium logu yok \u2014 Appium kapal\u0131 olabilir ya da hen\xfcz sat\u0131r d\xfc\u015fmedi."))})]})]}),(0,a.jsxs)(R.A,{anchorEl:T,open:!!T,onClose:()=>W(null),slotProps:{paper:{sx:{width:200,borderRadius:2}}},children:[(0,a.jsx)(g.A,{sx:{px:1.5,py:.75,fontSize:"0.62rem",fontWeight:800,letterSpacing:"0.06em",color:Vn},children:Ln("deviceFarmVisibleCards","VISIBLE CARDS")}),oo.map((e=>(0,a.jsxs)(N.A,{onClick:()=>L((t=>(0,i.A)((0,i.A)({},t),{},{[e.key]:!t[e.key]}))),sx:{fontSize:"0.82rem",justifyContent:"space-between"},children:[e.label,(0,a.jsx)(G.A,{size:"small",checked:!!O[e.key],sx:{p:0,"&.Mui-checked":{color:Bn}}})]},e.key)))]}),(()=>{const e=oo.find((e=>e.key===_));if(!e)return null;const t=(P[e.key]||[]).map(((e,t)=>({i:t,v:e}))),n=ue?e.get(xe):null,i=t.length>=2;return(0,a.jsxs)(j.A,{open:!!_,onClose:()=>X(null),maxWidth:"md",fullWidth:!0,PaperProps:{sx:{borderRadius:3,overflow:"hidden",fontFamily:"Inter, sans-serif"}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",px:3,pt:2.5,pb:2,background:"linear-gradient(to bottom, #f8fafc, #fff)",borderBottom:"1px solid ".concat(qn)},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.75},children:[(0,a.jsx)(o.A,{sx:{width:44,height:44,borderRadius:2.5,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:e.tint,color:"#fff",boxShadow:"0 2px 6px -2px rgba(15,23,42,.3)","& svg":{fontSize:22}},children:e.icon}),(0,a.jsxs)(o.A,{children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",fontWeight:600,color:Hn,lineHeight:1,mb:.75},children:e.label}),(0,a.jsx)(o.A,{sx:{display:"flex",alignItems:"flex-end",gap:1},children:(0,a.jsxs)(g.A,{sx:{fontSize:"1.9rem",fontWeight:800,color:Un,lineHeight:1,letterSpacing:"-0.02em"},children:[null!=n?n:"\u2014",(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.9rem",fontWeight:700,color:Vn,ml:.25},children:null!=n?e.unit:""})]})})]})]}),(0,a.jsx)(Y.A,{size:"small",onClick:()=>X(null),sx:{color:Hn},children:(0,a.jsx)(Cn.default,{sx:{fontSize:18}})})]}),(0,a.jsxs)(o.A,{sx:{px:2,py:2},children:[(0,a.jsx)(g.A,{sx:{px:1,pb:1,fontSize:"0.72rem",fontWeight:500,color:Vn}
1,children:Ln("deviceFarmChartLiveSession","Canl\u0131 oturum (bu panel a\xe7\u0131kken toplanan ger\xe7ek \xf6l\xe7\xfcmler)")}),(0,a.jsx)(o.A,{sx:{height:320,position:"relative"},children:i?(0,a.jsx)(An.u,{width:"100%",height:"100%",children:(0,a.jsxs)(yn.Q,{data:t,margin:{top:8,right:12,left:0,bottom:0},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"ncg-".concat(e.key),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:e.tint,stopOpacity:.28}),(0,a.jsx)("stop",{offset:"100%",stopColor:e.tint,stopOpacity:0})]})}),(0,a.jsx)(jn.W,{dataKey:"i",hide:!0}),(0,a.jsx)(Sn.h,{width:38,tick:{fontSize:11,fill:Vn},axisLine:!1,tickLine:!1,domain:["dataMin - 2","dataMax + 2"]}),(0,a.jsx)(wn.m,{contentStyle:{borderRadius:8,border:"1px solid ".concat(_n),fontSize:12,boxShadow:"0 8px 24px -12px rgba(15,23,42,.3)"},formatter:t=>["".concat(t).concat(e.unit),e.label],labelFormatter:()=>""}),(0,a.jsx)(kn.G,{type:"monotone",dataKey:"v",stroke:e.tint,strokeWidth:2.5,fill:"url(#ncg-".concat(e.key,")"),dot:!1,isAnimationActive:!1})]})}):(0,a.jsxs)(o.A,{sx:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:Vn,gap:1},children:[(0,a.jsx)(Mn.default,{sx:{fontSize:32}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.82rem"},children:ue?null==n?Ln("deviceFarmChartNoMetric","Bu metrik bu node\u2019da okunmuyor (\u2014)."):Ln("deviceFarmChartCollecting","\xd6l\xe7\xfcmler toplan\u0131yor\u2026 birka\xe7 saniye i\xe7inde grafik olu\u015facak."):Ln("deviceFarmChartOffline","Node \xe7evrimd\u0131\u015f\u0131 \u2014 metrik yok.")})]})})]})]})})()]})}var ro=n(599640),so=n(756236),co=n(496389),po=n(989295),xo=n(850261),mo=n(554554),uo=n(76084),fo=n(670704),ho=n(467786),vo=n(681058),go=n(773472),bo=n(456033),Ao=n(3609),yo=n(48443),jo=n(134444),So=n(109929),wo=n(931190),ko=n(744624),Fo=n(653288),Co=n(941795),zo=n(745650),Io=n(409593),No=(n(8402),n(887868),n(970544)),Ro=n(116250),Do=n(273294),Mo=n(170383),To=n(771680),Wo=n(277958),Oo=n(111596),Eo=n(869935),Lo=n(518726),Bo=n(941009),Uo=n(81472);const Po="#0d1526",Ho="#64748b";function Vo(e,t){const n="".concat(e||""," ").concat(t||"").toLowerCase();return/iphone|ipad|apple/.test(n)?"Apple":/pixel|nexus/.test(n)?"Google":/galaxy|samsung|sm-/.test(n)?"Samsung":/xiaomi|redmi|poco|mi /.test(n)?"Xiaomi":/huawei|honor/.test(n)?"Huawei":/oneplus/.test(n)?"OnePlus":/oppo/.test(n)?"Oppo":/vivo/.test(n)?"Vivo":/motorola|moto /.test(n)?"Motorola":null}const Ko=[{key:"cpu",label:"CPU",unit:"%",color:"#2f6bff",icon:(0,a.jsx)(Dn.default,{}),get:e=>e.cpuPct},{key:"temp",label:"Temperature",unit:"\xb0C",color:"#f97316",icon:(0,a.jsx)(jo.default,{}),get:e=>e.tempC},{key:"mem",label:"Memory",unit:"MB",color:"#10b981",icon:(0,a.jsx)(Mn.default,{}),get:e=>e.memUsedMb},{key:"battery",label:"Battery",unit:"%",color:"#8b5cf6",icon:(0,a.jsx)(So.default,{}),get:e=>e.batteryPct}],_o=[{label:"Back",icon:(0,a.jsx)(fo.default,{})},{label:"Home",icon:(0,a.jsx)(ho.default,{})},{label:"Recents",icon:(0,a.jsx)(vo.default,{})},{label:"Lock",icon:(0,a.jsx)(mo.default,{})},{label:"Volume +",icon:(0,a.jsx)(go.default,{})},{label:"Volume \u2212",icon:(0,a.jsx)(bo.default,{})},{label:"Rotate",icon:(0,a.jsx)(Ao.default,{})},{label:"Screenshot",icon:(0,a.jsx)(yo.default,{})}];function qo(e){let{values:t,color:n,height:o=24}=e;const i=120,l=36;if(!t||t.length<2)return(0,a.jsx)("svg",{viewBox:"0 0 ".concat(i," ").concat(l),preserveAspectRatio:"none",style:{width:"100%",height:o},children:(0,a.jsx)("line",{x1:"0",y1:18,x2:i,y2:18,stroke:"#cbd5e1",strokeWidth:"2",strokeDasharray:"4 5",vectorEffect:"non-scaling-stroke"})});const r=Math.min(...t),s=Math.max(...t)-r||1,c=t.length,d=t.map(((e,t)=>[3+t/(c-1)*114,3+30*(1-(e-r)/s)])).map(((e,t)=>"".concat(t?"L":"M"," ").concat(e[0].toFixed(1)," ").concat(e[1].toFixed(1)))).join(" "),p="dd-spark-".concat(n.replace("#",""));return(0,a.jsxs)("svg",{viewBox:"0 0 ".concat(i," ").concat(l),preserveAspectRatio:"none",style:{width:"100%",height:o},children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"0",stopColor:n,stopOpacity:"0.22"}),(0,a.jsx)("stop",{offset:"1",stopColor:n,stopOpacity:"0"})]})}),(0,a.jsx)("path",{d:"".concat(d," L ").concat(117," ").concat(l," L ").concat(3," ").concat(l," Z"),fill:"url(#".concat(p,")")}),(0,a.jsx)("path",{d:d,fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})}function Yo(e){return String(e).padStart(2,"0")}function Go(e){if(!e)return"\u2014";const t=new Date(e);return Number.isNaN(t.getTime())?"\u2014":t.toLocaleDateString()}
1function Xo(e){let{canManage:t=!0,open:n,device:l,nodeName:r,nodeOffline:s,holder:c,pollLiveMetrics:d,getDeviceLogcat:p,onClose:x,onRestart:m,onDeviceOp:u,onAssign:f,onUnassign:h,onSetReservable:v,onForceRelease:g,onInstall:b}=e;const A=(0,Ce.xz)(),[y,S]=(0,E.useState)(!1),[w,k]=(0,E.useState)(!1),[F,C]=(0,E.useState)(!1),[z,I]=(0,E.useState)({cpu:[],temp:[],mem:[],battery:[]}),[D,M]=(0,E.useState)(null),[T,W]=(0,E.useState)([]),[O,L]=(0,E.useState)([]),[B,U]=(0,E.useState)(!1),[P,H]=(0,E.useState)(!1),[V,K]=(0,E.useState)("00:00"),[_,G]=(0,E.useState)(null),[J,$]=(0,E.useState)(null),[Z,ee]=(0,E.useState)(null),te=(0,E.useRef)(null),oe=(0,E.useRef)(null),ie=String((null===l||void 0===l?void 0:l.status)||"").toUpperCase(),le=!l||"OFFLINE"===ie||"MAINTENANCE"===ie,ae=String((null===l||void 0===l?void 0:l.adbTransport)||"").toUpperCase()||null,re=String((null===l||void 0===l?void 0:l.netSharing)||"").toUpperCase()||null,se="USB_TETHER"===re,ce=se||"WIRELESS"===ae,de="USB"===ae?Ge("deviceFarmConnUsb","USB"):"WIRELESS"===ae?Ge("deviceFarmConnWireless","Wi-Fi (wireless ADB)"):"EMULATOR"===ae?Ge("deviceFarmConnEmulator","Emulator (local)"):"\u2014",pe="USB_TETHER"===re?Ge("deviceFarmSharingUsbTether","USB tethering active"):"HOTSPOT"===re?Ge("deviceFarmSharingHotspot","Hotspot active"):"NONE"===re?Ge("deviceFarmSharingNone","Not sharing"):"\u2014",xe="BUSY"===ie?{label:Ge("deviceFarmStateBusy","Busy"),dot:_e.emerald,text:_e.emeraldDk}:"ONLINE"===ie||"AVAILABLE"===ie?{label:Ge("deviceFarmStateAvailable","Available"),dot:_e.sky,text:_e.skyDk}:s?{label:Ge("deviceFarmStateNodeOffline","Node offline"),dot:_e.slate400,text:_e.slate500}:{label:Ge("deviceFarmStateOffline","Offline"),dot:_e.slate400,text:_e.slate500},me=/EMULATOR|SIMULATOR/i.test((null===l||void 0===l?void 0:l.deviceKind)||""),ue="IOS"===String((null===l||void 0===l?void 0:l.platform)||"").toUpperCase(),fe=l?"".concat("IOS"===l.platform?"iOS":"ANDROID"===l.platform?"Android":l.platform||"\u2014").concat(l.osVersion?" ".concat(l.osVersion):""):"\u2014",he=(null===l||void 0===l?void 0:l.displayName)||(null===l||void 0===l?void 0:l.name)||(null===l||void 0===l?void 0:l.udid)||(l?"#".concat(l.id):""),be=(e,t)=>{const n="".concat(Yo((new Date).getHours()),":").concat(Yo((new Date).getMinutes()),":").concat(Yo((new Date).getSeconds()));W((o=>[...o,{ts:n,msg:e,lvl:t}].slice(-200))),"e"===t&&H(!0)};(0,E.useEffect)((()=>{if(!n||!l)return S(!1),void k(!1);S(!1),k(!1),I({cpu:[],temp:[],mem:[],battery:[]}),M(null),L([]),U(!1),H(!1),te.current=null,K("00:00");const e="".concat(Yo((new Date).getHours()),":").concat(Yo((new Date).getMinutes()),":").concat(Yo((new Date).getSeconds())),t=[{ts:e,msg:"".concat(l.udid||he," \u2014 ").concat(Ge("deviceFarmDetailSessionReady","session detail ready")),lvl:"i"}];le&&t.push({ts:e,msg:s?Ge("deviceFarmDetailNodeOffline","node is offline \u2014 the device cannot be reached (the node agent is not reporting to the backend)"):Ge("deviceFarmDetailDeviceOffline","device is offline \u2014 no active session"),lvl:"w"}),W(t)}),[n,null===l||void 0===l?void 0:l.id]),(0,E.useEffect)((()=>{if(!n||null===l||void 0===l||!l.id||le||!d)return;let e=!0;const t=async()=>{try{const t=await d(l.id),n=null===t||void 0===t?void 0:t.sample;if(!e)return;if(!n)return void M(null);M(n),I((e=>{const t=(e,t)=>null==t||Number.isNaN(Number(t))?e:[...e,Number(t)].slice(-30);return{cpu:t(e.cpu,n.cpuPct),temp:t(e.temp,n.tempC),mem:t(e.mem,n.memUsedMb),battery:t(e.battery,n.batteryPct)}}))}catch(t){}};t();const o=setInterval(t,4e3);return()=>{e=!1,clearInterval(o)}}),[n,null===l||void 0===l?void 0:l.id,le,d]),(0,E.useEffect)((()=>{if(!n||null===l||void 0===l||!l.id||le||ue||!p)return;let e=!0;const t=async()=>{try{const t=await p(l.id);if(!e)return;U(!0);const n=t&&"string"===typeof t.log?t.log:"",o=n?n.replace(/\r/g,"").split("\n").filter((e=>e.length)):[];L(o.slice(-400))}catch(t){}};t();const o=setInterval(t,3e3);return()=>{e=!1,clearInterval(o)}}),[n,null===l||void 0===l?void 0:l.id,le,ue,p]),(0,E.useEffect)((()=>{if(!y)return te.current=null,void K("00:00");te.current||(te.current=Date.now(),be(Ge("deviceFarmDetailSessionStarted","session started \u2014 screen mirroring active"),"i"));const e=()=>{const e=Math.floor((Date.now()-te.current)/1e3);K("".concat(Yo(Math.floor(e/60)),":").concat(Yo(e%60)))};e();const t=setInterval(e,1e3);return()=>clearInterval(t)}),[y]),(0,E.useEffect)((()=>{oe.current&&(oe.current.scrollTop=oe.current.scrollHeight)}),[T,O]);const Ae=!!c&&!y,ye=!le&&!y&&!c&&"BUSY"===String((null===l||void 0===l?void 0:l.status)||"").toUpperCase(),je=t&&!y&&(Ae||ye),Se=(0,Lt.Sf)(l),we=(0,E.useMemo)((()=>
1{if(!l)return[];const e=e=>null==e||""===e?"\u2014":e,t=null!=l.ramMb?"".concat((l.ramMb/1024).toFixed(l.ramMb%1024?1:0)," GB"):null!=l.ramGb?"".concat(l.ramGb," GB"):"\u2014",n=null!=l.storageGb?"".concat(l.storageGb," GB"):null!=l.diskGb?"".concat(l.diskGb," GB"):"\u2014";return[{l:Ge("deviceFarmInfoUdid","UDID"),v:e(l.udid),mono:!0},{l:Ge("deviceFarmInfoState","State"),v:xe.label},{l:Ge("deviceFarmInfoInUseBy","In use by"),v:(null===c||void 0===c?void 0:c.label)||(le?"\u2014":Ge("deviceFarmNobody","Nobody"))},{l:Ge("deviceFarmInfoType","Type"),v:me?Ge("deviceFarmTypeEmulator","Emulator (ephemeral)"):Ge("deviceFarmTypeReal","Real device")},{l:Ge("deviceFarmInfoConnection","Connection"),v:de},{l:Ge("deviceFarmInfoNetSharing","Network sharing"),v:pe},{l:Ge("deviceFarmInfoBrand","Brand"),v:Vo(l.name,l.model)||"\u2014"},{l:Ge("deviceFarmInfoOs","OS"),v:fe},{l:Ge("deviceFarmInfoModel","Model"),v:e(l.model)},{l:Ge("deviceFarmInfoChipset","Chipset"),v:e(l.chipset)},{l:Ge("deviceFarmInfoRam","RAM"),v:t},{l:Ge("deviceFarmInfoDisk","Disk"),v:n},{l:Ge("deviceFarmInfoResolution","Resolution"),v:e(l.resolution||l.screenResolution)},{l:Ge("deviceFarmInfoBatteryHealth","Battery health"),v:e(l.batteryHealth)},{l:Ge("deviceFarmInfoUsage","Usage"),v:e(l.usage)},{l:Ge("deviceFarmInfoUsageMode","Usage mode"),v:Ge(Lt.Nc[Se],"")},{l:Ge("deviceFarmInfoNode","Node"),v:r||(null!=l.nodeId?"#".concat(l.nodeId):"\u2014")},...A?[]:[{l:Ge("deviceFarmInfoPool","Pool"),v:"DEDICATED"===l.poolType?Ge("deviceFarmDedicated","Dedicated"):Ge("deviceFarmShared","Shared")}],{l:Ge("deviceFarmInfoAdded","Added"),v:Go(l.createdAt)},{l:Ge("deviceFarmInfoLastRun","Last run"),v:l.lastSessionAt||l.lastRunAt?Go(l.lastSessionAt||l.lastRunAt):"\u2014"}]}),[l,c,xe.label,me,fe,r,le,A,de,pe,Se]),ke=e=>{G(null);const t=he||"device-".concat(null===l||void 0===l?void 0:l.id);if("json"===e){const e={};we.forEach((t=>{e[t.l]=t.v})),Fe("".concat(t,".json"),JSON.stringify(e,null,2),"application/json")}else if("csv"===e){const e=["field,value",...we.map((e=>'"'.concat(e.l,'","').concat(String(e.v).replace(/"/g,'""'),'"')))].join("\n");Fe("".concat(t,".csv"),e,"text/csv")}else{const e=we.map((e=>"".concat(e.l,": ").concat(e.v))).join("\n");navigator.clipboard&&navigator.clipboard.writeText(e).catch((()=>{}))}},Fe=(e,t,n)=>{const o=new Blob([t],{type:n}),i=URL.createObjectURL(o),l=document.createElement("a");l.href=i,l.download=e,l.click(),URL.revokeObjectURL(i)},ze=()=>[...T.map((e=>"".concat(e.ts," ").concat(e.msg))),...O.length?["","\u2500\u2500 logcat \u2500\u2500",...O]:[]].join("\n"),Ie=()=>{Fe("".concat(he||(null===l||void 0===l?void 0:l.id),"-logs.txt"),ze(),"text/plain")},Ne="BUSY"===ie,Re=Ge("deviceFarmBusyOpTip","Device is busy \u2014 a session is running"),De=!(null===l||void 0===l||!l.blocked),Me="RESERVABLE"===(null===l||void 0===l?void 0:l.poolType),Te="DEDICATED"===(null===l||void 0===l?void 0:l.poolType),We=(e,t,n)=>async()=>{u&&(await u(l,e),t&&be(t,n||"i"))},Oe=(0,E.useRef)({v:void 0,at:0});Oe.current.v!==(null===l||void 0===l?void 0:l.netStateAgeMs)&&(Oe.current={v:null===l||void 0===l?void 0:l.netStateAgeMs,at:Date.now()});const Ee="number"===typeof(null===l||void 0===l?void 0:l.netStateAgeMs)?l.netStateAgeMs+Math.max(0,Date.now()-Oe.current.at):null,Le="number"===typeof(null===D||void 0===D?void 0:D.ageMs)&&D.ageMs<=2e4,Be=null!=Ee&&Ee<=12e4,Ue=(e,t)=>Le&&"boolean"===typeof e?e:Be&&"boolean"===typeof t?t:null,Pe={airplane:Ue(null===D||void 0===D?void 0:D.airplaneOn,null===l||void 0===l?void 0:l.airplaneOn),wifi:Ue(null===D||void 0===D?void 0:D.wifiOn,null===l||void 0===l?void 0:l.wifiOn),data:Ue(null===D||void 0===D?void 0:D.mobileDataOn,null===l||void 0===l?void 0:l.mobileDataOn)},He=se?Ge("deviceFarmNetTetherLockTip","USB tethering is active on this device \u2014 this node's internet connection may run through it. Turning the network off would cut the node off from the backend and the device would appear offline."):Ge("deviceFarmNetWirelessLockTip","Device is connected over wireless ADB \u2014 turning Wi-Fi off would drop the connection and it cannot be restored remotely. Connect the device over USB to use this switch."),Ve=async(e,t)=>{if(u&&!J&&(null===e||void 0===e||!e.lock)){$(e.key);try{if(await u(l,t?e.on:e.off),be(Ge("deviceFarmDetailNetQueued","network command queued"),"i"),await new Promise((e=>setTimeout(e,1500))),d&&null!==l&&void 0!==l&&l.id){const e=await d(l.id);null!==e&&void 0!==e&&e.sample&&M(e.sample)}}catch(n){}finally{$(null)}}}
1,Ke=[{key:"restart",label:Ge("deviceFarmCtlRestart","Restart"),icon:(0,a.jsx)(ge.default,{sx:{fontSize:16}}),disabled:Ne||le,tip:Ne?Re:le?Ge("deviceFarmNotReachable","Device is not reachable"):null,run:async()=>{await m(l.id),be(Ge("deviceFarmDetailRestartQueued","restart command queued"),"i")}}],qe=[{key:"airplane",label:Ge("deviceFarmNetAirplane","Airplane mode"),icon:Pe.airplane?(0,a.jsx)(Fo.default,{}):(0,a.jsx)(Co.default,{}),value:Pe.airplane,on:"airplane_on",off:"airplane_off",lock:ce},{key:"wifi",label:Ge("deviceFarmNetWifi","Wi-Fi"),icon:!1===Pe.wifi?(0,a.jsx)(Io.default,{}):(0,a.jsx)(zo.default,{}),value:Pe.wifi,on:"wifi_on",off:"wifi_off",lock:ce}],Ye=(0,a.jsxs)(a.Fragment,{children:[Ke.map((e=>(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:e.tip||e.label,placement:"right",arrow:!0,children:(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-flex"},children:(0,a.jsx)(o.A,{component:"button","aria-label":e.label,disabled:e.disabled,onClick:e.run,sx:Qo(!1,e.disabled),children:e.icon})})},e.key))),qe.map((e=>(e=>{const t=null==e.value,n=J===e.key,l=le||e.lock||!!J,r=t?Ge("deviceFarmNetStateUnknownShort","unknown"):e.value?Ge("deviceFarmNetOn","On"):Ge("deviceFarmNetOff","Off"),c=le?s?Ge("deviceFarmNodeOfflineOpTip","The node is offline \u2014 this device cannot be reached"):Ge("deviceFarmOfflineOpTip","Device is offline"):e.lock?He:n?Ge("deviceFarmDetailNetQueued","network command queued"):t?"".concat(e.label," \u2014 ").concat(Ge("deviceFarmNetStateUnknownActionable","Current state unknown \u2014 you can still turn it on or off")):"".concat(e.label,": ").concat(r),d=(0,i.A)((0,i.A)({},Qo(!1,l)),{},{"& svg":{fontSize:16}}),p=l?d:t?(0,i.A)((0,i.A)({},d),{},{borderStyle:"dashed",borderColor:_e.slate300,color:_e.slate400}):e.value?(0,i.A)((0,i.A)({},d),{},{borderColor:"#a7f3d0",bgcolor:"#ecfdf5",color:_e.emerald,"&:hover":{bgcolor:"#d1fae5"}}):d;return(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:c,placement:"right",arrow:!0,children:(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-flex"},children:(0,a.jsx)(o.A,(0,i.A)((0,i.A)({component:"button","aria-label":"".concat(e.label,": ").concat(r)},t?{"aria-haspopup":"menu"}:{"aria-pressed":!0===e.value}),{},{disabled:l,onClick:n=>{l||(t?ee({anchor:n.currentTarget,sw:e}):Ve(e,!e.value))},sx:p,children:e.icon}))})},e.key)})(e))),ce&&!le&&(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:He,placement:"right",arrow:!0,children:(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-flex",color:_e.amber,"& svg":{fontSize:14},mt:.25},children:(0,a.jsx)(mo.default,{})})})]}),Xe=[{group:Ge("deviceFarmControlsBaseline","Baseline"),items:[{label:Ge("deviceFarmCtlSetBaseline","Set as baseline"),icon:(0,a.jsx)(wo.default,{}),disabled:Ne,tip:Ne?Re:null,run:We("baseline",Ge("deviceFarmDetailBaselineQueued","set-baseline command queued"),"i")},{label:Ge("deviceFarmCtlResetBaseline","Reset to baseline"),icon:(0,a.jsx)(ko.default,{}),warn:!0,disabled:Ne||!(null!==l&&void 0!==l&&l.baselineReady),tip:Ne?Re:null!==l&&void 0!==l&&l.baselineReady?null:Ge("deviceFarmNoBaselineTip","No baseline saved for this device yet"),run:We("reset",Ge("deviceFarmDetailResetQueued","reset-to-baseline command queued"),"w")}]},{group:Ge("deviceFarmControlsUsage","Usage"),items:[...[{mode:Lt.Ay.AUTOMATION,label:Ge("deviceFarmCtlUsageAutomation","Reserve for automation"),logMsg:Ge("deviceFarmDetailUsageAutomation","device reserved for automation"),icon:(0,a.jsx)(Mo.default,{})},{mode:Lt.Ay.MANUAL,label:Ge("deviceFarmCtlUsageManual","Reserve for manual testing"),logMsg:Ge("deviceFarmDetailUsageManual","device reserved for manual testing"),icon:(0,a.jsx)(To.default,{})},{mode:Lt.Ay.BOTH,label:Ge("deviceFarmCtlUsageBoth","Open for dual use"),logMsg:Ge("deviceFarmDetailUsageBoth","usage restriction removed"),icon:(0,a.jsx)(Wo.default,{})}].filter((e=>e.mode!==Se)).map((e=>({label:e.label,icon:e.icon,allowOffline:!0,run:We(Lt.Pp[e.mode],e.logMsg,"i")})))]},{available:false,group:Ge("deviceFarmControlsAccess","Access"),items:[...A?[]:[{label:Ge("deviceFarmCtlAssign","Assign to company"),icon:(0,a.jsx)(No.default,{}),allowOffline:!0,run:()=>{f&&f(l)}}
1],...Te&&!A?[{label:Ge("deviceFarmCtlUnassign","Unassign"),icon:(0,a.jsx)(Ro.default,{}),warn:!0,allowOffline:!0,run:()=>{h&&h(l)}}]:[],{label:A?De?Ge("deviceFarmCtlUnblockTeam","Unblock (show to your team)"):Ge("deviceFarmCtlBlockTeam","Block (hide from your team)"):De?Ge("deviceFarmCtlUnblock","Unblock (show to customers)"):Ge("deviceFarmCtlBlock","Block (hide from customers)"),icon:De?(0,a.jsx)(Q.default,{}):(0,a.jsx)(Do.default,{}),warn:!De,allowOffline:!0,run:We(De?"unblock":"block",De?Ge("deviceFarmDetailUnblocked","device unblocked"):Ge("deviceFarmDetailBlocked","device blocked"),De?"i":"w")},...A?[]:[{label:Me?Ge("deviceFarmCtlMakeShared","Move to shared pool"):Ge("deviceFarmCtlMakeReservable","Make reservable"),icon:(0,a.jsx)(Oo.default,{}),allowOffline:!0,run:()=>{v&&v(l,!Me)}}]]}],Je=(t?Xe:Xe.filter((e=>e.useTier))).filter((e=>!1!==e.available));if(!l)return null;const Qe=()=>S(!0),$e=String(l.platform||"").toLowerCase();return(0,a.jsxs)(j.A,{open:n,onClose:x,maxWidth:!1,PaperProps:{sx:{bgcolor:"#fff",fontFamily:"Inter, sans-serif",width:w?"min(620px, 96vw)":"min(1440px, 92vw)",height:w?"100vh":"min(880px, 90vh)",maxWidth:"none",m:0,borderRadius:w?0:3,overflow:"hidden",transition:"width 0.2s ease, height 0.2s ease"}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1.5,px:{xs:1.5,sm:2,md:2.5},py:w?{xs:1,sm:1.25}:{xs:1.25,sm:1.75},borderBottom:"1px solid ".concat(_e.slate100),flexShrink:0},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:{xs:1,sm:1.5},minWidth:0,flex:1},children:[!w&&(0,a.jsx)(o.A,{sx:{width:40,height:40,borderRadius:2,bgcolor:_e.slate100,display:"flex",alignItems:"center",justifyContent:"center",color:_e.slate500,flexShrink:0},children:me?(0,a.jsx)(Ut.default,{sx:{fontSize:20}}):(0,a.jsx)(X.default,{sx:{fontSize:20}})}),(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.95rem",fontWeight:700,color:_e.ink,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:he}),(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5,fontSize:"0.68rem",fontWeight:600,color:xe.text},children:[(0,a.jsx)(o.A,{component:"span",sx:{width:6,height:6,borderRadius:"50%",bgcolor:xe.dot}}),xe.label]})]}),(0,a.jsxs)(o.A,{component:"div",sx:{mt:.25,fontSize:"0.72rem",color:_e.slate500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[l.udid||"\u2014"," \xb7 ",fe," \xb7 ",r||(null!=l.nodeId?"#".concat(l.nodeId):"\u2014")]})]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:{xs:.5,sm:1},flexShrink:0},children:[y&&(0,a.jsxs)(o.A,{sx:{display:"inline-flex",alignItems:"center",gap:.75,fontSize:"0.72rem",fontWeight:700,color:_e.emeraldDk,bgcolor:"#ecfdf5",border:"1px solid #a7f3d0",borderRadius:999,px:1.25,py:.5},children:[(0,a.jsx)(o.A,{sx:{width:6,height:6,borderRadius:"50%",bgcolor:_e.emerald}}),V]}),je&&(0,a.jsxs)(o.A,{component:"button",onClick:()=>g&&g(),title:Ge("deviceFarmForceReleaseHint","Ends whatever is holding this device and returns it to the pool"),sx:{display:"inline-flex",alignItems:"center",gap:.6,px:1.25,py:.9,borderRadius:2,fontSize:"0.78rem",fontWeight:600,whiteSpace:"nowrap",flexShrink:0,cursor:"pointer",color:_e.rose,bgcolor:"#fff",border:"1px solid #fecaca","&:hover":{bgcolor:"#fef2f2"}},children:[(0,a.jsx)(uo.default,{sx:{fontSize:16}}),Ge("deviceFarmForceRelease","Force release")]}),(0,a.jsxs)(o.A,{component:"button",disabled:le||Ae,onClick:()=>y?(k(!1),void S(!1)):Qe(),sx:(0,i.A)({display:"inline-flex",alignItems:"center",gap:.75,px:{xs:1.25,sm:1.75},py:1,borderRadius:2,fontSize:"0.82rem",fontWeight:600,whiteSpace:"nowrap",flexShrink:0,cursor:"pointer",border:"none"},le||Ae?{color:_e.slate400,bgcolor:_e.slate100,cursor:"not-allowed"}:y?{color:_e.slate600,bgcolor:"transparent",border:"1px solid ".concat(_e.slate200),"&:hover":{bgcolor:_e.slate50}}:{color:"#fff",bgcolor:_e.brand,"&:hover":{filter:"brightness(1.08)"}}),children:[y?(0,a.jsx)(xo.default,{sx:{fontSize:16}}):Ae?(0,a.jsx)(mo.default,{sx:{fontSize:16}}):(0,a.jsx)(ve.default,{sx:{fontSize:16}}),y?Ge("deviceFarmRelease","Release"):Ae?Ge("deviceFarmInUse","In use"):Ge("deviceFarmTakeDevice","Take device")]}
1),(0,a.jsx)(Y.A,{size:"small",onClick:x,sx:{width:34,height:34,color:_e.slate500,"& svg":{fontSize:18}},children:(0,a.jsx)(Cn.default,{})})]})]}),(0,a.jsxs)(o.A,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:{xs:"column",lg:"row"}},children:[(0,a.jsxs)(o.A,{sx:{width:w?"100%":{lg:560},flexShrink:0,borderBottom:{xs:"1px solid ".concat(_e.slate100),lg:"none"},borderRight:w?"none":{lg:"1px solid ".concat(_e.slate100)},px:0,pt:0,pb:w?{xs:"9px",sm:"10px"}:{xs:1,sm:1.25},gap:w?{xs:.5,sm:.75}:{xs:.25,sm:.375},display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:w?.5:1.5,background:"linear-gradient(to bottom,#f8fafc,#fff)",minHeight:0},children:[(0,a.jsx)(o.A,{sx:{width:"100%",flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",gap:w?.5:1.5},children:y?(0,a.jsx)(o.A,{sx:{position:"relative",width:"100%",maxWidth:w?"100%":560,alignSelf:w?"flex-start":"stretch",height:w?{xs:480,lg:"calc(100% - 8px)"}:{xs:420,lg:"100%"},minHeight:0,display:"flex",borderRadius:3},children:(0,a.jsx)(po.A,{variant:"inline",open:!0,farmDeviceId:l.id,hostName:r||void 0,device:{udid:l.udid,name:he,platform:$e},expanded:w,onToggleExpand:()=>k((e=>!e)),extraKeys:Ye})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{"aria-hidden":!0,sx:{width:36,flexShrink:0}}),(0,a.jsx)(o.A,{sx:{position:"relative",height:{xs:380,lg:"calc(100% - 20px)"},maxHeight:"calc(100% - 16px)",aspectRatio:"9 / 19.5",borderRadius:"34px",p:"7px",bgcolor:"#0f172a",boxShadow:"0 25px 50px -12px rgba(0,0,0,.35)"},children:(0,a.jsx)(o.A,{sx:{width:"100%",height:"100%",borderRadius:"27px",bgcolor:"#020617",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",textAlign:"center",px:3},children:(0,a.jsxs)(o.A,{children:[(0,a.jsx)(o.A,{sx:{width:48,height:48,borderRadius:"50%",bgcolor:"rgba(255,255,255,.05)",border:"1px solid rgba(255,255,255,.1)",display:"flex",alignItems:"center",justifyContent:"center",mx:"auto",mb:1.5},children:(0,a.jsx)(ve.default,{sx:{fontSize:22,color:_e.slate500}})}),(0,a.jsx)(o.A,{component:"div",sx:{fontSize:"0.82rem",color:_e.slate300,fontWeight:500},children:le?Ge("deviceFarmDeviceOffline","Device is offline"):Ge("deviceFarmScreenNotMirrored","Screen not mirrored")}),(0,a.jsx)(o.A,{component:"div",sx:{fontSize:"0.7rem",color:_e.slate500,mt:.5,mb:2},children:le?Ge("deviceFarmReconnectToStart","Reconnect the device to start a session."):Ge("deviceFarmTakeToMirror","Take the device to mirror its screen and send input.")}),!le&&!Ae&&(0,a.jsxs)(o.A,{component:"button",onClick:Qe,sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.75,py:1,borderRadius:2,bgcolor:_e.brand,color:"#fff",fontSize:"0.78rem",fontWeight:600,border:"none",cursor:"pointer","&:hover":{filter:"brightness(1.08)"}},children:[(0,a.jsx)(ve.default,{sx:{fontSize:16}}),Ge("deviceFarmTakeDevice","Take device")]})]})})}),(0,a.jsxs)(o.A,{sx:{display:"flex",flexDirection:"column",flexWrap:"wrap",alignSelf:"stretch",maxHeight:"100%",alignItems:"center",alignContent:"center",justifyContent:"center",gap:.5,columnGap:1,flexShrink:0},children:[(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:"".concat(Ge("deviceFarmFullScreen","Full screen")," \u2014 ").concat(Ge("deviceFarmKeyNeedsTake","take the device first")),placement:"right",arrow:!0,children:(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-flex"},children:(0,a.jsx)(o.A,{component:"button",disabled:!0,sx:Qo(!1,!0),children:(0,a.jsx)(Fn.default,{sx:{fontSize:16}})})})}),(0,a.jsx)(o.A,{sx:{width:20,height:"1px",bgcolor:_e.slate200,my:.5}}),_o.map((e=>(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:"".concat(e.label," \u2014 ").concat(Ge("deviceFarmKeyNeedsTake","take the device first")),placement:"right",arrow:!0,children:(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-flex"},children:(0,a.jsx)(o.A,{component:"button",disabled:!0,onClick:Qe,sx:Qo(!1,!0),children:e.icon})})},e.label))),(0,a.jsx)(o.A,{sx:{width:20,height:"1px",bgcolor:_e.slate200,my:.5}}),Ye]})]})}),b&&(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:Ge("deviceFarmInstallBuild","Install app on this device"),placement:"top",arrow:!0,children:(0,a.jsx)(o.A,{component:"span",sx:{dis
1play:"inline-flex",flexShrink:0,mt:0},children:(0,a.jsxs)(o.A,{component:"button",onClick:()=>b(l),disabled:le,sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:w?.625:.75,px:w?{xs:1.5,sm:2}:{xs:1.75,sm:2.5},py:w?.625:.875,minHeight:w?30:34,borderRadius:2,bgcolor:"#fff",color:_e.slate700,border:"1px solid ".concat(_e.slate300),boxShadow:"0 1px 2px rgba(15,23,42,.06)",fontSize:w?"0.75rem":"0.78rem",fontWeight:600,fontFamily:"inherit",cursor:"pointer",whiteSpace:"nowrap",transition:"background-color .15s, border-color .15s, color .15s, box-shadow .15s","& svg":{color:_e.slate500,transition:"color .15s"},"&:hover":{bgcolor:"#eff6ff",borderColor:_e.brand,color:_e.brand,boxShadow:"0 2px 6px rgba(47,107,255,.15)","& svg":{color:_e.brand}},"&:disabled":{opacity:.5,cursor:"not-allowed",bgcolor:"#fff"}},children:[(0,a.jsx)(_t.default,{sx:{fontSize:w?15:16}}),Ge("deviceFarmInstallApp","Install App")]})})})]}),!w&&(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflowY:"auto"},children:[(0,a.jsxs)(o.A,{sx:{px:2.5,pt:1.75,pb:2.5,display:"flex",flexDirection:"column",gap:2},children:[(()=>{if(y)return(0,a.jsx)(o.A,{sx:(0,i.A)((0,i.A)({},Jo),{},{borderColor:"#a7f3d0",bgcolor:"#ecfdf5"}),children:(0,a.jsxs)(o.A,{component:"span",sx:{fontSize:"0.8rem",color:_e.slate700},children:[(0,a.jsx)("b",{children:Ge("deviceFarmYouHaveDevice","You have this device")})," \xb7 ",Ge("deviceFarmManualSession","manual session")]})});if(le)return(0,a.jsx)(o.A,{sx:(0,i.A)((0,i.A)({},Jo),{},{borderColor:_e.slate200,bgcolor:_e.slate50}),children:(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.8rem",color:_e.slate500},children:Ge("deviceFarmNotReachable","Device is not reachable")})});if(ye)return(0,a.jsxs)(o.A,{sx:(0,i.A)((0,i.A)({},Jo),{},{borderColor:"#fecaca",bgcolor:"#fef2f2",justifyContent:"space-between"}),children:[(0,a.jsxs)(o.A,{component:"span",sx:{fontSize:"0.8rem",color:_e.slate700,minWidth:0},children:[(0,a.jsx)("b",{children:Ge("deviceFarmStateBusy","Busy")}),(0,a.jsxs)(o.A,{component:"span",sx:{color:_e.slate500},children:[" \xb7 ",Ge("deviceFarmBusyNoHolder","no active session found \u2014 the device is probably stuck")]})]}),t&&(0,a.jsx)(o.A,{component:"button",onClick:()=>g&&g(),sx:{flexShrink:0,fontSize:"0.72rem",fontWeight:600,color:_e.rose,border:"none",background:"none",cursor:"pointer",px:1,py:.5,borderRadius:1.5,"&:hover":{bgcolor:"#fee2e2"}},children:Ge("deviceFarmForceRelease","Force release")})]});if(Ae){const e=null!==c&&void 0!==c&&c.startedAt?function(e){const t=new Date(e).getTime();if(!t||Number.isNaN(t))return null;const n=Math.floor((Date.now()-t)/6e4);if(n<1)return null;if(n<60)return"".concat(n,"m");const o=Math.floor(n/60);return o<24?"".concat(o,"h"):"".concat(Math.floor(o/24),"d")}(c.startedAt):null;return(0,a.jsxs)(o.A,{sx:(0,i.A)((0,i.A)({},Jo),{},{borderColor:"#fde68a",bgcolor:"#fffbeb",justifyContent:"space-between"}),children:[(0,a.jsxs)(o.A,{component:"span",sx:{fontSize:"0.8rem",color:_e.slate700,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,a.jsx)("b",{children:c.label}),(0,a.jsxs)(o.A,{component:"span",sx:{color:_e.slate500},children:[" ","\xb7"," ","run"===c.kind?Ge("deviceFarmAutomatedRun","automated run"):Ge("deviceFarmManualSession","manual session"),e?" \xb7 ".concat(Ge("deviceFarmHeld","held")," ").concat(e):""]})]}),t&&(0,a.jsx)(o.A,{component:"button",onClick:()=>g&&g(),sx:{flexShrink:0,fontSize:"0.72rem",fontWeight:600,color:_e.rose,border:"none",background:"none",cursor:"pointer",px:1,py:.5,borderRadius:1.5,"&:hover":{bgcolor:"#fef2f2"}},children:Ge("deviceFarmForceRelease","Force release")})]})}return(0,a.jsx)(o.A,{sx:(0,i.A)((0,i.A)({},Jo),{},{borderColor:"#bae6fd",bgcolor:"#f0f9ff"}),children:(0,a.jsxs)(o.A,{component:"span",sx:{fontSize:"0.8rem",color:_e.slate700},children:[(0,a.jsx)("b",{children:Ge("deviceFarmStateAvailable","Available")}),(0,a.jsxs)(o.A,{component:"span",sx:{color:_e.slate500},children:[" ","\xb7 ",Ge("deviceFarmNobodyUsing","nobody is using this device")]})]})})})(),(0,a.jsxs)(o.A,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.25},children:[(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.68rem",fontWeight:700,letterSpacing:"0.06em",color:_e.slate400,textTransform:"uppercase"},children:Ge("deviceFarmLiveMetrics","Live metrics")}),!le&&D&&(0,a.jsxs)(o.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,fontSize:"0.6rem",fontWeight:700,color:_e.emeraldDk,bgcolor:"#ecfdf5",border:"1px solid #a7f3d0",borderRadius:999,px:.75,py:"1px"},children:[(0,a.jsx)(o.A,{sx:{width:4,height:4,borderRadius:"50%",bgcolor:_e.emerald}}),"LIVE"]})]}),(0,a.jsx)(o.A,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2,1fr)",sm:"repeat(4,1fr)"},gap:1.25},children:Ko.map((e=>{const t=le||!D?null:e.get(D),n=null!=t&&!Number.isNaN(Number(t));return(0,a.jsxs)(o.A,{sx:{borderRadius:2,bgcolor:"#fff",border:"1px solid ".concat(_e.cardBorder),p:1.25},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75,mb:.75},children:[(0,a.jsx)(o.A,{sx:{width:20,height:20,borderRadius:1.25,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"".concat(e.color,"14"),color:e.color,"& svg":{fontSize:12}},children:e.icon}),(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.62rem",fontWeight:500,color:_e.slate500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label})]}),(0,a.jsxs)(o.A,{component:"div",sx:{fontSize:"1rem",fontWeight:700,color:n?_e.ink:_e.slate300,lineHeight:1,mb:.75},children:[n?Math.round(Number(t)):"\u2014",n&&(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.66rem",fontWeight:600,ml:.35,color:_e.slate400},children:e.unit})]}),(0,a.jsx)(qo,{values:z[e.key],color:e.color,height:24})]},e.key)}))})]}),(0,a.jsxs)(o.A,{children:[(0,a.jsx)(o.A,{component:"span",sx:{dis
1play:"block",fontSize:"0.68rem",fontWeight:700,letterSpacing:"0.06em",color:_e.slate400,textTransform:"uppercase",mb:1.25},children:Ge("deviceFarmControls","Controls")}),(0,a.jsx)(o.A,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:Je.map((e=>(0,a.jsxs)(o.A,{sx:{borderRadius:2,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff",px:1.5,py:1.25},children:[(0,a.jsx)(o.A,{component:"div",sx:{fontSize:"0.6rem",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:_e.slate400,mb:.75},children:e.group}),e.switches?(0,a.jsxs)(o.A,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:.75},children:[e.switches.map((e=>{const t=null==e.value,n=J===e.key,l=le||e.lock||!!J,r=t?Ge("deviceFarmNetStateUnknownShort","unknown"):e.value?Ge("deviceFarmNetOn","On"):Ge("deviceFarmNetOff","Off"),c=le?s?Ge("deviceFarmNodeOfflineOpTip","The node is offline \u2014 this device cannot be reached"):Ge("deviceFarmOfflineOpTip","Device is offline"):e.lock?He:n?Ge("deviceFarmDetailNetQueued","network command queued"):t?Ge("deviceFarmNetStateUnknownActionable","Current state unknown \u2014 you can still turn it on or off"):"".concat(e.label,": ").concat(r),d=t?{fg:l?_e.slate300:_e.slate500,bg:"transparent",bd:"1px dashed ".concat(l?_e.slate200:_e.slate300),hover:_e.slate100}:e.value?{fg:l?_e.slate400:_e.emeraldDk,bg:l?_e.slate100:"".concat(_e.emerald,"1a"),bd:"1px solid ".concat(l?_e.slate200:_e.emerald),hover:"".concat(_e.emerald,"2e")}:{fg:l?_e.slate300:_e.slate500,bg:_e.slate100,bd:"1px solid ".concat(_e.slate200),hover:_e.slate200},p=(0,a.jsxs)(o.A,(0,i.A)((0,i.A)({component:"button",type:"button",disabled:l,"aria-label":"".concat(e.label," \u2014 ").concat(r)},t?{"aria-haspopup":"menu"}:{"aria-pressed":!0===e.value}),{},{onClick:n=>{l||(t?ee({anchor:n.currentTarget,sw:e}):Ve(e,!e.value))},sx:{display:"inline-flex",alignItems:"center",gap:.6,px:1,py:.55,borderRadius:1.5,font:"inherit",fontSize:"0.72rem",fontWeight:600,lineHeight:1,color:d.fg,bgcolor:d.bg,border:d.bd,opacity:l?.55:1,cursor:l?"not-allowed":"pointer",transition:"background-color .15s, color .15s, border-color .15s","&:hover":l?{}:{bgcolor:d.hover},"& svg":{fontSize:16}},children:[e.icon,(0,a.jsx)(o.A,{component:"span",children:e.label}),t&&!le&&(0,a.jsx)(o.A,{component:"span",sx:{color:_e.slate300,fontWeight:500},children:"\u2014"})]}));return c?(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:c,arrow:!0,children:(0,a.jsx)(o.A,{sx:{display:"inline-flex"},children:p})},e.key):(0,a.jsx)(o.A,{sx:{display:"inline-flex"},children:p},e.key)})),ce&&!le&&(0,a.jsx)(o.A,{component:"div",sx:{flexBasis:"100%",mt:.5,fontSize:"0.64rem",lineHeight:1.35,color:_e.slate400},children:se?Ge("deviceFarmNetTetherLockNote","USB tethering is active \u2014 this device may be providing this node's internet connection, so Wi-Fi and airplane mode are locked. Mobile data stays available."):Ge("deviceFarmNetWirelessLockNote","Wireless ADB: Wi-Fi and airplane mode are locked \u2014 switching them off would drop the connection to this device.")}),!ce&&"HOTSPOT"===re&&!le&&(0,a.jsx)(o.A,{component:"div",sx:{flexBasis:"100%",mt:.5,fontSize:"0.64rem",lineHeight:1.35,color:_e.slate400},children:Ge("deviceFarmNetHotspotWarnNote","Hotspot is active on this device \u2014 if this node connects through it, turning the network off will also cut the node off.")}),(0,a.jsx)(R.A,{anchorEl:(null===Z||void 0===Z?void 0:Z.anchor)||null,open:!!Z,onClose:()=>ee(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[{on:!0,label:Ge("deviceFarmNetTurnOn","Turn on")},{on:!1,label:Ge("deviceFarmNetTurnOff","Turn off")}].map((e=>(0,a.jsx)(N.A,{dense:!0,onClick:()=>{const t=null===Z||void 0===Z?void 0:Z.sw;ee(null),t&&Ve(t,e.on)},sx:{fontSize:"0.72rem"},children:e.label},e.label)))})]}):(0,a.jsx)(o.A,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:e.items.map((e=>{const t=!!e.disabled||le&&!e.allowOffline,n=(0,a.jsxs)(o.A,{component:"button",disabled:t,onClick:e.run,sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.25,py:.75,borderRadius:1.5,fontSize:"0.72rem",fontWeight:500,border:"none",background:"none",cursor:t?"not-allowed":"pointer",color:t?_e.slate300:_e.slate600,"&:hover":t?{}:e.warn?{bgcolor:"#fef2f2",color:_e.rose}:{bgcolor:_e.slate100,color:_e.slate800},"& svg":{fontSize:15,color:t?_e.slate300:e.warn?_e.roseLt:_e.slate400}},children:[e.icon,e.label]});return t?(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,t
1itle:e.tip||(le&&!e.allowOffline?Ge("deviceFarmOfflineOpTip","Device is offline"):Ge("deviceFarmNotAvailable","Not available")),arrow:!0,children:(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-flex"},children:n})},e.label):(0,a.jsx)(o.A,{sx:{display:"inline-flex"},children:n},e.label)}))})]},e.group)))})]}),(0,a.jsxs)(o.A,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1.25},children:[(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.68rem",fontWeight:700,letterSpacing:"0.06em",color:_e.slate400,textTransform:"uppercase"},children:Ge("deviceFarmDeviceInfo","Device info")}),(0,a.jsxs)(o.A,{component:"button",onClick:e=>G(e.currentTarget),sx:{display:"inline-flex",alignItems:"center",gap:.5,fontSize:"0.72rem",fontWeight:600,color:_e.slate600,border:"none",background:"none",cursor:"pointer",px:1,py:.5,borderRadius:1.5,"&:hover":{bgcolor:_e.slate100},"& svg":{fontSize:14,color:_e.slate400}},children:[(0,a.jsx)(ne.default,{}),Ge("deviceFarmExport","Export"),(0,a.jsx)(Lo.default,{sx:{fontSize:12}})]}),(0,a.jsxs)(R.A,{anchorEl:_,open:!!_,onClose:()=>G(null),children:[(0,a.jsxs)(N.A,{onClick:()=>ke("csv"),sx:{fontSize:"0.82rem",gap:1},children:[(0,a.jsx)(Bo.default,{sx:{fontSize:16,color:_e.slate400}}),Ge("deviceFarmExportCsv","Device details (.csv)")]}),(0,a.jsxs)(N.A,{onClick:()=>ke("json"),sx:{fontSize:"0.82rem",gap:1},children:[(0,a.jsx)(Uo.default,{sx:{fontSize:16,color:_e.slate400}}),Ge("deviceFarmExportJson","Device details (.json)")]}),(0,a.jsxs)(N.A,{onClick:()=>ke("copy"),sx:{fontSize:"0.82rem",gap:1},children:[(0,a.jsx)(Eo.default,{sx:{fontSize:16,color:_e.slate400}}),Ge("deviceFarmExportCopy","Copy as text")]})]})]}),(0,a.jsx)(o.A,{sx:{borderRadius:2,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff",p:.75,display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr"},columnGap:1.5},children:we.map((e=>{const t="\u2014"===e.v;return(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1.5,px:1.25,py:.75},children:[(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.76rem",color:_e.slate400,flexShrink:0},children:e.l}),(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.76rem",fontWeight:500,color:t?_e.slate300:_e.slate700,textAlign:"right",fontFamily:e.mono?"monospace":"inherit",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:String(e.v),children:e.v})]},e.l)}))})]})]}),(0,a.jsxs)(o.A,{sx:{mt:"auto",borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1},children:[(0,a.jsxs)(o.A,{component:"span",sx:{fontSize:"0.68rem",fontWeight:700,letterSpacing:"0.06em",color:_e.slate400,textTransform:"uppercase"},children:[Ge("deviceFarmDeviceLogs","Device logs"),P&&(0,a.jsxs)(o.A,{component:"span",sx:{color:_e.rose,textTransform:"none",fontWeight:600}
1,children:[" ","\xb7 ",Ge("deviceFarmError","error")]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",gap:.25},children:[(0,a.jsx)(Et.A,{variant:"plain",value:ze(),iconSize:15,copyLabel:Ge("deviceFarmLogCopy","Copy"),tooltipProps:{enterDelay:1e3,enterNextDelay:1e3},sx:{width:26,height:26,color:_e.slate500}}),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ge("deviceFarmLogDownload","Download"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:Ie,sx:{width:26,height:26,color:_e.slate500,"& svg":{fontSize:15}},children:(0,a.jsx)(ne.default,{})})}),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ge("deviceFarmLogExpand","Expand"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:()=>C(!0),sx:{width:26,height:26,color:_e.slate500,"& svg":{fontSize:14},"&:hover":{color:_e.brand}},children:(0,a.jsx)(Fn.default,{})})})]})]}),(0,a.jsxs)(o.A,{ref:oe,sx:{mx:2,mb:2,height:200,overflowY:"auto",borderRadius:1.5,bgcolor:Po,p:1.25,fontFamily:"ui-monospace, Menlo, Consolas, monospace",fontSize:"0.68rem",lineHeight:1.7},children:[T.slice(-4).map(((e,t)=>(0,a.jsxs)(o.A,{component:"div",sx:{display:"flex",gap:1,opacity:.85},children:[(0,a.jsx)(o.A,{component:"span",style:{color:Ho},sx:{flexShrink:0},children:e.ts}),(0,a.jsx)(o.A,{component:"span",style:{color:"e"===e.lvl?"#f87171":"w"===e.lvl?"#fbbf24":"#94a3b8"},children:e.msg})]},"b-".concat(t)))),ue?(0,a.jsx)(o.A,{component:"div",style:{color:Ho},sx:{mt:T.length?1:0},children:Ge("deviceFarmLogcatNoIos","Live logcat is not available for iOS devices (Android only).")}):le?(0,a.jsx)(o.A,{component:"div",style:{color:Ho},sx:{mt:T.length?1:0},children:Ge("deviceFarmLogcatOffline","Device is offline \u2014 no logs available.")}):B?0===O.length?(0,a.jsx)(o.A,{component:"div",style:{color:Ho},sx:{mt:T.length?1:0},children:Ge("deviceFarmLogcatEmpty","No recent logcat output from this device.")}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{component:"div",style:{color:Ho},sx:{mt:1,mb:.25,textTransform:"uppercase",letterSpacing:"0.06em",fontSize:"0.6rem"},children:"logcat"}),O.map(((e,t)=>(0,a.jsx)(o.A,{component:"div",sx:{color:"#cbd5e1",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:e},"lc-".concat(t))))]}):(0,a.jsx)(o.A,{component:"div",style:{color:Ho},sx:{mt:T.length?1:0},children:Ge("deviceFarmLogcatWaiting","Waiting for device logs\u2026")})]})]}),(0,a.jsxs)(j.A,{open:F,onClose:()=>C(!1),maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{borderRadius:{xs:0,sm:2},m:{xs:0,sm:4},width:{xs:"100vw",sm:"calc(100% - 64px)"},height:{xs:"100vh",sm:"85vh"},bgcolor:Po}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,px:2,py:1.25,borderBottom:"1px solid rgba(148,163,184,.2)"},children:[(0,a.jsx)(o.A,{component:"span",style:{color:"#e2e8f0",fontWeight:700,fontSize:"0.875rem"},children:Ge("deviceFarmDeviceLogs","Device logs")}),(0,a.jsx)(o.A,{sx:{flex:1}}),(0,a.jsx)(Et.A,{variant:"plain",value:ze(),iconSize:16,copyLabel:Ge("deviceFarmLogCopy","Copy"),tooltipProps:{enterDelay:1e3,enterNextDelay:1e3},sx:{width:30,height:30,color:"#94a3b8","&:hover":{color:"#e2e8f0"}}}),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ge("deviceFarmLogDownload","Download"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:Ie,sx:{width:30,height:30,color:"#94a3b8","& svg":{fontSize:16},"&:hover":{color:"#e2e8f0"}},children:(0,a.jsx)(ne.default,{})})}),(0,a.jsx)(q.A,{placement:"top",enterDelay:1e3,enterNextDelay:1e3,title:Ge("close","Close"),arrow:!0,children:(0,a.jsx)(Y.A,{size:"small",onClick:()=>C(!1),sx:{width:30,height:30,color:"#94a3b8","& svg":{fontSize:18},"&:hover":{color:"#e2e8f0"}},children:(0,a.jsx)(Cn.default,{})})})]}),(0,a.jsx)(o.A,{component:"pre",sx:{flex:1,m:0,p:2,overflow:"auto",color:"#cbd5e1",fontFamily:"ui-monospace, Menlo, Consolas, monospace",fontSize:{xs:"0.7rem",sm:"0.75rem"},lineHeight:1.7,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:ze()||Ge("deviceFarmLogcatEmpty","No recent logcat output from this device.")})]})]})]})]})}const Jo={display:"flex",alignItems:"center",gap:1.25,borderRadius:2,border:"1px solid",px:1.75,py:1.25};function Qo(e,t){return t?{width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1.5,border:"1px solid ".concat(_e.slate100),bgcolor:_e.slate50,color:_e.slate300,cursor:"not-allowed",p:0}:e?{width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1.5,border:"1px solid #dbeafe",bgcolor:"#eff6ff",color:_e.brand,cursor:"pointer",p:0,"&:hover":{bgcolor:"#dbeafe"}}:{width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1.5,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff",color:_e.slate500,cursor:"pointer",p:0,"&:hover":{color:_e.brand,borderColor:_e.brand}}}var $o=n(582917);function Zo(e){let{rows:t=5,variant:n="nodes"}=e;return(0,a.jsxs)(o.A,{"aria-busy":"true","aria-live":"polite",children:[(0,a.jsx)(o.A,{sx:{display:"flex",gap:{xs:2,md:3},alignItems:"center",minHeight:44,mb:{xs:1.5,md:2},borderBottom:"1px solid ".concat(_e.slate200),overflow:"hidden"},children:[86,92,104,90].map(((e,t)=>(0,a.jsx)($o.A,{variant:"text",width:e,height:20,sx:{flexShrink:0}},t)))}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:{xs:1.5,md:3},flexWrap:"wrap",px:{xs:1.5,md:2},py:1.5,mb:{xs:1.5,md:2},borderRadius:2.5,border:"1px solid ".concat(_e.slate200)},children:[[54,74,82,70].map(((e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,a.jsx)($o.A,{variant:"circular",width:8,height:8}),(0,a.jsx)($o.A,{variant:"text",width:e,height:16})]},t))),(0,a.jsx)(o.A,{sx:{flex:1,minWidth:0}}),(0,a.jsx)($o.A,{variant:"text",width:150,height:16,sx:{display:{xs:"none",md:"block"}}})]}),"devices"===n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25,flexWrap:"wrap",mb:1.5},children:[(0,a.jsx)($o.A,{variant:"rounded",height:38,sx:{borderRadius:2,width:{xs:"100%",sm:260,md:320}}}),(0,a.jsx)(o.A,{sx:{flex:1,minWidth:0,display:{xs:"none",sm:"block"}}}),[84,96].map(((e,t)=>(0,a.jsx)($o.A,{variant:"rounded",width:e,height:34,sx:{borderRadius:2,display:{xs:"none",md:"block"}}},t))),(0,a.jsx)($o.A,{variant:"rounded",width:150,height:38,sx:{borderRadius:2}})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",gap:2,alignItems:"flex-start",flexWrap:{xs:"wrap",md:"nowrap"}},children:[(0,a.jsxs)(o.A,{sx:{width:{xs:"100%",md:300},flexShrink:0,display:{xs:"none",md:"block"},borderRadius:2.5,border:"1px solid ".concat(_e.slate200),p:2},children:[(0,a.jsx)($o.A,{variant:"text",width:90,height:20,sx:{mb:1.5}}),[0,1,2,3].map((e=>(0,a.jsxs)(o.A,{sx:{mb:2},children:[(0,a.jsx)($o.A,{variant:"text",width:78,height:13,sx:{mb:.75}}),(0,a.jsx)(o.A,{sx:{display:"flex",gap:.75,flexWrap:"wrap"},children:[52,74,60,68].map(((e,t)=>(0,a.jsx)($o.A,{variant:"rounded",width:e,height:26,sx:{borderRadius:999}},t)))})]},e)))]}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0},children:[(0,a.jsx)($o.A,{variant:"text",width:150,height:18,sx:{mb:1.5}}),(0,a.jsx)(o.A,{sx:{display:"grid",gap:2,gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",xl:"repeat(3, minmax(0, 1fr))"}},children:Array.from({length:Math.max(2,Math.min(t,6))}).map(((e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1.5,borderRadius:2.5,border:"1px solid ".concat(_e.slate200),p:2},children:[(0,a.jsx)($o.A,{variant:"rounded",width:72,height:128,sx:{borderRadius:2,flexShrink:0}}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0},children:[(0,a.jsx)($o.A,{variant:"text",width:"70%",height:20}),(0,a.jsx)($o.A,{variant:"rounded",width:140,height:22,sx:{borderRadius:999,my:1}}),(0,a.jsx)(o.A,{sx:{display:"flex",gap:.75,mb:1},children:[70,44,84].map(((e,t)=>(0,a.jsx)($o.A,{variant:"rounded",width:e,height:22,sx:{borderRadius:1.5}},t)))}),(0,a.jsx)($o.A,{variant:"text",width:60,height:16,sx:{mb:1.5}}),(0,a.jsx)($o.A,{variant:"rounded",height:38,sx:{borderRadius:2}})]})]},t)))})]})]})]}):"applibrary"===n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25,flexWrap:"wrap",mb:1.5},children:[(0,a.jsx)($o.A,{variant:"rounded",height:38,sx:{borderRadius:2,width:{xs:"100%",sm:240,md:300}}}),(0,a.jsx)($o.A,{variant:"rounded",width:220,height:38,sx:{borderRadius:2,display:{xs:"none",sm:"block"}}}),(0,a.jsx)(o.A,{sx:{flex:1,minWidth:0,display:{xs:"none",sm:"block"}}}),[84,96].map(((e,t)=>(0,a.jsx)($o.A,{variant:"rounded",width:e,height:34,sx:{borderRadius:2,display:{xs:"none",md:"block"}}},t))),(0,a.jsx)($o.A,{variant:"rounded",width:160,height:38,sx:{borderRadius:2}})]}),(0,a.jsxs)(o.A,{sx:{borderRadius:2.5,border:"1px solid ".concat(_e.slate200),overflow:"hidden"},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:{xs:1.5,md:2},py:1.25,bgcolor:_e.slate50},children:[(0,a.jsx)($o.A,{variant:"text",width:90,height:16,sx:{ml:5}}),(0,a.jsx)(o.A,{sx:{display:{xs:"none",md:"flex"},gap:2,flex:1,minWidth:0},children:[0,1,2,3].map((e=>(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}},e)))}),(0,a.jsx)($o.A,{variant:"text",width:52,height:16,sx:{flexShrink:0,ml:"auto"}})]}),Array.from({length:Math.max(2,Math.min(t,6))}).map(((e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:{xs:1.5,md:2},py:1.75,borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)($o.A,{variant:"text",width:10,height:16,sx:{flexShrink:0}}
1),(0,a.jsx)($o.A,{variant:"rounded",width:34,height:34,sx:{borderRadius:2,flexShrink:0}}),(0,a.jsxs)(o.A,{sx:{width:"28%",minWidth:0},children:[(0,a.jsx)($o.A,{variant:"text",height:16,width:"80%"}),(0,a.jsx)($o.A,{variant:"text",height:13,width:"60%"})]}),(0,a.jsx)(o.A,{sx:{display:{xs:"none",md:"flex"},gap:2,flex:1,minWidth:0,alignItems:"center"},children:[0,1,2,3].map((e=>(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}},e)))}),(0,a.jsx)($o.A,{variant:"circular",width:22,height:22,sx:{ml:"auto",flexShrink:0}})]},t)))]})]}):"runs"===n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25,flexWrap:"wrap",mb:1.5},children:[(0,a.jsx)($o.A,{variant:"rounded",height:38,sx:{borderRadius:2,width:{xs:"100%",sm:260,md:320}}}),(0,a.jsx)(o.A,{sx:{flex:1,minWidth:0,display:{xs:"none",sm:"block"}}}),[84,96].map(((e,t)=>(0,a.jsx)($o.A,{variant:"rounded",width:e,height:34,sx:{borderRadius:2,display:{xs:"none",md:"block"}}},t)))]}),(0,a.jsxs)(o.A,{sx:{borderRadius:2.5,border:"1px solid ".concat(_e.slate200),overflow:"hidden"},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:{xs:1.5,md:2},py:1.25,bgcolor:_e.slate50},children:[(0,a.jsx)($o.A,{variant:"text",width:"20%",height:16}),(0,a.jsx)(o.A,{sx:{display:{xs:"none",md:"flex"},gap:2,flex:1,minWidth:0},children:[0,1,2,3,4].map((e=>(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}},e)))})]}),Array.from({length:t}).map(((e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:{xs:1.5,md:2},py:1.5,borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,width:"20%",minWidth:0},children:[(0,a.jsx)($o.A,{variant:"circular",width:8,height:8,sx:{flexShrink:0}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}})]}),(0,a.jsxs)(o.A,{sx:{display:{xs:"none",md:"flex"},gap:2,flex:1,minWidth:0,alignItems:"center"},children:[(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}}),(0,a.jsx)($o.A,{variant:"rounded",height:22,sx:{flex:1,borderRadius:999}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}})]})]},t)))]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:1.5},children:[(0,a.jsx)($o.A,{variant:"text",width:130,height:16}),(0,a.jsx)($o.A,{variant:"rounded",width:92,height:28,sx:{borderRadius:2}})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25,flexWrap:"wrap",mb:1.5},children:[(0,a.jsx)($o.A,{variant:"rounded",height:38,sx:{borderRadius:2,width:{xs:"100%",sm:260,md:320}}}),(0,a.jsx)(o.A,{sx:{flex:1,minWidth:0,display:{xs:"none",sm:"block"}}}),[84,96,104,88].map(((e,t)=>(0,a.jsx)($o.A,{variant:"rounded",width:e,height:34,sx:{borderRadius:2,display:{xs:"none",md:"block"}}},t))),(0,a.jsx)($o.A,{variant:"rounded",width:124,height:38,sx:{borderRadius:2}})]}),(0,a.jsxs)(o.A,{sx:{borderRadius:2.5,border:"1px solid ".concat(_e.slate200),overflow:"hidden"},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:{xs:1.5,md:2},py:1.25,bgcolor:_e.slate50},children:[(0,a.jsx)($o.A,{variant:"rounded",width:16,height:16,sx:{flexShrink:0}}),(0,a.jsx)($o.A,{variant:"text",width:"22%",height:16}),(0,a.jsx)(o.A,{sx:{display:{xs:"none",md:"flex"},gap:2,flex:1,minWidth:0},children:[0,1,2,3,4,5].map((e=>(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}},e)))}),(0,a.jsx)($o.A,{variant:"text",width:56,height:16,sx:{flexShrink:0,ml:"auto"}})]}),Array.from({length:t}).map(((e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:{xs:1.5,md:2},py:1.5,borderTop:"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)($o.A,{variant:"rounded",width:16,height:16,sx:{flexShrink:0}}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,width:"22%",minWidth:0},children:[(0,a.jsx)($o.A,{variant:"circular",width:8,height:8,sx:{flexShrink:0}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}})]}),(0,a.jsxs)(o.A,{sx:{display:{xs:"none",md:"flex"},gap:2,flex:1,minWidth:0,alignItems:"center"},children:[(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}}),(0,a.jsx)($o.A,{variant:"rounded",height:22,sx:{flex:1,borderRadius:999}}),(0,a.jsx)($o.A,{variant:"rounded",height:22,sx:{flex:1,borderRadius:999}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}}),(0,a.jsx)($o.A,{variant:"text",height:16,sx:{flex:1}})]}),(0,a.jsx)(o.A,{sx:{display:"flex",gap:.75,ml:"auto",flexShrink:0},children:[0,1,2,3].map((e=>(0,a.jsx)($o.A,{variant:"circular",width:22,height:22},e)))})]},t)))]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:1.5},children:[(0,a.jsx)($o.A,{variant:"text",width:130,height:16}),(0,a.jsx)($o.A,{variant:"rounded",width:92,height:28,sx:{borderRadius:2}})]})]})]})}var ei=n(843795),ti=n(312504),ni=n(480392),oi=n(90221),ii=n(577915),li=n(677046);const ai="\u2014",ri=e=>
1"IOS"===String(e).toUpperCase()?"iOS":"ANDROID"===String(e).toUpperCase()?"Android":e||ai;function si(e){var t,n,o;const i=null!==(t=null!==(n=null!==(o=e.fileSize)&&void 0!==o?o:e.sizeBytes)&&void 0!==n?n:e.size)&&void 0!==t?t:null;return null==i?null:"number"===typeof i?"".concat((i/1048576).toFixed(1)," MB"):String(i)}function ci(e){var t,n,o,i;const l=null!==(t=null!==(n=null!==(o=null!==(i=e.updatedDate)&&void 0!==i?i:e.updatedAt)&&void 0!==o?o:e.createdDate)&&void 0!==n?n:e.createdAt)&&void 0!==t?t:null;if(!l)return null;const a=new Date(l);return Number.isNaN(a.getTime())?null:a}function di(e){const t=ci(e);return t?t.toLocaleDateString():null}function pi(e){const t=ci(e);return t?"".concat(t.toLocaleDateString()," ").concat(t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})):null}const xi=e=>{var t,n,o;return null!==(t=null!==(n=null!==(o=e.uploadedBy)&&void 0!==o?o:e.createdBy)&&void 0!==n?n:e.uploaderName)&&void 0!==t?t:null};function mi(e,t,n){(0,E.useEffect)((()=>{if(!e)return;const o=e=>{t.current&&!t.current.contains(e.target)&&n()},i=e=>{"Escape"===e.key&&n()};return document.addEventListener("mousedown",o,!0),document.addEventListener("keydown",i,!0),()=>{document.removeEventListener("mousedown",o,!0),document.removeEventListener("keydown",i,!0)}}),[e,t,n])}function ui(e,t,n){const o=new Blob([t],{type:n}),i=URL.createObjectURL(o),l=document.createElement("a");l.href=i,l.download=e,l.click(),URL.revokeObjectURL(i)}const fi=e=>'"'.concat(String(null!==e&&void 0!==e?e:"").replace(/"/g,'""'),'"'),hi=(e,t)=>[e,...t].map((e=>e.map(fi).join(","))).join("\n"),vi={px:2,py:1.5,fontWeight:600,fontSize:"0.82rem",whiteSpace:"nowrap",color:_e.slate500,textAlign:"left"},gi={px:2,py:1.75,verticalAlign:"middle"};function bi(e){let{canManage:t=!0,hideCompanyPicker:n=!1,companies:l,appLibCompanyId:r,onCompanyChange:s,apps:c,loading:d=!1,busy:p,maxApps:x,onAdd:m,onUpdate:u,onDelete:f,onRename:h,onEditIdentity:v}=e;const b=(0,Ce.xz)()||n,A=e=>(null===e||void 0===e?void 0:e.displayName)||(null===e||void 0===e?void 0:e.fileName)||(null===e||void 0===e?void 0:e.packageId)||"#".concat(null===e||void 0===e?void 0:e.id),y=e=>!String((null===e||void 0===e?void 0:e.packageId)||"").trim(),[j,S]=(0,E.useState)(!1),[w,k]=(0,E.useState)(""),[F,C]=(0,E.useState)(""),[z,I]=(0,E.useState)("all"),[R,D]=(0,E.useState)(null),[T,W]=(0,E.useState)(!1),[O,L]=(0,E.useState)(null),[B,U]=(0,E.useState)(null),[P,H]=(0,E.useState)(!1),[V,K]=(0,E.useState)(null),[_,q]=(0,E.useState)(!1),Y=(0,E.useRef)(null),G=(0,E.useRef)(null);mi(P,Y,(0,E.useCallback)((()=>H(!1)),[]));mi(T,G,(0,E.useCallback)((()=>W(!1)),[]));const $=(0,E.useRef)(null),ee=(0,E.useRef)(null),te=(0,E.useRef)(null),ne=(0,E.useMemo)((()=>{const e=F.trim().toLowerCase();return(c||[]).filter((t=>{const n=ri(t.platform);if("all"!==z&&n!==z)return!1;if(e){if(!"".concat(t.displayName||""," ").concat(t.fileName||""," ").concat(t.packageId||""," ").concat(n).toLowerCase().includes(e))return!1}return!0}))}),[c,F,z]),oe=(0,E.useMemo)((()=>{const e=(c||[]).filter((e=>"Android"===ri(e.platform))).length,t=(c||[]).filter((e=>"iOS"===ri(e.platform))).length,n=(c||[]).reduce(((e,t)=>e+function(e){var t,n,o;const i=null!==(t=null!==(n=null!==(o=e.fileSize)&&void 0!==o?o:e.sizeBytes)&&void 0!==n?n:e.size)&&void 0!==t?t:null;if("number"===typeof i)return i/1048576;if("string"===typeof i){const e=parseFloat(i);return Number.isNaN(e)?0:e}return 0}(t)),0),o=(c||[]).filter(y).length;return{total:(c||[]).length,builds:(c||[]).length,android:e,ios:t,mb:n,noPkg:o}}),[c]),ie=(0,a.jsx)(Ze,{segs:[{key:"apps",label:Ge("deviceFarmAppsApplications","Applications"),value:oe.total,color:_e.brand},{key:"builds",label:Ge("deviceFarmAppsBuilds","Versions"),value:oe.builds,color:_e.violet},{key:"osmix",label:Ge("deviceFarmAppsAndroidIos","Android / iOS"),value:"".concat(oe.android,"/").concat(oe.ios),color:_e.emerald}],right:(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25},children:[oe.noPkg>0&&(0,a.jsxs)(o.A,{component:"span",title:Ge("deviceFarmAppsNoPkgTip","Runs started with these apps may open the wrong app"),sx:{display:"inline-flex",alignItems:"center",gap:.5,fontSize:"0.75rem",fontWeight:600,color:"#9a3412",bgcolor:"#fff7ed",border:"1px solid #fed7aa",borderRadius:999,px:1,py:.25},children:[(0,a.jsx)(li.default,{sx:{fontSize:14}}),String(Ge("deviceFarmAppsNoPkgCount","{n} app(s) missing package id")).replace("{n}",oe.noPkg)]}),(0,a.jsx)(g.A,{component:"span",sx:{fontSize:"0.8125rem",color:_e.slate500},children:oe.mb?"".concat(oe.mb.toFixed(1)," MB ").concat(Ge("deviceFarmAppsStored","stored")):"".concat(ai," ").concat(Ge("deviceFarmAppsStored","stored"))})]})}),le=e=>{W(!1);const t=("all"===e?c||[]:ne).map((e=>[A(e),e.packageId||"",ri(e.platform),e.version||"",si(e)||"",di(e)||"",xi(e)||""]));ui("app-library-".concat(e,".csv"),hi(["App","Package","Platform","Build","Size","Uploaded","By"],t),"text/csv")},ae=(c||[]).length>=x,[re,se]=(0,E.useState)(""),ce=()=>L(null),[de,pe]=(0,E.useState)(!1),xe=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),de||pe(!0)},me=()=>{if(!B||!h)return;const e=(w||"").trim();Promise.resolve(h(B,e)).then((()=>{U((t=>t&&t.id===B.id?(0,i.A)((0,i.A)({},t),{},{displayName:e||null}):t)),S(!1)})).catch((()=>{}))};(0,E.useEffect)((()=>
1{if(!B)return K(null),void q(!1);K({platform:"IOS"===String(B.platform||"").toUpperCase()?"IOS":"ANDROID",packageId:B.packageId||"",mainActivity:B.mainActivity||"",version:B.version||""})}),[B]);const ue=e=>[[Ge("deviceFarmAppsMetaApplication","Application"),A(e)],[Ge("deviceFarmAppsMetaFileName","File name"),e.fileName||ai],[Ge("deviceFarmAppsMetaPackage","Package"),e.packageId||ai],[Ge("deviceFarmAppsMetaPlatform","Platform"),ri(e.platform),(0,a.jsx)(Pe.Ay,{platform:e.platform,full:!0},"pf")],[Ge("deviceFarmAppsMetaBuild","Version"),e.version||ai],[Ge("deviceFarmAppsMetaSize","Size"),si(e)||ai],[Ge("deviceFarmAppsMetaUploaded","Uploaded"),pi(e)||ai],[Ge("deviceFarmAppsMetaUploadedBy","Uploaded by"),xi(e)||ai],[Ge("deviceFarmAppsMetaUrl","URL"),e.url||ai]],fe=e=>{if(H(!1),!B)return;const t=ue(B),n="".concat(B.fileName||B.packageId||B.id).replace(/[\s()]+/g,"-").replace(/-+$/,"");"csv"!==e?"json"!==e?navigator.clipboard&&navigator.clipboard.writeText(t.map((e=>"".concat(e[0],": ").concat(e[1]))).join("\n")):ui("".concat(n,".json"),JSON.stringify(Object.fromEntries(t),null,2),"application/json"):ui("".concat(n,".csv"),hi(t.map((e=>e[0])),[t.map((e=>e[1]))]),"text/csv")};return(0,a.jsxs)(o.A,{sx:{fontFamily:"Inter, sans-serif"},children:[!b&&(0,a.jsxs)(o.A,{sx:{mb:2,maxWidth:320},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.6875rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:_e.slate400,mb:.75},children:Ge("company","Company")}),(0,a.jsx)(ot,{value:String(r||""),onChange:e=>s(e),options:[["",Ge("deviceFarmAppLibPickCompanyShort","Select a company\u2026")],...l.map((e=>{var t;const n=null!==(t=e.companyId)&&void 0!==t?t:e.id;return[String(n),e.companyName||e.name||"#".concat(n)]}))]})]}),r||b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{sx:{mb:2},children:ie}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,mb:1.5,flexWrap:"wrap"},children:[(0,a.jsx)(it,{value:F,onChange:C,placeholder:Ge("deviceFarmAppsSearch","Search app / package\u2026")}),(0,a.jsx)(o.A,{sx:{display:"inline-flex",alignItems:"center",gap:.25,ml:.5,p:"3px",borderRadius:2.5,bgcolor:_e.slate100,border:"1px solid ".concat(_e.slate200),flexShrink:0},children:[["all",Ge("deviceFarmFilterAll","All")],["Android","Android"],["iOS","iOS"]].map((e=>{let[t,n]=e;return(0,a.jsxs)(o.A,{component:"button",onClick:()=>{I(t),D(null)},sx:{px:{xs:1.25,sm:1.75},py:.625,borderRadius:2,fontFamily:"inherit",fontSize:"0.8125rem",fontWeight:z===t?700:500,border:"none",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:.5,whiteSpace:"nowrap",transition:"background-color .15s, color .15s, box-shadow .15s",bgcolor:z===t?"#fff":"transparent",color:z===t?_e.brand:_e.slate500,boxShadow:z===t?"0 1px 2px rgba(15,23,42,.10)":"none","&:hover":{bgcolor:z===t?"#fff":"rgba(255,255,255,0.6)",color:z===t?_e.brand:_e.slate700}},children:["all"!==t&&(0,a.jsx)(Pe.jE,{platform:t,size:15}),n]},t)}))}),(0,a.jsx)(o.A,{sx:{flex:1}}),(0,a.jsx)(Xe,{icon:(0,a.jsx)(Z.default,{}),onClick:Ai(s,r),children:Ge("deviceFarmRefresh","Refresh")}),(0,a.jsxs)(o.A,{sx:{position:"relative"},ref:G,children:[(0,a.jsxs)(Xe,{icon:(0,a.jsx)(qt.default,{}),onClick:()=>W((e=>!e)),disabled:!(c||[]).length,children:[Ge("deviceFarmExport","Export")," \u25be"]}),T&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(o.A,{sx:{position:"absolute",right:0,mt:1,width:240,bgcolor:"#fff",borderRadius:2.5,boxShadow:"0 12px 32px -12px rgba(15,23,42,.35)",border:"1px solid ".concat(_e.slate100),py:.75,zIndex:30},children:[(0,a.jsx)(yi,{onClick:()=>le("filtered"),children:Ge("deviceFarmAppsExportFiltered","Filtered results (.csv)")}),(0,a.jsx)(yi,{onClick:()=>le("all"),children:Ge("deviceFarmAppsExportAll","All apps (.csv)")})]})})]}),t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{component:"span",sx:{width:"1px",height:24,bgcolor:_e.slate200,mx:.5}}),(0,a.jsx)(Je,{icon:(0,a.jsx)(ti.default,{}),onClick:()=>{ae?se(Ge("deviceFarmAppsCapReachedMsg","App Library dolu \u2014 yeni uygulama eklemek i\xe7in mevcut bir uygulamay\u0131 g\xfcncelleyin ya da silin.")):L({file:null,notes:"",busy:!1})}
1,children:Ge("deviceFarmAppsUploadBuild","Upload build")})]})]}),re&&(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,mb:1,px:1.5,py:1,borderRadius:2,border:"1px solid #fed7aa",bgcolor:"#fff7ed"},children:[(0,a.jsx)(o.A,{component:"span",style:{color:"#9a3412"},sx:{fontSize:"0.78rem"},children:re}),(0,a.jsx)(o.A,{component:"button",onClick:()=>se(""),sx:{border:"none",background:"none",cursor:"pointer",color:"#9a3412",display:"inline-flex",p:.25},children:(0,a.jsx)(Cn.default,{sx:{fontSize:16}})})]}),(0,a.jsx)(o.A,{sx:(0,i.A)({borderRadius:3,border:"1px solid ".concat(_e.slate100),bgcolor:"#fff",overflowX:"auto",overflowY:"hidden"},Ye),children:(0,a.jsxs)(o.A,{component:"table",sx:{width:"100%",minWidth:760,borderCollapse:"collapse",fontSize:{xs:"0.8125rem",sm:"0.9rem"},"& th":{whiteSpace:"nowrap"}},children:[(0,a.jsx)(o.A,{component:"thead",children:(0,a.jsxs)(o.A,{component:"tr",sx:{borderBottom:"1px solid ".concat(_e.slate200),bgcolor:"#EFF1F5"},children:[(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},vi),{},{width:"4%",minWidth:40})}),(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},vi),{},{width:"34%"}),children:Ge("deviceFarmAppsColApplication","Application")}),(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},vi),{},{width:"12%",minWidth:110}),children:Ge("deviceFarmAppsColPlatform","Platform")}),(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},vi),{},{width:"24%",minWidth:180}),children:Ge("deviceFarmAppsColLatest","Latest version")}),(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},vi),{},{width:"8%",minWidth:70}),children:Ge("deviceFarmAppsColBuilds","Versions")}),(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},vi),{},{width:"12%",minWidth:110}),children:Ge("deviceFarmAppsColUpdated","Updated")}),(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},vi),{},{width:"6%",minWidth:64,textAlign:"center"}),children:Ge("actions","Actions")})]})}),(0,a.jsx)(o.A,{component:"tbody",children:d?[0,1,2,3,4].map((e=>(0,a.jsxs)(o.A,{component:"tr",sx:{borderBottom:"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},gi),{},{width:40}),children:(0,a.jsx)($o.A,{variant:"text",width:10,height:16})}),(0,a.jsx)(o.A,{component:"td",sx:gi,children:(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[(0,a.jsx)($o.A,{variant:"rounded",width:32,height:32,sx:{borderRadius:2,flexShrink:0}}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0},children:[(0,a.jsx)($o.A,{variant:"text",width:"45%",height:16}),(0,a.jsx)($o.A,{variant:"text",width:"30%",height:13})]})]})}),(0,a.jsx)(o.A,{component:"td",sx:gi,children:(0,a.jsx)($o.A,{variant:"text",width:56,height:16})}),(0,a.jsxs)(o.A,{component:"td",sx:gi,children:[(0,a.jsx)($o.A,{variant:"text",width:96,height:16}),(0,a.jsx)($o.A,{variant:"text",width:132,height:13})]}),(0,a.jsx)(o.A,{component:"td",sx:gi,children:(0,a.jsx)($o.A,{variant:"text",width:16,height:16})}),(0,a.jsx)(o.A,{component:"td",sx:gi,children:(0,a.jsx)($o.A,{variant:"text",width:72,height:16})}),(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},gi),{},{textAlign:"center"}),children:(0,a.jsx)($o.A,{variant:"circular",width:20,height:20,sx:{mx:"auto"}})})]},"sk-".concat(e)))):0===ne.length?(0,a.jsx)(o.A,{component:"tr",children:(0,a.jsxs)(o.A,{component:"td",colSpan:7,sx:{py:6,textAlign:"center",color:_e.slate400},children:[(0,a.jsx)(ii.default,{sx:{fontSize:28,mb:1,display:"block",mx:"auto"}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.85rem"},children:Ge("deviceFarmAppsNoMatch","No application matches your search.")})]})}):ne.map((e=>{const n=R===e.id,l=si(e),r=xi(e),s=di(e);return(0,a.jsxs)(E.Fragment,{children:[(0,a.jsxs)(o.A,{component:"tr",sx:{borderBottom:"1px solid ".concat(_e.slate100),bgcolor:n?"rgba(239,246,255,0.5)":"transparent","&:hover":{bgcolor:n?"rgba(239,246,255,0.5)":"#fafbfc"}},children:[(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},gi),{},{width:40}),children:(0,a.jsx)(Qe,{size:28,title:n?Ge("deviceFarmCollapse","Collapse"):Ge("deviceFarmExpand","Expand"),onClick:()=>D(n?null:e.id),children:n?(0,a.jsx)(Lo.default,{}):(0,a.jsx)(ni.default,{})})}),(0,a.jsx)(o.A,{component:"td",sx:gi,children:(0,a.jsx)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.5,minWidth:0},children:(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontWeight:500,color:_e.slate800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.displayName?"".concat(e.displayName," \xb7 ").concat(e.fileName||""):e.fileName||e.packageId,children:A(e)}),(0,a.jsx)(g.A,{sx:{fontSize:"0.75rem",color:_e.slate400,fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.packageId||ai}),y(e)&&(0,a.jsxs)(o.A,{component:"span",title:Ge("deviceFarmAppsNoPkgTip","Runs started with these apps may open the wrong app"),sx:{display:"inline-flex",alignItems:"center",gap:.4,mt:.4,fontSize:"0.68rem",fontWeight:600,color:"#9a3412",bgcolor:"#fff7ed",border:"1px solid #fed7aa",borderRadius:.75,px:.7,py:.1},children:[(0,a.jsx)(li.default,{sx:{fontSize:12}}),Ge("deviceFarmAppsNoPkg","package id could not be read")]})]})})}),(0,a.jsx)(o.A,{component:"td",sx:gi,children:(0,a.jsx)(Pe.Ay,{platform:e.platform,full:!0})}),(0,a.jsxs)(o.A,{component:"td",sx:gi,children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontWeight:500,color:_e.slate800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.version||ai}),(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.625rem",fontWeight:700,color:_e.emeraldDk,bgcolor:"#ecfdf5",border:"1px solid #a7f3d0",borderRadius:.75,px:.75,py:.25,flexShrink:0},children:Ge("deviceFarmAppsLatestBadge","LATEST")})]}),(0,a.jsx)(g.A,{sx:{fontSize:"0.75rem",color:_e.slate400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}
1,children:[l,r].filter(Boolean).join(" \xb7 ")||ai})]}),(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},gi),{},{color:_e.slate600}),children:"1"}),(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},gi),{},{color:_e.slate500,fontSize:"0.8rem",whiteSpace:"nowrap"}),children:s||ai}),(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},gi),{},{textAlign:"center",whiteSpace:"nowrap"}),children:(0,a.jsx)(Qe,{size:32,title:Ge("deviceFarmAppsBuildMeta","App details"),onClick:()=>U(e),children:(0,a.jsx)(Pt.default,{})})})]}),n&&(0,a.jsxs)(o.A,{component:"tr",sx:{bgcolor:"rgba(239,246,255,0.5)"},children:[(0,a.jsx)(o.A,{component:"td"}),(0,a.jsx)(o.A,{component:"td",colSpan:6,sx:{pt:.5,pb:2,pr:2},children:(0,a.jsxs)(o.A,{sx:{borderRadius:2.5,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff",overflow:"hidden",boxShadow:"0 1px 2px rgba(0,0,0,.04)"},children:[(0,a.jsxs)(o.A,{sx:{px:2,py:1,borderBottom:"1px solid ".concat(_e.slate100),bgcolor:"rgba(248,250,252,0.6)",fontSize:"0.6875rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:_e.slate400},children:[Ge("deviceFarmAppsBuildHistory","Version history")," \xb7 1"]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1.25,minWidth:0},children:[(0,a.jsx)(o.A,{sx:{width:6,height:6,borderRadius:"50%",bgcolor:_e.emerald,flexShrink:0}}),(0,a.jsx)(g.A,{sx:{flexShrink:0,minWidth:56,fontSize:"0.85rem",fontWeight:500,color:_e.slate800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.version||ai}),(0,a.jsx)(g.A,{sx:{flexShrink:0,fontSize:"0.8rem",color:_e.slate500},children:l||ai}),(0,a.jsx)(g.A,{sx:{flexShrink:0,fontSize:"0.8rem",color:_e.slate500,display:{xs:"none",md:"block"}},children:s||ai}),(0,a.jsx)(g.A,{title:r||"",sx:{minWidth:0,fontSize:"0.8rem",color:_e.slate500,maxWidth:{md:220,lg:300,xl:420},overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:{xs:"none",md:"block"}},children:r||ai}),(0,a.jsx)(o.A,{sx:{flex:1,minWidth:8}}),(0,a.jsx)(Qe,{size:28,title:Ge("deviceFarmAppsBuildMeta","App details"),onClick:()=>U(e),children:(0,a.jsx)(Pt.default,{sx:{fontSize:"15px !important"}})}),t&&(0,a.jsx)(Qe,{size:28,title:Ge("deviceFarmAppsReplace","Replace app"),onClick:()=>{return t=e,te.current=t,void(ee.current&&ee.current.click());var t},sx:{"&:hover":{color:_e.brand,bgcolor:"#eff6ff"}},children:(0,a.jsx)(ti.default,{sx:{fontSize:"15px !important"}})}),t&&(0,a.jsx)(Qe,{size:28,title:Ge("deviceFarmAppsDelete","Delete build"),onClick:()=>f(e),sx:{"&:hover":{color:_e.rose,bgcolor:"#fff1f2"}},children:(0,a.jsx)(Ae.default,{sx:{fontSize:"15px !important"}})})]})]})})]})]},e.id)}))})]})})]}):(0,a.jsxs)(o.A,{sx:{borderRadius:3,border:"1px dashed ".concat(_e.slate300),p:5,textAlign:"center",color:_e.slate400},children:[(0,a.jsx)(ii.default,{sx:{fontSize:34,mb:1}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.875rem"},children:Ge("deviceFarmAppLibPickCompany","K\xfct\xfcphanesini y\xf6netmek i\xe7in bir m\xfc\u015fteri \u015firket se\xe7.")})]}),(0,a.jsx)("input",{ref:$,type:"file",accept:".apk,.aab,.ipa,.zip",style:{display:"none"},onChange:e=>{const t=e.target.files&&e.target.files[0];e.target.value="",t&&L((e=>(0,i.A)((0,i.A)({},e||{}),{},{file:t,notes:(null===e||void 0===e?void 0:e.notes)||""})))}}),(0,a.jsx)("input",{ref:ee,type:"file",accept:".apk,.aab,.ipa,.zip",style:{display:"none"},onChange:async e=>{const t=e.target.files&&e.target.files[0];e.target.value="";const n=te.current;if(te.current=null,t&&n){L({file:t,notes:"",busy:!0,replace:!0});try{await u(n,t),ce()}catch(o){L((e=>e?(0,i.A)((0,i.A)({},e),{},{busy:!1}):e))}}}}),O&&(0,a.jsxs)(Si,{onClose:O.busy?void 0:ce,width:560,children:[(0,a.jsx)(wi,{icon:(0,a.jsx)(ti.default,{sx:{fontSize:18}}),title:O.replace?Ge("deviceFarmAppsReplace","Replace app"):Ge("deviceFarmAppsUploadBuild","Upload build"),sub:Ge("deviceFarmAppsUploadSub","APK, AAB, IPA or simulator .zip"),onClose:O.busy?void 0:ce}),(0,a.jsx)(o.A,{sx:{flex:1,overflowY:"auto",p:2.5},children:O.busy?(0,a.jsxs)(o.A,{sx:{py:5,textAlign:"center"},children:[(0,a.jsx)(bn.A,{size:28}),(0,a.jsx)(g.A,{sx:{mt:2,fontSize:"0.9rem",color:_e.slate700}
1,children:Ge("deviceFarmAppsUploading","Uploading and parsing\u2026")})]}):O.file?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.5,borderRadius:2.5,border:"1px solid ".concat(_e.slate200),px:1.75,py:1.5,mb:2},children:[(0,a.jsx)(o.A,{sx:{width:36,height:36,borderRadius:2,bgcolor:"#ecfdf5",color:_e.emeraldDk,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,a.jsx)(Q.default,{sx:{fontSize:18}})}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.85rem",fontWeight:600,color:_e.slate800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.file.name}),(0,a.jsx)(g.A,{sx:{fontSize:"0.75rem",color:_e.slate400},children:"".concat((O.file.size/1048576).toFixed(1)," MB")})]}),(0,a.jsx)(o.A,{component:"button",onClick:()=>L((e=>(0,i.A)((0,i.A)({},e),{},{file:null}))),sx:{flexShrink:0,background:"none",border:"none",cursor:"pointer",fontSize:"0.75rem",fontWeight:600,color:_e.slate400,"&:hover":{color:_e.rose}},children:Ge("deviceFarmAppsRemove","Remove")})]}),(0,a.jsx)(g.A,{sx:{fontSize:"0.6875rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:_e.slate400,mb:1},children:Ge("deviceFarmAppsMetadata","Metadata")}),(0,a.jsx)(o.A,{sx:{borderRadius:2.5,border:"1px solid ".concat(_e.slate200),mb:2},children:[[Ge("deviceFarmAppsMetaApplication","Application"),O.file.name],[Ge("deviceFarmAppsMetaPlatform","Platform"),/\.(ipa|zip)$/i.test(O.file.name)?"iOS":"Android",(0,a.jsx)(Pe.Ay,{platform:/\.(ipa|zip)$/i.test(O.file.name)?"IOS":"ANDROID",full:!0},"pf")],[Ge("deviceFarmAppsMetaSize","Size"),"".concat((O.file.size/1048576).toFixed(1)," MB")],[Ge("deviceFarmAppsMetaPackage","Package"),ai],[Ge("deviceFarmAppsMetaVersion","Version"),ai]].map(((e,t)=>{let[n,i,l]=e;return(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1.5,px:1.75,py:1,borderTop:t?"1px solid ".concat(_e.slate100):"none",alignItems:"center"},children:[(0,a.jsx)(g.A,{sx:{width:130,flexShrink:0,color:_e.slate500,fontSize:"0.8rem"},children:n}),l||(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",color:_e.slate800,wordBreak:"break-all"},children:i})]},n)}))}),(0,a.jsxs)(o.A,{component:"label",sx:{display:"block"},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.6875rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:_e.slate400},children:Ge("deviceFarmAppsReleaseNotes","Release notes (optional)")}),(0,a.jsx)(o.A,{component:"input",value:O.notes,onChange:e=>L((t=>(0,i.A)((0,i.A)({},t),{},{notes:e.target.value}))),placeholder:Ge("deviceFarmAppsReleaseNotesPh","What changed in this version?"),sx:{mt:.75,width:"100%",px:1.75,py:1.25,borderRadius:2,border:"1px solid ".concat(_e.slate200),fontSize:"0.85rem",fontFamily:"inherit",color:_e.slate800,"&:focus":{outline:"none",borderColor:_e.brand,boxShadow:"0 0 0 3px ".concat(_e.brand,"22")}}})]})]}):(0,a.jsxs)(o.A,{component:"button",type:"button",onClick:()=>$.current&&$.current.click(),onDragEnter:xe,onDragOver:xe,onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),pe(!1)},onDrop:e=>{e.preventDefault(),e.stopPropagation(),pe(!1);const t=e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files[0];var n;t&&(n=t.name,/\.(apk|aab|ipa|zip)$/i.test(n||"")?L((e=>(0,i.A)((0,i.A)({},e||{}),{},{file:t,notes:(null===e||void 0===e?void 0:e.notes)||""}))):se(Ge("deviceFarmAppsWrongType","Yaln\u0131zca APK, AAB, IPA veya sim\xfclat\xf6r .zip dosyas\u0131 y\xfckleyebilirsiniz.")))},sx:{width:"100%",borderRadius:3,border:"2px dashed ".concat(de?_e.brand:_e.slate300),bgcolor:de?"rgba(239,246,255,0.7)":"transparent",cursor:"pointer",py:6,display:"flex",flexDirection:"column",alignItems:"center",gap:1,transition:"all .15s","& *":{pointerEvents:"none"},"&:hover":{borderColor:_e.brand,bgcolor:"rgba(239,246,255,0.4)"}},children:[(0,a.jsx)(o.A,{sx:{width:48,height:48,borderRadius:"50%",bgcolor:_e.slate100,color:_e.slate400,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,a.jsx)(oi.default,{})}),(0,a.jsx)(g.A,{sx:{fontSize:"0.95rem",fontWeight:600,color:_e.slate700},children:Ge("deviceFarmAppsDrop","Drop an APK, AAB, IPA or simulator .zip here")}),(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",color:_e.slate400},children:Ge("deviceFarmAppsDropHint","or click to choose a file")})]})}),(0,a.jsxs)(ki,{children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",color:_e.slate500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.file&&!O.busy?O.file.name:""}),(0,a.jsx)(o.A,{sx:{flex:1}}),(0,a.jsx)(Xe,{onClick:ce,disabled:O.busy,children:Ge("cancel","Cancel")}),(0,a.jsx)(Je,{icon:(0,a.jsx)(ti.default,{}),onClick:async()=>
1{if(null!==O&&void 0!==O&&O.file){L((e=>(0,i.A)((0,i.A)({},e),{},{busy:!0})));try{await m(O.file),ce()}catch(e){L((e=>e?(0,i.A)((0,i.A)({},e),{},{busy:!1}):e))}}},disabled:!O.file||O.busy||p,children:Ge("deviceFarmAppsUpload","Upload")})]})]}),B&&(0,a.jsxs)(Si,{onClose:()=>{U(null),H(!1)},width:620,children:[(0,a.jsx)(wi,{icon:"iOS"===ri(B.platform)?(0,a.jsx)(ei.default,{sx:{fontSize:18}}):(0,a.jsx)(X.default,{sx:{fontSize:18}}),title:"".concat(B.fileName||B.packageId||"#".concat(B.id)).concat(B.version?" \xb7 ".concat(B.version):""),sub:"".concat(B.packageId||ai," \xb7 ").concat(ri(B.platform)),onClose:()=>{U(null),H(!1)},right:(0,a.jsxs)(o.A,{sx:{position:"relative"},ref:Y,children:[(0,a.jsxs)(Xe,{icon:(0,a.jsx)(qt.default,{}),onClick:()=>H((e=>!e)),children:[Ge("deviceFarmExport","Export")," \u25be"]}),P&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(o.A,{sx:{position:"absolute",right:0,mt:1,width:220,bgcolor:"#fff",borderRadius:2.5,boxShadow:"0 12px 32px -12px rgba(15,23,42,.35)",border:"1px solid ".concat(_e.slate100),py:.75,zIndex:30},children:[(0,a.jsx)(yi,{onClick:()=>fe("csv"),children:Ge("deviceFarmAppsMetaCsv","Metadata (.csv)")}),(0,a.jsx)(yi,{onClick:()=>fe("json"),children:Ge("deviceFarmAppsMetaJson","Metadata (.json)")}),(0,a.jsx)(yi,{onClick:()=>fe("copy"),children:Ge("deviceFarmAppsMetaCopy","Copy as text")})]})})]})}),(0,a.jsxs)(o.A,{sx:{flex:1,overflowY:"auto",p:2.5},children:[t&&v&&V&&(0,a.jsxs)(o.A,{sx:{mb:2,borderRadius:2.5,border:"1px solid ".concat(y(B)?"#fed7aa":_e.slate200),overflow:"hidden"},children:[y(B)&&(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1,alignItems:"flex-start",px:1.75,py:1.25,bgcolor:"#fff7ed"},children:[(0,a.jsx)(li.default,{sx:{fontSize:16,color:"#9a3412",mt:"1px",flexShrink:0}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.78rem",color:"#9a3412",lineHeight:1.5},children:Ge("deviceFarmAppsNoPkgHelp","This app has no package id. Fix the platform and enter the id manually.")})]}),(0,a.jsxs)(o.A,{sx:{px:1.75,py:1.5,display:"flex",flexDirection:"column",gap:1.25},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1.25,flexWrap:"wrap"},children:[(0,a.jsxs)(o.A,{sx:{minWidth:150,flex:"0 0 auto"},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.72rem",color:_e.slate500,mb:.4},children:Ge("deviceFarmAppsMetaPlatform","Platform")}),(0,a.jsxs)(M.A,{select:!0,size:"small",fullWidth:!0,value:V.platform,onChange:e=>K((t=>(0,i.A)((0,i.A)({},t),{},{platform:e.target.value}))),SelectProps:{sx:{"& .MuiSelect-select":{display:"flex",alignItems:"center",gap:.75,fontSize:"0.8125rem",py:.9}}},sx:{"& .MuiOutlinedInput-root":{borderRadius:2,bgcolor:"#fff"},"& .MuiOutlinedInput-notchedOutline":{borderColor:_e.slate200},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:_e.brand}},children:[(0,a.jsxs)(N.A,{value:"ANDROID",sx:{display:"flex",alignItems:"center",gap:1,fontSize:"0.8125rem"},children:[(0,a.jsx)(Pe.jE,{platform:"ANDROID",size:16}),"Android"]}),(0,a.jsxs)(N.A,{value:"IOS",sx:{display:"flex",alignItems:"center",gap:1,fontSize:"0.8125rem"},children:[(0,a.jsx)(Pe.jE,{platform:"IOS",size:16}),"iOS"]})]})]}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:220},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.72rem",color:_e.slate500,mb:.4},children:"IOS"===V.platform?Ge("deviceFarmAppsMetaBundleId","Bundle ID"):Ge("deviceFarmAppsMetaPackage","Package")}),(0,a.jsx)(M.A,{size:"small",fullWidth:!0,value:V.packageId,onChange:e=>K((t=>(0,i.A)((0,i.A)({},t),{},{packageId:e.target.value}))),placeholder:"IOS"===V.platform?"com.example.App":"com.example.app",title:V.packageId||"",inputProps:{title:V.packageId||"",style:{fontSize:"0.8rem",fontFamily:"monospace"}}})]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1.25,flexWrap:"wrap"},children:["IOS"!==V.platform&&(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:220},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.72rem",color:_e.slate500,mb:.4},children:Ge("deviceFarmAppsMetaActivity","App Activity")}),(0,a.jsx)(M.A,{size:"small",fullWidth:!0,value:V.mainActivity,onChange:e=>K((t=>(0,i.A)((0,i.A)({},t),{},{mainActivity:e.target.value}))),placeholder:"com.example.app.MainActivity",title:V.mainActivity||"",inputProps:{title:V.mainActivity||"",style:{fontSize:"0.8rem",fontFamily:"monospace"}}})]}),(0,a.jsxs)(o.A,{sx:{width:150,flex:"0 0 auto"},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.72rem",color:_e.slate500,mb:.4},children:Ge("deviceFarmAppsMetaBuild","Version")}),(0,a.jsx)(M.A,{size:"small",fullWidth:!0,value:V.version,onChange:e=>K((t=>(0,i.A)((0,i.A)({},t),{},{version:e.target.value}))),placeholder:"1.0.0",title:V.version||"",inputProps:{title:V.version||"",style:{fontSize:"0.8rem"}}})]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1,alignItems:"center",flexWrap:"wrap"},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.7rem",color:_e.slate300,flex:1,minWidth:120},children:Ge("deviceFarmAppsIdentityHelp","The file itself is not changed.")}),_&&(0,a.jsx)(bn.A,{size:16,sx:{color:_e.slate400}}),(0,a.jsx)(Je,{onClick:()=>{B&&V&&v&&(q(!0),Promise.resolve(v(B,V)).then((e=>
1{e&&e.id&&U(e)})).finally((()=>q(!1))))},disabled:_,sx:{px:1.75,py:.6,fontSize:"0.78rem",borderRadius:2},children:Ge("save","Save")})]})]})]}),(0,a.jsx)(o.A,{sx:{borderRadius:2.5,border:"1px solid ".concat(_e.slate200)},children:ue(B).map(((e,n)=>{let[i,l,r]=e;return(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1.5,px:1.75,py:1.25,borderTop:n?"1px solid ".concat(_e.slate100):"none",alignItems:"center"},children:[(0,a.jsx)(g.A,{sx:{width:140,flexShrink:0,color:_e.slate500,fontSize:"0.8rem"},children:i}),0===n&&t&&h?j?(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"flex-start",gap:.5,flex:1,minWidth:0},children:[(0,a.jsx)(M.A,{autoFocus:!0,size:"small",fullWidth:!0,value:w,placeholder:B.fileName||"",onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"===e.key&&me(),"Escape"===e.key&&S(!1)},inputProps:{style:{fontSize:"0.8rem"}},helperText:Ge("deviceFarmAppRenameHelp","Leave empty to show the file name again."),FormHelperTextProps:{sx:{fontSize:"0.7rem",ml:0}}}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.5,flexShrink:0,mt:"6px"},children:[(0,a.jsx)(Qe,{size:28,onClick:me,title:Ge("save","Save"),children:(0,a.jsx)(Q.default,{sx:{fontSize:16}})}),(0,a.jsx)(Qe,{size:28,onClick:()=>S(!1),title:Ge("cancel","Cancel"),children:(0,a.jsx)(Cn.default,{sx:{fontSize:16}})})]})]}):(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.75,flex:1,minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",color:_e.slate800,wordBreak:"break-all"},children:l}),(0,a.jsx)(o.A,{component:"span",title:Ge("deviceFarmAppRenameTooltip","Rename - the file name stays unchanged"),onClick:()=>{k(B.displayName||""),S(!0)},sx:{display:"inline-flex",color:_e.slate400,cursor:"pointer","&:hover":{color:_e.brand}},children:(0,a.jsx)(J.default,{sx:{fontSize:15}})})]}):r?(0,a.jsx)(o.A,{sx:{flex:1,minWidth:0},children:r}):(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",color:_e.slate800,wordBreak:"break-all"},children:l})]},i)}))})]}),(0,a.jsx)(ki,{justify:"flex-end",children:(0,a.jsx)(Xe,{onClick:()=>{U(null),H(!1)},children:Ge("close","Close")})})]})]})}function Ai(e,t){return()=>e(t)}function yi(e){let{children:t,onClick:n}=e;return(0,a.jsx)(o.A,{component:"button",onClick:n,sx:{width:"100%",textAlign:"left",px:1.75,py:1,fontSize:"0.82rem",color:_e.slate700,background:"none",border:"none",cursor:"pointer","&:hover":{bgcolor:_e.slate50}},children:t})}const ji=(0,E.createContext)(null);function Si(e){let{children:t,onClose:n,width:i}=e;const[l,r]=(0,E.useState)({x:0,y:0}),s=(0,E.useRef)(null),c=(0,E.useRef)(!1),d=(0,E.useCallback)((e=>{0===e.button&&(e.target.closest&&e.target.closest('button,[role="button"],input,textarea,a,select')||(s.current={sx:e.clientX,sy:e.clientY,ox:l.x,oy:l.y},e.currentTarget.setPointerCapture&&e.currentTarget.setPointerCapture(e.pointerId)))}),[l.x,l.y]),p=(0,E.useCallback)((e=>{const t=s.current;if(!t)return;const n=Math.max(0,window.innerWidth/2-60),o=Math.max(0,window.innerHeight/2-40),i=Math.min(n,Math.max(-n,t.ox+e.clientX-t.sx)),l=Math.min(o,Math.max(-o,t.oy+e.clientY-t.sy));r({x:i,y:l})}),[]),x=(0,E.useCallback)((e=>{if(s.current=null,e.currentTarget.releasePointerCapture)try{e.currentTarget.releasePointerCapture(e.pointerId)}catch(t){}}),[]),m=(0,E.useMemo)((()=>({handleProps:{onPointerDown:d,onPointerMove:p,onPointerUp:x,onPointerCancel:x},handleSx:{cursor:"move",touchAction:"none",userSelect:"none"}})),[d,p,x]);return(0,a.jsxs)(ji.Provider,{value:m,children:[(0,a.jsx)(o.A,{onMouseDown:e=>{c.current=e.target===e.currentTarget},onClick:e=>{const t=c.current;c.current=!1,n&&t&&e.target===e.currentTarget&&n()},sx:{position:"fixed",inset:0,bgcolor:"rgba(15,23,42,.55)",backdropFilter:"blur(2px)",zIndex:1400}}),(0,a.jsx)(o.A,{sx:{position:"fixed",left:"50%",top:"50%",transform:"translate(calc(-50% + ".concat(l.x,"px), calc(-50% + ").concat(l.y,"px))"),width:"min(".concat(i,"px, 94vw)"),maxHeight:"88vh",bgcolor:"#fff",borderRadius:4,boxShadow:"0 24px 60px -12px rgba(15,23,42,.5)",zIndex:1401,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"Inter, sans-serif"},children:t})]})}function wi(e){let{icon:t,title:n,sub:l,onClose:r,right:s}=e;const c=(0,E.useContext)(ji);return(0,a.jsxs)(o.A,(0,i.A)((0,i.A)({},c?c.handleProps:{}),{}
1,{sx:(0,i.A)({display:"flex",alignItems:"center",gap:1.5,px:3,py:2,borderBottom:"1px solid ".concat(_e.slate100),flexShrink:0},c?c.handleSx:{}),children:[(0,a.jsx)(o.A,{sx:{width:36,height:36,borderRadius:2,bgcolor:"#eff6ff",color:_e.brand,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t}),(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsx)(g.A,{variant:"h5",fontWeight:"bold",sx:{lineHeight:1.25,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),l&&(0,a.jsx)(g.A,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",mt:-.2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]}),(0,a.jsx)(o.A,{sx:{flex:1}}),s,r&&(0,a.jsx)(Qe,{size:32,onClick:r,children:(0,a.jsx)(Cn.default,{})})]}))}function ki(e){let{children:t,justify:n}=e;return(0,a.jsx)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,px:3,py:2,bgcolor:_e.slate50,borderTop:"1px solid ".concat(_e.slate100),flexShrink:0,justifyContent:n||"flex-start"},children:t})}var Fi=n(818450),Ci=n(637744),zi=n(132024),Ii=n(489490),Ni=n(521659),Ri=n(722379),Di=n(102748),Mi=n(593500);const Ti={temp:{label:Ge("deviceFarmNtfTemp","Temperature above"),unit:"\xb0C",thr:65,icon:(0,a.jsx)(Fi.default,{sx:{fontSize:16}})},cpu:{label:Ge("deviceFarmNtfCpu","CPU usage above"),unit:"%",thr:85,icon:(0,a.jsx)(Mn.default,{sx:{fontSize:16}})},disk:{label:Ge("deviceFarmNtfDisk","Disk usage above"),unit:"%",thr:85,icon:(0,a.jsx)(Ci.default,{sx:{fontSize:16}})},emu:{label:Ge("deviceFarmNtfEmu","Running emulators above"),unit:"",thr:5,icon:(0,a.jsx)(Wn.default,{sx:{fontSize:16}})},devcount:{label:Ge("deviceFarmNtfDevCount","Connected devices above"),unit:"",thr:10,icon:(0,a.jsx)(zi.default,{sx:{fontSize:16}})},started:{label:Ge("deviceFarmNtfStarted","Run started"),unit:"",thr:null,icon:(0,a.jsx)(Ii.default,{sx:{fontSize:16}})},finished:{label:Ge("deviceFarmNtfFinished","Run finished"),unit:"",thr:null,icon:(0,a.jsx)(Ni.default,{sx:{fontSize:16}})},noresp:{label:Ge("deviceFarmNtfNoResp","No response from device"),unit:"",thr:null,icon:(0,a.jsx)(Ri.default,{sx:{fontSize:16}})}},Wi=e=>"node"===e||"nodes"===e?["temp","cpu","disk","emu","devcount","noresp"]:["temp","cpu","started","finished","noresp"],Oi={inapp:{label:Ge("deviceFarmNtfInApp","In-app"),icon:(0,a.jsx)(Ht.default,{sx:{fontSize:15}})},mail:{label:Ge("deviceFarmNtfEmail","Email"),icon:(0,a.jsx)(Di.default,{sx:{fontSize:15}})},sms:{label:Ge("deviceFarmNtfSms","SMS"),icon:(0,a.jsx)(Mi.default,{sx:{fontSize:15}})}},Ei={fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em",color:_e.slate400};function Li(e){if(!e)return Ge("deviceFarmNtfAllDevices","All devices");const{type:t,target:n}=e;if("device"===t&&n)return n.displayName||n.name||n.udid||Ge("deviceFarmNtfDevice","device");if("node"===t&&n)return n.name||"#".concat(n.id);if("nodes"===t){const e=Array.isArray(n)?n:[];return 1===e.length?e[0].name||"#".concat(e[0].id):"".concat(e.length," ").concat(Ge("deviceFarmNtfNodes","nodes"))}return Ge("deviceFarmNtfAllDevices","All devices")}function Bi(e){let{open:t,scope:n,rules:l=[],onAddRule:r,onDeleteRule:s,onClose:c}=e;const d="node"===(null===n||void 0===n?void 0:n.type)||"nodes"===(null===n||void 0===n?void 0:n.type),[p,x]=(0,E.useState)({cond:"temp",thr:65,action:"notify",ch:["inapp"]});(0,E.useEffect)((()=>{if(!t)return;const e=Wi(null===n||void 0===n?void 0:n.type);x((t=>{var n;const o=e.includes(t.cond)?t.cond:e[0],i=(d?["notify","shutdown"]:["notify","stop"]).includes(t.action)?t.action:"notify";return{cond:o,thr:null!==(n=Ti[o].thr)&&void 0!==n?n:t.thr,action:i,ch:t.ch.length?t.ch:["inapp"]}}))}),[t,null===n||void 0===n?void 0:n.type]);const m=Wi(null===n||void 0===n?void 0:n.type),u=Ti[p.cond]||Ti[m[0]],f=null!=u.thr,h=d?[["notify",Ge("deviceFarmNtfNotify","Notify")],["shutdown",Ge("deviceFarmNtfShutdown","Shut down devices")]]:[["notify",Ge("deviceFarmNtfNotify","Notify")],["stop",Ge("deviceFarmNtfStop","Stop device")]],v="device"===(null===n||void 0===n?void 0:n.type)?"".concat(Ge("deviceFarmNtfAlerts","Alerts")," \xb7 ").concat(Li(n)):"node"===(null===n||void 0===n?void 0:n.type)||"nodes"===(null===n||void 0===n?void 0:n.type)?"".concat(Ge("deviceFarmNtfAutomation","Automation")," \xb7 ").concat(Li(n)):Ge("deviceFarmNtfTitle","Notifications & automation"),b={display:"flex",flex:1,alignItems:"center",justifyContent:"center",gap:.75,px:1.25,py:1,borderRadius:2,fontSize:"0.75rem",fontWeight:600,cursor:"pointer",border:"1px solid",transition:"all .15s"};return(0,a.jsxs)(j.A,{open:!!t,onClose:c,maxWidth:!1,PaperProps:{sx:{width:"min(620px,95vw)",maxHeight:"90vh",borderRadius:3,m:2,display:"flex",flexDirection:"column",overflow:"hidden"}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2.5,py:2,borderBottom:"1px solid ".concat(_e.slate100),flexShrink:0},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25},children:[(0,a.jsx)(ue.default,{sx:{fontSize:20,color:_e.brand}}),(0,a.jsx)(g.A,{sx:{fontSize:"1rem",fontWeight:700,color:_e.ink},children:v})]}
1),(0,a.jsx)(Qe,{title:Ge("deviceFarmClose","Close"),onClick:c,children:(0,a.jsx)(Cn.default,{})})]}),(0,a.jsxs)(o.A,{sx:{flex:1,overflowY:"auto",px:2.5,py:2},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",gap:1,alignItems:"flex-start",mb:2,p:1.5,borderRadius:2,bgcolor:"#fffbeb",border:"1px solid #fde68a"},children:[(0,a.jsx)(Pt.default,{sx:{fontSize:18,color:_e.amber,mt:"1px",flexShrink:0}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.75rem",color:"#92400e",lineHeight:1.45},children:Ge("deviceFarmNtfEnforceBanner","Rules are defined here but automatic evaluation/enforcement requires backend support (coming soon). They are saved locally in your browser only \u2014 no rule is triggered or applied automatically yet.")})]}),(0,a.jsx)(g.A,{sx:(0,i.A)((0,i.A)({},Ei),{},{mb:1}),children:Ge("deviceFarmNtfNewRule","New rule")}),(0,a.jsxs)(o.A,{sx:{borderRadius:2.5,border:"1px solid ".concat(_e.slate200),p:2,display:"flex",flexDirection:"column",gap:2,mb:2.5},children:[(0,a.jsxs)(o.A,{sx:{display:"grid",gap:1.5,gridTemplateColumns:f?{xs:"1fr",sm:"3fr 2fr"}:"1fr"},children:[(0,a.jsxs)(o.A,{children:[(0,a.jsx)(g.A,{component:"label",sx:Ei,children:Ge("deviceFarmNtfWhen","When")}),(0,a.jsxs)(o.A,{sx:{position:"relative",mt:.5},children:[(0,a.jsx)(o.A,{sx:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:_e.slate400,display:"flex",pointerEvents:"none"},children:u.icon}),(0,a.jsx)(o.A,{component:"select",value:p.cond,onChange:e=>{return t=e.target.value,x((e=>{var n;return(0,i.A)((0,i.A)({},e),{},{cond:t,thr:null!==(n=Ti[t].thr)&&void 0!==n?n:e.thr})}));var t},sx:{width:"100%",appearance:"none",border:"1px solid ".concat(_e.slate200),borderRadius:2,pl:4.5,pr:4,py:1.25,fontSize:"0.85rem",bgcolor:"#fff",color:_e.slate700,fontFamily:"inherit",cursor:"pointer","&:focus":{outline:"none",borderColor:_e.brand}},children:m.map((e=>(0,a.jsx)("option",{value:e,children:Ti[e].label},e)))}),(0,a.jsx)(o.A,{component:"span",sx:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:_e.slate400,fontSize:"0.7rem"},children:"\u25be"})]})]}),f&&(0,a.jsxs)(o.A,{children:[(0,a.jsx)(g.A,{component:"label",sx:Ei,children:Ge("deviceFarmNtfThreshold","Threshold")}),(0,a.jsxs)(o.A,{sx:{position:"relative",mt:.5},children:[(0,a.jsx)(o.A,{component:"input",type:"number",value:p.thr,onChange:e=>x((t=>(0,i.A)((0,i.A)({},t),{},{thr:Number(e.target.value)}))),sx:{width:"100%",boxSizing:"border-box",border:"1px solid ".concat(_e.slate200),borderRadius:2,px:1.5,pr:u.unit?4.5:1.5,py:1.25,fontSize:"0.85rem",fontFamily:"inherit",color:_e.slate800,"&:focus":{outline:"none",borderColor:_e.brand}}}),u.unit&&(0,a.jsx)(o.A,{component:"span",sx:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",fontSize:"0.72rem",fontWeight:600,color:_e.slate400},children:u.unit})]})]})]}),(0,a.jsxs)(o.A,{children:[(0,a.jsx)(g.A,{component:"label",sx:Ei,children:Ge("deviceFarmNtfThen","Then")}),(0,a.jsx)(o.A,{sx:{display:"inline-flex",width:"100%",p:.25,mt:.5,bgcolor:_e.slate100,borderRadius:2},children:h.map((e=>{let[t,n]=e;const l=p.action===t;return(0,a.jsx)(o.A,{onClick:()=>x((e=>(0,i.A)((0,i.A)({},e),{},{action:t}))),sx:{flex:1,textAlign:"center",px:1.5,py:.75,borderRadius:1.5,fontSize:"0.8125rem",fontWeight:600,cursor:"pointer",bgcolor:l?"#fff":"transparent",color:l?_e.brand:_e.slate500,boxShadow:l?"0 1px 2px rgba(0,0,0,.08)":"none",transition:"all .15s"},children:n},t)}))})]}),(0,a.jsxs)(o.A,{children:[(0,a.jsx)(g.A,{component:"label",sx:Ei,children:Ge("deviceFarmNtfNotifyVia","Notify via")}),(0,a.jsx)(o.A,{sx:{display:"flex",gap:1,mt:.5},children:Object.entries(Oi).map((e=>{let[t,n]=e;const l=p.ch.includes(t);return(0,a.jsxs)(o.A,{onClick:()=>(e=>x((t=>{let n=t.ch.includes(e)?t.ch.filter((t=>t!==e)):[...t.ch,e];return n.length||(n=["inapp"]),(0,i.A)((0,i.A)({},t),{},{ch:n})})))(t),sx:(0,i.A)((0,i.A)({},b),{},{borderColor:l?_e.brand:_e.slate200,bgcolor:l?"#eff6ff":"transparent",color:l?_e.brand:_e.slate500,"&:hover":{bgcolor:l?"#eff6ff":_e.slate50}}),children:[n.icon,n.label]},t)}))})]})]}),(0,a.jsxs)(g.A,{sx:(0,i.A)((0,i.A)({},Ei),{},{mb:1}),children:[Ge("deviceFarmNtfActiveRules","Active rules")," \xb7 ",l.length]}),(0,a.jsx)(o.A,{sx:{display:"flex",flexDirection:"column",gap:1},children:l.length?l.map(((e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:1.5,borderRadius:2,border:"1px solid ".concat(_e.slate200),p:1.5},children:[(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsxs)(g.A,{sx:{fontSize:"0.85rem",fontWeight:600,color:_e.slate800},children:[e.condText,null!=e.thr?" ".concat(e.thr).concat(e.unit||""):""]}),(0,a.jsxs)(g.A,{sx:{fontSize:"0.75rem",color:_e.slate500,mt:.25},children:[e.scopeLabel," \xb7 ",e.actionText," \xb7 ",(e.ch||[]).map((e=>{var t;return(null===(t=Oi[e])||void 0===t?void 0:t.label)||e}
1)).join(", ")]})]}),(0,a.jsx)(o.A,{component:"button",onClick:()=>s&&s(e.id),sx:{p:0,border:0,bgcolor:"transparent",cursor:"pointer",color:_e.slate300,flexShrink:0,"&:hover":{color:_e.rose}},children:(0,a.jsx)(Ae.default,{sx:{fontSize:18}})})]},e.id||t))):(0,a.jsx)(g.A,{sx:{fontSize:"0.85rem",color:_e.slate400,py:1},children:Ge("deviceFarmNtfNoRules","No rules yet.")})})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2.5,py:1.75,bgcolor:_e.slate50,borderTop:"1px solid ".concat(_e.slate100),flexShrink:0},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.75rem",color:_e.slate400},children:Ge("deviceFarmNtfSavedLocally","Saved locally in this browser")}),(0,a.jsx)(Je,{icon:(0,a.jsx)(oe.default,{}),onClick:()=>{const e={notify:Ge("deviceFarmNtfActNotify","Send notification"),stop:Ge("deviceFarmNtfStop","Stop device"),shutdown:Ge("deviceFarmNtfActShutdown","Shut down node devices")},t=Ti[p.cond];r&&r({id:"rule_".concat(Date.now()),cond:p.cond,condText:t.label,thr:null!=t.thr?p.thr:null,unit:t.unit,scopeType:(null===n||void 0===n?void 0:n.type)||"all",scopeLabel:Li(n),action:p.action,actionText:e[p.action]||p.action,ch:[...p.ch]})},children:Ge("deviceFarmNtfAddRule","Add rule")})]})]})}var Ui=n(471291),Pi=n(212563),Hi=n(130606),Vi=n(854501),Ki=n(722631);const _i=[{key:"list",label:Ge("deviceFarmShList","List connected devices"),cmd:"adb devices -l",icon:(0,a.jsx)(je.default,{sx:{fontSize:16}}),run:"operatorAction",action:"list_devices"},{key:"adbrestart",label:Ge("deviceFarmShAdbRestart","Restart ADB / node agent"),cmd:"node agent restart",icon:(0,a.jsx)(Z.default,{sx:{fontSize:16}}),run:"nodeRestart"},{key:"appium",label:Ge("deviceFarmShAppiumStatus","Appium server status"),cmd:"appium status",icon:(0,a.jsx)(Ui.default,{sx:{fontSize:16}}),run:"appiumLog"},{key:"appiumlog",label:Ge("deviceFarmShAppiumLog","Tail Appium log"),cmd:"tail appium.log",icon:(0,a.jsx)(Pi.default,{sx:{fontSize:16}}),run:"appiumLog"},{key:"reboot",label:Ge("deviceFarmShReboot","Reboot node devices"),cmd:"reboot devices",icon:(0,a.jsx)(te.default,{sx:{fontSize:16}}),run:"rebootDevices"},{key:"cache",label:Ge("deviceFarmShCache","Clear app cache"),cmd:"adb shell pm clear",icon:(0,a.jsx)(Hi.default,{sx:{fontSize:16}})},{key:"killsess",label:Ge("deviceFarmShKill","Kill stuck sessions"),cmd:"df-agent --kill-stale",icon:(0,a.jsx)(Vi.default,{sx:{fontSize:16}})},{key:"disk",label:Ge("deviceFarmShDisk","Disk usage"),cmd:"df -h /",icon:(0,a.jsx)(Ci.default,{sx:{fontSize:16}}),run:"operatorAction",action:"disk_usage"},{key:"agent",label:Ge("deviceFarmShAgent","Update node agent"),cmd:"df-agent self-update",icon:(0,a.jsx)(Ki.default,{sx:{fontSize:16}})}];function qi(e){let{open:t,node:n,onClose:i}=e;const[l,r]=(0,E.useState)([]),[s,c]=(0,E.useState)(!1),d=(0,E.useRef)(null),p=(null===n||void 0===n?void 0:n.name)||(null!=(null===n||void 0===n?void 0:n.id)?"#".concat(n.id):"node"),x=(e,t)=>r((n=>[...n,{text:e,cls:t||_e.slate300}]));(0,E.useEffect)((()=>{t&&(r([{text:Ge("deviceFarmShIntro1","Predefined operator actions only. This is not a live arbitrary shell."),cls:_e.slate500},{text:Ge("deviceFarmShIntro2","Free-form command execution needs RBAC + audited backend (planned \u2014 Faz 3)."),cls:_e.slate500},{text:Ge("deviceFarmShIntro3","Pick a ready action on the left; only backend-backed actions run."),cls:_e.slate500}]),c(!1))}),[t,null===n||void 0===n?void 0:n.id]),(0,E.useEffect)((()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)}),[l]);const m=async e=>{if(!s&&e.run&&null!==n&&void 0!==n&&n.id){var t;c(!0),t=e.cmd,r((e=>[...e,{text:t,cls:_e.emerald,prompt:!0}]));try{if("appiumLog"===e.run){const e=await U.A.getNodeAppiumLog(n.id),t="string"===typeof(null===e||void 0===e?void 0:e.log)?e.log:"";t.trim()?t.split("\n").forEach((e=>x(e,_e.slate300))):x(Ge("deviceFarmShNoAppiumLog","(no Appium log returned by node yet)"),_e.slate500)}else if("nodeRestart"===e.run)await U.A.sendNodeCommand(n.id,"restart"),x(Ge("deviceFarmShQueuedRestart","\u2192 queued: node agent restart (applied on next node poll)"),_e.emerald);else if("rebootDevices"===e.run){var o;const e=await U.A.bulkRestartDevices({nodeId:n.id}),t=null!==(o=null===e||void 0===e?void 0:e.queued)&&void 0!==o?o:0,i=Array.isArray(null===e||void 0===e?void 0:e.skipped)?e.skipped:[];x("\u2192 ".concat(Ge("deviceFarmShQueuedReboot","queued restart for")," ").concat(t," ").concat(Ge("deviceFarmShDevices","device(s)")),_e.emerald),i.length&&x(" ".concat(i.length," ").concat(Ge("deviceFarmShSkipped","skipped"),": ").concat(i.slice(0,4).map((e=>"".concat(e.name,":").concat(e.reason))).join(", ")).concat(i.length>4?"\u2026":""),_e.amber)}else if("operatorAction"===e.run){const t=await U.A.runOperatorAction(n.id,e.action),o="string"===typeof(null===t||void 0===t?void 0:t.output)?t.output:"";!1===(null===t||void 0===t?void 0:t.ok)&&x("".concat(Ge("deviceFarmShError","error"),": ").concat((null===t||void 0===t?void 0:t.error)||Ge("deviceFarmShFailed","command failed")),_e.roseLt),o.trim()?o.split("\n").forEach((e=>x(e,_e.slate300))):!1!==(null===t||void 0===t?void 0:t.ok)&&x(Ge("deviceFarmShNoOutput","(no output)"),_e.slate500)}}catch(a){var i,l;x("".concat(Ge("deviceFarmShError","error"),": ").concat((null===a||void 0===a||null===(i=a.response)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.error)||a.message||Ge("deviceFarmShFailed","command failed")),_e.roseLt)}finally{x("",_e.slate300),c(!1)}}};return(0,a.jsxs)(j.A,{open:!!t,onClose:i,maxWidth:!1,PaperProps:{sx:{width:"min(960px,95vw)",height:"min(660px,90vh)",borderRadius:3,m:2,display:"flex",flexDirection:"column",overflow:"hidden"}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2.5,py:1.75,borderBottom:"1px solid ".concat(_e.slate100),flexShrink:0},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.5,minWidth:0},children:[(0,a.jsx)(o.A,{sx:{width:36,height:36,borderRadius:2,bgcolor:"#eff6ff",color:_e.brand,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,a.jsx)(ae.default,{sx:{fontSize:20}})}),(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,a.jsxs)(g.A,{sx:{fontSize:"0.9375rem",fontWeight:700,color:_e.ink},noWrap:!0,children:[Ge("deviceFarmShTitle","Remote shell")," \xb7 ",p]}
1),(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5,borderRadius:99,bgcolor:"#eff6ff",color:_e.brand,px:1,py:"2px",fontSize:"0.6875rem",fontWeight:600},children:[(0,a.jsx)(mo.default,{sx:{fontSize:12}}),Ge("deviceFarmShPredefined","predefined")]})]}),(0,a.jsx)(g.A,{sx:{fontSize:"0.75rem",color:_e.slate500},noWrap:!0,children:null!=(null===n||void 0===n?void 0:n.id)?"Node #".concat(n.id).concat(null!==n&&void 0!==n&&n.os?" \xb7 ".concat(n.os):""):""})]})]}),(0,a.jsx)(o.A,{component:"button",onClick:i,title:Ge("deviceFarmClose","Close"),sx:{p:.5,border:0,bgcolor:"transparent",cursor:"pointer",color:_e.slate400,borderRadius:1.5,display:"flex","&:hover":{bgcolor:_e.slate100,color:_e.slate700}},children:(0,a.jsx)(Cn.default,{sx:{fontSize:20}})})]}),(0,a.jsxs)(o.A,{sx:{flex:1,minHeight:0,display:"flex"},children:[(0,a.jsxs)(o.A,{sx:{width:272,flexShrink:0,borderRight:"1px solid ".concat(_e.slate100),display:"flex",flexDirection:"column",bgcolor:"rgba(248,250,252,0.4)"},children:[(0,a.jsx)(g.A,{sx:{px:2,pt:1.75,pb:1,fontSize:"0.6875rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:_e.slate400},children:Ge("deviceFarmShReadyScripts","Ready scripts")}),(0,a.jsx)(o.A,{sx:{flex:1,overflowY:"auto",px:1.25,pb:1.5,display:"flex",flexDirection:"column",gap:.5},children:_i.map((e=>{const t=!!e.run&&!s,n=!e.run,i=(0,a.jsxs)(o.A,{component:"button",disabled:!t,onClick:()=>m(e),sx:{width:"100%",display:"flex",alignItems:"center",gap:1.25,px:1.25,py:1,borderRadius:2,textAlign:"left",border:"1px solid transparent",bgcolor:"transparent",cursor:t?"pointer":"not-allowed",opacity:n?.55:1,transition:"all .15s","&:hover":t?{bgcolor:"#fff",borderColor:_e.slate200,boxShadow:"0 1px 2px rgba(0,0,0,.05)"}:{}},children:[(0,a.jsx)(o.A,{sx:{width:28,height:28,borderRadius:2,bgcolor:"#fff",border:"1px solid ".concat(_e.slate200),color:_e.slate500,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.icon}),(0,a.jsxs)(o.A,{sx:{minWidth:0,flex:1},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.8125rem",fontWeight:600,color:_e.slate700},noWrap:!0,children:e.label}),(0,a.jsx)(g.A,{sx:{fontSize:"0.6875rem",color:_e.slate400,fontFamily:"monospace"},noWrap:!0,children:e.cmd})]}),n&&(0,a.jsx)(mo.default,{sx:{fontSize:13,color:_e.slate300,flexShrink:0}})]});return n?(0,a.jsx)(q.A,{enterDelay:1e3,enterNextDelay:1e3,title:Ge("deviceFarmShNotAvailable","Not available \u2014 no node-side backend for this command yet"),arrow:!0,placement:"right",children:(0,a.jsx)("span",{children:i})},e.key):(0,a.jsx)(o.A,{children:i},e.key)}))})]}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",p:1.5},children:[(0,a.jsx)(o.A,{ref:d,sx:{flex:1,minHeight:0,overflowY:"auto",fontFamily:"monospace",fontSize:"0.78rem",lineHeight:1.6,borderRadius:2,px:2,py:1.5,color:"#e2e8f0",bgcolor:_e.termBg,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l.map(((e,t)=>e.prompt?(0,a.jsxs)(o.A,{children:[(0,a.jsx)(o.A,{component:"span",sx:{color:_e.emerald},children:"".concat(p.toLowerCase(),":~$ ")}),(0,a.jsx)(o.A,{component:"span",sx:{color:"#f1f5f9"},children:e.text})]},t):(0,a.jsx)(o.A,{sx:{color:e.cls},children:e.text||"\xa0"},t)))}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,mt:1,px:1.5,py:1,borderRadius:2,border:"1px solid ".concat(_e.slate200),bgcolor:_e.slate50},children:[(0,a.jsx)(o.A,{component:"span",sx:{fontFamily:"monospace",color:_e.slate400,fontSize:"0.85rem"},children:"$"}),(0,a.jsx)(o.A,{component:"input",disabled:!0,placeholder:Ge("deviceFarmShInputDisabled","Free-form shell requires RBAC + audited backend \u2014 coming soon (Faz 3)"),sx:{flex:1,bgcolor:"transparent",border:0,fontFamily:"monospace",fontSize:"0.8rem",color:_e.slate500,"&::placeholder":{color:_e.slate400},"&:disabled":{cursor:"not-allowed"}}}),(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.4,fontSize:"0.6875rem",fontWeight:600,color:_e.slate400},children:[(0,a.jsx)(mo.default,{sx:{fontSize:13}}),Ge("deviceFarmShDisabled","disabled")]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",gap:.75,alignItems:"center",mt:.75},children:[(0,a.jsx)(Pt.default,{sx:{fontSize:14,color:_e.slate400}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.6875rem",color:_e.slate400},children:Ge("deviceFarmShBanner","Remote shell is limited to predefined actions; full shell + RBAC/audit is planned (Faz 3).")})]})]})]})]})}const Yi=e=>{var t,n,o,i;return{id:null!==(t=null===e||void 0===e?void 0:e.farmSessionId)&&void 0!==t?t:null,farmSessionId:null!==(n=null===e||void 0===e?void 0:e.farmSessionId)&&void 0!==n?n:null,companyId:null,userName:(null===e||void 0===e?void 0:e.userName)||null,
1nodeId:null,nodeName:null,deviceId:null!==(o=null===e||void 0===e?void 0:e.deviceId)&&void 0!==o?o:null,deviceName:(null===e||void 0===e?void 0:e.deviceName)||null,platform:(null===e||void 0===e?void 0:e.platform)||null,status:(null===e||void 0===e?void 0:e.status)||null,minutes:null!==(i=null===e||void 0===e?void 0:e.minutes)&&void 0!==i?i:null,startedAt:(null===e||void 0===e?void 0:e.startedAt)||null,endedAt:(null===e||void 0===e?void 0:e.endedAt)||null}},Gi={key:"operator",supportsNodes:!0,supportsStats:!0,supportsCompanies:!0,supportsDeviceControls:!0,supportsDeviceInstall:!0,supportsLiveDiagnostics:!0,supportsAppLibraryWrite:!0,listDevices:e=>U.A.listAllDevices(e),listNodes:e=>U.A.listNodes(e),listSessions:e=>U.A.listSessions(e),getStats:e=>U.A.getStats(e),listActiveRuns:()=>U.A.listActiveRuns(),getSessionTelemetry:(e,t)=>U.A.getOperatorSessionTelemetry(e),listApps:e=>U.A.listAppsForCompany(e),createApp:(e,t)=>U.A.createAppForCompany(e,t),updateApp:(e,t,n)=>U.A.updateAppForCompany(e,t,n),renameApp:(e,t,n)=>U.A.renameAppForCompany(e,t,n),editAppIdentity:(e,t,n)=>U.A.editAppIdentityForCompany(e,t,n),reparseApp:(e,t)=>U.A.reparseAppForCompany(e,t),deleteApp:(e,t)=>U.A.deleteAppForCompany(e,t)},Xi={key:"tenant",supportsNodes:!1,supportsStats:!1,supportsCompanies:!1,supportsDeviceControls:!1,supportsDeviceInstall:!1,supportsLiveDiagnostics:!1,supportsAppLibraryWrite:!0,listDevices:e=>U.A.listDevices(e),listNodes:null,listSessions:async()=>{return(e=await U.A.listMyRuns(),Array.isArray(e)?e:[]).map(Yi);var e},getStats:null,listActiveRuns:()=>U.A.listActiveRuns(),getSessionTelemetry:(e,t)=>U.A.getSessionTelemetry(e,t),listApps:e=>U.A.listApps(e),createApp:(e,t)=>U.A.createApp(t,e),updateApp:(e,t,n)=>U.A.updateApp(t,n),renameApp:(e,t,n)=>U.A.renameApp(t,n),editAppIdentity:(e,t,n)=>U.A.editAppIdentity(t,n),reparseApp:(e,t)=>U.A.reparseApp(t),deleteApp:(e,t)=>U.A.deleteApp(t)},Ji=()=>{const e=Me(),t=e.tier===De?Xi:Gi;return(0,i.A)((0,i.A)({},e),{},{source:t,canListCompanies:Boolean(null===t||void 0===t?void 0:t.supportsCompanies)&&Boolean(null===e||void 0===e?void 0:e.isSuperAdmin)})};var Qi=n(887899),$i=n(576746),Zi=n(191602),el=n(630149);function tl(e){let{value:t,onChange:n,placeholder:i}=e;return(0,a.jsxs)(o.A,{sx:{position:"relative",width:"100%"},children:[(0,a.jsx)(o.A,{component:"span",sx:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:_e.slate400,fontSize:"0.9rem",pointerEvents:"none"},children:"\u2315"}),(0,a.jsx)(o.A,{component:"input",value:t,onChange:e=>n(e.target.value),placeholder:i,spellCheck:!1,sx:{width:"100%",pl:4.25,pr:1.5,py:1,borderRadius:2,border:"1px solid ".concat(_e.slate200),fontSize:"0.82rem",fontFamily:"inherit",color:_e.slate800,boxSizing:"border-box","&::placeholder":{color:_e.slate400},"&:focus":{outline:"none",borderColor:_e.brand,boxShadow:"0 0 0 3px ".concat(_e.brand,"22")}}})]})}const nl=e=>"IOS"===e?"iOS":"ANDROID"===e?"Android":e||"\u2014",ol=e=>e.displayName||e.fileName||e.name||e.packageId||"#".concat(e.id),il=e=>e.version||e.fileName||Ge("deviceFarmBuildLatest","latest");function ll(e){let{ctx:t,apps:n=[],onClose:i}=e;const l=!!t,[r,s]=(0,E.useState)(""),[c,d]=(0,E.useState)(""),[p,x]=(0,E.useState)(null),[m,u]=(0,E.useState)([]),[f,h]=(0,E.useState)([]),[v,b]=(0,E.useState)(null),[A,y]=(0,E.useState)((()=>new Set));(0,E.useEffect)((()=>{if(!t)return;s(""),d("");const e=t.preApp||n[0]||null;b(e?e.id:null),y(new Set((t.preselect||[]).map(String)))}),[t]);const S=(0,E.useMemo)((()=>n.find((e=>e.id===v))||null),[n,v]),w=(0,E.useMemo)((()=>{const e=r.trim().toLowerCase();return n.filter((t=>!e||"".concat(ol(t)," ").concat(t.packageId||""," ").concat(nl(t.platform)).toLowerCase().includes(e)))}),[n,r]),k=e=>!!(S&&e.platform&&S.platform&&e.platform!==S.platform),F=(0,E.useMemo)((()=>"node"===(null===t||void 0===t?void 0:t.kind)?[]:((null===t||void 0===t?void 0:t.targets)||[]).map((e=>e.id)).filter((e=>null!=e))),[t]),{usedTags:C,getDeviceTagIds:z}=(0,Zt.A)(F),I=m.length>0||f.length>0,N=(0,E.useMemo)((()=>{const e=c.trim().toLowerCase(),n=((null===t||void 0===t?void 0:t.targets)||[]).filter((t=>!e||"".concat(t.name," ").concat(t.search||"").toLowerCase().includes(e)));return"node"===(null===t||void 0===t?void 0:t.kind)?n:(0,Qt.J)(n,(e=>z(e.id)),m,f)}),[t,c,z,m,f]);(0,E.useEffect)((()=>{t&&!t.lockTargets&&y((e=>{let n=!1;const o=new Set(e);
1return(t.targets||[]).forEach((e=>{k(e)&&o.has(String(e.id))&&(o.delete(String(e.id)),n=!0)})),n?o:e}))}),[v]);const R=e=>y((t=>{const n=new Set(t);return n.has(String(e))?n.delete(String(e)):n.add(String(e)),n})),D=N.filter((e=>!k(e))).map((e=>String(e.id))),M=D.length>0&&D.every((e=>A.has(e))),T=!(!S||!A.size),W=(e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,flexWrap:"wrap",rowGap:.5,mb:1,minHeight:22},children:[(0,a.jsx)(g.A,{component:"div",sx:{display:"flex",alignItems:"center",gap:.75,fontSize:"0.6875rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:_e.slate400},children:e}),t]}),O=(e,t)=>(0,a.jsxs)(o.A,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:1,px:2,py:3,textAlign:"center"},children:[(0,a.jsx)(e,{sx:{fontSize:26,color:_e.slate300}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.78rem",color:_e.slate400},children:t})]}),L=(e,t)=>(0,a.jsx)(o.A,{component:"span",sx:{px:.75,py:"1px",borderRadius:1,letterSpacing:0,textTransform:"none",fontSize:"0.6875rem",fontWeight:700,fontVariantNumeric:"tabular-nums",bgcolor:t?"rgba(47,107,255,0.10)":_e.slate100,color:t?_e.brand:_e.slate400},children:e}),B=(e,t,n,i)=>(0,a.jsx)(o.A,{component:"button",type:"button",onClick:t,disabled:n,sx:{border:"none",bgcolor:"transparent",p:0,fontFamily:"inherit",fontSize:"inherit",fontWeight:600,color:n?_e.slate300:i,cursor:n?"default":"pointer","&:hover":{textDecoration:n?"none":"underline"}},children:e});return(0,a.jsxs)(j.A,{open:l,onClose:i,maxWidth:!1,PaperProps:{sx:{width:{xs:"calc(100% - 16px)",sm:"min(900px,94vw)"},maxWidth:"100%",height:{xs:"calc(100% - 16px)",sm:"min(620px,88vh)"},borderRadius:{xs:2,sm:3},m:{xs:1,sm:2},display:"flex",flexDirection:"column",overflow:"hidden"}},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.5,px:{xs:2,sm:3},py:{xs:1.5,sm:2},borderBottom:"1px solid ".concat(_e.slate100),flexShrink:0},children:[(0,a.jsx)(o.A,{sx:{width:36,height:36,borderRadius:2,bgcolor:"#eef4ff",color:_e.brand,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,a.jsx)(_t.default,{sx:{fontSize:18}})}),(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsx)(g.A,{variant:"h5",fontWeight:"bold",sx:{lineHeight:1.25,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:null===t||void 0===t?void 0:t.title}),(0,a.jsx)(g.A,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",mt:-.2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(null===t||void 0===t?void 0:t.subtitle)||Ge("deviceFarmInstallPickerSubtitle","Pick an application and the devices it should be installed on.")})]}),(0,a.jsx)(o.A,{sx:{flex:1}}),(0,a.jsx)(Qe,{title:Ge("deviceFarmClose","Close"),onClick:i,children:(0,a.jsx)(Cn.default,{})})]}),(0,a.jsxs)(o.A,{sx:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:{xs:"minmax(0,1fr)",md:"minmax(0,340px) minmax(0,1fr)"},gridTemplateRows:{xs:"minmax(0,1fr) minmax(0,1fr)",md:"minmax(0,1fr)"},overflow:"hidden"},children:[(0,a.jsxs)(o.A,{sx:{minHeight:0,display:"flex",flexDirection:"column",p:{xs:1.75,sm:2.5},bgcolor:"rgba(248,250,252,0.4)",borderRight:{md:"1px solid ".concat(_e.slate100)},borderBottom:{xs:"1px solid ".concat(_e.slate100),md:"none"}},children:[W(Ge("deviceFarmInstallPickerApp","Application"),L("".concat(w.length," / ").concat(n.length),!1)),(0,a.jsx)(o.A,{sx:{mb:1},children:(0,a.jsx)(tl,{value:r,onChange:s,placeholder:Ge("deviceFarmSearchApp","Search application / package\u2026")})}),(0,a.jsx)(o.A,{sx:{flex:1,minHeight:96,overflowY:"auto",overflowX:"hidden",borderRadius:2,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff"},children:w.length?w.map((e=>{const t=e.id===v;return(0,a.jsxs)(o.A,{component:"button",type:"button",onClick:()=>b(e.id),sx:{width:"100%",display:"flex",alignItems:"center",gap:1.25,pl:t?"calc(12px - 3px)":1.5,pr:1.5,py:1.25,borderLeft:t?"3px solid ".concat(_e.brand):"none",textAlign:"left",border:"none",borderBottom:"1px solid ".concat(_e.slate100),cursor:"pointer",transition:"background-color .12s",bgcolor:t?"rgba(47,107,255,0.07)":"transparent","&:last-of-type":{borderBottom:"none"},"&:hover":{bgcolor:t?"rgba(47,107,255,0.07)":_e.slate50}},children:[(0,a.jsx)(Pe.jE,{platform:e.platform,size:16}),(0,a.jsxs)(o.A,{sx:{minWidth:0,flex:1},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.85rem",fontWeight:t?700:500,color:t?_e.ink:_e.slate800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ol(e)}),(0,a.jsx)(g.A,{sx:{fontSize:"0.68rem",color:_e.slate400,fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"".concat(e.packageId||Ge("deviceFarmNoPkg","no package id")," \xb7 ").concat(nl(e.platform))})]}),t&&(0,a.jsx)(Qi.default,{sx:{fontSize:16,color:_e.brand,flexShrink:0}})]},e.id)})):O(_t.default,n.length?Ge("deviceFarmNoAppMatch","No application matches."):Ge("deviceFarmNoApps","No apps in library yet."))}),S&&(0,a.jsxs)(o.A,{sx:{mt:1.5,flexShrink:0},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.6875rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:_e.slate400,mb:.75},children:Ge("deviceFarmInstallPickerBuild","Version")}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1.25,borderRadius:2,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff"},children:[(0,a.jsx)(_t.default,{sx:{fontSize:15,color:_e.slate400}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.82rem",color:_e.slate700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:il(S)})]})]})]}),(0,a.jsxs)(o.A,{sx:{minHeight:0,display:"flex",flexDirection:"column",p:{xs:1.75,sm:2.5}},children:[W((0,a.jsxs)(a.Fragment,{children:["node"===(null===t||void 0===t?void 0:t.kind)?Ge("deviceFarmNodesLabel","Nodes"):Ge("deviceFarmDevicesLabel","Devices"),L("".concat(A.size," / ").concat(N.length),A.size>0)]}),!(null!==t&&void 0!==t&&t.lockTargets)&&(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1,fontSize:"0.75rem"},children:[B(Ge("deviceFarmSelectAll","Select all"),(()=>y((()=>new Set(N.filter((e=>!k(e))).map((e=>String(e.id))))))),M,_e.brand),(0,a.jsx)(o.A,{component:"span",sx:{color:_e.slate200},children:"|"}
1),B(Ge("deviceFarmClear","Clear"),(()=>y(new Set)),0===A.size,_e.slate500)]})),!(null!==t&&void 0!==t&&t.lockTargets)&&(0,a.jsxs)(o.A,{sx:{mb:1,display:"flex",alignItems:"center",gap:1},children:[(0,a.jsx)(o.A,{sx:{flex:1,minWidth:0},children:(0,a.jsx)(tl,{value:c,onChange:d,placeholder:Ge("deviceFarmSearchTarget","Search\u2026")})}),"node"!==(null===t||void 0===t?void 0:t.kind)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Qe,{title:Ge("deviceFarmFilterByTags","Filter by tags"),onClick:e=>x(e.currentTarget),active:I,children:(0,a.jsx)(Xt.default,{sx:{fontSize:17}})}),(0,a.jsx)(Jt.A,{open:Boolean(p),anchorEl:p,onClose:()=>x(null),tags:C,includeIds:m,excludeIds:f,onChange:(e,t)=>{u(e),h(t)},getText:K.A.getText})]})]}),(0,a.jsx)(o.A,{sx:{flex:1,minHeight:96,overflowY:"auto",overflowX:"hidden",borderRadius:2,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff"},children:N.length?N.map((e=>{const n=k(e),i=n||t.lockTargets;return(0,a.jsxs)(o.A,{onClick:()=>!i&&R(e.id),sx:{display:"flex",alignItems:"center",gap:1.25,px:1.5,py:1.25,borderBottom:"1px solid ".concat(_e.slate100),cursor:i?"default":"pointer",opacity:n?.5:1,transition:"background-color .12s",bgcolor:A.has(String(e.id))?"rgba(47,107,255,0.06)":"transparent","&:last-of-type":{borderBottom:"none"},"&:hover":{bgcolor:i?void 0:_e.slate50}},children:[(0,a.jsx)($e,{checked:A.has(String(e.id)),onChange:()=>!i&&R(e.id)}),(0,a.jsxs)(o.A,{sx:{minWidth:0,flex:1},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.85rem",color:_e.slate800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,a.jsx)(g.A,{sx:{fontSize:"0.68rem",color:_e.slate400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.sub})]}),n?(0,a.jsx)(o.A,{component:"span",sx:{flexShrink:0,px:.75,py:"2px",borderRadius:999,fontSize:"0.68rem",fontWeight:700,color:_e.amber,bgcolor:"#fffbeb",border:"1px solid #fde68a"},children:Ge("deviceFarmPlatformMismatch","wrong platform")}):e.state?(0,a.jsx)(o.A,{component:"span",sx:{flexShrink:0,px:.75,py:"2px",borderRadius:999,fontSize:"0.68rem",fontWeight:700,color:e.tone||_e.slate500,bgcolor:_e.slate100},children:e.state}):null]},e.id)})):O(Bt.default,Ge("deviceFarmNoDeviceMatch","No device matches."))})]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:{xs:"stretch",sm:"center"},flexDirection:{xs:"column",sm:"row"},gap:{xs:1,sm:1.5},px:{xs:2,sm:3},py:{xs:1.5,sm:2},bgcolor:_e.slate50,borderTop:"1px solid ".concat(_e.slate100),flexShrink:0},children:[(0,a.jsx)(g.A,{sx:{minWidth:0,fontSize:"0.82rem",color:_e.slate500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S?"".concat(ol(S)," \xb7 ").concat(il(S)," \u2192 ").concat(A.size," ").concat((null===t||void 0===t?void 0:t.unit)||Ge("deviceFarmUnitDevices","device(s)")):""}),(0,a.jsx)(o.A,{sx:{flex:1,display:{xs:"none",sm:"block"}}}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1},children:[(0,a.jsx)(Xe,{onClick:i,children:Ge("cancel","Cancel")}),(0,a.jsx)(Je,{icon:(0,a.jsx)(_t.default,{}),onClick:()=>{if(!T)return;const e=[...A],n={app:S,version:il(S)},o=(t.targets||[]).filter((e=>A.has(String(e.id)))),l=t.onConfirm;i&&i(),l&&l(n,e,o)},disabled:!T,children:(null===t||void 0===t?void 0:t.confirmLabel)||Ge("deviceFarmInstall","Install")})]})]})]})}const al={pending:{label:()=>Ge("deviceFarmJobSending","Sending\u2026"),color:_e.brand,Icon:null},queued:{label:()=>Ge("deviceFarmJobQueued","Queued"),color:_e.slate500,Icon:Zi.default},installing:{label:()=>Ge("deviceFarmJobInstalling","Installing\u2026"),color:_e.brand,Icon:null},done:{label:()=>Ge("deviceFarmJobDone","Installed"),color:_e.emeraldDk,Icon:Q.default},failed:{label:()=>Ge("deviceFarmJobFailed","Failed"),color:_e.rose,Icon:$i.default}};function rl(e){let{state:t,onClose:n,onRetry:i}=e;const l=!!t,r=(null===t||void 0===t?void 0:t.jobs)||[],s=r.filter((e=>"done"===e.st||"failed"===e.st)).length,c=r.filter((e=>"failed"===e.st)).length,d=r.length>0&&s===r.length,p=r.length?Math.round(s/r.length*100):0,x=null===t||void 0===t?void 0:t.app,m=d?c?Ge("deviceFarmInstallErrorsTitle","Finished with errors"):Ge("deviceFarmInstallDoneTitle","Installed on all devices"):Ge("deviceFarmInstalling","Installing\u2026"),u=d?c?{bg:"#fff1f2",fg:_e.rose}:{bg:"#ecfdf5",fg:_e.emeraldDk}:{bg:"#eef4ff",fg:_e.brand};return(0,a.jsxs)(j.A,{open:l,onClose:d?n:void 0,maxWidth:!1,PaperProps:{sx:{width:"min(520px,92vw)",borderRadius:3,m:2,overflow:"hidden"}},children:[(0,a.jsxs)(o.A,{sx:{px:3,pt:3,pb:2},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"flex-start",ga
1p:1.5},children:[(0,a.jsx)(o.A,{sx:{width:36,height:36,borderRadius:2,bgcolor:u.bg,color:u.fg,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,mt:"1px"},children:(0,a.jsx)(_t.default,{sx:{fontSize:18}})}),(0,a.jsxs)(o.A,{sx:{minWidth:0,flex:1,pt:"2px"},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.95rem",fontWeight:700,color:_e.ink,lineHeight:1.2},children:m}),(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",color:_e.slate500,mt:.5},children:x?"".concat(ol(x)," \xb7 ").concat(nl(x.platform)," \xb7 ").concat(x.version||""," \u2192 ").concat(r.length," ").concat(Ge("deviceFarmUnitDevices","device(s)")):""})]})]}),(0,a.jsxs)(o.A,{sx:{mt:2},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"0.72rem",fontWeight:600,color:_e.slate500,mb:.75},children:[(0,a.jsx)(o.A,{component:"span",children:"".concat(s," ").concat(Ge("deviceFarmOf","of")," ").concat(r.length," ").concat(Ge("deviceFarmComplete","complete")).concat(c?" \xb7 ".concat(c," ").concat(Ge("deviceFarmJobFailedLower","failed")):"")}),(0,a.jsxs)(o.A,{component:"span",children:[p,"%"]})]}),(0,a.jsx)(o.A,{sx:{height:6,width:"100%",borderRadius:3,bgcolor:_e.slate100,overflow:"hidden"},children:(0,a.jsx)(o.A,{sx:{height:"100%",width:"".concat(p,"%"),bgcolor:c&&d?_e.rose:_e.brand,transition:"width .3s"}})}),(0,a.jsx)(o.A,{sx:{mt:1.5,borderRadius:2,border:"1px solid ".concat(_e.slate200),maxHeight:260,overflowY:"auto"},children:r.map((e=>{const t=al[e.st]||al.pending;return(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.25,px:1.5,py:1,borderBottom:"1px solid ".concat(_e.slate100)},children:["pending"===e.st||"installing"===e.st?(0,a.jsx)(bn.A,{size:15,thickness:5,sx:{color:t.color,flexShrink:0}}):t.Icon?(0,a.jsx)(t.Icon,{sx:{fontSize:16,color:t.color,flexShrink:0}}):(0,a.jsx)(Zi.default,{sx:{fontSize:16,color:t.color,flexShrink:0}}),(0,a.jsxs)(o.A,{sx:{minWidth:0,flex:1},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.82rem",color:_e.slate800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),(0,a.jsx)(g.A,{sx:{fontSize:"0.68rem",color:_e.slate400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.msg||e.sub})]}),(0,a.jsx)(g.A,{sx:{fontSize:"0.68rem",fontWeight:700,color:t.color,flexShrink:0},children:t.label()})]},e.id)}))})]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,px:3,py:2,bgcolor:_e.slate50,borderTop:"1px solid ".concat(_e.slate100)},children:[d&&c>0&&(0,a.jsx)(Xe,{icon:(0,a.jsx)(el.default,{}),onClick:i,children:Ge("deviceFarmRetryFailed","Retry failed")}),(0,a.jsx)(Je,{onClick:n,disabled:!d,children:Ge("deviceFarmClose","Close")})]})]})}const sl=(e,t)=>{const n=K.A.getText(e);return n&&n!==e?n:t},cl=function(e,t,n){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"primary",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return(0,a.jsxs)(v.A,{variant:"outlined",sx:e=>{const t=e.palette[l]&&e.palette[l].main||e.palette.primary.main;return(0,i.A)({p:1.6,flex:"1 1 0",minWidth:150,display:"flex",alignItems:"center",gap:1.4,borderRadius:2,borderColor:(0,h.X4)(t,.25),background:"linear-gradient(135deg, ".concat((0,h.X4)(t,.06)," 0%, ").concat((0,h.X4)(t,.015)," 100%)"),transition:"box-shadow .15s, transform .15s","&:hover":{boxShadow:"0 4px 14px ".concat((0,h.X4)(t,.18)),transform:"translateY(-2px)"},"@keyframes statCardFlash":{"0%":{boxShadow:"0 0 0 0 ".concat((0,h.X4)(t,.45)),borderColor:t},"60%":{boxShadow:"0 0 0 5px ".concat((0,h.X4)(t,0)),borderColor:t},"100%":{boxShadow:"0 0 0 0 ".concat((0,h.X4)(t,0)),borderColor:(0,h.X4)(t,.25)}}},s?{animation:"statCardFlash 1.2s ease-out"}:{})},children:[(0,a.jsx)(o.A,{sx:e=>{const t=e.palette[l]&&e.palette[l].main||e.palette.primary.main;return{width:44,height:44,borderRadius:"12px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:(0,h.X4)(t,.14),color:t}},children:e}),(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontSize:"1.5rem",fontWeight:800,lineHeight:1.05},children:n}),(0,a.jsx)(g.A,{sx:{fontSize:"0.72rem",color:"text.secondary",fontWeight:500},children:t}),null!=r&&(0,a.jsx)(g.A,{sx:{fontSize:"0.62rem",color:"text.disabled",mt:.2},children:r})]})]})},dl={px:2,py:1.5,fontWeight:600,fontSize:"0.82rem",whiteSpace:"nowrap",color:_e.slate500,textAlign:"left"},pl={px:2,py:1.25,verticalAlign:"middle"},xl=(e,t)=>
1(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-flex",alignItems:"baseline",gap:.6},children:[e,null!=t&&(0,a.jsxs)(o.A,{component:"span",sx:{color:_e.slate400,fontWeight:500},children:["(",t,")"]})]}),ml={COMPLETED:{bg:"#52c41a",fg:"#fff"},ACTIVE:{bg:_e.brand,fg:"#fff"},FAILED:{bg:"#ff4d4f",fg:"#fff"},NO_SHOW:{bg:_e.slate200,fg:_e.slate600},CANCELLED:{bg:_e.slate200,fg:_e.slate600}},ul=e=>{let{status:t}=e;const n=ml[t]||{bg:_e.slate200,fg:_e.slate600};return(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-block",bgcolor:n.bg,color:n.fg,fontSize:"0.6875rem",fontWeight:700,px:1.25,py:.375,borderRadius:1.25,whiteSpace:"nowrap"},children:t||"\u2014"})},fl=()=>{var e,t,n,l,K,q,Y,G,X,J,Q,$,Z,ee,te,ne,oe,ie,le,ae,re,se;const ce=(0,Ce.xz)(),{canManage:de,isTenant:pe,isCompanyAdmin:xe,canListCompanies:me,source:ue}=Ji(),fe=ue.supportsAppLibraryWrite&&(de||pe&&xe),{refreshUserData:he,companyWithUserInfoData:ve}=(0,_.h)()||{},[ge,be]=(0,E.useState)(null),[Ae,ye]=(0,E.useState)([]),[je,Se]=(0,E.useState)(null),[we,ke]=(0,E.useState)(null),[Fe,ze]=(0,E.useState)(null);(0,E.useEffect)((()=>{const e=null===Fe||void 0===Fe?void 0:Fe.device;if(null===e||void 0===e||!e.id)return;let t=!0;const n=async()=>{try{const n=await U.A.pollDeviceLiveMetrics(e.id),o=null===n||void 0===n?void 0:n.sample;t&&o&&"number"===typeof o.t&&ze((t=>{var n;if(!t||(null===(n=t.device)||void 0===n?void 0:n.id)!==e.id)return t;const l=t.samples[t.samples.length-1];return l&&l.t===o.t?t:(0,i.A)((0,i.A)({},t),{},{samples:[...t.samples,o].slice(-40)})}))}catch(n){}};n();const o=setInterval(n,3e3);return()=>{t=!1,clearInterval(o)}}),[null===Fe||void 0===Fe||null===(e=Fe.device)||void 0===e?void 0:e.id]);const[Ie,Ne]=(0,E.useState)([]),[Re,De]=(0,E.useState)(null),[Me,Te]=(0,E.useState)([]),[We,Oe]=(0,E.useState)([]),[Ee,Le]=(0,E.useState)([]),[Be,Ue]=(0,E.useState)(!0),[Pe,He]=(0,E.useState)({}),[Ve,Ke]=(0,E.useState)((()=>ue.supportsNodes?"nodes":"devices")),[Ge,Xe]=(0,E.useState)("all"),[Je,$e]=(0,E.useState)(null),[Ze,et]=(0,E.useState)([]),[tt,nt]=(0,E.useState)(new Set),[it,lt]=(0,E.useState)(new Set),at=(0,E.useRef)(null),rt=(0,E.useRef)(null),[st,ct]=(0,E.useState)(""),[dt,pt]=(0,E.useState)(""),[xt,mt]=(0,E.useState)(0),[ut,ft]=(0,E.useState)(10),[ht,vt]=(0,E.useState)(null),[gt,bt]=(0,E.useState)(""),[At,yt]=(0,E.useState)(null),jt=(0,E.useRef)(null),[St,wt]=(0,E.useState)(!1),kt="df-notif-rules",[Ft,Ct]=(0,E.useState)((()=>{try{const e=localStorage.getItem(kt);return e?JSON.parse(e):[]}catch(e){return[]}})),[zt,It]=(0,E.useState)(null),[Nt,Rt]=(0,E.useState)(null),Dt=e=>{try{localStorage.setItem(kt,JSON.stringify(e))}catch(t){}},Mt=(e,t)=>It({scope:{type:e,target:t}}),[Et,Bt]=(0,E.useState)(null),[Ut,Pt]=(0,E.useState)(""),[Ht,Vt]=(0,E.useState)(""),[Kt,_t]=(0,E.useState)(!1),[qt,Yt]=(0,E.useState)([]),[Gt,Xt]=(0,E.useState)(!1),[Jt,Qt]=(0,E.useState)(!1),[$t,Zt]=(0,E.useState)(null),[en,tn]=(0,E.useState)(null),[nn,on]=(0,E.useState)(null),[ln,an]=(0,E.useState)(""),[rn,sn]=(0,E.useState)(null),[cn,dn]=(0,E.useState)(null),[pn,xn]=(0,E.useState)(null),mn=e=>{var t;xn(null!==(t=null===e||void 0===e?void 0:e.id)&&void 0!==t?t:null),Ke("devices")},[fn,hn]=(0,E.useState)(null),[vn,gn]=(0,E.useState)(null),bn=e=>{an(""),on(e)},An=()=>{on(null),an("")},yn=e=>{if(null==e)return"";const t=Ee.find((t=>t.companyId===e||t.id===e));return t&&(t.companyName||t.name)||"#".concat(e)},jn=null!==(t=null!==(n=null===ve||void 0===ve||null===(l=ve.company)||void 0===l?void 0:l.companyId)&&void 0!==n?n:null===ve||void 0===ve||null===(K=ve.company)||void 0===K?void 0:K.id)&&void 0!==t?t:null,Sn=ce&&(Ee.find((e=>{var t;return String(null!==(t=e.companyId)&&void 0!==t?t:e.id)===String(jn)}))||Ee[0])||null,wn=Sn?null!==(q=Sn.companyId)&&void 0!==q?q:Sn.id:null,kn=(e,t)=>{const n=Array.isArray(e)?e:[],o=n.map((e=>e.id)),i=rt.current;if(t&&i){const e=o.filter((e=>!i.has(e)));e.length&&(lt((t=>{const n=new Set(t);return e.forEach((e=>n.add(e))),n})),setTimeout((()=>{lt((t=>{const n=new Set(t);return e.forEach((e=>n.delete(e))),n}))}),2e3))}rt.current=new Set(o),et(n)},Fn=(e,t)=>{if(e){const n=at.current;if(t&&n){const t=["nodesOnline","devicesOnline","sessionsActive","sessionsTotal","successRate","totalDeviceMinutes"].filter((t=>n[t]!==e[t]));n.nodesTotal===e.nodesTotal||t.includes("nodesOnline")||t.push("nodesOnline"),n.devicesTotal===e.devicesTotal||t.includes("devicesOnline")||t.push("devicesOnline"),t.length&&(nt(new Set(t)),setTimeout((()=>nt(new Set)),1500))}at.current=e}$e(e)},Cn=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e||Ue(!0);try{const[e,t,n]=await Promise.all([ue.listNodes?ue.listNodes(Tn||void 0):Promise.resolve([]),ue.listDevices(Tn||void 0),me?L.A.getAllCompanies().catch((()=>null)):Promise.resolve(null)]);Te(Array.isArray(e)?e:[]),Oe(Array.isArray(t)?t:[]),Le(Array.isArray(n)&&n.length?n:(()=>{var e,t;const n=null===ve||void 0===ve?void 0:ve.company;return n&&"object"===typeof n?null==(null!==(e=null!==(t=n.companyId)&&void 0!==t?t:n.id)&&void 0!==e?e:null)?[]:[n]:[]})());const[o,i,l]=await Promise.all([ue.getStats?ue.getStats(Tn||void 0).catch((()=>null)):Promise.resolve(null),ue.listSessions(Tn||void 0).catch((()=>[])),U.A.listActiveRuns().catch((()=>[]))]);Fn(o,!1),kn(i,!1),ye(Array.isArray(l)?l:[])}catch(t){e||(0,O.M8)(sl("deviceFarmLoadError","Failed to load device farm data"),{variant:"error"})}finally{e||Ue(!1)}},zn=async()=>{try{const[e,t,n,o,i]=await Promise.all([ue.listNodes?ue.listNodes(Tn||void 0).catch((()=>null)):Promise.resolve(null),ue.listDevices(Tn||void 0).catch((()=>null)),ue.getStats?ue.getStats(Tn||void 0).catch((()=>null)):Promise.resolve(null),ue.listSessions(Tn||void 0).catch((()=>null)),U.A.listActiveRuns().catch((()=>null))]);Array.isArray(e)&&Te(e),Array.isArray(t)&&Oe(t),n&&Fn(n,!0),Array.isArray(o)&&kn(o,!0),Array.isArray(i)&&ye(i)}catch(e){}},In={};Ae.forEach((e=>{e&&null!=e.deviceId&&(In[e.deviceId]=e)}));const Nn={};
1(Ze||[]).forEach((e=>{if(!e||null==e.deviceId||"ACTIVE"!==e.status)return;const t=Nn[e.deviceId];if(t&&new Date(t._startedAt||0)>=new Date(e.startedAt||0))return;const n=e.testName||e.testCaseName||e.pipelineName||null,o=e.userName||e.userEmail||e.startedBy||null,i=n||o||yn(e.companyId)||"#".concat(e.id);Nn[e.deviceId]={kind:n?"run":"user",label:i,startedAt:e.startedAt||null,_startedAt:e.startedAt||null,sessionId:e.id}}));const Rn={};We.forEach((e=>{const t=null!=e.nodeId?String(e.nodeId):"\u2014";Rn[t]=(Rn[t]||0)+1}));const Dn=(0,B.Ay)(),Mn=null!=Dn?String(Dn):"",Tn=Mn;(0,E.useEffect)((()=>{Tn&&Cn(!0)}),[Tn]);const Wn=Tn?Me.filter((e=>{var t;return String(null!==(t=e.ownerCompanyId)&&void 0!==t?t:"")===String(Tn)})):Me,On={};Me.forEach((e=>{var t;On[String(e.id)]=null!==(t=e.ownerCompanyId)&&void 0!==t?t:null}));const En=Tn?We.filter((e=>{var t,n;const o=null!==(t=null!==(n=e.assignedCompanyId)&&void 0!==n?n:On[String(e.nodeId)])&&void 0!==t?t:null;return String(null!==o&&void 0!==o?o:"")===String(Tn)})):We,Ln=Tn?Ze.filter((e=>{var t;return String(null!==(t=e.companyId)&&void 0!==t?t:"")===String(Tn)})):Ze,Bn=("all"===Ge||En.filter((e=>String(e.nodeId)===String(Ge))),async(e,t)=>{if(e)try{let n;if("restart"===t)await U.A.restartDevice(e.id),n=sl("deviceFarmOpRestartQueued","Yeniden ba\u015flatma komutu g\xf6nderildi");else if("baseline"===t)await U.A.setDeviceBaseline(e.id),n=sl("deviceFarmOpBaselineQueued","Baseline alma komutu g\xf6nderildi");else if("reset"===t)await U.A.resetDevice(e.id),n=sl("deviceFarmOpResetQueued","Baseline'a d\xf6nd\xfcrme komutu g\xf6nderildi");else if("block"===t||"unblock"===t){const o="block"===t;await U.A.blockDevice(e.id,o),n=o?ce?sl("deviceFarmOpBlockedTeam","Cihaz bloke edildi \u2014 ekibiniz g\xf6remez/kullanamaz"):sl("deviceFarmOpBlocked","Cihaz bloke edildi \u2014 m\xfc\u015fteriler g\xf6remez/kullanamaz"):ce?sl("deviceFarmOpUnblockedTeam","Cihaz a\xe7\u0131ld\u0131 \u2014 ekibiniz tekrar g\xf6rebilir"):sl("deviceFarmOpUnblocked","Cihaz a\xe7\u0131ld\u0131 \u2014 m\xfc\u015fteriler tekrar g\xf6rebilir"),Cn()}else if((0,Lt.Kg)(t)){const o=(0,Lt.Kg)(t);await U.A.setDeviceUsageMode(e.id,o),n=o===Lt.Ay.AUTOMATION?sl("deviceFarmOpUsageAutomation","Cihaz otomasyona ayr\u0131ld\u0131 \u2014 Inspector/Record ile kullan\u0131lamaz"):o===Lt.Ay.MANUAL?sl("deviceFarmOpUsageManual","Cihaz manuel teste ayr\u0131ld\u0131 \u2014 otomatik ko\u015fular bu cihaz\u0131 se\xe7mez"):sl("deviceFarmOpUsageBoth","Kullan\u0131m k\u0131s\u0131t\u0131 kald\u0131r\u0131ld\u0131 \u2014 cihaz hem ko\u015fu hem manuel kullan\u0131ma a\xe7\u0131k"),Cn()}else"airplane_on"===t||"airplane_off"===t?await U.A.setDeviceAirplane(e.id,"airplane_on"===t):"wifi_on"===t||"wifi_off"===t?await U.A.setDeviceNetwork(e.id,{wifi:"wifi_on"===t}):"data_on"!==t&&"data_off"!==t||await U.A.setDeviceNetwork(e.id,{data:"data_on"===t});n&&(0,O.M8)("".concat(e.displayName||e.name||"#"+e.id,": ").concat(n),{variant:"success"})}catch(i){var n,o;(0,O.M8)((null===i||void 0===i||null===(n=i.response)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.error)||sl("deviceFarmOpError","\u0130\u015flem ba\u015far\u0131s\u0131z"),{variant:"error"})}}),Un=e=>{if(_t(!0),pe)return void ue.listApps(Mn).then((e=>Yt(Array.isArray(e)?e:[]))).catch((()=>Yt([]))).finally((()=>_t(!1)));const t=null!==e&&void 0!==e?e:Ht;if(!t)return Mn?void U.A.listApps(Mn).then((e=>Yt(Array.isArray(e)?e:[]))).catch((()=>Yt([]))).finally((()=>_t(!1))):(Yt([]),void _t(!1));ue.listApps(t).then((e=>Yt(Array.isArray(e)?e:[]))).catch((()=>Yt([]))).finally((()=>_t(!1)))};(0,E.useEffect)((()=>{ce&&wn&&String(Ht||"")!==String(wn)&&(Vt(wn),Un(wn))}),[wn]),(0,E.useEffect)((()=>{var e,t,n,o;if(ce)return;const i=Tn||jn||(null!==(e=null!==(t=null===(n=Ee[0])||void 0===n?void 0:n.companyId)&&void 0!==t?t:null===(o=Ee[0])||void 0===o?void 0:o.id)&&void 0!==e?e:null);null!=i?(String(Ht||"")!==String(i)&&Vt(i),Un(i)):Un()}),[jn,Ee,Tn]);const Pn=async e=>{const t=new FormData;t.append("file",e);const n=await H.Ay.uploadFile(Ht,"device-farm-apps",t);if(!n)throw new Error("CDN url al\u0131namad\u0131");const o=(0,V.Jb)(e.name);return{url:n,fileName:e.name,platform:o}},Hn=async(e,t)=>{const n=await(0,V.GE)(e,t);return n.warning&&(0,O.M8)(sl("deviceFarmAppMetaHint","Uygulama bilgileri (paket/aktivite) okunamad\u0131 \u2014 ko\u015fuda manuel girilebilir."),{variant:"warning"}),(0,V.VG)(n)},Vn=(e,t)=>{var n;const o=null!==(n=null===e||void 0===e?void 0:e.queued)&&void 0!==n?n:0,i=Array.isArray(null===e||void 0===e?void 0:e.skipped)?e.skipped:[];if(0===o&&0===i.length)return void(0,O.M8)(sl("deviceFarmBulkNoTarget","Uygun cihaz yok"),{variant:"warning"});const l=i.length?" \xb7 ".concat(i.length," ").concat(sl("deviceFarmBulkSkipped","atland\u0131")," (").concat(i.slice(0,4).map((e=>"".concat(e.name,":").concat(e.reason))).join(", ")).concat(i.length>4?"\u2026":"",")"):"";(0,O.M8)("".concat(t,": ").concat(o," ").concat(sl("deviceFarmBulkQueued","cihaza komut g\xf6nderildi")).concat(l),{variant:o>0?"success":"warning",autoHideDuration:7e3})},Kn=e=>{var t;
1const n="IOS"===e.platform?"iOS":"ANDROID"===e.platform?"Android":e.platform||"\u2014",o=(null===(t=Me.find((t=>String(t.id)===String(e.nodeId))))||void 0===t?void 0:t.name)||(null!=e.nodeId?"#".concat(e.nodeId):"\u2014"),i="BUSY"===e.status,l="ONLINE"===e.status||"BUSY"===e.status;return{id:e.id,name:e.displayName||e.name||e.udid||"#".concat(e.id),sub:"".concat(n).concat(e.osVersion?" ".concat(e.osVersion):""," \xb7 ").concat(o),search:"".concat(n," ").concat(e.osVersion||""," ").concat(o," ").concat(e.udid||""),platform:e.platform,state:i?sl("deviceFarmBusy","Busy"):l?sl("deviceFarmAvailableState","Available"):sl("deviceFarmOfflineState","Offline"),tone:i?_e.emeraldDk:l?_e.skyDk:_e.slate400,offline:!l}},_n=function(e){let{title:t,single:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=Array.isArray(e)?e:[],i=[...new Set(o.map((e=>null===e||void 0===e?void 0:e.assignedCompanyId)).filter((e=>null!=e)).map(String))];Jn(1===i.length?i[0]:null);const l=n?o.map(Kn):o.filter((e=>"ONLINE"===e.status||"BUSY"===e.status)).map(Kn);Zt({kind:"device",unit:sl("deviceFarmUnitDevices","device(s)"),title:t||sl("deviceFarmInstallOnDevices","Install app on devices"),confirmLabel:sl("deviceFarmInstall","Install"),lockTargets:!!n,libraryLabel:Re?yn(Re):null,targets:l,preselect:l.map((e=>e.id)),onConfirm:Xn})},qn=(e,t)=>U.A.renameNode(e.id,t).then((n=>(dn((o=>o&&o.id===e.id?(0,i.A)((0,i.A)({},o),{},{name:(null===n||void 0===n?void 0:n.name)||t}):o)),Cn(),!0))).catch((e=>(0,O.M8)((0,Wt.gt)(e,{fallbackKey:"deviceFarmNodeRenameError"}),{variant:(0,Wt.kL)(e)?"warning":"error"}))).then((e=>!0===e)),Yn=(e,t)=>{tn((n=>n?(0,i.A)((0,i.A)({},n),{},{jobs:n.jobs.map((n=>String(n.id)===String(e)?(0,i.A)((0,i.A)({},n),t):n))}):n))},Gn=(e,t)=>{t.forEach((t=>{U.A.installAppOnDevice(t.id,e.url,e.packageId||null).then((e=>{const n=e&&e.commandId?e.commandId:null;Yn(t.id,n?{st:"queued",commandId:n}:{st:"failed",msg:sl("deviceFarmInstallSendError","kurulum komutu g\xf6nderilemedi")})})).catch((e=>{var n,o;return Yn(t.id,{st:"failed",msg:(null===e||void 0===e||null===(n=e.response)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.error)||sl("deviceFarmInstallSendError","kurulum komutu g\xf6nderilemedi")})}))}))},Xn=(e,t,n)=>{const o=new Set((t||[]).map(String)),i=n&&n.length?n.filter((e=>o.has(String(e.id)))):((null===$t||void 0===$t?void 0:$t.targets)||[]).filter((e=>o.has(String(e.id))));if(Zt(null),!i.length)return;const l=e.app,a=i.map((e=>({id:e.id,name:e.name||"#".concat(e.id),sub:e.sub||"",st:"pending",commandId:null,msg:""})));tn({app:l,startedAt:Date.now(),jobs:a}),Gn(l,i)};(0,E.useEffect)((()=>{const e=en;if(!e)return;if(e.jobs.every((e=>"done"===e.st||"failed"===e.st)))return;if(Date.now()-(e.startedAt||Date.now())>48e4)return void tn((e=>e?(0,i.A)((0,i.A)({},e),{},{jobs:e.jobs.map((e=>"done"===e.st||"failed"===e.st?e:(0,i.A)((0,i.A)({},e),{},{st:"failed",msg:e.msg||sl("deviceFarmInstallTimeout","zaman a\u015f\u0131m\u0131 \u2014 sonu\xe7 al\u0131namad\u0131")})))}):e));const t=e.jobs.map((e=>e.commandId)).filter(Boolean);if(!t.length)return;const n=setTimeout((()=>{U.A.getInstallJobs(t).then((e=>{const t=new Map((e||[]).map((e=>[String(e.commandId),e])));tn((e=>e?(0,i.A)((0,i.A)({},e),{},{jobs:e.jobs.map((e=>{if(!e.commandId||"done"===e.st||"failed"===e.st)return e;const n=t.get(String(e.commandId));if(!n)return e;const o="DONE"===n.status?"done":"FAILED"===n.status?"failed":"INSTALLING"===n.status?"installing":"queued";return(0,i.A)((0,i.A)({},e),{},{st:o,msg:n.message||e.msg})}))}):e))})).catch((()=>tn((e=>e?(0,i.A)({},e):e))))}),1500);return()=>clearTimeout(n)}),[en]);const Jn=e=>{const t=pe?null:Ht||e||null,n=t?ue.listApps(t):U.A.listApps(Mn);De(t||null),n.then((e=>Ne(Array.isArray(e)?e:[]))).catch((()=>Ne([])))},Qn=async e=>{try{U.A.requestNodeLogs(e).catch((()=>{}));const t=await U.A.getNodeLogs(e);bt((null===t||void 0===t?void 0:t.logs)||""),yt((null===t||void 0===t?void 0:t.logsAt)||null)}catch(t){}};(0,E.useEffect)((()=>{if(!ht)return;const e=setInterval((()=>Qn(ht.id)),3e3);return()=>clearInterval(e)}),[ht]),(0,E.useEffect)((()=>{jt.current&&(jt.current.scrollTop=jt.current.scrollHeight)}),[gt]);const $n=function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";(0,O.M8)("".concat(e,": ").concat(t," ").concat(sl("deviceFarmNodeOpOk","ok")).concat(n?", ".concat(n," ").concat(sl("deviceFarmNodeOpFail","ba\u015far\u0131s\u0131z")):"").
1concat(o),{variant:n>0?t>0?"warning":"error":"success",autoHideDuration:7e3})},Zn=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=0,l=0;for(const r of e)try{await U.A.sendNodeCommand(r.id,t),i+=1}catch(a){l+=1}$n(n,i,l),o&&setTimeout((()=>Cn(!0)),1500)};(0,E.useEffect)((()=>{Cn()}),[]),(0,E.useEffect)((()=>{if(0===Object.keys(Pe).length)return;const e=setInterval((()=>Cn(!0)),2500);return()=>clearInterval(e)}),[Pe]),(0,E.useEffect)((()=>{He((e=>{const t=Object.keys(e);if(0===t.length)return e;const n=(0,i.A)({},e);let o=!1;return t.forEach((t=>{const i=e[t],l=Me.find((e=>String(e.id)===t)),a=Date.now()-((null===i||void 0===i?void 0:i.t0)||0);l&&l.lastHeartbeatAt&&l.lastHeartbeatAt!==i.hb&&a>2500?(delete n[t],o=!0,(0,O.M8)("".concat(l.name||"#".concat(t),": ").concat(sl("deviceFarmRestartDone","yeniden ba\u015flad\u0131 \u2713")),{variant:"success"})):a>6e4&&(delete n[t],o=!0)})),o?n:e}))}),[Me]),(0,E.useEffect)((()=>{if(St||Et)return;zn();const e=setInterval(zn,3e3);return()=>clearInterval(e)}),[St,Et]);return Be?(0,a.jsx)(Zo,{variant:Ve}):(0,a.jsxs)(o.A,{sx:(0,i.A)({height:{xs:"calc(100vh - 82px)",md:"calc(100vh - 90px)"},overflowY:"auto",overflowX:"hidden"},Ye),children:[(0,a.jsxs)(b.A,{value:Ve,onChange:(e,t)=>
1Ke(t),variant:"scrollable",scrollButtons:"auto",allowScrollButtonsMobile:!0,sx:{mt:0,mb:{xs:1.5,md:2},borderBottom:"1px solid ".concat(_e.slate200),minHeight:44,position:"sticky",top:0,zIndex:5,bgcolor:"#FAFAFA",boxShadow:"0 -8px 0 8px #FAFAFA","& .MuiTabs-scroller":{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},"& .MuiTabs-scrollButtons.Mui-disabled":{opacity:0},"& .MuiTabs-indicator":{backgroundColor:_e.brand,height:3,borderRadius:"3px 3px 0 0"},"& .MuiTab-root":{minHeight:44,textTransform:"none",fontSize:"0.9375rem",fontWeight:600,color:"#4b5563",padding:"10px 16px",mr:0,minWidth:90,whiteSpace:"nowrap",borderRadius:"8px 8px 0 0",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)","&:hover":{color:_e.brand,backgroundColor:"action.hover"},"&:focus-visible":{color:_e.brand,backgroundColor:"action.hover"}},"& .Mui-selected":{color:"".concat(_e.brand," !important")}},children:[ue.supportsNodes&&(0,a.jsx)(A.A,{value:"nodes",label:xl(sl("deviceFarmNodes","Nodes"),Wn.length)}),(0,a.jsx)(A.A,{value:"devices",label:xl(sl("deviceFarmDevices","Devices"),En.length)}),(0,a.jsx)(A.A,{value:"runs",label:xl(sl("deviceFarmRecentRuns","Recent runs"),Ln.length)}),de&&ce&&(0,a.jsx)(A.A,{value:"licence",label:xl(sl("deviceFarmSecLicence","Licence"))}),(0,a.jsx)(A.A,{value:"applibrary",label:xl(sl("deviceFarmSecAppLibrary","App Library"))})]}),"overview"===Ve&&(()=>{const e=[],t=Me.filter((e=>"OFFLINE"===e.status));t.length&&e.push({sev:"warning",text:"".concat(t.length," ").concat(sl("deviceFarmAlertNodeOffline","node \xe7evrimd\u0131\u015f\u0131"),": ").concat(t.map((e=>e.name||"#".concat(e.id))).join(", "))});const n=Me.filter((e=>"MAINTENANCE"===e.status));n.length&&e.push({sev:"info",text:"".concat(n.length," ").concat(sl("deviceFarmAlertNodeMaint","node bak\u0131m modunda"))}),Me.filter((e=>"ONLINE"===e.status&&e.health)).forEach((t=>{const n=[];!1===t.health.api&&n.push("API"),!1===t.health.cdn&&n.push("CDN"),!1===t.health.appium&&n.push("Appium"),n.length&&e.push({sev:"warning",text:"".concat(t.name||"#".concat(t.id),": ").concat(n.join(", ")," ").concat(sl("deviceFarmAlertUnreachable","eri\u015filemiyor"))})}));const i=We.filter((e=>"OFFLINE"===e.status&&e.assignedCompanyId));return i.length&&e.push({sev:"warning",text:"".concat(i.length," ").concat(sl("deviceFarmAlertDevOffline","atanm\u0131\u015f cihaz \xe7evrimd\u0131\u015f\u0131"))}),(0,a.jsxs)(o.A,{sx:{mb:3},children:[(0,a.jsxs)(g.A,{variant:"subtitle1",sx:{fontWeight:600,mb:1},children:[sl("deviceFarmAlerts","Alerts"),e.length?" (".concat(e.length,")"):""]}),0===e.length?(0,a.jsxs)(v.A,{variant:"outlined",sx:{px:2,py:1,display:"flex",alignItems:"center",gap:1,borderRadius:2},children:[(0,a.jsx)(o.A,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"success.main"}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem",color:"text.secondary"},children:sl("deviceFarmAllNormal","T\xfcm sistemler normal")})]}):(0,a.jsx)(o.A,{sx:{display:"flex",flexDirection:"column",gap:.8},children:e.map(((e,t)=>(0,a.jsxs)(v.A,{variant:"outlined",sx:t=>{const n=t.palette[e.sev]&&t.palette[e.sev].main||t.palette.info.main;return{px:1.5,py:.9,display:"flex",alignItems:"center",gap:1,borderRadius:2,borderLeft:"4px solid",borderLeftColor:n,bgcolor:(0,h.X4)(n,.06)}},children:[(0,a.jsx)(o.A,{sx:t=>({width:8,height:8,borderRadius:"50%",flexShrink:0,bgcolor:t.palette[e.sev]&&t.palette[e.sev].main||t.palette.info.main})}),(0,a.jsx)(g.A,{sx:{fontSize:"0.8rem"},children:e.text})]},t)))})]})})(),"overview"===Ve&&Je&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.8,mt:1,mb:1},children:[(0,a.jsx)(g.A,{variant:"subtitle1",sx:{fontWeight:600},children:sl("deviceFarmOverview","Overview")}),(0,a.jsxs)(o.A,{sx:{display:"inline-flex",alignItems:"center",gap:.4,px:.8,py:.15,borderRadius:5,bgcolor:"rgba(46,160,67,0.12)","@keyframes livePulse":{"0%,100%":{opacity:1},"50%":{opacity:.25}}},children:[(0,a.jsx)(o.A,{sx:{width:7,height:7,borderRadius:"50%",bgcolor:"success.main",animation:"livePulse 1.4s ease-in-out infinite"}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.6rem",fontWeight:700,color:"success.main",letterSpacing:.3},children:sl("deviceFarmLive","CANLI")})]})]}),(0,a.jsxs)(o.A,{sx:{display:"flex",flexWrap:"wrap",gap:1.5,mb:3},children:[cl((0,a.jsx)(r,{fontSize:"small"}),sl("deviceFarmStatNodes","Nodes online"),"".concat(null!==(Y=Je.nodesOnline)&&void 0!==Y?Y:0,"/").concat(null!==(G=Je.nodesTotal)&&void 0!==G?G:0),"success",Je.nodesMaintenance?"".concat(Je.nodesMaintenance," ").concat(sl("deviceFarmDraining","Bak\u0131m")):null,tt.has("nodesOnline")),cl((0,a.jsx)(s,{fontSize:"small"}),sl("deviceFarmStatDevices","Devices online"),"".concat(null!==(X=Je.devicesOnline)&&void 0!==X?X:0,"/").concat(null!==(J=Je.devicesTotal)&&void 0!==J?J:0),"info",Je.devicesBusy?"".concat(Je.devicesBusy," ").concat(sl("deviceFarmBusy","busy")):null,tt.has("devicesOnline")),cl((0,a.jsx)(c,{fontSize:"small"}),sl("deviceFarmStatActive","Active runs"),null!==(Q=Je.sessionsActive)&&void 0!==Q?Q:0,"warning",null,tt.has("sessionsActive")),cl((0,a.jsx)(d,{fontSize:"small"}),sl("deviceFarmStatTotal","Total runs"),null!==($=Je.sessionsTotal)&&void 0!==$?$:0,"primary",null,tt.has("sessionsTotal")),cl((0,a.jsx)(p.A,{fontSize:"small"}),sl("deviceFarmStatSuccess","Success rate"),null!=Je.successRate?"%".concat(Je.successRate):"\u2014",null!=Je.successRate&&Je.successRate<50?"error":"success","".concat(null!==(Z=Je.sessionsCompleted)&&void 0!==Z?Z:0,"\u2713 / ").concat(null!==(ee=Je.sessionsFailed)&&void 0!==ee?ee:0,"\u2717"),tt.has("successRate")),!ce&&cl((0,a.jsx)(x,{fontSize:"small"}),sl("deviceFarmStatMinutes","Device-minutes"),null!==(te=Je.totalDeviceMinutes)&&void 0!==te?te:0,"secondary",null,tt.has("totalDeviceMinutes"))]})]}),ue.supportsNodes&&"nodes"===Ve&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(Tt,{canManage:de,rawNodes:Wn,devices:En,onRefresh:()=>Cn(),onNodeCommand:de?async(e,t)=>{try{await U.A.sendNodeCommand(e.id,t);
1const n={restart:sl("deviceFarmCmdRestart","Yeniden ba\u015flatma komutu g\xf6nderildi"),drain:sl("deviceFarmCmdDrain","Bak\u0131m moduna al\u0131nd\u0131 \u2014 yeni i\u015f almayacak"),resume:sl("deviceFarmCmdResume","Bak\u0131m modundan \xe7\u0131kar\u0131ld\u0131")};(0,O.M8)("".concat(e.name||"#".concat(e.id),": ").concat(n[t]),{variant:"success"}),"restart"===t?He((t=>(0,i.A)((0,i.A)({},t),{},{[e.id]:{hb:e.lastHeartbeatAt||"",t0:Date.now()}}))):setTimeout((()=>Cn(!0)),1500)}catch(n){(0,O.M8)(sl("deviceFarmCmdError","Komut g\xf6nderilemedi"),{variant:"error"})}}:null,onDeleteNodes:de?(e,t)=>{const n=Array.isArray(e)?e:[];0!==n.length?bn({variant:"error",danger:!0,requireText:"delete",title:sl("deviceFarmDeleteNodesTitle","Node(lar) silinsin mi?"),subtitle:n.map((e=>e.name||"#".concat(e.id))).join(", "),message:sl("deviceFarmDeleteNodesMsg","Se\xe7ili node(lar) ve bunlara ba\u011fl\u0131 cihaz kay\u0131tlar\u0131 farmdan kald\u0131r\u0131lacak. Bu i\u015flem geri al\u0131namaz."),confirmLabel:sl("deviceFarmDelete","Sil"),onConfirm:async()=>{let e=0,o=0;for(const t of n)try{await U.A.deleteNode(t.id),e+=1}catch(i){o+=1}$n(sl("deviceFarmDeleteNodes","Node silme"),e,o),t&&t(),Cn()}}):(0,O.M8)(sl("deviceFarmNoNodeSelected","\xd6nce node se\xe7in"),{variant:"warning"})}:null,onManageAction:de?(e,t)=>{const n=Array.isArray(t)?t:[];if("installcmd"===e){const e=n[0];return null!==e&&void 0!==e&&e.id?void(async()=>{try{var t;const n=await U.A.getNodeToken(e.id),o=(null===n||void 0===n?void 0:n.registrationToken)||(null===n||void 0===n||null===(t=n.data)||void 0===t?void 0:t.registrationToken);if(!o)throw new Error(sl("deviceFarmFarmKeyMissing","API key al\u0131namad\u0131"));const i=(0,P.sf)(o),l=String(e.os||"").toUpperCase(),a="WINDOWS"===l?i.windows:"MAC"===l?i.mac:i.linux;await navigator.clipboard.writeText(a),(0,O.M8)(sl("deviceFarmInstallCmdCopied","Kurulum komutu panoya kopyaland\u0131"),{variant:"success"})}catch(i){var n,o;(0,O.M8)((null===i||void 0===i||null===(n=i.response)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.error)||i.message||sl("deviceFarmOpError","\u0130\u015flem ba\u015far\u0131s\u0131z"),{variant:"error"})}})():void(0,O.M8)(sl("deviceFarmNoNodeSelected","\xd6nce node se\xe7in"),{variant:"warning"})}if("install"!==e){if("alerts"===e)return 0===n.length?void(0,O.M8)(sl("deviceFarmNoNodeSelected","\xd6nce node se\xe7in"),{variant:"warning"}):void Mt("nodes",n);if(0!==n.length)if("monon"!==e&&"monoff"!==e)"killemu"!==e?"rebootdev"===e&&bn({variant:"warning",danger:!1,title:sl("deviceFarmRestartDevicesTitle","Cihazlar yeniden ba\u015flat\u0131ls\u0131n m\u0131?"),subtitle:n.map((e=>e.name||"#".concat(e.id))).join(", "),message:sl("deviceFarmRestartDevicesMsg","Se\xe7ili node(lar)daki t\xfcm cihazlar yeniden ba\u015flat\u0131lacak."),confirmLabel:sl("deviceFarmRestartDevicesConfirm","Yeniden ba\u015flat"),onConfirm:()=>(async e=>{let t=0,n=0;const o=[];for(const a of e)try{var i;const e=await U.A.bulkRestartDevices({nodeId:a.id});t+=null!==(i=null===e||void 0===e?void 0:e.queued)&&void 0!==i?i:0,Array.isArray(null===e||void 0===e?void 0:e.skipped)&&o.push(...e.skipped)}catch(l){n+=1}Vn({queued:t,skipped:o},sl("deviceFarmBulkRestart","Toplu restart")),n>0&&(0,O.M8)("".concat(n," ").concat(sl("deviceFarmNodeUnreachable","node ula\u015f\u0131lamad\u0131")),{variant:"warning"})})(n)}):bn({variant:"warning",danger:!0,title:sl("deviceFarmKillEmuTitle","Em\xfclat\xf6rler kapat\u0131ls\u0131n m\u0131?"),subtitle:n.map((e=>e.name||"#".concat(e.id))).join(", "),message:sl("deviceFarmKillEmuMsg","Se\xe7ili node(lar)daki \xe7al\u0131\u015fan t\xfcm Android em\xfclat\xf6rleri kapat\u0131lacak."),confirmLabel:sl("deviceFarmKillEmuConfirm","Em\xfclat\xf6rleri kapat"),onConfirm:()=>Zn(n,"kill_emulators",sl("deviceFarmKillEmu","Em\xfclat\xf6r kapatma"))});else{const t="monon"===e;Zn(n,t?"monitoring_on":"monitoring_off",t?sl("deviceFarmMonOn","\u0130zleme a\xe7\u0131ld\u0131"):sl("deviceFarmMonOff","\u0130zleme kapat\u0131ld\u0131"),!0)}else(0,O.M8)(sl("deviceFarmNoNodeSelected","\xd6nce node se\xe7in"),{variant:"warning"})}else{const e=new Set(n.map((e=>String(e.id)))),t=n.length?We.filter((t=>e.has(String(t.nodeId)))):We;_n(t,{title:sl("deviceFarmInstallOnDevices","Install app on devices")})}}:null,onNodeView:e=>dn(e),onRename:de?qn:null,onNodeLogs:de?e=>{vt(e),bt(""),yt(null),Qn(e.id)}:null,onCreateNode:de?()=>wt(!0):null,onOpenDevices:mn,onRemoteShell:de?e=>Rt(e):null,onCopyFarmKey:de?async e=>{if(null!==e&&void 0!==e&&e.id)try{var t;const n=await U.A.getNodeToken(e.id),o=(null===n||void 0===n?void 0:n.registrationToken)||(null===n||void 0===n||null===(t=n.data)||void 0===t?void 0:t.registrationToken);if(!o)throw new Error(sl("deviceFarmFarmKeyMissing","API key al\u0131namad\u0131"));await navigator.clipboard.writeText(o)}catch(i){var n,o;(0,O.M8)((null===i||void 0===i||null===(n=i.response)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.error)||i.message||sl("deviceFarmOpError","\u0130\u015flem ba\u015far\u0131s\u0131z"),{variant:"error"})}}:null})}),"devices"===Ve&&(0===En.length?(0,a.jsx)(o.A,{sx:{textAlign:"center",color:"text.disabled",py:6,fontSize:"0.85rem"},children:sl("deviceFarmNoDevicesInScope","Bu \u015firkete ait cihaz yok")}):(0,a.jsx)(un,{devices:En,nodes:Wn,focusNodeId:pn,onFocusNodeApplied:()=>xn(null),sessionByDevice:Nn,onRefresh:()=>Cn(),onBulkInstall:de?e=>{const t=Array.isArray(e)&&e.length?e:We;_n(t,{title:sl("deviceFarmInstallOnDevices","Install app on devices")})}:null,onUseDevice:e=>{be(e)},onDeviceAlerts:e=>Mt("device",e),onNotifications:()=>Mt("all",null),notifCount:Ft.length,onDeviceDetails:e=>{be(e)}})),"runs"===Ve&&(()=>{const e=Ln.filter((e=>{var t;return(!st||e.status===st)&&(!dt||String(null!==(t=e.projectId)&&void 0!==t?t:"")===String(dt))})),t=[],n=new Set;Ln.forEach((e=>{null==e.projectId||n.has(String(e.projectId))||(n.add(String(e.projectId)),t.push([String(e.projectId),e.projectName||"#".concat(e.projectId)]))}));
1const l=Math.max(0,Math.ceil(e.length/ut)-1),r=Math.min(xt,l),s=e.slice(r*ut,r*ut+ut),c=e.length;return(0,a.jsxs)(o.A,{sx:{fontFamily:"Inter, sans-serif",mb:3},children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:2,flexWrap:"wrap"},children:[(0,a.jsxs)(g.A,{sx:{fontSize:"1.0625rem",fontWeight:700,color:_e.ink},children:[sl("deviceFarmRecentRuns","Recent runs")," (",c,")"]}),Ln.length>=200&&(0,a.jsx)(g.A,{sx:{fontSize:"0.65rem",color:_e.slate400},children:sl("deviceFarmRunsCap","son 200 g\xf6steriliyor")}),(0,a.jsx)(o.A,{sx:{flexGrow:1}}),(0,a.jsx)(o.A,{sx:{width:{xs:"100%",sm:170}},children:(0,a.jsx)(ot,{value:st,onChange:e=>{ct(e),mt(0)},options:[["",sl("status","Status")],["ACTIVE","ACTIVE"],["COMPLETED","COMPLETED"],["FAILED","FAILED"]]})}),t.length>0&&(0,a.jsx)(o.A,{sx:{width:{xs:"100%",sm:220}},children:(0,a.jsx)(ot,{value:dt,onChange:e=>{pt(e),mt(0)},options:[["",sl("deviceFarmAllProjects","T\xfcm projeler")],...t]})})]}),(0,a.jsx)(o.A,{sx:(0,i.A)({borderRadius:3,border:"1px solid ".concat(_e.slate100),bgcolor:"#fff",overflowX:"auto",maxHeight:{lg:"calc(100vh - 332px)"},overflowY:{lg:"auto"}},Ye),children:(0,a.jsxs)(o.A,{component:"table",sx:{width:"100%",minWidth:720,borderCollapse:"collapse",fontSize:{xs:"0.8125rem",sm:"0.9rem"},"& td, & th":{whiteSpace:"nowrap"},"& thead th":{position:"sticky",top:0,zIndex:1,bgcolor:"#EFF1F5"}},children:[(0,a.jsx)(o.A,{component:"thead",children:(0,a.jsxs)(o.A,{component:"tr",sx:{borderBottom:"1px solid ".concat(_e.slate200),bgcolor:"#EFF1F5"},children:[(0,a.jsx)(o.A,{component:"th",sx:dl,children:"ID"}),(0,a.jsx)(o.A,{component:"th",sx:dl,children:sl("project","Project")}),ue.supportsNodes&&(0,a.jsx)(o.A,{component:"th",sx:dl,children:sl("deviceFarmNode","Node")}),(0,a.jsx)(o.A,{component:"th",sx:dl,children:sl("device","Device")}),(0,a.jsx)(o.A,{component:"th",sx:dl,children:sl("status","Status")}),(0,a.jsx)(o.A,{component:"th",sx:dl,children:sl("deviceFarmStartedAt","Started")}),(0,a.jsx)(o.A,{component:"th",sx:(0,i.A)((0,i.A)({},dl),{},{textAlign:"right"}),children:sl("deviceFarmMinutes","Min")})]})}),(0,a.jsx)(o.A,{component:"tbody",children:0===c?(0,a.jsx)(o.A,{component:"tr",children:(0,a.jsx)(o.A,{component:"td",colSpan:6+(ue.supportsNodes?1:0),sx:{textAlign:"center",color:_e.slate400,py:5},children:sl("deviceFarmNoRuns","No runs yet")})}):s.map((e=>{var t;return(0,a.jsxs)(o.A,{component:"tr",sx:(0,i.A)({borderBottom:"1px solid ".concat(_e.slate100),"&:hover":{bgcolor:"#fafbfc"}},it.has(e.id)?{"@keyframes runRowFlash":{"0%":{backgroundColor:"rgba(46,160,67,0.32)"},"40%":{backgroundColor:"rgba(46,160,67,0.10)"},"70%":{backgroundColor:"rgba(46,160,67,0.26)"},"100%":{backgroundColor:"rgba(46,160,67,0)"}},animation:"runRowFlash 2s ease-out","& > td:first-of-type":{boxShadow:"inset 3px 0 0 0 #2ea043"}}:{}),children:[(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},pl),{},{color:_e.slate700}),children:e.id}),(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},pl),{},{color:_e.slate700}),children:e.projectName||(e.projectId?"#".concat(e.projectId):"\u2014")}),ue.supportsNodes&&(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},pl),{},{color:_e.slate600}),children:e.nodeName||(e.nodeId?"#".concat(e.nodeId):"\u2014")}),(0,a.jsxs)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},pl),{},{color:_e.slate700}),children:[e.deviceName||(e.deviceId?"#".concat(e.deviceId):"\u2014"),e.platform?(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.65rem",color:_e.slate400,fontWeight:500,ml:.75},children:e.platform}):null]}),(0,a.jsx)(o.A,{component:"td",sx:pl,children:(0,a.jsx)(ul,{status:e.status})}),(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},pl),{},{color:_e.slate600,fontSize:"0.8rem",whiteSpace:"nowrap"}),children:e.startedAt?new Date(e.startedAt).toLocaleString():"\u2014"}),(0,a.jsx)(o.A,{component:"td",sx:(0,i.A)((0,i.A)({},pl),{},{textAlign:"right",pr:2,color:_e.slate700,whiteSpace:"nowrap"}),children:(0,a.jsxs)(o.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5,justifyContent:"flex-end"},children:[(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-block",minWidth:20,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:null!==(t=e.minutes)&&void 0!==t?t:"\u2014"}),(0,a.jsx)(Qe,{size:28,title:sl("deviceFarmTelemetryView","Cihaz metrikleri"),onClick:()=>(async e=>{if(null!==e&&void 0!==e&&e.id){ke({session:e,samples:[],loading:!0});try{const t=await ue.getSessionTelemetry(e.id,Mn);ke({session:e,samples:(null===t||void 0===t?void 0:t.samples)||[],loading:!1})}catch(t){ke({session:e,samples:[],loading:!1})}}})(e),sx:{color:_e.brand},children:(0,a.jsx)(m,{sx:{fontSize:"15px !important"}})})]})})]},e.id)}))})]})}),c>0&&(0,a.jsx)(y.A,{id:"device-farm-runs-pagination",component:"div",rowsPerPageOptions:[10,25,50,100],c
1ount:c,rowsPerPage:ut,page:r,onPageChange:(e,t)=>mt(t),onRowsPerPageChange:e=>{ft(parseInt(e.target.value,10)),mt(0)},labelRowsPerPage:sl("rowsPerPage","Rows per page"),sx:{mt:.5,"& .MuiTablePagination-toolbar":{minHeight:48,alignItems:"center",justifyContent:"flex-end",flexWrap:{xs:"wrap",sm:"nowrap"},rowGap:.5,pl:{xs:0,sm:2},pr:{xs:0,sm:.5}},"& .MuiTablePagination-spacer":{display:{xs:"none",sm:"block"}},"& .MuiTablePagination-selectLabel, & .MuiTablePagination-displayedRows":{fontSize:"0.8125rem",color:_e.slate500,m:0,lineHeight:"1.5"},"& .MuiTablePagination-select":{fontSize:"0.8125rem",lineHeight:"1.5"},"& .MuiTablePagination-displayedRows":{ml:{xs:1.5,sm:3}},"& .MuiTablePagination-actions":{ml:{xs:.5,sm:2}}}})]})})(),ce&&de&&"licence"===Ve&&(()=>{const e=(null===Sn||void 0===Sn?void 0:Sn.companyLicenceDTO)||{},t=e.companyLicenceLimitDetails||{},n=Boolean(t.deviceFarmEnabled),i=t.farmAllowedPlatforms?String(t.farmAllowedPlatforms).split(",").map((e=>e.trim())).filter(Boolean).join(" \xb7 "):null,l=Me.filter((e=>"ONLINE"===e.status)).length,r=We.filter((e=>"ONLINE"===e.status||"BUSY"===e.status)).length,s=Ze.filter((e=>"ACTIVE"===e.status)).length,c=e=>null===e||void 0===e||""===e?"\u2014":e,d=[[sl("deviceFarmEnabledLabel","Device Farm"),n?sl("on","On"):sl("off","Off")],[sl("deviceFarmTier","Tier"),c(t.deviceFarmTier)],[sl("deviceFarmLicPlatforms","Allowed platforms"),c(i)],[sl("deviceFarmLicType","Licence type"),c(e.licenceType)],[sl("deviceFarmLicExpiry","Expires"),e.expireDate?new Date(e.expireDate).toLocaleDateString():"\u2014"]],p=[[sl("deviceFarmLicUsageNodes","Nodes"),String(Me.length),"".concat(l," ").concat(sl("deviceFarmLicUsageOnline","online"))],[sl("deviceFarmLicUsageDevices","Devices"),String(We.length),"".concat(r," ").concat(sl("deviceFarmLicUsageOnline","online"))],[sl("deviceFarmStatActive","Active runs"),String(s),""]];return(0,a.jsxs)(o.A,{sx:{fontFamily:"Inter, sans-serif",mb:3},children:[(0,a.jsx)(g.A,{sx:{color:_e.slate500,fontSize:"0.9375rem",mb:2.5},children:sl("deviceFarmLicenceHint","Cihaz laboratuvar\u0131n\u0131z\u0131n lisans haklar\u0131 ve anl\u0131k kullan\u0131m\u0131. Haklar lisans\u0131n\u0131zdan gelir; uygulama i\xe7inden de\u011fi\u015ftirilemez. De\u011fi\u015fiklik i\xe7in sa\u011flay\u0131c\u0131n\u0131zla ileti\u015fime ge\xe7in.")}),(0,a.jsxs)(o.A,{sx:{display:"flex",flexWrap:"wrap",gap:2,alignItems:"flex-start"},children:[(0,a.jsxs)(o.A,{sx:{flex:"1 1 320px",minWidth:300,borderRadius:3,border:"1px solid ".concat(_e.slate100),overflow:"hidden"},children:[(0,a.jsxs)(o.A,{sx:{px:2,py:1.5,borderBottom:"1px solid ".concat(_e.slate200),bgcolor:"rgba(248,250,252,0.6)",display:"flex",alignItems:"center",gap:1},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.82rem",fontWeight:700,color:_e.slate600},children:sl("deviceFarmLicEntitlements","Entitlements")}),(0,a.jsx)(o.A,{sx:{flex:1}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.7rem",color:_e.slate400},children:(null===Sn||void 0===Sn?void 0:Sn.companyName)||(null===Sn||void 0===Sn?void 0:Sn.name)||"\u2014"})]}),d.map(((e,t)=>{let[i,l]=e;return(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:2,py:1.5,borderTop:0===t?"none":"1px solid ".concat(_e.slate100)},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.85rem",color:_e.slate500},children:i}),(0,a.jsx)(o.A,{sx:{flex:1}}),i===sl("deviceFarmEnabledLabel","Device Farm")?(0,a.jsx)(o.A,{component:"span",sx:{display:"inline-block",fontSize:"0.6875rem",fontWeight:700,px:1.25,py:.375,borderRadius:1.25,bgcolor:n?_e.emerald:_e.slate100,color:n?"#fff":_e.slate500},children:l}):(0,a.jsx)(g.A,{sx:{fontSize:"0.875rem",fontWeight:600,color:_e.slate700,textAlign:"right"},children:l})]},i)}))]}),(0,a.jsxs)(o.A,{sx:{flex:"1 1 280px",minWidth:260,borderRadius:3,border:"1px solid ".concat(_e.slate100),overflow:"hidden"},children:[(0,a.jsx)(o.A,{sx:{px:2,py:1.5,borderBottom:"1px solid ".concat(_e.slate200),bgcolor:"rgba(248,250,252,0.6)"},children:(0,a.jsx)(g.A,{sx:{fontSize:"0.82rem",fontWeight:700,color:_e.slate600},children:sl("deviceFarmLicUsage","Current usage")})}),p.map(((e,t)=>{let[n,i,l]=e;return(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:2,px:2,py:1.5,borderTop:0===t?"none":"1px solid ".concat(_e.slate100)},children:[(0,a.jsxs)(o.A,{sx:{minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.85rem",color:_e.slate500},children:n}),l?(0,a.jsx)(g.A,{sx:{fontSize:"0.68rem",color:_e.slate400},children:l}):null]}),(0,a.jsx)(o.A,{sx:{flex:1}}),(0,a.jsx)(g.A,{sx:{fontSize:"1.05rem",fontWeight:800,color:_e.ink},children:i})]},n)}))]})]}),(0,a.jsx)(g.A,{sx:{fontSize:"0.75rem",color:_e.slate400,mt:2},children:sl("deviceFarmLicReadOnlyNote","Bu de\u011ferler salt-okunurdur \u2014 lisans\u0131n\u0131zla belirlenir.")})]})})(),(0,a.jsxs)(j.A,{open:de&&!!ht,onClose:()=>
1vt(null),maxWidth:"md",fullWidth:!0,children:[(0,a.jsxs)(S.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[sl("deviceFarmNodeLogs","Node logs")," \u2014 ",(null===ht||void 0===ht?void 0:ht.name)||(ht?"#".concat(ht.id):""),(0,a.jsx)(o.A,{sx:{flexGrow:1}}),At&&(0,a.jsxs)(g.A,{sx:{fontSize:"0.65rem",color:"text.secondary"},children:[sl("deviceFarmLogsAt","g\xfcncelleme"),": ",new Date(At).toLocaleTimeString()]})]}),(0,a.jsx)(w.A,{children:(0,a.jsx)(o.A,{ref:jt,component:"pre",sx:{m:0,p:1.5,height:460,overflow:"auto",borderRadius:1,bgcolor:"#0d1117",color:"#c9d1d9",fontFamily:"monospace",fontSize:"0.72rem",lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:gt||sl("deviceFarmLogsLoading","Loglar isteniyor\u2026 (node birka\xe7 saniye i\xe7inde g\xf6nderir)")})}),(0,a.jsxs)(k.A,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",gap:.6,mr:"auto",ml:1},children:[(0,a.jsx)(o.A,{sx:{width:7,height:7,borderRadius:"50%",bgcolor:"success.main","@keyframes lp":{"0%,100%":{opacity:1},"50%":{opacity:.3}},animation:"lp 1.4s ease-in-out infinite"}}),(0,a.jsx)(g.A,{sx:{fontSize:"0.65rem",color:"text.secondary"},children:sl("deviceFarmLiveTail","canl\u0131 (3sn)")})]}),(0,a.jsx)(F.A,{onClick:()=>ht&&Qn(ht.id),children:sl("refresh","Refresh")}),(0,a.jsx)(F.A,{onClick:()=>vt(null),children:sl("close","Close")})]})]}),(0,a.jsx)(Ot,{open:de&&St,onClose:()=>wt(!1),onRefresh:()=>Cn(),existingNames:Wn.map((e=>null===e||void 0===e?void 0:e.name)).filter(Boolean)}),(0,a.jsxs)(j.A,{open:!ce&&de&&!!Et,onClose:()=>Bt(null),maxWidth:"xs",fullWidth:!0,children:[(0,a.jsx)(S.A,{children:sl("deviceFarmAssignTitle","Assign Device to Company")}),(0,a.jsxs)(w.A,{sx:{pt:1},children:[(0,a.jsxs)(g.A,{variant:"body2",sx:{mb:2,color:"text.secondary"},children:[(null===Et||void 0===Et?void 0:Et.name)||(null===Et||void 0===Et?void 0:Et.udid)," \u2014 ",null===Et||void 0===Et?void 0:Et.platform]}),(0,a.jsxs)(C.A,{fullWidth:!0,children:[(0,a.jsx)(z.A,{children:sl("company","Company")}),(0,a.jsx)(I.A,{label:sl("company","Company"),value:Ut,onChange:e=>Pt(e.target.value),children:Ee.map((e=>(0,a.jsx)(N.A,{value:e.companyId||e.id,children:e.companyName||e.name},e.companyId||e.id)))})]})]}),(0,a.jsxs)(k.A,{children:[(0,a.jsx)(F.A,{onClick:()=>Bt(null),children:sl("cancel","Cancel")}),(0,a.jsx)(F.A,{variant:"contained",onClick:async()=>{if(Ut)try{await U.A.assignDevice(Et.id,Ut),(0,O.M8)(sl("deviceFarmDeviceAssigned","Device assigned"),{variant:"success"}),Bt(null),Pt(""),Cn()}catch(n){var e,t;(0,O.M8)((null===n||void 0===n||null===(e=n.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.error)||sl("deviceFarmAssignError","Failed to assign device"),{variant:"error"})}else(0,O.M8)(sl("deviceFarmSelectCompany","Select a company"),{variant:"warning"})},children:sl("deviceFarmAssign","Assign")})]})]}),(0,a.jsx)(Xo,{canManage:de,open:!!ge,device:ge?We.find((e=>String(e.id)===String(ge.id)))||ge:null,nodeName:ge?null===(ne=Me.find((e=>String(e.id)===String(ge.nodeId))))||void 0===ne?void 0:ne.name:null,nodeOffline:!!ge&&"OFFLINE"===(null===(oe=Me.find((e=>String(e.id)===String(ge.nodeId))))||void 0===oe?void 0:oe.status),holder:ge?Nn[ge.id]:null,pollLiveMetrics:ue.supportsLiveDiagnostics?e=>U.A.pollDeviceLiveMetrics(e):null,getDeviceLogcat:ue.supportsLiveDiagnostics?e=>U.A.getDeviceLogcat(e):null,onClose:()=>be(null),onRestart:ue.supportsDeviceControls?e=>U.A.restartDevice(e):null,onInstall:ue.supportsDeviceInstall?e=>(e=>{e&&_n([e],{title:"".concat(sl("deviceFarmInstallBuildOn","Install app on")," ").concat(e.displayName||e.name||"#".concat(e.id)),single:!0})})(e):null,onDeviceOp:(e,t)=>"baseline"===t?new Promise((t=>((e,t)=>{if(!e)return;const n=e;bn({variant:"warning",danger:!1,title:sl("deviceFarmBaselineConfirmTitle","Baseline olarak kaydedilsin mi?"),subtitle:n.displayName||n.name||"#".concat(n.id),message:sl("deviceFarmBaselineConfirmMsg","Baseline = cihaz\u0131n temiz ba\u015flang\u0131\xe7 hali. \u015eu an cihazda kurulu olan T\xdcM uygulamalar kal\u0131c\u0131 kabul edilir; sonraki ko\u015fularda yaln\u0131z verileri temizlenir, KALDIRILMAZ. Baseline'\u0131 yaln\u0131z temiz bir cihazda (test/m\xfc\u015fteri uygulamas\u0131 yokken) al\u0131n. Devam edilsin mi?"),confirmLabel:sl("deviceFarmOpSetBaseline","Baseline olarak kaydet"),onConfirm:async()=>{await Bn(n,"baseline"),t&&t()}})})(e,(()=>t(!0))))):"reset"===t?new Promise((t=>((e,t)=>{if(!e)return;const n=e;bn({variant:"warning",danger:!0,title:sl("deviceFarmResetConfirmTitle","Cihaz baseline'a d\xf6nd\xfcr\xfcls\xfcn m\xfc?"),subtitle:n.displayName||n.name||"#".concat(n.id),message:sl("deviceFarmResetConfirmMsg","Cihaz kay\u0131tl\u0131 baseline haline d\xf6nd\xfcr\xfcl\xfcr: baseline'da OLMAYAN t\xfcm uygulamalar C\u0130HAZDAN KALDIRILIR (adb uninstall); baseline'daki uygulamalar kald\u0131r\u0131lmaz, yaln\u0131z verileri silinir (pm clear). Em\xfclat\xf6rde baseline snapshot'\u0131 geri y\xfcklenir, iOS sim\xfclat\xf6r\xfcnde cihaz tamamen silinir (erase). Bu i\u015flem geri al\u0131namaz. Devam edilsin mi?"),confirmLabel:sl("deviceFarm
1CtlResetBaseline","Baseline'a d\xf6nd\xfcr"),onConfirm:async()=>{await Bn(n,"reset"),t&&t()}})})(e,(()=>t(!0))))):Bn(e,t),onAssign:e=>{Bt(e),Pt("")},onUnassign:e=>(async e=>{try{await U.A.unassignDevice(e.id),(0,O.M8)(sl("deviceFarmDeviceUnassigned","Device returned to shared pool"),{variant:"success"}),Cn()}catch(o){var t,n;(0,O.M8)((null===o||void 0===o||null===(t=o.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.error)||sl("deviceFarmUnassignError","Failed to unassign device"),{variant:"error"})}})(e),onSetReservable:(e,t)=>(async(e,t)=>{try{await U.A.setDeviceReservable(e.id,t),(0,O.M8)(t?sl("deviceFarmMarkedReservable","Cihaz rezerve havuzuna al\u0131nd\u0131"):sl("deviceFarmMarkedShared","Cihaz ortak havuza al\u0131nd\u0131"),{variant:"success"}),Cn()}catch(i){var n,o;(0,O.M8)((null===i||void 0===i||null===(n=i.response)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.error)||sl("deviceFarmPoolSetError","Havuz de\u011fi\u015ftirilemedi"),{variant:"error"})}})(e,t),onForceRelease:()=>{const e=ge;null!==e&&void 0!==e&&e.id&&bn({variant:"warning",danger:!0,title:sl("deviceFarmForceReleaseTitle","Cihaz zorla serbest b\u0131rak\u0131ls\u0131n m\u0131?"),message:sl("deviceFarmForceReleaseMsg","Bu cihaz\u0131 tutan her \u015fey (aktif oturum, Inspector kilidi, canl\u0131 yay\u0131n) sonland\u0131r\u0131l\u0131r ve cihaz havuza d\xf6ner. Devam edilsin mi?"),confirmLabel:sl("deviceFarmForceRelease","Force release"),onConfirm:async()=>{try{var t;const n=await U.A.forceReleaseDevice(e.id);(0,O.M8)("".concat(sl("deviceFarmDeviceReleased","Cihaz serbest b\u0131rak\u0131ld\u0131")," \xb7 ").concat(sl("deviceFarmClosedSessions","kapat\u0131lan oturum"),": ").concat(null!==(t=null===n||void 0===n?void 0:n.closedSessions)&&void 0!==t?t:0),{variant:"success"}),Cn()}catch(i){var n,o;(0,O.M8)((null===i||void 0===i||null===(n=i.response)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.error)||sl("deviceFarmOpError","\u0130\u015flem ba\u015far\u0131s\u0131z"),{variant:"error"})}}})}}),(0,a.jsx)(po.A,{open:!!je,onClose:()=>Se(null),observeFarmSessionId:null===je||void 0===je?void 0:je.farmSessionId,readOnly:!0,hostName:sl("deviceFarmWatchingRun","Watching run"),device:je?{name:je.deviceName,platform:String(je.platform||"").toLowerCase()}:null}),(0,a.jsxs)(R.A,{anchorEl:rn,open:!!rn,onClose:()=>{sn(null),hn(null)},children:[(0,a.jsxs)(N.A,{onClick:()=>{const e=fn;sn(null),hn(null),(async e=>{try{const t=await U.A.getNodeToken(e.id);gn({node:e,token:(null===t||void 0===t?void 0:t.registrationToken)||""})}catch(o){var t,n;(0,O.M8)((null===o||void 0===o||null===(t=o.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.error)||sl("deviceFarmNodeTokenError","API key al\u0131namad\u0131"),{variant:"error"})}})(e)},children:[(0,a.jsx)(u.A,{fontSize:"small",sx:{mr:1}})," ",sl("deviceFarmShowFarmKey","API key g\xf6ster & kopyala")]}),(0,a.jsx)(D.A,{}),(0,a.jsxs)(N.A,{sx:{color:"error.main"},onClick:()=>{const e=fn;sn(null),hn(null),bn({title:sl("deviceFarmDeleteNodeTitle","Node silinsin mi?"),message:sl("deviceFarmDeleteNodeMsg","Bu node ve ona ba\u011fl\u0131 T\xdcM cihazlar veritaban\u0131ndan silinecek. Geri al\u0131namaz."),confirmLabel:sl("deviceFarmDelete","Sil"),onConfirm:()=>(async e=>{try{await U.A.deleteNode(e.id),(0,O.M8)("".concat(e.name||"#".concat(e.id),": ").concat(sl("deviceFarmNodeDeleted","node silindi")),{variant:"success"}),Cn()}catch(o){var t,n;(0,O.M8)((null===o||void 0===o||null===(t=o.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.error)||sl("deviceFarmNodeDeleteError","Node silinemedi"),{variant:"error"})}})(e)})},children:[(0,a.jsx)(f.A,{fontSize:"small",sx:{mr:1}})," ",sl("deviceFarmDeleteNode","Node\u2019u sil")]})]}),(0,a.jsx)(so.A,{open:Boolean(nn),onClose:An,onConfirm:async()=>{const e=null===nn||void 0===nn?void 0:nn.onConfirm;An(),e&&await e()},variant:(null===nn||void 0===nn?void 0:nn.variant)||"error",danger:null===(ie=null===nn||void 0===nn?void 0:nn.danger)||void 0===ie||ie,title:null===nn||void 0===nn?void 0:nn.title,subtitle:null===nn||void 0===nn?void 0:nn.subtitle,message:null!==nn&&void 0!==nn&&nn.requireText||null===nn||void 0===nn?void 0:nn.message,loading:Boolean(null===nn||void 0===nn?void 0:nn.requireText)&&ln.trim().toLowerCase()!==nn.requireText,confirmLabel:(null===nn||void 0===nn?void 0:nn.confirmLabel)||sl("deviceFarmDelete","Sil"),children:null!==nn&&void 0!==nn&&nn.requireText?(0,a.jsxs)(o.A,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[(0,a.jsx)(g.A,{sx:{fontSize:"0.92rem",color:"#1f2430",lineHeight:1.6},children:nn.message}),(0,a.jsxs)(g.A,{sx:{fontSize:"0.85rem",color:"#6b7588"}
1,children:[sl("deviceFarmTypeToConfirm","Onaylamak i\xe7in a\u015fa\u011f\u0131ya")," ",(0,a.jsx)("b",{children:nn.requireText})," ",sl("deviceFarmTypeToConfirmSuffix","yaz\u0131n.")]}),(0,a.jsx)(M.A,{size:"small",autoFocus:!0,value:ln,onChange:e=>an(e.target.value),placeholder:nn.requireText,inputProps:{autoComplete:"off",spellCheck:!1}})]}):null}),(0,a.jsxs)(j.A,{open:de&&Boolean(vn),onClose:()=>gn(null),maxWidth:"sm",fullWidth:!0,children:[(0,a.jsxs)(S.A,{children:[sl("deviceFarmFarmKeyTitle","API Key")," \u2014 ",(null===vn||void 0===vn||null===(le=vn.node)||void 0===le?void 0:le.name)||(vn?"#".concat(vn.node.id):"")]}),(0,a.jsxs)(w.A,{children:[(0,a.jsx)(T.A,{severity:"info",sx:{mb:2},children:sl("deviceFarmFarmKeyInfo","Agent bu key ile ba\u015flat\u0131l\u0131r: --apikey <key>. Gizli tut \u2014 yaln\u0131z operat\xf6r g\xf6r\xfcr.")}),(0,a.jsx)(M.A,{fullWidth:!0,multiline:!0,size:"small",value:(null===vn||void 0===vn?void 0:vn.token)||"",InputProps:{readOnly:!0,sx:{fontFamily:"monospace",fontSize:"0.8rem",wordBreak:"break-all"}}})]}),(0,a.jsxs)(k.A,{children:[(0,a.jsx)(F.A,{onClick:()=>gn(null),children:sl("close","Kapat")}),(0,a.jsx)(F.A,{variant:"contained",startIcon:(0,a.jsx)(u.A,{fontSize:"small"}),onClick:async()=>{if(null!==vn&&void 0!==vn&&vn.token)try{await navigator.clipboard.writeText(vn.token),(0,O.M8)(sl("deviceFarmNodeTokenCopied","API key kopyaland\u0131"),{variant:"success"})}catch(e){(0,O.M8)(sl("deviceFarmCopyFail","Kopyalanamad\u0131"),{variant:"warning"})}},children:sl("deviceFarmCopy","Kopyala")})]})]}),"applibrary"===Ve&&(0,a.jsx)(bi,{canManage:fe,hideCompanyPicker:!0,companies:Ee,appLibCompanyId:Ht,onCompanyChange:e=>{Vt(e),Un(e),Ne([]),De(e||null)},apps:qt,loading:Kt,busy:Gt,maxApps:30,onAdd:async e=>{if(e)if(Ht)try{Xt(!0);const t=await Pn(e),n=await Hn(e,t.platform);await ue.createApp(Ht,(0,i.A)((0,i.A)((0,i.A)({},t),n),{},{fileSize:e.size})),Un(),(0,O.M8)("".concat(e.name,": ").concat(sl("deviceFarmAppUploaded","y\xfcklendi")),{variant:"success"})}catch(o){var t,n;(0,O.M8)((null===o||void 0===o||null===(t=o.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.error)||o.message||sl("deviceFarmAppUploadError","Y\xfckleme ba\u015far\u0131s\u0131z"),{variant:"error"})}finally{Xt(!1)}else(0,O.M8)(sl("deviceFarmAppLibNoCompany","\u015eirket ba\u011flam\u0131 \xe7\xf6z\xfclemedi \u2014 sayfay\u0131 yenileyip tekrar deneyin"),{variant:"warning"})},onUpdate:async(e,t)=>{if(t&&e)if(Ht)try{Xt(!0);const n=await Pn(t),o=await Hn(t,n.platform);await ue.updateApp(Ht,e.id,(0,i.A)((0,i.A)({url:n.url,fileName:n.fileName},o),{},{fileSize:t.size})),Un(),(0,O.M8)("".concat(e.fileName||e.id,": ").concat(sl("deviceFarmAppUpdated","yeni s\xfcr\xfcm y\xfcklendi")),{variant:"success"})}catch(l){var n,o;(0,O.M8)((null===l||void 0===l||null===(n=l.response)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.error)||l.message||sl("deviceFarmAppUploadError","Y\xfckleme ba\u015far\u0131s\u0131z"),{variant:"error"})}finally{Xt(!1)}else(0,O.M8)(sl("deviceFarmAppLibNoCompany","\u015eirket ba\u011flam\u0131 \xe7\xf6z\xfclemedi \u2014 sayfay\u0131 yenileyip tekrar deneyin"),{variant:"warning"})},onRename:(e,t)=>ue.renameApp(Ht,e.id,t).then((()=>{Un(),Jn()})).catch((e=>{var t,n;return(0,O.M8)((null===e||void 0===e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.error)||sl("deviceFarmAppRenameError","Ad guncellenemedi"),{variant:"error"})})),onEditIdentity:(e,t)=>ue.editAppIdentity(Ht,e.id,t).then((e=>(Un(),Jn(),(0,O.M8)(sl("deviceFarmAppIdentitySaved","Uygulama bilgileri g\xfcncellendi"),{variant:"success"}),e))).catch((e=>{throw(0,O.M8)((0,Wt.gt)(e,{fallbackKey:"deviceFarmAppIdentityError"}),{variant:"error"}),e})),onDelete:e=>bn({title:sl("deviceFarmDeleteAppTitle","Uygulama silinsin mi?"),message:"".concat(e.fileName||e.packageId||"#".concat(e.id)," \u2014 ").concat(sl("deviceFarmDeleteAppMsg","App Library\u2019den silinecek. Bu uygulamay\u0131 se\xe7en ko\u015fularda art\u0131k kurulmaz.")),confirmLabel:sl("deviceFarmDelete","Sil"),onConfirm:()=>(async e=>{if(e)if(Ht)try{Xt(!0),await ue.deleteApp(Ht,e.id),Un(),(0,O.M8)("".concat(e.fileName||e.
1id,": ").concat(sl("deviceFarmAppDeleted","silindi")),{variant:"success"})}catch(o){var t,n;(0,O.M8)((null===o||void 0===o||null===(t=o.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.error)||sl("deviceFarmAppDeleteError","Silme ba\u015far\u0131s\u0131z"),{variant:"error"})}finally{Xt(!1)}else(0,O.M8)(sl("deviceFarmAppLibNoCompany","\u015eirket ba\u011flam\u0131 \xe7\xf6z\xfclemedi \u2014 sayfay\u0131 yenileyip tekrar deneyin"),{variant:"warning"})})(e)})}),(0,a.jsx)(ll,{ctx:$t,apps:Ie,onClose:()=>Zt(null)}),(0,a.jsx)(rl,{state:en,onClose:()=>tn(null),onRetry:()=>{if(!en)return;const e=en.jobs.filter((e=>"failed"===e.st)).map((e=>({id:e.id,name:e.name,sub:e.sub})));if(!e.length)return;const t=en.app,n=new Set(e.map((e=>String(e.id))));tn((e=>e?(0,i.A)((0,i.A)({},e),{},{startedAt:Date.now(),jobs:e.jobs.map((e=>n.has(String(e.id))?(0,i.A)((0,i.A)({},e),{},{st:"pending",commandId:null,msg:""}):e))}):e)),Gn(t,e)}}),(0,a.jsx)(co.A,{open:Boolean(we),onClose:()=>ke(null),title:sl("deviceFarmTelemetryTitle","Device Metrics"),subtitle:null!==we&&void 0!==we&&we.session?[we.session.deviceName||"#".concat(we.session.deviceId),ce?null:yn(we.session.companyId),we.session.status].filter(Boolean).join(" \xb7 "):"",variant:"info",icon:(0,a.jsx)(m,{}),maxWidth:"md",children:(0,a.jsx)(ro.A,{samples:null===we||void 0===we?void 0:we.samples,loading:null===we||void 0===we?void 0:we.loading})}),(0,a.jsxs)(co.A,{open:Boolean(Fe),onClose:()=>ze(null),title:sl("deviceFarmLiveMetricsTitle","Canl\u0131 Cihaz Metrikleri"),subtitle:null!==Fe&&void 0!==Fe&&Fe.device?Fe.device.displayName||Fe.device.name||"#".concat(Fe.device.id):"",variant:"info",icon:(0,a.jsx)(m,{}),maxWidth:"md",children:[(0,a.jsxs)(o.A,{sx:{mb:1.5,display:"flex",alignItems:"center",gap:1},children:[(0,a.jsx)(W.A,{size:"small",color:null!==Fe&&void 0!==Fe&&null!==(ae=Fe.samples)&&void 0!==ae&&ae.length?"success":"warning",label:null!==Fe&&void 0!==Fe&&null!==(re=Fe.samples)&&void 0!==re&&re.length?"LIVE":sl("deviceFarmConnecting","Ba\u011flan\u0131yor\u2026"),sx:{height:20,fontWeight:700,fontSize:"0.62rem"}}),(0,a.jsx)(g.A,{variant:"caption",color:"text.secondary",children:sl("deviceFarmLiveHint","~3 sn\u2019de bir g\xfcncellenir; yaln\u0131z bu pencere a\xe7\u0131kken \xe7eker.")})]}),(0,a.jsx)(ro.A,{samples:null===Fe||void 0===Fe?void 0:Fe.samples,loading:!(null!==Fe&&void 0!==Fe&&null!==(se=Fe.samples)&&void 0!==se&&se.length)})]}),(0,a.jsx)(ao,{open:!!cn,node:cn,devices:We,onClose:()=>dn(null),onOpenDevices:mn,onRename:de?qn:null}),(0,a.jsx)(Bi,{open:qe,scope:null===zt||void 0===zt?void 0:zt.scope,rules:Ft,onAddRule:e=>{Ct((t=>{const n=[...t,e];return Dt(n),n})),(0,O.M8)(sl("deviceFarmNtfRuleAdded","Rule saved locally (backend enforcement coming soon)"),{variant:"success"})},onDeleteRule:e=>{Ct((t=>{const n=t.filter((t=>t.id!==e));return Dt(n),n}))},onClose:()=>It(null)}),(0,a.jsx)(qi,{open:de&&!!Nt,node:Nt,onClose:()=>Rt(null)})]})};var hl=n(671768),vl=n(545866),gl=n(472661),bl=n(908253),Al=n(89573),yl=n(313157),jl=n(479693),Sl=n(104983),wl=n(914857),kl=n(46589),Fl=n(857191),Cl=n(702046),zl=n(211761);const Il=255,Nl=zl.Ay.DEVICE_FARM_REQUEST,Rl=(0,zl.aw)(Nl);function Dl(e){let{open:t,onClose:n,onSent:l,companyId:r}=e;const s=(0,wl.A)(),c=(0,kl.A)(s.breakpoints.down("sm")),[d,p]=(0,E.useState)(""),[x,m]=(0,E.useState)(!1),[u,f]=(0,E.useState)(null),[h,v]=(0,E.useState)(!1),b=()=>{x||(p(""),f(null),v(!1),n())};return(0,a.jsxs)(j.A,{open:t,onClose:b,maxWidth:"sm",fullWidth:!0,fullScreen:c,PaperProps:{sx:{borderRadius:c?0:3,overflow:"hidden"}},children:[(0,a.jsxs)(S.A,{sx:{background:"linear-gradient(135deg, #2196f3 0%, #1976d2 50%, #1565c0 100%)",color:"#fff","& .MuiTypography-root":{color:"#fff !important"},"& .MuiSvgIcon-root":{color:"#fff !important"},px:{xs:2,sm:3},py:{xs:1.75,sm:2},display:"flex",alignItems:"center",gap:1.5},children:[(0,a.jsx)(o.A,{sx:{width:40,height:40,borderRadius:2,bgcolor:"rgba(255,255,255,.18)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,a.jsx)(Rl.icon,{sx:{fontSize:22,color:"#fff"}})}),(0,a.jsxs)(o.A,{sx:{flex:1,minWidth:0},children:[(0,a.jsx)(g.A,{sx:{fontWeight:700,fontSize:{xs:"1rem",sm:"1.05rem"},lineHeight:1.3,color:"#fff"},children:Ge("deviceFarmRequestTitle","Device Farm Talebi")}),(0,a.jsx)(g.A,{sx:{fontSize:{xs:"0.75rem",sm:"0.8rem"},color:"rgba(255,255,255,.9)"},children:Ge("deviceFarmRequestSubtitle","Talebiniz SmartestQA ekibine iletilecektir.")})]}),(0,a.jsx)(Y.A,{onClick:b,disabled:x,sx:{color:"#fff","&.Mui-disabled":{color:"rgba(255,255,255,.5)"}},size:"small",children:(0,a.jsx)(Cn.default,{})})]}),(0,a.jsx)(w.A,{sx:lt.RY,children:h?(0,a.jsx)(Fl.A,{in:h,timeout:400,children:(0,a.jsxs)(o.A,{sx:{textAlign:"center",py:4},children:[(0,a.jsx)(o.A,{sx:{width:{xs:64,sm:72},height:{xs:64,sm:72},borderRadius:"50%",backgroundColor:"success.lighter",display:"flex",alignItems:"center",justifyContent:"center",mx:"auto",mb:2.5,animation:"feedbackSuccessPulse 1.6s ease-in-out infinite","@keyframes feedbackSuccessPulse":{"0%, 100%":{boxShadow:"0 0 0 0 rgba(76, 175, 80, 0.35)"},"50%":{boxShadow:"0 0 0 12px rgba(76, 175, 80, 0)"}}},children:(0,a.jsx)(Sl.default,{sx:{fontSize:{xs:38,sm:42},color:"success.main"}})}),(0,a.jsx)(g.A,{sx:{fontWeight:700,fontSize:"1.05rem",mb:.5},children:Ge("deviceFarmRequestSuccessTitle","Talebiniz al\u0131nd\u0131")}),(0,a.jsx)(g.A,{sx:{fontSize:"0.88rem",color:"#64748b",maxWidth:360,mx:"auto"},children:Ge("deviceFarmRequestSuccessText","Ekibimiz en k\u0131sa s\xfcrede sizinle ileti\u015fime ge\xe7ecek.")})]})}):(0,a.jsxs)(a.Fragment,{children:[u&&(0,a.jsx)(T.A,{severity:"error",sx:{mb:2},children:u}),(0,a.jsx)(M.A,{label:Ge("deviceFarmRequestMessageLabel","Mesaj\u0131n\u0131z (opsiyonel)"),placeholder:Ge("deviceFarmRequestMessagePlaceholder","Eklemek istedi\u011finiz bir not var m\u0131?"),value:d,onChange:e=>p(e.target.value),fullWidth:!0,multiline:!0,rows:4,sx:lt.FB,inputProps:{maxLength:Il},InputProps:{startAdornment:(0,a.jsx)(Cl.A,{position:"start",sx:{alignSelf:"flex-start",mt:1.5},children:(0,a.jsx)(yl.default,{sx:{color:"#94a3b8"}})})}}),(0,a.jsxs)(g.A,{sx:{fontSize:"0.75rem",color:"#94a3b8",textAlign:"right",mt:.5},children:[d.length,"/",Il]})]})}),(0,a.jsx)(k.A,{sx:lt.N3,children:h?(0,a.jsx)(F.A,{onClick:b,variant:"text",sx:{color:"text.secondary","&:hover":{color:"text.primary",bgcolor:"action.hover"}},children:Ge("close","Kapat")}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(F.A,{onClick:b,disabled:x,sx:{px:3,color:"text.secondary"},children:Ge("cancel","\u0130ptal")}),(0,a.jsx)(F.A,{onClick:async()=>{m(!0),f(null);try{const e=await Al.A.submitDeviceFarmRequest({companyId:r,message:d.trim()||null,pageUrl:window.location.href,browserInfo:navigator.userAgent});v(!0),l&&l((null===e||void 0===e?void 0:e.data)||null)}catch(e){f(Ge("deviceFarmRequestError","Talep g\xf6nderilemedi. L\xfctfen tekrar deneyin."))}finally{m(!1)}},variant:"contained",disabled:x,startIcon:x?(0,a.jsx)(bn.A,{size:15,color:"inherit"}):(0,a.jsx)(jl.default,{sx:{fontSize:{xs:16,sm:17}}}),sx:(0,i.A)((0,i.A)({},(0,lt.Mk)("#1976d2")),{},{px:{xs:2.25,sm:2.5},py:{xs:.7,sm:.65},fontSize:{xs:"0.85rem",sm:"0.875rem"},minWidth:{xs:"auto",sm:104},lineHeight:1.7,whiteSpace:"nowrap"}),children:Ge("deviceFarmRequestSend","Talep G\xf6nder")})]})})]})}function Ml(){const{companyWithUserInfoData:e}=(0,_.h)()||{},[t,n]=(0,E.useState)(null),[l,r]=(0,E.useState)(!0),[s,c]=(0,E.useState)(!1),[d,p]=(0,E.useState)(!1),x=(0,B.Ay)(),m=(0,E.useCallback)((async()=>
1{if(null==x)return n(null),void r(!1);try{const e=await Al.A.getDeviceFarmRequestStatus(x);n((null===e||void 0===e?void 0:e.data)||null)}catch(e){n(null)}finally{r(!1)}}),[x]);(0,E.useEffect)((()=>{m()}),[m]);const u=[Ge("deviceFarmUpsellBenefit1","Ger\xe7ek cihaz ve em\xfclat\xf6r havuzunda mobil testler"),Ge("deviceFarmUpsellBenefit2","Ayn\u0131 testi birden \xe7ok cihazda paralel ko\u015fma"),Ge("deviceFarmUpsellBenefit3","Canl\u0131 ekran yans\u0131tma, telemetri ve \xe7\xf6kme kay\u0131tlar\u0131"),Ge("deviceFarmUpsellBenefit4","Kurulum/altyap\u0131 yok \u2014 cihazlar haz\u0131r, se\xe7 ve ko\u015f")],f=!(null===t||void 0===t||!t.alreadyRequested),h=(0,E.useMemo)((()=>{if(null===t||void 0===t||!t.requestedAt)return null;const e=new Date(t.requestedAt);return Number.isNaN(e.getTime())?null:e.toLocaleString(void 0,{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}),[t]);return(0,a.jsxs)(o.A,{sx:{display:"flex",justifyContent:"center",px:2,py:{xs:4,md:8}},children:[(0,a.jsxs)(o.A,{sx:{width:"100%",maxWidth:560,textAlign:"center",borderRadius:3,border:"1px solid ".concat(_e.slate200),bgcolor:"#fff",px:{xs:3,md:5},py:{xs:4,md:6}},children:[(0,a.jsx)(o.A,{sx:{width:{xs:56,sm:64},height:{xs:56,sm:64},borderRadius:"50%",mx:"auto",mb:2,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"".concat(_e.brand,"14")},children:(0,a.jsx)(hl.default,{sx:{fontSize:{xs:28,sm:32},color:_e.brand}})}),(0,a.jsx)(o.A,{component:"span",sx:{display:"block",fontSize:"1.35rem",fontWeight:800,color:_e.ink,mb:1},children:Ge("deviceFarmUpsellTitle","SmartTest Device Farm")}),(0,a.jsx)(o.A,{component:"span",sx:{display:"block",fontSize:"0.92rem",color:_e.slate500,lineHeight:1.6,mb:3},children:Ge("deviceFarmUpsellSubtitle",Ge("deviceFarmUpsellSubtitle","Run your mobile tests on real devices. This feature is not enabled on your account yet."))}),(0,a.jsx)(o.A,{sx:{textAlign:"left",maxWidth:400,mx:"auto",mb:3.5},children:u.map(((e,t)=>(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"flex-start",gap:1,mb:1.25},children:[(0,a.jsx)(Q.default,{sx:{fontSize:18,color:_e.emerald,mt:"2px",flexShrink:0}}),(0,a.jsx)(o.A,{component:"span",sx:{fontSize:"0.86rem",color:_e.slate600,lineHeight:1.5},children:e})]},t)))}),l?(0,a.jsx)(bn.A,{size:22,sx:{color:_e.brand}}):f?(0,a.jsxs)(o.A,{children:[(0,a.jsxs)(o.A,{sx:{display:"flex",alignItems:"flex-start",gap:1.25,textAlign:"left",borderRadius:2,border:"1px solid ".concat(_e.emerald,"44"),bgcolor:"".concat(_e.emerald,"0F"),px:2,py:1.75,mb:2},children:[(0,a.jsx)(vl.default,{sx:{fontSize:20,color:_e.emeraldDk,mt:"1px",flexShrink:0}}),(0,a.jsxs)(o.A,{children:[(0,a.jsxs)(o.A,{component:"span",sx:{display:"block",fontSize:"0.88rem",fontWeight:700,color:_e.ink},children:[Ge("deviceFarmRequestSuccessTitle","Talebiniz al\u0131nd\u0131"),h?" \xb7 ".concat(h):""]}),(0,a.jsx)(o.A,{component:"span",sx:{display:"block",fontSize:"0.82rem",color:_e.slate600,mt:.25},children:Ge("deviceFarmRequestSuccessText","Ekibimiz en k\u0131sa s\xfcrede sizinle ileti\u015fime ge\xe7ecek.")})]})]}),(0,a.jsx)(F.A,{onClick:()=>p(!0),variant:"outlined",startIcon:(0,a.jsx)(gl.default,{sx:{fontSize:18}}),sx:{borderRadius:2,textTransform:"none",fontWeight:700,fontSize:"0.86rem",color:_e.brand,borderColor:"".concat(_e.brand,"66"),"&:hover":{borderColor:_e.brand,bgcolor:"".concat(_e.brand,"0A")}},children:Ge("contactUs","Bize Ula\u015f\u0131n")})]}):(0,a.jsx)(F.A,{onClick:()=>c(!0),variant:"contained",startIcon:(0,a.jsx)(Di.default,{sx:{fontSize:{xs:19,sm:20}}}),sx:(0,i.A)((0,i.A)({},(0,lt.Mk)(_e.brand)),{},{width:{xs:"100%",sm:"auto"},px:{xs:3,sm:4},py:{xs:1.3,sm:1.5},fontSize:{xs:"0.9rem",sm:"0.97rem"}}),children:Ge("deviceFarmUpsellCta","Etkinle\u015ftirmek i\xe7in bizimle ileti\u015fime ge\xe7in")})]}),(0,a.jsx)(Dl,{open:s,companyId:x,onClose:()=>c(!1),onSent:e=>n(e)}),(0,a.jsx)(bl.A,{open:d,onClose:()=>p(!1)})]})}function Tl(){var e,t,n,i;const{companyWithUserInfoData:l}=(0,_.h)()||{},r=(null===l||void 0===l||null===(e=l.smartRole)||void 0===e?void 0:e.roleType)===ze.Ay.RoleSuperAdmin,s=null===l||void 0===l||null===(t=l.company)||void 0===t||null===(n=t.companyLicenceDTO)||void 0===n||null===(i=n.companyLicenceLimitDetails)||void 0===i?void 0:i.deviceFarmEnabled,c=!r&&!s;return(0,a.jsx)(o.A,{sx:{p:{xs:1,md:2},pt:{xs:.5,md:.5}},children:c?(0,a.jsx)(Ml,{}):(0,a.jsx)(fl,{})})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.