@xenon-device-management/xenon 2.13.1 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/README.md +11 -5
  2. package/lib/package.json +1 -1
  3. package/lib/public/assets/{AnnotationOverlay-Cvpkk4r9.js → AnnotationOverlay-B_VNtKBH.js} +1 -1
  4. package/lib/public/assets/{ApiKeyGate-Bhn5ZtVM.js → ApiKeyGate-BwuaMjkX.js} +1 -1
  5. package/lib/public/assets/{BugReportButton-BA6aEjTC.js → BugReportButton-BAt0_pzq.js} +1 -1
  6. package/lib/public/assets/DeviceMosaicView-BYaQHhTf.js +2 -0
  7. package/lib/public/assets/{EmptyState-CgzbuUvO.js → EmptyState-BSjhk_IV.js} +1 -1
  8. package/lib/public/assets/{FieldGroup-BHc_5qNc.js → FieldGroup-Cb5QZsE1.js} +1 -1
  9. package/lib/public/assets/{FilterMenu-D7OMGuRc.js → FilterMenu-BAaSlWbW.js} +1 -1
  10. package/lib/public/assets/{Menu-C173JJ0l.js → Menu-JGGYrSQQ.js} +1 -1
  11. package/lib/public/assets/{Modal-ChvVUI3B.js → Modal-CFCp3n9d.js} +1 -1
  12. package/lib/public/assets/{RecordingPage-Dhw4d_O6.js → RecordingPage-CbJj_EBT.js} +1 -1
  13. package/lib/public/assets/{RecordingsPage-z97ftGK-.js → RecordingsPage-BJeYnygR.js} +2 -2
  14. package/lib/public/assets/{SegmentedControl-DbXhBGZC.js → SegmentedControl-Bg42Atjy.js} +1 -1
  15. package/lib/public/assets/{SettingCard-C908GgiI.js → SettingCard-Njz1pUIJ.js} +1 -1
  16. package/lib/public/assets/{Table-B1DB_ZN-.js → Table-BcTm5xV2.js} +1 -1
  17. package/lib/public/assets/{activity-Css0xNvp.js → activity-DOVdsfMQ.js} +1 -1
  18. package/lib/public/assets/{ai-settings-BMQK3-yN.js → ai-settings-CsuJroRf.js} +2 -2
  19. package/lib/public/assets/{api-keys-CbJ42eDQ.js → api-keys-BKnNSTw9.js} +1 -1
  20. package/lib/public/assets/{apps-DW1pw2re.js → apps-D0SC6uw6.js} +2 -2
  21. package/lib/public/assets/{arrow-left-Dpog9L0F.js → arrow-left-MMbTmgoE.js} +1 -1
  22. package/lib/public/assets/{arrow-right-CsBIlSIw.js → arrow-right-BMfnGmxW.js} +1 -1
  23. package/lib/public/assets/{arrow-up-right-z1tRQE4R.js → arrow-up-right-DuAftMWB.js} +1 -1
  24. package/lib/public/assets/{auth-shell-mXiX5vNk.js → auth-shell-nZC2JNDO.js} +2 -2
  25. package/lib/public/assets/{builds-page-BcFn23bE.js → builds-page-hDCgTwkS.js} +1 -1
  26. package/lib/public/assets/{button-Cq_zHETv.js → button-Dda4irn_.js} +1 -1
  27. package/lib/public/assets/{calendar-CKxABX9q.js → calendar-BMr0Q62v.js} +1 -1
  28. package/lib/public/assets/{check-C7xu-hGU.js → check-CZ9iw9-e.js} +1 -1
  29. package/lib/public/assets/{chevron-right-BiqfdCGA.js → chevron-right-BRYJJVC9.js} +1 -1
  30. package/lib/public/assets/{circle-check-CyBjjPxR.js → circle-check-CqAJjQ5O.js} +1 -1
  31. package/lib/public/assets/{circle-x-6gMRcx6z.js → circle-x-DlDJtnVz.js} +1 -1
  32. package/lib/public/assets/{clock-U1rDTT1h.js → clock-CpuDKysU.js} +1 -1
  33. package/lib/public/assets/{copy-BIM0ZX0L.js → copy-CAQydNFe.js} +1 -1
  34. package/lib/public/assets/device-explorer-CdO6_nrn.js +282 -0
  35. package/lib/public/assets/{download-DDBRXnAZ.js → download-C9XG6lLv.js} +1 -1
  36. package/lib/public/assets/{forgot-password-Dpg7yxM8.js → forgot-password-CGnkRgE9.js} +1 -1
  37. package/lib/public/assets/h264Stream-VQBphYhg.js +26 -0
  38. package/lib/public/assets/{index-BGBqohfQ.js → index-BbKEXUFH.js} +5 -5
  39. package/lib/public/assets/{index-BTYMAqNW.css → index-Bxoxt9sV.css} +1 -1
  40. package/lib/public/assets/{index-BQ2luT7L.js → index-DJGc1M2f.js} +1 -1
  41. package/lib/public/assets/{input-BvB1cjHE.js → input-Cm0tmSoc.js} +1 -1
  42. package/lib/public/assets/{line-chart-m78VggnW.js → line-chart-D2DyJCml.js} +1 -1
  43. package/lib/public/assets/{list-checks-cY7o1QTL.js → list-checks-UWf1GY99.js} +1 -1
  44. package/lib/public/assets/{lock-loz8txQm.js → lock-CCJv9m_I.js} +1 -1
  45. package/lib/public/assets/{login-BYOvz4lx.js → login-f8vOVW-U.js} +1 -1
  46. package/lib/public/assets/maintenance-settings-C1PrkuAH.js +6 -0
  47. package/lib/public/assets/{monitor-C4HPHb6s.js → monitor-B2jDgwm7.js} +1 -1
  48. package/lib/public/assets/{mouse-pointer-2-BkdKtCzi.js → mouse-pointer-2-DLI1RtzU.js} +1 -1
  49. package/lib/public/assets/{network-C5e0MIWo.js → network-ebT86qoi.js} +1 -1
  50. package/lib/public/assets/{overview-tlu8ijGd.js → overview-C0aykVrd.js} +1 -1
  51. package/lib/public/assets/{page-header-FXPlo6az.js → page-header-BjzgWz-T.js} +1 -1
  52. package/lib/public/assets/{play-CWdk0_Sy.js → play-DLG9t8FU.js} +1 -1
  53. package/lib/public/assets/{plus-B2xCnntV.js → plus-nBFSMu_X.js} +1 -1
  54. package/lib/public/assets/{profile-page-D080qzr4.js → profile-page-CSl0UYlv.js} +1 -1
  55. package/lib/public/assets/{reset-password-D3u4Mbvn.js → reset-password-LeOuHqmB.js} +1 -1
  56. package/lib/public/assets/{runbook-page-hPRZMy7s.js → runbook-page-CMMeQml9.js} +1 -1
  57. package/lib/public/assets/{select-12RThAXc.js → select-88jHcl-Z.js} +1 -1
  58. package/lib/public/assets/{selector-detail-redirect-uQwvV7EQ.js → selector-detail-redirect-BbXKJjZM.js} +1 -1
  59. package/lib/public/assets/{selector-health-page-CThoxDFO.js → selector-health-page-B4rA1Xkv.js} +2 -2
  60. package/lib/public/assets/session-detail-page-COL_RZxw.js +4 -0
  61. package/lib/public/assets/settings-GF6ZMSQ6.js +6 -0
  62. package/lib/public/assets/{stat-tile-B02WEte8.js → stat-tile-BV98e_Sv.js} +1 -1
  63. package/lib/public/assets/{tablet-Dj30VGZl.js → tablet-BiAsnFDj.js} +1 -1
  64. package/lib/public/assets/{teams-uL4fjTDR.js → teams-B4-jrr-1.js} +1 -1
  65. package/lib/public/assets/{trash-2-B54e-TfY.js → trash-2-C5RSuX0e.js} +1 -1
  66. package/lib/public/assets/{upload-B3k8WCSP.js → upload-BG7_rMXK.js} +1 -1
  67. package/lib/public/assets/{use-builds-data-BFn90NH3.js → use-builds-data-J-riQYyC.js} +1 -1
  68. package/lib/public/assets/{use-password-reset-mode-DL2TmWZ0.js → use-password-reset-mode-C8-eH-UG.js} +1 -1
  69. package/lib/public/assets/{users-CqBuxMlX.js → users-CFba5TSy.js} +1 -1
  70. package/lib/public/assets/{users-DjQSucKb.js → users-Cp0beJm3.js} +1 -1
  71. package/lib/public/assets/{video-off-T0rlt0GA.js → video-off-DDsEISjV.js} +1 -1
  72. package/lib/public/assets/webhook-settings-BGu32vSB.js +1 -0
  73. package/lib/public/assets/{zap-gBHqutZV.js → zap-l4VaXzq8.js} +1 -1
  74. package/lib/public/index.html +2 -2
  75. package/lib/schema.json +19 -46
  76. package/lib/src/XenonCapabilityManager.js +22 -5
  77. package/lib/src/app/openapi/control.yaml +71 -20
  78. package/lib/src/app/openapi/grid.yaml +23 -5
  79. package/lib/src/app/openapi/platform.yaml +136 -28
  80. package/lib/src/app/routers/control.js +30 -5
  81. package/lib/src/app/routers/dashboard.js +29 -1
  82. package/lib/src/app/routers/grid.js +32 -10
  83. package/lib/src/app/routers/streamStartConflict.js +3 -0
  84. package/lib/src/app/routers/streamType.js +7 -2
  85. package/lib/src/app/routers/webhook.js +8 -4
  86. package/lib/src/config.js +50 -5
  87. package/lib/src/dashboard/commands.js +185 -141
  88. package/lib/src/dashboard/event-manager.js +39 -6
  89. package/lib/src/data-service/appleFamily.js +43 -0
  90. package/lib/src/data-service/db.js +11 -0
  91. package/lib/src/data-service/device-service.js +46 -1
  92. package/lib/src/data-service/device-store.js +66 -3
  93. package/lib/src/data-service/deviceClaims.js +37 -0
  94. package/lib/src/data-service/deviceFieldOwners.js +25 -11
  95. package/lib/src/data-service/deviceSettings.js +79 -0
  96. package/lib/src/data-service/prisma-store.js +152 -9
  97. package/lib/src/data-service/web-config-service.js +43 -92
  98. package/lib/src/device-managers/AndroidDeviceManager.js +9 -31
  99. package/lib/src/device-managers/ios/WDAClient.js +44 -43
  100. package/lib/src/device-managers/shellCommands.js +96 -0
  101. package/lib/src/device-utils.js +143 -37
  102. package/lib/src/generated/client/edge.js +17 -3
  103. package/lib/src/generated/client/index-browser.js +14 -0
  104. package/lib/src/generated/client/index.d.ts +2054 -379
  105. package/lib/src/generated/client/index.js +17 -3
  106. package/lib/src/generated/client/package.json +1 -1
  107. package/lib/src/generated/client/schema.prisma +35 -7
  108. package/lib/src/generated/client/wasm.js +14 -0
  109. package/lib/src/interceptors/CommandInterceptor.js +29 -8
  110. package/lib/src/interceptors/xenonScripts.js +55 -0
  111. package/lib/src/interfaces/IPluginArgs.js +1 -2
  112. package/lib/src/middleware/deviceAccessGuard.js +63 -9
  113. package/lib/src/plugin.js +15 -1
  114. package/lib/src/prisma.js +1 -1
  115. package/lib/src/scripts/database-check.js +124 -0
  116. package/lib/src/services/AIService.js +99 -0
  117. package/lib/src/services/CleanupService.js +6 -1
  118. package/lib/src/services/InterceptorService.js +70 -13
  119. package/lib/src/services/NetworkConditioningService.js +85 -88
  120. package/lib/src/services/NotificationService.js +36 -29
  121. package/lib/src/services/OrphanSweeper.js +5 -0
  122. package/lib/src/services/PortAllocator.js +5 -0
  123. package/lib/src/services/ServerManager.js +97 -8
  124. package/lib/src/services/SessionLifecycleService.js +63 -53
  125. package/lib/src/services/ShutdownCoordinator.js +33 -0
  126. package/lib/src/services/TeamService.js +20 -3
  127. package/lib/src/services/device-access/SessionOwnerResolver.js +26 -0
  128. package/lib/src/services/device-access/deviceAccessPolicy.js +38 -6
  129. package/lib/src/services/device-access/leaseHold.js +26 -0
  130. package/lib/src/services/device-access/ticketActorAccess.js +6 -0
  131. package/lib/src/services/healing/HealingOrchestrator.js +32 -1
  132. package/lib/src/services/interceptor/AndroidProxyAdapter.js +18 -0
  133. package/lib/src/services/interceptor/interceptorOptions.js +44 -0
  134. package/lib/src/services/lease/activeLeases.js +37 -0
  135. package/lib/src/services/network/AndroidRadios.js +71 -0
  136. package/lib/src/services/network/PhoneNetworkLedger.js +184 -0
  137. package/lib/src/services/network/PhoneNetworkRestore.js +330 -0
  138. package/lib/src/services/network/adbForPhone.js +60 -0
  139. package/lib/src/services/network/phoneNetworkLock.js +20 -0
  140. package/lib/src/services/network/xenonProxy.js +107 -0
  141. package/lib/src/services/omni-vision/OmniVisionService.js +53 -43
  142. package/lib/src/services/omni-vision/VisionAssertionService.js +28 -25
  143. package/lib/src/services/omni-vision/ocrTextMatch.js +105 -0
  144. package/lib/src/services/omni-vision/screenScale.js +68 -0
  145. package/lib/src/services/recording/busy-precheck.js +24 -3
  146. package/lib/src/services/recording/concurrency-gate.js +12 -3
  147. package/lib/src/services/settings/SelfHealingSwitch.js +70 -0
  148. package/lib/src/services/settings/labSettings.js +149 -0
  149. package/lib/src/services/webhookEvents.js +173 -0
  150. package/lib/test/helpers/fake-adb.js +58 -0
  151. package/lib/test/helpers/fake-device-table.js +63 -24
  152. package/lib/test/helpers/scratch-database.js +1 -0
  153. package/lib/test/unit/TeamService.test.js +3 -0
  154. package/lib/test/unit/XenonCapabilityManager.spec.js +4 -2
  155. package/lib/test/unit/apple-family.spec.js +36 -0
  156. package/lib/test/unit/cleanup-settings-db.spec.js +103 -0
  157. package/lib/test/unit/cleanup-settings.spec.js +244 -0
  158. package/lib/test/unit/dashboard-api-paths.spec.js +101 -0
  159. package/lib/test/unit/dashboard-commands.spec.js +249 -0
  160. package/lib/test/unit/dashboard-events-team-scope.spec.js +9 -6
  161. package/lib/test/unit/database-check.spec.js +108 -0
  162. package/lib/test/unit/default-plugin-args.spec.js +33 -0
  163. package/lib/test/unit/device-access-lease.spec.js +270 -0
  164. package/lib/test/unit/device-offline-webhook.spec.js +81 -0
  165. package/lib/test/unit/device-setting-columns.spec.js +66 -0
  166. package/lib/test/unit/device-settings-loki.spec.js +87 -0
  167. package/lib/test/unit/device-settings-survive.spec.js +555 -0
  168. package/lib/test/unit/device-sync-lost-update.spec.js +5 -0
  169. package/lib/test/unit/emulator-boot.spec.js +91 -0
  170. package/lib/test/unit/hub-node-gateway-appium-server.spec.js +48 -0
  171. package/lib/test/unit/hub-node-same-host.spec.js +5 -0
  172. package/lib/test/unit/iphone-ipad-only.spec.js +132 -0
  173. package/lib/test/unit/json-logging-option.spec.js +74 -0
  174. package/lib/test/unit/lab-settings.spec.js +218 -0
  175. package/lib/test/unit/lease/allocate-lease-branch.spec.js +22 -0
  176. package/lib/test/unit/lease/session-lease-proof.spec.js +59 -0
  177. package/lib/test/unit/lease-held-phone.spec.js +196 -0
  178. package/lib/test/unit/max-sessions.spec.js +240 -0
  179. package/lib/test/unit/ocr-text-match.spec.js +44 -0
  180. package/lib/test/unit/omni-vision-analyze-screen.spec.js +72 -0
  181. package/lib/test/unit/omni-vision-ios-points.spec.js +161 -0
  182. package/lib/test/unit/omni-vision-tap-text.spec.js +129 -0
  183. package/lib/test/unit/omni-vision.spec.js +1 -1
  184. package/lib/test/unit/partial-config-file.spec.js +114 -0
  185. package/lib/test/unit/phone-network/boot-clean-up.spec.js +64 -0
  186. package/lib/test/unit/phone-network/interceptor-options.spec.js +77 -0
  187. package/lib/test/unit/phone-network/interceptor-proxy-restore.spec.js +145 -0
  188. package/lib/test/unit/phone-network/network-conditioning.spec.js +145 -0
  189. package/lib/test/unit/phone-network/phone-network-restore.spec.js +246 -0
  190. package/lib/test/unit/phone-network/session-end-paths.spec.js +182 -0
  191. package/lib/test/unit/phone-network/session-start.spec.js +110 -0
  192. package/lib/test/unit/phone-network/xenon-proxy.spec.js +69 -0
  193. package/lib/test/unit/plugin.spec.js +3 -3
  194. package/lib/test/unit/recording-options.spec.js +181 -0
  195. package/lib/test/unit/schema-required-args.spec.js +21 -16
  196. package/lib/test/unit/self-healing-boot.spec.js +75 -0
  197. package/lib/test/unit/self-healing-setting.spec.js +272 -0
  198. package/lib/test/unit/session-failed-webhook.spec.js +170 -0
  199. package/lib/test/unit/shell-commands.spec.js +133 -0
  200. package/lib/test/unit/socketServer.scopedEmit.spec.js +2 -0
  201. package/lib/test/unit/stream-start-pipelines.spec.js +210 -0
  202. package/lib/test/unit/stream-status-type.spec.js +4 -0
  203. package/lib/test/unit/vision-assertion.spec.js +118 -0
  204. package/lib/test/unit/wda-client-shell.spec.js +133 -0
  205. package/lib/test/unit/web-config-service.spec.js +79 -0
  206. package/lib/test/unit/webhook-delivery.spec.js +24 -0
  207. package/lib/test/unit/webhook-payloads.spec.js +273 -0
  208. package/lib/test/unit/xenon-execute-scripts.spec.js +138 -0
  209. package/lib/tsconfig.tsbuildinfo +1 -1
  210. package/lib/web/src/components/webhook-settings/webhookEventVariables.json +30 -0
  211. package/package.json +1 -1
  212. package/prisma/migrations/20261004140000_keep_device_settings/migration.sql +19 -0
  213. package/prisma/schema.prisma +35 -7
  214. package/schema.json +19 -46
  215. package/scripts/generate-types-from-schema.js +7 -2
  216. package/scripts/lib/always-present-plugin-args.js +42 -0
  217. package/lib/public/assets/DeviceMosaicView-ChhHnpFQ.js +0 -2
  218. package/lib/public/assets/device-explorer-DSpAA_t9.js +0 -279
  219. package/lib/public/assets/maintenance-settings-BxbA7SkB.js +0 -6
  220. package/lib/public/assets/recording-group-store-B75435xR.js +0 -26
  221. package/lib/public/assets/session-detail-page-Bc02YjMm.js +0 -4
  222. package/lib/public/assets/settings-C1VIluuT.js +0 -6
  223. package/lib/public/assets/webhook-settings-DAHgnJyZ.js +0 -1
@@ -1 +1 @@
1
- import{r as c,i as J,u as Q,b as X,t as ee,j as e,e as B,A as te,_ as ne}from"./index-BGBqohfQ.js";import{f as q,a as re,c as se,h as ae,i as Z,j as ie,k as oe,m as ce}from"./recordings-BWe1ydXm.js";import{P as le}from"./page-header-FXPlo6az.js";import{B as I}from"./button-Cq_zHETv.js";import{E as L}from"./EmptyState-CgzbuUvO.js";import{M as ue}from"./Modal-ChvVUI3B.js";import{P as de,M as fe,a as me}from"./Menu-C173JJ0l.js";import{A as ge}from"./AnnotationOverlay-Cvpkk4r9.js";import{t as O,v as pe,R as he,P as be,n as ye,c as U,o as ve,a as R,f as ke,p as xe,S as V,b as je,d as Me}from"./recordings-n-GTW3aT.js";import{A as we}from"./arrow-left-Dpog9L0F.js";import{T as Re}from"./trash-2-B54e-TfY.js";import{P as Se,a as Ne}from"./play-CWdk0_Sy.js";import{D as Ee}from"./download-DDBRXnAZ.js";import"./utils-CDN07tui.js";import"./index-BQ2luT7L.js";import"./check-C7xu-hGU.js";function Ce(n){const t=[{key:"zip",label:"All videos (zip)",url:re(n.groupId)}];return n.hasComposite&&t.push({key:"composite",label:"Side-by-side video",url:se(n.groupId)}),t.push({key:"bundle",label:"Proof bundle",url:ae(n.groupId)}),n.phones.filter(l=>l.status!=="FAILED"&&l.status!=="DISCARDED").forEach(l=>{t.push({key:`video-${l.recordingId}`,label:`${l.name}: video`,url:Z(n.groupId,l.recordingId,!0)}),l.annotationCount>0&&t.push({key:`annotated-${l.recordingId}`,label:`${l.name}: video with annotations`,url:ie(n.groupId,l.recordingId)})}),t}function Ie(n,t){return t?t.role==="ADMIN"||t.role==="SUPER_ADMIN"?!0:!!n.startedBy&&!!t.userId&&n.startedBy.id===t.userId:!1}function De(n){if(n instanceof q){if(n.code==="not_owner")return"Only the person who recorded it, or an admin, can delete it.";if(n.code==="recording_in_progress")return"It’s still recording. Stop it on Live devices first.";if(n.status===404)return"It was already deleted, or it’s on phones you can’t see."}return`Couldn’t delete the recording: ${n instanceof Error?n.message:String(n)}`}function Ae(n){const t=document.createElement("a");t.href=n,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t)}const Te={now:()=>performance.now(),schedule:n=>window.requestAnimationFrame(()=>n()),cancel:n=>window.cancelAnimationFrame(n)},Pe=100,_e=3,Fe=.05;function W(n){return n.ended||Number.isFinite(n.duration)&&n.currentTime>=n.duration-Fe}function Le(n,t=Te){const l=c.useRef(new Map),v=c.useRef(new Map),u=c.useRef(new Map),d=c.useRef({baseMs:0,since:null,running:!1,waiting:!1}),p=c.useRef(null),S=c.useRef(-1/0),k=c.useRef(n);k.current=n;const[D,w]=c.useState({timeMs:0,playing:!1,waiting:!1}),x=()=>d.current.since===null?d.current.baseMs:d.current.baseMs+(t.now()-d.current.since),h=(s,a)=>{l.current.forEach((i,M)=>{var _;const m=v.current.get(M);if(!m||i.error)return;const T=O(s,m.offsetMs,m.durationMs);let C=T==="before"?0:T==="after"?m.durationMs:pe(s,m.offsetMs);Number.isFinite(i.duration)&&(C=Math.min(C,i.duration*1e3));const $=d.current.running?he:be;ye(i.currentTime*1e3,C,$)&&(i.currentTime=C/1e3),a&&T==="playing"?i.paused&&!W(i)&&((_=i.play())==null||_.catch(()=>{})):i.paused||i.pause()})},j=s=>Array.from(l.current.entries()).some(([a,i])=>{const M=v.current.get(a);return!!M&&!i.error&&!W(i)&&O(s,M.offsetMs,M.durationMs)==="playing"&&i.readyState<_e}),g=s=>{const a=t.now();!s&&a-S.current<Pe||(S.current=a,w({timeMs:x(),playing:d.current.running,waiting:d.current.waiting}))},b=()=>{p.current!==null&&t.cancel(p.current),p.current=null},A=()=>{p.current=null;const s=d.current;if(!s.running)return;const a=x();if(a>=k.current){Object.assign(s,{baseMs:k.current,since:null,running:!1,waiting:!1}),h(k.current,!1),g(!0);return}const i=j(a);i!==s.waiting?(s.baseMs=a,s.since=i?null:t.now(),s.waiting=i,h(a,!i),g(!0)):(h(a,!i),g(!1)),p.current=t.schedule(A)},N=()=>{const s=d.current;x()>=k.current?s.baseMs=0:s.baseMs=x(),Object.assign(s,{since:t.now(),running:!0,waiting:!1}),h(s.baseMs,!0),g(!0),b(),p.current=t.schedule(A)},y=()=>{const s=d.current;Object.assign(s,{baseMs:x(),since:null,running:!1,waiting:!1}),b(),h(s.baseMs,!1),g(!0)},f=s=>{const a=d.current,i=U(s,k.current);a.baseMs=i,a.since=a.running&&!a.waiting?t.now():null,h(i,a.running&&!a.waiting),g(!0)},P=c.useCallback((s,a)=>{v.current.set(s,a);let i=u.current.get(s);return i||(i=M=>{if(M){l.current.set(s,M);const m=d.current;h(x(),m.running&&!m.waiting)}else l.current.delete(s)},u.current.set(s,i)),i},[]);return c.useEffect(()=>b,[]),{...D,play:N,pause:y,toggle:()=>d.current.running?y():N(),seek:f,bind:P}}const $e=()=>{},Y="Stop the recording on Live devices first.",Be=1e3;function Oe(n){const t=n;return!t||!t.closest?!1:!!t.closest('input:not([type="range"]):not([type="checkbox"]), select, textarea, [contenteditable="true"], [role="dialog"], [role="menu"]')}function Ue({groupId:n,phone:t,timeMs:l,marks:v,showMarks:u,bind:d}){const[p,S]=c.useState(!1),[k,D]=c.useState(void 0),w=t.status==="FAILED"||t.status==="DISCARDED",x=O(l,t.offsetMs,t.durationMs),h=je(v,l).map(Me).filter(g=>g!==null);let j=null;return w?j=`Recording failed: ${t.failReason??"unknown reason"}`:p?j="Video no longer available":x==="before"&&t.offsetMs>=Be&&(j=`Starts at ${R(t.offsetMs)}`),e.jsxs("figure",{className:"rec-tile theme-dark","aria-label":t.name,children:[e.jsx("figcaption",{className:"rec-tile-name",title:t.name,children:t.name}),e.jsxs("div",{className:"rec-tile-screen",children:[!w&&e.jsx("video",{className:"rec-tile-video",muted:!0,playsInline:!0,preload:"auto",src:Z(n,t.recordingId),ref:d(t.recordingId,{offsetMs:t.offsetMs,durationMs:t.durationMs}),onError:()=>S(!0),onLoadedMetadata:g=>{const b=g.currentTarget;b.videoWidth>0&&b.videoHeight>0&&D(b.videoWidth/b.videoHeight)}}),!w&&u&&e.jsx(ge,{enabled:!1,shape:"RECT",color:"currentColor",onCommit:$e,committed:h,mediaAspect:k}),j&&e.jsx("div",{className:"rec-tile-note",children:j})]})]})}function ze({detail:n}){const[t,l]=c.useState(!1),v=c.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsxs(I,{ref:v,variant:"secondary","aria-haspopup":"menu","aria-expanded":t,onClick:()=>l(u=>!u),children:[e.jsx(Ee,{size:14,"aria-hidden":"true"}),"Download"]}),e.jsx(de,{open:t,onClose:()=>l(!1),anchorRef:v,children:e.jsx(fe,{children:Ce(n.summary).map(u=>e.jsx(me,{onClick:()=>{l(!1),Ae(u.url)},children:u.label},u.key))})})]})}function at(){var K;const{groupId:n=""}=J(),t=Q(),{me:l}=X(),{toast:v}=ee(),[u,d]=c.useState(null),[p,S]=c.useState(null),[k,D]=c.useState(0),[w,x]=c.useState(!0),[h,j]=c.useState(!1),[g,b]=c.useState(!1),[A,N]=c.useState(null);c.useEffect(()=>{let r=!0;return S(null),d(null),oe(n).then(o=>r&&d(ve(o))).catch(o=>{r&&S({missing:o instanceof q&&o.status===404,message:o instanceof Error?o.message:String(o)})}),()=>{r=!1}},[n,k]);const y=(u==null?void 0:u.summary.durationMs)??0,f=Le(y),P=c.useRef(f);P.current=f;const s=c.useRef(!0);if(c.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]),c.useEffect(()=>{if(!u||u.summary.status==="recording")return;const r=o=>{var F,H;if(o.metaKey||o.ctrlKey||o.altKey||Oe(o.target)||o.key===" "&&((H=(F=o.target)==null?void 0:F.closest)!=null&&H.call(F,"button, a, label")))return;if(o.key===" "&&o.repeat){o.preventDefault();return}const E=P.current;o.key===" "?(o.preventDefault(),E.toggle()):o.key==="ArrowRight"?(o.preventDefault(),E.seek(U(E.timeMs+V,y))):o.key==="ArrowLeft"&&(o.preventDefault(),E.seek(U(E.timeMs-V,y)))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[u,y]),p)return p.missing?e.jsx(L,{title:"This recording isn't available",description:"It may have been deleted, or it's on phones you can't see.",action:e.jsx(B,{className:"rec-link",to:"/recordings",children:"Back to Recordings"})}):e.jsx(L,{title:"Couldn't load this recording",description:p.message,action:e.jsxs(I,{variant:"secondary",onClick:()=>D(r=>r+1),children:[e.jsx(te,{size:14,"aria-hidden":"true"}),"Retry"]})});if(!u)return e.jsx(L,{title:"Loading recording…"});const{summary:a,bookmarks:i,annotations:M}=u,m=a.status==="recording",T=a.phones.map(r=>r.name).join(", "),C=r=>{var o;return((o=a.phones.find(E=>E.recordingId===r))==null?void 0:o.name)??""},$=[T,a.durationMs===null?null:`Length ${R(a.durationMs)}`,`Recorded by ${((K=a.startedBy)==null?void 0:K.name)??"Unknown"}`].filter(Boolean).join(" · "),_=Ie(a,l),z=()=>{j(!1),N(null)},G=async()=>{b(!0),N(null);try{await ce(n)}catch(r){s.current&&(b(!1),N(De(r)));return}v("Recording deleted","success"),s.current&&t("/recordings")};return e.jsxs("div",{className:"rec-page",children:[e.jsx("nav",{className:"rec-backbar",children:e.jsxs(B,{className:"rec-link",to:"/recordings",children:[e.jsx(we,{size:14,"aria-hidden":"true"})," Recordings"]})}),e.jsx(le,{icon:ne,title:ke(a.startedAt),subtitle:$,action:e.jsxs(e.Fragment,{children:[!m&&a.status!=="failed"&&e.jsx(ze,{detail:u}),_&&e.jsxs(e.Fragment,{children:[e.jsxs(I,{variant:"danger",disabled:m,"aria-describedby":m?"rec-delete-reason":void 0,title:m?Y:void 0,onClick:()=>{N(null),j(!0)},children:[e.jsx(Re,{size:14,"aria-hidden":"true"}),"Delete"]}),m&&e.jsx("span",{id:"rec-delete-reason",className:"sr-only",children:Y})]})]})}),m?e.jsx(L,{title:"Still recording",description:"Stop it on Live devices to play it here.",action:e.jsx(B,{className:"rec-link",to:"/devices/live",children:"Open Live devices"})}):e.jsxs("div",{className:`rec-body${i.length>0?" rec-body--with-list":""}`,children:[e.jsxs("div",{className:"rec-player",children:[e.jsx("div",{className:"rec-grid",children:a.phones.map(r=>e.jsx(Ue,{groupId:n,phone:r,timeMs:f.timeMs,marks:M.filter(o=>o.recordingId===r.recordingId),showMarks:w,bind:f.bind},r.recordingId))}),e.jsxs("div",{className:"rec-transport",children:[e.jsx(I,{variant:"secondary",size:"icon","aria-label":f.playing?"Pause":"Play",onClick:f.toggle,children:f.playing?e.jsx(Se,{size:14,"aria-hidden":"true"}):e.jsx(Ne,{size:14,"aria-hidden":"true"})}),e.jsxs("span",{className:"rec-num rec-clock",children:[R(f.timeMs)," / ",R(y)]}),e.jsxs("div",{className:"rec-timeline",children:[e.jsx("input",{type:"range",className:"rec-range","aria-label":"Timeline","aria-valuetext":`${R(f.timeMs)} of ${R(y)}`,min:0,max:y,step:100,value:f.timeMs,onChange:r=>f.seek(Number(r.target.value))}),i.map(r=>e.jsx("button",{type:"button",className:"rec-mark",style:{left:`${xe(r.timecodeMs,y)}%`},title:r.label,"aria-label":`Bookmark: ${r.label}, ${R(r.timecodeMs)}`,onClick:()=>f.seek(r.timecodeMs)},r.id))]}),e.jsx("span",{role:"status",className:"rec-waiting",children:f.waiting?"Buffering…":""}),a.annotationCount>0&&e.jsxs("label",{className:"rec-toggle",children:[e.jsx("input",{type:"checkbox",checked:w,onChange:r=>x(r.target.checked)}),"Annotations"]})]})]}),i.length>0&&e.jsxs("section",{className:"rec-bookmarks","aria-labelledby":"rec-bookmarks-title",children:[e.jsx("h2",{id:"rec-bookmarks-title",className:"rec-bookmarks-title",children:"Bookmarks"}),e.jsx("ol",{className:"rec-bookmark-list",children:i.map(r=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"rec-bookmark",onClick:()=>f.seek(r.timecodeMs),children:[e.jsx("span",{className:"rec-bookmark-label",children:r.label}),e.jsxs("span",{className:"rec-num rec-bookmark-meta",children:[R(r.timecodeMs)," · ",C(r.recordingId)]})]})},r.id))})]})]}),e.jsxs(ue,{open:h,title:"Delete this recording?",onClose:()=>{g||z()},footer:e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"secondary",onClick:z,disabled:g,children:"Cancel"}),e.jsx(I,{variant:"danger",onClick:G,disabled:g,children:"Delete"})]}),children:[e.jsx("p",{children:"Its videos, bookmarks and annotations are removed for everyone."}),A&&e.jsx("p",{role:"alert",className:"rec-error",children:A})]})]})}export{at as default};
1
+ import{r as c,i as J,u as Q,b as X,t as ee,j as e,e as B,A as te,$ as ne}from"./index-BbKEXUFH.js";import{f as q,a as re,c as se,h as ae,i as Z,j as ie,k as oe,m as ce}from"./recordings-BWe1ydXm.js";import{P as le}from"./page-header-BjzgWz-T.js";import{B as I}from"./button-Dda4irn_.js";import{E as F}from"./EmptyState-BSjhk_IV.js";import{M as ue}from"./Modal-CFCp3n9d.js";import{P as de,M as fe,a as me}from"./Menu-JGGYrSQQ.js";import{A as ge}from"./AnnotationOverlay-B_VNtKBH.js";import{t as O,v as pe,R as he,P as be,n as ye,c as U,o as ve,a as R,f as ke,p as xe,S as V,b as je,d as Me}from"./recordings-n-GTW3aT.js";import{A as we}from"./arrow-left-MMbTmgoE.js";import{T as Re}from"./trash-2-C5RSuX0e.js";import{P as Se,a as Ne}from"./play-DLG9t8FU.js";import{D as Ee}from"./download-C9XG6lLv.js";import"./utils-CDN07tui.js";import"./index-DJGc1M2f.js";import"./check-CZ9iw9-e.js";function Ce(n){const t=[{key:"zip",label:"All videos (zip)",url:re(n.groupId)}];return n.hasComposite&&t.push({key:"composite",label:"Side-by-side video",url:se(n.groupId)}),t.push({key:"bundle",label:"Proof bundle",url:ae(n.groupId)}),n.phones.filter(l=>l.status!=="FAILED"&&l.status!=="DISCARDED").forEach(l=>{t.push({key:`video-${l.recordingId}`,label:`${l.name}: video`,url:Z(n.groupId,l.recordingId,!0)}),l.annotationCount>0&&t.push({key:`annotated-${l.recordingId}`,label:`${l.name}: video with annotations`,url:ie(n.groupId,l.recordingId)})}),t}function Ie(n,t){return t?t.role==="ADMIN"||t.role==="SUPER_ADMIN"?!0:!!n.startedBy&&!!t.userId&&n.startedBy.id===t.userId:!1}function De(n){if(n instanceof q){if(n.code==="not_owner")return"Only the person who recorded it, or an admin, can delete it.";if(n.code==="recording_in_progress")return"It’s still recording. Stop it on Live devices first.";if(n.status===404)return"It was already deleted, or it’s on phones you can’t see."}return`Couldn’t delete the recording: ${n instanceof Error?n.message:String(n)}`}function Ae(n){const t=document.createElement("a");t.href=n,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t)}const Te={now:()=>performance.now(),schedule:n=>window.requestAnimationFrame(()=>n()),cancel:n=>window.cancelAnimationFrame(n)},Pe=100,_e=3,$e=.05;function W(n){return n.ended||Number.isFinite(n.duration)&&n.currentTime>=n.duration-$e}function Fe(n,t=Te){const l=c.useRef(new Map),v=c.useRef(new Map),u=c.useRef(new Map),d=c.useRef({baseMs:0,since:null,running:!1,waiting:!1}),p=c.useRef(null),S=c.useRef(-1/0),k=c.useRef(n);k.current=n;const[D,w]=c.useState({timeMs:0,playing:!1,waiting:!1}),x=()=>d.current.since===null?d.current.baseMs:d.current.baseMs+(t.now()-d.current.since),h=(s,a)=>{l.current.forEach((i,M)=>{var _;const m=v.current.get(M);if(!m||i.error)return;const T=O(s,m.offsetMs,m.durationMs);let C=T==="before"?0:T==="after"?m.durationMs:pe(s,m.offsetMs);Number.isFinite(i.duration)&&(C=Math.min(C,i.duration*1e3));const L=d.current.running?he:be;ye(i.currentTime*1e3,C,L)&&(i.currentTime=C/1e3),a&&T==="playing"?i.paused&&!W(i)&&((_=i.play())==null||_.catch(()=>{})):i.paused||i.pause()})},j=s=>Array.from(l.current.entries()).some(([a,i])=>{const M=v.current.get(a);return!!M&&!i.error&&!W(i)&&O(s,M.offsetMs,M.durationMs)==="playing"&&i.readyState<_e}),g=s=>{const a=t.now();!s&&a-S.current<Pe||(S.current=a,w({timeMs:x(),playing:d.current.running,waiting:d.current.waiting}))},b=()=>{p.current!==null&&t.cancel(p.current),p.current=null},A=()=>{p.current=null;const s=d.current;if(!s.running)return;const a=x();if(a>=k.current){Object.assign(s,{baseMs:k.current,since:null,running:!1,waiting:!1}),h(k.current,!1),g(!0);return}const i=j(a);i!==s.waiting?(s.baseMs=a,s.since=i?null:t.now(),s.waiting=i,h(a,!i),g(!0)):(h(a,!i),g(!1)),p.current=t.schedule(A)},N=()=>{const s=d.current;x()>=k.current?s.baseMs=0:s.baseMs=x(),Object.assign(s,{since:t.now(),running:!0,waiting:!1}),h(s.baseMs,!0),g(!0),b(),p.current=t.schedule(A)},y=()=>{const s=d.current;Object.assign(s,{baseMs:x(),since:null,running:!1,waiting:!1}),b(),h(s.baseMs,!1),g(!0)},f=s=>{const a=d.current,i=U(s,k.current);a.baseMs=i,a.since=a.running&&!a.waiting?t.now():null,h(i,a.running&&!a.waiting),g(!0)},P=c.useCallback((s,a)=>{v.current.set(s,a);let i=u.current.get(s);return i||(i=M=>{if(M){l.current.set(s,M);const m=d.current;h(x(),m.running&&!m.waiting)}else l.current.delete(s)},u.current.set(s,i)),i},[]);return c.useEffect(()=>b,[]),{...D,play:N,pause:y,toggle:()=>d.current.running?y():N(),seek:f,bind:P}}const Le=()=>{},Y="Stop the recording on Live devices first.",Be=1e3;function Oe(n){const t=n;return!t||!t.closest?!1:!!t.closest('input:not([type="range"]):not([type="checkbox"]), select, textarea, [contenteditable="true"], [role="dialog"], [role="menu"]')}function Ue({groupId:n,phone:t,timeMs:l,marks:v,showMarks:u,bind:d}){const[p,S]=c.useState(!1),[k,D]=c.useState(void 0),w=t.status==="FAILED"||t.status==="DISCARDED",x=O(l,t.offsetMs,t.durationMs),h=je(v,l).map(Me).filter(g=>g!==null);let j=null;return w?j=`Recording failed: ${t.failReason??"unknown reason"}`:p?j="Video no longer available":x==="before"&&t.offsetMs>=Be&&(j=`Starts at ${R(t.offsetMs)}`),e.jsxs("figure",{className:"rec-tile theme-dark","aria-label":t.name,children:[e.jsx("figcaption",{className:"rec-tile-name",title:t.name,children:t.name}),e.jsxs("div",{className:"rec-tile-screen",children:[!w&&e.jsx("video",{className:"rec-tile-video",muted:!0,playsInline:!0,preload:"auto",src:Z(n,t.recordingId),ref:d(t.recordingId,{offsetMs:t.offsetMs,durationMs:t.durationMs}),onError:()=>S(!0),onLoadedMetadata:g=>{const b=g.currentTarget;b.videoWidth>0&&b.videoHeight>0&&D(b.videoWidth/b.videoHeight)}}),!w&&u&&e.jsx(ge,{enabled:!1,shape:"RECT",color:"currentColor",onCommit:Le,committed:h,mediaAspect:k}),j&&e.jsx("div",{className:"rec-tile-note",children:j})]})]})}function ze({detail:n}){const[t,l]=c.useState(!1),v=c.useRef(null);return e.jsxs(e.Fragment,{children:[e.jsxs(I,{ref:v,variant:"secondary","aria-haspopup":"menu","aria-expanded":t,onClick:()=>l(u=>!u),children:[e.jsx(Ee,{size:14,"aria-hidden":"true"}),"Download"]}),e.jsx(de,{open:t,onClose:()=>l(!1),anchorRef:v,children:e.jsx(fe,{children:Ce(n.summary).map(u=>e.jsx(me,{onClick:()=>{l(!1),Ae(u.url)},children:u.label},u.key))})})]})}function at(){var K;const{groupId:n=""}=J(),t=Q(),{me:l}=X(),{toast:v}=ee(),[u,d]=c.useState(null),[p,S]=c.useState(null),[k,D]=c.useState(0),[w,x]=c.useState(!0),[h,j]=c.useState(!1),[g,b]=c.useState(!1),[A,N]=c.useState(null);c.useEffect(()=>{let r=!0;return S(null),d(null),oe(n).then(o=>r&&d(ve(o))).catch(o=>{r&&S({missing:o instanceof q&&o.status===404,message:o instanceof Error?o.message:String(o)})}),()=>{r=!1}},[n,k]);const y=(u==null?void 0:u.summary.durationMs)??0,f=Fe(y),P=c.useRef(f);P.current=f;const s=c.useRef(!0);if(c.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[]),c.useEffect(()=>{if(!u||u.summary.status==="recording")return;const r=o=>{var $,H;if(o.metaKey||o.ctrlKey||o.altKey||Oe(o.target)||o.key===" "&&((H=($=o.target)==null?void 0:$.closest)!=null&&H.call($,"button, a, label")))return;if(o.key===" "&&o.repeat){o.preventDefault();return}const E=P.current;o.key===" "?(o.preventDefault(),E.toggle()):o.key==="ArrowRight"?(o.preventDefault(),E.seek(U(E.timeMs+V,y))):o.key==="ArrowLeft"&&(o.preventDefault(),E.seek(U(E.timeMs-V,y)))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[u,y]),p)return p.missing?e.jsx(F,{title:"This recording isn't available",description:"It may have been deleted, or it's on phones you can't see.",action:e.jsx(B,{className:"rec-link",to:"/recordings",children:"Back to Recordings"})}):e.jsx(F,{title:"Couldn't load this recording",description:p.message,action:e.jsxs(I,{variant:"secondary",onClick:()=>D(r=>r+1),children:[e.jsx(te,{size:14,"aria-hidden":"true"}),"Retry"]})});if(!u)return e.jsx(F,{title:"Loading recording…"});const{summary:a,bookmarks:i,annotations:M}=u,m=a.status==="recording",T=a.phones.map(r=>r.name).join(", "),C=r=>{var o;return((o=a.phones.find(E=>E.recordingId===r))==null?void 0:o.name)??""},L=[T,a.durationMs===null?null:`Length ${R(a.durationMs)}`,`Recorded by ${((K=a.startedBy)==null?void 0:K.name)??"Unknown"}`].filter(Boolean).join(" · "),_=Ie(a,l),z=()=>{j(!1),N(null)},G=async()=>{b(!0),N(null);try{await ce(n)}catch(r){s.current&&(b(!1),N(De(r)));return}v("Recording deleted","success"),s.current&&t("/recordings")};return e.jsxs("div",{className:"rec-page",children:[e.jsx("nav",{className:"rec-backbar",children:e.jsxs(B,{className:"rec-link",to:"/recordings",children:[e.jsx(we,{size:14,"aria-hidden":"true"})," Recordings"]})}),e.jsx(le,{icon:ne,title:ke(a.startedAt),subtitle:L,action:e.jsxs(e.Fragment,{children:[!m&&a.status!=="failed"&&e.jsx(ze,{detail:u}),_&&e.jsxs(e.Fragment,{children:[e.jsxs(I,{variant:"danger",disabled:m,"aria-describedby":m?"rec-delete-reason":void 0,title:m?Y:void 0,onClick:()=>{N(null),j(!0)},children:[e.jsx(Re,{size:14,"aria-hidden":"true"}),"Delete"]}),m&&e.jsx("span",{id:"rec-delete-reason",className:"sr-only",children:Y})]})]})}),m?e.jsx(F,{title:"Still recording",description:"Stop it on Live devices to play it here.",action:e.jsx(B,{className:"rec-link",to:"/devices/live",children:"Open Live devices"})}):e.jsxs("div",{className:`rec-body${i.length>0?" rec-body--with-list":""}`,children:[e.jsxs("div",{className:"rec-player",children:[e.jsx("div",{className:"rec-grid",children:a.phones.map(r=>e.jsx(Ue,{groupId:n,phone:r,timeMs:f.timeMs,marks:M.filter(o=>o.recordingId===r.recordingId),showMarks:w,bind:f.bind},r.recordingId))}),e.jsxs("div",{className:"rec-transport",children:[e.jsx(I,{variant:"secondary",size:"icon","aria-label":f.playing?"Pause":"Play",onClick:f.toggle,children:f.playing?e.jsx(Se,{size:14,"aria-hidden":"true"}):e.jsx(Ne,{size:14,"aria-hidden":"true"})}),e.jsxs("span",{className:"rec-num rec-clock",children:[R(f.timeMs)," / ",R(y)]}),e.jsxs("div",{className:"rec-timeline",children:[e.jsx("input",{type:"range",className:"rec-range","aria-label":"Timeline","aria-valuetext":`${R(f.timeMs)} of ${R(y)}`,min:0,max:y,step:100,value:f.timeMs,onChange:r=>f.seek(Number(r.target.value))}),i.map(r=>e.jsx("button",{type:"button",className:"rec-mark",style:{left:`${xe(r.timecodeMs,y)}%`},title:r.label,"aria-label":`Bookmark: ${r.label}, ${R(r.timecodeMs)}`,onClick:()=>f.seek(r.timecodeMs)},r.id))]}),e.jsx("span",{role:"status",className:"rec-waiting",children:f.waiting?"Buffering…":""}),a.annotationCount>0&&e.jsxs("label",{className:"rec-toggle",children:[e.jsx("input",{type:"checkbox",checked:w,onChange:r=>x(r.target.checked)}),"Annotations"]})]})]}),i.length>0&&e.jsxs("section",{className:"rec-bookmarks","aria-labelledby":"rec-bookmarks-title",children:[e.jsx("h2",{id:"rec-bookmarks-title",className:"rec-bookmarks-title",children:"Bookmarks"}),e.jsx("ol",{className:"rec-bookmark-list",children:i.map(r=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:"rec-bookmark",onClick:()=>f.seek(r.timecodeMs),children:[e.jsx("span",{className:"rec-bookmark-label",children:r.label}),e.jsxs("span",{className:"rec-num rec-bookmark-meta",children:[R(r.timecodeMs)," · ",C(r.recordingId)]})]})},r.id))})]})]}),e.jsxs(ue,{open:h,title:"Delete this recording?",onClose:()=>{g||z()},footer:e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"secondary",onClick:z,disabled:g,children:"Cancel"}),e.jsx(I,{variant:"danger",onClick:G,disabled:g,children:"Delete"})]}),children:[e.jsx("p",{children:"Its videos, bookmarks and annotations are removed for everyone."}),A&&e.jsx("p",{role:"alert",className:"rec-error",children:A})]})]})}export{at as default};
@@ -1,2 +1,2 @@
1
- import{u as V,G,r as l,j as n,_ as Y,A as z,e as q}from"./index-BGBqohfQ.js";import{P as Q}from"./page-header-FXPlo6az.js";import{T as Z,a as J,b as T,c as h,d as X,e as m}from"./Table-B1DB_ZN-.js";import{B as v}from"./button-Cq_zHETv.js";import{E as y}from"./EmptyState-CgzbuUvO.js";import{I as ee}from"./input-BvB1cjHE.js";import{F as f}from"./FilterMenu-D7OMGuRc.js";import{l as A}from"./recordings-BWe1ydXm.js";import{f as ne,a as te}from"./recordings-n-GTW3aT.js";import"./utils-CDN07tui.js";import"./Menu-C173JJ0l.js";import"./index-BQ2luT7L.js";import"./check-C7xu-hGU.js";import"./plus-B2xCnntV.js";const re={phone:"",by:"",when:"any",q:""},oe=["any","24h","7d","30d"],R=864e5,se={"24h":R,"7d":7*R,"30d":30*R},ae={any:"Any time","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days"};function ce(t){const r=t.get("when");return{phone:t.get("phone")??"",by:t.get("by")??"",when:r&&oe.includes(r)?r:"any",q:t.get("q")??""}}function F(t){const r=new URLSearchParams;return t.phone&&r.set("phone",t.phone),t.by&&r.set("by",t.by),t.when!=="any"&&r.set("when",t.when),t.q.trim()&&r.set("q",t.q),r}function ie(t){return!!(t.phone||t.by||t.when!=="any"||t.q.trim())}function P(t,r){return{udid:t.phone||void 0,startedBy:t.by||void 0,since:t.when==="any"?void 0:new Date(r-se[t.when]).toISOString(),q:t.q.trim()||void 0}}const B=50,le=250;function de(t){const r=t.phones.map(g=>g.name);return{text:r.length>2?`${r.slice(0,2).join(", ")} +${r.length-2}`:r.join(", "),title:r.join(`
2
- `)}}const ue=t=>t.status==="recording"?"/devices/live":`/recordings/${encodeURIComponent(t.groupId)}`;function Ne(){const t=V(),[r,g]=G(),a=ce(r),x=F(a).toString(),[s,S]=l.useState(null),[I,D]=l.useState(null),[j,C]=l.useState([]),[N,w]=l.useState(null),[M,k]=l.useState(!1),[_,H]=l.useState(0),u=l.useRef(0),d=l.useRef(!0),p=e=>g(F(e),{replace:!0});l.useEffect(()=>{d.current=!0;const e=++u.current,c=window.setTimeout(()=>{A({...P(a,Date.now()),limit:B}).then(i=>{!d.current||e!==u.current||(S(i),C(i.recordings),w(null),D(x))}).catch(i=>{!d.current||e!==u.current||w(i instanceof Error?i.message:String(i))})},le);return()=>{window.clearTimeout(c),d.current=!1}},[x,_]);const b=I===x?(s==null?void 0:s.nextCursor)??null:null,O=async()=>{if(!b)return;const e=u.current;k(!0);try{const c=await A({...P(a,Date.now()),limit:B,cursor:b});if(!d.current||e!==u.current)return;S(c),C(i=>i.concat(c.recordings))}catch(c){if(!d.current||e!==u.current)return;w(c instanceof Error?c.message:String(c))}finally{d.current&&k(!1)}},o=s==null?void 0:s.facets,W=[{value:"",label:"Any phone",count:(o==null?void 0:o.when.any)??0},...((o==null?void 0:o.phones)??[]).map(e=>({value:e.udid,label:e.name,count:e.count}))],K=[{value:"",label:"Anyone",count:(o==null?void 0:o.when.any)??0},...((o==null?void 0:o.people)??[]).map(e=>({value:e.id,label:e.name,count:e.count})),...o&&o.unknownCount>0?[{value:"unknown",label:"Unknown",count:o.unknownCount}]:[]],U=["any","24h","7d","30d"].map(e=>({value:e,label:ae[e],count:(o==null?void 0:o.when[e])??0})),E=(s==null?void 0:s.total)??0;return n.jsxs("div",{className:"rec-page",children:[n.jsx(Q,{icon:Y,title:"Recordings",subtitle:s?`${E} recording${E===1?"":"s"}`:void 0}),n.jsxs("div",{className:"rec-toolbar",children:[n.jsx(ee,{type:"text",className:"rec-search","aria-label":"Search recordings",placeholder:"Search phones and bookmarks",value:a.q,onChange:e=>p({...a,q:e.target.value})}),n.jsx(f,{name:"Phone",value:a.phone,anyValue:"",options:W,onChange:e=>p({...a,phone:e})}),n.jsx(f,{name:"Recorded by",value:a.by,anyValue:"",options:K,onChange:e=>p({...a,by:e})}),n.jsx(f,{name:"When",value:a.when,anyValue:"any",options:U,onChange:e=>p({...a,when:e})})]}),N?n.jsx(y,{title:"Couldn't load recordings",description:N,action:n.jsxs(v,{variant:"secondary",onClick:()=>H(e=>e+1),children:[n.jsx(z,{size:14,"aria-hidden":"true"}),"Retry"]})}):s?j.length===0?ie(a)?n.jsx(y,{title:"No recordings match",action:n.jsx(v,{variant:"secondary",onClick:()=>p(re),children:"Clear filters"})}):n.jsx(y,{title:"No recordings yet",description:"Record phones from Live devices.",action:n.jsx(q,{className:"rec-link",to:"/devices/live",children:"Open Live devices"})}):n.jsxs(n.Fragment,{children:[n.jsxs(Z,{className:"rec-table",children:[n.jsxs("caption",{className:"sr-only",children:["Recordings, ",j.length," shown"]}),n.jsx(J,{children:n.jsxs(T,{children:[n.jsx(h,{scope:"col",children:"When"}),n.jsx(h,{scope:"col",children:"Phones"}),n.jsx(h,{scope:"col",children:"Length"}),n.jsx(h,{scope:"col",children:"Recorded by"}),n.jsx(h,{scope:"col",children:"Bookmarks"}),n.jsx(h,{scope:"col",children:"Status"})]})}),n.jsx(X,{children:j.map(e=>{var L;const c=de(e),i=ue(e);return n.jsxs(T,{className:"rec-row",onClick:$=>{$.target.closest("a")||t(i)},children:[n.jsx(m,{children:n.jsx(q,{to:i,className:"rec-link",children:ne(e.startedAt)})}),n.jsx(m,{title:c.title,children:c.text}),n.jsx(m,{className:"rec-num",children:e.durationMs===null?"—":te(e.durationMs)}),n.jsx(m,{children:((L=e.startedBy)==null?void 0:L.name)??"Unknown"}),n.jsx(m,{className:"rec-num",children:e.bookmarkCount}),n.jsx(m,{children:e.status==="recording"?"Recording…":e.status==="failed"?"Failed":""})]},e.groupId)})})]}),b&&n.jsx("div",{className:"rec-more",children:n.jsx(v,{variant:"secondary",onClick:O,disabled:M,children:"Load more"})})]}):n.jsx(y,{title:"Loading recordings…"}),s&&n.jsxs("p",{className:"rec-footnote",children:["Recordings are kept for ",s.retention.days," days, up to the newest"," ",s.retention.maxCount,"."]})]})}export{Ne as default,de as phoneNames};
1
+ import{u as V,H as Y,r as l,j as n,$ as z,A as G,e as q}from"./index-BbKEXUFH.js";import{P as Q}from"./page-header-BjzgWz-T.js";import{T as Z,a as J,b as T,c as h,d as X,e as m}from"./Table-BcTm5xV2.js";import{B as v}from"./button-Dda4irn_.js";import{E as y}from"./EmptyState-BSjhk_IV.js";import{I as ee}from"./input-Cm0tmSoc.js";import{F as f}from"./FilterMenu-BAaSlWbW.js";import{l as A}from"./recordings-BWe1ydXm.js";import{f as ne,a as te}from"./recordings-n-GTW3aT.js";import"./utils-CDN07tui.js";import"./Menu-JGGYrSQQ.js";import"./index-DJGc1M2f.js";import"./check-CZ9iw9-e.js";import"./plus-nBFSMu_X.js";const re={phone:"",by:"",when:"any",q:""},oe=["any","24h","7d","30d"],R=864e5,se={"24h":R,"7d":7*R,"30d":30*R},ae={any:"Any time","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days"};function ce(t){const r=t.get("when");return{phone:t.get("phone")??"",by:t.get("by")??"",when:r&&oe.includes(r)?r:"any",q:t.get("q")??""}}function F(t){const r=new URLSearchParams;return t.phone&&r.set("phone",t.phone),t.by&&r.set("by",t.by),t.when!=="any"&&r.set("when",t.when),t.q.trim()&&r.set("q",t.q),r}function ie(t){return!!(t.phone||t.by||t.when!=="any"||t.q.trim())}function P(t,r){return{udid:t.phone||void 0,startedBy:t.by||void 0,since:t.when==="any"?void 0:new Date(r-se[t.when]).toISOString(),q:t.q.trim()||void 0}}const B=50,le=250;function de(t){const r=t.phones.map(g=>g.name);return{text:r.length>2?`${r.slice(0,2).join(", ")} +${r.length-2}`:r.join(", "),title:r.join(`
2
+ `)}}const ue=t=>t.status==="recording"?"/devices/live":`/recordings/${encodeURIComponent(t.groupId)}`;function Ne(){const t=V(),[r,g]=Y(),a=ce(r),x=F(a).toString(),[s,S]=l.useState(null),[I,D]=l.useState(null),[j,C]=l.useState([]),[N,w]=l.useState(null),[H,k]=l.useState(!1),[M,O]=l.useState(0),u=l.useRef(0),d=l.useRef(!0),p=e=>g(F(e),{replace:!0});l.useEffect(()=>{d.current=!0;const e=++u.current,c=window.setTimeout(()=>{A({...P(a,Date.now()),limit:B}).then(i=>{!d.current||e!==u.current||(S(i),C(i.recordings),w(null),D(x))}).catch(i=>{!d.current||e!==u.current||w(i instanceof Error?i.message:String(i))})},le);return()=>{window.clearTimeout(c),d.current=!1}},[x,M]);const b=I===x?(s==null?void 0:s.nextCursor)??null:null,_=async()=>{if(!b)return;const e=u.current;k(!0);try{const c=await A({...P(a,Date.now()),limit:B,cursor:b});if(!d.current||e!==u.current)return;S(c),C(i=>i.concat(c.recordings))}catch(c){if(!d.current||e!==u.current)return;w(c instanceof Error?c.message:String(c))}finally{d.current&&k(!1)}},o=s==null?void 0:s.facets,W=[{value:"",label:"Any phone",count:(o==null?void 0:o.when.any)??0},...((o==null?void 0:o.phones)??[]).map(e=>({value:e.udid,label:e.name,count:e.count}))],$=[{value:"",label:"Anyone",count:(o==null?void 0:o.when.any)??0},...((o==null?void 0:o.people)??[]).map(e=>({value:e.id,label:e.name,count:e.count})),...o&&o.unknownCount>0?[{value:"unknown",label:"Unknown",count:o.unknownCount}]:[]],K=["any","24h","7d","30d"].map(e=>({value:e,label:ae[e],count:(o==null?void 0:o.when[e])??0})),E=(s==null?void 0:s.total)??0;return n.jsxs("div",{className:"rec-page",children:[n.jsx(Q,{icon:z,title:"Recordings",subtitle:s?`${E} recording${E===1?"":"s"}`:void 0}),n.jsxs("div",{className:"rec-toolbar",children:[n.jsx(ee,{type:"text",className:"rec-search","aria-label":"Search recordings",placeholder:"Search phones and bookmarks",value:a.q,onChange:e=>p({...a,q:e.target.value})}),n.jsx(f,{name:"Phone",value:a.phone,anyValue:"",options:W,onChange:e=>p({...a,phone:e})}),n.jsx(f,{name:"Recorded by",value:a.by,anyValue:"",options:$,onChange:e=>p({...a,by:e})}),n.jsx(f,{name:"When",value:a.when,anyValue:"any",options:K,onChange:e=>p({...a,when:e})})]}),N?n.jsx(y,{title:"Couldn't load recordings",description:N,action:n.jsxs(v,{variant:"secondary",onClick:()=>O(e=>e+1),children:[n.jsx(G,{size:14,"aria-hidden":"true"}),"Retry"]})}):s?j.length===0?ie(a)?n.jsx(y,{title:"No recordings match",action:n.jsx(v,{variant:"secondary",onClick:()=>p(re),children:"Clear filters"})}):n.jsx(y,{title:"No recordings yet",description:"Record phones from Live devices.",action:n.jsx(q,{className:"rec-link",to:"/devices/live",children:"Open Live devices"})}):n.jsxs(n.Fragment,{children:[n.jsxs(Z,{className:"rec-table",children:[n.jsxs("caption",{className:"sr-only",children:["Recordings, ",j.length," shown"]}),n.jsx(J,{children:n.jsxs(T,{children:[n.jsx(h,{scope:"col",children:"When"}),n.jsx(h,{scope:"col",children:"Phones"}),n.jsx(h,{scope:"col",children:"Length"}),n.jsx(h,{scope:"col",children:"Recorded by"}),n.jsx(h,{scope:"col",children:"Bookmarks"}),n.jsx(h,{scope:"col",children:"Status"})]})}),n.jsx(X,{children:j.map(e=>{var L;const c=de(e),i=ue(e);return n.jsxs(T,{className:"rec-row",onClick:U=>{U.target.closest("a")||t(i)},children:[n.jsx(m,{children:n.jsx(q,{to:i,className:"rec-link",children:ne(e.startedAt)})}),n.jsx(m,{title:c.title,children:c.text}),n.jsx(m,{className:"rec-num",children:e.durationMs===null?"—":te(e.durationMs)}),n.jsx(m,{children:((L=e.startedBy)==null?void 0:L.name)??"Unknown"}),n.jsx(m,{className:"rec-num",children:e.bookmarkCount}),n.jsx(m,{children:e.status==="recording"?"Recording…":e.status==="failed"?"Failed":""})]},e.groupId)})})]}),b&&n.jsx("div",{className:"rec-more",children:n.jsx(v,{variant:"secondary",onClick:_,disabled:H,children:"Load more"})})]}):n.jsx(y,{title:"Loading recordings…"}),s&&n.jsxs("p",{className:"rec-footnote",children:["Recordings are kept for ",s.retention.days," days, up to the newest"," ",s.retention.maxCount,"."]})]})}export{Ne as default,de as phoneNames};
@@ -1 +1 @@
1
- import{j as e}from"./index-BGBqohfQ.js";const s=({kind:n,size:a=6,className:l})=>e.jsx("span",{className:`status-dot status-dot-${n}${l?" "+l:""}`,style:{width:a,height:a},"aria-hidden":!0});function d({segments:n,value:a,onChange:l,size:o="md",label:i}){return e.jsx("div",{className:`seg seg-${o}`,role:"tablist","aria-label":i,children:n.map(t=>e.jsxs("button",{role:"tab","aria-selected":t.value===a,"aria-label":t.title&&typeof t.label=="string"?t.label:void 0,"aria-keyshortcuts":t.keyShortcuts,title:t.title,disabled:t.disabled,className:`seg-btn${t.value===a?" seg-btn-active":""}`,onClick:()=>{t.disabled||l(t.value)},type:"button",children:[t.tone&&e.jsx(s,{kind:t.tone}),e.jsx("span",{children:t.label}),typeof t.count=="number"&&e.jsx("span",{className:`seg-count${t.count===0?" seg-count-zero":""}`,children:t.count})]},t.value))})}export{s as S,d as a};
1
+ import{j as e}from"./index-BbKEXUFH.js";const s=({kind:n,size:a=6,className:l})=>e.jsx("span",{className:`status-dot status-dot-${n}${l?" "+l:""}`,style:{width:a,height:a},"aria-hidden":!0});function d({segments:n,value:a,onChange:l,size:o="md",label:i}){return e.jsx("div",{className:`seg seg-${o}`,role:"tablist","aria-label":i,children:n.map(t=>e.jsxs("button",{role:"tab","aria-selected":t.value===a,"aria-label":t.title&&typeof t.label=="string"?t.label:void 0,"aria-keyshortcuts":t.keyShortcuts,title:t.title,disabled:t.disabled,className:`seg-btn${t.value===a?" seg-btn-active":""}`,onClick:()=>{t.disabled||l(t.value)},type:"button",children:[t.tone&&e.jsx(s,{kind:t.tone}),e.jsx("span",{children:t.label}),typeof t.count=="number"&&e.jsx("span",{className:`seg-count${t.count===0?" seg-count-zero":""}`,children:t.count})]},t.value))})}export{s as S,d as a};
@@ -1,4 +1,4 @@
1
- import{c as n,j as s,A as h}from"./index-BGBqohfQ.js";import{B as r}from"./button-Cq_zHETv.js";/**
1
+ import{c as n,j as s,A as h}from"./index-BbKEXUFH.js";import{B as r}from"./button-Dda4irn_.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as t}from"./index-BGBqohfQ.js";const x=({className:s,...a})=>t.jsx("table",{className:`tbl${s?" "+s:""}`,...a}),j=s=>t.jsx("thead",{...s}),c=s=>t.jsx("tbody",{...s}),e=s=>t.jsx("tr",{...s}),n=s=>t.jsx("th",{...s}),T=s=>t.jsx("td",{...s});export{x as T,j as a,e as b,n as c,c as d,T as e};
1
+ import{j as t}from"./index-BbKEXUFH.js";const x=({className:s,...a})=>t.jsx("table",{className:`tbl${s?" "+s:""}`,...a}),j=s=>t.jsx("thead",{...s}),c=s=>t.jsx("tbody",{...s}),e=s=>t.jsx("tr",{...s}),n=s=>t.jsx("th",{...s}),T=s=>t.jsx("td",{...s});export{x as T,j as a,e as b,n as c,c as d,T as e};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-BGBqohfQ.js";/**
1
+ import{c as t}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as p,t as z,r as c,X as m,j as e,S as k,A as N,V as I,W as $}from"./index-BGBqohfQ.js";/* empty css */import{S,A as F}from"./SettingCard-C908GgiI.js";import{P as B}from"./page-header-FXPlo6az.js";import{L as T}from"./lock-loz8txQm.js";import{C as b}from"./circle-check-CyBjjPxR.js";import{A as E}from"./activity-Css0xNvp.js";import"./button-Cq_zHETv.js";import"./utils-CDN07tui.js";/**
1
+ import{c as p,t as z,r as c,X as m,j as e,S as k,A as N,W as I,Y as $}from"./index-BbKEXUFH.js";/* empty css */import{S,A as F}from"./SettingCard-Njz1pUIJ.js";import{P as B}from"./page-header-BjzgWz-T.js";import{L as T}from"./lock-CCJv9m_I.js";import{C as b}from"./circle-check-CqAJjQ5O.js";import{A as E}from"./activity-DOVdsfMQ.js";import"./button-Dda4irn_.js";import"./utils-CDN07tui.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,4 +18,4 @@ import{c as p,t as z,r as c,X as m,j as e,S as k,A as N,V as I,W as $}from"./ind
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const V=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],O=p("sliders-vertical",V),_={aiProvider:"gemini",aiModel:"",aiBaseUrl:"",geminiModel:"",openaiModel:"",anthropicModel:"",ollamaModel:"",geminiSet:!1,openaiSet:!1,anthropicSet:!1,aiTemperature:1,aiMaxTokens:4096,aiTopP:1},X=(s,i)=>s.aiProvider===i.aiProvider&&s.aiTemperature===i.aiTemperature&&s.aiMaxTokens===i.aiMaxTokens&&s.aiTopP===i.aiTopP,o=s=>{switch(s){case"gemini":return"gemini-3-flash-preview";case"openai":return"gpt-4o";case"anthropic":return"claude-sonnet-4-6";case"ollama":return"llama3";default:return"—"}},Y=s=>{switch(s){case"ollama":return"http://localhost:11434";default:return"Provider default"}},se=()=>{const{toast:s}=z(),[i,r]=c.useState(_),[h,u]=c.useState(_),[w,g]=c.useState(!0),[x,v]=c.useState(!1),[f,j]=c.useState(!1);c.useEffect(()=>{P()},[]);const P=async()=>{g(!0);try{const a=await m.getGlobalConfig(),n={aiProvider:a.aiProvider||"gemini",aiModel:a.aiModel||"",aiBaseUrl:a.aiBaseUrl||"",geminiModel:a.geminiModel||"",openaiModel:a.openaiModel||"",anthropicModel:a.anthropicModel||"",ollamaModel:a.ollamaModel||"",geminiSet:!!a.geminiSet,openaiSet:!!a.openaiSet,anthropicSet:!!a.anthropicSet,aiTemperature:typeof a.aiTemperature=="number"?a.aiTemperature:1,aiMaxTokens:typeof a.aiMaxTokens=="number"?a.aiMaxTokens:4096,aiTopP:typeof a.aiTopP=="number"?a.aiTopP:1};r(n),u(n)}catch(a){console.error("Failed to load AISettings",a),s("Failed to access AI configuration.","error")}finally{g(!1)}},C=async()=>{v(!0);try{await m.updateGlobalConfig({aiProvider:i.aiProvider,aiTemperature:i.aiTemperature,aiMaxTokens:i.aiMaxTokens,aiTopP:i.aiTopP}),u(i),s("AI engine configuration saved.","success")}catch(a){console.error("Failed to save AISettings",a),$(s,a)}finally{v(!1)}},A=async()=>{j(!0);const a=Date.now();try{const n=await m.testAIConfig({aiProvider:i.aiProvider}),l=Date.now()-a;n.success?s(`${n.message} (${l}ms)`,"success"):s(n.message,"error")}catch(n){s(`Connection failed: ${(n==null?void 0:n.message)||"unknown error"}`,"error")}finally{j(!1)}},d=[{id:"gemini",name:"Google Gemini",description:`${o("gemini")} — Multimodal reasoning`,icon:e.jsx("span",{className:"ai-provider-glyph",children:"G"}),isConfigured:!!i.geminiSet},{id:"openai",name:"OpenAI",description:`${o("openai")} — OpenAI v1 compatible`,icon:e.jsx(D,{size:18}),isConfigured:!!i.openaiSet},{id:"anthropic",name:"Anthropic",description:`${o("anthropic")} — Advanced analysis`,icon:e.jsx(k,{size:18}),isConfigured:!!i.anthropicSet},{id:"ollama",name:"Ollama",description:"Local / self-hosted — no API key required",icon:e.jsx(R,{size:18}),isConfigured:!!i.ollamaModel||!!i.aiModel||!!i.aiBaseUrl}],t=d.find(a=>a.id===i.aiProvider),y=d.filter(a=>a.isConfigured).length,M=!X(i,h);return w?e.jsxs("div",{className:"settings-loading",children:[e.jsx(N,{className:"animate-spin",size:32}),e.jsx("span",{children:"Synchronizing Global State..."})]}):e.jsxs("div",{className:"settings-container",children:[e.jsx(B,{icon:I,title:"AI engine",subtitle:e.jsxs(e.Fragment,{children:["All credentials and endpoints are managed via environment variables.",e.jsxs("span",{className:"page-header-subnote",children:[e.jsx(T,{size:12}),"Select the active provider from configured options below."]})]})}),e.jsx("div",{className:"settings-content",children:e.jsxs("div",{className:"settings-grid settings-grid--two-equal",children:[e.jsx(S,{icon:e.jsx(k,{size:16}),title:"Provider registry",titleExtra:e.jsxs("span",{className:`provider-count-pill ${y>0?"is-ok":"is-empty"}`,children:[y," / ",d.length," configured"]}),description:"Providers are activated via environment variables. Select a configured engine to activate.",children:e.jsx("div",{className:"provider-list",children:d.map(a=>{const n=i.aiProvider===a.id,l=a.isConfigured;return e.jsxs("button",{type:"button",className:`provider-row ${n?"is-active":""} ${l?"":"is-disabled"}`,onClick:()=>l&&r({...i,aiProvider:a.id}),disabled:!l,title:l?`Activate ${a.name}`:`Set XENON_${a.id.toUpperCase()}_API_KEY to enable`,children:[e.jsx("div",{className:"provider-row__icon",children:a.icon}),e.jsxs("div",{className:"provider-row__body",children:[e.jsx("div",{className:"provider-row__name",children:a.name}),e.jsx("div",{className:"provider-row__desc",children:a.description}),e.jsx("div",{className:"provider-row__status",children:n?e.jsxs("span",{className:"provider-status provider-status--active",children:[e.jsx(b,{size:11}),a.isConfigured?"Active":"Active — no key"]}):a.isConfigured?e.jsxs("span",{className:"provider-status provider-status--ready",children:[e.jsx(b,{size:11}),"READY"]}):e.jsxs("span",{className:"provider-status provider-status--off",children:[e.jsx(T,{size:10}),"Not set"]})})]})]},a.id)})})}),e.jsxs(S,{icon:e.jsx(L,{size:16}),title:"Runtime configuration",description:"Environmental overrides for AI model endpoints and identifiers.",children:[e.jsxs("div",{className:"ai-config-display",children:[e.jsxs("div",{className:"ai-config-row",children:[e.jsx("span",{className:"ai-config-label",children:"Active provider"}),e.jsxs("span",{className:"ai-config-value",children:[t==null?void 0:t.icon,(t==null?void 0:t.name)||"—"]})]}),e.jsxs("div",{className:"ai-config-row",children:[e.jsx("span",{className:"ai-config-label",children:"Model"}),e.jsxs("span",{className:"ai-config-value mono",children:[e.jsxs("span",{children:[i.aiProvider==="gemini"&&(i.geminiModel||i.aiModel||o("gemini")),i.aiProvider==="openai"&&(i.openaiModel||i.aiModel||o("openai")),i.aiProvider==="anthropic"&&(i.anthropicModel||i.aiModel||o("anthropic")),i.aiProvider==="ollama"&&(i.ollamaModel||i.aiModel||o("ollama"))]}),e.jsx("span",{className:"ai-config-default",children:"Default"})]})]}),e.jsxs("div",{className:"ai-config-row",children:[e.jsx("span",{className:"ai-config-label",children:"Base URL"}),e.jsxs("span",{className:"ai-config-value mono",children:[e.jsx("span",{children:i.aiBaseUrl||Y(i.aiProvider)}),!i.aiBaseUrl&&e.jsx("span",{className:"ai-config-default",children:"Default"})]})]})]}),e.jsxs("div",{className:"model-params",children:[e.jsxs("div",{className:"model-params__header",children:[e.jsx(O,{size:14}),e.jsx("span",{children:"Model Parameters"})]}),e.jsxs("div",{className:"model-param",children:[e.jsxs("div",{className:"model-param__label-row",children:[e.jsx("label",{htmlFor:"ai-temp",children:"Temperature"}),e.jsx("span",{className:"model-param__value",children:i.aiTemperature.toFixed(1)})]}),e.jsx("input",{id:"ai-temp",type:"range",min:0,max:2,step:.1,value:i.aiTemperature,onChange:a=>r({...i,aiTemperature:parseFloat(a.target.value)}),className:"model-param__slider"})]}),e.jsxs("div",{className:"model-param",children:[e.jsx("div",{className:"model-param__label-row",children:e.jsx("label",{htmlFor:"ai-max-tokens",children:"Max tokens"})}),e.jsx("div",{className:"setting-input-wrapper",children:e.jsx("input",{id:"ai-max-tokens",type:"number",min:256,step:128,value:i.aiMaxTokens,onChange:a=>r({...i,aiMaxTokens:parseInt(a.target.value,10)||0})})})]}),e.jsxs("div",{className:"model-param",children:[e.jsxs("div",{className:"model-param__label-row",children:[e.jsx("label",{htmlFor:"ai-top-p",children:"Top P"}),e.jsx("span",{className:"model-param__value",children:i.aiTopP.toFixed(2)})]}),e.jsx("input",{id:"ai-top-p",type:"range",min:0,max:1,step:.01,value:i.aiTopP,onChange:a=>r({...i,aiTopP:parseFloat(a.target.value)}),className:"model-param__slider"})]})]}),e.jsxs("button",{type:"button",className:"test-connection-btn",onClick:A,disabled:f||!(t!=null&&t.isConfigured),children:[f?e.jsx(N,{size:14,className:"animate-spin"}):e.jsx(E,{size:14}),e.jsx("span",{children:"Test Connection"})]})]})]})}),(M||x)&&e.jsx(F,{onSave:C,onDiscard:()=>r(h),isSaving:x,isDirty:M,saveLabel:"Save configuration"})]})};export{se as AISettings};
21
+ */const O=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],V=p("sliders-vertical",O),_={aiProvider:"gemini",aiModel:"",aiBaseUrl:"",geminiModel:"",openaiModel:"",anthropicModel:"",ollamaModel:"",geminiSet:!1,openaiSet:!1,anthropicSet:!1,aiTemperature:1,aiMaxTokens:4096,aiTopP:1},X=(s,i)=>s.aiProvider===i.aiProvider&&s.aiTemperature===i.aiTemperature&&s.aiMaxTokens===i.aiMaxTokens&&s.aiTopP===i.aiTopP,o=s=>{switch(s){case"gemini":return"gemini-3-flash-preview";case"openai":return"gpt-4o";case"anthropic":return"claude-sonnet-4-6";case"ollama":return"llama3";default:return"—"}},Y=s=>{switch(s){case"ollama":return"http://localhost:11434";default:return"Provider default"}},se=()=>{const{toast:s}=z(),[i,r]=c.useState(_),[h,u]=c.useState(_),[w,g]=c.useState(!0),[x,v]=c.useState(!1),[f,j]=c.useState(!1);c.useEffect(()=>{P()},[]);const P=async()=>{g(!0);try{const a=await m.getGlobalConfig(),n={aiProvider:a.aiProvider||"gemini",aiModel:a.aiModel||"",aiBaseUrl:a.aiBaseUrl||"",geminiModel:a.geminiModel||"",openaiModel:a.openaiModel||"",anthropicModel:a.anthropicModel||"",ollamaModel:a.ollamaModel||"",geminiSet:!!a.geminiSet,openaiSet:!!a.openaiSet,anthropicSet:!!a.anthropicSet,aiTemperature:typeof a.aiTemperature=="number"?a.aiTemperature:1,aiMaxTokens:typeof a.aiMaxTokens=="number"?a.aiMaxTokens:4096,aiTopP:typeof a.aiTopP=="number"?a.aiTopP:1};r(n),u(n)}catch(a){console.error("Failed to load AISettings",a),s("Failed to access AI configuration.","error")}finally{g(!1)}},C=async()=>{v(!0);try{await m.updateGlobalConfig({aiProvider:i.aiProvider,aiTemperature:i.aiTemperature,aiMaxTokens:i.aiMaxTokens,aiTopP:i.aiTopP}),u(i),s("AI engine configuration saved.","success")}catch(a){console.error("Failed to save AISettings",a),$(s,a)}finally{v(!1)}},A=async()=>{j(!0);const a=Date.now();try{const n=await m.testAIConfig({aiProvider:i.aiProvider}),l=Date.now()-a;n.success?s(`${n.message} (${l}ms)`,"success"):s(n.message,"error")}catch(n){s(`Connection failed: ${(n==null?void 0:n.message)||"unknown error"}`,"error")}finally{j(!1)}},d=[{id:"gemini",name:"Google Gemini",description:`${o("gemini")} — Multimodal reasoning`,icon:e.jsx("span",{className:"ai-provider-glyph",children:"G"}),isConfigured:!!i.geminiSet},{id:"openai",name:"OpenAI",description:`${o("openai")} — OpenAI v1 compatible`,icon:e.jsx(D,{size:18}),isConfigured:!!i.openaiSet},{id:"anthropic",name:"Anthropic",description:`${o("anthropic")} — Advanced analysis`,icon:e.jsx(k,{size:18}),isConfigured:!!i.anthropicSet},{id:"ollama",name:"Ollama",description:"Local / self-hosted — no API key required",icon:e.jsx(R,{size:18}),isConfigured:!!i.ollamaModel||!!i.aiModel||!!i.aiBaseUrl}],t=d.find(a=>a.id===i.aiProvider),y=d.filter(a=>a.isConfigured).length,M=!X(i,h);return w?e.jsxs("div",{className:"settings-loading",children:[e.jsx(N,{className:"animate-spin",size:32}),e.jsx("span",{children:"Synchronizing Global State..."})]}):e.jsxs("div",{className:"settings-container",children:[e.jsx(B,{icon:I,title:"AI engine",subtitle:e.jsxs(e.Fragment,{children:["All credentials and endpoints are managed via environment variables.",e.jsxs("span",{className:"page-header-subnote",children:[e.jsx(T,{size:12}),"Select the active provider from configured options below."]})]})}),e.jsx("div",{className:"settings-content",children:e.jsxs("div",{className:"settings-grid settings-grid--two-equal",children:[e.jsx(S,{icon:e.jsx(k,{size:16}),title:"Provider registry",titleExtra:e.jsxs("span",{className:`provider-count-pill ${y>0?"is-ok":"is-empty"}`,children:[y," / ",d.length," configured"]}),description:"Providers are activated via environment variables. Select a configured engine to activate.",children:e.jsx("div",{className:"provider-list",children:d.map(a=>{const n=i.aiProvider===a.id,l=a.isConfigured;return e.jsxs("button",{type:"button",className:`provider-row ${n?"is-active":""} ${l?"":"is-disabled"}`,onClick:()=>l&&r({...i,aiProvider:a.id}),disabled:!l,title:l?`Activate ${a.name}`:`Set XENON_${a.id.toUpperCase()}_API_KEY to enable`,children:[e.jsx("div",{className:"provider-row__icon",children:a.icon}),e.jsxs("div",{className:"provider-row__body",children:[e.jsx("div",{className:"provider-row__name",children:a.name}),e.jsx("div",{className:"provider-row__desc",children:a.description}),e.jsx("div",{className:"provider-row__status",children:n?e.jsxs("span",{className:"provider-status provider-status--active",children:[e.jsx(b,{size:11}),a.isConfigured?"Active":"Active — no key"]}):a.isConfigured?e.jsxs("span",{className:"provider-status provider-status--ready",children:[e.jsx(b,{size:11}),"READY"]}):e.jsxs("span",{className:"provider-status provider-status--off",children:[e.jsx(T,{size:10}),"Not set"]})})]})]},a.id)})})}),e.jsxs(S,{icon:e.jsx(L,{size:16}),title:"Runtime configuration",description:"Environmental overrides for AI model endpoints and identifiers.",children:[e.jsxs("div",{className:"ai-config-display",children:[e.jsxs("div",{className:"ai-config-row",children:[e.jsx("span",{className:"ai-config-label",children:"Active provider"}),e.jsxs("span",{className:"ai-config-value",children:[t==null?void 0:t.icon,(t==null?void 0:t.name)||"—"]})]}),e.jsxs("div",{className:"ai-config-row",children:[e.jsx("span",{className:"ai-config-label",children:"Model"}),e.jsxs("span",{className:"ai-config-value mono",children:[e.jsxs("span",{children:[i.aiProvider==="gemini"&&(i.geminiModel||i.aiModel||o("gemini")),i.aiProvider==="openai"&&(i.openaiModel||i.aiModel||o("openai")),i.aiProvider==="anthropic"&&(i.anthropicModel||i.aiModel||o("anthropic")),i.aiProvider==="ollama"&&(i.ollamaModel||i.aiModel||o("ollama"))]}),e.jsx("span",{className:"ai-config-default",children:"Default"})]})]}),e.jsxs("div",{className:"ai-config-row",children:[e.jsx("span",{className:"ai-config-label",children:"Base URL"}),e.jsxs("span",{className:"ai-config-value mono",children:[e.jsx("span",{children:i.aiBaseUrl||Y(i.aiProvider)}),!i.aiBaseUrl&&e.jsx("span",{className:"ai-config-default",children:"Default"})]})]})]}),e.jsxs("div",{className:"model-params",children:[e.jsxs("div",{className:"model-params__header",children:[e.jsx(V,{size:14}),e.jsx("span",{children:"Model Parameters"})]}),e.jsxs("div",{className:"model-param",children:[e.jsxs("div",{className:"model-param__label-row",children:[e.jsx("label",{htmlFor:"ai-temp",children:"Temperature"}),e.jsx("span",{className:"model-param__value",children:i.aiTemperature.toFixed(1)})]}),e.jsx("input",{id:"ai-temp",type:"range",min:0,max:2,step:.1,value:i.aiTemperature,onChange:a=>r({...i,aiTemperature:parseFloat(a.target.value)}),className:"model-param__slider"})]}),e.jsxs("div",{className:"model-param",children:[e.jsx("div",{className:"model-param__label-row",children:e.jsx("label",{htmlFor:"ai-max-tokens",children:"Max tokens"})}),e.jsx("div",{className:"setting-input-wrapper",children:e.jsx("input",{id:"ai-max-tokens",type:"number",min:256,step:128,value:i.aiMaxTokens,onChange:a=>r({...i,aiMaxTokens:parseInt(a.target.value,10)||0})})})]}),e.jsxs("div",{className:"model-param",children:[e.jsxs("div",{className:"model-param__label-row",children:[e.jsx("label",{htmlFor:"ai-top-p",children:"Top P"}),e.jsx("span",{className:"model-param__value",children:i.aiTopP.toFixed(2)})]}),e.jsx("input",{id:"ai-top-p",type:"range",min:0,max:1,step:.01,value:i.aiTopP,onChange:a=>r({...i,aiTopP:parseFloat(a.target.value)}),className:"model-param__slider"})]})]}),e.jsxs("button",{type:"button",className:"test-connection-btn",onClick:A,disabled:f||!(t!=null&&t.isConfigured),children:[f?e.jsx(N,{size:14,className:"animate-spin"}):e.jsx(E,{size:14}),e.jsx("span",{children:"Test Connection"})]})]})]})}),(M||x)&&e.jsx(F,{onSave:C,onDiscard:()=>r(h),isSaving:x,isDirty:M,saveLabel:"Save configuration"})]})};export{se as AISettings};
@@ -1 +1 @@
1
- import{t as le,r as a,j as e,A as $,Y as g,y as oe}from"./index-BGBqohfQ.js";/* empty css */import{a as L}from"./time-D-gjmE1o.js";import{T as ce,a as de,b as z,c as l,d as me,e as o}from"./Table-B1DB_ZN-.js";import{F as m}from"./FieldGroup-BHc_5qNc.js";import{P as O}from"./page-header-FXPlo6az.js";import{M as B}from"./Modal-ChvVUI3B.js";import{B as u}from"./button-Cq_zHETv.js";import{I as H}from"./input-BvB1cjHE.js";import{S as M}from"./select-12RThAXc.js";import{P as v}from"./plus-B2xCnntV.js";import{T as pe}from"./trash-2-B54e-TfY.js";import{C as he}from"./check-C7xu-hGU.js";import{C as xe}from"./copy-BIM0ZX0L.js";import"./index-BQ2luT7L.js";import"./utils-CDN07tui.js";const Y=["read","sessions","devices","admin"],U={"7d":"7 days","30d":"30 days","90d":"90 days","1y":"1 year",never:"No expiry"},ue={"7d":7,"30d":30,"90d":90,"1y":365};function W(i){return i==="never"?null:new Date(Date.now()+ue[i]*864e5).toISOString()}function q(i){if(!i)return"Never";const n=Date.now()-new Date(i).getTime();return n<6e4?"Just now":n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}const Ee=()=>{const{toast:i}=le(),[n,w]=a.useState([]),[b,J]=a.useState([]),[X,N]=a.useState(!0),[G,k]=a.useState(!1),[Q,d]=a.useState(!1),[r,y]=a.useState(null),[C,S]=a.useState(null),[T,_]=a.useState(!1),[p,A]=a.useState(""),[j,I]=a.useState({read:!0,sessions:!0,devices:!1,admin:!1}),[R,P]=a.useState(300),[E,D]=a.useState(""),[h,F]=a.useState("30d"),[x,K]=a.useState(!1),V=s=>{var t;return s?((t=b.find(c=>c.id===s))==null?void 0:t.name)||s.slice(0,8):"Shared"},f=async()=>{N(!0);try{const[s,t]=await Promise.all([fetch("/xenon/api/apikeys",{credentials:"include"}),fetch("/xenon/api/teams",{credentials:"include"})]);if(s.status===403){k(!0),w([]);return}if(!s.ok)throw new Error(`HTTP ${s.status}`);w(await s.json()),t.ok&&J(await t.json()),k(!1)}catch(s){i(`Failed to load API keys: ${s.message}`,"error")}finally{N(!1)}};a.useEffect(()=>{f()},[]);const Z=()=>{A(""),I({read:!0,sessions:!0,devices:!1,admin:!1}),P(300),D(""),F("30d")},ee=async()=>{const s=Y.filter(t=>j[t]);if(!p.trim()){i("Key name is required","error");return}if(s.length===0){i("Select at least one scope","error");return}K(!0);try{const t=await fetch("/xenon/api/apikeys",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),scopes:s,rateLimit:R,teamId:E||null,expiresAt:W(h)})});if(!t.ok)throw new Error(`HTTP ${t.status}`);const c=await t.json();d(!1),Z(),y({name:p.trim(),raw:c.key}),await f()}catch(t){i(`Create failed: ${t.message}`,"error")}finally{K(!1)}},se=async s=>{S(s);try{const t=await fetch(`/xenon/api/apikeys/${s}`,{method:"DELETE",credentials:"include"});if(!t.ok)throw new Error(`HTTP ${t.status}`);i("Key revoked","success"),await f()}catch(t){i(`Revoke failed: ${t.message}`,"error")}finally{S(null)}},te=async s=>{try{await navigator.clipboard.writeText(s),_(!0),setTimeout(()=>_(!1),1500)}catch{i("Copy failed — select the text manually","error")}};if(X)return e.jsxs("div",{className:"settings-loading",children:[e.jsx($,{className:"animate-spin",size:32}),e.jsx("span",{children:"Loading API keys…"})]});if(G)return e.jsx("div",{className:"settings-container",children:e.jsx(O,{icon:g,title:"API keys",subtitle:e.jsxs(e.Fragment,{children:["Your key lacks the ",e.jsx("code",{children:"admin"})," scope. Ask an administrator to issue an admin key so you can manage access for other users."]})})});const ae=n.length,ie=n.filter(s=>s.scopes.includes("admin")).length,ne=n.filter(s=>s.lastUsedAt&&Date.now()-new Date(s.lastUsedAt).getTime()<864e5).length;return e.jsxs("div",{className:"settings-container",children:[e.jsx(O,{icon:g,title:"API keys",subtitle:e.jsxs(e.Fragment,{children:["Issue scoped credentials for humans (dashboard login) and machines (CI, WebDriver clients via ",e.jsx("code",{children:"xe:options.accessKey"})," + ",e.jsx("code",{children:"xe:options.token"}),"). Keys are shown only once at creation — copy the value before closing the dialog."]}),action:e.jsxs("button",{type:"button",className:"page-header-action",onClick:()=>d(!0),children:[e.jsx(v,{size:16}),e.jsx("span",{children:"Create new key"})]})}),e.jsxs("div",{className:"settings-content",children:[n.length>0&&e.jsxs("div",{className:"stat-strip",children:[e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:ae}),e.jsx("div",{className:"stat-strip__label",children:"Total keys"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value stat-strip__value--accent",children:ie}),e.jsx("div",{className:"stat-strip__label",children:"Admin scope"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:ne}),e.jsx("div",{className:"stat-strip__label",children:"Active in last 24h"})]})]}),n.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx("div",{className:"empty-state__icon",children:e.jsx(g,{size:28})}),e.jsx("h3",{className:"empty-state__title",children:"No API keys yet"}),e.jsx("p",{className:"empty-state__copy",children:"Issue your first key to authenticate WebDriver clients or CI pipelines. Keys are shown only once at creation — copy the value before closing the dialog."}),e.jsxs("button",{type:"button",className:"page-header-action empty-state__action",onClick:()=>d(!0),children:[e.jsx(v,{size:16}),e.jsx("span",{children:"Create your first key"})]})]}):e.jsx("div",{className:"data-card",children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsxs(z,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Team"}),e.jsx(l,{children:"Scopes"}),e.jsx(l,{children:"Rate limit"}),e.jsx(l,{children:"Last used"}),e.jsx(l,{children:"Created"}),e.jsx(l,{children:"Expires"}),e.jsx(l,{style:{textAlign:"right"},children:"Actions"})]})}),e.jsx(me,{children:n.map(s=>e.jsxs(z,{children:[e.jsxs(o,{children:[e.jsx("strong",{children:s.name}),e.jsx("div",{className:"row-meta-mono",children:s.id.slice(0,8)})]}),e.jsx(o,{children:e.jsx("span",{className:`pill-chip ${s.teamId?"pill-chip--team":"pill-chip--shared"}`,children:V(s.teamId)})}),e.jsx(o,{children:e.jsx("div",{className:"scope-chips",children:s.scopes.split(",").map(t=>{const c=t.trim(),re=c==="admin";return e.jsx("span",{className:`pill-chip ${re?"pill-chip--admin":"pill-chip--scope"}`,children:c},t)})})}),e.jsxs(o,{className:"row-mono",children:[s.rateLimit,"/min"]}),e.jsx(o,{className:"row-mono",children:q(s.lastUsedAt)}),e.jsx(o,{className:"row-mono",children:q(s.createdAt)}),e.jsx(o,{className:"row-mono",children:s.expiresAt?new Date(s.expiresAt).getTime()<=Date.now()?e.jsx("span",{style:{color:"var(--red)"},children:"expired"}):L(s.expiresAt):"Never"}),e.jsx(o,{style:{textAlign:"right"},children:e.jsxs("button",{type:"button",className:"row-action row-action--danger",disabled:C===s.id,onClick:()=>{window.confirm(`Revoke "${s.name}"? Any client using this key will immediately fail.`)&&se(s.id)},children:[e.jsx(pe,{size:13}),C===s.id?"Revoking…":"Revoke"]})})]},s.id))})]})})]}),e.jsx(B,{open:Q,title:"Create API key",width:520,onClose:()=>d(!1),footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",onClick:()=>d(!1),disabled:x,children:"Cancel"}),e.jsxs(u,{variant:"primary",onClick:ee,disabled:x,children:[x?e.jsx($,{className:"animate-spin",size:18}):e.jsx(v,{size:18}),x?"Creating…":"Create key"]})]}),children:e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx(m,{label:"Name",htmlFor:"apikey-name",children:e.jsx(H,{id:"apikey-name",type:"text",value:p,onChange:s=>A(s.target.value),placeholder:"alice-laptop, ci-main, etc.",className:"w-full",autoFocus:!0})}),e.jsx(m,{label:"Scopes",description:e.jsxs(e.Fragment,{children:[e.jsx("code",{children:"admin"})," grants full access including API-key management."," ",e.jsx("code",{children:"sessions"})," is required for WebDriver sessions (",e.jsx("code",{children:"xe:options.accessKey"})," + ",e.jsx("code",{children:"xe:options.token"}),")."]}),children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:Y.map(s=>e.jsxs("label",{style:ye,children:[e.jsx("input",{type:"checkbox",checked:j[s],onChange:t=>I({...j,[s]:t.target.checked})}),e.jsx("span",{children:s})]},s))})}),e.jsx(m,{label:"Rate limit (requests/min)",htmlFor:"apikey-ratelimit",children:e.jsx(H,{id:"apikey-ratelimit",type:"number",min:10,step:10,value:R,onChange:s=>P(parseInt(s.target.value)||300),className:"w-full"})}),e.jsx(m,{label:"Default team",description:e.jsxs(e.Fragment,{children:["Keys without a team can only reach shared-pool devices. Admins can override at session time via ",e.jsx("code",{children:"xe:options.team"}),"."]}),htmlFor:"apikey-team",children:e.jsxs(M,{id:"apikey-team",value:E,onChange:s=>D(s.target.value),className:"w-full",children:[e.jsx("option",{value:"",children:"No team (shared pool only)"}),b.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})}),e.jsx(m,{label:"Expires after",description:h==="never"?"Key never expires. Rotate manually when needed.":`Key will stop working on ${L(W(h))}.`,htmlFor:"apikey-expiry",children:e.jsx(M,{id:"apikey-expiry",value:h,onChange:s=>F(s.target.value),className:"w-full",children:Object.keys(U).map(s=>e.jsx("option",{value:s,children:U[s]},s))})})]})}),e.jsx(B,{open:!!r,title:r?`Key created: ${r.name}`:"",width:560,onClose:()=>y(null),closeOnOverlayClick:!1,footer:e.jsxs(e.Fragment,{children:[e.jsxs(u,{variant:"primary",onClick:()=>r&&te(r.raw),disabled:!r,children:[T?e.jsx(he,{size:18}):e.jsx(xe,{size:18}),T?"Copied":"Copy to clipboard"]}),e.jsx(u,{variant:"secondary",onClick:()=>y(null),children:"I've saved it"})]}),children:r&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{background:"var(--status-busy-bg)",border:"1px solid var(--status-busy-border)",borderRadius:6,padding:12,display:"flex",gap:8,alignItems:"flex-start"},children:[e.jsx(oe,{size:18,style:{flexShrink:0,marginTop:2}}),e.jsxs("div",{children:[e.jsx("strong",{children:"This key will not be shown again."})," Copy it now and store it in your password manager, CI secret store, or client config."]})]}),e.jsx("div",{style:{fontFamily:"monospace",padding:12,background:"rgb(var(--rgb-black) / 0.3)",borderRadius:6,wordBreak:"break-all",fontSize:"0.9em"},children:r.raw})]})})]})},ye={display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"rgb(var(--rgb-white) / 0.04)",borderRadius:6,cursor:"pointer",fontFamily:"monospace",fontSize:"0.9em"};export{Ee as ApiKeys};
1
+ import{t as le,r as a,j as e,A as $,Z as g,y as oe}from"./index-BbKEXUFH.js";/* empty css */import{a as L}from"./time-D-gjmE1o.js";import{T as ce,a as de,b as z,c as l,d as me,e as o}from"./Table-BcTm5xV2.js";import{F as m}from"./FieldGroup-Cb5QZsE1.js";import{P as O}from"./page-header-BjzgWz-T.js";import{M as B}from"./Modal-CFCp3n9d.js";import{B as u}from"./button-Dda4irn_.js";import{I as H}from"./input-Cm0tmSoc.js";import{S as M}from"./select-88jHcl-Z.js";import{P as v}from"./plus-nBFSMu_X.js";import{T as pe}from"./trash-2-C5RSuX0e.js";import{C as he}from"./check-CZ9iw9-e.js";import{C as xe}from"./copy-CAQydNFe.js";import"./index-DJGc1M2f.js";import"./utils-CDN07tui.js";const U=["read","sessions","devices","admin"],W={"7d":"7 days","30d":"30 days","90d":"90 days","1y":"1 year",never:"No expiry"},ue={"7d":7,"30d":30,"90d":90,"1y":365};function Y(i){return i==="never"?null:new Date(Date.now()+ue[i]*864e5).toISOString()}function q(i){if(!i)return"Never";const n=Date.now()-new Date(i).getTime();return n<6e4?"Just now":n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}const Ee=()=>{const{toast:i}=le(),[n,w]=a.useState([]),[b,J]=a.useState([]),[X,N]=a.useState(!0),[G,k]=a.useState(!1),[Z,d]=a.useState(!1),[r,y]=a.useState(null),[C,S]=a.useState(null),[T,_]=a.useState(!1),[p,A]=a.useState(""),[j,I]=a.useState({read:!0,sessions:!0,devices:!1,admin:!1}),[R,P]=a.useState(300),[E,D]=a.useState(""),[h,F]=a.useState("30d"),[x,K]=a.useState(!1),Q=s=>{var t;return s?((t=b.find(c=>c.id===s))==null?void 0:t.name)||s.slice(0,8):"Shared"},f=async()=>{N(!0);try{const[s,t]=await Promise.all([fetch("/xenon/api/apikeys",{credentials:"include"}),fetch("/xenon/api/teams",{credentials:"include"})]);if(s.status===403){k(!0),w([]);return}if(!s.ok)throw new Error(`HTTP ${s.status}`);w(await s.json()),t.ok&&J(await t.json()),k(!1)}catch(s){i(`Failed to load API keys: ${s.message}`,"error")}finally{N(!1)}};a.useEffect(()=>{f()},[]);const V=()=>{A(""),I({read:!0,sessions:!0,devices:!1,admin:!1}),P(300),D(""),F("30d")},ee=async()=>{const s=U.filter(t=>j[t]);if(!p.trim()){i("Key name is required","error");return}if(s.length===0){i("Select at least one scope","error");return}K(!0);try{const t=await fetch("/xenon/api/apikeys",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),scopes:s,rateLimit:R,teamId:E||null,expiresAt:Y(h)})});if(!t.ok)throw new Error(`HTTP ${t.status}`);const c=await t.json();d(!1),V(),y({name:p.trim(),raw:c.key}),await f()}catch(t){i(`Create failed: ${t.message}`,"error")}finally{K(!1)}},se=async s=>{S(s);try{const t=await fetch(`/xenon/api/apikeys/${s}`,{method:"DELETE",credentials:"include"});if(!t.ok)throw new Error(`HTTP ${t.status}`);i("Key revoked","success"),await f()}catch(t){i(`Revoke failed: ${t.message}`,"error")}finally{S(null)}},te=async s=>{try{await navigator.clipboard.writeText(s),_(!0),setTimeout(()=>_(!1),1500)}catch{i("Copy failed — select the text manually","error")}};if(X)return e.jsxs("div",{className:"settings-loading",children:[e.jsx($,{className:"animate-spin",size:32}),e.jsx("span",{children:"Loading API keys…"})]});if(G)return e.jsx("div",{className:"settings-container",children:e.jsx(O,{icon:g,title:"API keys",subtitle:e.jsxs(e.Fragment,{children:["Your key lacks the ",e.jsx("code",{children:"admin"})," scope. Ask an administrator to issue an admin key so you can manage access for other users."]})})});const ae=n.length,ie=n.filter(s=>s.scopes.includes("admin")).length,ne=n.filter(s=>s.lastUsedAt&&Date.now()-new Date(s.lastUsedAt).getTime()<864e5).length;return e.jsxs("div",{className:"settings-container",children:[e.jsx(O,{icon:g,title:"API keys",subtitle:e.jsxs(e.Fragment,{children:["Issue scoped credentials for humans (dashboard login) and machines (CI, WebDriver clients via ",e.jsx("code",{children:"xe:options.accessKey"})," + ",e.jsx("code",{children:"xe:options.token"}),"). Keys are shown only once at creation — copy the value before closing the dialog."]}),action:e.jsxs("button",{type:"button",className:"page-header-action",onClick:()=>d(!0),children:[e.jsx(v,{size:16}),e.jsx("span",{children:"Create new key"})]})}),e.jsxs("div",{className:"settings-content",children:[n.length>0&&e.jsxs("div",{className:"stat-strip",children:[e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:ae}),e.jsx("div",{className:"stat-strip__label",children:"Total keys"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value stat-strip__value--accent",children:ie}),e.jsx("div",{className:"stat-strip__label",children:"Admin scope"})]}),e.jsxs("div",{className:"stat-strip__cell",children:[e.jsx("div",{className:"stat-strip__value",children:ne}),e.jsx("div",{className:"stat-strip__label",children:"Active in last 24h"})]})]}),n.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx("div",{className:"empty-state__icon",children:e.jsx(g,{size:28})}),e.jsx("h3",{className:"empty-state__title",children:"No API keys yet"}),e.jsx("p",{className:"empty-state__copy",children:"Issue your first key to authenticate WebDriver clients or CI pipelines. Keys are shown only once at creation — copy the value before closing the dialog."}),e.jsxs("button",{type:"button",className:"page-header-action empty-state__action",onClick:()=>d(!0),children:[e.jsx(v,{size:16}),e.jsx("span",{children:"Create your first key"})]})]}):e.jsx("div",{className:"data-card",children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsxs(z,{children:[e.jsx(l,{children:"Name"}),e.jsx(l,{children:"Team"}),e.jsx(l,{children:"Scopes"}),e.jsx(l,{children:"Rate limit"}),e.jsx(l,{children:"Last used"}),e.jsx(l,{children:"Created"}),e.jsx(l,{children:"Expires"}),e.jsx(l,{style:{textAlign:"right"},children:"Actions"})]})}),e.jsx(me,{children:n.map(s=>e.jsxs(z,{children:[e.jsxs(o,{children:[e.jsx("strong",{children:s.name}),e.jsx("div",{className:"row-meta-mono",children:s.id.slice(0,8)})]}),e.jsx(o,{children:e.jsx("span",{className:`pill-chip ${s.teamId?"pill-chip--team":"pill-chip--shared"}`,children:Q(s.teamId)})}),e.jsx(o,{children:e.jsx("div",{className:"scope-chips",children:s.scopes.split(",").map(t=>{const c=t.trim(),re=c==="admin";return e.jsx("span",{className:`pill-chip ${re?"pill-chip--admin":"pill-chip--scope"}`,children:c},t)})})}),e.jsxs(o,{className:"row-mono",children:[s.rateLimit,"/min"]}),e.jsx(o,{className:"row-mono",children:q(s.lastUsedAt)}),e.jsx(o,{className:"row-mono",children:q(s.createdAt)}),e.jsx(o,{className:"row-mono",children:s.expiresAt?new Date(s.expiresAt).getTime()<=Date.now()?e.jsx("span",{style:{color:"var(--red)"},children:"expired"}):L(s.expiresAt):"Never"}),e.jsx(o,{style:{textAlign:"right"},children:e.jsxs("button",{type:"button",className:"row-action row-action--danger",disabled:C===s.id,onClick:()=>{window.confirm(`Revoke "${s.name}"? Any client using this key will immediately fail.`)&&se(s.id)},children:[e.jsx(pe,{size:13}),C===s.id?"Revoking…":"Revoke"]})})]},s.id))})]})})]}),e.jsx(B,{open:Z,title:"Create API key",width:520,onClose:()=>d(!1),footer:e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"secondary",onClick:()=>d(!1),disabled:x,children:"Cancel"}),e.jsxs(u,{variant:"primary",onClick:ee,disabled:x,children:[x?e.jsx($,{className:"animate-spin",size:18}):e.jsx(v,{size:18}),x?"Creating…":"Create key"]})]}),children:e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx(m,{label:"Name",htmlFor:"apikey-name",children:e.jsx(H,{id:"apikey-name",type:"text",value:p,onChange:s=>A(s.target.value),placeholder:"alice-laptop, ci-main, etc.",className:"w-full",autoFocus:!0})}),e.jsx(m,{label:"Scopes",description:e.jsxs(e.Fragment,{children:[e.jsx("code",{children:"admin"})," grants full access including API-key management."," ",e.jsx("code",{children:"sessions"})," is required for WebDriver sessions (",e.jsx("code",{children:"xe:options.accessKey"})," + ",e.jsx("code",{children:"xe:options.token"}),")."]}),children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:U.map(s=>e.jsxs("label",{style:ye,children:[e.jsx("input",{type:"checkbox",checked:j[s],onChange:t=>I({...j,[s]:t.target.checked})}),e.jsx("span",{children:s})]},s))})}),e.jsx(m,{label:"Rate limit (requests/min)",htmlFor:"apikey-ratelimit",children:e.jsx(H,{id:"apikey-ratelimit",type:"number",min:10,step:10,value:R,onChange:s=>P(parseInt(s.target.value)||300),className:"w-full"})}),e.jsx(m,{label:"Default team",description:e.jsxs(e.Fragment,{children:["Keys without a team can only reach shared-pool devices. Admins can override at session time via ",e.jsx("code",{children:"xe:options.team"}),"."]}),htmlFor:"apikey-team",children:e.jsxs(M,{id:"apikey-team",value:E,onChange:s=>D(s.target.value),className:"w-full",children:[e.jsx("option",{value:"",children:"No team (shared pool only)"}),b.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})}),e.jsx(m,{label:"Expires after",description:h==="never"?"Key never expires. Rotate manually when needed.":`Key will stop working on ${L(Y(h))}.`,htmlFor:"apikey-expiry",children:e.jsx(M,{id:"apikey-expiry",value:h,onChange:s=>F(s.target.value),className:"w-full",children:Object.keys(W).map(s=>e.jsx("option",{value:s,children:W[s]},s))})})]})}),e.jsx(B,{open:!!r,title:r?`Key created: ${r.name}`:"",width:560,onClose:()=>y(null),closeOnOverlayClick:!1,footer:e.jsxs(e.Fragment,{children:[e.jsxs(u,{variant:"primary",onClick:()=>r&&te(r.raw),disabled:!r,children:[T?e.jsx(he,{size:18}):e.jsx(xe,{size:18}),T?"Copied":"Copy to clipboard"]}),e.jsx(u,{variant:"secondary",onClick:()=>y(null),children:"I've saved it"})]}),children:r&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{background:"var(--status-busy-bg)",border:"1px solid var(--status-busy-border)",borderRadius:6,padding:12,display:"flex",gap:8,alignItems:"flex-start"},children:[e.jsx(oe,{size:18,style:{flexShrink:0,marginTop:2}}),e.jsxs("div",{children:[e.jsx("strong",{children:"This key will not be shown again."})," Copy it now and store it in your password manager, CI secret store, or client config."]})]}),e.jsx("div",{style:{fontFamily:"monospace",padding:12,background:"rgb(var(--rgb-black) / 0.3)",borderRadius:6,wordBreak:"break-all",fontSize:"0.9em"},children:r.raw})]})})]})},ye={display:"flex",alignItems:"center",gap:6,padding:"6px 12px",background:"rgb(var(--rgb-white) / 0.04)",borderRadius:6,cursor:"pointer",fontFamily:"monospace",fontSize:"0.9em"};export{Ee as ApiKeys};
@@ -1,4 +1,4 @@
1
- import{c as k,j as e,r as i,A as X,t as ve,b as je,X as p,K as fe,q as V,z as ye,v as ge}from"./index-BGBqohfQ.js";import{f as Ne}from"./time-D-gjmE1o.js";import{c as be,B as x}from"./button-Cq_zHETv.js";import{c as ke}from"./utils-CDN07tui.js";import{P as we}from"./page-header-FXPlo6az.js";import{S as Z}from"./select-12RThAXc.js";import{M as J}from"./Modal-ChvVUI3B.js";import{F as Q}from"./FieldGroup-BHc_5qNc.js";import{U as ee,T as q}from"./upload-B3k8WCSP.js";import{C as Ce}from"./check-C7xu-hGU.js";import{C as Ae}from"./copy-BIM0ZX0L.js";import{Z as Se}from"./zap-gBHqutZV.js";import{D as ze}from"./download-DDBRXnAZ.js";import{T as Me}from"./trash-2-B54e-TfY.js";import"./index-BQ2luT7L.js";/**
1
+ import{c as k,j as e,r as i,A as K,t as ve,b as je,X as p,O as fe,q as V,z as ye,v as ge}from"./index-BbKEXUFH.js";import{f as Ne}from"./time-D-gjmE1o.js";import{c as be,B as x}from"./button-Dda4irn_.js";import{c as ke}from"./utils-CDN07tui.js";import{P as we}from"./page-header-BjzgWz-T.js";import{S as Z}from"./select-88jHcl-Z.js";import{M as J}from"./Modal-CFCp3n9d.js";import{F as Q}from"./FieldGroup-Cb5QZsE1.js";import{U as ee,T as q}from"./upload-BG7_rMXK.js";import{C as Ce}from"./check-CZ9iw9-e.js";import{C as Ae}from"./copy-CAQydNFe.js";import{Z as Se}from"./zap-l4VaXzq8.js";import{D as ze}from"./download-C9XG6lLv.js";import{T as Me}from"./trash-2-C5RSuX0e.js";import"./index-DJGc1M2f.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -23,4 +23,4 @@ import{c as k,j as e,r as i,A as X,t as ve,b as je,X as p,K as fe,q as V,z as ye
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const Ue=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],W=k("rocket",Ue),Re=be("badge-base",{variants:{variant:{default:"badge-variant-default",success:"badge-variant-success",warning:"badge-variant-warning",error:"badge-variant-error",outline:"badge-variant-outline",secondary:"badge-variant-secondary"}},defaultVariants:{variant:"default"}});function Y({className:r,variant:c,...n}){return e.jsx("div",{className:ke(Re({variant:c}),r),...n})}const ae=({id:r,value:c,teams:n,onChange:m,disabled:h})=>e.jsxs(Z,{id:r,value:c,disabled:h,className:"w-full",onChange:l=>m(l.target.value),children:[e.jsx("option",{value:"",children:"Shared"}),n.map(l=>e.jsx("option",{value:l.id,children:l.name},l.id))]}),te="Members of the team can see and run it. Shared apps are open to everyone.",_e=({open:r,teams:c,teamId:n,onTeamChange:m,onChooseFile:h,onClose:l})=>e.jsx(J,{open:r,onClose:l,title:"Upload app",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",onClick:l,children:"Cancel"}),e.jsxs(x,{variant:"primary",onClick:h,children:[e.jsx(ee,{size:14,className:"mr-1"}),"Choose file…"]})]}),children:e.jsx(Q,{label:"Team",htmlFor:"upload-app-team",description:te,children:e.jsx(ae,{id:"upload-app-team",value:n,teams:c,onChange:m})})}),Le=({app:r,teams:c,onMove:n,onClose:m})=>{const[h,l]=i.useState(""),[d,f]=i.useState(!1),[y,u]=i.useState(null);i.useEffect(()=>{l((r==null?void 0:r.teamId)??""),u(null)},[r]);const g=async()=>{f(!0),u(null);try{await n(h||null)}catch(v){u((v==null?void 0:v.message)||"Could not move the app")}finally{f(!1)}};return e.jsxs(J,{open:!!r,onClose:m,title:"Move to team",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",onClick:m,disabled:d,children:"Cancel"}),e.jsxs(x,{variant:"primary",onClick:g,disabled:d,children:[d?e.jsx(X,{size:14,className:"mr-1 animate-spin"}):e.jsx(se,{size:14,className:"mr-1"}),"Move"]})]}),children:[e.jsx("p",{className:"app-move-name",children:r==null?void 0:r.name}),e.jsx(Q,{label:"Team",htmlFor:"move-app-team",description:te,error:y??void 0,children:e.jsx(ae,{id:"move-app-team",value:h,teams:c,onChange:l,disabled:d})})]})},K=r=>{var c;return((c=r.team)==null?void 0:c.name)??(r.teamId?String(r.teamId).slice(0,8):"Shared")},ss=()=>{const{toast:r,removeToast:c}=ve(),[n,m]=i.useState([]),[h,l]=i.useState([]),[d,f]=i.useState(!1),[y,u]=i.useState(""),[g,v]=i.useState(!1),[re,R]=i.useState(null),[w,_]=i.useState({android:!0,ios:!0}),[S,ie]=i.useState("desc"),[C,z]=i.useState(null),[M,T]=i.useState(""),D=i.useRef(null),{me:j}=je(),N=(j==null?void 0:j.role)==="ADMIN"||(j==null?void 0:j.role)==="SUPER_ADMIN",[L,B]=i.useState([]),[ne,I]=i.useState(!1),[E,G]=i.useState(""),[F,$]=i.useState(null),b=i.useCallback(async()=>{f(!0);try{const s=await p.getApps();m(Array.isArray(s)?s:[])}catch(s){console.error("Failed to fetch apps",s)}finally{f(!1)}},[]),U=i.useCallback(async()=>{try{const s=await p.getDevices();l(Array.isArray(s)?s:[])}catch(s){console.error("Failed to fetch devices",s)}},[]);i.useEffect(()=>{b(),U();const s=setInterval(U,1e4);return()=>clearInterval(s)},[b,U]),i.useEffect(()=>{N&&p.listTeams().then(B).catch(()=>B([]))},[N]);const O=()=>{var s;N?(G(""),I(!0)):(s=D.current)==null||s.click()},le=async s=>{F&&(await p.setAppTeam(F.id,s),r(s?"App moved to team":"App shared with everyone","success"),$(null),await b())},ce=async s=>{var o;const a=(o=s.target.files)==null?void 0:o[0];if(!a)return;const t=N&&E?E:null;I(!1),v(!0);try{await p.uploadApp(a,t),await b()}catch(ue){console.error("Upload failed",ue)}finally{v(!1),s.target&&(s.target.value="")}},oe=async(s,a)=>{if(window.confirm(`Permanently remove artifact "${a}"?`))try{await p.deleteApp(s),m(t=>t.filter(o=>o.id!==s))}catch(t){console.error("Delete failed",t)}},de=(s,a)=>{navigator.clipboard.writeText(s),R(`${a}-${s}`),setTimeout(()=>R(null),2e3)},me=async(s,a)=>{const t=r(`Deploying app to ${a}...`,"loading",0);try{const o=await p.installRepositoryApp(a,s);o.success?(r("App deployed successfully","success"),z(null),T("")):r(`Deployment failed: ${o.error}`,"error")}catch(o){r(`Execution Error: ${o.message}`,"error")}finally{c(t)}},A=n.filter(s=>{const a=s.name.toLowerCase().includes(y.toLowerCase())||s.packageName&&s.packageName.toLowerCase().includes(y.toLowerCase()),t=w.android&&s.platform==="android"||w.ios&&s.platform==="ios";return a&&t}).sort((s,a)=>{const t=new Date(s.createdAt).getTime(),o=new Date(a.createdAt).getTime();return S==="desc"?o-t:t-o}),he=s=>{if(!s)return"0 B";const a=1024,t=Math.floor(Math.log(s)/Math.log(a));return parseFloat((s/Math.pow(a,t)).toFixed(1))+" "+["B","KB","MB","GB"][t]},pe=s=>Ne(s),P=s=>{_(a=>({...a,[s]:!a[s]}))},xe=s=>{const a=s.toLowerCase();return a.includes("wda-signed")||a.includes("wda-resign")||a.includes("webdriveragent")};return e.jsxs("div",{className:"apps-container device-explorer-container",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsx(we,{icon:fe,title:"Apps",subtitle:"Signed builds available for installation across your device fleet."}),e.jsxs("div",{className:"device-explorer-header-container",children:[e.jsxs("div",{className:"device-explorer-header-left-container",children:[e.jsx("div",{className:"device-explorer-header-entry",children:e.jsxs("div",{className:"device-explorer-header-value",children:[e.jsxs("button",{className:`device-explorer-header__platform-btn ${w.android&&"selected"}`,onClick:()=>P("android"),children:[e.jsx(V,{size:18,color:"currentColor"})," Android"]}),e.jsxs("button",{className:`device-explorer-header__platform-btn ${w.ios&&"selected"}`,onClick:()=>P("ios"),children:[e.jsx(H,{size:18,color:"currentColor"})," iOS"]})]})}),e.jsx("div",{className:"device-explorer-header-entry",children:e.jsx("div",{className:"device-explorer-header-value",children:e.jsxs("div",{className:"device-explorer-search-wrapper",children:[e.jsx(ye,{size:16,color:"#94a3b8",className:"device-explorer-search-icon"}),e.jsx("input",{type:"text",className:"device-explorer-header-text-filter",placeholder:"Filter by bundle or name...",value:y,onChange:s=>u(s.target.value)})]})})}),e.jsx("div",{className:"device-explorer-header-filter-count",children:e.jsxs(Y,{variant:"secondary",children:[e.jsx("span",{className:"font-bold",children:A.length})," of"," ",e.jsx("span",{className:"font-bold",children:n.length})," ",n.length===1?"artifact":"artifacts"]})})]}),e.jsxs("div",{className:"device-explorer-header-right-container",children:[e.jsx("button",{className:"icon-btn-secondary sort-btn",onClick:()=>ie(s=>s==="desc"?"asc":"desc"),title:S==="desc"?"Newest First":"Oldest First",children:S==="desc"?e.jsx(Ie,{size:18}):e.jsx($e,{size:18})}),e.jsxs(x,{size:"sm",variant:"secondary",onClick:()=>b(),disabled:d,children:[e.jsx(X,{size:14,className:`mr-1 ${d&&"animate-spin"}`}),"Refresh"]}),e.jsx("input",{ref:D,type:"file",accept:".apk,.ipa",onChange:ce,hidden:!0}),e.jsxs(x,{size:"sm",variant:"primary",onClick:O,disabled:g,children:[e.jsx(ee,{size:14,className:"mr-1"}),"Upload app"]})]})]}),e.jsx("main",{className:"apps-registry-content",children:d&&n.length===0?e.jsxs("div",{className:"empty-data-vignette",children:[e.jsx("div",{className:"processing-loader"}),e.jsx("p",{className:"text-muted text-xs font-bold tracking-widest",children:"SYNCING REGISTRY..."})]}):e.jsxs(e.Fragment,{children:[A.length>0&&e.jsxs("div",{className:"registry-table-header",children:[e.jsx("div",{children:"Artifact bundle"}),e.jsx("div",{children:"Version"}),e.jsx("div",{children:"Size"}),e.jsx("div",{children:"Team"}),e.jsx("div",{children:"Registry date"}),e.jsx("div",{style:{textAlign:"right"},children:"Management"})]}),e.jsx("div",{className:"registry-list",children:A.map(s=>{const a=h.filter(t=>t.platform===s.platform&&!t.busy&&!t.offline);return e.jsxs("div",{className:`artifact-row ${s.platform}`,children:[e.jsxs("div",{className:"col-app-info",children:[e.jsx("div",{className:"app-platform-badge",children:s.platform==="android"?e.jsx(V,{size:18}):e.jsx(H,{size:18})}),e.jsxs("div",{className:"app-text-block",children:[e.jsxs("div",{className:"app-display-name",title:s.name,children:[s.name,xe(s.name)&&e.jsx(Y,{variant:"outline",className:"ml-2 text-[10px] h-4 py-0 border-primary text-primary",children:"WDA"})]}),e.jsxs("div",{className:"app-package-id",children:[e.jsx("code",{children:s.packageName||"internal.bundle"}),s.packageName&&e.jsx("div",{className:"copy-hint",title:`Copy ${s.packageName}`,onClick:()=>de(s.packageName,"pkg"),children:re===`pkg-${s.packageName}`?e.jsx(Ce,{size:10,className:"text-primary"}):e.jsx(Ae,{size:10})})]})]})]}),e.jsx("div",{className:"col-version",children:s.version||"v1.0.0"}),e.jsx("div",{className:"col-size",children:he(s.size)}),e.jsx("div",{className:"col-team",title:K(s),children:K(s)}),e.jsx("div",{className:"col-timestamp",children:pe(s.createdAt)}),e.jsxs("div",{className:"col-actions",children:[e.jsxs("div",{className:"deploy-anchor",children:[e.jsx("button",{className:`instant-deploy-trigger ${C===s.id&&"active"}`,onClick:()=>{C===s.id?(z(null),T("")):z(s.id)},children:C===s.id?e.jsxs(e.Fragment,{children:[e.jsx(ge,{size:12})," CANCEL"]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{size:12})," Deploy"]})}),C===s.id&&e.jsx("div",{className:"deployment-flyout",children:a.length>0?e.jsxs("div",{className:"deploy-actions-group",children:[e.jsxs(Z,{selectSize:"sm",className:"min-w-[280px]",autoFocus:!0,value:M,onChange:t=>T(t.target.value),children:[e.jsx("option",{value:"",children:"SELECT TARGET..."}),a.map(t=>e.jsxs("option",{value:t.udid,children:[t.name," (",t.udid,")"]},t.udid))]}),e.jsx("button",{className:"confirm-deploy-btn",disabled:!M,onClick:()=>me(s.id,M),title:"Confirm deployment",children:e.jsx(W,{size:14})})]}):e.jsx("div",{className:"target-device-select empty",children:"NO TARGETS"})})]}),e.jsx("button",{className:"utility-icon-btn",onClick:()=>window.open(`/xenon/api/apps/${s.id}/download`,"_blank"),children:e.jsx(ze,{size:14})}),N&&e.jsx("button",{className:"utility-icon-btn","aria-label":`Move ${s.name} to team`,title:"Move to team",onClick:()=>$(s),children:e.jsx(se,{size:14})}),e.jsx("button",{className:"utility-icon-btn danger",onClick:()=>oe(s.id,s.name),children:e.jsx(Me,{size:14})})]})]},s.id)})}),A.length===0&&n.length>0&&!d&&e.jsxs("div",{className:"empty-registry-technical",children:[e.jsx("div",{className:"empty-icon-container",children:e.jsx(q,{size:48,className:"text-primary opacity-40"})}),e.jsx("h2",{className:"empty-title brand-font",children:"No matching artifacts"}),e.jsxs("p",{className:"empty-description",children:[n.length," ",n.length===1?"artifact is":"artifacts are"," registered, but none match the current filter."]}),e.jsx("div",{className:"empty-actions",children:e.jsx(x,{size:"sm",variant:"default",onClick:()=>{u(""),_({android:!0,ios:!0})},children:"Clear filters"})})]}),n.length===0&&!d&&e.jsxs("div",{className:"empty-registry-technical",children:[e.jsx("div",{className:"empty-icon-container",children:e.jsx(q,{size:48,className:"text-primary opacity-40 animate-pulse"})}),e.jsx("h2",{className:"empty-title brand-font",children:"No apps yet"}),e.jsxs("p",{className:"empty-description",children:["Upload ",e.jsx("code",{className:"text-primary",children:".apk"})," or"," ",e.jsx("code",{className:"text-primary",children:".ipa"})," artifacts to enable versioned installs across your device fleet."]}),e.jsx("div",{className:"empty-actions",children:e.jsx("button",{type:"button",className:"upload-trigger-massive",onClick:O,disabled:g,children:e.jsxs("span",{className:"massive-upload-content",children:[e.jsx(W,{size:24,className:"mb-2"}),e.jsx("span",{children:"Upload your first app"})]})})})]})]})}),e.jsx(_e,{open:ne,teams:L,teamId:E,onTeamChange:G,onChooseFile:()=>{var s;return(s=D.current)==null?void 0:s.click()},onClose:()=>I(!1)}),e.jsx(Le,{app:F,teams:L,onMove:le,onClose:()=>$(null)}),g&&e.jsx("div",{className:"upload-overlay-technical",children:e.jsxs("div",{className:"upload-card-technical",children:[e.jsx("div",{className:"processing-loader"}),e.jsx("h2",{className:"brand-font",style:{fontSize:"20px",marginBottom:"8px"},children:"Artifact ingestion"}),e.jsx("p",{className:"text-muted text-xs",children:"VERIFYING CHECKSUM & DEPLOYING TO REGISTRY..."})]})})]})};export{ss as default};
26
+ */const Ue=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],W=k("rocket",Ue),Re=be("badge-base",{variants:{variant:{default:"badge-variant-default",success:"badge-variant-success",warning:"badge-variant-warning",error:"badge-variant-error",outline:"badge-variant-outline",secondary:"badge-variant-secondary"}},defaultVariants:{variant:"default"}});function Y({className:r,variant:c,...n}){return e.jsx("div",{className:ke(Re({variant:c}),r),...n})}const ae=({id:r,value:c,teams:n,onChange:m,disabled:h})=>e.jsxs(Z,{id:r,value:c,disabled:h,className:"w-full",onChange:l=>m(l.target.value),children:[e.jsx("option",{value:"",children:"Shared"}),n.map(l=>e.jsx("option",{value:l.id,children:l.name},l.id))]}),te="Members of the team can see and run it. Shared apps are open to everyone.",_e=({open:r,teams:c,teamId:n,onTeamChange:m,onChooseFile:h,onClose:l})=>e.jsx(J,{open:r,onClose:l,title:"Upload app",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",onClick:l,children:"Cancel"}),e.jsxs(x,{variant:"primary",onClick:h,children:[e.jsx(ee,{size:14,className:"mr-1"}),"Choose file…"]})]}),children:e.jsx(Q,{label:"Team",htmlFor:"upload-app-team",description:te,children:e.jsx(ae,{id:"upload-app-team",value:n,teams:c,onChange:m})})}),Le=({app:r,teams:c,onMove:n,onClose:m})=>{const[h,l]=i.useState(""),[d,f]=i.useState(!1),[y,u]=i.useState(null);i.useEffect(()=>{l((r==null?void 0:r.teamId)??""),u(null)},[r]);const g=async()=>{f(!0),u(null);try{await n(h||null)}catch(v){u((v==null?void 0:v.message)||"Could not move the app")}finally{f(!1)}};return e.jsxs(J,{open:!!r,onClose:m,title:"Move to team",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",onClick:m,disabled:d,children:"Cancel"}),e.jsxs(x,{variant:"primary",onClick:g,disabled:d,children:[d?e.jsx(K,{size:14,className:"mr-1 animate-spin"}):e.jsx(se,{size:14,className:"mr-1"}),"Move"]})]}),children:[e.jsx("p",{className:"app-move-name",children:r==null?void 0:r.name}),e.jsx(Q,{label:"Team",htmlFor:"move-app-team",description:te,error:y??void 0,children:e.jsx(ae,{id:"move-app-team",value:h,teams:c,onChange:l,disabled:d})})]})},X=r=>{var c;return((c=r.team)==null?void 0:c.name)??(r.teamId?String(r.teamId).slice(0,8):"Shared")},ss=()=>{const{toast:r,removeToast:c}=ve(),[n,m]=i.useState([]),[h,l]=i.useState([]),[d,f]=i.useState(!1),[y,u]=i.useState(""),[g,v]=i.useState(!1),[re,R]=i.useState(null),[w,_]=i.useState({android:!0,ios:!0}),[S,ie]=i.useState("desc"),[C,z]=i.useState(null),[M,T]=i.useState(""),D=i.useRef(null),{me:j}=je(),N=(j==null?void 0:j.role)==="ADMIN"||(j==null?void 0:j.role)==="SUPER_ADMIN",[L,B]=i.useState([]),[ne,I]=i.useState(!1),[E,O]=i.useState(""),[F,$]=i.useState(null),b=i.useCallback(async()=>{f(!0);try{const s=await p.getApps();m(Array.isArray(s)?s:[])}catch(s){console.error("Failed to fetch apps",s)}finally{f(!1)}},[]),U=i.useCallback(async()=>{try{const s=await p.getDevices();l(Array.isArray(s)?s:[])}catch(s){console.error("Failed to fetch devices",s)}},[]);i.useEffect(()=>{b(),U();const s=setInterval(U,1e4);return()=>clearInterval(s)},[b,U]),i.useEffect(()=>{N&&p.listTeams().then(B).catch(()=>B([]))},[N]);const G=()=>{var s;N?(O(""),I(!0)):(s=D.current)==null||s.click()},le=async s=>{F&&(await p.setAppTeam(F.id,s),r(s?"App moved to team":"App shared with everyone","success"),$(null),await b())},ce=async s=>{var o;const a=(o=s.target.files)==null?void 0:o[0];if(!a)return;const t=N&&E?E:null;I(!1),v(!0);try{await p.uploadApp(a,t),await b()}catch(ue){console.error("Upload failed",ue)}finally{v(!1),s.target&&(s.target.value="")}},oe=async(s,a)=>{if(window.confirm(`Permanently remove artifact "${a}"?`))try{await p.deleteApp(s),m(t=>t.filter(o=>o.id!==s))}catch(t){console.error("Delete failed",t)}},de=(s,a)=>{navigator.clipboard.writeText(s),R(`${a}-${s}`),setTimeout(()=>R(null),2e3)},me=async(s,a)=>{const t=r(`Deploying app to ${a}...`,"loading",0);try{const o=await p.installRepositoryApp(a,s);o.success?(r("App deployed successfully","success"),z(null),T("")):r(`Deployment failed: ${o.error}`,"error")}catch(o){r(`Execution Error: ${o.message}`,"error")}finally{c(t)}},A=n.filter(s=>{const a=s.name.toLowerCase().includes(y.toLowerCase())||s.packageName&&s.packageName.toLowerCase().includes(y.toLowerCase()),t=w.android&&s.platform==="android"||w.ios&&s.platform==="ios";return a&&t}).sort((s,a)=>{const t=new Date(s.createdAt).getTime(),o=new Date(a.createdAt).getTime();return S==="desc"?o-t:t-o}),he=s=>{if(!s)return"0 B";const a=1024,t=Math.floor(Math.log(s)/Math.log(a));return parseFloat((s/Math.pow(a,t)).toFixed(1))+" "+["B","KB","MB","GB"][t]},pe=s=>Ne(s),P=s=>{_(a=>({...a,[s]:!a[s]}))},xe=s=>{const a=s.toLowerCase();return a.includes("wda-signed")||a.includes("wda-resign")||a.includes("webdriveragent")};return e.jsxs("div",{className:"apps-container device-explorer-container",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsx(we,{icon:fe,title:"Apps",subtitle:"Signed builds available for installation across your device fleet."}),e.jsxs("div",{className:"device-explorer-header-container",children:[e.jsxs("div",{className:"device-explorer-header-left-container",children:[e.jsx("div",{className:"device-explorer-header-entry",children:e.jsxs("div",{className:"device-explorer-header-value",children:[e.jsxs("button",{className:`device-explorer-header__platform-btn ${w.android&&"selected"}`,onClick:()=>P("android"),children:[e.jsx(V,{size:18,color:"currentColor"})," Android"]}),e.jsxs("button",{className:`device-explorer-header__platform-btn ${w.ios&&"selected"}`,onClick:()=>P("ios"),children:[e.jsx(H,{size:18,color:"currentColor"})," iOS"]})]})}),e.jsx("div",{className:"device-explorer-header-entry",children:e.jsx("div",{className:"device-explorer-header-value",children:e.jsxs("div",{className:"device-explorer-search-wrapper",children:[e.jsx(ye,{size:16,color:"#94a3b8",className:"device-explorer-search-icon"}),e.jsx("input",{type:"text",className:"device-explorer-header-text-filter",placeholder:"Filter by bundle or name...",value:y,onChange:s=>u(s.target.value)})]})})}),e.jsx("div",{className:"device-explorer-header-filter-count",children:e.jsxs(Y,{variant:"secondary",children:[e.jsx("span",{className:"font-bold",children:A.length})," of"," ",e.jsx("span",{className:"font-bold",children:n.length})," ",n.length===1?"artifact":"artifacts"]})})]}),e.jsxs("div",{className:"device-explorer-header-right-container",children:[e.jsx("button",{className:"icon-btn-secondary sort-btn",onClick:()=>ie(s=>s==="desc"?"asc":"desc"),title:S==="desc"?"Newest First":"Oldest First",children:S==="desc"?e.jsx(Ie,{size:18}):e.jsx($e,{size:18})}),e.jsxs(x,{size:"sm",variant:"secondary",onClick:()=>b(),disabled:d,children:[e.jsx(K,{size:14,className:`mr-1 ${d&&"animate-spin"}`}),"Refresh"]}),e.jsx("input",{ref:D,type:"file",accept:".apk,.ipa",onChange:ce,hidden:!0}),e.jsxs(x,{size:"sm",variant:"primary",onClick:G,disabled:g,children:[e.jsx(ee,{size:14,className:"mr-1"}),"Upload app"]})]})]}),e.jsx("main",{className:"apps-registry-content",children:d&&n.length===0?e.jsxs("div",{className:"empty-data-vignette",children:[e.jsx("div",{className:"processing-loader"}),e.jsx("p",{className:"text-muted text-xs font-bold tracking-widest",children:"SYNCING REGISTRY..."})]}):e.jsxs(e.Fragment,{children:[A.length>0&&e.jsxs("div",{className:"registry-table-header",children:[e.jsx("div",{children:"Artifact bundle"}),e.jsx("div",{children:"Version"}),e.jsx("div",{children:"Size"}),e.jsx("div",{children:"Team"}),e.jsx("div",{children:"Registry date"}),e.jsx("div",{style:{textAlign:"right"},children:"Management"})]}),e.jsx("div",{className:"registry-list",children:A.map(s=>{const a=h.filter(t=>t.platform===s.platform&&!t.busy&&!t.offline);return e.jsxs("div",{className:`artifact-row ${s.platform}`,children:[e.jsxs("div",{className:"col-app-info",children:[e.jsx("div",{className:"app-platform-badge",children:s.platform==="android"?e.jsx(V,{size:18}):e.jsx(H,{size:18})}),e.jsxs("div",{className:"app-text-block",children:[e.jsxs("div",{className:"app-display-name",title:s.name,children:[s.name,xe(s.name)&&e.jsx(Y,{variant:"outline",className:"ml-2 text-[10px] h-4 py-0 border-primary text-primary",children:"WDA"})]}),e.jsxs("div",{className:"app-package-id",children:[e.jsx("code",{children:s.packageName||"internal.bundle"}),s.packageName&&e.jsx("div",{className:"copy-hint",title:`Copy ${s.packageName}`,onClick:()=>de(s.packageName,"pkg"),children:re===`pkg-${s.packageName}`?e.jsx(Ce,{size:10,className:"text-primary"}):e.jsx(Ae,{size:10})})]})]})]}),e.jsx("div",{className:"col-version",children:s.version||"v1.0.0"}),e.jsx("div",{className:"col-size",children:he(s.size)}),e.jsx("div",{className:"col-team",title:X(s),children:X(s)}),e.jsx("div",{className:"col-timestamp",children:pe(s.createdAt)}),e.jsxs("div",{className:"col-actions",children:[e.jsxs("div",{className:"deploy-anchor",children:[e.jsx("button",{className:`instant-deploy-trigger ${C===s.id&&"active"}`,onClick:()=>{C===s.id?(z(null),T("")):z(s.id)},children:C===s.id?e.jsxs(e.Fragment,{children:[e.jsx(ge,{size:12})," CANCEL"]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{size:12})," Deploy"]})}),C===s.id&&e.jsx("div",{className:"deployment-flyout",children:a.length>0?e.jsxs("div",{className:"deploy-actions-group",children:[e.jsxs(Z,{selectSize:"sm",className:"min-w-[280px]",autoFocus:!0,value:M,onChange:t=>T(t.target.value),children:[e.jsx("option",{value:"",children:"SELECT TARGET..."}),a.map(t=>e.jsxs("option",{value:t.udid,children:[t.name," (",t.udid,")"]},t.udid))]}),e.jsx("button",{className:"confirm-deploy-btn",disabled:!M,onClick:()=>me(s.id,M),title:"Confirm deployment",children:e.jsx(W,{size:14})})]}):e.jsx("div",{className:"target-device-select empty",children:"NO TARGETS"})})]}),e.jsx("button",{className:"utility-icon-btn",onClick:()=>window.open(`/xenon/api/apps/${s.id}/download`,"_blank"),children:e.jsx(ze,{size:14})}),N&&e.jsx("button",{className:"utility-icon-btn","aria-label":`Move ${s.name} to team`,title:"Move to team",onClick:()=>$(s),children:e.jsx(se,{size:14})}),e.jsx("button",{className:"utility-icon-btn danger",onClick:()=>oe(s.id,s.name),children:e.jsx(Me,{size:14})})]})]},s.id)})}),A.length===0&&n.length>0&&!d&&e.jsxs("div",{className:"empty-registry-technical",children:[e.jsx("div",{className:"empty-icon-container",children:e.jsx(q,{size:48,className:"text-primary opacity-40"})}),e.jsx("h2",{className:"empty-title brand-font",children:"No matching artifacts"}),e.jsxs("p",{className:"empty-description",children:[n.length," ",n.length===1?"artifact is":"artifacts are"," registered, but none match the current filter."]}),e.jsx("div",{className:"empty-actions",children:e.jsx(x,{size:"sm",variant:"default",onClick:()=>{u(""),_({android:!0,ios:!0})},children:"Clear filters"})})]}),n.length===0&&!d&&e.jsxs("div",{className:"empty-registry-technical",children:[e.jsx("div",{className:"empty-icon-container",children:e.jsx(q,{size:48,className:"text-primary opacity-40 animate-pulse"})}),e.jsx("h2",{className:"empty-title brand-font",children:"No apps yet"}),e.jsxs("p",{className:"empty-description",children:["Upload ",e.jsx("code",{className:"text-primary",children:".apk"})," or"," ",e.jsx("code",{className:"text-primary",children:".ipa"})," artifacts to enable versioned installs across your device fleet."]}),e.jsx("div",{className:"empty-actions",children:e.jsx("button",{type:"button",className:"upload-trigger-massive",onClick:G,disabled:g,children:e.jsxs("span",{className:"massive-upload-content",children:[e.jsx(W,{size:24,className:"mb-2"}),e.jsx("span",{children:"Upload your first app"})]})})})]})]})}),e.jsx(_e,{open:ne,teams:L,teamId:E,onTeamChange:O,onChooseFile:()=>{var s;return(s=D.current)==null?void 0:s.click()},onClose:()=>I(!1)}),e.jsx(Le,{app:F,teams:L,onMove:le,onClose:()=>$(null)}),g&&e.jsx("div",{className:"upload-overlay-technical",children:e.jsxs("div",{className:"upload-card-technical",children:[e.jsx("div",{className:"processing-loader"}),e.jsx("h2",{className:"brand-font",style:{fontSize:"20px",marginBottom:"8px"},children:"Artifact ingestion"}),e.jsx("p",{className:"text-muted text-xs",children:"VERIFYING CHECKSUM & DEPLOYING TO REGISTRY..."})]})})]})};export{ss as default};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-BGBqohfQ.js";/**
1
+ import{c as o}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-BGBqohfQ.js";/**
1
+ import{c as o}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-BGBqohfQ.js";/**
1
+ import{c as o}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,6 +1,6 @@
1
- import{c as i,j as e,n,S as o}from"./index-BGBqohfQ.js";import{N as l}from"./network-C5e0MIWo.js";/**
1
+ import{c as i,j as e,n,S as o}from"./index-BbKEXUFH.js";import{N as l}from"./network-ebT86qoi.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const d=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],c=i("monitor-smartphone",d),x=[{icon:o,title:"Self-healing selectors",body:"Broken locators recover through six escalating tiers before a test fails."},{icon:c,title:"Live Android & iOS devices",body:"Watch, drive and record real devices from the browser."},{icon:l,title:"Hub–node scaling",body:"One hub orchestrates device labs across machines."}];function b({children:t}){return e.jsxs("div",{className:"grid min-h-screen w-full grid-cols-1 bg-[var(--bg)] text-[var(--text)] md:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]",children:[e.jsxs("aside",{className:"relative hidden overflow-hidden border-r border-[rgb(var(--rgb-fg)/0.06)] bg-[var(--surface-sunken)] md:flex md:flex-col",children:[e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_90%_60%_at_0%_0%,rgb(var(--rgb-accent)/0.14),transparent_60%)]"}),e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-[linear-gradient(to_right,rgb(var(--rgb-white)/0.03)_1px,transparent_1px),linear-gradient(to_bottom,rgb(var(--rgb-white)/0.03)_1px,transparent_1px)] bg-[size:48px_48px] [mask-image:linear-gradient(to_bottom,black,transparent_85%)]"}),e.jsxs("div",{className:"relative flex flex-1 flex-col justify-between px-12 py-10",children:[e.jsx(n,{className:"h-8 w-auto self-start object-contain"}),e.jsxs("div",{className:"max-w-md",children:[e.jsxs("h2",{className:"text-4xl font-semibold leading-tight tracking-tight",children:["Your device lab,",e.jsx("br",{}),e.jsx("span",{className:"text-[var(--color-accent)]",children:"under control."})]}),e.jsx("p",{className:"mt-4 text-sm leading-relaxed text-[var(--text-muted)]",children:"Appium orchestration for the devices you own — with self-healing tests, live streaming and recordable proof of what ran."}),e.jsx("ul",{className:"mt-10 space-y-6",children:x.map(({icon:a,title:r,body:s})=>e.jsxs("li",{className:"flex gap-4",children:[e.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-[var(--accent-border)] bg-[var(--accent-subtle)]",children:e.jsx(a,{className:"h-4 w-4 text-[var(--color-accent)]","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text)]",children:r}),e.jsx("div",{className:"mt-0.5 text-sm text-[var(--text-muted)]",children:s})]})]},r))})]}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-[rgb(var(--rgb-fg)/0.06)] pt-5 text-xs text-[var(--text-muted)]",children:[e.jsxs("span",{children:["Xenon v","2.13.1"," · Self-hosted device lab"]}),e.jsx("a",{href:"/xenon/api-docs",target:"_blank",rel:"noreferrer",className:"text-[var(--text-muted)] underline-offset-4 hover:text-[var(--text)] hover:underline",children:"API docs"})]})]})]}),e.jsx("main",{className:"flex items-center justify-center px-6 py-10",children:e.jsx("div",{className:"w-full max-w-[400px] rounded-xl border border-[var(--border)] bg-[var(--surface)] px-8 py-9 shadow-[var(--shadow-lg)]",children:t})})]})}export{b as A};
6
+ */const d=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],c=i("monitor-smartphone",d),x=[{icon:o,title:"Self-healing selectors",body:"Broken locators recover through six escalating tiers before a test fails."},{icon:c,title:"Live Android & iOS devices",body:"Watch, drive and record real devices from the browser."},{icon:l,title:"Hub–node scaling",body:"One hub orchestrates device labs across machines."}];function b({children:t}){return e.jsxs("div",{className:"grid min-h-screen w-full grid-cols-1 bg-[var(--bg)] text-[var(--text)] md:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]",children:[e.jsxs("aside",{className:"relative hidden overflow-hidden border-r border-[rgb(var(--rgb-fg)/0.06)] bg-[var(--surface-sunken)] md:flex md:flex-col",children:[e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_90%_60%_at_0%_0%,rgb(var(--rgb-accent)/0.14),transparent_60%)]"}),e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-[linear-gradient(to_right,rgb(var(--rgb-white)/0.03)_1px,transparent_1px),linear-gradient(to_bottom,rgb(var(--rgb-white)/0.03)_1px,transparent_1px)] bg-[size:48px_48px] [mask-image:linear-gradient(to_bottom,black,transparent_85%)]"}),e.jsxs("div",{className:"relative flex flex-1 flex-col justify-between px-12 py-10",children:[e.jsx(n,{className:"h-8 w-auto self-start object-contain"}),e.jsxs("div",{className:"max-w-md",children:[e.jsxs("h2",{className:"text-4xl font-semibold leading-tight tracking-tight",children:["Your device lab,",e.jsx("br",{}),e.jsx("span",{className:"text-[var(--color-accent)]",children:"under control."})]}),e.jsx("p",{className:"mt-4 text-sm leading-relaxed text-[var(--text-muted)]",children:"Appium orchestration for the devices you own — with self-healing tests, live streaming and recordable proof of what ran."}),e.jsx("ul",{className:"mt-10 space-y-6",children:x.map(({icon:a,title:r,body:s})=>e.jsxs("li",{className:"flex gap-4",children:[e.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-[var(--accent-border)] bg-[var(--accent-subtle)]",children:e.jsx(a,{className:"h-4 w-4 text-[var(--color-accent)]","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text)]",children:r}),e.jsx("div",{className:"mt-0.5 text-sm text-[var(--text-muted)]",children:s})]})]},r))})]}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-[rgb(var(--rgb-fg)/0.06)] pt-5 text-xs text-[var(--text-muted)]",children:[e.jsxs("span",{children:["Xenon v","2.14.0"," · Self-hosted device lab"]}),e.jsx("a",{href:"/xenon/api-docs",target:"_blank",rel:"noreferrer",className:"text-[var(--text-muted)] underline-offset-4 hover:text-[var(--text)] hover:underline",children:"API docs"})]})]})]}),e.jsx("main",{className:"flex items-center justify-center px-6 py-10",children:e.jsx("div",{className:"w-full max-w-[400px] rounded-xl border border-[var(--border)] bg-[var(--surface)] px-8 py-9 shadow-[var(--shadow-lg)]",children:t})})]})}export{b as A};
@@ -1,4 +1,4 @@
1
- import{c as ee,r as h,p as te,X,j as e,z as V,R as _,f as se,T as ae,q as re,u as ne,i as le,t as oe,M as ie}from"./index-BGBqohfQ.js";import{s as ce,b as L,P as de,T as B,i as xe,f as q,a as ue,c as me,d as pe,p as he,e as fe,r as ve,C as be,g as ge,h as je,j as A,k as Ne,l as W,S as we,m as ye,n as Se,u as Ce,o as $e}from"./use-builds-data-BFn90NH3.js";import{I as J}from"./input-BvB1cjHE.js";import{L as ke,a as Me}from"./list-checks-cY7o1QTL.js";import{B as O}from"./button-Cq_zHETv.js";import{D as Ee}from"./download-DDBRXnAZ.js";import{s as Te}from"./labels-C21SA4JG.js";import{C as Re}from"./circle-x-6gMRcx6z.js";import{C as Be}from"./circle-check-CyBjjPxR.js";import{C as Le}from"./chevron-right-BiqfdCGA.js";import{T as Ie}from"./tablet-Dj30VGZl.js";import{M as _e}from"./monitor-C4HPHb6s.js";import{S}from"./stat-tile-B02WEte8.js";import{P as De}from"./page-header-FXPlo6az.js";import{S as Ae}from"./select-12RThAXc.js";import{E as F}from"./EmptyState-CgzbuUvO.js";import"./time-D-gjmE1o.js";import"./utils-CDN07tui.js";/**
1
+ import{c as ee,r as h,p as te,X,j as e,z as V,R as _,f as se,T as ae,q as re,u as ne,i as le,t as oe,M as ie}from"./index-BbKEXUFH.js";import{s as ce,b as L,P as de,T as B,i as xe,f as q,a as ue,c as me,d as pe,p as he,e as fe,r as ve,C as be,g as ge,h as je,j as A,k as Ne,l as W,S as we,m as ye,n as Se,u as Ce,o as $e}from"./use-builds-data-J-riQYyC.js";import{I as J}from"./input-Cm0tmSoc.js";import{L as ke,a as Me}from"./list-checks-UWf1GY99.js";import{B as O}from"./button-Dda4irn_.js";import{D as Ee}from"./download-C9XG6lLv.js";import{s as Te}from"./labels-C21SA4JG.js";import{C as Re}from"./circle-x-DlDJtnVz.js";import{C as Be}from"./circle-check-CqAJjQ5O.js";import{C as Le}from"./chevron-right-BRYJJVC9.js";import{T as Ie}from"./tablet-BiAsnFDj.js";import{M as _e}from"./monitor-B2jDgwm7.js";import{S}from"./stat-tile-BV98e_Sv.js";import{P as De}from"./page-header-BjzgWz-T.js";import{S as Ae}from"./select-88jHcl-Z.js";import{E as F}from"./EmptyState-BSjhk_IV.js";import"./time-D-gjmE1o.js";import"./utils-CDN07tui.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as x,j as z}from"./index-BGBqohfQ.js";import{a as j,c as g}from"./utils-CDN07tui.js";const v=a=>typeof a=="boolean"?`${a}`:a===0?"0":a,b=j,k=(a,e)=>t=>{var l;if((e==null?void 0:e.variants)==null)return b(a,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:d,defaultVariants:r}=e,y=Object.keys(d).map(n=>{const s=t==null?void 0:t[n],o=r==null?void 0:r[n];if(s===null)return null;const i=v(s)||v(o);return d[n][i]}),c=t&&Object.entries(t).reduce((n,s)=>{let[o,i]=s;return i===void 0||(n[o]=i),n},{}),f=e==null||(l=e.compoundVariants)===null||l===void 0?void 0:l.reduce((n,s)=>{let{class:o,className:i,...V}=s;return Object.entries(V).every(N=>{let[m,u]=N;return Array.isArray(u)?u.includes({...r,...c}[m]):{...r,...c}[m]===u})?[...n,o,i]:n},[]);return b(a,y,f,t==null?void 0:t.class,t==null?void 0:t.className)},C=k("btn-base",{variants:{variant:{default:"btn-primary",primary:"btn-primary",secondary:"btn-secondary",outline:"btn-secondary",ghost:"btn-ghost",tonal:"btn-tonal",link:"btn-link",destructive:"btn-danger",danger:"btn-danger"},size:{default:"btn-size-md",md:"btn-size-md",sm:"btn-size-sm",lg:"btn-size-lg",icon:"btn-size-icon"}},defaultVariants:{variant:"primary",size:"md"}}),O=x.forwardRef(({className:a,variant:e,size:t,...l},d)=>z.jsx("button",{className:g(C({variant:e,size:t,className:a})),ref:d,...l}));O.displayName="Button";export{O as B,k as c};
1
+ import{r as x,j as z}from"./index-BbKEXUFH.js";import{a as j,c as g}from"./utils-CDN07tui.js";const v=a=>typeof a=="boolean"?`${a}`:a===0?"0":a,b=j,k=(a,e)=>t=>{var l;if((e==null?void 0:e.variants)==null)return b(a,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:d,defaultVariants:r}=e,y=Object.keys(d).map(n=>{const s=t==null?void 0:t[n],o=r==null?void 0:r[n];if(s===null)return null;const i=v(s)||v(o);return d[n][i]}),c=t&&Object.entries(t).reduce((n,s)=>{let[o,i]=s;return i===void 0||(n[o]=i),n},{}),f=e==null||(l=e.compoundVariants)===null||l===void 0?void 0:l.reduce((n,s)=>{let{class:o,className:i,...V}=s;return Object.entries(V).every(N=>{let[m,u]=N;return Array.isArray(u)?u.includes({...r,...c}[m]):{...r,...c}[m]===u})?[...n,o,i]:n},[]);return b(a,y,f,t==null?void 0:t.class,t==null?void 0:t.className)},C=k("btn-base",{variants:{variant:{default:"btn-primary",primary:"btn-primary",secondary:"btn-secondary",outline:"btn-secondary",ghost:"btn-ghost",tonal:"btn-tonal",link:"btn-link",destructive:"btn-danger",danger:"btn-danger"},size:{default:"btn-size-md",md:"btn-size-md",sm:"btn-size-sm",lg:"btn-size-lg",icon:"btn-size-icon"}},defaultVariants:{variant:"primary",size:"md"}}),O=x.forwardRef(({className:a,variant:e,size:t,...l},d)=>z.jsx("button",{className:g(C({variant:e,size:t,className:a})),ref:d,...l}));O.displayName="Button";export{O as B,k as c};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-BGBqohfQ.js";/**
1
+ import{c as e}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-BGBqohfQ.js";/**
1
+ import{c}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-BGBqohfQ.js";/**
1
+ import{c as o}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-BGBqohfQ.js";/**
1
+ import{c}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-BGBqohfQ.js";/**
1
+ import{c}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-BGBqohfQ.js";/**
1
+ import{c}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-BGBqohfQ.js";/**
1
+ import{c}from"./index-BbKEXUFH.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.