@xenon-device-management/xenon 2.11.0 → 2.12.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 (96) hide show
  1. package/lib/package.json +1 -1
  2. package/lib/public/assets/{AnnotationOverlay-BQPQ5bPF.js → AnnotationOverlay-Crkn72_3.js} +1 -1
  3. package/lib/public/assets/{ApiKeyGate-Bd7Pumwv.js → ApiKeyGate-BThVlj_j.js} +1 -1
  4. package/lib/public/assets/{BugReportButton-iC7fxPxl.js → BugReportButton-Dwa0GnBh.js} +1 -1
  5. package/lib/public/assets/DeviceMosaicView-Ccc-pOls.js +2 -0
  6. package/lib/public/assets/{EmptyState-wZeJbGhN.js → EmptyState-BeuTrlN_.js} +1 -1
  7. package/lib/public/assets/{FieldGroup-tpRfmhlE.js → FieldGroup-DBIaNxl1.js} +1 -1
  8. package/lib/public/assets/{FilterMenu-BZwOppId.js → FilterMenu-BgSAS6iT.js} +1 -1
  9. package/lib/public/assets/{Menu-CahoAx8L.js → Menu-GCbP6gYN.js} +1 -1
  10. package/lib/public/assets/{Modal-mcM5W_Ji.js → Modal-ByESeBRC.js} +1 -1
  11. package/lib/public/assets/RecordingPage-Bwyf3WMl.js +1 -0
  12. package/lib/public/assets/{RecordingsPage-BOez3f_9.js → RecordingsPage-7kM1rB3i.js} +2 -2
  13. package/lib/public/assets/{SegmentedControl-qMSiMN1d.js → SegmentedControl-B8tTU8kD.js} +1 -1
  14. package/lib/public/assets/{SettingCard-rcPtJ7HG.js → SettingCard-Clg_Ijbc.js} +1 -1
  15. package/lib/public/assets/{Table-J3uognu0.js → Table-CIaR0QWV.js} +1 -1
  16. package/lib/public/assets/{activity-_5pNSfKT.js → activity-Bengh9SD.js} +1 -1
  17. package/lib/public/assets/{ai-settings-DTPRbkei.js → ai-settings-G9SymiPH.js} +2 -2
  18. package/lib/public/assets/{api-keys-CxkIUo76.js → api-keys-CrGlbfn-.js} +1 -1
  19. package/lib/public/assets/{apps-Bv0pAfxz.js → apps-DIbcGVlU.js} +3 -3
  20. package/lib/public/assets/{arrow-left-uY7F6z1K.js → arrow-left-BtJIXXMY.js} +1 -1
  21. package/lib/public/assets/{arrow-right-BbAm_2Wa.js → arrow-right-zm-NagQh.js} +1 -1
  22. package/lib/public/assets/{arrow-up-right-x4H5NuvE.js → arrow-up-right-DdU8YEYp.js} +1 -1
  23. package/lib/public/assets/{auth-shell-CtMFhbnC.js → auth-shell-CHmBFmOz.js} +2 -2
  24. package/lib/public/assets/{builds-page-B_O5uBSZ.js → builds-page-JkzWKRpU.js} +1 -1
  25. package/lib/public/assets/{button-CQoMQEj_.js → button-CqhPBGRj.js} +1 -1
  26. package/lib/public/assets/{calendar-BZkpCqlL.js → calendar-C7eYYJTo.js} +1 -1
  27. package/lib/public/assets/{check-CAB6RYuc.js → check-DpbIM4E0.js} +1 -1
  28. package/lib/public/assets/{chevron-right-ec0unu3u.js → chevron-right-Dl4X1PRz.js} +1 -1
  29. package/lib/public/assets/{circle-check-Dfg-gpjg.js → circle-check-Du3sjbfV.js} +1 -1
  30. package/lib/public/assets/{circle-x-cbPq6Btp.js → circle-x-BSSqhpXi.js} +1 -1
  31. package/lib/public/assets/{clock-DU9cBLi8.js → clock-DMT60v1C.js} +1 -1
  32. package/lib/public/assets/{copy-VM9kWPpE.js → copy-BKNyOehd.js} +1 -1
  33. package/lib/public/assets/device-explorer-CHv1miyr.css +1 -0
  34. package/lib/public/assets/device-explorer-CoPR8DW3.js +279 -0
  35. package/lib/public/assets/{download-WgW4AVid.js → download-BM6Xn22t.js} +1 -1
  36. package/lib/public/assets/{forgot-password-BGRpjTtt.js → forgot-password-B8WqMqBT.js} +1 -1
  37. package/lib/public/assets/{index-DQa193-A.css → index-BTYMAqNW.css} +1 -1
  38. package/lib/public/assets/index-ClrpAMAT.js +219 -0
  39. package/lib/public/assets/{index-DNDdHt3h.js → index-DauQh6ie.js} +1 -1
  40. package/lib/public/assets/{input-DwiVcO3Q.js → input-CyKdLnEx.js} +1 -1
  41. package/lib/public/assets/{line-chart-PE5e9PeN.js → line-chart-EIBXwYGo.js} +1 -1
  42. package/lib/public/assets/{list-checks-Bgn9GEEO.js → list-checks-fWsgD9bI.js} +1 -1
  43. package/lib/public/assets/{lock-Cb7My6hc.js → lock-CVCe56TH.js} +1 -1
  44. package/lib/public/assets/{login-CDmyzSpl.js → login-BJ8a7yVD.js} +1 -1
  45. package/lib/public/assets/{maintenance-settings-Bq6pKoBt.js → maintenance-settings-DcRmTLS6.js} +1 -1
  46. package/lib/public/assets/{monitor-BZSwrnPV.js → monitor-Bw1YQZnL.js} +1 -1
  47. package/lib/public/assets/{mouse-pointer-2-BbFj8y8i.js → mouse-pointer-2-C01jbqkO.js} +1 -1
  48. package/lib/public/assets/{network-DpwYGB0-.js → network-CBGUjJDJ.js} +1 -1
  49. package/lib/public/assets/{overview-B4_IO-X8.js → overview-Cxe8aQ7C.js} +1 -1
  50. package/lib/public/assets/{page-header-BpLEuo7i.js → page-header-B92DKLiq.js} +1 -1
  51. package/lib/public/assets/play-Ck0L-0_m.js +11 -0
  52. package/lib/public/assets/{plus-DHZS0EGU.js → plus-Dq3tCy2N.js} +1 -1
  53. package/lib/public/assets/{profile-page-DsHDIq-Y.js → profile-page--dkDiKbr.js} +2 -2
  54. package/lib/public/assets/recording-group-store-5BYIFFN9.js +26 -0
  55. package/lib/public/assets/{reset-password-DuUjhw_l.js → reset-password-KYWlfjia.js} +1 -1
  56. package/lib/public/assets/{runbook-page-BI_ayvLd.js → runbook-page-mnsxgS1d.js} +1 -1
  57. package/lib/public/assets/{select-xiba9PSx.js → select-BBOIZTYm.js} +1 -1
  58. package/lib/public/assets/{selector-detail-redirect-Emz2obK_.js → selector-detail-redirect-CcI2j_Su.js} +1 -1
  59. package/lib/public/assets/{selector-health-page-zpwrgalC.js → selector-health-page-BdJb_x5L.js} +2 -2
  60. package/lib/public/assets/{session-detail-page-BhlTJ1Oq.js → session-detail-page-BjLaJy8z.js} +1 -1
  61. package/lib/public/assets/{settings-B-mabJFm.js → settings-B6cpMhsx.js} +1 -1
  62. package/lib/public/assets/{stat-tile-lT8WcPgu.js → stat-tile-BU9e4s36.js} +1 -1
  63. package/lib/public/assets/{tablet-DM8dp75P.js → tablet-hgbEwrWq.js} +1 -1
  64. package/lib/public/assets/{teams-CRkb5-Fe.js → teams-uiiG4hZM.js} +1 -1
  65. package/lib/public/assets/{trash-2-Dxgryn4o.js → trash-2-NK_Iazmg.js} +1 -1
  66. package/lib/public/assets/{upload-Ci0vz0BP.js → upload-BUX8TNFi.js} +1 -1
  67. package/lib/public/assets/{use-builds-data-DaaqMjjL.js → use-builds-data-DZszmFyl.js} +1 -1
  68. package/lib/public/assets/{use-password-reset-mode-BvIyZtaF.js → use-password-reset-mode-BK4B9kRC.js} +1 -1
  69. package/lib/public/assets/{users-CWYHk75q.js → users-BDh1xjad.js} +1 -1
  70. package/lib/public/assets/{users-BT8qx3ea.js → users-BU4XBbMT.js} +1 -1
  71. package/lib/public/assets/{video-off-BvY08g6I.js → video-off-BOjNwT4R.js} +1 -1
  72. package/lib/public/assets/webhook-settings-BMzyUcx5.js +1 -0
  73. package/lib/public/assets/{zap-qG2Li6rI.js → zap-DTWwVMUg.js} +1 -1
  74. package/lib/public/index.html +2 -2
  75. package/lib/src/device-managers/iOSTracker.js +14 -1
  76. package/lib/src/device-managers/ios/IOSDiscoveryService.js +9 -5
  77. package/lib/src/device-managers/ios/usbmuxd.js +46 -0
  78. package/lib/src/gateway/nodeSessionMetrics.js +5 -2
  79. package/lib/src/services/metrics/NodeMetricsCollector.js +4 -2
  80. package/lib/src/services/metrics/SessionMetricsService.js +5 -1
  81. package/lib/src/services/metrics/nodeMetrics.js +33 -3
  82. package/lib/src/sessions/RemoteSession.js +1 -1
  83. package/lib/test/unit/dashboard-events-metrics.spec.js +1 -0
  84. package/lib/test/unit/hub-node-session-metrics.spec.js +83 -13
  85. package/lib/test/unit/ios-usbmuxd-missing.spec.js +111 -0
  86. package/lib/test/unit/node-metrics-collector.spec.js +53 -0
  87. package/lib/test/unit/node-session-metrics-route.spec.js +2 -1
  88. package/lib/tsconfig.tsbuildinfo +1 -1
  89. package/package.json +1 -1
  90. package/lib/public/assets/DeviceMosaicView-CNdES7nm.js +0 -2
  91. package/lib/public/assets/RecordingPage-B4dFBndn.js +0 -11
  92. package/lib/public/assets/device-explorer-D2AqrrLN.css +0 -1
  93. package/lib/public/assets/device-explorer-ai0usQ8m.js +0 -268
  94. package/lib/public/assets/index-C33GjwPr.js +0 -219
  95. package/lib/public/assets/keycodes-CvCtpVJD.js +0 -26
  96. package/lib/public/assets/webhook-settings-aHIlSJFP.js +0 -1
@@ -1 +1 @@
1
- import{r as o,j as h,x as U,a1 as N}from"./index-C33GjwPr.js";function T(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function B(...e){return t=>{let r=!1;const s=e.map(n=>{const i=T(n,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let n=0;n<s.length;n++){const i=s[n];typeof i=="function"?i():T(e[n],null)}}}}function W(...e){return o.useCallback(B(...e),e)}function V(e){const t=z(e),r=o.forwardRef((s,n)=>{const{children:i,...u}=s,c=o.Children.toArray(i),f=c.find(X);if(f){const a=f.props.children,l=c.map(v=>v===f?o.Children.count(a)>1?o.Children.only(null):o.isValidElement(a)?a.props.children:null:v);return h.jsx(t,{...u,ref:n,children:o.isValidElement(a)?o.cloneElement(a,void 0,l):null})}return h.jsx(t,{...u,ref:n,children:i})});return r.displayName=`${e}.Slot`,r}function z(e){const t=o.forwardRef((r,s)=>{const{children:n,...i}=r;if(o.isValidElement(n)){const u=Z(n),c=Y(i,n.props);return n.type!==o.Fragment&&(c.ref=s?B(s,u):u),o.cloneElement(n,c)}return o.Children.count(n)>1?o.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var K=Symbol("radix.slottable");function X(e){return o.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===K}function Y(e,t){const r={...t};for(const s in t){const n=e[s],i=t[s];/^on[A-Z]/.test(s)?n&&i?r[s]=(...c)=>{const f=i(...c);return n(...c),f}:n&&(r[s]=n):s==="style"?r[s]={...n,...i}:s==="className"&&(r[s]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}function Z(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var q=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=q.reduce((e,t)=>{const r=V(`Primitive.${t}`),s=o.forwardRef((n,i)=>{const{asChild:u,...c}=n,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(f,{...c,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function G(e,t){e&&U.flushSync(()=>e.dispatchEvent(t))}function pe(e,t){const r=o.createContext(t),s=i=>{const{children:u,...c}=i,f=o.useMemo(()=>c,Object.values(c));return h.jsx(r.Provider,{value:f,children:u})};s.displayName=e+"Provider";function n(i){const u=o.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,n]}function ve(e,t=[]){let r=[];function s(i,u){const c=o.createContext(u),f=r.length;r=[...r,u];const a=v=>{var b;const{scope:d,children:m,...E}=v,y=((b=d==null?void 0:d[e])==null?void 0:b[f])||c,P=o.useMemo(()=>E,Object.values(E));return h.jsx(y.Provider,{value:P,children:m})};a.displayName=i+"Provider";function l(v,d){var y;const m=((y=d==null?void 0:d[e])==null?void 0:y[f])||c,E=o.useContext(m);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${i}\``)}return[a,l]}const n=()=>{const i=r.map(u=>o.createContext(u));return function(c){const f=(c==null?void 0:c[e])||i;return o.useMemo(()=>({[`__scope${e}`]:{...c,[e]:f}}),[c,f])}};return n.scopeName=e,[s,J(n,...t)]}function J(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(i){const u=s.reduce((c,{useScope:f,scopeName:a})=>{const v=f(i)[`__scope${a}`];return{...c,...v}},{});return o.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function g(e){const t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}var j=globalThis!=null&&globalThis.document?o.useLayoutEffect:()=>{};function S(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}function Q(e,t=globalThis==null?void 0:globalThis.document){const r=g(e);o.useEffect(()=>{const s=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var H="DismissableLayer",w="dismissableLayer.update",ee="dismissableLayer.pointerDownOutside",te="dismissableLayer.focusOutside",I,A=o.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ne=o.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:n,onFocusOutside:i,onInteractOutside:u,onDismiss:c,...f}=e,a=o.useContext(A),[l,v]=o.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=o.useState({}),E=W(t,p=>v(p)),y=Array.from(a.layers),[P]=[...a.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(P),D=l?y.indexOf(l):-1,k=a.layersWithOutsidePointerEventsDisabled.size>0,R=D>=b,M=oe(p=>{const C=p.target,O=[...a.branches].some(x=>x.contains(C));!R||O||(n==null||n(p),u==null||u(p),p.defaultPrevented||c==null||c())},d),L=ie(p=>{const C=p.target;[...a.branches].some(x=>x.contains(C))||(i==null||i(p),u==null||u(p),p.defaultPrevented||c==null||c())},d);return Q(p=>{D===a.layers.size-1&&(s==null||s(p),!p.defaultPrevented&&c&&(p.preventDefault(),c()))},d),o.useEffect(()=>{if(l)return r&&(a.layersWithOutsidePointerEventsDisabled.size===0&&(I=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),a.layersWithOutsidePointerEventsDisabled.add(l)),a.layers.add(l),_(),()=>{r&&a.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=I)}},[l,d,r,a]),o.useEffect(()=>()=>{l&&(a.layers.delete(l),a.layersWithOutsidePointerEventsDisabled.delete(l),_())},[l,a]),o.useEffect(()=>{const p=()=>m({});return document.addEventListener(w,p),()=>document.removeEventListener(w,p)},[]),h.jsx($.div,{...f,ref:E,style:{pointerEvents:k?R?"auto":"none":void 0,...e.style},onFocusCapture:S(e.onFocusCapture,L.onFocusCapture),onBlurCapture:S(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:S(e.onPointerDownCapture,M.onPointerDownCapture)})});ne.displayName=H;var re="DismissableLayerBranch",se=o.forwardRef((e,t)=>{const r=o.useContext(A),s=o.useRef(null),n=W(t,s);return o.useEffect(()=>{const i=s.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),h.jsx($.div,{...e,ref:n})});se.displayName=re;function oe(e,t=globalThis==null?void 0:globalThis.document){const r=g(e),s=o.useRef(!1),n=o.useRef(()=>{});return o.useEffect(()=>{const i=c=>{if(c.target&&!s.current){let f=function(){F(ee,r,a,{discrete:!0})};const a={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=f,t.addEventListener("click",n.current,{once:!0})):f()}else t.removeEventListener("click",n.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",i),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function ie(e,t=globalThis==null?void 0:globalThis.document){const r=g(e),s=o.useRef(!1);return o.useEffect(()=>{const n=i=>{i.target&&!s.current&&F(te,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function _(){const e=new CustomEvent(w);document.dispatchEvent(e)}function F(e,t,r,{discrete:s}){const n=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),s?G(n,i):n.dispatchEvent(i)}var ce=N[" useId ".trim().toString()]||(()=>{}),ue=0;function Ee(e){const[t,r]=o.useState(ce());return j(()=>{r(s=>s??String(ue++))},[e]),e||(t?`radix-${t}`:"")}var ae=N[" useInsertionEffect ".trim().toString()]||j;function ye({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[n,i,u]=le({defaultProp:t,onChange:r}),c=e!==void 0,f=c?e:n;{const l=o.useRef(e!==void 0);o.useEffect(()=>{const v=l.current;v!==c&&console.warn(`${s} is changing from ${v?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=c},[c,s])}const a=o.useCallback(l=>{var v;if(c){const d=fe(l)?l(e):l;d!==e&&((v=u.current)==null||v.call(u,d))}else i(l)},[c,e,i,u]);return[f,a]}function le({defaultProp:e,onChange:t}){const[r,s]=o.useState(e),n=o.useRef(r),i=o.useRef(t);return ae(()=>{i.current=t},[t]),o.useEffect(()=>{var u;n.current!==r&&((u=i.current)==null||u.call(i,r),n.current=r)},[r,n]),[r,s,i]}function fe(e){return typeof e=="function"}export{ne as D,$ as P,W as a,j as b,ye as c,Ee as d,S as e,ve as f,V as g,pe as h,B as i,g as u};
1
+ import{r as o,j as h,x as U,a2 as N}from"./index-ClrpAMAT.js";function T(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function B(...e){return t=>{let r=!1;const s=e.map(n=>{const i=T(n,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let n=0;n<s.length;n++){const i=s[n];typeof i=="function"?i():T(e[n],null)}}}}function W(...e){return o.useCallback(B(...e),e)}function V(e){const t=z(e),r=o.forwardRef((s,n)=>{const{children:i,...u}=s,c=o.Children.toArray(i),f=c.find(X);if(f){const a=f.props.children,l=c.map(v=>v===f?o.Children.count(a)>1?o.Children.only(null):o.isValidElement(a)?a.props.children:null:v);return h.jsx(t,{...u,ref:n,children:o.isValidElement(a)?o.cloneElement(a,void 0,l):null})}return h.jsx(t,{...u,ref:n,children:i})});return r.displayName=`${e}.Slot`,r}function z(e){const t=o.forwardRef((r,s)=>{const{children:n,...i}=r;if(o.isValidElement(n)){const u=Z(n),c=Y(i,n.props);return n.type!==o.Fragment&&(c.ref=s?B(s,u):u),o.cloneElement(n,c)}return o.Children.count(n)>1?o.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var K=Symbol("radix.slottable");function X(e){return o.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===K}function Y(e,t){const r={...t};for(const s in t){const n=e[s],i=t[s];/^on[A-Z]/.test(s)?n&&i?r[s]=(...c)=>{const f=i(...c);return n(...c),f}:n&&(r[s]=n):s==="style"?r[s]={...n,...i}:s==="className"&&(r[s]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}function Z(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var q=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$=q.reduce((e,t)=>{const r=V(`Primitive.${t}`),s=o.forwardRef((n,i)=>{const{asChild:u,...c}=n,f=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(f,{...c,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function G(e,t){e&&U.flushSync(()=>e.dispatchEvent(t))}function pe(e,t){const r=o.createContext(t),s=i=>{const{children:u,...c}=i,f=o.useMemo(()=>c,Object.values(c));return h.jsx(r.Provider,{value:f,children:u})};s.displayName=e+"Provider";function n(i){const u=o.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,n]}function ve(e,t=[]){let r=[];function s(i,u){const c=o.createContext(u),f=r.length;r=[...r,u];const a=v=>{var b;const{scope:d,children:m,...E}=v,y=((b=d==null?void 0:d[e])==null?void 0:b[f])||c,P=o.useMemo(()=>E,Object.values(E));return h.jsx(y.Provider,{value:P,children:m})};a.displayName=i+"Provider";function l(v,d){var y;const m=((y=d==null?void 0:d[e])==null?void 0:y[f])||c,E=o.useContext(m);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${i}\``)}return[a,l]}const n=()=>{const i=r.map(u=>o.createContext(u));return function(c){const f=(c==null?void 0:c[e])||i;return o.useMemo(()=>({[`__scope${e}`]:{...c,[e]:f}}),[c,f])}};return n.scopeName=e,[s,J(n,...t)]}function J(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(i){const u=s.reduce((c,{useScope:f,scopeName:a})=>{const v=f(i)[`__scope${a}`];return{...c,...v}},{});return o.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function g(e){const t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}var j=globalThis!=null&&globalThis.document?o.useLayoutEffect:()=>{};function S(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}function Q(e,t=globalThis==null?void 0:globalThis.document){const r=g(e);o.useEffect(()=>{const s=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var H="DismissableLayer",w="dismissableLayer.update",ee="dismissableLayer.pointerDownOutside",te="dismissableLayer.focusOutside",I,A=o.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ne=o.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:n,onFocusOutside:i,onInteractOutside:u,onDismiss:c,...f}=e,a=o.useContext(A),[l,v]=o.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=o.useState({}),E=W(t,p=>v(p)),y=Array.from(a.layers),[P]=[...a.layersWithOutsidePointerEventsDisabled].slice(-1),b=y.indexOf(P),D=l?y.indexOf(l):-1,k=a.layersWithOutsidePointerEventsDisabled.size>0,R=D>=b,M=oe(p=>{const C=p.target,O=[...a.branches].some(x=>x.contains(C));!R||O||(n==null||n(p),u==null||u(p),p.defaultPrevented||c==null||c())},d),L=ie(p=>{const C=p.target;[...a.branches].some(x=>x.contains(C))||(i==null||i(p),u==null||u(p),p.defaultPrevented||c==null||c())},d);return Q(p=>{D===a.layers.size-1&&(s==null||s(p),!p.defaultPrevented&&c&&(p.preventDefault(),c()))},d),o.useEffect(()=>{if(l)return r&&(a.layersWithOutsidePointerEventsDisabled.size===0&&(I=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),a.layersWithOutsidePointerEventsDisabled.add(l)),a.layers.add(l),_(),()=>{r&&a.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=I)}},[l,d,r,a]),o.useEffect(()=>()=>{l&&(a.layers.delete(l),a.layersWithOutsidePointerEventsDisabled.delete(l),_())},[l,a]),o.useEffect(()=>{const p=()=>m({});return document.addEventListener(w,p),()=>document.removeEventListener(w,p)},[]),h.jsx($.div,{...f,ref:E,style:{pointerEvents:k?R?"auto":"none":void 0,...e.style},onFocusCapture:S(e.onFocusCapture,L.onFocusCapture),onBlurCapture:S(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:S(e.onPointerDownCapture,M.onPointerDownCapture)})});ne.displayName=H;var re="DismissableLayerBranch",se=o.forwardRef((e,t)=>{const r=o.useContext(A),s=o.useRef(null),n=W(t,s);return o.useEffect(()=>{const i=s.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),h.jsx($.div,{...e,ref:n})});se.displayName=re;function oe(e,t=globalThis==null?void 0:globalThis.document){const r=g(e),s=o.useRef(!1),n=o.useRef(()=>{});return o.useEffect(()=>{const i=c=>{if(c.target&&!s.current){let f=function(){F(ee,r,a,{discrete:!0})};const a={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=f,t.addEventListener("click",n.current,{once:!0})):f()}else t.removeEventListener("click",n.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",i),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function ie(e,t=globalThis==null?void 0:globalThis.document){const r=g(e),s=o.useRef(!1);return o.useEffect(()=>{const n=i=>{i.target&&!s.current&&F(te,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function _(){const e=new CustomEvent(w);document.dispatchEvent(e)}function F(e,t,r,{discrete:s}){const n=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),s?G(n,i):n.dispatchEvent(i)}var ce=N[" useId ".trim().toString()]||(()=>{}),ue=0;function Ee(e){const[t,r]=o.useState(ce());return j(()=>{r(s=>s??String(ue++))},[e]),e||(t?`radix-${t}`:"")}var ae=N[" useInsertionEffect ".trim().toString()]||j;function ye({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[n,i,u]=le({defaultProp:t,onChange:r}),c=e!==void 0,f=c?e:n;{const l=o.useRef(e!==void 0);o.useEffect(()=>{const v=l.current;v!==c&&console.warn(`${s} is changing from ${v?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=c},[c,s])}const a=o.useCallback(l=>{var v;if(c){const d=fe(l)?l(e):l;d!==e&&((v=u.current)==null||v.call(u,d))}else i(l)},[c,e,i,u]);return[f,a]}function le({defaultProp:e,onChange:t}){const[r,s]=o.useState(e),n=o.useRef(r),i=o.useRef(t);return ae(()=>{i.current=t},[t]),o.useEffect(()=>{var u;n.current!==r&&((u=i.current)==null||u.call(i,r),n.current=r)},[r,n]),[r,s,i]}function fe(e){return typeof e=="function"}export{ne as D,$ as P,W as a,j as b,ye as c,Ee as d,S as e,ve as f,V as g,pe as h,B as i,g as u};
@@ -1 +1 @@
1
- import{r as p,j as o}from"./index-C33GjwPr.js";import{c as e}from"./utils-CDN07tui.js";const n=p.forwardRef(({className:r,type:s,...t},a)=>o.jsx("input",{type:s,className:e("input-base",r),ref:a,...t}));n.displayName="Input";export{n as I};
1
+ import{r as p,j as o}from"./index-ClrpAMAT.js";import{c as e}from"./utils-CDN07tui.js";const n=p.forwardRef(({className:r,type:s,...t},a)=>o.jsx("input",{type:s,className:e("input-base",r),ref:a,...t}));n.displayName="Input";export{n as I};
@@ -1 +1 @@
1
- import{j as a,r as g}from"./index-C33GjwPr.js";const I=({header:e,footer:t,action:n,padded:o=!0,className:s,children:x})=>a.jsxs("div",{className:`card${s?" "+s:""}`,children:[(e||n)&&a.jsxs("div",{className:"card-header",children:[a.jsx("div",{className:"card-header-title",children:e}),n&&a.jsx("div",{className:"card-header-action",children:n})]}),a.jsx("div",{className:o?"card-body":"card-body-flush",children:x}),t&&a.jsx("div",{className:"card-footer",children:t})]});function E(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return!Array.isArray(t.samples)||!t.series||typeof t.series!="object"?null:{platform:String(t.platform??""),intervalMs:Number(t.intervalMs)||2e3,appId:typeof t.appId=="string"?t.appId:null,series:{deviceCpu:!!t.series.deviceCpu,deviceMem:!!t.series.deviceMem,appCpu:!!t.series.appCpu,appMem:!!t.series.appMem},recording:t.recording==="sampling"||t.recording==="stopped"||t.recording==="off"?t.recording:null,samples:t.samples}}function L(e){let t=-1/0,n=0,o=0;for(const s of e)s===null||!Number.isFinite(s)||(t=Math.max(t,s),n+=s,o+=1);return o===0?null:{peak:t,average:n/o}}function k(e){const t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),s=String(t%60).padStart(2,"0");return n>0?`${n}:${String(o).padStart(2,"0")}:${s}`:`${o}:${s}`}function R(e){return e===0?"0%":`${e<10?e.toFixed(1):Math.round(e)}%`}function W(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const M=1e3,N=600;function $(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e));for(const n of[1,1.5,2,2.5,3,4,5,6,8,10])if(n*t>=e)return n*t;return 10*t}function w(e,t){if(e.length===0)return-1;let n=0,o=e.length-1;for(;n<o;){const s=n+o>>1;e[s]<t?n=s+1:o=s}return n>0&&t-e[n-1]<=e[n]-t?n-1:n}function S(e,t=N){const n=e.length;if(n<=t)return Array.from({length:n},(l,u)=>u);const o=Math.floor((t-2)/3),s=n/o,x=new Set([0,n-1]);for(let l=0;l<o;l+=1){const u=Math.min(n,Math.floor((l+1)*s));let i=-1,p=-1,f=-1;for(let c=Math.floor(l*s);c<u;c+=1){const h=e[c];if(h==null){f<0&&(f=c);continue}(i<0||h<e[i])&&(i=c),(p<0||h>e[p])&&(p=c)}for(const c of[i,p,f])c>=0&&x.add(c)}return Array.from(x).sort((l,u)=>l-u)}const b=e=>Math.round(e*100)/100;function A(e,t,n,o,s,x,l){const u=[];let i=!1;for(const p of n){const f=e[p];if(f==null){i=!1;continue}const c=t[p]/o*x,h=l-Math.min(f,s)/s*l;u.push(`${i?"L":"M"}${b(c)} ${b(h)}`),i=!0}return u.join(" ")}const B=({times:e,series:t,yMax:n,formatValue:o,formatTime:s,ariaLabel:x,height:l=140})=>{const u=g.useRef(null),[i,p]=g.useState(null),f=Math.max(e.length?e[e.length-1]:0,1),c=g.useMemo(()=>{if(n!==void 0)return n;let r=0;for(const d of t)for(const v of d.values)v!==null&&v>r&&(r=v);return $(r)},[t,n]),h=g.useMemo(()=>t.map(r=>S(r.values)),[t]),y=r=>{var j;const d=(j=u.current)==null?void 0:j.getBoundingClientRect();if(!d||d.width<=0||e.length===0)return;const v=Math.min(1,Math.max(0,(r.clientX-d.left)/d.width));p(w(e,v*f))},m=i!==null?e[i]/f*100:0;return a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex w-14 flex-col justify-between text-right text-[10px] tabular-nums text-[var(--text-dim)]",style:{height:l},children:[a.jsx("span",{children:o(c)}),a.jsx("span",{children:o(0)})]}),a.jsxs("div",{ref:u,"data-testid":"line-chart",className:"relative min-w-0 flex-1",style:{height:l},onMouseMove:y,onMouseLeave:()=>p(null),children:[a.jsxs("svg",{role:"img","aria-label":x,viewBox:`0 0 ${M} ${l}`,preserveAspectRatio:"none",className:"absolute inset-0 h-full w-full overflow-visible",children:[[0,.5,1].map(r=>a.jsx("line",{x1:0,x2:M,y1:r*l,y2:r*l,stroke:"var(--border)",strokeWidth:1,vectorEffect:"non-scaling-stroke"},r)),t.map((r,d)=>a.jsx("path",{"data-series":r.key,d:A(r.values,e,h[d],f,c,M,l),fill:"none",stroke:r.color,strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:r.dashed?"4 3":void 0,vectorEffect:"non-scaling-stroke"},r.key)),i!==null&&a.jsx("line",{x1:m/100*M,x2:m/100*M,y1:0,y2:l,stroke:"var(--text-muted)",strokeWidth:1,vectorEffect:"non-scaling-stroke"})]}),i!==null&&a.jsxs("div",{role:"tooltip",className:"pointer-events-none absolute top-1 z-10 whitespace-nowrap rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1 text-[11px] text-[var(--text)]",style:m>60?{right:`${100-m}%`,marginRight:8}:{left:`${m}%`,marginLeft:8},children:[a.jsx("div",{className:"tabular-nums text-[var(--text-dim)]",children:(s??k)(e[i])}),t.map(r=>{var v;const d=r.values[i];return a.jsxs("div",{className:"flex items-center gap-1.5 tabular-nums",children:[a.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:r.color}}),a.jsx("span",{className:"text-[var(--text-muted)]",children:((v=r.pointLabels)==null?void 0:v[i])??r.label}),a.jsx("span",{className:"ml-auto pl-3",children:d==null?"—":o(d)})]},r.key)})]})]})]})};export{I as C,B as L,W as a,E as b,R as f,$ as n,L as s};
1
+ import{j as a,r as g}from"./index-ClrpAMAT.js";const I=({header:e,footer:t,action:n,padded:o=!0,className:s,children:x})=>a.jsxs("div",{className:`card${s?" "+s:""}`,children:[(e||n)&&a.jsxs("div",{className:"card-header",children:[a.jsx("div",{className:"card-header-title",children:e}),n&&a.jsx("div",{className:"card-header-action",children:n})]}),a.jsx("div",{className:o?"card-body":"card-body-flush",children:x}),t&&a.jsx("div",{className:"card-footer",children:t})]});function E(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return!Array.isArray(t.samples)||!t.series||typeof t.series!="object"?null:{platform:String(t.platform??""),intervalMs:Number(t.intervalMs)||2e3,appId:typeof t.appId=="string"?t.appId:null,series:{deviceCpu:!!t.series.deviceCpu,deviceMem:!!t.series.deviceMem,appCpu:!!t.series.appCpu,appMem:!!t.series.appMem},recording:t.recording==="sampling"||t.recording==="stopped"||t.recording==="off"?t.recording:null,samples:t.samples}}function L(e){let t=-1/0,n=0,o=0;for(const s of e)s===null||!Number.isFinite(s)||(t=Math.max(t,s),n+=s,o+=1);return o===0?null:{peak:t,average:n/o}}function k(e){const t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),s=String(t%60).padStart(2,"0");return n>0?`${n}:${String(o).padStart(2,"0")}:${s}`:`${o}:${s}`}function R(e){return e===0?"0%":`${e<10?e.toFixed(1):Math.round(e)}%`}function W(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const M=1e3,N=600;function $(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e));for(const n of[1,1.5,2,2.5,3,4,5,6,8,10])if(n*t>=e)return n*t;return 10*t}function w(e,t){if(e.length===0)return-1;let n=0,o=e.length-1;for(;n<o;){const s=n+o>>1;e[s]<t?n=s+1:o=s}return n>0&&t-e[n-1]<=e[n]-t?n-1:n}function S(e,t=N){const n=e.length;if(n<=t)return Array.from({length:n},(l,u)=>u);const o=Math.floor((t-2)/3),s=n/o,x=new Set([0,n-1]);for(let l=0;l<o;l+=1){const u=Math.min(n,Math.floor((l+1)*s));let i=-1,p=-1,f=-1;for(let c=Math.floor(l*s);c<u;c+=1){const h=e[c];if(h==null){f<0&&(f=c);continue}(i<0||h<e[i])&&(i=c),(p<0||h>e[p])&&(p=c)}for(const c of[i,p,f])c>=0&&x.add(c)}return Array.from(x).sort((l,u)=>l-u)}const b=e=>Math.round(e*100)/100;function A(e,t,n,o,s,x,l){const u=[];let i=!1;for(const p of n){const f=e[p];if(f==null){i=!1;continue}const c=t[p]/o*x,h=l-Math.min(f,s)/s*l;u.push(`${i?"L":"M"}${b(c)} ${b(h)}`),i=!0}return u.join(" ")}const B=({times:e,series:t,yMax:n,formatValue:o,formatTime:s,ariaLabel:x,height:l=140})=>{const u=g.useRef(null),[i,p]=g.useState(null),f=Math.max(e.length?e[e.length-1]:0,1),c=g.useMemo(()=>{if(n!==void 0)return n;let r=0;for(const d of t)for(const v of d.values)v!==null&&v>r&&(r=v);return $(r)},[t,n]),h=g.useMemo(()=>t.map(r=>S(r.values)),[t]),y=r=>{var j;const d=(j=u.current)==null?void 0:j.getBoundingClientRect();if(!d||d.width<=0||e.length===0)return;const v=Math.min(1,Math.max(0,(r.clientX-d.left)/d.width));p(w(e,v*f))},m=i!==null?e[i]/f*100:0;return a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex w-14 flex-col justify-between text-right text-[10px] tabular-nums text-[var(--text-dim)]",style:{height:l},children:[a.jsx("span",{children:o(c)}),a.jsx("span",{children:o(0)})]}),a.jsxs("div",{ref:u,"data-testid":"line-chart",className:"relative min-w-0 flex-1",style:{height:l},onMouseMove:y,onMouseLeave:()=>p(null),children:[a.jsxs("svg",{role:"img","aria-label":x,viewBox:`0 0 ${M} ${l}`,preserveAspectRatio:"none",className:"absolute inset-0 h-full w-full overflow-visible",children:[[0,.5,1].map(r=>a.jsx("line",{x1:0,x2:M,y1:r*l,y2:r*l,stroke:"var(--border)",strokeWidth:1,vectorEffect:"non-scaling-stroke"},r)),t.map((r,d)=>a.jsx("path",{"data-series":r.key,d:A(r.values,e,h[d],f,c,M,l),fill:"none",stroke:r.color,strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:r.dashed?"4 3":void 0,vectorEffect:"non-scaling-stroke"},r.key)),i!==null&&a.jsx("line",{x1:m/100*M,x2:m/100*M,y1:0,y2:l,stroke:"var(--text-muted)",strokeWidth:1,vectorEffect:"non-scaling-stroke"})]}),i!==null&&a.jsxs("div",{role:"tooltip",className:"pointer-events-none absolute top-1 z-10 whitespace-nowrap rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1 text-[11px] text-[var(--text)]",style:m>60?{right:`${100-m}%`,marginRight:8}:{left:`${m}%`,marginLeft:8},children:[a.jsx("div",{className:"tabular-nums text-[var(--text-dim)]",children:(s??k)(e[i])}),t.map(r=>{var v;const d=r.values[i];return a.jsxs("div",{className:"flex items-center gap-1.5 tabular-nums",children:[a.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:r.color}}),a.jsx("span",{className:"text-[var(--text-muted)]",children:((v=r.pointLabels)==null?void 0:v[i])??r.label}),a.jsx("span",{className:"ml-auto pl-3",children:d==null?"—":o(d)})]},r.key)})]})]})]})};export{I as C,B as L,W as a,E as b,R as f,$ as n,L as s};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-C33GjwPr.js";/**
1
+ import{c as a}from"./index-ClrpAMAT.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-C33GjwPr.js";/**
1
+ import{c}from"./index-ClrpAMAT.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as g,L as X,u as z,a as H,b as K,r as a,d as O,j as e,N as B,I as W,e as Y,C as _,f as G,l as J}from"./index-C33GjwPr.js";import{c as Q}from"./utils-CDN07tui.js";import{u as V}from"./use-password-reset-mode-BvIyZtaF.js";import{A as Z}from"./auth-shell-CtMFhbnC.js";import{L as ee}from"./lock-Cb7My6hc.js";import{C as te}from"./clock-DU9cBLi8.js";import{A as se}from"./arrow-right-BbAm_2Wa.js";import"./network-DpwYGB0-.js";/**
1
+ import{c as g,L as X,u as z,a as H,b as K,r as a,d as O,j as e,N as B,I as W,e as Y,C as _,f as G,l as J}from"./index-ClrpAMAT.js";import{c as Q}from"./utils-CDN07tui.js";import{u as V}from"./use-password-reset-mode-BK4B9kRC.js";import{A as Z}from"./auth-shell-CHmBFmOz.js";import{L as ee}from"./lock-CVCe56TH.js";import{C as te}from"./clock-DMT60v1C.js";import{A as se}from"./arrow-right-zm-NagQh.js";import"./network-CBGUjJDJ.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 N,t as M,r as d,X as C,j as e,A as D,S as y,I as w,Q as A}from"./index-C33GjwPr.js";/* empty css */import{S as o,A as k}from"./SettingCard-rcPtJ7HG.js";import{P as B}from"./page-header-BpLEuo7i.js";import{T as z}from"./trash-2-Dxgryn4o.js";import{C as E}from"./check-CAB6RYuc.js";import{C as R}from"./calendar-BZkpCqlL.js";import"./button-CQoMQEj_.js";import"./utils-CDN07tui.js";/**
1
+ import{c as N,t as M,r as d,X as C,j as e,A as D,S as y,I as w,V as A}from"./index-ClrpAMAT.js";/* empty css */import{S as o,A as k}from"./SettingCard-Clg_Ijbc.js";import{P as B}from"./page-header-B92DKLiq.js";import{T as z}from"./trash-2-NK_Iazmg.js";import{C as E}from"./check-DpbIM4E0.js";import{C as R}from"./calendar-C7eYYJTo.js";import"./button-CqhPBGRj.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,4 +1,4 @@
1
- import{c as e}from"./index-C33GjwPr.js";/**
1
+ import{c as e}from"./index-ClrpAMAT.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 e}from"./index-C33GjwPr.js";/**
1
+ import{c as e}from"./index-ClrpAMAT.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 e}from"./index-C33GjwPr.js";/**
1
+ import{c as e}from"./index-ClrpAMAT.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 y,r as h,p as E,X as p,j as e,u as R,T as H,q as L,s as M}from"./index-C33GjwPr.js";import{p as T}from"./labels-C21SA4JG.js";import{A as O}from"./arrow-right-BbAm_2Wa.js";import{T as B}from"./tablet-DM8dp75P.js";import{M as P}from"./monitor-BZSwrnPV.js";import{A as U}from"./activity-_5pNSfKT.js";import{P as X}from"./page-header-BpLEuo7i.js";/**
1
+ import{c as y,r as h,p as E,X as p,j as e,u as R,T as H,q as L,s as M}from"./index-ClrpAMAT.js";import{p as T}from"./labels-C21SA4JG.js";import{A as O}from"./arrow-right-zm-NagQh.js";import{T as B}from"./tablet-hgbEwrWq.js";import{M as P}from"./monitor-Bw1YQZnL.js";import{A as U}from"./activity-Bengh9SD.js";import{P as X}from"./page-header-B92DKLiq.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 e}from"./index-C33GjwPr.js";const i=({icon:s,children:t})=>e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight text-[var(--text)]",children:[s&&e.jsx(s,{className:"h-5 w-5 text-[var(--color-accent)] shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:t})]}),l=({icon:s,eyebrow:t,title:x,subtitle:a,action:r})=>e.jsx("header",{className:"px-6 pt-6 pb-4 border-b border-[var(--border)]",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("div",{className:"text-[11px] font-semibold text-[var(--text-dim)] mb-1.5",children:t}),e.jsx(i,{icon:s,children:x}),a&&e.jsx("p",{className:"mt-1.5 text-sm text-[var(--text-muted)] max-w-3xl",children:a})]}),r&&e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:r})]})});export{l as P,i as a};
1
+ import{j as e}from"./index-ClrpAMAT.js";const i=({icon:s,children:t})=>e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight text-[var(--text)]",children:[s&&e.jsx(s,{className:"h-5 w-5 text-[var(--color-accent)] shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:t})]}),l=({icon:s,eyebrow:t,title:x,subtitle:a,action:r})=>e.jsx("header",{className:"px-6 pt-6 pb-4 border-b border-[var(--border)]",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("div",{className:"text-[11px] font-semibold text-[var(--text-dim)] mb-1.5",children:t}),e.jsx(i,{icon:s,children:x}),a&&e.jsx("p",{className:"mt-1.5 text-sm text-[var(--text-muted)] max-w-3xl",children:a})]}),r&&e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:r})]})});export{l as P,i as a};
@@ -0,0 +1,11 @@
1
+ import{c as e}from"./index-ClrpAMAT.js";/**
2
+ * @license lucide-react v0.555.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const t=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],o=e("pause",t);/**
7
+ * @license lucide-react v0.555.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const a=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],s=e("play",a);export{o as P,s as a};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-C33GjwPr.js";/**
1
+ import{c as e}from"./index-ClrpAMAT.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 S,b as N,r as n,j as e,_ as E,A as T}from"./index-C33GjwPr.js";import{P as A}from"./page-header-BpLEuo7i.js";import{a as y,f as w}from"./time-D-gjmE1o.js";import{S as C}from"./select-xiba9PSx.js";import{C as $}from"./copy-VM9kWPpE.js";import{T as D}from"./trash-2-Dxgryn4o.js";import"./utils-CDN07tui.js";/**
1
+ import{c as S,b as N,r as n,j as e,$ as E,A as T}from"./index-ClrpAMAT.js";import{P as A}from"./page-header-B92DKLiq.js";import{a as y,f as w}from"./time-D-gjmE1o.js";import{S as C}from"./select-BBOIZTYm.js";import{C as $}from"./copy-BKNyOehd.js";import{T as D}from"./trash-2-NK_Iazmg.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.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],K=S("circle-user",I);function R(){const{me:t}=N(),[r,i]=n.useState(""),[o,l]=n.useState(""),[d,p]=n.useState(""),[u,x]=n.useState(!1),[b,h]=n.useState(null);async function c(a){if(a.preventDefault(),h(null),o!==d){h({kind:"err",text:"Passwords do not match."});return}x(!0);try{await E(r,o),h({kind:"ok",text:"Password updated. Other sessions for your account were signed out."}),i(""),l(""),p("")}catch(m){h({kind:"err",text:m.message})}finally{x(!1)}}return e.jsxs("div",{className:"max-w-md",children:[(t==null?void 0:t.role)==="MEMBER"&&(t.teams.length>0?e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"text-xs text-[var(--text-dim)] mb-2",children:"Your teams"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.teams.map(a=>e.jsx("span",{className:"inline-block px-2 py-1 rounded bg-[var(--surface)] border border-[var(--border)] text-xs",children:a.name},a.id))})]}):e.jsx("div",{className:"mb-6 text-xs text-[var(--text-dim)]",children:"You're not on any team — ask an admin to add you so you can see team-scoped devices."})),e.jsxs("form",{onSubmit:c,children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Update password"}),["oldPassword","newPassword","confirm"].map(a=>e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:a==="oldPassword"?"Current password":a==="newPassword"?"New password":"Confirm new password"}),e.jsx("input",{type:"password",value:a==="oldPassword"?r:a==="newPassword"?o:d,onChange:m=>{a==="oldPassword"?i(m.target.value):a==="newPassword"?l(m.target.value):p(m.target.value)},className:"w-full h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm"})]},a)),b&&e.jsx("div",{className:`text-xs mb-3 ${b.kind==="ok"?"text-[var(--color-success)]":"text-[var(--red)]"}`,children:b.text}),e.jsx("button",{type:"submit",disabled:u||o.length<8,className:"h-10 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] font-medium text-sm disabled:opacity-50",children:u?"Updating…":"Update password"})]})]})}const v="/xenon/api/profile";async function O(){const t=await fetch(`${v}/tokens`,{credentials:"include"});if(!t.ok)throw new Error(`listTokens failed (${t.status})`);return t.json()}async function L(t,r,i){const o=await fetch(`${v}/tokens`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,scopes:r,expiresAt:i??void 0})});if(!o.ok){const l=await o.json().catch(()=>({}));throw new Error(l.error||`createToken failed (${o.status})`)}return o.json()}async function M(t){const r=await fetch(`${v}/tokens/${t}`,{method:"DELETE",credentials:"include"});if(!r.ok&&r.status!==204)throw new Error(`deleteToken failed (${r.status})`)}async function U(){const t=await fetch(`${v}/access-key`,{credentials:"include"});if(!t.ok)throw new Error(`getAccessKey failed (${t.status})`);return(await t.json()).accessKey}async function B(){const t=await fetch(`${v}/access-key/rotate`,{method:"POST",credentials:"include"});if(!t.ok)throw new Error(`rotateAccessKey failed (${t.status})`);return(await t.json()).accessKey}const j={"7d":"7 days","30d":"30 days","90d":"90 days","1y":"1 year",never:"No expiry"},z={"7d":7,"30d":30,"90d":90,"1y":365};function k(t){if(t==="never")return null;const r=z[t]*24*60*60*1e3;return new Date(Date.now()+r).toISOString()}function _({onClose:t,onCreated:r}){const[i,o]=n.useState(""),[l,d]=n.useState("30d"),[p,u]=n.useState(!1),[x,b]=n.useState(null);async function h(c){c.preventDefault(),u(!0),b(null);try{const a=k(l),m=await L(i,void 0,a);r({name:i,token:m.token,expiresAt:m.expiresAt})}catch(a){b(a.message)}finally{u(!1)}}return e.jsx("div",{className:"fixed inset-0 z-30 bg-black/50 flex items-center justify-center",role:"dialog","aria-modal":"true",children:e.jsxs("form",{onSubmit:h,className:"bg-[var(--bg)] border border-[var(--border)] rounded-lg w-full max-w-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Generate Identity Token"}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Description"}),e.jsx("input",{autoFocus:!0,value:i,onChange:c=>o(c.target.value),placeholder:"e.g. mac, CI, etc.",required:!0,className:"w-full mb-4 h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm"}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Expires after"}),e.jsx(C,{value:l,onChange:c=>d(c.target.value),className:"mb-1",children:Object.keys(j).map(c=>e.jsx("option",{value:c,children:j[c]},c))}),e.jsx("p",{className:"text-[11px] text-[var(--text-dim)] mb-4",children:l==="never"?"Token never expires. Rotate manually when needed.":`Token will stop working on ${y(k(l))}.`}),x&&e.jsx("div",{className:"text-xs text-[var(--red)] mb-2",children:x}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:t,className:"h-9 px-3 rounded-md border border-[var(--border)] text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:p||!i,className:"h-9 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium disabled:opacity-50",children:p?"Creating…":"Create"})]})]})})}function F(){const[t,r]=n.useState(""),[i,o]=n.useState([]),[l,d]=n.useState(!0),[p,u]=n.useState(!1),[x,b]=n.useState(null),[h,c]=n.useState(null);async function a(){d(!0),c(null);try{const[s,f]=await Promise.all([U(),O()]);r(s),o(f)}catch(s){c(s instanceof Error?s.message:"Failed to load tokens")}finally{d(!1)}}n.useEffect(()=>{a()},[]);async function m(){if(confirm("Rotate access key? Existing tokens stay valid but the old accessKey will stop working immediately."))try{r(await B())}catch(s){c(s instanceof Error?s.message:"Failed to rotate access key")}}async function g(s){if(confirm("Delete this token? It will stop working immediately."))try{await M(s),o(f=>f.filter(P=>P.id!==s))}catch(f){c(f instanceof Error?f.message:"Failed to delete token")}}return e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:"Access Key"}),e.jsx("code",{className:"px-2 py-1 rounded bg-[var(--surface)] border border-[var(--border)] text-xs",children:t||"…"}),e.jsx("button",{onClick:()=>navigator.clipboard.writeText(t),"aria-label":"Copy access key",className:"text-[var(--text-dim)] hover:text-[var(--text)]",children:e.jsx($,{size:14})}),e.jsx("button",{onClick:m,"aria-label":"Rotate access key",className:"text-[var(--text-dim)] hover:text-[var(--text)]",children:e.jsx(T,{size:14})}),e.jsx("span",{className:"text-[10px] text-[var(--text-dim)] ml-2",children:"Public — paired with a token below"})]}),e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Identity Tokens"}),e.jsx("button",{onClick:()=>u(!0),className:"h-9 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] font-medium text-sm",children:"Generate new token"})]}),l?e.jsx("div",{className:"text-sm text-[var(--text-dim)]",children:"Loading…"}):h?e.jsxs("div",{className:"text-sm text-[var(--red)] py-6 text-center border border-dashed border-[var(--border)] rounded-md",children:[h," ",e.jsx("button",{className:"underline text-[var(--text)]",onClick:a,children:"Retry"})]}):i.length===0?e.jsx("div",{className:"text-sm text-[var(--text-dim)] py-6 text-center border border-dashed border-[var(--border)] rounded-md",children:"No tokens yet — generate one to use programmatically."}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-[11px] text-[var(--text-dim)]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left py-2",children:"Name"}),e.jsx("th",{className:"text-left py-2",children:"Issued"}),e.jsx("th",{className:"text-left py-2",children:"Last Used"}),e.jsx("th",{className:"text-left py-2",children:"Expires"}),e.jsx("th",{className:"w-px"})]})}),e.jsx("tbody",{children:i.map(s=>{const f=s.expiresAt?new Date(s.expiresAt).getTime()<=Date.now():!1;return e.jsxs("tr",{className:"border-t border-[var(--border)]",children:[e.jsx("td",{className:"py-2",children:s.name}),e.jsx("td",{className:"py-2 text-[var(--text-muted)]",children:w(s.createdAt)}),e.jsx("td",{className:"py-2 text-[var(--text-muted)]",children:s.lastUsedAt?w(s.lastUsedAt):"—"}),e.jsx("td",{className:`py-2 ${f?"text-[var(--red)]":"text-[var(--text-muted)]"}`,children:s.expiresAt?`${y(s.expiresAt)}${f?" (expired)":""}`:"Never"}),e.jsx("td",{className:"py-2 text-right",children:e.jsx("button",{onClick:()=>g(s.id),"aria-label":"Delete token",className:"text-[var(--red)] hover:opacity-80",children:e.jsx(D,{size:14})})})]},s.id)})})]}),p&&e.jsx(_,{onClose:()=>u(!1),onCreated:s=>{u(!1),b(s),a()}}),x&&e.jsx("div",{className:"fixed inset-0 z-30 bg-black/50 flex items-center justify-center",role:"dialog",children:e.jsxs("div",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-lg w-full max-w-md p-6",children:[e.jsx("h3",{className:"text-base font-semibold mb-2",children:"Token created"}),e.jsx("p",{className:"text-xs text-[var(--text-dim)] mb-3",children:"Copy this now — it will not be shown again."}),e.jsx("code",{className:"block break-all px-3 py-2 rounded bg-[var(--surface)] border border-[var(--border)] text-xs mb-3",children:x.token}),e.jsx("p",{className:"text-[11px] text-[var(--text-dim)] mb-4",children:x.expiresAt?`Expires ${y(x.expiresAt)}`:"No expiry — rotate manually."}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>b(null),className:"h-9 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium",children:"Done"})})]})})]})}function W(){const{me:t}=N(),[r,i]=n.useState("password"),o=t!=null&&t.authDisabled?[{id:"tokens",label:"API tokens"}]:[{id:"password",label:"Password & authentication"},{id:"tokens",label:"API tokens"}],l=o.some(d=>d.id===r)?r:o[0].id;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(A,{icon:K,title:"Profile",subtitle:t?[t.name||t.email,t.role].filter(Boolean).join(" — "):"Your account settings."}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsxs("nav",{className:"w-56 shrink-0 border-r border-[var(--border)] py-6 px-3",children:[e.jsx("div",{className:"text-sm font-semibold mb-4 px-2",children:"Profile settings"}),o.map(d=>e.jsx("button",{onClick:()=>i(d.id),"aria-current":l===d.id?"page":void 0,className:`block w-full text-left px-3 py-2 text-sm rounded-md mb-1 ${l===d.id?"bg-[var(--color-accent)]/10 text-[var(--color-accent)]":"text-[var(--text)] hover:bg-[var(--surface)]"}`,children:d.label},d.id))]}),e.jsx("section",{className:"flex-1 px-8 py-6",children:l==="password"?e.jsx(R,{}):e.jsx(F,{})})]})]})}export{W as default};
6
+ */const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],K=S("circle-user",I);function R(){const{me:t}=N(),[r,i]=n.useState(""),[o,l]=n.useState(""),[d,p]=n.useState(""),[u,x]=n.useState(!1),[b,h]=n.useState(null);async function c(a){if(a.preventDefault(),h(null),o!==d){h({kind:"err",text:"Passwords do not match."});return}x(!0);try{await E(r,o),h({kind:"ok",text:"Password updated. Other sessions for your account were signed out."}),i(""),l(""),p("")}catch(m){h({kind:"err",text:m.message})}finally{x(!1)}}return e.jsxs("div",{className:"max-w-md",children:[(t==null?void 0:t.role)==="MEMBER"&&(t.teams.length>0?e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"text-xs text-[var(--text-dim)] mb-2",children:"Your teams"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.teams.map(a=>e.jsx("span",{className:"inline-block px-2 py-1 rounded bg-[var(--surface)] border border-[var(--border)] text-xs",children:a.name},a.id))})]}):e.jsx("div",{className:"mb-6 text-xs text-[var(--text-dim)]",children:"You're not on any team — ask an admin to add you so you can see team-scoped devices."})),e.jsxs("form",{onSubmit:c,children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Update password"}),["oldPassword","newPassword","confirm"].map(a=>e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:a==="oldPassword"?"Current password":a==="newPassword"?"New password":"Confirm new password"}),e.jsx("input",{type:"password",value:a==="oldPassword"?r:a==="newPassword"?o:d,onChange:m=>{a==="oldPassword"?i(m.target.value):a==="newPassword"?l(m.target.value):p(m.target.value)},className:"w-full h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm"})]},a)),b&&e.jsx("div",{className:`text-xs mb-3 ${b.kind==="ok"?"text-[var(--color-success)]":"text-[var(--red)]"}`,children:b.text}),e.jsx("button",{type:"submit",disabled:u||o.length<8,className:"h-10 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] font-medium text-sm disabled:opacity-50",children:u?"Updating…":"Update password"})]})]})}const v="/xenon/api/profile";async function O(){const t=await fetch(`${v}/tokens`,{credentials:"include"});if(!t.ok)throw new Error(`listTokens failed (${t.status})`);return t.json()}async function L(t,r,i){const o=await fetch(`${v}/tokens`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,scopes:r,expiresAt:i??void 0})});if(!o.ok){const l=await o.json().catch(()=>({}));throw new Error(l.error||`createToken failed (${o.status})`)}return o.json()}async function M(t){const r=await fetch(`${v}/tokens/${t}`,{method:"DELETE",credentials:"include"});if(!r.ok&&r.status!==204)throw new Error(`deleteToken failed (${r.status})`)}async function U(){const t=await fetch(`${v}/access-key`,{credentials:"include"});if(!t.ok)throw new Error(`getAccessKey failed (${t.status})`);return(await t.json()).accessKey}async function B(){const t=await fetch(`${v}/access-key/rotate`,{method:"POST",credentials:"include"});if(!t.ok)throw new Error(`rotateAccessKey failed (${t.status})`);return(await t.json()).accessKey}const j={"7d":"7 days","30d":"30 days","90d":"90 days","1y":"1 year",never:"No expiry"},z={"7d":7,"30d":30,"90d":90,"1y":365};function k(t){if(t==="never")return null;const r=z[t]*24*60*60*1e3;return new Date(Date.now()+r).toISOString()}function F({onClose:t,onCreated:r}){const[i,o]=n.useState(""),[l,d]=n.useState("30d"),[p,u]=n.useState(!1),[x,b]=n.useState(null);async function h(c){c.preventDefault(),u(!0),b(null);try{const a=k(l),m=await L(i,void 0,a);r({name:i,token:m.token,expiresAt:m.expiresAt})}catch(a){b(a.message)}finally{u(!1)}}return e.jsx("div",{className:"fixed inset-0 z-30 bg-black/50 flex items-center justify-center",role:"dialog","aria-modal":"true",children:e.jsxs("form",{onSubmit:h,className:"bg-[var(--bg)] border border-[var(--border)] rounded-lg w-full max-w-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Generate Identity Token"}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Description"}),e.jsx("input",{autoFocus:!0,value:i,onChange:c=>o(c.target.value),placeholder:"e.g. mac, CI, etc.",required:!0,className:"w-full mb-4 h-10 px-3 rounded-md bg-[var(--surface)] border border-[var(--border)] text-sm"}),e.jsx("label",{className:"block text-xs text-[var(--text-dim)] mb-1",children:"Expires after"}),e.jsx(C,{value:l,onChange:c=>d(c.target.value),className:"mb-1",children:Object.keys(j).map(c=>e.jsx("option",{value:c,children:j[c]},c))}),e.jsx("p",{className:"text-[11px] text-[var(--text-dim)] mb-4",children:l==="never"?"Token never expires. Rotate manually when needed.":`Token will stop working on ${y(k(l))}.`}),x&&e.jsx("div",{className:"text-xs text-[var(--red)] mb-2",children:x}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:t,className:"h-9 px-3 rounded-md border border-[var(--border)] text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:p||!i,className:"h-9 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium disabled:opacity-50",children:p?"Creating…":"Create"})]})]})})}function Y(){const[t,r]=n.useState(""),[i,o]=n.useState([]),[l,d]=n.useState(!0),[p,u]=n.useState(!1),[x,b]=n.useState(null),[h,c]=n.useState(null);async function a(){d(!0),c(null);try{const[s,f]=await Promise.all([U(),O()]);r(s),o(f)}catch(s){c(s instanceof Error?s.message:"Failed to load tokens")}finally{d(!1)}}n.useEffect(()=>{a()},[]);async function m(){if(confirm("Rotate access key? Existing tokens stay valid but the old accessKey will stop working immediately."))try{r(await B())}catch(s){c(s instanceof Error?s.message:"Failed to rotate access key")}}async function g(s){if(confirm("Delete this token? It will stop working immediately."))try{await M(s),o(f=>f.filter(P=>P.id!==s))}catch(f){c(f instanceof Error?f.message:"Failed to delete token")}}return e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:"Access Key"}),e.jsx("code",{className:"px-2 py-1 rounded bg-[var(--surface)] border border-[var(--border)] text-xs",children:t||"…"}),e.jsx("button",{onClick:()=>navigator.clipboard.writeText(t),"aria-label":"Copy access key",className:"text-[var(--text-dim)] hover:text-[var(--text)]",children:e.jsx($,{size:14})}),e.jsx("button",{onClick:m,"aria-label":"Rotate access key",className:"text-[var(--text-dim)] hover:text-[var(--text)]",children:e.jsx(T,{size:14})}),e.jsx("span",{className:"text-[10px] text-[var(--text-dim)] ml-2",children:"Public — paired with a token below"})]}),e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Identity Tokens"}),e.jsx("button",{onClick:()=>u(!0),className:"h-9 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] font-medium text-sm",children:"Generate new token"})]}),l?e.jsx("div",{className:"text-sm text-[var(--text-dim)]",children:"Loading…"}):h?e.jsxs("div",{className:"text-sm text-[var(--red)] py-6 text-center border border-dashed border-[var(--border)] rounded-md",children:[h," ",e.jsx("button",{className:"underline text-[var(--text)]",onClick:a,children:"Retry"})]}):i.length===0?e.jsx("div",{className:"text-sm text-[var(--text-dim)] py-6 text-center border border-dashed border-[var(--border)] rounded-md",children:"No tokens yet — generate one to use programmatically."}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-[11px] text-[var(--text-dim)]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left py-2",children:"Name"}),e.jsx("th",{className:"text-left py-2",children:"Issued"}),e.jsx("th",{className:"text-left py-2",children:"Last Used"}),e.jsx("th",{className:"text-left py-2",children:"Expires"}),e.jsx("th",{className:"w-px"})]})}),e.jsx("tbody",{children:i.map(s=>{const f=s.expiresAt?new Date(s.expiresAt).getTime()<=Date.now():!1;return e.jsxs("tr",{className:"border-t border-[var(--border)]",children:[e.jsx("td",{className:"py-2",children:s.name}),e.jsx("td",{className:"py-2 text-[var(--text-muted)]",children:w(s.createdAt)}),e.jsx("td",{className:"py-2 text-[var(--text-muted)]",children:s.lastUsedAt?w(s.lastUsedAt):"—"}),e.jsx("td",{className:`py-2 ${f?"text-[var(--red)]":"text-[var(--text-muted)]"}`,children:s.expiresAt?`${y(s.expiresAt)}${f?" (expired)":""}`:"Never"}),e.jsx("td",{className:"py-2 text-right",children:e.jsx("button",{onClick:()=>g(s.id),"aria-label":"Delete token",className:"text-[var(--red)] hover:opacity-80",children:e.jsx(D,{size:14})})})]},s.id)})})]}),p&&e.jsx(F,{onClose:()=>u(!1),onCreated:s=>{u(!1),b(s),a()}}),x&&e.jsx("div",{className:"fixed inset-0 z-30 bg-black/50 flex items-center justify-center",role:"dialog",children:e.jsxs("div",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-lg w-full max-w-md p-6",children:[e.jsx("h3",{className:"text-base font-semibold mb-2",children:"Token created"}),e.jsx("p",{className:"text-xs text-[var(--text-dim)] mb-3",children:"Copy this now — it will not be shown again."}),e.jsx("code",{className:"block break-all px-3 py-2 rounded bg-[var(--surface)] border border-[var(--border)] text-xs mb-3",children:x.token}),e.jsx("p",{className:"text-[11px] text-[var(--text-dim)] mb-4",children:x.expiresAt?`Expires ${y(x.expiresAt)}`:"No expiry — rotate manually."}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>b(null),className:"h-9 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium",children:"Done"})})]})})]})}function W(){const{me:t}=N(),[r,i]=n.useState("password"),o=t!=null&&t.authDisabled?[{id:"tokens",label:"API tokens"}]:[{id:"password",label:"Password & authentication"},{id:"tokens",label:"API tokens"}],l=o.some(d=>d.id===r)?r:o[0].id;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(A,{icon:K,title:"Profile",subtitle:t?[t.name||t.email,t.role].filter(Boolean).join(" — "):"Your account settings."}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsxs("nav",{className:"w-56 shrink-0 border-r border-[var(--border)] py-6 px-3",children:[e.jsx("div",{className:"text-sm font-semibold mb-4 px-2",children:"Profile settings"}),o.map(d=>e.jsx("button",{onClick:()=>i(d.id),"aria-current":l===d.id?"page":void 0,className:`block w-full text-left px-3 py-2 text-sm rounded-md mb-1 ${l===d.id?"bg-[var(--color-accent)]/10 text-[var(--color-accent)]":"text-[var(--text)] hover:bg-[var(--surface)]"}`,children:d.label},d.id))]}),e.jsx("section",{className:"flex-1 px-8 py-6",children:l==="password"?e.jsx(R,{}):e.jsx(Y,{})})]})]})}export{W as default};
@@ -0,0 +1,26 @@
1
+ import{c as a,r as t,j as l}from"./index-ClrpAMAT.js";/**
2
+ * @license lucide-react v0.555.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const c=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],A=a("camera",c);/**
7
+ * @license lucide-react v0.555.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const u=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],m=a("chevron-left",u);/**
12
+ * @license lucide-react v0.555.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const i=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],I=a("circle",i);/**
17
+ * @license lucide-react v0.555.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const E=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],S=a("house",E);/**
22
+ * @license lucide-react v0.555.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const g=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],O=a("square",g);function T(e){return e.session_id||e.nodeHold||null}const M=t.forwardRef(function(r,d){const n=t.useRef(null),o=t.useCallback(s=>{n.current=s,typeof d=="function"?d(s):d&&(d.current=s)},[d]);return t.useEffect(()=>{const s=n.current;return()=>s==null?void 0:s.removeAttribute("src")},[]),l.jsx("img",{ref:o,...r})}),R={HOME:3,BACK:4,APP_SWITCH:187,VOLUME_UP:24,VOLUME_DOWN:25},C={HOME:"home",VOLUME_UP:"volumeup",VOLUME_DOWN:"volumedown"};function N(e,r){return e!=="auto"?e:r<=1?"1":r===2?"2x1":r<=4?"2x2":"3x2"}const p={selected:new Set,layout:"auto",tiles:[],groupId:null,compositeEnabled:!1,downloadableVideoCount:0,recordingPhase:"idle",recording:!1,startedAt:null,annotateMode:!1,shape:"RECT",color:"#ff3333",overlayAnnotations:{},errorBanner:null,banner:null};function f(e,r){var d;switch(r.type){case"SET_LAYOUT":return{...e,layout:r.layout};case"TOGGLE_SELECTED":{const n=new Set(e.selected);return n.has(r.udid)?n.delete(r.udid):n.add(r.udid),{...e,selected:n}}case"CLEAR_SELECTED":return{...e,selected:new Set};case"SET_TILES":return{...e,tiles:r.tiles};case"ADD_TILE":return e.tiles.some(n=>n.udid===r.tile.udid)?e:{...e,tiles:[...e.tiles,r.tile]};case"PATCH_TILE_DIMS":{let n=!1;const o=e.tiles.map(s=>s.udid!==r.udid||s.screenWidth&&s.screenHeight?s:(n=!0,{...s,screenWidth:r.screenWidth,screenHeight:r.screenHeight,aspect:r.aspect??s.aspect}));return n?{...e,tiles:o}:e}case"REMOVE_TILE":return e.recordingPhase!=="idle"?e:{...e,tiles:e.tiles.filter(n=>n.udid!==r.udid)};case"BIND_RECORDING_IDS":{const n=e.tiles.map(o=>({...o,recordingId:r.map[o.udid]??o.recordingId}));return{...e,tiles:n}}case"SET_RECORDING_PHASE":{const n=r.phase;return{...e,recordingPhase:n,recording:n==="recording"||n==="stopping"}}case"START_RECORDING":{const n=e.tiles.map(o=>({...o,recordingId:r.tileIds[o.udid]??o.recordingId}));return{...e,groupId:r.groupId,compositeEnabled:r.compositeEnabled===!0,downloadableVideoCount:0,recordingPhase:"recording",recording:!0,annotateMode:!1,startedAt:r.startedAt,overlayAnnotations:{},tiles:n}}case"REHYDRATE_RECORDING":{const n=e.tiles.map(o=>({...o,recordingId:r.tileIds[o.udid]??o.recordingId}));return{...e,groupId:r.groupId,compositeEnabled:r.compositeEnabled,downloadableVideoCount:0,recordingPhase:"recording",recording:!0,annotateMode:!1,startedAt:r.startedAt,overlayAnnotations:r.overlayAnnotations,tiles:n}}case"STOP_RECORDING":{const n=e.tiles.map(o=>({...o,recordingId:void 0}));return{...e,recording:!1,recordingPhase:"idle",annotateMode:!1,overlayAnnotations:{},downloadableVideoCount:r.downloadableVideoCount??e.downloadableVideoCount,compositeEnabled:r.compositeEnabled!==void 0?r.compositeEnabled:e.compositeEnabled,tiles:n}}case"SET_ANNOTATE_MODE":return{...e,annotateMode:r.enabled};case"SET_SHAPE":return{...e,shape:r.shape};case"SET_COLOR":return{...e,color:r.color};case"SET_OVERLAY_ANNOTATIONS":return{...e,overlayAnnotations:{...e.overlayAnnotations,[r.recordingId]:r.annotations}};case"CLEAR_OVERLAY_ANNOTATIONS":return{...e,overlayAnnotations:{}};case"SET_ERROR_BANNER":return{...e,errorBanner:r.message,banner:r.message?{tone:"error",message:r.message}:null};case"SET_BANNER":return{...e,banner:r.banner,errorBanner:((d=r.banner)==null?void 0:d.tone)==="error"?r.banner.message:null};default:return e}}const _=t.createContext(null);function b(){const e=t.useContext(_);if(!e)throw new Error("useMosaic must be used inside <MosaicContext.Provider>");return e}function y(){return t.useReducer(f,p)}function v(e){const r=Math.max(0,Math.floor(e/1e3)),d=Math.floor(r/3600),n=Math.floor(r%3600/60),o=r%60;return d>0?`${d}:${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${n}:${String(o).padStart(2,"0")}`}export{R as A,I as C,S as H,C as I,M,O as S,A as a,m as b,y as c,_ as d,N as e,v as f,T as h,p as i,b as u};
@@ -1 +1 @@
1
- import{i as f,r as s,u as w,k as v,j as e,e as g,m as j}from"./index-C33GjwPr.js";import{A as d}from"./auth-shell-CtMFhbnC.js";import"./network-DpwYGB0-.js";function k(i){return window.location.hash.replace(/^#/,"")||i||void 0}function S(){const i=f(),[r]=s.useState(()=>k(i.token)),u=w(),[a,o]=s.useState("checking"),[n,x]=s.useState(""),[c,h]=s.useState(""),[m,l]=s.useState(null);s.useEffect(()=>{(window.location.hash||i.token)&&window.history.replaceState(null,"","/xenon/reset-password")},[]),s.useEffect(()=>{if(!r){o("invalid");return}v(r).then(t=>o(t?"ready":"invalid"))},[r]);async function p(t){if(t.preventDefault(),l(null),n!==c){l("Passwords do not match.");return}if(n.length<8){l("Password must be at least 8 characters.");return}o("submitting");try{await j(r,n),o("done"),setTimeout(()=>u("/login",{replace:!0}),1500)}catch(b){l(b.message||"Reset failed"),o("ready")}}return a==="checking"?e.jsx(d,{children:e.jsx("div",{className:"text-sm text-[var(--text-muted)] text-center",children:"Checking link…"})}):a==="invalid"?e.jsx(d,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"This link is invalid or expired"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Reset links are good for 1 hour and single-use. Request a new one."}),e.jsx(g,{to:"/forgot-password",className:"inline-block h-10 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium leading-10",children:"Request a new link"})]})}):a==="done"?e.jsx(d,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"Password updated"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Redirecting to sign in…"})]})}):e.jsx(d,{children:e.jsxs("form",{onSubmit:p,children:[e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:"Reset your password"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Choose a new password to sign in with."}),e.jsx("label",{htmlFor:"reset-password",className:"block text-sm font-medium text-[var(--text)] mb-1.5",children:"New password"}),e.jsx("input",{id:"reset-password",type:"password",autoComplete:"new-password",value:n,onChange:t=>x(t.target.value),autoFocus:!0,required:!0,className:"w-full mb-3 h-10 px-3 rounded-lg bg-[var(--bg)] border border-[var(--border-strong)] text-sm text-[var(--text)] outline-none focus:border-[var(--color-accent)] focus:shadow-[0_0_0_3px_var(--accent-subtle)]"}),e.jsx("label",{htmlFor:"reset-confirm",className:"block text-sm font-medium text-[var(--text)] mb-1.5",children:"Confirm new password"}),e.jsx("input",{id:"reset-confirm",type:"password",autoComplete:"new-password",value:c,onChange:t=>h(t.target.value),required:!0,className:"w-full mb-3 h-10 px-3 rounded-lg bg-[var(--bg)] border border-[var(--border-strong)] text-sm text-[var(--text)] outline-none focus:border-[var(--color-accent)] focus:shadow-[0_0_0_3px_var(--accent-subtle)]"}),m&&e.jsx("div",{role:"alert",className:"text-sm text-[var(--red)] mb-3",children:m}),e.jsx("button",{type:"submit",disabled:a==="submitting"||n.length<8,className:"mt-5 w-full h-10 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] font-medium text-sm disabled:opacity-50",children:a==="submitting"?"Updating…":"Update password"})]})})}export{S as default};
1
+ import{i as f,r as s,u as w,k as v,j as e,e as g,m as j}from"./index-ClrpAMAT.js";import{A as d}from"./auth-shell-CHmBFmOz.js";import"./network-CBGUjJDJ.js";function k(i){return window.location.hash.replace(/^#/,"")||i||void 0}function S(){const i=f(),[r]=s.useState(()=>k(i.token)),u=w(),[a,o]=s.useState("checking"),[n,x]=s.useState(""),[c,h]=s.useState(""),[m,l]=s.useState(null);s.useEffect(()=>{(window.location.hash||i.token)&&window.history.replaceState(null,"","/xenon/reset-password")},[]),s.useEffect(()=>{if(!r){o("invalid");return}v(r).then(t=>o(t?"ready":"invalid"))},[r]);async function p(t){if(t.preventDefault(),l(null),n!==c){l("Passwords do not match.");return}if(n.length<8){l("Password must be at least 8 characters.");return}o("submitting");try{await j(r,n),o("done"),setTimeout(()=>u("/login",{replace:!0}),1500)}catch(b){l(b.message||"Reset failed"),o("ready")}}return a==="checking"?e.jsx(d,{children:e.jsx("div",{className:"text-sm text-[var(--text-muted)] text-center",children:"Checking link…"})}):a==="invalid"?e.jsx(d,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"This link is invalid or expired"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Reset links are good for 1 hour and single-use. Request a new one."}),e.jsx(g,{to:"/forgot-password",className:"inline-block h-10 px-4 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] text-sm font-medium leading-10",children:"Request a new link"})]})}):a==="done"?e.jsx(d,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-xl font-semibold mb-3",children:"Password updated"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Redirecting to sign in…"})]})}):e.jsx(d,{children:e.jsxs("form",{onSubmit:p,children:[e.jsx("h1",{className:"text-2xl font-semibold mb-1",children:"Reset your password"}),e.jsx("p",{className:"text-sm text-[var(--text-muted)] mb-6",children:"Choose a new password to sign in with."}),e.jsx("label",{htmlFor:"reset-password",className:"block text-sm font-medium text-[var(--text)] mb-1.5",children:"New password"}),e.jsx("input",{id:"reset-password",type:"password",autoComplete:"new-password",value:n,onChange:t=>x(t.target.value),autoFocus:!0,required:!0,className:"w-full mb-3 h-10 px-3 rounded-lg bg-[var(--bg)] border border-[var(--border-strong)] text-sm text-[var(--text)] outline-none focus:border-[var(--color-accent)] focus:shadow-[0_0_0_3px_var(--accent-subtle)]"}),e.jsx("label",{htmlFor:"reset-confirm",className:"block text-sm font-medium text-[var(--text)] mb-1.5",children:"Confirm new password"}),e.jsx("input",{id:"reset-confirm",type:"password",autoComplete:"new-password",value:c,onChange:t=>h(t.target.value),required:!0,className:"w-full mb-3 h-10 px-3 rounded-lg bg-[var(--bg)] border border-[var(--border-strong)] text-sm text-[var(--text)] outline-none focus:border-[var(--color-accent)] focus:shadow-[0_0_0_3px_var(--accent-subtle)]"}),m&&e.jsx("div",{role:"alert",className:"text-sm text-[var(--red)] mb-3",children:m}),e.jsx("button",{type:"submit",disabled:a==="submitting"||n.length<8,className:"mt-5 w-full h-10 rounded-md bg-[var(--color-accent)] text-[var(--color-on-accent)] font-medium text-sm disabled:opacity-50",children:a==="submitting"?"Updating…":"Update password"})]})})}export{S as default};
@@ -1,4 +1,4 @@
1
- import{F as Me,R as Ie,i as Ir,u as Tr,j as J,G as Or}from"./index-C33GjwPr.js";import{A as vr}from"./arrow-left-uY7F6z1K.js";const qn=["http","https","mailto","tel"];function Lr(e){const n=(e||"").trim(),t=n.charAt(0);if(t==="#"||t==="/")return n;const r=n.indexOf(":");if(r===-1)return n;let i=-1;for(;++i<qn.length;){const l=qn[i];if(r===l.length&&n.slice(0,l.length).toLowerCase()===l)return n}return i=n.indexOf("?"),i!==-1&&r>i||(i=n.indexOf("#"),i!==-1&&r>i)?n:"javascript:void(0)"}/*!
1
+ import{G as Me,R as Ie,i as Ir,u as Tr,j as J,H as Or}from"./index-ClrpAMAT.js";import{A as vr}from"./arrow-left-BtJIXXMY.js";const qn=["http","https","mailto","tel"];function Lr(e){const n=(e||"").trim(),t=n.charAt(0);if(t==="#"||t==="/")return n;const r=n.indexOf(":");if(r===-1)return n;let i=-1;for(;++i<qn.length;){const l=qn[i];if(r===l.length&&n.slice(0,l.length).toLowerCase()===l)return n}return i=n.indexOf("?"),i!==-1&&r>i||(i=n.indexOf("#"),i!==-1&&r>i)?n:"javascript:void(0)"}/*!
2
2
  * Determine if an object is a Buffer
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
@@ -1 +1 @@
1
- import{r as c,j as m}from"./index-C33GjwPr.js";import{c as o}from"./utils-CDN07tui.js";const l=c.forwardRef(({className:s,selectSize:e="md",children:t,...a},r)=>m.jsx("select",{ref:r,className:o("select-base",e==="sm"&&"select-sm",s),...a,children:t}));l.displayName="Select";export{l as S};
1
+ import{r as c,j as m}from"./index-ClrpAMAT.js";import{c as o}from"./utils-CDN07tui.js";const l=c.forwardRef(({className:s,selectSize:e="md",children:t,...a},r)=>m.jsx("select",{ref:r,className:o("select-base",e==="sm"&&"select-sm",s),...a,children:t}));l.displayName="Select";export{l as S};
@@ -1 +1 @@
1
- import{E as e,j as t,N as r}from"./index-C33GjwPr.js";import{l as s}from"./view-state-83Z1gFME.js";const i=()=>{const[a]=e();return t.jsx(r,{to:s(a),replace:!0})};export{i as SelectorDetailRedirect,i as default};
1
+ import{F as e,j as t,N as r}from"./index-ClrpAMAT.js";import{l as s}from"./view-state-83Z1gFME.js";const i=()=>{const[a]=e();return t.jsx(r,{to:s(a),replace:!0})};export{i as SelectorDetailRedirect,i as default};
@@ -1,4 +1,4 @@
1
- import{c as ae,p as ne,r as d,j as t,A as fe,v as re,z as ve,w as ge,t as le,X as I,e as be,E as ye,b as je,K as Ne}from"./index-C33GjwPr.js";import{P as Se}from"./page-header-BpLEuo7i.js";import{a as ke}from"./SegmentedControl-qMSiMN1d.js";import{B as N}from"./button-CQoMQEj_.js";import{S as we}from"./stat-tile-lT8WcPgu.js";import{L as ie,n as Ce,C as Ae}from"./line-chart-PE5e9PeN.js";import{E as $e}from"./EmptyState-wZeJbGhN.js";import{I as Me}from"./input-DwiVcO3Q.js";import{S as O}from"./select-xiba9PSx.js";import{s as _,r as Y,w as Ee,P as Te,b as _e}from"./view-state-83Z1gFME.js";import{p as Le}from"./labels-C21SA4JG.js";import{M as R}from"./Modal-mcM5W_Ji.js";import{C as Ie}from"./check-CAB6RYuc.js";import{C as oe}from"./copy-VM9kWPpE.js";import"./utils-CDN07tui.js";import"./index-DNDdHt3h.js";/**
1
+ import{c as ae,p as ne,r as d,j as t,A as fe,v as re,z as ve,w as ge,t as le,X as I,e as be,F as ye,b as je,O as Ne}from"./index-ClrpAMAT.js";import{P as Se}from"./page-header-B92DKLiq.js";import{a as ke}from"./SegmentedControl-B8tTU8kD.js";import{B as N}from"./button-CqhPBGRj.js";import{S as we}from"./stat-tile-BU9e4s36.js";import{L as ie,n as Ce,C as Ae}from"./line-chart-EIBXwYGo.js";import{E as $e}from"./EmptyState-BeuTrlN_.js";import{I as Me}from"./input-CyKdLnEx.js";import{S as z}from"./select-BBOIZTYm.js";import{s as _,r as Y,w as Ee,P as Te,b as _e}from"./view-state-83Z1gFME.js";import{p as Le}from"./labels-C21SA4JG.js";import{M as R}from"./Modal-ByESeBRC.js";import{C as Ie}from"./check-DpbIM4E0.js";import{C as oe}from"./copy-BKNyOehd.js";import"./utils-CDN07tui.js";import"./index-DauQh6ie.js";/**
2
2
  * @license lucide-react v0.555.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as ae,p as ne,r as d,j as t,A as fe,v as re,z as ve,w as ge,t as le,X a
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Re=ae("send",Pe),Fe=3e4,ze=5*6e4;function Oe({onShow:e}){const{on:n}=ne(),[s,l]=d.useState([]);if(d.useEffect(()=>{const o=n("selector_regressed",r=>{l(i=>{const u=Date.now()-ze;return[...i.filter(b=>b.receivedAt>=u),{strategy:(r==null?void 0:r.original_strategy)??"",selector:(r==null?void 0:r.original_selector)??"",receivedAt:Date.now()}]})});return()=>{o&&o()}},[n]),d.useEffect(()=>{if(s.length===0)return;const o=setTimeout(()=>l([]),Fe);return()=>clearTimeout(o)},[s]),s.length===0)return null;const c=s.length===1?s[0]:null;return t.jsxs("div",{role:"alert",className:"flex items-center gap-3 rounded-lg border border-[var(--color-warning)] bg-[var(--surface)] px-4 py-2.5 text-sm text-[var(--text)]",children:[t.jsx(fe,{size:14,className:"shrink-0 text-[var(--color-warning)]","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:c?t.jsxs(t.Fragment,{children:["A selector you fixed broke again:"," ",t.jsx("code",{className:"font-mono text-xs",title:c.selector,children:c.selector})]}):`${s.length} selectors you fixed broke again in the last 5 minutes.`}),t.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{e(s.map(({strategy:o,selector:r})=>({strategy:o,selector:r}))),l([])},children:"Show selectors to fix"}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>l([]),className:"rounded p-1 text-[var(--text-muted)] hover:text-[var(--text)]",children:t.jsx(re,{size:13})})]})}const He={"accessibility id":"Accessibility ID",xpath:"XPath",id:"ID",name:"Name","class name":"Class Name","-android uiautomator":"UiAutomator","-ios predicate string":"iOS Predicate","-ios class chain":"iOS Class Chain","xenon:visual":"Visual AI (coords)"};function Ue(e){return e?He[e]??e:"(unknown strategy)"}const Xe={fix:"To fix",verifying:"Being verified",fixed:"Fixed",muted:"Muted"},qe={heals:"Most heals",recent:"Most recent",time:"Most time spent healing"},Ve=["Resilio","Native","Fuzzy XML","OCR","Visual AI","LLM"],P={Resilio:"Found it from its saved fingerprint",Native:"Found it again with the original selector","Fuzzy XML":"Found the closest match in the screen's structure",OCR:"Found it by reading the text on screen","Visual AI":"Found it in a screenshot with AI",LLM:"Asked a language model to find it"},Ke=[{value:"android",label:"Android"},{value:"ios",label:"iOS"},{value:"tvos",label:"tvOS"}];function J(e){if(!(e>0))return"0 s";const n=e/1e3;if(n<1)return"<1 s";if(Math.round(n)<60)return`${Math.round(n)} s`;const s=n/60;if(Math.round(s)<60)return`${Math.round(s)} min`;const l=s/60;return`${l<10?l.toFixed(1):Math.round(l)} h`}function q(e,n=Date.now()){if(!e)return"—";const s=Date.parse(e);if(!Number.isFinite(s))return"—";const l=Math.floor(Math.max(0,n-s)/6e4);if(l<1)return"just now";if(l<60)return`${l} min ago`;const c=Math.floor(l/60);if(c<24)return`${c} h ago`;const o=Math.floor(c/24);return o===1?"yesterday":`${o} days ago`}function ce(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function V(e){if(!e)return"—";const n=Date.parse(e);return Number.isFinite(n)?new Date(n).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—"}function Ge(e,n,s,l){const c=`the ${s} days before`;if(e===n)return{text:`Same as ${c}`,tone:"neutral"};if(n===0)return{text:`None ${c}`,tone:"bad"};const o=e>n,r=o?"bad":"good";if(l==="count")return{text:`${Math.abs(e-n)} ${o?"more":"fewer"} than ${c}`,tone:r};if(l==="duration")return{text:`${J(Math.abs(e-n))} ${o?"more":"less"} than ${c}`,tone:r};const i=Math.round(Math.abs(e-n)/n*100);return i===0?{text:`About the same as ${c}`,tone:"neutral"}:{text:`${i}% ${o?"more":"fewer"} than ${c}`,tone:r}}function de(e){return`${Math.round(e*100)}% of heals`}function K(e){return e?Ue(e):"Unknown type"}function Je(e){switch(e==null?void 0:e.status){case"pending":return`Being verified, ${e.cleanBuilds} of 3 clean builds`;case"resolved":return"Fixed";case"muted":return"Muted";default:return"To fix"}}function G(e){return e!=null&&e.name?` by ${e.name}`:""}const We={marked_fixed:"Marked fixed",verification_cancelled:"Verification cancelled",verified:"Verified after 3 clean builds",broke_again:"Broke again",muted:"Muted",unmuted:"Unmuted"};function Ye(e){return`${We[e.action]??"Changed"}${G(e.by)}`}const H=e=>e.toLocaleString(),Qe=({summary:e,days:n})=>{const s=e==null?void 0:e.current,l=e==null?void 0:e.prior,c=[{label:"Selectors that needed healing",value:s==null?void 0:s.distinctSelectors,before:l==null?void 0:l.distinctSelectors,kind:"count",show:H},{label:"Heals",value:s==null?void 0:s.totalHeals,before:l==null?void 0:l.totalHeals,kind:"percent",show:H},{label:"Sessions affected",value:s==null?void 0:s.sessionsTouched,before:l==null?void 0:l.sessionsTouched,kind:"percent",show:H},{label:"Time spent healing",value:s==null?void 0:s.timeSpentMs,before:l==null?void 0:l.timeSpentMs,kind:"duration",show:J}];return t.jsx("div",{className:"grid grid-cols-4 gap-3",children:c.map(o=>{const r=o.value!==void 0&&o.before!==void 0?Ge(o.value,o.before,n,o.kind):null;return t.jsx(we,{label:o.label,value:o.value!==void 0?o.show(o.value):"—",note:r==null?void 0:r.text,noteTone:(r==null?void 0:r.tone)??"neutral"},o.label)})})},Q="var(--color-info)",Z="var(--color-warning)",ee=({color:e,label:n,total:s})=>t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:e}}),t.jsx("span",{children:n}),t.jsx("span",{className:"tabular-nums text-[var(--text)]",children:s.toLocaleString()})]}),Ze=({trend:e,days:n,failed:s})=>{var h;const l=d.useMemo(()=>e??[],[e]),c=((h=l[0])==null?void 0:h.t)??0,o=l.reduce((m,y)=>m+y.heals,0),r=l.reduce((m,y)=>m+y.aiHeals,0),i=d.useMemo(()=>l.map(m=>m.t-c),[l,c]),u=d.useMemo(()=>[{key:"heals",label:"All heals",color:Q,values:l.map(m=>m.heals)},{key:"ai",label:"Heals that used AI",color:Z,values:l.map(m=>m.aiHeals)}],[l]),b=l.reduce((m,y)=>Math.max(m,y.heals),0);let p;return e===null&&s?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Couldn't load heals per day. Try again in a moment."}):e===null?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}):o===0?p=t.jsxs("div",{className:"text-xs text-[var(--text-dim)]",children:["No heals in the last ",n," days."]}):p=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-[var(--text-muted)]",children:[t.jsx(ee,{color:Q,label:"All heals",total:o}),t.jsx(ee,{color:Z,label:"Heals that used AI",total:r})]}),t.jsx(ie,{times:i,series:u,yMax:Ce(b),formatValue:m=>String(Math.round(m)),formatTime:m=>ce(c+m),ariaLabel:"Heals per day",height:120})]}),t.jsx(Ae,{header:"Heals per day",children:p})},D=({title:e,tone:n="neutral",children:s})=>t.jsx("span",{title:e,className:`inline-block max-w-full truncate rounded px-1.5 py-px text-[10px] font-medium ${n==="warning"?"border border-[var(--color-warning)] text-[var(--color-warning)]":"bg-[rgb(var(--rgb-fg)/0.06)] text-[var(--text-muted)]"}`,children:s}),te=({strategy:e,text:n,extra:s})=>t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-0.5 flex min-w-0 items-center gap-1.5",children:[t.jsx(D,{children:K(e)}),s]}),t.jsx("code",{className:"line-clamp-2 break-all font-mono text-[11px] leading-snug text-[var(--text)]",title:n,children:n})]}),et=300,tt=["fix","verifying","fixed","muted"],st=["heals","recent","time"],E=e=>t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:e});function at(e,n,s){const l={key:"selector",label:"Selector",cell:r=>t.jsx(te,{strategy:r.strategy,text:r.selector,extra:e==="fix"&&r.state&&r.state.brokeAgain>0?t.jsx(D,{tone:"warning",children:"Broke again"}):null})},c=r=>({key:"heals",label:r,width:"96px",cell:i=>t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold tabular-nums text-[var(--text)]",children:i.heals.toLocaleString()}),t.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.sessions," ",i.sessions===1?"session":"sessions"]})]})}),o={key:"last",label:"Last healed",width:"104px",cell:r=>E(q(r.lastHealedAt))};switch(e){case"fix":return n?[l,c("Heals"),o]:[l,c("Heals"),o,{key:"method",label:"Healed by",width:"112px",cell:r=>r.topMethod?t.jsx(D,{title:P[r.topMethod],children:r.topMethod}):E("—")},{key:"fix",label:"Suggested fix",width:"34%",cell:r=>r.suggestion?t.jsx(te,{strategy:r.suggestion.strategy,text:r.suggestion.selector,extra:t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:de(r.suggestion.share)})}):E("None yet")}];case"verifying":{const r={key:"progress",label:"Progress",width:"150px",cell:i=>{var u;return t.jsxs("span",{className:"text-xs text-[var(--text)]",children:[((u=i.state)==null?void 0:u.cleanBuilds)??0," of 3 clean builds"]})}};return n?[l,r]:[l,r,{key:"marked",label:"Marked fixed",width:"180px",cell:i=>{var u,b;return E(`${q(((u=i.state)==null?void 0:u.fixedAt)??null)}${G(((b=i.state)==null?void 0:b.fixedBy)??null)}`)}},c(`Heals, ${s} days`)]}case"fixed":{const r={key:"verified",label:"Verified",width:"140px",cell:i=>{var u;return E(V(((u=i.state)==null?void 0:u.resolvedAt)??null))}};return n?[l,r]:[l,r,c(`Heals, ${s} days`)]}case"muted":{const r={key:"muted",label:"Muted",width:"180px",cell:i=>{var u,b;return E(`${V(((u=i.state)==null?void 0:u.mutedAt)??null)}${G(((b=i.state)==null?void 0:b.mutedBy)??null)}`)}};return n?[l,r]:[l,r,{key:"reason",label:"Reason",width:"26%",cell:i=>{var u;return(u=i.state)!=null&&u.muteReason?t.jsx("span",{className:"line-clamp-2 text-xs text-[var(--text)]",children:i.state.muteReason}):E("No reason given")}},c(`Heals, ${s} days`)]}}}function nt(e,n,s){if(n)return{title:`No selectors match “${n}”`,description:"Try fewer or different words."};switch(e){case"fix":return{title:`Nothing to fix in the last ${s} days`,description:"Every selector your tests used was found without healing."};case"verifying":return{title:"Nothing being verified",description:"When you mark a selector fixed, Xenon watches its next 3 clean builds here."};case"fixed":return{title:`Nothing fixed in the last ${s} days`,description:"Selectors that pass 3 clean builds after being marked fixed show here."};case"muted":return{title:"Nothing muted",description:"A muted selector is left out of this list, the CI gate and the digest."}}}const rt=({view:e,data:n,loading:s,compact:l,selectedKey:c,onView:o,onOpen:r,error:i})=>{const[u,b]=d.useState(e.q);d.useEffect(()=>b(e.q),[e.q]),d.useEffect(()=>{if(u===e.q)return;const a=setTimeout(()=>o({q:u,page:1}),et);return()=>clearTimeout(a)},[u,e.q,o]);const p=at(e.tab,l,e.days),h=n&&n.tab===e.tab?n:null,m=(h==null?void 0:h.items)??[],y=(h==null?void 0:h.total)??0,k=(h==null?void 0:h.page)??e.page,w=(h==null?void 0:h.pageSize)??50,T=Math.max(1,Math.ceil(y/w)),A=y===0?0:(k-1)*w+1,C=Math.min(y,k*w),$=nt(e.tab,e.q,e.days);return t.jsxs("section",{"aria-label":"Selectors",className:"rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsx("div",{role:"tablist","aria-label":"Selector status",className:"flex gap-1 border-b border-[var(--border)] px-3",children:tt.map(a=>{var j;const g=e.tab===a,f=(j=n==null?void 0:n.counts)==null?void 0:j[a];return t.jsxs("button",{type:"button",role:"tab","aria-selected":g,onClick:()=>{g||o({tab:a,page:1})},className:`-mb-px flex items-center gap-2 border-b-2 px-3 py-2.5 text-sm ${g?"border-[var(--color-accent)] font-medium text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:[Xe[a],t.jsx("span",{className:"rounded-full bg-[rgb(var(--rgb-fg)/0.08)] px-1.5 text-[11px] tabular-nums",children:typeof f=="number"?f.toLocaleString():"–"})]},a)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--border)] px-3 py-2.5",children:[t.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[t.jsx(ve,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-dim)]"}),t.jsx(Me,{type:"search","aria-label":"Search",value:u,onChange:a=>b(a.target.value),placeholder:e.tab==="fix"?"Search selectors and fixes":"Search selectors",className:"h-8 w-full pl-8 pr-2 text-xs"})]}),e.tab==="fix"&&t.jsxs(t.Fragment,{children:[t.jsxs(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Platform",value:e.platform,onChange:a=>o({platform:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All platforms"}),Ke.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))]}),t.jsxs(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Healing method",value:e.method,onChange:a=>o({method:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All healing methods"}),Ve.map(a=>t.jsx("option",{value:a,title:P[a],children:a},a))]}),t.jsx(O,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Sort",value:e.sort,onChange:a=>o({sort:a.target.value,page:1}),children:st.map(a=>t.jsx("option",{value:a,children:qe[a]},a))})]})]}),h?m.length===0?t.jsx($e,{title:$.title,description:$.description}):t.jsxs("table",{className:"w-full table-fixed text-left",children:[t.jsx("colgroup",{children:p.map(a=>t.jsx("col",{style:a.width?{width:a.width}:void 0},a.key))}),t.jsx("thead",{children:t.jsx("tr",{children:p.map(a=>t.jsx("th",{scope:"col",className:"px-3 py-2 text-[11px] font-medium text-[var(--text-muted)]",children:a.label},a.key))})}),t.jsx("tbody",{children:m.map(a=>{const g=_(a),f=g===c,j=()=>r({strategy:a.strategy,selector:a.selector});return t.jsx("tr",{tabIndex:0,"data-selector-row":"","data-key":g,"aria-current":f?"true":void 0,onClick:j,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),j())},className:`cursor-pointer border-t border-[var(--border)] align-top outline-none hover:bg-[rgb(var(--rgb-fg)/0.03)] focus-visible:bg-[rgb(var(--rgb-fg)/0.05)] ${f?"bg-[rgb(var(--rgb-fg)/0.06)]":""}`,children:p.map(M=>t.jsx("td",{className:"px-3 py-2.5 text-xs",children:M.cell(a)},M.key))},g)})})]}):t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:i&&!s?"Couldn't load selectors. Try again in a moment.":"Loading selectors…"}),y>0&&t.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] px-3 py-2 text-xs text-[var(--text-muted)]",children:[t.jsxs("span",{className:"tabular-nums",children:[A,"–",C," of ",y.toLocaleString()]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{variant:"secondary",size:"sm",disabled:k<=1,onClick:()=>o({page:k-1}),children:"Previous"}),t.jsx(N,{variant:"secondary",size:"sm",disabled:k>=T,onClick:()=>o({page:k+1}),children:"Next"})]})]})]})},lt={javascript:{"accessibility id":e=>`await driver.findElement('accessibility id', '${e}')`,xpath:e=>`await driver.findElement('xpath', '${e}')`,id:e=>`await driver.findElement('id', '${e}')`,name:e=>`await driver.findElement('name', '${e}')`,"class name":e=>`await driver.findElement('class name', '${e}')`,"-android uiautomator":e=>`await driver.findElement('-android uiautomator', '${e}')`,"-ios predicate string":e=>`await driver.findElement('-ios predicate string', '${e}')`,"-ios class chain":e=>`await driver.findElement('-ios class chain', '${e}')`},java:{"accessibility id":e=>`driver.findElement(AppiumBy.accessibilityId("${e}"))`,xpath:e=>`driver.findElement(AppiumBy.xpath("${e}"))`,id:e=>`driver.findElement(AppiumBy.id("${e}"))`,name:e=>`driver.findElement(AppiumBy.name("${e}"))`,"class name":e=>`driver.findElement(AppiumBy.className("${e}"))`,"-android uiautomator":e=>`driver.findElement(AppiumBy.androidUIAutomator("${e}"))`,"-ios predicate string":e=>`driver.findElement(AppiumBy.iOSNsPredicateString("${e}"))`,"-ios class chain":e=>`driver.findElement(AppiumBy.iOSClassChain("${e}"))`},python:{"accessibility id":e=>`driver.find_element(AppiumBy.ACCESSIBILITY_ID, '${e}')`,xpath:e=>`driver.find_element(AppiumBy.XPATH, '${e}')`,id:e=>`driver.find_element(AppiumBy.ID, '${e}')`,name:e=>`driver.find_element(AppiumBy.NAME, '${e}')`,"class name":e=>`driver.find_element(AppiumBy.CLASS_NAME, '${e}')`,"-android uiautomator":e=>`driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, '${e}')`,"-ios predicate string":e=>`driver.find_element(AppiumBy.IOS_PREDICATE, '${e}')`,"-ios class chain":e=>`driver.find_element(AppiumBy.IOS_CLASS_CHAIN, '${e}')`},csharp:{"accessibility id":e=>`driver.FindElement(MobileBy.AccessibilityId("${e}"))`,xpath:e=>`driver.FindElement(By.XPath("${e}"))`,id:e=>`driver.FindElement(By.Id("${e}"))`,name:e=>`driver.FindElement(By.Name("${e}"))`,"class name":e=>`driver.FindElement(By.ClassName("${e}"))`},ruby:{"accessibility id":e=>`driver.find_element(:accessibility_id, '${e}')`,xpath:e=>`driver.find_element(:xpath, '${e}')`,id:e=>`driver.find_element(:id, '${e}')`,name:e=>`driver.find_element(:name, '${e}')`,"class name":e=>`driver.find_element(:class_name, '${e}')`}};function it(e,n){const s=e==="java"||e==="csharp",l=n.replace(/\\/g,"\\\\");return s?l.replace(/"/g,'\\"'):l.replace(/'/g,"\\'")}function ue(e,n,s){var c;if(n==="xenon:visual")return"/* Visual AI (coordinates) — no portable Appium snippet. Use snapshot view to find a stable native locator. */";const l=(c=lt[e])==null?void 0:c[n];return l?l(it(e,s)):`${(n??"").toString().toUpperCase()}: ${s}`}const W=[{value:"javascript",short:"JS",label:"JavaScript (WebdriverIO)"},{value:"java",short:"Java",label:"Java (Appium-Java)"},{value:"python",short:"Py",label:"Python (Appium-Python)"},{value:"csharp",short:"C#",label:"C# (.NET)"},{value:"ruby",short:"Rb",label:"Ruby"}],me="xenon.copyLang";function ot(){try{const e=localStorage.getItem(me);return e&&W.find(n=>n.value===e)?e:null}catch{return null}}function ct(e){try{localStorage.setItem(me,e)}catch{}}function xe(e){var n;return((n=W.find(s=>s.value===e))==null?void 0:n.short)??e}function dt({open:e,initialLang:n,strategy:s,value:l,onCopy:c,onClose:o}){const[r,i]=d.useState(n??"javascript"),[u,b]=d.useState(!0),p=ue(r,s,l),h=async()=>{try{await navigator.clipboard.writeText(p)}catch{}u&&ct(r),c(r,p),o()};return t.jsxs(R,{open:e,onClose:o,title:"Choose your default copy language",width:520,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:o,children:"Cancel"}),t.jsxs(N,{onClick:h,children:["Copy as ",xe(r)]})]}),children:[t.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"Snippets will be copied in this language until you change it."}),t.jsx("ul",{className:"mb-3 space-y-1",children:W.map(m=>t.jsx("li",{children:t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text)]",children:[t.jsx("input",{type:"radio",name:"copy-lang",value:m.value,checked:r===m.value,onChange:()=>i(m.value)}),m.label]})},m.value))}),t.jsx("div",{className:"mb-1 text-[11px] font-semibold text-[var(--text-dim)]",children:"Preview"}),t.jsx("pre",{className:"mb-3 overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--surface-sunken)] p-3 font-mono text-[11px] text-[var(--text)]",children:t.jsx("code",{children:p})}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-muted)]",children:[t.jsx("input",{type:"checkbox",checked:u,onChange:m=>b(m.target.checked)}),"Remember my choice"]})]})}function ut({strategy:e,value:n,onCopied:s}){const[l,c]=d.useState(!1),[o,r]=d.useState(!1),i=ot(),u=e==="xenon:visual",b=async()=>{if(!i){c(!0);return}try{await navigator.clipboard.writeText(ue(i,e,n))}catch{}r(!0),s(i),setTimeout(()=>r(!1),1500)},p=i?`Copy as ${xe(i)}`:"Copy as code";return t.jsxs("span",{className:"inline-flex shrink-0",children:[t.jsxs(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-r-none",onClick:h=>{h.stopPropagation(),b()},disabled:u&&!n,"aria-label":p,title:u?"Found by its place on screen: there is no selector to copy":p,children:[o?t.jsx(Ie,{size:12}):t.jsx(oe,{size:12}),t.jsx("span",{children:o?"Copied":i?p:"Copy as…"})]}),t.jsx(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-l-none border-l-0 px-1.5",onClick:h=>{h.stopPropagation(),c(!0)},title:"Choose copy language","aria-label":"Choose copy language",children:t.jsx(ge,{size:12})}),t.jsx(dt,{open:l,initialLang:i??void 0,strategy:e,value:n,onCopy:h=>{r(!0),s(h),setTimeout(()=>r(!1),1500)},onClose:()=>c(!1)})]})}const se=500,mt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Mark this selector fixed?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:l,disabled:n,children:"Mark fixed"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Xenon watches the next 3 clean builds. If this selector heals again, it goes back to To fix."})}),xt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Cancel verification?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Keep verifying"}),t.jsx(N,{onClick:l,disabled:n,children:"Cancel verification"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"The selector goes back to To fix, and its clean builds start again from zero."})}),ht=({open:e,busy:n,onClose:s,onConfirm:l})=>{const[c,o]=d.useState("");return d.useEffect(()=>{e&&o("")},[e]),t.jsxs(R,{open:e,onClose:s,title:"Mute this selector?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:()=>l(c.trim()),disabled:n,children:"Mute"})]}),children:[t.jsx("p",{className:"mb-3 text-sm text-[var(--text-muted)]",children:"A muted selector is left out of this list, the CI gate and the digest, for everyone, until someone unmutes it."}),t.jsx("label",{htmlFor:"mute-reason",className:"block text-xs font-medium text-[var(--text)]",children:"Reason (optional)"}),t.jsx("textarea",{id:"mute-reason",value:c,maxLength:se,rows:3,placeholder:"Screen being redesigned",onChange:r=>o(r.target.value),className:"mt-1 w-full rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1.5 text-sm text-[var(--text)]"}),t.jsxs("div",{className:"mt-1 text-right text-[11px] tabular-nums text-[var(--text-dim)]",children:[c.length,"/",se]})]})},pt={mark_fixed:"Marked fixed. Xenon is watching the next 3 clean builds.",mute:"Muted.",unmute:"Unmuted.",cancel_verification:"Verification cancelled."},ft={pending:"border-[var(--color-info)] text-[var(--color-info)]",resolved:"border-[var(--color-success)] text-[var(--color-success)]",muted:"border-[var(--border-strong)] text-[var(--text-muted)]"},vt=({state:e})=>t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[11px] font-medium ${ft[(e==null?void 0:e.status)??""]??"border-[var(--color-danger)] text-[var(--color-danger)]"}`,children:Je(e)}),U=({label:e,onClick:n,children:s})=>t.jsx("button",{type:"button","aria-label":e,title:e,onClick:n,className:"rounded p-1.5 text-[var(--text-muted)] hover:bg-[rgb(var(--rgb-fg)/0.06)] hover:text-[var(--text)]",children:s}),L=({title:e,children:n})=>t.jsxs("section",{"aria-label":e,children:[t.jsx("h3",{className:"mb-2 text-xs font-semibold text-[var(--text)]",children:e}),n]}),X=({title:e,rows:n})=>n.length===0?null:t.jsxs("div",{className:"mb-3",children:[t.jsx("div",{className:"mb-1 text-[11px] text-[var(--text-dim)]",children:e}),n.map(s=>t.jsxs("div",{className:"flex justify-between gap-3 py-0.5 text-xs",children:[t.jsx("span",{className:"min-w-0 truncate text-[var(--text)]",title:s.label,children:s.label}),t.jsx("span",{className:"shrink-0 tabular-nums text-[var(--text-muted)]",children:s.count.toLocaleString()})]},s.key))]}),gt=({activity:e})=>t.jsx(L,{title:"Activity",children:e.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No changes recorded yet."}):t.jsx("ul",{children:e.map((n,s)=>t.jsxs("li",{className:"flex justify-between gap-3 py-1 text-[11px]",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"text-[var(--text)]",children:Ye(n)}),n.reason&&t.jsxs("span",{className:"text-[var(--text-muted)]",children:[": “",n.reason,"”"]})]}),t.jsx("span",{className:"shrink-0 text-[var(--text-dim)]",children:V(n.at)})]},`${n.at}-${s}`))})}),bt=({target:e,days:n,tz:s,refreshKey:l,onClose:c,onChanged:o})=>{var $;const{toast:r}=le(),[i,u]=d.useState(null),[b,p]=d.useState("loading"),[h,m]=d.useState(null),[y,k]=d.useState(!1);d.useEffect(()=>{u(null),p("loading")},[e.strategy,e.selector]),d.useEffect(()=>{let a=!0;return I.getSelectorPanel(e.strategy,e.selector,n,s).then(({status:g,body:f})=>{a&&(g===404?(u(null),p("missing")):g===200&&f?(u(f),p("ready")):p("failed"))}).catch(()=>{a&&p("failed")}),()=>{a=!1}},[e.strategy,e.selector,n,s,l]);const w=async(a,g)=>{k(!0);try{await I.postSelectorStateAction({original_strategy:e.strategy,original_selector:e.selector,action:a,...g?{reason:g}:{}}),r(pt[a],"success")}catch(f){const j=f.status;r(j===409?"Someone changed this selector just now. It has been refreshed.":j===404?"This selector isn't available any more.":"That didn't work. Try again.","error")}finally{k(!1),m(null),o()}},T=async(a,g)=>{try{await navigator.clipboard.writeText(a),r(g,"success")}catch{r("Couldn't copy: your browser blocked it.","error")}},A=(($=i==null?void 0:i.state)==null?void 0:$.status)??"active",C=d.useMemo(()=>{var f;const a=(i==null?void 0:i.daily)??[],g=((f=a[0])==null?void 0:f.t)??0;return{start:g,times:a.map(j=>j.t-g),values:a.map(j=>j.heals)}},[i]);return t.jsxs("aside",{"aria-label":"Selector details",className:"sticky top-4 flex max-h-[calc(100vh-7rem)] w-[480px] shrink-0 flex-col overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs("header",{className:"border-b border-[var(--border)] p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(D,{children:K(e.strategy)}),i&&t.jsx(vt,{state:i.state}),t.jsxs("span",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx(U,{label:"Copy selector",onClick:()=>void T(e.selector,"Selector copied"),children:t.jsx(oe,{size:14})}),t.jsx(U,{label:"Copy link to this selector",onClick:()=>void T(window.location.href,"Link copied"),children:t.jsx(Be,{size:14})}),t.jsx(U,{label:"Close",onClick:c,children:t.jsx(re,{size:14})})]})]}),t.jsx("code",{className:"mt-2 block break-all font-mono text-xs leading-relaxed text-[var(--text)]",children:e.selector}),(i==null?void 0:i.canAct)&&t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[A==="active"&&e.strategy!==""&&t.jsx(N,{size:"sm",onClick:()=>m("mark_fixed"),children:"Mark fixed"}),A==="pending"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("cancel_verification"),children:"Cancel verification"}),A!=="muted"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("mute"),children:"Mute…"}),A==="muted"&&t.jsx(N,{size:"sm",variant:"secondary",disabled:y,onClick:()=>void w("unmute"),children:"Unmute"})]})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-4",children:[b==="loading"&&t.jsx("p",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}),b==="missing"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"This selector isn't available. It may belong to another team, or Xenon has no heals on record for it."}),b==="failed"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Couldn't load this selector. Try again in a moment."}),i&&i.heals===0&&t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["No heals in the last ",n," days."]}),i&&i.heals>0&&t.jsxs(t.Fragment,{children:[t.jsx(L,{title:"Suggested fix",children:i.suggestions.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Xenon found the element without a selector it can suggest."}):t.jsx("ul",{className:"space-y-2",children:i.suggestions.map((a,g)=>t.jsx("li",{className:`rounded-md border p-2.5 ${g===0?"border-[var(--color-success)]":"border-[var(--border)]"}`,children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[t.jsx(D,{children:K(a.strategy)}),t.jsx("span",{children:de(a.share)}),a.methods.length>0&&t.jsxs("span",{title:a.methods.map(f=>P[f]??f).join(". "),children:["· ",a.methods.join(", ")]}),a.averageConfidence!==null&&t.jsxs("span",{children:["· ",Math.round(a.averageConfidence*100),"% confidence"]})]}),t.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--text)]",children:a.selector})]}),t.jsx(ut,{strategy:a.strategy??e.strategy,value:a.selector,onCopied:f=>r(`Copied as ${f}`,"success")})]})},`${a.strategy??""}\0${a.selector}`))})}),t.jsxs(L,{title:`In the last ${n} days`,children:[t.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:i.heals===1?"heal":"heals",value:i.heals.toLocaleString()},{label:i.sessions===1?"session":"sessions",value:i.sessions.toLocaleString()},{label:"spent healing",value:J(i.timeSpentMs)}].map(a=>t.jsxs("div",{className:"rounded-md bg-[rgb(var(--rgb-fg)/0.04)] px-2.5 py-2",children:[t.jsx("div",{className:"text-sm font-semibold tabular-nums text-[var(--text)]",children:a.value}),t.jsx("div",{className:"text-[11px] text-[var(--text-muted)]",children:a.label})]},a.label))}),C.times.length>1&&t.jsx("div",{className:"mt-3",children:t.jsx(ie,{times:C.times,series:[{key:"heals",label:"Heals",color:"var(--color-info)",values:C.values}],formatValue:a=>String(Math.round(a)),formatTime:a=>ce(C.start+a),ariaLabel:"Heals per day for this selector",height:56})})]}),t.jsxs(L,{title:"Where it happens",children:[t.jsx(X,{title:"Platforms",rows:i.platforms.map(a=>({key:a.name,label:Le(a.name),count:a.count}))}),t.jsx(X,{title:"Builds",rows:i.builds.map(a=>({key:a.id??"",label:a.name,count:a.count}))}),t.jsx(X,{title:"Devices",rows:i.devices.map(a=>({key:a.udid,label:a.name,count:a.count}))})]}),t.jsx(L,{title:"Recent heals",children:t.jsx("ul",{className:"divide-y divide-[var(--border)]",children:i.recent.map(a=>t.jsxs("li",{className:"py-2 text-[11px]",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[var(--text-muted)]",children:[t.jsx("span",{children:q(a.at)}),a.device&&t.jsxs("span",{className:"min-w-0 truncate",children:["· ",a.device]}),a.method&&t.jsxs("span",{title:P[a.method],children:["· ",a.method,a.confidence!==null?` ${Math.round(a.confidence*100)}%`:""]}),t.jsx(be,{className:"ml-auto shrink-0 text-[var(--color-accent)] hover:underline",to:`/builds/${encodeURIComponent(a.buildId??"none")}/sessions/${encodeURIComponent(a.sessionId)}`,children:"Session"})]}),a.healedSelector&&t.jsx("code",{className:"mt-0.5 block truncate font-mono text-[var(--text)]",title:a.healedSelector,children:a.healedSelector})]},a.id))})})]}),i&&t.jsx(gt,{activity:i.activity})]}),t.jsx(mt,{open:h==="mark_fixed",busy:y,onClose:()=>m(null),onConfirm:()=>void w("mark_fixed")}),t.jsx(xt,{open:h==="cancel_verification",busy:y,onClose:()=>m(null),onConfirm:()=>void w("cancel_verification")}),t.jsx(ht,{open:h==="mute",busy:y,onClose:()=>m(null),onConfirm:a=>void w("mute",a||void 0)})]})},yt=1e3,jt=["healing_event","selector_fixed","selector_resolved","selector_regressed","selector_cancelled","selector_muted","selector_unmuted","selector_progress"],Nt=e=>!!e&&(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.isContentEditable),Ft=()=>{const[e,n]=ye(),s=d.useMemo(()=>Y(e),[e]),l=d.useMemo(()=>-new Date().getTimezoneOffset(),[]),{on:c}=ne(),{toast:o}=le(),{me:r}=je(),i=!!r&&(r.role==="ADMIN"||r.role==="SUPER_ADMIN"||!!r.authDisabled),[u,b]=d.useState(null),[p,h]=d.useState(null),[m,y]=d.useState(!1),[k,w]=d.useState(!1),[T,A]=d.useState(!0),[C,$]=d.useState(0),[a,g]=d.useState(!1),f=d.useCallback((x,v=!1)=>n(Ee({...Y(e),...x}),{replace:v}),[e,n]);d.useEffect(()=>{let x=!0;return I.getHealingSummary(s.days,l).then(v=>{x&&(b(v??null),w(!1))}).catch(()=>{x&&w(!0)}),()=>{x=!1}},[s.days,l,C]),d.useEffect(()=>{let x=!0;return A(!0),I.getHealingSelectors({tab:s.tab,days:s.days,q:s.q,platform:s.platform,method:s.method,sort:s.sort,page:s.page}).then(v=>{x&&(h(v??null),y(!1))}).catch(()=>{x&&y(!0)}).finally(()=>{x&&A(!1)}),()=>{x=!1}},[s.tab,s.days,s.q,s.platform,s.method,s.sort,s.page,C]);const j=d.useRef(null);d.useEffect(()=>{const x=()=>{j.current||(j.current=setTimeout(()=>{j.current=null,$(S=>S+1)},yt))},v=jt.map(S=>c(S,x));return()=>{v.forEach(S=>S&&S()),j.current&&clearTimeout(j.current),j.current=null}},[c]);const M=d.useCallback(x=>f({open:x}),[f]),F=d.useCallback(()=>{const x=s.open?_(s.open):null;f({open:null}),setTimeout(()=>{var S;(S=Array.from(document.querySelectorAll("[data-selector-row]")).find(B=>B.dataset.key===x))==null||S.focus()},0)},[s.open,f]),z=d.useCallback(x=>{const v=(p==null?void 0:p.items)??[];if(v.length===0)return;const S=s.open?v.findIndex(pe=>_(pe)===_(s.open)):-1,B=v[S<0?0:Math.min(v.length-1,Math.max(0,S+x))];f({open:{strategy:B.strategy,selector:B.selector}},!0)},[p,s.open,f]);d.useEffect(()=>{if(!s.open)return;const x=v=>{v.defaultPrevented||Nt(document.activeElement)||document.querySelector('[role="dialog"]')||(v.key==="Escape"?(v.preventDefault(),F()):v.key==="ArrowDown"?(v.preventDefault(),z(1)):v.key==="ArrowUp"&&(v.preventDefault(),z(-1)))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[s.open,F,z]);const he=async()=>{g(!0);try{const x=await I.sendHealingDigest({windowDays:s.days,limit:5,minHealCount:2}),v=(x==null?void 0:x.sent)??0;v===0?o("No webhook gets the digest yet. Add one in Notifications.","error"):o(`Digest sent to ${v} webhook${v===1?"":"s"}.`,"success")}catch{o("Couldn't send the digest. Try again.","error")}finally{g(!1)}};return t.jsxs("div",{children:[t.jsx(Se,{icon:Ne,eyebrow:"Test quality",title:"Selector health",subtitle:"Selectors your tests could only find with self-healing. Fix the ones that heal most.",action:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ke,{size:"sm",label:"Period",value:String(s.days),onChange:x=>f({days:Number(x),page:1}),segments:Te.map(x=>({value:String(x),label:`${x} days`}))}),i&&t.jsxs(N,{variant:"secondary",size:"sm",onClick:()=>void he(),disabled:a,children:[t.jsx(Re,{size:14})," Send digest"]})]})}),t.jsxs("div",{className:"space-y-4 px-6 pb-8 pt-4",children:[t.jsx(Oe,{onShow:x=>f(_e(x))}),t.jsx(Qe,{summary:u,days:s.days}),t.jsx(Ze,{trend:u?u.trend??[]:null,days:s.days,failed:k&&!u}),t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(rt,{view:s,data:p,loading:T,compact:!!s.open,selectedKey:s.open?_(s.open):null,onView:f,onOpen:M,error:m})}),s.open&&t.jsx(bt,{target:s.open,days:s.days,tz:l,refreshKey:C,onClose:F,onChanged:()=>$(x=>x+1)})]})]})]})};export{yt as LIVE_REFRESH_MS,Ft as default};
11
+ */const Pe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Re=ae("send",Pe),Fe=3e4,Oe=5*6e4;function ze({onShow:e}){const{on:n}=ne(),[s,l]=d.useState([]);if(d.useEffect(()=>{const o=n("selector_regressed",r=>{l(i=>{const u=Date.now()-Oe;return[...i.filter(b=>b.receivedAt>=u),{strategy:(r==null?void 0:r.original_strategy)??"",selector:(r==null?void 0:r.original_selector)??"",receivedAt:Date.now()}]})});return()=>{o&&o()}},[n]),d.useEffect(()=>{if(s.length===0)return;const o=setTimeout(()=>l([]),Fe);return()=>clearTimeout(o)},[s]),s.length===0)return null;const c=s.length===1?s[0]:null;return t.jsxs("div",{role:"alert",className:"flex items-center gap-3 rounded-lg border border-[var(--color-warning)] bg-[var(--surface)] px-4 py-2.5 text-sm text-[var(--text)]",children:[t.jsx(fe,{size:14,className:"shrink-0 text-[var(--color-warning)]","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:c?t.jsxs(t.Fragment,{children:["A selector you fixed broke again:"," ",t.jsx("code",{className:"font-mono text-xs",title:c.selector,children:c.selector})]}):`${s.length} selectors you fixed broke again in the last 5 minutes.`}),t.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{e(s.map(({strategy:o,selector:r})=>({strategy:o,selector:r}))),l([])},children:"Show selectors to fix"}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>l([]),className:"rounded p-1 text-[var(--text-muted)] hover:text-[var(--text)]",children:t.jsx(re,{size:13})})]})}const He={"accessibility id":"Accessibility ID",xpath:"XPath",id:"ID",name:"Name","class name":"Class Name","-android uiautomator":"UiAutomator","-ios predicate string":"iOS Predicate","-ios class chain":"iOS Class Chain","xenon:visual":"Visual AI (coords)"};function Ue(e){return e?He[e]??e:"(unknown strategy)"}const Xe={fix:"To fix",verifying:"Being verified",fixed:"Fixed",muted:"Muted"},qe={heals:"Most heals",recent:"Most recent",time:"Most time spent healing"},Ve=["Resilio","Native","Fuzzy XML","OCR","Visual AI","LLM"],P={Resilio:"Found it from its saved fingerprint",Native:"Found it again with the original selector","Fuzzy XML":"Found the closest match in the screen's structure",OCR:"Found it by reading the text on screen","Visual AI":"Found it in a screenshot with AI",LLM:"Asked a language model to find it"},Ke=[{value:"android",label:"Android"},{value:"ios",label:"iOS"},{value:"tvos",label:"tvOS"}];function J(e){if(!(e>0))return"0 s";const n=e/1e3;if(n<1)return"<1 s";if(Math.round(n)<60)return`${Math.round(n)} s`;const s=n/60;if(Math.round(s)<60)return`${Math.round(s)} min`;const l=s/60;return`${l<10?l.toFixed(1):Math.round(l)} h`}function q(e,n=Date.now()){if(!e)return"—";const s=Date.parse(e);if(!Number.isFinite(s))return"—";const l=Math.floor(Math.max(0,n-s)/6e4);if(l<1)return"just now";if(l<60)return`${l} min ago`;const c=Math.floor(l/60);if(c<24)return`${c} h ago`;const o=Math.floor(c/24);return o===1?"yesterday":`${o} days ago`}function ce(e){return new Date(e).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function V(e){if(!e)return"—";const n=Date.parse(e);return Number.isFinite(n)?new Date(n).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—"}function Ge(e,n,s,l){const c=`the ${s} days before`;if(e===n)return{text:`Same as ${c}`,tone:"neutral"};if(n===0)return{text:`None ${c}`,tone:"bad"};const o=e>n,r=o?"bad":"good";if(l==="count")return{text:`${Math.abs(e-n)} ${o?"more":"fewer"} than ${c}`,tone:r};if(l==="duration")return{text:`${J(Math.abs(e-n))} ${o?"more":"less"} than ${c}`,tone:r};const i=Math.round(Math.abs(e-n)/n*100);return i===0?{text:`About the same as ${c}`,tone:"neutral"}:{text:`${i}% ${o?"more":"fewer"} than ${c}`,tone:r}}function de(e){return`${Math.round(e*100)}% of heals`}function K(e){return e?Ue(e):"Unknown type"}function Je(e){switch(e==null?void 0:e.status){case"pending":return`Being verified, ${e.cleanBuilds} of 3 clean builds`;case"resolved":return"Fixed";case"muted":return"Muted";default:return"To fix"}}function G(e){return e!=null&&e.name?` by ${e.name}`:""}const We={marked_fixed:"Marked fixed",verification_cancelled:"Verification cancelled",verified:"Verified after 3 clean builds",broke_again:"Broke again",muted:"Muted",unmuted:"Unmuted"};function Ye(e){return`${We[e.action]??"Changed"}${G(e.by)}`}const H=e=>e.toLocaleString(),Qe=({summary:e,days:n})=>{const s=e==null?void 0:e.current,l=e==null?void 0:e.prior,c=[{label:"Selectors that needed healing",value:s==null?void 0:s.distinctSelectors,before:l==null?void 0:l.distinctSelectors,kind:"count",show:H},{label:"Heals",value:s==null?void 0:s.totalHeals,before:l==null?void 0:l.totalHeals,kind:"percent",show:H},{label:"Sessions affected",value:s==null?void 0:s.sessionsTouched,before:l==null?void 0:l.sessionsTouched,kind:"percent",show:H},{label:"Time spent healing",value:s==null?void 0:s.timeSpentMs,before:l==null?void 0:l.timeSpentMs,kind:"duration",show:J}];return t.jsx("div",{className:"grid grid-cols-4 gap-3",children:c.map(o=>{const r=o.value!==void 0&&o.before!==void 0?Ge(o.value,o.before,n,o.kind):null;return t.jsx(we,{label:o.label,value:o.value!==void 0?o.show(o.value):"—",note:r==null?void 0:r.text,noteTone:(r==null?void 0:r.tone)??"neutral"},o.label)})})},Q="var(--color-info)",Z="var(--color-warning)",ee=({color:e,label:n,total:s})=>t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"inline-block h-0.5 w-3",style:{background:e}}),t.jsx("span",{children:n}),t.jsx("span",{className:"tabular-nums text-[var(--text)]",children:s.toLocaleString()})]}),Ze=({trend:e,days:n,failed:s})=>{var h;const l=d.useMemo(()=>e??[],[e]),c=((h=l[0])==null?void 0:h.t)??0,o=l.reduce((m,y)=>m+y.heals,0),r=l.reduce((m,y)=>m+y.aiHeals,0),i=d.useMemo(()=>l.map(m=>m.t-c),[l,c]),u=d.useMemo(()=>[{key:"heals",label:"All heals",color:Q,values:l.map(m=>m.heals)},{key:"ai",label:"Heals that used AI",color:Z,values:l.map(m=>m.aiHeals)}],[l]),b=l.reduce((m,y)=>Math.max(m,y.heals),0);let p;return e===null&&s?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Couldn't load heals per day. Try again in a moment."}):e===null?p=t.jsx("div",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}):o===0?p=t.jsxs("div",{className:"text-xs text-[var(--text-dim)]",children:["No heals in the last ",n," days."]}):p=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-[var(--text-muted)]",children:[t.jsx(ee,{color:Q,label:"All heals",total:o}),t.jsx(ee,{color:Z,label:"Heals that used AI",total:r})]}),t.jsx(ie,{times:i,series:u,yMax:Ce(b),formatValue:m=>String(Math.round(m)),formatTime:m=>ce(c+m),ariaLabel:"Heals per day",height:120})]}),t.jsx(Ae,{header:"Heals per day",children:p})},D=({title:e,tone:n="neutral",children:s})=>t.jsx("span",{title:e,className:`inline-block max-w-full truncate rounded px-1.5 py-px text-[10px] font-medium ${n==="warning"?"border border-[var(--color-warning)] text-[var(--color-warning)]":"bg-[rgb(var(--rgb-fg)/0.06)] text-[var(--text-muted)]"}`,children:s}),te=({strategy:e,text:n,extra:s})=>t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-0.5 flex min-w-0 items-center gap-1.5",children:[t.jsx(D,{children:K(e)}),s]}),t.jsx("code",{className:"line-clamp-2 break-all font-mono text-[11px] leading-snug text-[var(--text)]",title:n,children:n})]}),et=300,tt=["fix","verifying","fixed","muted"],st=["heals","recent","time"],E=e=>t.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:e});function at(e,n,s){const l={key:"selector",label:"Selector",cell:r=>t.jsx(te,{strategy:r.strategy,text:r.selector,extra:e==="fix"&&r.state&&r.state.brokeAgain>0?t.jsx(D,{tone:"warning",children:"Broke again"}):null})},c=r=>({key:"heals",label:r,width:"96px",cell:i=>t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold tabular-nums text-[var(--text)]",children:i.heals.toLocaleString()}),t.jsxs("div",{className:"text-[11px] text-[var(--text-muted)]",children:[i.sessions," ",i.sessions===1?"session":"sessions"]})]})}),o={key:"last",label:"Last healed",width:"104px",cell:r=>E(q(r.lastHealedAt))};switch(e){case"fix":return n?[l,c("Heals"),o]:[l,c("Heals"),o,{key:"method",label:"Healed by",width:"112px",cell:r=>r.topMethod?t.jsx(D,{title:P[r.topMethod],children:r.topMethod}):E("—")},{key:"fix",label:"Suggested fix",width:"34%",cell:r=>r.suggestion?t.jsx(te,{strategy:r.suggestion.strategy,text:r.suggestion.selector,extra:t.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:de(r.suggestion.share)})}):E("None yet")}];case"verifying":{const r={key:"progress",label:"Progress",width:"150px",cell:i=>{var u;return t.jsxs("span",{className:"text-xs text-[var(--text)]",children:[((u=i.state)==null?void 0:u.cleanBuilds)??0," of 3 clean builds"]})}};return n?[l,r]:[l,r,{key:"marked",label:"Marked fixed",width:"180px",cell:i=>{var u,b;return E(`${q(((u=i.state)==null?void 0:u.fixedAt)??null)}${G(((b=i.state)==null?void 0:b.fixedBy)??null)}`)}},c(`Heals, ${s} days`)]}case"fixed":{const r={key:"verified",label:"Verified",width:"140px",cell:i=>{var u;return E(V(((u=i.state)==null?void 0:u.resolvedAt)??null))}};return n?[l,r]:[l,r,c(`Heals, ${s} days`)]}case"muted":{const r={key:"muted",label:"Muted",width:"180px",cell:i=>{var u,b;return E(`${V(((u=i.state)==null?void 0:u.mutedAt)??null)}${G(((b=i.state)==null?void 0:b.mutedBy)??null)}`)}};return n?[l,r]:[l,r,{key:"reason",label:"Reason",width:"26%",cell:i=>{var u;return(u=i.state)!=null&&u.muteReason?t.jsx("span",{className:"line-clamp-2 text-xs text-[var(--text)]",children:i.state.muteReason}):E("No reason given")}},c(`Heals, ${s} days`)]}}}function nt(e,n,s){if(n)return{title:`No selectors match “${n}”`,description:"Try fewer or different words."};switch(e){case"fix":return{title:`Nothing to fix in the last ${s} days`,description:"Every selector your tests used was found without healing."};case"verifying":return{title:"Nothing being verified",description:"When you mark a selector fixed, Xenon watches its next 3 clean builds here."};case"fixed":return{title:`Nothing fixed in the last ${s} days`,description:"Selectors that pass 3 clean builds after being marked fixed show here."};case"muted":return{title:"Nothing muted",description:"A muted selector is left out of this list, the CI gate and the digest."}}}const rt=({view:e,data:n,loading:s,compact:l,selectedKey:c,onView:o,onOpen:r,error:i})=>{const[u,b]=d.useState(e.q);d.useEffect(()=>b(e.q),[e.q]),d.useEffect(()=>{if(u===e.q)return;const a=setTimeout(()=>o({q:u,page:1}),et);return()=>clearTimeout(a)},[u,e.q,o]);const p=at(e.tab,l,e.days),h=n&&n.tab===e.tab?n:null,m=(h==null?void 0:h.items)??[],y=(h==null?void 0:h.total)??0,k=(h==null?void 0:h.page)??e.page,w=(h==null?void 0:h.pageSize)??50,T=Math.max(1,Math.ceil(y/w)),A=y===0?0:(k-1)*w+1,C=Math.min(y,k*w),$=nt(e.tab,e.q,e.days);return t.jsxs("section",{"aria-label":"Selectors",className:"rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsx("div",{role:"tablist","aria-label":"Selector status",className:"flex gap-1 border-b border-[var(--border)] px-3",children:tt.map(a=>{var j;const g=e.tab===a,f=(j=n==null?void 0:n.counts)==null?void 0:j[a];return t.jsxs("button",{type:"button",role:"tab","aria-selected":g,onClick:()=>{g||o({tab:a,page:1})},className:`-mb-px flex items-center gap-2 border-b-2 px-3 py-2.5 text-sm ${g?"border-[var(--color-accent)] font-medium text-[var(--text)]":"border-transparent text-[var(--text-muted)] hover:text-[var(--text)]"}`,children:[Xe[a],t.jsx("span",{className:"rounded-full bg-[rgb(var(--rgb-fg)/0.08)] px-1.5 text-[11px] tabular-nums",children:typeof f=="number"?f.toLocaleString():"–"})]},a)})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--border)] px-3 py-2.5",children:[t.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[t.jsx(ve,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-dim)]"}),t.jsx(Me,{type:"search","aria-label":"Search",value:u,onChange:a=>b(a.target.value),placeholder:e.tab==="fix"?"Search selectors and fixes":"Search selectors",className:"h-8 w-full pl-8 pr-2 text-xs"})]}),e.tab==="fix"&&t.jsxs(t.Fragment,{children:[t.jsxs(z,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Platform",value:e.platform,onChange:a=>o({platform:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All platforms"}),Ke.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))]}),t.jsxs(z,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Healing method",value:e.method,onChange:a=>o({method:a.target.value,page:1}),children:[t.jsx("option",{value:"",children:"All healing methods"}),Ve.map(a=>t.jsx("option",{value:a,title:P[a],children:a},a))]}),t.jsx(z,{selectSize:"sm",className:"!w-auto shrink-0","aria-label":"Sort",value:e.sort,onChange:a=>o({sort:a.target.value,page:1}),children:st.map(a=>t.jsx("option",{value:a,children:qe[a]},a))})]})]}),h?m.length===0?t.jsx($e,{title:$.title,description:$.description}):t.jsxs("table",{className:"w-full table-fixed text-left",children:[t.jsx("colgroup",{children:p.map(a=>t.jsx("col",{style:a.width?{width:a.width}:void 0},a.key))}),t.jsx("thead",{children:t.jsx("tr",{children:p.map(a=>t.jsx("th",{scope:"col",className:"px-3 py-2 text-[11px] font-medium text-[var(--text-muted)]",children:a.label},a.key))})}),t.jsx("tbody",{children:m.map(a=>{const g=_(a),f=g===c,j=()=>r({strategy:a.strategy,selector:a.selector});return t.jsx("tr",{tabIndex:0,"data-selector-row":"","data-key":g,"aria-current":f?"true":void 0,onClick:j,onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),j())},className:`cursor-pointer border-t border-[var(--border)] align-top outline-none hover:bg-[rgb(var(--rgb-fg)/0.03)] focus-visible:bg-[rgb(var(--rgb-fg)/0.05)] ${f?"bg-[rgb(var(--rgb-fg)/0.06)]":""}`,children:p.map(M=>t.jsx("td",{className:"px-3 py-2.5 text-xs",children:M.cell(a)},M.key))},g)})})]}):t.jsx("div",{className:"px-4 py-10 text-center text-xs text-[var(--text-dim)]",children:i&&!s?"Couldn't load selectors. Try again in a moment.":"Loading selectors…"}),y>0&&t.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] px-3 py-2 text-xs text-[var(--text-muted)]",children:[t.jsxs("span",{className:"tabular-nums",children:[A,"–",C," of ",y.toLocaleString()]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(N,{variant:"secondary",size:"sm",disabled:k<=1,onClick:()=>o({page:k-1}),children:"Previous"}),t.jsx(N,{variant:"secondary",size:"sm",disabled:k>=T,onClick:()=>o({page:k+1}),children:"Next"})]})]})]})},lt={javascript:{"accessibility id":e=>`await driver.findElement('accessibility id', '${e}')`,xpath:e=>`await driver.findElement('xpath', '${e}')`,id:e=>`await driver.findElement('id', '${e}')`,name:e=>`await driver.findElement('name', '${e}')`,"class name":e=>`await driver.findElement('class name', '${e}')`,"-android uiautomator":e=>`await driver.findElement('-android uiautomator', '${e}')`,"-ios predicate string":e=>`await driver.findElement('-ios predicate string', '${e}')`,"-ios class chain":e=>`await driver.findElement('-ios class chain', '${e}')`},java:{"accessibility id":e=>`driver.findElement(AppiumBy.accessibilityId("${e}"))`,xpath:e=>`driver.findElement(AppiumBy.xpath("${e}"))`,id:e=>`driver.findElement(AppiumBy.id("${e}"))`,name:e=>`driver.findElement(AppiumBy.name("${e}"))`,"class name":e=>`driver.findElement(AppiumBy.className("${e}"))`,"-android uiautomator":e=>`driver.findElement(AppiumBy.androidUIAutomator("${e}"))`,"-ios predicate string":e=>`driver.findElement(AppiumBy.iOSNsPredicateString("${e}"))`,"-ios class chain":e=>`driver.findElement(AppiumBy.iOSClassChain("${e}"))`},python:{"accessibility id":e=>`driver.find_element(AppiumBy.ACCESSIBILITY_ID, '${e}')`,xpath:e=>`driver.find_element(AppiumBy.XPATH, '${e}')`,id:e=>`driver.find_element(AppiumBy.ID, '${e}')`,name:e=>`driver.find_element(AppiumBy.NAME, '${e}')`,"class name":e=>`driver.find_element(AppiumBy.CLASS_NAME, '${e}')`,"-android uiautomator":e=>`driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, '${e}')`,"-ios predicate string":e=>`driver.find_element(AppiumBy.IOS_PREDICATE, '${e}')`,"-ios class chain":e=>`driver.find_element(AppiumBy.IOS_CLASS_CHAIN, '${e}')`},csharp:{"accessibility id":e=>`driver.FindElement(MobileBy.AccessibilityId("${e}"))`,xpath:e=>`driver.FindElement(By.XPath("${e}"))`,id:e=>`driver.FindElement(By.Id("${e}"))`,name:e=>`driver.FindElement(By.Name("${e}"))`,"class name":e=>`driver.FindElement(By.ClassName("${e}"))`},ruby:{"accessibility id":e=>`driver.find_element(:accessibility_id, '${e}')`,xpath:e=>`driver.find_element(:xpath, '${e}')`,id:e=>`driver.find_element(:id, '${e}')`,name:e=>`driver.find_element(:name, '${e}')`,"class name":e=>`driver.find_element(:class_name, '${e}')`}};function it(e,n){const s=e==="java"||e==="csharp",l=n.replace(/\\/g,"\\\\");return s?l.replace(/"/g,'\\"'):l.replace(/'/g,"\\'")}function ue(e,n,s){var c;if(n==="xenon:visual")return"/* Visual AI (coordinates) — no portable Appium snippet. Use snapshot view to find a stable native locator. */";const l=(c=lt[e])==null?void 0:c[n];return l?l(it(e,s)):`${(n??"").toString().toUpperCase()}: ${s}`}const W=[{value:"javascript",short:"JS",label:"JavaScript (WebdriverIO)"},{value:"java",short:"Java",label:"Java (Appium-Java)"},{value:"python",short:"Py",label:"Python (Appium-Python)"},{value:"csharp",short:"C#",label:"C# (.NET)"},{value:"ruby",short:"Rb",label:"Ruby"}],me="xenon.copyLang";function ot(){try{const e=localStorage.getItem(me);return e&&W.find(n=>n.value===e)?e:null}catch{return null}}function ct(e){try{localStorage.setItem(me,e)}catch{}}function xe(e){var n;return((n=W.find(s=>s.value===e))==null?void 0:n.short)??e}function dt({open:e,initialLang:n,strategy:s,value:l,onCopy:c,onClose:o}){const[r,i]=d.useState(n??"javascript"),[u,b]=d.useState(!0),p=ue(r,s,l),h=async()=>{try{await navigator.clipboard.writeText(p)}catch{}u&&ct(r),c(r,p),o()};return t.jsxs(R,{open:e,onClose:o,title:"Choose your default copy language",width:520,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:o,children:"Cancel"}),t.jsxs(N,{onClick:h,children:["Copy as ",xe(r)]})]}),children:[t.jsx("p",{className:"mb-3 text-xs text-[var(--text-muted)]",children:"Snippets will be copied in this language until you change it."}),t.jsx("ul",{className:"mb-3 space-y-1",children:W.map(m=>t.jsx("li",{children:t.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text)]",children:[t.jsx("input",{type:"radio",name:"copy-lang",value:m.value,checked:r===m.value,onChange:()=>i(m.value)}),m.label]})},m.value))}),t.jsx("div",{className:"mb-1 text-[11px] font-semibold text-[var(--text-dim)]",children:"Preview"}),t.jsx("pre",{className:"mb-3 overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--surface-sunken)] p-3 font-mono text-[11px] text-[var(--text)]",children:t.jsx("code",{children:p})}),t.jsxs("label",{className:"flex items-center gap-2 text-xs text-[var(--text-muted)]",children:[t.jsx("input",{type:"checkbox",checked:u,onChange:m=>b(m.target.checked)}),"Remember my choice"]})]})}function ut({strategy:e,value:n,onCopied:s}){const[l,c]=d.useState(!1),[o,r]=d.useState(!1),i=ot(),u=e==="xenon:visual",b=async()=>{if(!i){c(!0);return}try{await navigator.clipboard.writeText(ue(i,e,n))}catch{}r(!0),s(i),setTimeout(()=>r(!1),1500)},p=i?`Copy as ${xe(i)}`:"Copy as code";return t.jsxs("span",{className:"inline-flex shrink-0",children:[t.jsxs(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-r-none",onClick:h=>{h.stopPropagation(),b()},disabled:u&&!n,"aria-label":p,title:u?"Found by its place on screen: there is no selector to copy":p,children:[o?t.jsx(Ie,{size:12}):t.jsx(oe,{size:12}),t.jsx("span",{children:o?"Copied":i?p:"Copy as…"})]}),t.jsx(N,{type:"button",variant:"secondary",size:"sm",className:"rounded-l-none border-l-0 px-1.5",onClick:h=>{h.stopPropagation(),c(!0)},title:"Choose copy language","aria-label":"Choose copy language",children:t.jsx(ge,{size:12})}),t.jsx(dt,{open:l,initialLang:i??void 0,strategy:e,value:n,onCopy:h=>{r(!0),s(h),setTimeout(()=>r(!1),1500)},onClose:()=>c(!1)})]})}const se=500,mt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Mark this selector fixed?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:l,disabled:n,children:"Mark fixed"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Xenon watches the next 3 clean builds. If this selector heals again, it goes back to To fix."})}),xt=({open:e,busy:n,onClose:s,onConfirm:l})=>t.jsx(R,{open:e,onClose:s,title:"Cancel verification?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Keep verifying"}),t.jsx(N,{onClick:l,disabled:n,children:"Cancel verification"})]}),children:t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"The selector goes back to To fix, and its clean builds start again from zero."})}),ht=({open:e,busy:n,onClose:s,onConfirm:l})=>{const[c,o]=d.useState("");return d.useEffect(()=>{e&&o("")},[e]),t.jsxs(R,{open:e,onClose:s,title:"Mute this selector?",footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"secondary",onClick:s,children:"Cancel"}),t.jsx(N,{onClick:()=>l(c.trim()),disabled:n,children:"Mute"})]}),children:[t.jsx("p",{className:"mb-3 text-sm text-[var(--text-muted)]",children:"A muted selector is left out of this list, the CI gate and the digest, for everyone, until someone unmutes it."}),t.jsx("label",{htmlFor:"mute-reason",className:"block text-xs font-medium text-[var(--text)]",children:"Reason (optional)"}),t.jsx("textarea",{id:"mute-reason",value:c,maxLength:se,rows:3,placeholder:"Screen being redesigned",onChange:r=>o(r.target.value),className:"mt-1 w-full rounded-md border border-[var(--border-strong)] bg-[var(--surface)] px-2 py-1.5 text-sm text-[var(--text)]"}),t.jsxs("div",{className:"mt-1 text-right text-[11px] tabular-nums text-[var(--text-dim)]",children:[c.length,"/",se]})]})},pt={mark_fixed:"Marked fixed. Xenon is watching the next 3 clean builds.",mute:"Muted.",unmute:"Unmuted.",cancel_verification:"Verification cancelled."},ft={pending:"border-[var(--color-info)] text-[var(--color-info)]",resolved:"border-[var(--color-success)] text-[var(--color-success)]",muted:"border-[var(--border-strong)] text-[var(--text-muted)]"},vt=({state:e})=>t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[11px] font-medium ${ft[(e==null?void 0:e.status)??""]??"border-[var(--color-danger)] text-[var(--color-danger)]"}`,children:Je(e)}),U=({label:e,onClick:n,children:s})=>t.jsx("button",{type:"button","aria-label":e,title:e,onClick:n,className:"rounded p-1.5 text-[var(--text-muted)] hover:bg-[rgb(var(--rgb-fg)/0.06)] hover:text-[var(--text)]",children:s}),L=({title:e,children:n})=>t.jsxs("section",{"aria-label":e,children:[t.jsx("h3",{className:"mb-2 text-xs font-semibold text-[var(--text)]",children:e}),n]}),X=({title:e,rows:n})=>n.length===0?null:t.jsxs("div",{className:"mb-3",children:[t.jsx("div",{className:"mb-1 text-[11px] text-[var(--text-dim)]",children:e}),n.map(s=>t.jsxs("div",{className:"flex justify-between gap-3 py-0.5 text-xs",children:[t.jsx("span",{className:"min-w-0 truncate text-[var(--text)]",title:s.label,children:s.label}),t.jsx("span",{className:"shrink-0 tabular-nums text-[var(--text-muted)]",children:s.count.toLocaleString()})]},s.key))]}),gt=({activity:e})=>t.jsx(L,{title:"Activity",children:e.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No changes recorded yet."}):t.jsx("ul",{children:e.map((n,s)=>t.jsxs("li",{className:"flex justify-between gap-3 py-1 text-[11px]",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"text-[var(--text)]",children:Ye(n)}),n.reason&&t.jsxs("span",{className:"text-[var(--text-muted)]",children:[": “",n.reason,"”"]})]}),t.jsx("span",{className:"shrink-0 text-[var(--text-dim)]",children:V(n.at)})]},`${n.at}-${s}`))})}),bt=({target:e,days:n,tz:s,refreshKey:l,onClose:c,onChanged:o})=>{var $;const{toast:r}=le(),[i,u]=d.useState(null),[b,p]=d.useState("loading"),[h,m]=d.useState(null),[y,k]=d.useState(!1);d.useEffect(()=>{u(null),p("loading")},[e.strategy,e.selector]),d.useEffect(()=>{let a=!0;return I.getSelectorPanel(e.strategy,e.selector,n,s).then(({status:g,body:f})=>{a&&(g===404?(u(null),p("missing")):g===200&&f?(u(f),p("ready")):p("failed"))}).catch(()=>{a&&p("failed")}),()=>{a=!1}},[e.strategy,e.selector,n,s,l]);const w=async(a,g)=>{k(!0);try{await I.postSelectorStateAction({original_strategy:e.strategy,original_selector:e.selector,action:a,...g?{reason:g}:{}}),r(pt[a],"success")}catch(f){const j=f.status;r(j===409?"Someone changed this selector just now. It has been refreshed.":j===404?"This selector isn't available any more.":"That didn't work. Try again.","error")}finally{k(!1),m(null),o()}},T=async(a,g)=>{try{await navigator.clipboard.writeText(a),r(g,"success")}catch{r("Couldn't copy: your browser blocked it.","error")}},A=(($=i==null?void 0:i.state)==null?void 0:$.status)??"active",C=d.useMemo(()=>{var f;const a=(i==null?void 0:i.daily)??[],g=((f=a[0])==null?void 0:f.t)??0;return{start:g,times:a.map(j=>j.t-g),values:a.map(j=>j.heals)}},[i]);return t.jsxs("aside",{"aria-label":"Selector details",className:"sticky top-4 flex max-h-[calc(100vh-7rem)] w-[480px] shrink-0 flex-col overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--surface)]",children:[t.jsxs("header",{className:"border-b border-[var(--border)] p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(D,{children:K(e.strategy)}),i&&t.jsx(vt,{state:i.state}),t.jsxs("span",{className:"ml-auto flex items-center gap-0.5",children:[t.jsx(U,{label:"Copy selector",onClick:()=>void T(e.selector,"Selector copied"),children:t.jsx(oe,{size:14})}),t.jsx(U,{label:"Copy link to this selector",onClick:()=>void T(window.location.href,"Link copied"),children:t.jsx(Be,{size:14})}),t.jsx(U,{label:"Close",onClick:c,children:t.jsx(re,{size:14})})]})]}),t.jsx("code",{className:"mt-2 block break-all font-mono text-xs leading-relaxed text-[var(--text)]",children:e.selector}),(i==null?void 0:i.canAct)&&t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[A==="active"&&e.strategy!==""&&t.jsx(N,{size:"sm",onClick:()=>m("mark_fixed"),children:"Mark fixed"}),A==="pending"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("cancel_verification"),children:"Cancel verification"}),A!=="muted"&&t.jsx(N,{size:"sm",variant:"secondary",onClick:()=>m("mute"),children:"Mute…"}),A==="muted"&&t.jsx(N,{size:"sm",variant:"secondary",disabled:y,onClick:()=>void w("unmute"),children:"Unmute"})]})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-4",children:[b==="loading"&&t.jsx("p",{className:"text-xs text-[var(--text-dim)]",children:"Loading…"}),b==="missing"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"This selector isn't available. It may belong to another team, or Xenon has no heals on record for it."}),b==="failed"&&t.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"Couldn't load this selector. Try again in a moment."}),i&&i.heals===0&&t.jsxs("p",{className:"text-sm text-[var(--text-muted)]",children:["No heals in the last ",n," days."]}),i&&i.heals>0&&t.jsxs(t.Fragment,{children:[t.jsx(L,{title:"Suggested fix",children:i.suggestions.length===0?t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Xenon found the element without a selector it can suggest."}):t.jsx("ul",{className:"space-y-2",children:i.suggestions.map((a,g)=>t.jsx("li",{className:`rounded-md border p-2.5 ${g===0?"border-[var(--color-success)]":"border-[var(--border)]"}`,children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[t.jsx(D,{children:K(a.strategy)}),t.jsx("span",{children:de(a.share)}),a.methods.length>0&&t.jsxs("span",{title:a.methods.map(f=>P[f]??f).join(". "),children:["· ",a.methods.join(", ")]}),a.averageConfidence!==null&&t.jsxs("span",{children:["· ",Math.round(a.averageConfidence*100),"% confidence"]})]}),t.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--text)]",children:a.selector})]}),t.jsx(ut,{strategy:a.strategy??e.strategy,value:a.selector,onCopied:f=>r(`Copied as ${f}`,"success")})]})},`${a.strategy??""}\0${a.selector}`))})}),t.jsxs(L,{title:`In the last ${n} days`,children:[t.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:i.heals===1?"heal":"heals",value:i.heals.toLocaleString()},{label:i.sessions===1?"session":"sessions",value:i.sessions.toLocaleString()},{label:"spent healing",value:J(i.timeSpentMs)}].map(a=>t.jsxs("div",{className:"rounded-md bg-[rgb(var(--rgb-fg)/0.04)] px-2.5 py-2",children:[t.jsx("div",{className:"text-sm font-semibold tabular-nums text-[var(--text)]",children:a.value}),t.jsx("div",{className:"text-[11px] text-[var(--text-muted)]",children:a.label})]},a.label))}),C.times.length>1&&t.jsx("div",{className:"mt-3",children:t.jsx(ie,{times:C.times,series:[{key:"heals",label:"Heals",color:"var(--color-info)",values:C.values}],formatValue:a=>String(Math.round(a)),formatTime:a=>ce(C.start+a),ariaLabel:"Heals per day for this selector",height:56})})]}),t.jsxs(L,{title:"Where it happens",children:[t.jsx(X,{title:"Platforms",rows:i.platforms.map(a=>({key:a.name,label:Le(a.name),count:a.count}))}),t.jsx(X,{title:"Builds",rows:i.builds.map(a=>({key:a.id??"",label:a.name,count:a.count}))}),t.jsx(X,{title:"Devices",rows:i.devices.map(a=>({key:a.udid,label:a.name,count:a.count}))})]}),t.jsx(L,{title:"Recent heals",children:t.jsx("ul",{className:"divide-y divide-[var(--border)]",children:i.recent.map(a=>t.jsxs("li",{className:"py-2 text-[11px]",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[var(--text-muted)]",children:[t.jsx("span",{children:q(a.at)}),a.device&&t.jsxs("span",{className:"min-w-0 truncate",children:["· ",a.device]}),a.method&&t.jsxs("span",{title:P[a.method],children:["· ",a.method,a.confidence!==null?` ${Math.round(a.confidence*100)}%`:""]}),t.jsx(be,{className:"ml-auto shrink-0 text-[var(--color-accent)] hover:underline",to:`/builds/${encodeURIComponent(a.buildId??"none")}/sessions/${encodeURIComponent(a.sessionId)}`,children:"Session"})]}),a.healedSelector&&t.jsx("code",{className:"mt-0.5 block truncate font-mono text-[var(--text)]",title:a.healedSelector,children:a.healedSelector})]},a.id))})})]}),i&&t.jsx(gt,{activity:i.activity})]}),t.jsx(mt,{open:h==="mark_fixed",busy:y,onClose:()=>m(null),onConfirm:()=>void w("mark_fixed")}),t.jsx(xt,{open:h==="cancel_verification",busy:y,onClose:()=>m(null),onConfirm:()=>void w("cancel_verification")}),t.jsx(ht,{open:h==="mute",busy:y,onClose:()=>m(null),onConfirm:a=>void w("mute",a||void 0)})]})},yt=1e3,jt=["healing_event","selector_fixed","selector_resolved","selector_regressed","selector_cancelled","selector_muted","selector_unmuted","selector_progress"],Nt=e=>!!e&&(["INPUT","TEXTAREA","SELECT"].includes(e.tagName)||e.isContentEditable),Ft=()=>{const[e,n]=ye(),s=d.useMemo(()=>Y(e),[e]),l=d.useMemo(()=>-new Date().getTimezoneOffset(),[]),{on:c}=ne(),{toast:o}=le(),{me:r}=je(),i=!!r&&(r.role==="ADMIN"||r.role==="SUPER_ADMIN"||!!r.authDisabled),[u,b]=d.useState(null),[p,h]=d.useState(null),[m,y]=d.useState(!1),[k,w]=d.useState(!1),[T,A]=d.useState(!0),[C,$]=d.useState(0),[a,g]=d.useState(!1),f=d.useCallback((x,v=!1)=>n(Ee({...Y(e),...x}),{replace:v}),[e,n]);d.useEffect(()=>{let x=!0;return I.getHealingSummary(s.days,l).then(v=>{x&&(b(v??null),w(!1))}).catch(()=>{x&&w(!0)}),()=>{x=!1}},[s.days,l,C]),d.useEffect(()=>{let x=!0;return A(!0),I.getHealingSelectors({tab:s.tab,days:s.days,q:s.q,platform:s.platform,method:s.method,sort:s.sort,page:s.page}).then(v=>{x&&(h(v??null),y(!1))}).catch(()=>{x&&y(!0)}).finally(()=>{x&&A(!1)}),()=>{x=!1}},[s.tab,s.days,s.q,s.platform,s.method,s.sort,s.page,C]);const j=d.useRef(null);d.useEffect(()=>{const x=()=>{j.current||(j.current=setTimeout(()=>{j.current=null,$(S=>S+1)},yt))},v=jt.map(S=>c(S,x));return()=>{v.forEach(S=>S&&S()),j.current&&clearTimeout(j.current),j.current=null}},[c]);const M=d.useCallback(x=>f({open:x}),[f]),F=d.useCallback(()=>{const x=s.open?_(s.open):null;f({open:null}),setTimeout(()=>{var S;(S=Array.from(document.querySelectorAll("[data-selector-row]")).find(B=>B.dataset.key===x))==null||S.focus()},0)},[s.open,f]),O=d.useCallback(x=>{const v=(p==null?void 0:p.items)??[];if(v.length===0)return;const S=s.open?v.findIndex(pe=>_(pe)===_(s.open)):-1,B=v[S<0?0:Math.min(v.length-1,Math.max(0,S+x))];f({open:{strategy:B.strategy,selector:B.selector}},!0)},[p,s.open,f]);d.useEffect(()=>{if(!s.open)return;const x=v=>{v.defaultPrevented||Nt(document.activeElement)||document.querySelector('[role="dialog"]')||(v.key==="Escape"?(v.preventDefault(),F()):v.key==="ArrowDown"?(v.preventDefault(),O(1)):v.key==="ArrowUp"&&(v.preventDefault(),O(-1)))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[s.open,F,O]);const he=async()=>{g(!0);try{const x=await I.sendHealingDigest({windowDays:s.days,limit:5,minHealCount:2}),v=(x==null?void 0:x.sent)??0;v===0?o("No webhook gets the digest yet. Add one in Notifications.","error"):o(`Digest sent to ${v} webhook${v===1?"":"s"}.`,"success")}catch{o("Couldn't send the digest. Try again.","error")}finally{g(!1)}};return t.jsxs("div",{children:[t.jsx(Se,{icon:Ne,eyebrow:"Test quality",title:"Selector health",subtitle:"Selectors your tests could only find with self-healing. Fix the ones that heal most.",action:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ke,{size:"sm",label:"Period",value:String(s.days),onChange:x=>f({days:Number(x),page:1}),segments:Te.map(x=>({value:String(x),label:`${x} days`}))}),i&&t.jsxs(N,{variant:"secondary",size:"sm",onClick:()=>void he(),disabled:a,children:[t.jsx(Re,{size:14})," Send digest"]})]})}),t.jsxs("div",{className:"space-y-4 px-6 pb-8 pt-4",children:[t.jsx(ze,{onShow:x=>f(_e(x))}),t.jsx(Qe,{summary:u,days:s.days}),t.jsx(Ze,{trend:u?u.trend??[]:null,days:s.days,failed:k&&!u}),t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(rt,{view:s,data:p,loading:T,compact:!!s.open,selectedKey:s.open?_(s.open):null,onView:f,onOpen:M,error:m})}),s.open&&t.jsx(bt,{target:s.open,days:s.days,tz:l,refreshKey:C,onClose:F,onChanged:()=>$(x=>x+1)})]})]})]})};export{yt as LIVE_REFRESH_MS,Ft as default};