ryco-cli 0.1.15 → 0.1.16

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 (74) hide show
  1. package/dist/bin.cjs +2 -2
  2. package/dist/bin.mjs +2 -2
  3. package/dist/client/assets/{AccountSettings-Cey-16wq.js → AccountSettings-CkFq28pN.js} +1 -1
  4. package/dist/client/assets/AiFocusSettings-BI9AgQUi.js +1 -0
  5. package/dist/client/assets/BranchToolbar.logic-6LRTxcuo.js +1 -0
  6. package/dist/client/assets/ChatRightPanel-BSNsAFtv.js +27 -0
  7. package/dist/client/assets/{ChatThreadRouteView-tEo-zoCf.js → ChatThreadRouteView-Daox0F74.js} +1 -1
  8. package/dist/client/assets/CommandPaletteDialog-CIZnwgK9.js +1 -0
  9. package/dist/client/assets/{ConnectionsSettings-B0-Hkwof.js → ConnectionsSettings-DFBNmvfL.js} +2 -2
  10. package/dist/client/assets/DiagnosticsSettings-DhuLK993.js +2 -0
  11. package/dist/client/assets/{DraftChatThreadRouteView-BU2IGTR6.js → DraftChatThreadRouteView-BmVyawpM.js} +1 -1
  12. package/dist/client/assets/{HostedConnectionControls-Cux_sRCM.js → HostedConnectionControls-BvHq5iCa.js} +1 -1
  13. package/dist/client/assets/{HostedHubRoot-CyySCdJV.js → HostedHubRoot-CB5TRXg5.js} +1 -1
  14. package/dist/client/assets/{HostedNativeAuthorizationRoute-490iDXmk.js → HostedNativeAuthorizationRoute-Cb5WJuEG.js} +1 -1
  15. package/dist/client/assets/{HostedRelayTrustNotice-CcDOAwgS.js → HostedRelayTrustNotice-DFcgMZlL.js} +1 -1
  16. package/dist/client/assets/{IntegrationsSettingsPanel-BFTAvxtn.js → IntegrationsSettingsPanel-BIy-rKDv.js} +1 -1
  17. package/dist/client/assets/{KeybindingsSettings-VYgbhiZF.js → KeybindingsSettings-u3yB7Cob.js} +1 -1
  18. package/dist/client/assets/{McpServersSettings-DSDCjoTn.js → McpServersSettings-V32mLD4v.js} +2 -2
  19. package/dist/client/assets/{NewWorktreeDialog-C65Aifeb.js → NewWorktreeDialog-B64WGjQj.js} +2 -2
  20. package/dist/client/assets/{NoActiveThreadState-DehHNgAp.js → NoActiveThreadState-C0MwHtMx.js} +1 -1
  21. package/dist/client/assets/{NodeSecuritySettings-DW9GJ-kU.js → NodeSecuritySettings-CWlThhfV.js} +1 -1
  22. package/dist/client/assets/OpinionatedPluginsSettings-CVzfv5nP.js +1 -0
  23. package/dist/client/assets/{PhoneGetAppInterstitial-CbyVrtDn.js → PhoneGetAppInterstitial-CylfsDBD.js} +1 -1
  24. package/dist/client/assets/{PhoneHome-c0j_TBEC.js → PhoneHome-DBwwEeaI.js} +1 -1
  25. package/dist/client/assets/{PhoneSettingsSurface-5LFRIx_5.js → PhoneSettingsSurface-sDCNEVkR.js} +1 -1
  26. package/dist/client/assets/{ProjectFavicon-CeVJCQCy.js → ProjectFavicon-BjXJxNbQ.js} +1 -1
  27. package/dist/client/assets/{ProviderModelPicker-MFRYAv_3.js → ProviderModelPicker-BTFj53Qv.js} +1 -1
  28. package/dist/client/assets/{ProvidersSettingsPanel-FYBEqSr_.js → ProvidersSettingsPanel-IhzMeM1F.js} +1 -1
  29. package/dist/client/assets/RootAppShell-CG06ruyc.js +6 -0
  30. package/dist/client/assets/{SettingsDialog-CpwoqGS8.js → SettingsDialog-ByR9PwEc.js} +1 -1
  31. package/dist/client/assets/{SettingsPanels-COWRB29-.js → SettingsPanels-CwsCgdds.js} +3 -3
  32. package/dist/client/assets/{SourceControlSettings-DvBNelcO.js → SourceControlSettings-5w4N9XII.js} +1 -1
  33. package/dist/client/assets/{StatisticsPage-DxAKqvVX.js → StatisticsPage-jRyjIh52.js} +1 -1
  34. package/dist/client/assets/{StatisticsPanel-C0xGLlMA.js → StatisticsPanel-CV5eFeO_.js} +1 -1
  35. package/dist/client/assets/{ThreadStatusIndicators-CIOM98q2.js → ThreadStatusIndicators-C40TYVEC.js} +0 -0
  36. package/dist/client/assets/{ThreadTerminalDrawer-DRelLlEP.js → ThreadTerminalDrawer-flv5ZDel.js} +3 -3
  37. package/dist/client/assets/{ThreadWorkspacePanel-CktVSliZ.js → ThreadWorkspacePanel-B-cBAWFz.js} +6 -6
  38. package/dist/client/assets/{WorkItemsTab-CahU_t_S.js → WorkItemsTab-0DE4S4n0.js} +5 -5
  39. package/dist/client/assets/{branding-B7DcCXjn.js → branding-Ck4g7yv3.js} +1 -1
  40. package/dist/client/assets/{capabilities-B1FHGoov.js → capabilities-xa5Ll0KT.js} +1 -1
  41. package/dist/client/assets/{desktopUpdateAtoms-CPlZiFRm.js → desktopUpdateAtoms-hP0oc_If.js} +1 -1
  42. package/dist/client/assets/desktopWorkspace-hOxsGVFz.js +1 -0
  43. package/dist/client/assets/{device-CHdXzvhB.js → device-DIfzlguu.js} +1 -1
  44. package/dist/client/assets/{editorPreferences-B4GvqMiF.js → editorPreferences-B54y5_sx.js} +1 -1
  45. package/dist/client/assets/{index-Gre6bNC8.js → index-Dp3JRlOK.js} +1 -1
  46. package/dist/client/assets/main-B6n7O_N3.js +9 -0
  47. package/dist/client/assets/{projectPaths-D6fHIU1b.js → projectPaths-D8b4yLOe.js} +1 -1
  48. package/dist/client/assets/{providerIconUtils-DiDJeNtT.js → providerIconUtils-Cq0fezxt.js} +1 -1
  49. package/dist/client/assets/{runtime-CPM0EUhb.js → runtime-QZPKtH2P.js} +1 -1
  50. package/dist/client/assets/{session-logic-BalPN1Sc.js → session-logic-BuGYhZKZ.js} +1 -1
  51. package/dist/client/assets/{sidebarProjectFolders-bhNsO9Z_.js → sidebarProjectFolders-Dlo6McCj.js} +2 -2
  52. package/dist/client/assets/storeSelectors-_h41wnN2.js +1 -0
  53. package/dist/client/assets/{threadPinning-BLqwZebi.js → threadPinning-D2e9MEDr.js} +1 -1
  54. package/dist/client/assets/{threadPriorityRefreshRuntime-BoNAlBXK.js → threadPriorityRefreshRuntime-DbEFchoL.js} +1 -1
  55. package/dist/client/assets/types-_h41wnN2.js +1 -0
  56. package/dist/client/assets/{useAtlassian-CoHKzu-e.js → useAtlassian-Zb2Kkt0_.js} +0 -0
  57. package/dist/client/assets/useHandleNewThread-ByVfL71G.js +1 -0
  58. package/dist/client/assets/{usePhoneThreadActions-BIDUSWSI.js → usePhoneThreadActions-BhTVcLtf.js} +1 -1
  59. package/dist/client/assets/{useStatistics-B91973jb.js → useStatistics-Dbp94K5j.js} +1 -1
  60. package/dist/client/assets/{useThreadActions-BCH01d6u.js → useThreadActions-CPL4dO-X.js} +1 -1
  61. package/dist/client/index.html +1 -1
  62. package/package.json +1 -1
  63. package/dist/client/assets/AiFocusSettings-CaHQXDaQ.js +0 -1
  64. package/dist/client/assets/BranchToolbar.logic-DILAA3Cz.js +0 -1
  65. package/dist/client/assets/ChatRightPanel-D-AL07IU.js +0 -27
  66. package/dist/client/assets/CommandPaletteDialog-s7yf5Y2S.js +0 -1
  67. package/dist/client/assets/DiagnosticsSettings-DX5LH9Bt.js +0 -2
  68. package/dist/client/assets/OpinionatedPluginsSettings-DbxPOokL.js +0 -1
  69. package/dist/client/assets/RootAppShell-5HrP6N8H.js +0 -6
  70. package/dist/client/assets/desktopWorkspace-DEZ30LlY.js +0 -1
  71. package/dist/client/assets/main-Dz0zookE.js +0 -9
  72. package/dist/client/assets/storeSelectors-Cf2WDMfx.js +0 -1
  73. package/dist/client/assets/types-Cf2WDMfx.js +0 -1
  74. package/dist/client/assets/useHandleNewThread-Bw460iXT.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{t as r}from"./env-Bcq9YR3B.js";import{Kn as i,Mn as a,Sn as o,Vn as s,Zn as c,Zt as l,bn as u,gn as d,qn as f,xn as p}from"./runtime-QZPKtH2P.js";import{It as m}from"./composerDraftStore-TYv9j3vY.js";import{i as h,r as g}from"./branding-Ck4g7yv3.js";import{t as _}from"./settingsDialogStore-LxRFC5hh.js";import{f as v}from"./useRenderElement-DchFnsR8.js";import{t as y}from"./chevron-down-B7C6FKzM.js";import{i as b}from"./toast-C-0Ft2jD.js";import{t as x}from"./clipboard-copy-C4VV20QR.js";import{n as ee,t as S}from"./play-DYDxlTKo.js";import{t as C}from"./refresh-cw-DopCMrtR.js";import{t as w}from"./triangle-alert-RL_T3KLo.js";import{t as T}from"./utils-CV2fJJxC.js";import{t as E}from"./button-DG8WqjNn.js";import{t as D}from"./useCopyToClipboard-BTpWxumf.js";import{t as O}from"./toastHelpers-CSQRKo4F.js";import"./usePresentationTier-B_SCFvN7.js";import{i as k,r as te,t as ne}from"./alert-DomE7dAt.js";import{a as A,i as re,o as ie,s as j,t as M}from"./select-CZukJlTn.js";import{r as ae}from"./editorPreferences-B54y5_sx.js";import{t as N}from"./badge-w43sx8eF.js";import{i as P,n as F,r as I}from"./settingsLayout-CHJT5wtl.js";var oe=v(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),L=e(t(),1),R=n(),z=`[redacted]`,B=/(token|secret|password|passwd|credential|authorization|bearer|api[-_]?key|apikey|cookie|session[-_]?id|private[-_]?key|pairing[-_]?code|access[-_]?key|signature|email)/i;function se(e){let t;try{t=new URL(e)}catch{return e}(t.username||t.password)&&(t.username=``,t.password=``);for(let e of t.searchParams.keys())B.test(e)&&t.searchParams.set(e,z);return t.toString()}function ce(e){return le(e,!1)}function le(e,t){if(t)return e==null?e:z;if(typeof e==`string`)return se(e);if(Array.isArray(e))return e.map(e=>le(e,!1));if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=le(r,B.test(n));return t}return e}function ue(e){return ce({generatedAt:e.generatedAt,app:e.app,environments:e.environments.map(e=>({environmentId:e.environmentId,label:e.record?.label??null,connectionState:e.runtime?.connectionState??null,authState:e.runtime?.authState??null,role:e.runtime?.role??null,lastError:e.runtime?.lastError??null,lastErrorAt:e.runtime?.lastErrorAt??null,connectedAt:e.runtime?.connectedAt??null,disconnectedAt:e.runtime?.disconnectedAt??null,pushSequence:e.pushSequence})),providers:e.providers.map(e=>({instanceId:e.instanceId,driver:e.driver,enabled:e.enabled,installed:e.installed,version:e.version,status:e.status,availability:e.availability??`available`,authStatus:e.auth.status,authType:e.auth.type??null,message:e.message??null,unavailableReason:e.unavailableReason??null,checkedAt:e.checkedAt})),observability:e.observability?{logsDirectoryConfigured:e.observability.logsDirectoryPath.length>0,localTracingEnabled:e.observability.localTracingEnabled,otlpTracesEnabled:e.observability.otlpTracesEnabled,otlpMetricsEnabled:e.observability.otlpMetricsEnabled,localMetrics:e.observability.localMetrics?{turnQuiescenceAvgMs:e.observability.localMetrics.turnQuiescenceAvgMs,checkpointDurationP95Ms:e.observability.localMetrics.checkpointDurationP95Ms,wsReconnectCount:e.observability.localMetrics.wsReconnectCount,capturedAt:e.observability.localMetrics.capturedAt}:null}:null,performance:e.performance?{local:{turnQuiescenceAvgMs:e.performance.local.turnQuiescenceAvgMs,checkpointDurationP95Ms:e.performance.local.checkpointDurationP95Ms,latestThreadSnapshotDurationMs:e.performance.local.latestThreadSnapshotDurationMs,threadSnapshotDurationP95Ms:e.performance.local.threadSnapshotDurationP95Ms,wsReconnectCount:e.performance.local.wsReconnectCount,windowSampleCounts:{...e.performance.local.windowSampleCounts},capturedAt:e.performance.local.capturedAt},queues:{...e.performance.queues},traceSink:e.performance.traceSink?{...e.performance.traceSink}:null,snapshotCollectionDurationMs:e.performance.snapshotCollectionDurationMs}:null})}function de(e){return JSON.stringify(e,null,2)}function fe(e){return(e?.gapCount??0)>0}var V=m(),H={connected:`bg-success`,connecting:`bg-warning`,error:`bg-destructive`,disconnected:`bg-muted-foreground/40`},U={ready:`bg-success`,warning:`bg-warning`,error:`bg-destructive`,disabled:`bg-muted-foreground/40`};function W(e){let t=(0,R.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=T(`inline-block size-2 shrink-0 rounded-full`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,V.jsx)(`span`,{className:r,"aria-hidden":!0}),t[2]=r,t[3]=i),i}function G(e){if(!e)return`No push events observed yet.`;let t=[`last #${e.highestSequence??`—`}`,`${e.eventCount} events`,`${e.snapshotCount} snapshots`];return e.gapCount>0?t.push(`${e.gapCount} gap${e.gapCount===1?``:`s`}`):t.push(`no gaps`),t.join(` · `)}function pe(e){let t=(0,R.c)(25),{environmentId:n,record:r,runtime:i,pushSequence:a}=e,o=i?.connectionState??`disconnected`,s=r?.label??n,c=fe(a),l=H[o]??`bg-muted-foreground/40`,u;t[0]===l?u=t[1]:(u=(0,V.jsx)(W,{className:l}),t[0]=l,t[1]=u);let d;t[2]!==s||t[3]!==u?(d=(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[u,s]}),t[2]=s,t[3]=u,t[4]=d):d=t[4];let f=i?.authState?` · auth ${i.authState}`:``,p=i?.role?` · ${i.role}`:``,m;t[5]!==o||t[6]!==f||t[7]!==p?(m=(0,V.jsxs)(`span`,{className:`block`,children:[`WS `,o,f,p]}),t[5]=o,t[6]=f,t[7]=p,t[8]=m):m=t[8];let h=c?`text-warning`:`text-muted-foreground/70`,g;t[9]===h?g=t[10]:(g=T(`block`,h),t[9]=h,t[10]=g);let _;t[11]===a?_=t[12]:(_=G(a),t[11]=a,t[12]=_);let v;t[13]!==g||t[14]!==_?(v=(0,V.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]===i?y=t[17]:(y=i?.lastError?(0,V.jsx)(`span`,{className:`block break-all text-destructive`,children:i.lastError}):null,t[16]=i,t[17]=y);let b;t[18]!==v||t[19]!==y||t[20]!==m?(b=(0,V.jsxs)(`span`,{className:`space-y-0.5`,children:[m,v,y]}),t[18]=v,t[19]=y,t[20]=m,t[21]=b):b=t[21];let x;return t[22]!==b||t[23]!==d?(x=(0,V.jsx)(I,{title:d,description:b}),t[22]=b,t[23]=d,t[24]=x):x=t[24],x}function K(e){let t=(0,R.c)(52),{snapshot:n}=e,a=u(be),c=p(ye),d=l(ve),m=f(),_=i(),v=s(),y=n?.performance?.local??null,[ee,S]=(0,L.useState)(!1),C;t[0]!==y||t[1]!==_?(C=_?{..._,...y?{localMetrics:y}:{}}:null,t[0]=y,t[1]=_,t[2]=C):C=t[2];let w=C,T;t[3]!==d||t[4]!==a||t[5]!==c?(T=[...new Set([...Object.keys(a),...Object.keys(c),...Object.keys(d)])].toSorted(),t[3]=d,t[4]=a,t[5]=c,t[6]=T):T=t[6];let k=T,te;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(te={onCopy:_e,onError:ge},t[7]=te):te=t[7];let{copyToClipboard:ne,isCopied:A}=D(te),re;t[8]!==ne||t[9]!==k||t[10]!==w||t[11]!==m||t[12]!==d||t[13]!==a||t[14]!==c||t[15]!==n?.performance?(re=()=>{let e=ue({generatedAt:new Date().toISOString(),app:{version:h,stage:g,isElectron:r,userAgent:typeof navigator>`u`?null:navigator.userAgent},environments:k.map(e=>({environmentId:e,record:a[e]??null,runtime:c[e]??null,pushSequence:d[e]??null})),providers:m,observability:w,performance:n?.performance??null});ne(de(e),void 0)},t[8]=ne,t[9]=k,t[10]=w,t[11]=m,t[12]=d,t[13]=a,t[14]=c,t[15]=n?.performance,t[16]=re):re=t[16],n?.performance;let ie=re,j=_?.logsDirectoryPath??null,M;t[17]!==v||t[18]!==j?(M=()=>{if(!j)return;S(!0);let e=ae(v??[]);if(!e){S(!1),b.add(O({type:`error`,title:`Could not open logs folder`,description:`No available editors found.`}));return}o().shell.openInEditor(j,e).catch(he).finally(()=>{S(!1)})},t[17]=v,t[18]=j,t[19]=M):M=t[19];let N=M,F;t[20]===A?F=t[21]:(F=A?(0,V.jsx)(oe,{className:`size-3.5`}):(0,V.jsx)(x,{className:`size-3.5`}),t[20]=A,t[21]=F);let z=A?`Copied`:`Copy debug bundle`,B;t[22]!==ie||t[23]!==F||t[24]!==z?(B=(0,V.jsxs)(E,{size:`xs`,variant:`outline`,onClick:ie,children:[F,z]}),t[22]=ie,t[23]=F,t[24]=z,t[25]=B):B=t[25];let se;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,V.jsx)(I,{title:`Application`,description:`Version ${h} · ${g}${r?` · Desktop`:` · Browser`}`}),t[26]=se):se=t[26];let ce=j??`Resolving logs directory…`,le=!j||ee,fe=ee?`Opening…`:`Open logs folder`,H;t[27]!==N||t[28]!==le||t[29]!==fe?(H=(0,V.jsx)(E,{size:`xs`,variant:`outline`,disabled:le,onClick:N,children:fe}),t[27]=N,t[28]=le,t[29]=fe,t[30]=H):H=t[30];let U;t[31]!==ce||t[32]!==H?(U=(0,V.jsx)(I,{title:`Logs`,description:ce,control:H}),t[31]=ce,t[32]=H,t[33]=U):U=t[33];let W;t[34]!==U||t[35]!==B?(W=(0,V.jsxs)(P,{title:`Diagnostics`,headerAction:B,children:[se,U]}),t[34]=U,t[35]=B,t[36]=W):W=t[36];let G;t[37]!==k||t[38]!==d||t[39]!==a||t[40]!==c?(G=k.length===0?(0,V.jsx)(I,{title:`No environments`,description:`No environment connections are tracked yet.`}):k.map(e=>(0,V.jsx)(pe,{environmentId:e,record:a[e]??null,runtime:c[e]??null,pushSequence:d[e]??null},e)),t[37]=k,t[38]=d,t[39]=a,t[40]=c,t[41]=G):G=t[41];let K;t[42]===G?K=t[43]:(K=(0,V.jsx)(P,{title:`Environments`,children:G}),t[42]=G,t[43]=K);let q;t[44]===m?q=t[45]:(q=m.length===0?(0,V.jsx)(I,{title:`No providers`,description:`No provider instances are configured.`}):m.map(me),t[44]=m,t[45]=q);let J;t[46]===q?J=t[47]:(J=(0,V.jsx)(P,{title:`Providers`,children:q}),t[46]=q,t[47]=J);let Y;return t[48]!==W||t[49]!==K||t[50]!==J?(Y=(0,V.jsxs)(V.Fragment,{children:[W,K,J]}),t[48]=W,t[49]=K,t[50]=J,t[51]=Y):Y=t[51],Y}function me(e){let t=e.unavailableReason??e.message??null;return(0,V.jsx)(I,{title:(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,V.jsx)(W,{className:U[e.status]??`bg-muted-foreground/40`}),e.displayName??e.instanceId]}),description:(0,V.jsxs)(`span`,{className:`space-y-0.5`,children:[(0,V.jsxs)(`span`,{className:`block`,children:[e.status,` · auth `,e.auth.status,e.version?` · v${e.version}`:``]}),t?(0,V.jsx)(`span`,{className:`block break-all text-muted-foreground/70`,children:t}):null]})},e.instanceId)}function he(e){b.add(O({type:`error`,title:`Could not open logs folder`,description:e instanceof Error?e.message:`Failed to open logs folder.`}))}function ge(e){b.add(O({type:`error`,title:`Could not copy debug bundle`,description:e.message}))}function _e(){b.add({type:`success`,title:`Debug bundle copied`,description:`Secrets are redacted before export.`})}function ve(e){return e.byEnvironment}function ye(e){return e.byId}function be(e){return e.byId}var q=[{method:`thread/snapshot`,requestId:`req_9f2c81d4a6`,startedAt:`12s ago`},{method:`git/status`,requestId:`req_c07b3e51fd`,startedAt:`9s ago`}];function J(e){b.update(e,{type:`loading`,title:`Updating Claude Code`,description:`Running provider update command.`,timeout:0,actionProps:void 0,data:{hideCopyButton:!0}}),window.setTimeout(()=>{b.update(e,{type:`success`,title:`Provider updated`,description:`New sessions will use the updated provider.`,timeout:0,data:{hideCopyButton:!0,dismissAfterVisibleMs:3e3}})},1800)}var Y=[{value:`provider-update`,label:`Provider update available`,fire:()=>{let e=b.add(O({type:`warning`,title:`Update Available: Claude Code v2.1.4`,description:`Install the update now or review provider settings.`,timeout:0,actionProps:{children:`Update`,onClick:()=>J(e)},actionVariant:`default`,data:{hideCopyButton:!0,secondaryActionProps:{children:`Settings`,onClick:()=>_.getState().openSettings(`providers`)},secondaryActionVariant:`outline`}}))}},{value:`pr-checks-passed`,label:`PR checks passed`,fire:()=>{b.add({type:`success`,title:`Checks passed for PR #316`,description:`Redesign the notification toasts · 3273af68e412`,timeout:6e3,actionProps:{children:`Open PR`,onClick:()=>void 0},data:{actionVariant:`outline`}})}},{value:`git-push`,label:`Git push with follow-up action`,fire:()=>{b.add(O({type:`success`,title:`Pushed`,description:`3 commits pushed to origin/feat/notifications-toasts.`,timeout:0,actionProps:{children:`Open PR`,onClick:()=>void 0},actionVariant:`outline`,data:{dismissAfterVisibleMs:1e4}}))}},{value:`git-failed`,label:`Git action failed`,fire:()=>{b.add(O({type:`error`,title:`Action failed`,description:`remote: Permission to sak0a/ryco.git denied to deploy-bot.
2
+ fatal: unable to access 'https://github.com/sak0a/ryco.git/': The requested URL returned error: 403`,timeout:0}))}},{value:`git-pull`,label:`Git pull (loading → result)`,fire:()=>{b.promise(new Promise(e=>{window.setTimeout(e,2400)}),{loading:{title:`Pulling...`},success:{title:`Pulled`,description:`Updated main from origin/main.`},error:{title:`Pull failed`,description:`Could not fast-forward.`}})}},{value:`slow-requests`,label:`Slow requests (expandable)`,fire:()=>{b.add({type:`warning`,title:`Some requests are slow`,description:`2 requests waiting longer than 5s.`,timeout:0,data:{expandableDescriptionTrigger:!0,expandableLabels:{expand:`Show requests`,collapse:`Hide requests`},expandableContent:(0,V.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:q.map(e=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1 py-0.5 font-mono text-[10px]`,children:e.method}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.requestId}),(0,V.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground`,children:e.startedAt})]},e.requestId))})}})}},{value:`reconnected`,label:`Connection restored`,fire:()=>{b.add({type:`success`,title:`Reconnected to Ryco Server`,description:`Connection restored at ${new Date().toLocaleTimeString()}.`,timeout:0,data:{dismissAfterVisibleMs:8e3,hideCopyButton:!0}})}},{value:`long-error`,label:`Error with long details`,fire:()=>{b.add({type:`error`,title:`Provider session crashed`,description:`The provider session exited unexpectedly with code 137 while processing the turn. Last stderr output: FATAL ERROR: Reached heap limit — allocation failed, JavaScript heap out of memory. Restart the session or reduce the attached context, then try again.`,timeout:0})}}],xe=[`pr-checks-passed`,`provider-update`,`git-failed`];function Se(){xe.forEach((e,t)=>{let n=Y.find(t=>t.value===e);n&&window.setTimeout(()=>n.fire(),t*350)})}function Ce(){let e=(0,R.c)(17),[t,n]=(0,L.useState)(Y[0]?.value??``),r;e[0]===t?r=e[1]:(r=Y.find(e=>e.value===t)??Y[0],e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{typeof e==`string`&&n(e)},e[2]=a):a=e[2];let o=i?.label,s;e[3]===o?s=e[4]:(s=(0,V.jsx)(ie,{className:`w-full sm:w-56`,"aria-label":`Notification sample`,children:(0,V.jsx)(j,{children:o})}),e[3]=o,e[4]=s);let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,V.jsx)(A,{align:`end`,alignItemWithTrigger:!1,children:Y.map(we)}),e[5]=c):c=e[5];let l;e[6]!==t||e[7]!==s?(l=(0,V.jsxs)(M,{value:t,onValueChange:a,children:[s,c]}),e[6]=t,e[7]=s,e[8]=l):l=e[8];let u;e[9]===i?u=e[10]:(u=(0,V.jsx)(E,{"aria-label":`Show test notification`,size:`xs`,onClick:()=>i?.fire(),children:`Show`}),e[9]=i,e[10]=u);let d;e[11]!==l||e[12]!==u?(d=(0,V.jsx)(I,{title:`Test notification`,description:`Preview the notification design with realistic samples. Nothing is sent or changed.`,control:(0,V.jsxs)(`div`,{className:`flex w-full items-center gap-2 sm:w-auto`,children:[l,u]})}),e[11]=l,e[12]=u,e[13]=d):d=e[13];let f;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,V.jsx)(I,{title:`Notification stack`,description:`Fire a short burst to preview stacking, peeking, and hover expansion.`,control:(0,V.jsx)(E,{size:`xs`,variant:`outline`,onClick:Se,children:`Show stack`})}),e[14]=f):f=e[14];let p;return e[15]===d?p=e[16]:(p=(0,V.jsxs)(P,{title:`Notifications`,children:[d,f]}),e[15]=d,e[16]=p),p}function we(e){return(0,V.jsx)(re,{hideIndicator:!0,value:e.value,children:e.label},e.value)}function Te(e){return e===`failure`||e===`error`}function X(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function Z(e){return!Number.isFinite(e)||e<=0?`0 ms`:e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(+(e<1e4))} s`:`${(e/6e4).toFixed(1)} min`}function Ee(e){return e===void 0||!Number.isFinite(e)?`n/a`:`${Math.max(0,Math.min(100,e)).toFixed(1)}%`}function Q(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return e;let r=Math.max(0,t-n);return r<1e3?`just now`:r<6e4?`${Math.floor(r/1e3)}s ago`:r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:`${Math.floor(r/864e5)}d ago`}function De(e){return e.map(e=>({label:e.sampledAt,value:e.memory.rssBytes}))}function Oe(e){return e.map(e=>({label:e.sampledAt,value:e.cpu.utilizationPercent??0}))}function ke(e){return e.map(e=>({label:e.label,value:e.count}))}function Ae(e){return e.slice(0,8).map(e=>({label:e.name,value:e.count}))}function je(e){let t=e.failures.latest[0];return t?t.message:`No failures`}var Me=5e3;function Ne(e){let t=(0,R.c)(33),{points:n,formatValue:r}=e,i;bb0:{if(n.length===0){i=``;break bb0}let e;t[0]===n?e=t[1]:(e=Math.max(...n.map(Pe),1),t[0]=n,t[1]=e);let r=e,a;if(t[2]!==r||t[3]!==n){let e;t[5]!==r||t[6]!==n.length?(e=(e,t)=>{let i=n.length===1?320:t/(n.length-1)*320,a=96-e.value/r*84-6;return`${t===0?`M`:`L`}${i.toFixed(2)},${a.toFixed(2)}`},t[5]=r,t[6]=n.length,t[7]=e):e=t[7],a=n.map(e).join(` `),t[2]=r,t[3]=n,t[4]=a}else a=t[4];i=a}let a=i,o,s,c,l,u;if(t[8]!==r||t[9]!==n){let e=n.at(-1)?.value??0;u=`min-w-0`,c=`mb-2 flex items-baseline justify-between gap-3`,t[15]===n.length?l=t[16]:(l=(0,V.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground/70`,children:[n.length,` samples`]}),t[15]=n.length,t[16]=l),o=`font-mono text-xs text-foreground`,s=r(e),t[8]=r,t[9]=n,t[10]=o,t[11]=s,t[12]=c,t[13]=l,t[14]=u}else o=t[10],s=t[11],c=t[12],l=t[13],u=t[14];let d;t[17]!==o||t[18]!==s?(d=(0,V.jsx)(`span`,{className:o,children:s}),t[17]=o,t[18]=s,t[19]=d):d=t[19];let f;t[20]!==c||t[21]!==l||t[22]!==d?(f=(0,V.jsxs)(`div`,{className:c,children:[l,d]}),t[20]=c,t[21]=l,t[22]=d,t[23]=f):f=t[23];let p;t[24]===a?p=t[25]:(p=(0,V.jsx)(`path`,{d:a,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),t[24]=a,t[25]=p);let m;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,V.jsx)(`line`,{x1:`0`,y1:95,x2:320,y2:95,className:`stroke-border`}),t[26]=m):m=t[26];let h;t[27]===p?h=t[28]:(h=(0,V.jsxs)(`svg`,{viewBox:`0 0 320 96`,className:`h-24 w-full overflow-visible text-info`,role:`img`,"aria-label":`Diagnostics history chart`,children:[p,m]}),t[27]=p,t[28]=h);let g;return t[29]!==h||t[30]!==u||t[31]!==f?(g=(0,V.jsxs)(`div`,{className:u,children:[f,h]}),t[29]=h,t[30]=u,t[31]=f,t[32]=g):g=t[32],g}function Pe(e){return e.value}function Fe(e){let t=(0,R.c)(12),{points:n,formatValue:r}=e,i=r===void 0?String:r,a;t[0]===n?a=t[1]:(a=Math.max(...n.map(Ie),1),t[0]=n,t[1]=a);let o=a;if(n.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No data yet.`}),t[2]=e):e=t[2],e}let s;if(t[3]!==i||t[4]!==o||t[5]!==n){let e;t[7]!==i||t[8]!==o?(e=e=>(0,V.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_5rem] items-center gap-3 px-4 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`mb-1 truncate text-[12px] font-medium`,children:e.label}),(0,V.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,V.jsx)(`div`,{className:`h-full rounded-full bg-info`,style:{width:`${Math.max(4,e.value/o*100)}%`}})})]}),(0,V.jsx)(`div`,{className:`text-right font-mono text-[11px] text-muted-foreground`,children:i(e.value)})]},e.label),t[7]=i,t[8]=o,t[9]=e):e=t[9],s=n.map(e),t[3]=i,t[4]=o,t[5]=n,t[6]=s}else s=t[6];let c;return t[10]===s?c=t[11]:(c=(0,V.jsx)(`div`,{className:`divide-y divide-border/60`,children:s}),t[10]=s,t[11]=c),c}function Ie(e){return e.value}function $(e){let t=(0,R.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`div`,{className:`truncate text-[11px] font-medium text-muted-foreground uppercase tracking-[0.08em]`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,V.jsx)(`div`,{className:`mt-1 truncate text-[15px] font-semibold text-foreground`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,V.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] text-muted-foreground`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`div`,{className:`min-w-0 border-border/60 border-t px-4 py-3 first:border-t-0 sm:px-5`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Le(e){let t=(0,R.c)(12),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,V.jsx)(`div`,{className:`text-[12px] font-medium text-foreground`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,V.jsx)(`div`,{className:`font-mono text-[12px] text-foreground`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,V.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,V.jsxs)(`div`,{className:`grid gap-1 border-border/60 border-t px-4 py-3 first:border-t-0 sm:grid-cols-[11rem_minmax(0,1fr)] sm:px-5`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Re(e){let t=(0,R.c)(5),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(`summary`,{className:`cursor-pointer select-none text-[11px] text-muted-foreground hover:text-foreground`,children:`raw`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=JSON.stringify(n,null,2),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,V.jsxs)(`details`,{className:`group`,children:[r,(0,V.jsx)(`pre`,{className:`mt-2 max-h-64 overflow-auto rounded-md bg-muted/60 p-3 text-[11px] leading-relaxed`,children:i})]}),t[3]=i,t[4]=a),a}function ze(e){let t=(0,R.c)(5),{spans:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,V.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No spans retained yet.`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=n.slice(0,10).map(Be),t[1]=n,t[2]=r);let i;return t[3]===r?i=t[4]:(i=(0,V.jsx)(`div`,{className:`divide-y divide-border/60`,children:r}),t[3]=r,t[4]=i),i}function Be(e){return(0,V.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 sm:grid-cols-[minmax(0,1fr)_6rem_5rem] sm:items-start`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.name}),(0,V.jsx)(N,{size:`sm`,variant:Te(e.status)?`error`:`outline`,children:e.status})]}),(0,V.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:[e.source,` / `,e.kind,` / `,e.spanId]}),e.failureMessage&&Te(e.status)?(0,V.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11px] text-destructive`,children:e.failureMessage}):null,(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(Re,{value:e})})]}),(0,V.jsx)(`div`,{className:`font-mono text-[11px] text-muted-foreground sm:text-right`,children:Z(e.durationMs)}),(0,V.jsx)(`div`,{className:`font-mono text-[11px] text-muted-foreground sm:text-right`,children:Q(e.endTime)})]},e.id)}function Ve(e){let t=(0,R.c)(9),{memorySeries:n,cpuSeries:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,V.jsx)(`div`,{className:`mb-1 text-[12px] font-semibold`,children:`RSS memory`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,V.jsxs)(`div`,{className:`min-w-0 p-4`,children:[i,(0,V.jsx)(Ne,{points:n,formatValue:X})]}),t[1]=n,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,V.jsx)(`div`,{className:`mb-1 text-[12px] font-semibold`,children:`CPU utilization`}),t[3]=o):o=t[3];let s;t[4]===r?s=t[5]:(s=(0,V.jsxs)(`div`,{className:`min-w-0 p-4`,children:[o,(0,V.jsx)(Ne,{points:r,formatValue:He})]}),t[4]=r,t[5]=s);let c;return t[6]!==a||t[7]!==s?(c=(0,V.jsx)(P,{title:`Resource history`,children:(0,V.jsxs)(`div`,{className:`grid gap-0 divide-y divide-border/60 lg:grid-cols-2 lg:divide-x lg:divide-y-0`,children:[a,s]})}),t[6]=a,t[7]=s,t[8]=c):c=t[8],c}function He(e){return`${e.toFixed(1)}%`}function Ue(e){let t=(0,R.c)(25),{snapshot:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,V.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Top span names`}),t[0]=r):r=t[0];let i;t[1]===n?.tracing.topSpanNames?i=t[2]:(i=n?.tracing.topSpanNames??[],t[1]=n?.tracing.topSpanNames,t[2]=i);let a;t[3]===i?a=t[4]:(a=Ae(i),t[3]=i,t[4]=a);let o;t[5]===a?o=t[6]:(o=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[r,(0,V.jsx)(Fe,{points:a})]}),t[5]=a,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,V.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Duration buckets`}),t[7]=s):s=t[7];let c;t[8]===n?.tracing.durationBuckets?c=t[9]:(c=n?.tracing.durationBuckets??[],t[8]=n?.tracing.durationBuckets,t[9]=c);let l;t[10]===c?l=t[11]:(l=ke(c),t[10]=c,t[11]=l);let u;t[12]===l?u=t[13]:(u=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[s,(0,V.jsx)(Fe,{points:l})]}),t[12]=l,t[13]=u);let d;t[14]!==o||t[15]!==u?(d=(0,V.jsxs)(`div`,{className:`grid gap-0 divide-y divide-border/60 lg:grid-cols-2 lg:divide-x lg:divide-y-0`,children:[o,u]}),t[14]=o,t[15]=u,t[16]=d):d=t[16];let f;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,V.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Slowest spans`}),t[17]=f):f=t[17];let p;t[18]===n?.tracing.slowestSpans?p=t[19]:(p=n?.tracing.slowestSpans??[],t[18]=n?.tracing.slowestSpans,t[19]=p);let m;t[20]===p?m=t[21]:(m=(0,V.jsxs)(`div`,{className:`border-border/60 border-t`,children:[f,(0,V.jsx)(ze,{spans:p})]}),t[20]=p,t[21]=m);let h;return t[22]!==m||t[23]!==d?(h=(0,V.jsxs)(P,{title:`Tracing diagnostics`,children:[d,m]}),t[22]=m,t[23]=d,t[24]=h):h=t[24],h}function We(e){let t=(0,R.c)(10),{snapshot:n,nowMs:r}=e,i;if(t[0]!==r||t[1]!==n?.failures.latest){let e;t[3]===r?e=t[4]:(e=e=>(0,V.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 sm:grid-cols-[minmax(0,1fr)_6rem]`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(N,{size:`sm`,variant:`error`,children:e.category}),(0,V.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.message})]}),(0,V.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:[e.source,` / `,e.signature]}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(Re,{value:e.raw??e})})]}),(0,V.jsx)(`div`,{className:`font-mono text-[11px] text-muted-foreground sm:text-right`,children:Q(e.occurredAt,r)})]},e.id),t[3]=r,t[4]=e),i=(n?.failures.latest??[]).slice(0,8).map(e),t[0]=r,t[1]=n?.failures.latest,t[2]=i}else i=t[2];let a;t[5]===n?a=t[6]:(a=n&&n.failures.latest.length===0?(0,V.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No failures retained.`}):null,t[5]=n,t[6]=a);let o;return t[7]!==i||t[8]!==a?(o=(0,V.jsx)(P,{title:`Failures`,children:(0,V.jsxs)(`div`,{className:`divide-y divide-border/60`,children:[i,a]})}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Ge(e){let t=(0,R.c)(27),{snapshot:n,slowRpcAcks:r,nowMs:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,V.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Providers`}),t[0]=a):a=t[0];let o;t[1]===n?.liveProcesses.providers?o=t[2]:(o=n?.liveProcesses.providers??[],t[1]=n?.liveProcesses.providers,t[2]=o);let s;t[3]===o?s=t[4]:(s=o.map(qe),t[3]=o,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,V.jsx)(`div`,{className:`divide-y divide-border/60`,children:s})]}),t[5]=s,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,V.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Terminals and slow RPCs`}),t[7]=l):l=t[7];let u;t[8]===n?.liveProcesses.terminals?u=t[9]:(u=n?.liveProcesses.terminals??[],t[8]=n?.liveProcesses.terminals,t[9]=u);let d;t[10]===u?d=t[11]:(d=u.map(Ke),t[10]=u,t[11]=d);let f;if(t[12]!==i||t[13]!==r){let e;t[15]===i?e=t[16]:(e=e=>(0,V.jsxs)(`div`,{className:`px-4 py-2.5`,children:[(0,V.jsx)(`div`,{className:`truncate text-[13px] font-medium`,children:e.tag}),(0,V.jsxs)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:[`slow ack / `,Q(e.startedAt,i)]})]},e.requestId),t[15]=i,t[16]=e),f=r.map(e),t[12]=i,t[13]=r,t[14]=f}else f=t[14];let p;t[17]!==r.length||t[18]!==n?.liveProcesses.terminals.length?(p=(n?.liveProcesses.terminals.length??0)===0&&r.length===0?(0,V.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No live terminal or slow RPC activity.`}):null,t[17]=r.length,t[18]=n?.liveProcesses.terminals.length,t[19]=p):p=t[19];let m;t[20]!==d||t[21]!==f||t[22]!==p?(m=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[l,(0,V.jsxs)(`div`,{className:`divide-y divide-border/60`,children:[d,f,p]})]}),t[20]=d,t[21]=f,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==m||t[25]!==c?(h=(0,V.jsx)(P,{title:`Live activity`,children:(0,V.jsxs)(`div`,{className:`grid gap-0 divide-y divide-border/60 lg:grid-cols-2 lg:divide-x lg:divide-y-0`,children:[c,m]})}),t[24]=m,t[25]=c,t[26]=h):h=t[26],h}function Ke(e){return(0,V.jsxs)(`div`,{className:`px-4 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.terminalId}),(0,V.jsx)(N,{size:`sm`,variant:e.status===`error`?`error`:`outline`,children:e.status})]}),(0,V.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:[`pid `,e.pid??`n/a`,` / subprocess`,` `,e.hasRunningSubprocess?`yes`:`no`]})]},`${e.threadId}:${e.terminalId}`)}function qe(e){return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`truncate text-[13px] font-medium`,children:e.displayName??e.instanceId}),(0,V.jsx)(`div`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:e.driver})]}),(0,V.jsx)(N,{size:`sm`,variant:e.status===`error`?`error`:e.status===`warning`?`warning`:`outline`,children:e.status})]},e.instanceId)}function Je(e){let t=(0,R.c)(57),{snapshot:n,memorySeries:r,cpuSeries:i,slowRpcAcks:a,latestFailure:o,nowMs:s}=e,c;t[0]===n?c=t[1]:(c=n?Z(n.uptimeMs):`n/a`,t[0]=n,t[1]=c);let l;t[2]!==s||t[3]!==n?(l=n?`Started ${Q(n.serverStartedAt,s)}`:void 0,t[2]=s,t[3]=n,t[4]=l):l=t[4];let u;t[5]!==c||t[6]!==l?(u=(0,V.jsx)($,{label:`Uptime`,value:c,detail:l}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=n?X(n.resources.current.memory.rssBytes):`n/a`,t[8]=n,t[9]=d);let f;t[10]===n?f=t[11]:(f=n?`${X(n.resources.current.memory.heapUsedBytes)} heap used`:void 0,t[10]=n,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,V.jsx)($,{label:`Memory`,value:d,detail:f}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]===n?m=t[16]:(m=n?Ee(n.resources.current.cpu.utilizationPercent):`n/a`,t[15]=n,t[16]=m);let h;t[17]===n?h=t[18]:(h=n?.resources.current.eventLoopDelayMs===void 0?void 0:`${Z(n.resources.current.eventLoopDelayMs)} event loop delay`,t[17]=n,t[18]=h);let g;t[19]!==m||t[20]!==h?(g=(0,V.jsx)($,{label:`CPU`,value:m,detail:h}),t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;t[22]===n?.liveProcesses.providers?_=t[23]:(_=n?.liveProcesses.providers.filter(Ye).length??0,t[22]=n?.liveProcesses.providers,t[23]=_);let v=`${_} providers`,y=`${n?.liveProcesses.terminals.length??0} terminal sessions`,b;t[24]!==v||t[25]!==y?(b=(0,V.jsx)($,{label:`Activity`,value:v,detail:y}),t[24]=v,t[25]=y,t[26]=b):b=t[26];let x=`${n?.tracing.retainedSpanCount??0} spans`,ee=n?`${n.limits.fileTailBytes/1024} KB file tail`:void 0,S;t[27]!==x||t[28]!==ee?(S=(0,V.jsx)($,{label:`Tracing`,value:x,detail:ee}),t[27]=x,t[28]=ee,t[29]=S):S=t[29];let C;t[30]===o?C=t[31]:(C=(0,V.jsx)($,{label:`Latest failure`,value:o}),t[30]=o,t[31]=C);let w;t[32]!==b||t[33]!==S||t[34]!==C||t[35]!==u||t[36]!==p||t[37]!==g?(w=(0,V.jsx)(P,{title:`Overview`,children:(0,V.jsxs)(`div`,{className:`grid sm:grid-cols-2 lg:grid-cols-3`,children:[u,p,g,b,S,C]})}),t[32]=b,t[33]=S,t[34]=C,t[35]=u,t[36]=p,t[37]=g,t[38]=w):w=t[38];let T;t[39]!==i||t[40]!==r?(T=(0,V.jsx)(Ve,{memorySeries:r,cpuSeries:i}),t[39]=i,t[40]=r,t[41]=T):T=t[41];let E;t[42]===n?E=t[43]:(E=(0,V.jsx)(Ue,{snapshot:n}),t[42]=n,t[43]=E);let D;t[44]!==s||t[45]!==n?(D=(0,V.jsx)(We,{snapshot:n,nowMs:s}),t[44]=s,t[45]=n,t[46]=D):D=t[46];let O;t[47]!==s||t[48]!==a||t[49]!==n?(O=(0,V.jsx)(Ge,{snapshot:n,slowRpcAcks:a,nowMs:s}),t[47]=s,t[48]=a,t[49]=n,t[50]=O):O=t[50];let k;return t[51]!==w||t[52]!==T||t[53]!==E||t[54]!==D||t[55]!==O?(k=(0,V.jsxs)(V.Fragment,{children:[w,T,E,D,O]}),t[51]=w,t[52]=T,t[53]=E,t[54]=D,t[55]=O,t[56]=k):k=t[56],k}function Ye(e){return e.enabled}function Xe(e){let t=(0,R.c)(14),{snapshot:n,error:r}=e;if(!r&&(!n||n.warnings.length===0))return null;let i=r?`error`:`warning`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,V.jsx)(w,{}),t[0]=a):a=t[0];let o=r?`Diagnostics refresh failed`:`Diagnostics warnings`,s;t[1]===o?s=t[2]:(s=(0,V.jsx)(k,{children:o}),t[1]=o,t[2]=s);let c;t[3]===r?c=t[4]:(c=r?(0,V.jsx)(`span`,{children:r}):null,t[3]=r,t[4]=c);let l;t[5]===n?.warnings?l=t[6]:(l=n?.warnings.slice(0,4).map(Ze),t[5]=n?.warnings,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,V.jsxs)(te,{children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==i||t[11]!==s||t[12]!==u?(d=(0,V.jsxs)(ne,{variant:i,children:[a,s,u]}),t[10]=i,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function Ze(e){return(0,V.jsxs)(`span`,{children:[e.message,e.count?` (${e.count})`:``]},`${e.code}:${e.source??``}`)}function Qe({presentation:e=`performance`}){let t=c(),[n,r]=(0,L.useState)(null),[i,s]=(0,L.useState)(null),[l,u]=(0,L.useState)(!0),[f,m]=(0,L.useState)(!1),h=(0,L.useRef)(!1),g=(0,L.useRef)(!1),_=(0,L.useRef)(!1),v=a(),b=p(e=>e.byId),x=Date.now(),w=(0,L.useCallback)(async(e=!1)=>{if(!(!e&&document.visibilityState!==`visible`)&&!h.current){h.current=!0,u(e=>e&&!g.current);try{let e=t?d(t.environmentId)?.server:o().server;if(!e)throw Error(`Diagnostics are unavailable on ${t?.nodeLabel}.`);let n=await e.getDiagnosticsSnapshot();if(_.current)return;r(n),s(null),g.current=!0}catch(e){if(_.current)return;s(e instanceof Error?e.message:`Unable to refresh diagnostics.`)}finally{h.current=!1,_.current||u(!1)}}},[t]);(0,L.useEffect)(()=>{if(_.current=!1,w(),f)return()=>{_.current=!0};let e=null,t=()=>{e!==null&&(window.clearInterval(e),e=null)},n=()=>{document.visibilityState===`visible`&&e===null&&(e=window.setInterval(()=>void w(),Me))};n();let r=()=>{if(document.visibilityState===`visible`){w(),n();return}t()};return document.addEventListener(`visibilitychange`,r),()=>{_.current=!0,t(),document.removeEventListener(`visibilitychange`,r)}},[f,w]);let D=(0,L.useMemo)(()=>De(n?.resources.history??[]),[n]),O=(0,L.useMemo)(()=>Oe(n?.resources.history??[]),[n]),k=n?je(n):`No snapshot`,te=n?.liveProcesses.providers.filter(e=>e.enabled).length??0,ne=n?.liveProcesses.terminals.filter(e=>e.status===`starting`||e.status===`running`).length??0,A=Object.values(b),re=A.filter(e=>e.connectionState===`connected`).length,ie=A.filter(e=>e.connectionState===`connecting`).length,j=A.length===0?`No tracked clients`:`${re} connected${ie>0?` · ${ie} connecting`:``}`,M=n?.tracing.slowestSpans.find(e=>e.source===`server`)??null,ae=v[0]??null,N=n?.performance??null,I=N?.local.turnQuiescenceAvgMs??null,oe=N?.local.checkpointDurationP95Ms??null,R=N?.local.latestThreadSnapshotDurationMs??null,z=N?.local.threadSnapshotDurationP95Ms??null;return(0,V.jsxs)(F,{children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`text-base font-semibold`,children:`Diagnostics`}),(0,V.jsx)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:n?`Updated ${Q(n.generatedAt,x)}`:`Waiting for snapshot`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(E,{size:`xs`,variant:`outline`,onClick:()=>m(e=>!e),children:[f?(0,V.jsx)(S,{className:`size-3.5`}):(0,V.jsx)(ee,{className:`size-3.5`}),f?`Resume`:`Pause`]}),(0,V.jsxs)(E,{size:`xs`,variant:`outline`,onClick:()=>void w(!0),disabled:l,children:[(0,V.jsx)(C,{className:T(`size-3.5`,l&&`animate-spin`)}),`Refresh`]})]})]}),(0,V.jsx)(Xe,{snapshot:n,error:i}),null,e===`phone-legacy`?null:(0,V.jsx)(Ce,{}),e===`phone-legacy`?(0,V.jsx)(Je,{snapshot:n,memorySeries:D,cpuSeries:O,slowRpcAcks:v,latestFailure:k,nowMs:x}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(P,{title:`Performance now`,children:(0,V.jsxs)(`div`,{className:`grid sm:grid-cols-2 lg:grid-cols-3`,children:[(0,V.jsx)($,{label:`Backend CPU`,value:n?Ee(n.resources.current.cpu.utilizationPercent):`n/a`,detail:n?`Process uptime ${Z(n.uptimeMs)}`:void 0}),(0,V.jsx)($,{label:`RSS / heap`,value:n?X(n.resources.current.memory.rssBytes):`n/a`,detail:n?`${X(n.resources.current.memory.heapUsedBytes)} heap used`:void 0}),(0,V.jsx)($,{label:`Event-loop delay`,value:n?.resources.current.eventLoopDelayMs===void 0?`n/a`:Z(n.resources.current.eventLoopDelayMs),detail:`Measured once for this requested snapshot`}),(0,V.jsx)($,{label:`Providers / terminals`,value:`${te} enabled providers`,detail:`${ne} active terminals`}),(0,V.jsx)($,{label:`Turn quiescence`,value:I===null?`No samples`:Z(I),detail:`Rolling average`}),(0,V.jsx)($,{label:`Checkpoint duration`,value:oe===null?`No samples`:Z(oe),detail:`Rolling p95`}),(0,V.jsx)($,{label:`WebSocket state`,value:j,detail:`${N?.local.wsReconnectCount??0} reconnects in this server process`}),(0,V.jsx)($,{label:`Thread snapshot`,value:R===null?`No samples`:Z(R),detail:z===null?`Latest successful subscription snapshot`:`${Z(z)} rolling p95`}),(0,V.jsx)($,{label:`Latest failure`,value:k})]})}),(0,V.jsxs)(P,{title:`Why was this slow?`,children:[(0,V.jsx)(Le,{label:`Thread snapshot`,value:R===null?`No thread snapshot timing yet`:`${Z(R)} latest`,detail:z===null?`Replay duration and payload bytes are not collected because the current transport has no zero-copy attribution hook.`:`${Z(z)} rolling p95. Replay duration and payload bytes are not collected because the current transport has no zero-copy attribution hook.`}),(0,V.jsx)(Le,{label:`Queue pressure`,value:N?`${N.queues.runtimeDepthTotal+N.queues.liveBufferDepthTotal} queued now`:`No snapshot`,detail:N?`Largest runtime high-water ${N.queues.runtimeHighWaterMax}; live-buffer high-water ${N.queues.liveBufferHighWaterMax}; ${N.queues.liveBufferOverflowCount} overflows; replay depth ${N.queues.replayDepthMax}; replay lag ${N.queues.replayLagMax}; ${N.queues.providerLogDroppedRecords} provider log records dropped.`:`Runtime and replay queue evidence will appear after the first snapshot.`}),(0,V.jsx)(Le,{label:`Slowest server stage`,value:M?`${M.name} · ${Z(M.durationMs)}`:`No retained spans`,detail:M?`Server span completed ${Q(M.endTime,x)}.`:`Tracing has not retained a server stage yet.`}),(0,V.jsx)(Le,{label:`Current slow client RPC`,value:ae?.tag??`No slow RPC acknowledgement in progress`,detail:ae?`Exceeded its ${Z(ae.thresholdMs)} acknowledgement threshold; started ${Q(ae.startedAt,x)}.`:`Only RPCs that cross the existing client acknowledgement threshold appear here.`}),(0,V.jsx)(Le,{label:`Reconnect / resume`,value:j,detail:`${N?.local.wsReconnectCount??0} server-side reconnects. Per-environment push gaps and recovery state are in Advanced diagnostics.`}),(0,V.jsx)(Le,{label:`Recent failure`,value:n?.failures.latest[0]?.message??`No retained failures`,detail:n?.failures.latest[0]?`${n.failures.latest[0].source} · ${Q(n.failures.latest[0].occurredAt,x)}`:`No failure evidence is available for the current server process.`}),(0,V.jsx)(Le,{label:`Trace persistence`,value:N?.traceSink?`${X(N.traceSink.bufferedBytes)} buffered`:`Health unavailable`,detail:N?.traceSink?`${X(N.traceSink.maxBufferedBytes)} cap; ${N.traceSink.droppedRecords} dropped records; ${N.traceSink.writeFailures} write failures; retry delay ${Z(N.traceSink.retryDelayMs)}.`:`This diagnostics service is not attached to the local trace-file sink.`})]}),(0,V.jsxs)(`details`,{className:`group/diagnostics`,children:[(0,V.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between rounded-xl border bg-card px-4 py-3 text-sm font-medium text-foreground shadow-sm/4 marker:hidden hover:bg-accent/30`,children:[`Advanced diagnostics`,(0,V.jsx)(y,{className:`size-4 text-muted-foreground transition-transform group-open/diagnostics:rotate-180 motion-reduce:transition-none`})]}),(0,V.jsxs)(`div`,{className:`mt-5 space-y-5`,children:[(0,V.jsx)(Ve,{memorySeries:D,cpuSeries:O}),(0,V.jsx)(Ue,{snapshot:n}),(0,V.jsx)(We,{snapshot:n,nowMs:x}),(0,V.jsx)(Ge,{snapshot:n,slowRpcAcks:v,nowMs:x}),(0,V.jsx)(K,{snapshot:n})]})]})]})]})}export{Qe as DiagnosticsSettings};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{Dt as n,Jt as r}from"./runtime-CPM0EUhb.js";import{Dt as i}from"./primary-CiDY2oUi.js";import{It as a,P as o}from"./composerDraftStore-TYv9j3vY.js";import{c as ee}from"./useSwipeDismiss-D22_vuiH.js";import{a as s,c,i as l,l as u,n as te,o as d,s as f,t as ne,u as p}from"./rightPanelRouteSearch-BS8CkNS6.js";import{t as re}from"./useNavigate-2tVq4iZ2.js";import{a as ie,c as ae,d as oe,f as se,i as m,l as ce,n as le,o as ue,p as de,r as fe,t as h,u as pe}from"./ChatRightPanel-D-AL07IU.js";import{s as me}from"./tabSwitchInstrumentation-CLDM7g1_.js";import"./device-CHdXzvhB.js";import{t as he}from"./utils-CV2fJJxC.js";import"./storeSelectors-Cf2WDMfx.js";import{t as ge}from"./usePresentationTier-B_SCFvN7.js";import{o as g}from"./sidebar-CFGg5Tkr.js";import{n as _e}from"./NoActiveThreadState-DehHNgAp.js";var _=e(t(),1),v=a();function y({rawDraftId:e,search:t}){let a=re(),y=o.make(e),b=`draft:${y}`,ve=(0,_.useCallback)(e=>{a({to:`/draft/$draftId`,params:{draftId:y},replace:!0,search:e})},[y,a]),x=pe({threadKey:b,search:t,replaceSearch:ve}),S=de(y),C=r((0,_.useMemo)(()=>n(S?.threadId??null),[S?.threadId])),w=ae(C),T=(0,_.useMemo)(()=>S?.promotedTo?w?S.promotedTo:null:C?{environmentId:C.environmentId,threadId:C.id}:null,[S?.promotedTo,C,w]),E=x.diff===`1`,D=x.preview===`1`,O=ne(x),k=te(x),A=x.workspaceTab===`agent`&&x.workspaceAgentKey?x.workspaceAgentKey:null,j=me(ce),M=ge(),N=T?`${T.environmentId}:${T.threadId}`:null,P=i(e=>N?e.pendingOpenByThreadKey[N]:void 0),F=i(e=>e.consumeOpenRequest),ye=_e(),{maximized:I,toggleMaximized:be}=se({threadKey:y,open:k,canMaximize:!j&&M!==`phone`}),[L,R]=(0,_.useState)(()=>({draftId:y,hasOpenedDiff:E,hasOpenedPreview:D,hasOpenedTerminal:O===`terminal`,hasOpenedSimulator:O===`simulator`,hasOpenedAgents:O===`agents`,openedAgentKeys:A?[A]:[]}));(0,_.useEffect)(()=>{!T||!P||M===`phone`||(F(T.environmentId,T.threadId),a({to:`/draft/$draftId`,params:{draftId:y},search:e=>c(e)}))},[T,F,y,a,P,M]);let z=L.draftId===y?L.hasOpenedDiff:E,B=L.draftId===y?L.hasOpenedPreview:D,V=L.draftId===y?L.hasOpenedTerminal:O===`terminal`,H=L.draftId===y?L.hasOpenedSimulator:O===`simulator`,U=L.draftId===y?L.hasOpenedAgents:O===`agents`,W=(0,_.useMemo)(()=>{let e=L.draftId===y?L.openedAgentKeys:A?[A]:[];return A&&!e.includes(A)?[...e,A]:e},[A,y,L]),[G,K]=(0,_.useState)(()=>O??`files`),q=(0,_.useMemo)(()=>{let e=[];return(B||O===`files`)&&e.push(`files`),(z||O===`review`)&&e.push(`review`),(V||O===`terminal`)&&e.push(`terminal`),(H||O===`simulator`)&&e.push(`simulator`),(U||O===`agents`)&&e.push(`agents`),e},[U,z,B,H,V,O]),J=(0,_.useCallback)(e=>{K(e),R(t=>{let n={draftId:y,hasOpenedDiff:(t.draftId===y?t.hasOpenedDiff:E)||e===`review`,hasOpenedPreview:(t.draftId===y?t.hasOpenedPreview:D)||e===`files`,hasOpenedTerminal:(t.draftId===y?t.hasOpenedTerminal:O===`terminal`)||e===`terminal`,hasOpenedSimulator:(t.draftId===y?t.hasOpenedSimulator:O===`simulator`)||e===`simulator`,hasOpenedAgents:(t.draftId===y?t.hasOpenedAgents:O===`agents`)||e===`agents`,openedAgentKeys:t.draftId===y?t.openedAgentKeys:W};return t.draftId===n.draftId&&t.hasOpenedDiff===n.hasOpenedDiff&&t.hasOpenedPreview===n.hasOpenedPreview&&t.hasOpenedTerminal===n.hasOpenedTerminal&&t.hasOpenedSimulator===n.hasOpenedSimulator&&t.hasOpenedAgents===n.hasOpenedAgents&&t.openedAgentKeys===n.openedAgentKeys?t:n})},[E,y,W,D,O]),Y=(0,_.useCallback)(()=>{a({to:`/draft/$draftId`,params:{draftId:y},search:e=>fe(e)})},[y,a]),X=(0,_.useCallback)(()=>{a({to:`/draft/$draftId`,params:{draftId:y},search:e=>{let t=W[W.length-1];return G===`agent`&&t?l(e,t):G===`files`&&B?d(e):G===`review`&&z?f(e):G===`terminal`&&V?u(e):G===`simulator`&&H?c(e):G===`agents`&&U?s(e):B?d(e):z?f(e):V?u(e):H?c(e):U?s(e):t?l(e,t):p(e)}})},[y,U,z,B,H,V,G,a,W]),Z=(0,_.useCallback)(()=>{if(k){Y();return}X()},[Y,X,k]),Q=(0,_.useCallback)(e=>{if(e.mode===`agent`){let t=W.filter(t=>t!==e.agentKey);R(e=>({draftId:y,hasOpenedDiff:e.draftId===y?e.hasOpenedDiff:z,hasOpenedPreview:e.draftId===y?e.hasOpenedPreview:B,hasOpenedTerminal:e.draftId===y?e.hasOpenedTerminal:V,hasOpenedSimulator:e.draftId===y?e.hasOpenedSimulator:H,hasOpenedAgents:e.draftId===y?e.hasOpenedAgents:U,openedAgentKeys:t})),O===`agent`&&A===e.agentKey&&a({to:`/draft/$draftId`,params:{draftId:y},search:e=>{let n=t[t.length-1];return n?l(e,n):B?d(e):z?f(e):V?u(e):H?c(e):U?s(e):p(e)}});return}let t=e.mode===`review`?!1:z||O===`review`,n=e.mode===`files`?!1:B||O===`files`,r=e.mode===`terminal`?!1:V||O===`terminal`,i=e.mode===`simulator`?!1:H||O===`simulator`,o=e.mode===`agents`?!1:U||O===`agents`;R(e=>{let a={draftId:y,hasOpenedDiff:t,hasOpenedPreview:n,hasOpenedTerminal:r,hasOpenedSimulator:i,hasOpenedAgents:o,openedAgentKeys:e.draftId===y?e.openedAgentKeys:W};return e.draftId===a.draftId&&e.hasOpenedDiff===a.hasOpenedDiff&&e.hasOpenedPreview===a.hasOpenedPreview&&e.hasOpenedTerminal===a.hasOpenedTerminal&&e.hasOpenedSimulator===a.hasOpenedSimulator&&e.hasOpenedAgents===a.hasOpenedAgents&&e.openedAgentKeys===a.openedAgentKeys?e:a}),O===e.mode&&a({to:`/draft/$draftId`,params:{draftId:y},search:a=>e.mode!==`files`&&n?d(a):e.mode!==`review`&&t?f(a):e.mode!==`terminal`&&r?u(a):e.mode!==`simulator`&&i?c(a):e.mode!==`agents`&&o?s(a):p(a)})},[A,y,U,z,B,H,V,a,W,O]);if((0,_.useEffect)(()=>{O!==null&&(K(O),J(O))},[J,O]),(0,_.useEffect)(()=>{A&&R(e=>{let t=e.draftId===y?e.openedAgentKeys:[];return t.includes(A)?e.draftId===y?e:{draftId:y,hasOpenedDiff:z,hasOpenedPreview:B,hasOpenedTerminal:V,hasOpenedSimulator:H,hasOpenedAgents:U,openedAgentKeys:t}:{draftId:y,hasOpenedDiff:e.draftId===y?e.hasOpenedDiff:E,hasOpenedPreview:e.draftId===y?e.hasOpenedPreview:D,hasOpenedTerminal:e.draftId===y?e.hasOpenedTerminal:O===`terminal`,hasOpenedSimulator:e.draftId===y?e.hasOpenedSimulator:O===`simulator`,hasOpenedAgents:e.draftId===y?e.hasOpenedAgents:O===`agents`,openedAgentKeys:[...t,A]}})},[A,E,y,U,z,B,H,V,D,O]),(0,_.useEffect)(()=>{T&&(oe(b,`${T.environmentId}:${T.threadId}`),a({to:`/$environmentId/$threadId`,params:ee(T),replace:!0}))},[T,a,b]),(0,_.useEffect)(()=>{S||T||a({to:`/`,replace:!0})},[T,S,a]),T)return(0,v.jsx)(g,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,v.jsx)(m,{environmentId:T.environmentId,threadId:T.threadId,routeKind:`server`})});if(!S)return null;let xe=k||O===`review`||z||O===`files`||B||O===`terminal`||V||O===`simulator`||H||O===`agents`||U||O===`agent`||W.length>0,Se=k||O===`review`||z||O===`files`||B||O===`terminal`||V||O===`agent`||W.length>0,$=k?O:G;return M===`phone`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(g,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,v.jsx)(m,{draftId:y,environmentId:S.environmentId,threadId:S.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:k,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,v.jsx)(ue,{label:`Workspace`,open:k,onClose:Y,children:Se?(0,v.jsx)(h,{mode:`phone`,panelMode:$,openedPanelModes:q,openedAgentKeys:W,onClosePanelTab:Q}):null})]}):j?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(g,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,v.jsx)(m,{draftId:y,environmentId:S.environmentId,threadId:S.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:k,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,v.jsx)(ie,{open:k,onClose:Y,children:xe?(0,v.jsx)(h,{mode:`sheet`,panelMode:$,openedPanelModes:q,openedAgentKeys:W,onClosePanelTab:Q}):null})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(g,{className:he(`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,I&&`w-0 flex-none`),inert:I?!0:void 0,children:(0,v.jsx)(m,{draftId:y,environmentId:S.environmentId,threadId:S.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:k,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,v.jsx)(le,{open:k,panelMode:$,openedPanelModes:q,openedAgentKeys:W,onClosePanelTab:Q,onClose:Y,onOpen:X,renderContent:xe,maximized:I,onToggleMaximized:be,reserveChromeInset:I&&ye})]})}export{y as DraftChatThreadRouteView};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{Ot as n,Yt as r}from"./runtime-QZPKtH2P.js";import{Dt as i}from"./primary-CiDY2oUi.js";import{It as a,P as o}from"./composerDraftStore-TYv9j3vY.js";import{c as ee}from"./useSwipeDismiss-D22_vuiH.js";import{a as s,c,i as l,l as u,n as te,o as d,s as f,t as ne,u as p}from"./rightPanelRouteSearch-BS8CkNS6.js";import{t as re}from"./useNavigate-2tVq4iZ2.js";import{a as ie,c as ae,d as oe,f as se,i as m,l as ce,n as le,o as ue,p as de,r as fe,t as h,u as pe}from"./ChatRightPanel-BSNsAFtv.js";import{s as me}from"./tabSwitchInstrumentation-CLDM7g1_.js";import"./device-DIfzlguu.js";import{t as he}from"./utils-CV2fJJxC.js";import"./storeSelectors-_h41wnN2.js";import{t as ge}from"./usePresentationTier-B_SCFvN7.js";import{o as g}from"./sidebar-CFGg5Tkr.js";import{n as _e}from"./NoActiveThreadState-C0MwHtMx.js";var _=e(t(),1),v=a();function y({rawDraftId:e,search:t}){let a=re(),y=o.make(e),b=`draft:${y}`,ve=(0,_.useCallback)(e=>{a({to:`/draft/$draftId`,params:{draftId:y},replace:!0,search:e})},[y,a]),x=pe({threadKey:b,search:t,replaceSearch:ve}),S=de(y),C=r((0,_.useMemo)(()=>n(S?.threadId??null),[S?.threadId])),w=ae(C),T=(0,_.useMemo)(()=>S?.promotedTo?w?S.promotedTo:null:C?{environmentId:C.environmentId,threadId:C.id}:null,[S?.promotedTo,C,w]),E=x.diff===`1`,D=x.preview===`1`,O=ne(x),k=te(x),A=x.workspaceTab===`agent`&&x.workspaceAgentKey?x.workspaceAgentKey:null,j=me(ce),M=ge(),N=T?`${T.environmentId}:${T.threadId}`:null,P=i(e=>N?e.pendingOpenByThreadKey[N]:void 0),F=i(e=>e.consumeOpenRequest),ye=_e(),{maximized:I,toggleMaximized:be}=se({threadKey:y,open:k,canMaximize:!j&&M!==`phone`}),[L,R]=(0,_.useState)(()=>({draftId:y,hasOpenedDiff:E,hasOpenedPreview:D,hasOpenedTerminal:O===`terminal`,hasOpenedSimulator:O===`simulator`,hasOpenedAgents:O===`agents`,openedAgentKeys:A?[A]:[]}));(0,_.useEffect)(()=>{!T||!P||M===`phone`||(F(T.environmentId,T.threadId),a({to:`/draft/$draftId`,params:{draftId:y},search:e=>c(e)}))},[T,F,y,a,P,M]);let z=L.draftId===y?L.hasOpenedDiff:E,B=L.draftId===y?L.hasOpenedPreview:D,V=L.draftId===y?L.hasOpenedTerminal:O===`terminal`,H=L.draftId===y?L.hasOpenedSimulator:O===`simulator`,U=L.draftId===y?L.hasOpenedAgents:O===`agents`,W=(0,_.useMemo)(()=>{let e=L.draftId===y?L.openedAgentKeys:A?[A]:[];return A&&!e.includes(A)?[...e,A]:e},[A,y,L]),[G,K]=(0,_.useState)(()=>O??`files`),q=(0,_.useMemo)(()=>{let e=[];return(B||O===`files`)&&e.push(`files`),(z||O===`review`)&&e.push(`review`),(V||O===`terminal`)&&e.push(`terminal`),(H||O===`simulator`)&&e.push(`simulator`),(U||O===`agents`)&&e.push(`agents`),e},[U,z,B,H,V,O]),J=(0,_.useCallback)(e=>{K(e),R(t=>{let n={draftId:y,hasOpenedDiff:(t.draftId===y?t.hasOpenedDiff:E)||e===`review`,hasOpenedPreview:(t.draftId===y?t.hasOpenedPreview:D)||e===`files`,hasOpenedTerminal:(t.draftId===y?t.hasOpenedTerminal:O===`terminal`)||e===`terminal`,hasOpenedSimulator:(t.draftId===y?t.hasOpenedSimulator:O===`simulator`)||e===`simulator`,hasOpenedAgents:(t.draftId===y?t.hasOpenedAgents:O===`agents`)||e===`agents`,openedAgentKeys:t.draftId===y?t.openedAgentKeys:W};return t.draftId===n.draftId&&t.hasOpenedDiff===n.hasOpenedDiff&&t.hasOpenedPreview===n.hasOpenedPreview&&t.hasOpenedTerminal===n.hasOpenedTerminal&&t.hasOpenedSimulator===n.hasOpenedSimulator&&t.hasOpenedAgents===n.hasOpenedAgents&&t.openedAgentKeys===n.openedAgentKeys?t:n})},[E,y,W,D,O]),Y=(0,_.useCallback)(()=>{a({to:`/draft/$draftId`,params:{draftId:y},search:e=>fe(e)})},[y,a]),X=(0,_.useCallback)(()=>{a({to:`/draft/$draftId`,params:{draftId:y},search:e=>{let t=W[W.length-1];return G===`agent`&&t?l(e,t):G===`files`&&B?d(e):G===`review`&&z?f(e):G===`terminal`&&V?u(e):G===`simulator`&&H?c(e):G===`agents`&&U?s(e):B?d(e):z?f(e):V?u(e):H?c(e):U?s(e):t?l(e,t):p(e)}})},[y,U,z,B,H,V,G,a,W]),Z=(0,_.useCallback)(()=>{if(k){Y();return}X()},[Y,X,k]),Q=(0,_.useCallback)(e=>{if(e.mode===`agent`){let t=W.filter(t=>t!==e.agentKey);R(e=>({draftId:y,hasOpenedDiff:e.draftId===y?e.hasOpenedDiff:z,hasOpenedPreview:e.draftId===y?e.hasOpenedPreview:B,hasOpenedTerminal:e.draftId===y?e.hasOpenedTerminal:V,hasOpenedSimulator:e.draftId===y?e.hasOpenedSimulator:H,hasOpenedAgents:e.draftId===y?e.hasOpenedAgents:U,openedAgentKeys:t})),O===`agent`&&A===e.agentKey&&a({to:`/draft/$draftId`,params:{draftId:y},search:e=>{let n=t[t.length-1];return n?l(e,n):B?d(e):z?f(e):V?u(e):H?c(e):U?s(e):p(e)}});return}let t=e.mode===`review`?!1:z||O===`review`,n=e.mode===`files`?!1:B||O===`files`,r=e.mode===`terminal`?!1:V||O===`terminal`,i=e.mode===`simulator`?!1:H||O===`simulator`,o=e.mode===`agents`?!1:U||O===`agents`;R(e=>{let a={draftId:y,hasOpenedDiff:t,hasOpenedPreview:n,hasOpenedTerminal:r,hasOpenedSimulator:i,hasOpenedAgents:o,openedAgentKeys:e.draftId===y?e.openedAgentKeys:W};return e.draftId===a.draftId&&e.hasOpenedDiff===a.hasOpenedDiff&&e.hasOpenedPreview===a.hasOpenedPreview&&e.hasOpenedTerminal===a.hasOpenedTerminal&&e.hasOpenedSimulator===a.hasOpenedSimulator&&e.hasOpenedAgents===a.hasOpenedAgents&&e.openedAgentKeys===a.openedAgentKeys?e:a}),O===e.mode&&a({to:`/draft/$draftId`,params:{draftId:y},search:a=>e.mode!==`files`&&n?d(a):e.mode!==`review`&&t?f(a):e.mode!==`terminal`&&r?u(a):e.mode!==`simulator`&&i?c(a):e.mode!==`agents`&&o?s(a):p(a)})},[A,y,U,z,B,H,V,a,W,O]);if((0,_.useEffect)(()=>{O!==null&&(K(O),J(O))},[J,O]),(0,_.useEffect)(()=>{A&&R(e=>{let t=e.draftId===y?e.openedAgentKeys:[];return t.includes(A)?e.draftId===y?e:{draftId:y,hasOpenedDiff:z,hasOpenedPreview:B,hasOpenedTerminal:V,hasOpenedSimulator:H,hasOpenedAgents:U,openedAgentKeys:t}:{draftId:y,hasOpenedDiff:e.draftId===y?e.hasOpenedDiff:E,hasOpenedPreview:e.draftId===y?e.hasOpenedPreview:D,hasOpenedTerminal:e.draftId===y?e.hasOpenedTerminal:O===`terminal`,hasOpenedSimulator:e.draftId===y?e.hasOpenedSimulator:O===`simulator`,hasOpenedAgents:e.draftId===y?e.hasOpenedAgents:O===`agents`,openedAgentKeys:[...t,A]}})},[A,E,y,U,z,B,H,V,D,O]),(0,_.useEffect)(()=>{T&&(oe(b,`${T.environmentId}:${T.threadId}`),a({to:`/$environmentId/$threadId`,params:ee(T),replace:!0}))},[T,a,b]),(0,_.useEffect)(()=>{S||T||a({to:`/`,replace:!0})},[T,S,a]),T)return(0,v.jsx)(g,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,v.jsx)(m,{environmentId:T.environmentId,threadId:T.threadId,routeKind:`server`})});if(!S)return null;let xe=k||O===`review`||z||O===`files`||B||O===`terminal`||V||O===`simulator`||H||O===`agents`||U||O===`agent`||W.length>0,Se=k||O===`review`||z||O===`files`||B||O===`terminal`||V||O===`agent`||W.length>0,$=k?O:G;return M===`phone`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(g,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,v.jsx)(m,{draftId:y,environmentId:S.environmentId,threadId:S.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:k,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,v.jsx)(ue,{label:`Workspace`,open:k,onClose:Y,children:Se?(0,v.jsx)(h,{mode:`phone`,panelMode:$,openedPanelModes:q,openedAgentKeys:W,onClosePanelTab:Q}):null})]}):j?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(g,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,v.jsx)(m,{draftId:y,environmentId:S.environmentId,threadId:S.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:k,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,v.jsx)(ie,{open:k,onClose:Y,children:xe?(0,v.jsx)(h,{mode:`sheet`,panelMode:$,openedPanelModes:q,openedAgentKeys:W,onClosePanelTab:Q}):null})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(g,{className:he(`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,I&&`w-0 flex-none`),inert:I?!0:void 0,children:(0,v.jsx)(m,{draftId:y,environmentId:S.environmentId,threadId:S.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:k,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,v.jsx)(le,{open:k,panelMode:$,openedPanelModes:q,openedAgentKeys:W,onClosePanelTab:Q,onClose:Y,onOpen:X,renderContent:xe,maximized:I,onToggleMaximized:be,reserveChromeInset:I&&ye})]})}export{y as DraftChatThreadRouteView};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{n as r}from"./env-Bcq9YR3B.js";import{Fr as i,Rr as a}from"./src-DmPIm3ie.js";import{N as o}from"./runtime-CPM0EUhb.js";import{It as s}from"./composerDraftStore-TYv9j3vY.js";import{_ as c,d as l,f as u,h as d,l as f,m as p,p as m,r as h,v as g}from"./useHandleNewThread-Bw460iXT.js";import{t as _}from"./useNavigate-2tVq4iZ2.js";import{o as v}from"./authorization-D8lJzXTE.js";import{f as y}from"./useRenderElement-DchFnsR8.js";import{t as b}from"./chevron-down-B7C6FKzM.js";import{t as x}from"./copy-UQjKGt7t.js";import{t as S}from"./download-CQZ-m4zW.js";import{t as ee}from"./log-out-tMJm0Gk6.js";import{t as te}from"./refresh-cw-DopCMrtR.js";import{t as C}from"./shield-check-dQ-4cMKk.js";import{t as w}from"./shield-IZEIJ8r7.js";import{t as T}from"./smartphone-gNe1ynB8.js";import{t as ne}from"./user-round-Cpzx8pSw.js";import{t as E}from"./x-C1Cemsov.js";import{t as D}from"./utils-CV2fJJxC.js";import{t as O}from"./button-DG8WqjNn.js";import{t as k}from"./usePresentationTier-B_SCFvN7.js";import{a as A,i as j,n as re,o as M,s as N,t as P}from"./MobileSheet-BDvnUC5W.js";import{t as F}from"./GlassSurface-CDok2tTN.js";import{a as ie,c as ae,i as I,n as L,o as R,r as z,s as oe,t as B}from"./HostedRelayTrustNotice-CcDOAwgS.js";import{n as V,o as se}from"./settingsSections.logic-F8RXVmAq.js";var ce=y(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),H=y(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),U=y(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=y(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),G=n(),K=e(t(),1),le=Object.freeze({"":`overview`,security:`security`,appearance:`appearance`}),q=Object.freeze({"sign-in":`/sign-in`,"sign-in-password":`/sign-in/password`,"sign-in-recovery-code":`/sign-in/recovery-code`,"sign-up":`/sign-up`,"sign-up-verify":`/public-signup/verify`,"reset-password":`/password-reset`,invitation:`/invitation`,setup:`/setup`,"email-verification":`/email-verification`,nodes:`/nodes`,"nodes-enroll":`/nodes/enroll`}),ue=Object.freeze([`sign-in`,`sign-up`,`public-signup`,`password-reset`,`invitation`,`setup`,`email-verification`,`nodes`,`account`]);function de(e){return e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e===``?`/`:e}function fe(e){let t=de(e);if(t.startsWith(`/account`))return{kind:`account`,section:le[t.slice(8).replace(/^\//,``)]??`overview`};for(let[e,n]of Object.entries(q))if(t===n)return{kind:e};return null}function pe(e){return e.kind===`account`?e.section===`overview`?`/account`:`/account/${e.section}`:q[e.kind]}function me(e){switch(e.kind){case`sign-in`:return`Sign in`;case`sign-in-password`:return`Sign in with a password`;case`sign-in-recovery-code`:return`Use a recovery code`;case`sign-up`:return`Create your account`;case`sign-up-verify`:return`Verify your email`;case`reset-password`:return`Reset your password`;case`invitation`:return`Redeem your invitation`;case`setup`:return`Claim this Hub`;case`email-verification`:return`Email verification`;case`nodes`:return`Your nodes`;case`nodes-enroll`:return`Enroll a node`;case`account`:return e.section===`overview`?`Account`:e.section===`security`?`Security`:`Appearance`}}var he=typeof window>`u`?`/`:de(window.location.pathname),ge=new Set;function _e(){for(let e of Array.from(ge))e()}function ve(e){let t=de(e);t!==he&&(he=t,_e())}var ye=!1;function be(){ye||(ye=!0,g(()=>{ve(d().logicalPathname)}))}function xe(){return p()===null?typeof window>`u`?he:de(window.location.pathname):he}var Se=!1;function Ce(){Se||typeof window>`u`||(Se=!0,window.addEventListener(`popstate`,()=>{p()===null&&_e()}))}function we(e){return be(),Ce(),ge.add(e),()=>{ge.delete(e)}}function Te(e,t){Ee(pe(e),t)}function Ee(e,t){let n=de(e),r=p();if(r){t?.replace===!0?r.replace(n):r.push(n),ve(n);return}typeof window<`u`&&(t?.replace===!0?window.history.replaceState(window.history.state,``,n):window.history.pushState(window.history.state,``,n)),he=n,_e()}function De(){let e=(0,G.c)(2),t=(0,K.useSyncExternalStore)(we,xe),n;return e[0]===t?n=e[1]:(n=fe(t),e[0]=t,e[1]=n),n}var J=s(),Oe={unavailable:`The node from this link is not in your authorized node directory. Choose a node to continue.`,revoked:`Access to the node from this link was revoked. Choose a node to continue.`,offline:`The node from this link is offline. Choose a node to continue.`,"invalid-link":`This node link is not valid. Choose a node to continue.`},ke=null,Ae=new Set;function Y(e){if(ke!==e){ke=e;for(let e of Array.from(Ae))e()}}function je(e){return Ae.add(e),()=>{Ae.delete(e)}}function Me(){return ke===null?null:Oe[ke]}function Ne(){return(0,K.useSyncExternalStore)(je,Me)}function Pe(){return(0,K.useSyncExternalStore)(g,d)}var Fe=new Set([`node`,`draft`,`pair`,`diagnostics`,...ue]);function Ie(e){let t=/^\/([^/]+)\/([^/]+)\/?$/.exec(e);if(!t)return null;let n=t[1]??``;if(Fe.has(n))return null;try{return decodeURIComponent(n)}catch{return n}}function Le(e){let t=/^\/([^/]+)\/([^/]+)\/?$/u.exec(e);if(!t||Fe.has(t[1]??``))return null;try{return{environmentId:i.make(decodeURIComponent(t[1]??``)),threadId:a.make(decodeURIComponent(t[2]??``))}}catch{return null}}function Re(e){return e.startsWith(`/draft/`)}var X=null,Z=null,Q=null,ze=!1,Be=null,Ve=0,He=!1,Ue=null,We=null;function $(e){let t=e?JSON.stringify([e.environmentId,e.threadId]):null;t!==Ue&&(We?.(),We=null,Ue=t,e&&(We=f(e.environmentId,e.threadId)))}function Ge(e){return e?JSON.stringify([e.environmentId,e.threadId]):null}function Ke(){He||(He=!0,queueMicrotask(()=>{He=!1,Ve!==0&&Ye()}))}function qe(e){ze=!0;try{e()}finally{ze=!1}Ke()}function Je(e,t){X=null,Z=null,Q=null,(e===`none`||e===`online`||e===`offline`)&&Y(t),u()}function Ye(){if(ze||!p())return;let e=d(),t=o.getState();if(e.malformed){Y(`invalid-link`),$(null),u();return}if(t.accountStatus!==`authenticated`){$(null),Be===`authenticated`&&Y(null),Be=t.accountStatus;return}Be=t.accountStatus;let n=e.nodeId;if(n===null){if(Q=null,$(null),X=null,Z=null,t.selectedNode&&!h()){let e=t.selectionStatus===`revoked`||t.selectionStatus===`authorization-removed`||t.selectionStatus===`incompatible`;v.returnToDirectory(e?{preserveTerminalSelection:!0}:void 0);return}Xe(e.logicalPathname,t);return}let r=Le(e.logicalPathname);Ge(r)!==Ue&&$(null);let i=t.nodes.find(e=>e.id===n)??null;if(i&&(i.capabilities?.nativeClientRequired===!0||r&&i.environmentId!==r.environmentId)){$(null),Je(t.selectionStatus,`unavailable`);return}if(t.selectedNode?.id===n){if($(r),X=null,Q=null,t.sessionEstablished){Z=null,Y(null);return}if(Z===n&&t.transportStatus===`terminal-failure`&&(t.selectionStatus===`revoked`||t.selectionStatus===`authorization-removed`||t.selectionStatus===`incompatible`)){Z=null,qe(()=>{u(),v.returnToDirectory({preserveTerminalSelection:!0})});return}Z===n&&t.transportStatus===`terminal-failure`&&t.selectionStatus===`offline`&&t.errorMessage===`Ryco state could not be synchronized.`&&qe(()=>{Je(t.selectionStatus,`offline`),v.returnToDirectory()});return}if(t.directoryStatus===`stale`){Je(t.selectionStatus,`unavailable`);return}if(t.directoryStatus!==`ready`||t.browserStatus!==`current`)return;let a=t.nodes.find(e=>e.id===n);if(!a){Je(t.selectionStatus,`unavailable`);return}if(a.revokedAt!==null){Je(t.selectionStatus,`revoked`);return}let s=Q===n;$(r);let c=r!==null&&!a.presence.online&&!s;r&&h()&&!c||X!==n&&(X=n,Z=s?null:n,Q=null,Y(null),v.selectNode(a.id).finally(()=>{X===n&&(X=null)}))}function Xe(e,t){if(Re(e)){u();return}let n=Ie(e);if(n===null)return;if(t.directoryStatus===`stale`){Y(`unavailable`),u();return}if(t.directoryStatus!==`ready`)return;let r=t.nodes.find(e=>e.environmentId===n&&e.revokedAt===null);if(!r){Y(`unavailable`),u();return}l(r.id)}function Ze(e){return p()?(Q=e,Y(null),m(e)):!1}function Qe(){if(!p())return!1;Q=null,Y(null);let e=d();return e.nodeId===null&&e.logicalPathname===`/nodes`||c()}function $e(){Ve+=1;let e=g(Ke),t=o.subscribe(Ke),n=p()?.subscribe(()=>Ke());Ke();let r=!1;return()=>{r||(r=!0,--Ve,e(),t(),n?.())}}function et(){let e=(0,G.c)(1),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,K.useEffect)(tt,t)}function tt(){return $e()}function nt(e){let t=(0,G.c)(11),{label:n,status:r,icon:i,onClick:a,testId:o,className:s}=e,c;t[0]===s?c=t[1]:(c=D(F(`chip`),`flex min-h-11 min-w-11 max-w-[136px] shrink items-center justify-center gap-1.5 rounded-full border border-border px-2.5 text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring`,s),t[0]=s,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,J.jsx)(`span`,{"data-slot":`mobile-status-chip-status`,className:`min-w-0 truncate`,children:r}),t[2]=r,t[3]=l);let u;return t[4]!==i||t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==o?(u=(0,J.jsxs)(`button`,{type:`button`,"aria-label":n,"data-slot":`mobile-status-chip`,"data-testid":o,className:c,onClick:a,children:[i,l]}),t[4]=i,t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=o,t[10]=u):u=t[10],u}var rt={legacy:{glyph:`legacy`,iconClassName:`text-amber-500`},web:{glyph:`browser-encrypted`,iconClassName:`text-sky-500`},e2ee:{glyph:`native-verified`,iconClassName:`text-emerald-500`}};function it(e){return e.guarantee===`none`?e.connected?{glyph:`connected`,iconClassName:`text-emerald-500`}:{glyph:`disconnected`,iconClassName:`text-amber-500`}:rt[e.guarantee]}function at(){let e=(0,G.c)(19),t=ie(),n=R(),i=o(ct),a=o(st),s=o(ot);if(t!==`web-unsigned`)return null;let c,l;e[0]!==n||e[1]!==a||e[2]!==i||e[3]!==s?(c=z(se(`security`,{hosted:r(),role:V(i,a,s)})),l=I(n,c),e[0]=n,e[1]=a,e[2]=i,e[3]=s,e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u=l;if(!u){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`section`,{"aria-label":`Session code`,"data-testid":`hosted-e2ee-verification`,"data-code":`absent`,className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium`,children:`Session code`}),(0,J.jsx)(`p`,{"data-testid":`hosted-e2ee-verification-unavailable`,className:`text-[11px] leading-relaxed text-muted-foreground`,children:L})]}),e[6]=t):t=e[6],t}let d;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(`p`,{className:`text-xs font-medium`,children:`Session code`}),e[7]=d):d=e[7];let f;e[8]===u.display?f=e[9]:(f=(0,J.jsx)(`p`,{"data-testid":`hosted-e2ee-verification-code`,className:`font-mono text-base leading-none font-semibold tracking-[0.2em] whitespace-nowrap select-all`,children:u.display}),e[8]=u.display,e[9]=f);let p;e[10]===u.display?p=e[11]:(p=()=>void navigator.clipboard.writeText(u.display),e[10]=u.display,e[11]=p);let m;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}),e[12]=m):m=e[12];let h;e[13]===p?h=e[14]:(h=(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,onClick:p,children:[m,` Copy`]}),e[13]=p,e[14]=h);let g;return e[15]!==c||e[16]!==f||e[17]!==h?(g=(0,J.jsxs)(`section`,{"aria-label":`Session code`,"data-testid":`hosted-e2ee-verification`,"data-code":`present`,"data-form":c,className:`space-y-2`,children:[d,f,h]}),e[15]=c,e[16]=f,e[17]=h,e[18]=g):g=e[18],g}function ot(e){return e.transportStatus}function st(e){return e.directoryStatus}function ct(e){return e.effectiveRole}var lt=`ryco:pwa:activate:v1`,ut=`Installation is temporarily unavailable.`,dt={errorMessage:null,installState:`hidden`,platform:`other`,registrationState:`disabled`,updateState:`idle`};function ft(e){return e===``||e===`./`?`./`:e.endsWith(`/`)?e:`${e}/`}function pt(e){let t=e.navigator.userAgent;return/iPad|iPhone|iPod/.test(t)||/Macintosh/.test(t)&&e.navigator.maxTouchPoints>1}function mt(e){let t=e;return typeof t.prompt==`function`&&t.userChoice instanceof Promise}function ht(e){let t=dt,n=!1,r=null,i=null,a=!!e.navigator.serviceWorker?.controller,o=!1,s=!1,c=new Set,l=e.window.matchMedia(`(display-mode: standalone)`),u=e=>{let n={...t,...e};Object.entries(n).every(([e,n])=>t[e]===n)||(t=n,c.forEach(e=>e()))},d=()=>l.matches||e.navigator.standalone===!0,f=()=>d()?`installed`:`manual-available`,p=e=>{!mt(e)||d()||(e.preventDefault(),r=e,u({installState:`native-available`}))},m=()=>{r=null,u({installState:`installed`})},h=()=>{d()?(r=null,u({installState:`installed`})):u({installState:r?`native-available`:`manual-available`})},g=()=>{let t=a;a=!!e.navigator.serviceWorker?.controller,!(o||!s&&!t)&&(s=!1,o=!0,e.window.reload())},_=t=>{i=t,t.waiting&&u({updateState:`ready`}),t.addEventListener(`updatefound`,()=>{let n=t.installing;n&&n.addEventListener(`statechange`,()=>{n.state===`installed`&&e.navigator.serviceWorker?.controller&&u({updateState:`ready`})})})},v=async()=>{let t=e.navigator.serviceWorker;if(!t){u({registrationState:`unavailable`,errorMessage:ut});return}u({registrationState:`registering`,errorMessage:null});try{let n=ft(e.baseUrl);_(await t.register(`${n}service-worker.js`,{scope:n})),u({registrationState:`ready`,errorMessage:null})}catch{u({registrationState:`unavailable`,errorMessage:ut})}};return{activateUpdate(){let e=i?.waiting;!e||t.updateState!==`ready`||(s=!0,u({updateState:`activating`}),e.postMessage({type:lt}))},dismissInstall(){r=null,u({installState:d()?`installed`:`hidden`})},getSnapshot(){return t},async promptInstall(){let e=r;e&&(r=null,u({installState:`hidden`}),await e.prompt(),(await e.userChoice).outcome===`dismissed`&&!d()&&u({installState:`manual-available`}))},async start(t){n||(n=!0,t.enabled&&(a=!!e.navigator.serviceWorker?.controller,o=!1,u({installState:f(),platform:pt(e)?`ios`:`other`}),e.window.addEventListener(`beforeinstallprompt`,p),e.window.addEventListener(`appinstalled`,m),l.addEventListener(`change`,h),e.navigator.serviceWorker?.addEventListener(`controllerchange`,g),e.document.readyState===`complete`?await v():e.window.addEventListener(`load`,()=>void v(),{once:!0})))},stop(){n&&(n=!1,r=null,i=null,a=!1,o=!1,s=!1,e.window.removeEventListener(`beforeinstallprompt`,p),e.window.removeEventListener(`appinstalled`,m),l.removeEventListener(`change`,h),e.navigator.serviceWorker?.removeEventListener(`controllerchange`,g),t=dt,c.forEach(e=>e()))},subscribe(e){return c.add(e),()=>c.delete(e)}}}function gt(){let e=navigator;return{baseUrl:`/`,document,navigator:{maxTouchPoints:e.maxTouchPoints,userAgent:e.userAgent,...e.serviceWorker?{serviceWorker:e.serviceWorker}:{},...typeof e.standalone==`boolean`?{standalone:e.standalone}:{}},window:{addEventListener:window.addEventListener.bind(window),removeEventListener:window.removeEventListener.bind(window),matchMedia:window.matchMedia.bind(window),reload:()=>window.location.reload()}}}var _t=typeof window>`u`?null:ht(gt());function vt(e){let t=(0,G.c)(3),{compact:n,lifecycle:r}=e,i=n!==void 0&&n,a=r===void 0?_t:r,o;return t[0]!==i||t[1]!==a?(o=a?(0,J.jsx)(yt,{compact:i,lifecycle:a}):null,t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function yt(e){let t=(0,G.c)(27),{compact:n,lifecycle:r}=e,i=(0,K.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),[a,o]=(0,K.useState)(!1);if(i.installState!==`native-available`&&i.installState!==`manual-available`&&i.updateState===`idle`&&i.registrationState!==`unavailable`)return null;let s=n?`space-y-2`:`mt-4 space-y-3`,c;t[0]!==n||t[1]!==r||t[2]!==i.installState?(c=i.installState===`native-available`?(0,J.jsxs)(O,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,onClick:()=>void r.promptInstall(),children:[(0,J.jsx)(S,{"aria-hidden":!0}),` Install Ryco`]}):null,t[0]=n,t[1]=r,t[2]=i.installState,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==a||t[6]!==i.installState?(l=i.installState===`manual-available`?(0,J.jsxs)(O,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,"aria-expanded":a,onClick:()=>o(bt),children:[(0,J.jsx)(T,{"aria-hidden":!0}),` How to install`]}):null,t[4]=n,t[5]=a,t[6]=i.installState,t[7]=l):l=t[7];let u;t[8]!==n||t[9]!==r||t[10]!==i.updateState?(u=i.updateState===`idle`?null:(0,J.jsxs)(O,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,disabled:i.updateState===`activating`,onClick:()=>r.activateUpdate(),children:[(0,J.jsx)(te,{"aria-hidden":!0}),i.updateState===`activating`?`Updating…`:`Update ready`]}),t[8]=n,t[9]=r,t[10]=i.updateState,t[11]=u):u=t[11];let d;t[12]!==c||t[13]!==l||t[14]!==u?(d=(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c,l,u]}),t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f;t[16]!==a||t[17]!==i?(f=a?(0,J.jsx)(xt,{snapshot:i,onClose:()=>o(!1)}):null,t[16]=a,t[17]=i,t[18]=f):f=t[18];let p;t[19]!==i.errorMessage||t[20]!==i.registrationState?(p=i.registrationState===`unavailable`&&i.errorMessage?(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:i.errorMessage}):null,t[19]=i.errorMessage,t[20]=i.registrationState,t[21]=p):p=t[21];let m;return t[22]!==s||t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,J.jsxs)(`section`,{className:s,"aria-label":`Ryco app installation`,children:[d,f,p]}),t[22]=s,t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function bt(e){return!e}function xt(e){let t=(0,G.c)(13),{snapshot:n,onClose:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(`p`,{className:`font-medium`,children:`Install Ryco on this device`}),t[0]=i):i=t[0];let a;t[1]===n.platform?a=t[2]:(a=(0,J.jsxs)(`div`,{children:[i,n.platform===`ios`?(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`In Safari, open the Share or browser menu, choose Add to Home Screen, enable Open as Web App when offered, then tap Add.`}):(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`Open the browser menu, choose Add to home screen or Install app, then confirm Install.`})]}),t[1]=n.platform,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(E,{"aria-hidden":!0}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(`span`,{className:`sr-only`,children:`Close install instructions`}),t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=(0,J.jsxs)(O,{className:`size-11 shrink-0`,size:`icon`,variant:`ghost`,onClick:r,children:[o,` `,s]}),t[5]=r,t[6]=c);let l;t[7]!==a||t[8]!==c?(l=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(`div`,{className:`mt-3 border-t border-border pt-3`,children:(0,J.jsx)(B,{compact:!0})}),t[10]=u):u=t[10];let d;return t[11]===l?d=t[12]:(d=(0,J.jsxs)(`div`,{role:`region`,"aria-label":`Install Ryco instructions`,className:`rounded-lg border border-border bg-background p-3 text-sm`,children:[l,u]}),t[11]=l,t[12]=d),d}var St={connected:W,disconnected:U,legacy:H,"browser-encrypted":w,"native-verified":C};function Ct(e){let t=(0,G.c)(9),{indicator:n,className:r,testId:i}=e,a;t[0]===n?a=t[1]:(a=it(n),t[0]=n,t[1]=a);let{glyph:o,iconClassName:s}=a,c=St[o],l=String(n.connected),u=`${r} ${s}`,d;return t[2]!==c||t[3]!==o||t[4]!==n.guarantee||t[5]!==l||t[6]!==u||t[7]!==i?(d=(0,J.jsx)(c,{"aria-hidden":!0,"data-testid":i,"data-connected":l,"data-guarantee":n.guarantee,"data-glyph":o,className:u}),t[2]=c,t[3]=o,t[4]=n.guarantee,t[5]=l,t[6]=u,t[7]=i,t[8]=d):d=t[8],d}function wt(e){let t=(0,G.c)(3),{node:n}=e;if(n.revokedAt){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`span`,{className:`text-xs text-destructive`,children:`Revoked`}),t[0]=e):e=t[0],e}let r;return t[1]===n.presence.online?r=t[2]:(r=n.presence.online?(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400`,children:[(0,J.jsx)(W,{"aria-hidden":!0,className:`size-3.5`}),` Online`]}):(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(U,{"aria-hidden":!0,className:`size-3.5`}),` Offline`]}),t[1]=n.presence.online,t[2]=r),r}function Tt(){let e=(0,G.c)(7),t=_(),n;e[0]===t?n=e[1]:(n=async e=>{Ze(e.id)||(await t({to:`/`,replace:!0}),await v.selectNode(e.id))},e[0]=t,e[1]=n);let r=n,i;e[2]===t?i=e[3]:(i=async()=>{Qe()||(await t({to:`/`,replace:!0}),await v.returnToDirectory())},e[2]=t,e[3]=i);let a=i,o;return e[4]!==a||e[5]!==r?(o={switchNode:r,returnToAllNodes:a},e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Et(){let e=(0,G.c)(5),t=o(kt),n=o(Ot);if(t!==`delivery-unknown`)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(`p`,{children:`A request may or may not have reached the node. Ryco did not resend it automatically.`}),e[0]=r):r=e[0];let i=!n,a=n?void 0:`Wait for session replay to finish before acknowledging this warning.`,s=n?`Acknowledge`:`Synchronizing…`,c;return e[1]!==i||e[2]!==a||e[3]!==s?(c=(0,J.jsxs)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-500/30 bg-amber-500/5 p-2 text-xs`,children:[r,(0,J.jsx)(O,{className:`mt-2`,size:`sm`,variant:`outline`,disabled:i,title:a,onClick:Dt,children:s})]}),e[1]=i,e[2]=a,e[3]=s,e[4]=c):c=e[4],c}function Dt(){return v.acknowledgeDeliveryUnknown()}function Ot(e){return e.sessionRecoveredAfterUnknown}function kt(e){return e.sessionStatus}function At(){let e=(0,G.c)(62),t=o(Vt),n=o(Bt),r=o(zt),i=o(Rt),a=o(Lt),s=o(It),c=o(Ft),l=o(Pt),u=o(Nt),d=ie(),{switchNode:f,returnToAllNodes:p}=Tt(),m=(0,K.useRef)(null);if(!t)return null;let h,g;if(e[0]!==u||e[1]!==d||e[2]!==a||e[3]!==i||e[4]!==r){let t={browserStatus:u,sessionStatus:i,selectionStatus:a,transportStatus:r,e2eeStatus:d};h=ae(t),g=oe(t),e[0]=u,e[1]=d,e[2]=a,e[3]=i,e[4]=r,e[5]=h,e[6]=g}else h=e[5],g=e[6];let _=g,v;e[7]===_?v=e[8]:(v=(0,J.jsx)(Ct,{indicator:_,className:`size-4`}),e[7]=_,e[8]=v);let y;e[9]===t.label?y=e[10]:(y=(0,J.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:t.label}),e[9]=t.label,e[10]=y);let x;e[11]===h?x=e[12]:(x=(0,J.jsx)(`span`,{className:`max-w-24 truncate text-xs text-muted-foreground`,children:h}),e[11]=h,e[12]=x);let S;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(b,{"aria-hidden":!0,className:`size-3.5 transition-transform group-open:rotate-180`}),e[13]=S):S=e[13];let C;e[14]!==v||e[15]!==y||e[16]!==x?(C=(0,J.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-lg border border-border bg-card/95 px-3 py-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[v,y,x,S]}),e[14]=v,e[15]=y,e[16]=x,e[17]=C):C=e[17];let w;e[18]===t.label?w=e[19]:(w=(0,J.jsx)(`p`,{className:`font-medium`,children:t.label}),e[18]=t.label,e[19]=w);let T=c??`Role unavailable`,E;e[20]!==h||e[21]!==T?(E=(0,J.jsxs)(`p`,{className:`mt-0.5 text-xs capitalize text-muted-foreground`,children:[T,` · `,h]}),e[20]=h,e[21]=T,e[22]=E):E=e[22];let D;e[23]!==t.label||e[24]!==h?(D=(0,J.jsxs)(`p`,{className:`sr-only`,"aria-live":`polite`,children:[`Node `,t.label,`: `,h,`.`]}),e[23]=t.label,e[24]=h,e[25]=D):D=e[25];let k;e[26]===l?k=e[27]:(k=l?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:l}):null,e[26]=l,e[27]=k);let A;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(Et,{}),e[28]=A):A=e[28];let j;e[29]===p?j=e[30]:(j=()=>void p(),e[29]=p,e[30]=j);let re;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,J.jsx)(ce,{"aria-hidden":!0,className:`size-4`}),e[31]=re):re=e[31];let M;e[32]===j?M=e[33]:(M=(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:j,children:[re,` All nodes`]}),e[32]=j,e[33]=M);let N;if(e[34]!==u||e[35]!==s||e[36]!==t.id||e[37]!==n||e[38]!==f){let r;e[40]===t.id?r=e[41]:(r=e=>e.id!==t.id,e[40]=t.id,e[41]=r);let i;e[42]!==u||e[43]!==s||e[44]!==f?(i=e=>(0,J.jsxs)(`button`,{type:`button`,disabled:s!==`ready`||u!==`current`||e.revokedAt!==null||e.capabilities?.nativeClientRequired===!0,title:e.capabilities?.nativeClientRequired===!0?`Open in Desktop/Mobile`:void 0,className:`flex w-full items-center justify-between rounded-md px-2 py-2 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>void f(e),children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label}),(0,J.jsx)(wt,{node:e})]},e.id),e[42]=u,e[43]=s,e[44]=f,e[45]=i):i=e[45],N=n.filter(r).map(i),e[34]=u,e[35]=s,e[36]=t.id,e[37]=n,e[38]=f,e[39]=N}else N=e[39];let P;e[46]!==M||e[47]!==N?(P=(0,J.jsxs)(`div`,{className:`mt-3 max-h-48 space-y-1 overflow-auto border-t border-border pt-3`,children:[M,N]}),e[46]=M,e[47]=N,e[48]=P):P=e[48];let F;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsxs)(O,{size:`sm`,variant:`outline`,onClick:Mt,children:[(0,J.jsx)(te,{"aria-hidden":!0}),` Refresh`]}),e[49]=F):F=e[49];let I;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsxs)(O,{size:`sm`,variant:`ghost`,onClick:jt,children:[(0,J.jsx)(ee,{"aria-hidden":!0}),` Sign out`]}),e[50]=I):I=e[50];let L;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-border pt-3`,children:[F,I,(0,J.jsxs)(O,{size:`sm`,variant:`ghost`,onClick:()=>{m.current&&(m.current.open=!1),Te({kind:`account`,section:`security`})},children:[(0,J.jsx)(ne,{"aria-hidden":!0}),` Security details`]})]}),e[51]=L):L=e[51];let R;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsxs)(`div`,{className:`mt-3 space-y-3 border-t border-border pt-3`,children:[(0,J.jsx)(at,{}),(0,J.jsx)(vt,{compact:!0})]}),e[52]=R):R=e[52];let z;e[53]!==k||e[54]!==P||e[55]!==w||e[56]!==E||e[57]!==D?(z=(0,J.jsxs)(`div`,{className:`absolute right-0 z-50 mt-2 w-72 rounded-xl border border-border bg-popover p-3 shadow-xl`,children:[w,E,D,k,A,P,L,R]}),e[53]=k,e[54]=P,e[55]=w,e[56]=E,e[57]=D,e[58]=z):z=e[58];let B;return e[59]!==z||e[60]!==C?(B=(0,J.jsx)(`div`,{className:`relative max-w-full`,children:(0,J.jsxs)(`details`,{ref:m,className:`group relative`,children:[C,z]})}),e[59]=z,e[60]=C,e[61]=B):B=e[61],B}function jt(){v.signOut()}function Mt(){v.refreshDirectory()}function Nt(e){return e.browserStatus}function Pt(e){return e.errorMessage}function Ft(e){return e.effectiveRole}function It(e){return e.directoryStatus}function Lt(e){return e.selectionStatus}function Rt(e){return e.sessionStatus}function zt(e){return e.transportStatus}function Bt(e){return e.nodes}function Vt(e){return e.selectedNode}function Ht(e){let t=(0,G.c)(66),{open:n,onOpenChange:r}=e,i=o($t),a=o(Qt),s=o(Zt),c=o(Xt),l=o(Yt),u=o(Jt),d=o(qt),f=o(Kt),p=o(Gt),m=ie(),{switchNode:h,returnToAllNodes:g}=Tt();if(!i)return null;let _,v;if(t[0]!==p||t[1]!==m||t[2]!==l||t[3]!==c||t[4]!==s){let e={browserStatus:p,sessionStatus:c,selectionStatus:l,transportStatus:s,e2eeStatus:m};_=ae(e),v=oe(e),t[0]=p,t[1]=m,t[2]=l,t[3]=c,t[4]=s,t[5]=_,t[6]=v}else _=t[5],v=t[6];let y=v,b=u!==`ready`||p!==`current`,x;t[7]===y?x=t[8]:(x=(0,J.jsx)(Ct,{indicator:y,className:`size-4`}),t[7]=y,t[8]=x);let S;t[9]===i.label?S=t[10]:(S=(0,J.jsx)(`span`,{className:`truncate`,children:i.label}),t[9]=i.label,t[10]=S);let C;t[11]!==x||t[12]!==S?(C=(0,J.jsxs)(M,{className:`flex items-center gap-2`,children:[x,S]}),t[11]=x,t[12]=S,t[13]=C):C=t[13];let w=d??`Role unavailable`,T;t[14]!==_||t[15]!==w?(T=(0,J.jsxs)(re,{className:`capitalize`,children:[w,` · `,_]}),t[14]=_,t[15]=w,t[16]=T):T=t[16];let E;t[17]!==i.label||t[18]!==_?(E=(0,J.jsxs)(`p`,{className:`sr-only`,"aria-live":`polite`,children:[`Node `,i.label,`: `,_,`.`]}),t[17]=i.label,t[18]=_,t[19]=E):E=t[19];let D;t[20]!==C||t[21]!==T||t[22]!==E?(D=(0,J.jsxs)(j,{children:[C,T,E]}),t[20]=C,t[21]=T,t[22]=E,t[23]=D):D=t[23];let k;t[24]===f?k=t[25]:(k=f?(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:f}):null,t[24]=f,t[25]=k);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(Et,{}),t[26]=F):F=t[26];let I;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsx)(ne,{"aria-hidden":!0,className:`size-4 shrink-0`}),t[27]=I):I=t[27];let L;t[28]===r?L=t[29]:(L=(0,J.jsx)(N,{label:`Security details`,icon:I,onClick:()=>{r(!1),Te({kind:`account`,section:`security`})}}),t[28]=r,t[29]=L);let R;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsx)(ce,{"aria-hidden":!0,className:`size-4 shrink-0`}),t[30]=R):R=t[30];let z;t[31]!==r||t[32]!==g?(z=(0,J.jsx)(N,{label:`All nodes`,icon:R,onClick:()=>{r(!1),g()}}),t[31]=r,t[32]=g,t[33]=z):z=t[33];let B;if(t[34]!==i.id||t[35]!==a||t[36]!==r||t[37]!==h||t[38]!==b){let e;t[40]===i.id?e=t[41]:(e=e=>e.id!==i.id,t[40]=i.id,t[41]=e);let n;t[42]!==r||t[43]!==h||t[44]!==b?(n=e=>(0,J.jsx)(N,{label:e.label,disabled:b||e.revokedAt!==null||e.capabilities?.nativeClientRequired===!0,disabledReason:e.capabilities?.nativeClientRequired===!0?`Open in Desktop/Mobile`:e.revokedAt===null?`Node switching is unavailable until the directory and this browser are current.`:`Access to this node was revoked.`,trailing:(0,J.jsx)(wt,{node:e}),onClick:()=>{r(!1),h(e)}},e.id),t[42]=r,t[43]=h,t[44]=b,t[45]=n):n=t[45],B=a.filter(e).map(n),t[34]=i.id,t[35]=a,t[36]=r,t[37]=h,t[38]=b,t[39]=B}else B=t[39];let V;t[46]!==L||t[47]!==z||t[48]!==B?(V=(0,J.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-border pt-3`,children:[L,z,B]}),t[46]=L,t[47]=z,t[48]=B,t[49]=V):V=t[49];let se=u===`loading`,H;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsx)(te,{"aria-hidden":!0}),t[50]=H):H=t[50];let U;t[51]===se?U=t[52]:(U=(0,J.jsxs)(O,{size:`sm`,variant:`outline`,className:`min-h-11`,disabled:se,onClick:Wt,children:[H,` Refresh nodes`]}),t[51]=se,t[52]=U);let W;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,J.jsxs)(O,{size:`sm`,variant:`ghost`,className:`min-h-11`,onClick:Ut,children:[(0,J.jsx)(ee,{"aria-hidden":!0}),` Sign out`]}),t[53]=W):W=t[53];let K;t[54]===U?K=t[55]:(K=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-border pt-3`,children:[U,W]}),t[54]=U,t[55]=K);let le;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,J.jsx)(`div`,{className:`mt-3 space-y-3 border-t border-border pt-3`,children:(0,J.jsx)(vt,{compact:!0})}),t[56]=le):le=t[56];let q;t[57]!==V||t[58]!==K||t[59]!==k?(q=(0,J.jsxs)(A,{children:[k,F,V,K,le]}),t[57]=V,t[58]=K,t[59]=k,t[60]=q):q=t[60];let ue;return t[61]!==r||t[62]!==n||t[63]!==q||t[64]!==D?(ue=(0,J.jsxs)(P,{open:n,onOpenChange:r,label:`Connection`,children:[D,q]}),t[61]=r,t[62]=n,t[63]=q,t[64]=D,t[65]=ue):ue=t[65],ue}function Ut(){v.signOut()}function Wt(){v.refreshDirectory()}function Gt(e){return e.browserStatus}function Kt(e){return e.errorMessage}function qt(e){return e.effectiveRole}function Jt(e){return e.directoryStatus}function Yt(e){return e.selectionStatus}function Xt(e){return e.sessionStatus}function Zt(e){return e.transportStatus}function Qt(e){return e.nodes}function $t(e){return e.selectedNode}function en(){let e=(0,G.c)(25),t=o(on),n=o(an),r=o(rn),i=o(nn),a=o(tn),s=ie(),[c,l]=(0,K.useState)(!1);if(!t)return null;let u,d;if(e[0]!==a||e[1]!==s||e[2]!==i||e[3]!==r||e[4]!==n){let t={browserStatus:a,sessionStatus:r,selectionStatus:i,transportStatus:n,e2eeStatus:s};u=ae(t),d=oe(t),e[0]=a,e[1]=s,e[2]=i,e[3]=r,e[4]=n,e[5]=u,e[6]=d}else u=e[5],d=e[6];let f=d,p;e[7]!==t.label||e[8]!==c||e[9]!==r||e[10]!==u?(p=c?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{role:`status`,"aria-live":`polite`,"data-testid":`hosted-connection-status-announcer`,className:`sr-only`,children:[`Node `,t.label,`: `,u,`.`]}),r===`delivery-unknown`?(0,J.jsx)(`span`,{role:`alert`,className:`sr-only`,children:`Delivery unknown: a request may or may not have reached the node. Open the connection controls to acknowledge.`}):null]}),e[7]=t.label,e[8]=c,e[9]=r,e[10]=u,e[11]=p):p=e[11];let m=`Connection: ${t.label}, ${u}`,h;e[12]===f?h=e[13]:(h=(0,J.jsx)(Ct,{indicator:f,testId:`hosted-connection-icon`,className:`size-3.5 shrink-0`}),e[12]=f,e[13]=h);let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>l(!0),e[14]=g):g=e[14];let _;e[15]!==f.shortLabel||e[16]!==m||e[17]!==h?(_=(0,J.jsx)(nt,{testId:`hosted-connection-pill`,label:m,status:f.shortLabel,icon:h,onClick:g}),e[15]=f.shortLabel,e[16]=m,e[17]=h,e[18]=_):_=e[18];let v;e[19]===c?v=e[20]:(v=(0,J.jsx)(Ht,{open:c,onOpenChange:l}),e[19]=c,e[20]=v);let y;return e[21]!==p||e[22]!==_||e[23]!==v?(y=(0,J.jsxs)(J.Fragment,{children:[p,_,v]}),e[21]=p,e[22]=_,e[23]=v,e[24]=y):y=e[24],y}function tn(e){return e.browserStatus}function nn(e){return e.selectionStatus}function rn(e){return e.sessionStatus}function an(e){return e.transportStatus}function on(e){return e.selectedNode}function sn(){let e=(0,G.c)(2),t=k(),n;return e[0]===t?n=e[1]:(n=t===`phone`?(0,J.jsx)(en,{}):(0,J.jsx)(At,{}),e[0]=t,e[1]=n),n}export{De as _,Tt as a,Le as c,et as d,Pe as f,Ee as g,Te as h,wt as i,Ze as l,me as m,en as n,vt as o,pe as p,At as r,_t as s,sn as t,Ne as u,U as v};
1
+ import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{n as r}from"./env-Bcq9YR3B.js";import{Fr as i,Rr as a}from"./src-DmPIm3ie.js";import{P as o}from"./runtime-QZPKtH2P.js";import{It as s}from"./composerDraftStore-TYv9j3vY.js";import{_ as c,d as l,f as u,h as d,l as f,m as p,p as m,r as h,v as g}from"./useHandleNewThread-ByVfL71G.js";import{t as _}from"./useNavigate-2tVq4iZ2.js";import{o as v}from"./authorization-D8lJzXTE.js";import{f as y}from"./useRenderElement-DchFnsR8.js";import{t as b}from"./chevron-down-B7C6FKzM.js";import{t as x}from"./copy-UQjKGt7t.js";import{t as S}from"./download-CQZ-m4zW.js";import{t as ee}from"./log-out-tMJm0Gk6.js";import{t as te}from"./refresh-cw-DopCMrtR.js";import{t as C}from"./shield-check-dQ-4cMKk.js";import{t as w}from"./shield-IZEIJ8r7.js";import{t as T}from"./smartphone-gNe1ynB8.js";import{t as ne}from"./user-round-Cpzx8pSw.js";import{t as E}from"./x-C1Cemsov.js";import{t as D}from"./utils-CV2fJJxC.js";import{t as O}from"./button-DG8WqjNn.js";import{t as k}from"./usePresentationTier-B_SCFvN7.js";import{a as A,i as j,n as re,o as M,s as N,t as P}from"./MobileSheet-BDvnUC5W.js";import{t as F}from"./GlassSurface-CDok2tTN.js";import{a as ie,c as ae,i as I,n as L,o as R,r as z,s as oe,t as B}from"./HostedRelayTrustNotice-DFcgMZlL.js";import{n as V,o as se}from"./settingsSections.logic-F8RXVmAq.js";var ce=y(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),H=y(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),U=y(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=y(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),G=n(),K=e(t(),1),le=Object.freeze({"":`overview`,security:`security`,appearance:`appearance`}),q=Object.freeze({"sign-in":`/sign-in`,"sign-in-password":`/sign-in/password`,"sign-in-recovery-code":`/sign-in/recovery-code`,"sign-up":`/sign-up`,"sign-up-verify":`/public-signup/verify`,"reset-password":`/password-reset`,invitation:`/invitation`,setup:`/setup`,"email-verification":`/email-verification`,nodes:`/nodes`,"nodes-enroll":`/nodes/enroll`}),ue=Object.freeze([`sign-in`,`sign-up`,`public-signup`,`password-reset`,`invitation`,`setup`,`email-verification`,`nodes`,`account`]);function de(e){return e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e===``?`/`:e}function fe(e){let t=de(e);if(t.startsWith(`/account`))return{kind:`account`,section:le[t.slice(8).replace(/^\//,``)]??`overview`};for(let[e,n]of Object.entries(q))if(t===n)return{kind:e};return null}function pe(e){return e.kind===`account`?e.section===`overview`?`/account`:`/account/${e.section}`:q[e.kind]}function me(e){switch(e.kind){case`sign-in`:return`Sign in`;case`sign-in-password`:return`Sign in with a password`;case`sign-in-recovery-code`:return`Use a recovery code`;case`sign-up`:return`Create your account`;case`sign-up-verify`:return`Verify your email`;case`reset-password`:return`Reset your password`;case`invitation`:return`Redeem your invitation`;case`setup`:return`Claim this Hub`;case`email-verification`:return`Email verification`;case`nodes`:return`Your nodes`;case`nodes-enroll`:return`Enroll a node`;case`account`:return e.section===`overview`?`Account`:e.section===`security`?`Security`:`Appearance`}}var he=typeof window>`u`?`/`:de(window.location.pathname),ge=new Set;function _e(){for(let e of Array.from(ge))e()}function ve(e){let t=de(e);t!==he&&(he=t,_e())}var ye=!1;function be(){ye||(ye=!0,g(()=>{ve(d().logicalPathname)}))}function xe(){return p()===null?typeof window>`u`?he:de(window.location.pathname):he}var Se=!1;function Ce(){Se||typeof window>`u`||(Se=!0,window.addEventListener(`popstate`,()=>{p()===null&&_e()}))}function we(e){return be(),Ce(),ge.add(e),()=>{ge.delete(e)}}function Te(e,t){Ee(pe(e),t)}function Ee(e,t){let n=de(e),r=p();if(r){t?.replace===!0?r.replace(n):r.push(n),ve(n);return}typeof window<`u`&&(t?.replace===!0?window.history.replaceState(window.history.state,``,n):window.history.pushState(window.history.state,``,n)),he=n,_e()}function De(){let e=(0,G.c)(2),t=(0,K.useSyncExternalStore)(we,xe),n;return e[0]===t?n=e[1]:(n=fe(t),e[0]=t,e[1]=n),n}var J=s(),Oe={unavailable:`The node from this link is not in your authorized node directory. Choose a node to continue.`,revoked:`Access to the node from this link was revoked. Choose a node to continue.`,offline:`The node from this link is offline. Choose a node to continue.`,"invalid-link":`This node link is not valid. Choose a node to continue.`},ke=null,Ae=new Set;function Y(e){if(ke!==e){ke=e;for(let e of Array.from(Ae))e()}}function je(e){return Ae.add(e),()=>{Ae.delete(e)}}function Me(){return ke===null?null:Oe[ke]}function Ne(){return(0,K.useSyncExternalStore)(je,Me)}function Pe(){return(0,K.useSyncExternalStore)(g,d)}var Fe=new Set([`node`,`draft`,`pair`,`diagnostics`,...ue]);function Ie(e){let t=/^\/([^/]+)\/([^/]+)\/?$/.exec(e);if(!t)return null;let n=t[1]??``;if(Fe.has(n))return null;try{return decodeURIComponent(n)}catch{return n}}function Le(e){let t=/^\/([^/]+)\/([^/]+)\/?$/u.exec(e);if(!t||Fe.has(t[1]??``))return null;try{return{environmentId:i.make(decodeURIComponent(t[1]??``)),threadId:a.make(decodeURIComponent(t[2]??``))}}catch{return null}}function Re(e){return e.startsWith(`/draft/`)}var X=null,Z=null,Q=null,ze=!1,Be=null,Ve=0,He=!1,Ue=null,We=null;function $(e){let t=e?JSON.stringify([e.environmentId,e.threadId]):null;t!==Ue&&(We?.(),We=null,Ue=t,e&&(We=f(e.environmentId,e.threadId)))}function Ge(e){return e?JSON.stringify([e.environmentId,e.threadId]):null}function Ke(){He||(He=!0,queueMicrotask(()=>{He=!1,Ve!==0&&Ye()}))}function qe(e){ze=!0;try{e()}finally{ze=!1}Ke()}function Je(e,t){X=null,Z=null,Q=null,(e===`none`||e===`online`||e===`offline`)&&Y(t),u()}function Ye(){if(ze||!p())return;let e=d(),t=o.getState();if(e.malformed){Y(`invalid-link`),$(null),u();return}if(t.accountStatus!==`authenticated`){$(null),Be===`authenticated`&&Y(null),Be=t.accountStatus;return}Be=t.accountStatus;let n=e.nodeId;if(n===null){if(Q=null,$(null),X=null,Z=null,t.selectedNode&&!h()){let e=t.selectionStatus===`revoked`||t.selectionStatus===`authorization-removed`||t.selectionStatus===`incompatible`;v.returnToDirectory(e?{preserveTerminalSelection:!0}:void 0);return}Xe(e.logicalPathname,t);return}let r=Le(e.logicalPathname);Ge(r)!==Ue&&$(null);let i=t.nodes.find(e=>e.id===n)??null;if(i&&(i.capabilities?.nativeClientRequired===!0||r&&i.environmentId!==r.environmentId)){$(null),Je(t.selectionStatus,`unavailable`);return}if(t.selectedNode?.id===n){if($(r),X=null,Q=null,t.sessionEstablished){Z=null,Y(null);return}if(Z===n&&t.transportStatus===`terminal-failure`&&(t.selectionStatus===`revoked`||t.selectionStatus===`authorization-removed`||t.selectionStatus===`incompatible`)){Z=null,qe(()=>{u(),v.returnToDirectory({preserveTerminalSelection:!0})});return}Z===n&&t.transportStatus===`terminal-failure`&&t.selectionStatus===`offline`&&t.errorMessage===`Ryco state could not be synchronized.`&&qe(()=>{Je(t.selectionStatus,`offline`),v.returnToDirectory()});return}if(t.directoryStatus===`stale`){Je(t.selectionStatus,`unavailable`);return}if(t.directoryStatus!==`ready`||t.browserStatus!==`current`)return;let a=t.nodes.find(e=>e.id===n);if(!a){Je(t.selectionStatus,`unavailable`);return}if(a.revokedAt!==null){Je(t.selectionStatus,`revoked`);return}let s=Q===n;$(r);let c=r!==null&&!a.presence.online&&!s;r&&h()&&!c||X!==n&&(X=n,Z=s?null:n,Q=null,Y(null),v.selectNode(a.id).finally(()=>{X===n&&(X=null)}))}function Xe(e,t){if(Re(e)){u();return}let n=Ie(e);if(n===null)return;if(t.directoryStatus===`stale`){Y(`unavailable`),u();return}if(t.directoryStatus!==`ready`)return;let r=t.nodes.find(e=>e.environmentId===n&&e.revokedAt===null);if(!r){Y(`unavailable`),u();return}l(r.id)}function Ze(e){return p()?(Q=e,Y(null),m(e)):!1}function Qe(){if(!p())return!1;Q=null,Y(null);let e=d();return e.nodeId===null&&e.logicalPathname===`/nodes`||c()}function $e(){Ve+=1;let e=g(Ke),t=o.subscribe(Ke),n=p()?.subscribe(()=>Ke());Ke();let r=!1;return()=>{r||(r=!0,--Ve,e(),t(),n?.())}}function et(){let e=(0,G.c)(1),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,K.useEffect)(tt,t)}function tt(){return $e()}function nt(e){let t=(0,G.c)(11),{label:n,status:r,icon:i,onClick:a,testId:o,className:s}=e,c;t[0]===s?c=t[1]:(c=D(F(`chip`),`flex min-h-11 min-w-11 max-w-[136px] shrink items-center justify-center gap-1.5 rounded-full border border-border px-2.5 text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring`,s),t[0]=s,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,J.jsx)(`span`,{"data-slot":`mobile-status-chip-status`,className:`min-w-0 truncate`,children:r}),t[2]=r,t[3]=l);let u;return t[4]!==i||t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==o?(u=(0,J.jsxs)(`button`,{type:`button`,"aria-label":n,"data-slot":`mobile-status-chip`,"data-testid":o,className:c,onClick:a,children:[i,l]}),t[4]=i,t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=o,t[10]=u):u=t[10],u}var rt={legacy:{glyph:`legacy`,iconClassName:`text-amber-500`},web:{glyph:`browser-encrypted`,iconClassName:`text-sky-500`},e2ee:{glyph:`native-verified`,iconClassName:`text-emerald-500`}};function it(e){return e.guarantee===`none`?e.connected?{glyph:`connected`,iconClassName:`text-emerald-500`}:{glyph:`disconnected`,iconClassName:`text-amber-500`}:rt[e.guarantee]}function at(){let e=(0,G.c)(19),t=ie(),n=R(),i=o(ct),a=o(st),s=o(ot);if(t!==`web-unsigned`)return null;let c,l;e[0]!==n||e[1]!==a||e[2]!==i||e[3]!==s?(c=z(se(`security`,{hosted:r(),role:V(i,a,s)})),l=I(n,c),e[0]=n,e[1]=a,e[2]=i,e[3]=s,e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u=l;if(!u){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`section`,{"aria-label":`Session code`,"data-testid":`hosted-e2ee-verification`,"data-code":`absent`,className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium`,children:`Session code`}),(0,J.jsx)(`p`,{"data-testid":`hosted-e2ee-verification-unavailable`,className:`text-[11px] leading-relaxed text-muted-foreground`,children:L})]}),e[6]=t):t=e[6],t}let d;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(`p`,{className:`text-xs font-medium`,children:`Session code`}),e[7]=d):d=e[7];let f;e[8]===u.display?f=e[9]:(f=(0,J.jsx)(`p`,{"data-testid":`hosted-e2ee-verification-code`,className:`font-mono text-base leading-none font-semibold tracking-[0.2em] whitespace-nowrap select-all`,children:u.display}),e[8]=u.display,e[9]=f);let p;e[10]===u.display?p=e[11]:(p=()=>void navigator.clipboard.writeText(u.display),e[10]=u.display,e[11]=p);let m;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}),e[12]=m):m=e[12];let h;e[13]===p?h=e[14]:(h=(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,onClick:p,children:[m,` Copy`]}),e[13]=p,e[14]=h);let g;return e[15]!==c||e[16]!==f||e[17]!==h?(g=(0,J.jsxs)(`section`,{"aria-label":`Session code`,"data-testid":`hosted-e2ee-verification`,"data-code":`present`,"data-form":c,className:`space-y-2`,children:[d,f,h]}),e[15]=c,e[16]=f,e[17]=h,e[18]=g):g=e[18],g}function ot(e){return e.transportStatus}function st(e){return e.directoryStatus}function ct(e){return e.effectiveRole}var lt=`ryco:pwa:activate:v1`,ut=`Installation is temporarily unavailable.`,dt={errorMessage:null,installState:`hidden`,platform:`other`,registrationState:`disabled`,updateState:`idle`};function ft(e){return e===``||e===`./`?`./`:e.endsWith(`/`)?e:`${e}/`}function pt(e){let t=e.navigator.userAgent;return/iPad|iPhone|iPod/.test(t)||/Macintosh/.test(t)&&e.navigator.maxTouchPoints>1}function mt(e){let t=e;return typeof t.prompt==`function`&&t.userChoice instanceof Promise}function ht(e){let t=dt,n=!1,r=null,i=null,a=!!e.navigator.serviceWorker?.controller,o=!1,s=!1,c=new Set,l=e.window.matchMedia(`(display-mode: standalone)`),u=e=>{let n={...t,...e};Object.entries(n).every(([e,n])=>t[e]===n)||(t=n,c.forEach(e=>e()))},d=()=>l.matches||e.navigator.standalone===!0,f=()=>d()?`installed`:`manual-available`,p=e=>{!mt(e)||d()||(e.preventDefault(),r=e,u({installState:`native-available`}))},m=()=>{r=null,u({installState:`installed`})},h=()=>{d()?(r=null,u({installState:`installed`})):u({installState:r?`native-available`:`manual-available`})},g=()=>{let t=a;a=!!e.navigator.serviceWorker?.controller,!(o||!s&&!t)&&(s=!1,o=!0,e.window.reload())},_=t=>{i=t,t.waiting&&u({updateState:`ready`}),t.addEventListener(`updatefound`,()=>{let n=t.installing;n&&n.addEventListener(`statechange`,()=>{n.state===`installed`&&e.navigator.serviceWorker?.controller&&u({updateState:`ready`})})})},v=async()=>{let t=e.navigator.serviceWorker;if(!t){u({registrationState:`unavailable`,errorMessage:ut});return}u({registrationState:`registering`,errorMessage:null});try{let n=ft(e.baseUrl);_(await t.register(`${n}service-worker.js`,{scope:n})),u({registrationState:`ready`,errorMessage:null})}catch{u({registrationState:`unavailable`,errorMessage:ut})}};return{activateUpdate(){let e=i?.waiting;!e||t.updateState!==`ready`||(s=!0,u({updateState:`activating`}),e.postMessage({type:lt}))},dismissInstall(){r=null,u({installState:d()?`installed`:`hidden`})},getSnapshot(){return t},async promptInstall(){let e=r;e&&(r=null,u({installState:`hidden`}),await e.prompt(),(await e.userChoice).outcome===`dismissed`&&!d()&&u({installState:`manual-available`}))},async start(t){n||(n=!0,t.enabled&&(a=!!e.navigator.serviceWorker?.controller,o=!1,u({installState:f(),platform:pt(e)?`ios`:`other`}),e.window.addEventListener(`beforeinstallprompt`,p),e.window.addEventListener(`appinstalled`,m),l.addEventListener(`change`,h),e.navigator.serviceWorker?.addEventListener(`controllerchange`,g),e.document.readyState===`complete`?await v():e.window.addEventListener(`load`,()=>void v(),{once:!0})))},stop(){n&&(n=!1,r=null,i=null,a=!1,o=!1,s=!1,e.window.removeEventListener(`beforeinstallprompt`,p),e.window.removeEventListener(`appinstalled`,m),l.removeEventListener(`change`,h),e.navigator.serviceWorker?.removeEventListener(`controllerchange`,g),t=dt,c.forEach(e=>e()))},subscribe(e){return c.add(e),()=>c.delete(e)}}}function gt(){let e=navigator;return{baseUrl:`/`,document,navigator:{maxTouchPoints:e.maxTouchPoints,userAgent:e.userAgent,...e.serviceWorker?{serviceWorker:e.serviceWorker}:{},...typeof e.standalone==`boolean`?{standalone:e.standalone}:{}},window:{addEventListener:window.addEventListener.bind(window),removeEventListener:window.removeEventListener.bind(window),matchMedia:window.matchMedia.bind(window),reload:()=>window.location.reload()}}}var _t=typeof window>`u`?null:ht(gt());function vt(e){let t=(0,G.c)(3),{compact:n,lifecycle:r}=e,i=n!==void 0&&n,a=r===void 0?_t:r,o;return t[0]!==i||t[1]!==a?(o=a?(0,J.jsx)(yt,{compact:i,lifecycle:a}):null,t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function yt(e){let t=(0,G.c)(27),{compact:n,lifecycle:r}=e,i=(0,K.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),[a,o]=(0,K.useState)(!1);if(i.installState!==`native-available`&&i.installState!==`manual-available`&&i.updateState===`idle`&&i.registrationState!==`unavailable`)return null;let s=n?`space-y-2`:`mt-4 space-y-3`,c;t[0]!==n||t[1]!==r||t[2]!==i.installState?(c=i.installState===`native-available`?(0,J.jsxs)(O,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,onClick:()=>void r.promptInstall(),children:[(0,J.jsx)(S,{"aria-hidden":!0}),` Install Ryco`]}):null,t[0]=n,t[1]=r,t[2]=i.installState,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==a||t[6]!==i.installState?(l=i.installState===`manual-available`?(0,J.jsxs)(O,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,"aria-expanded":a,onClick:()=>o(bt),children:[(0,J.jsx)(T,{"aria-hidden":!0}),` How to install`]}):null,t[4]=n,t[5]=a,t[6]=i.installState,t[7]=l):l=t[7];let u;t[8]!==n||t[9]!==r||t[10]!==i.updateState?(u=i.updateState===`idle`?null:(0,J.jsxs)(O,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,disabled:i.updateState===`activating`,onClick:()=>r.activateUpdate(),children:[(0,J.jsx)(te,{"aria-hidden":!0}),i.updateState===`activating`?`Updating…`:`Update ready`]}),t[8]=n,t[9]=r,t[10]=i.updateState,t[11]=u):u=t[11];let d;t[12]!==c||t[13]!==l||t[14]!==u?(d=(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c,l,u]}),t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f;t[16]!==a||t[17]!==i?(f=a?(0,J.jsx)(xt,{snapshot:i,onClose:()=>o(!1)}):null,t[16]=a,t[17]=i,t[18]=f):f=t[18];let p;t[19]!==i.errorMessage||t[20]!==i.registrationState?(p=i.registrationState===`unavailable`&&i.errorMessage?(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:i.errorMessage}):null,t[19]=i.errorMessage,t[20]=i.registrationState,t[21]=p):p=t[21];let m;return t[22]!==s||t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,J.jsxs)(`section`,{className:s,"aria-label":`Ryco app installation`,children:[d,f,p]}),t[22]=s,t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function bt(e){return!e}function xt(e){let t=(0,G.c)(13),{snapshot:n,onClose:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(`p`,{className:`font-medium`,children:`Install Ryco on this device`}),t[0]=i):i=t[0];let a;t[1]===n.platform?a=t[2]:(a=(0,J.jsxs)(`div`,{children:[i,n.platform===`ios`?(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`In Safari, open the Share or browser menu, choose Add to Home Screen, enable Open as Web App when offered, then tap Add.`}):(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`Open the browser menu, choose Add to home screen or Install app, then confirm Install.`})]}),t[1]=n.platform,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(E,{"aria-hidden":!0}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(`span`,{className:`sr-only`,children:`Close install instructions`}),t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=(0,J.jsxs)(O,{className:`size-11 shrink-0`,size:`icon`,variant:`ghost`,onClick:r,children:[o,` `,s]}),t[5]=r,t[6]=c);let l;t[7]!==a||t[8]!==c?(l=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(`div`,{className:`mt-3 border-t border-border pt-3`,children:(0,J.jsx)(B,{compact:!0})}),t[10]=u):u=t[10];let d;return t[11]===l?d=t[12]:(d=(0,J.jsxs)(`div`,{role:`region`,"aria-label":`Install Ryco instructions`,className:`rounded-lg border border-border bg-background p-3 text-sm`,children:[l,u]}),t[11]=l,t[12]=d),d}var St={connected:W,disconnected:U,legacy:H,"browser-encrypted":w,"native-verified":C};function Ct(e){let t=(0,G.c)(9),{indicator:n,className:r,testId:i}=e,a;t[0]===n?a=t[1]:(a=it(n),t[0]=n,t[1]=a);let{glyph:o,iconClassName:s}=a,c=St[o],l=String(n.connected),u=`${r} ${s}`,d;return t[2]!==c||t[3]!==o||t[4]!==n.guarantee||t[5]!==l||t[6]!==u||t[7]!==i?(d=(0,J.jsx)(c,{"aria-hidden":!0,"data-testid":i,"data-connected":l,"data-guarantee":n.guarantee,"data-glyph":o,className:u}),t[2]=c,t[3]=o,t[4]=n.guarantee,t[5]=l,t[6]=u,t[7]=i,t[8]=d):d=t[8],d}function wt(e){let t=(0,G.c)(3),{node:n}=e;if(n.revokedAt){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`span`,{className:`text-xs text-destructive`,children:`Revoked`}),t[0]=e):e=t[0],e}let r;return t[1]===n.presence.online?r=t[2]:(r=n.presence.online?(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400`,children:[(0,J.jsx)(W,{"aria-hidden":!0,className:`size-3.5`}),` Online`]}):(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(U,{"aria-hidden":!0,className:`size-3.5`}),` Offline`]}),t[1]=n.presence.online,t[2]=r),r}function Tt(){let e=(0,G.c)(7),t=_(),n;e[0]===t?n=e[1]:(n=async e=>{Ze(e.id)||(await t({to:`/`,replace:!0}),await v.selectNode(e.id))},e[0]=t,e[1]=n);let r=n,i;e[2]===t?i=e[3]:(i=async()=>{Qe()||(await t({to:`/`,replace:!0}),await v.returnToDirectory())},e[2]=t,e[3]=i);let a=i,o;return e[4]!==a||e[5]!==r?(o={switchNode:r,returnToAllNodes:a},e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Et(){let e=(0,G.c)(5),t=o(kt),n=o(Ot);if(t!==`delivery-unknown`)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(`p`,{children:`A request may or may not have reached the node. Ryco did not resend it automatically.`}),e[0]=r):r=e[0];let i=!n,a=n?void 0:`Wait for session replay to finish before acknowledging this warning.`,s=n?`Acknowledge`:`Synchronizing…`,c;return e[1]!==i||e[2]!==a||e[3]!==s?(c=(0,J.jsxs)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-500/30 bg-amber-500/5 p-2 text-xs`,children:[r,(0,J.jsx)(O,{className:`mt-2`,size:`sm`,variant:`outline`,disabled:i,title:a,onClick:Dt,children:s})]}),e[1]=i,e[2]=a,e[3]=s,e[4]=c):c=e[4],c}function Dt(){return v.acknowledgeDeliveryUnknown()}function Ot(e){return e.sessionRecoveredAfterUnknown}function kt(e){return e.sessionStatus}function At(){let e=(0,G.c)(62),t=o(Vt),n=o(Bt),r=o(zt),i=o(Rt),a=o(Lt),s=o(It),c=o(Ft),l=o(Pt),u=o(Nt),d=ie(),{switchNode:f,returnToAllNodes:p}=Tt(),m=(0,K.useRef)(null);if(!t)return null;let h,g;if(e[0]!==u||e[1]!==d||e[2]!==a||e[3]!==i||e[4]!==r){let t={browserStatus:u,sessionStatus:i,selectionStatus:a,transportStatus:r,e2eeStatus:d};h=ae(t),g=oe(t),e[0]=u,e[1]=d,e[2]=a,e[3]=i,e[4]=r,e[5]=h,e[6]=g}else h=e[5],g=e[6];let _=g,v;e[7]===_?v=e[8]:(v=(0,J.jsx)(Ct,{indicator:_,className:`size-4`}),e[7]=_,e[8]=v);let y;e[9]===t.label?y=e[10]:(y=(0,J.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:t.label}),e[9]=t.label,e[10]=y);let x;e[11]===h?x=e[12]:(x=(0,J.jsx)(`span`,{className:`max-w-24 truncate text-xs text-muted-foreground`,children:h}),e[11]=h,e[12]=x);let S;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(b,{"aria-hidden":!0,className:`size-3.5 transition-transform group-open:rotate-180`}),e[13]=S):S=e[13];let C;e[14]!==v||e[15]!==y||e[16]!==x?(C=(0,J.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-lg border border-border bg-card/95 px-3 py-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[v,y,x,S]}),e[14]=v,e[15]=y,e[16]=x,e[17]=C):C=e[17];let w;e[18]===t.label?w=e[19]:(w=(0,J.jsx)(`p`,{className:`font-medium`,children:t.label}),e[18]=t.label,e[19]=w);let T=c??`Role unavailable`,E;e[20]!==h||e[21]!==T?(E=(0,J.jsxs)(`p`,{className:`mt-0.5 text-xs capitalize text-muted-foreground`,children:[T,` · `,h]}),e[20]=h,e[21]=T,e[22]=E):E=e[22];let D;e[23]!==t.label||e[24]!==h?(D=(0,J.jsxs)(`p`,{className:`sr-only`,"aria-live":`polite`,children:[`Node `,t.label,`: `,h,`.`]}),e[23]=t.label,e[24]=h,e[25]=D):D=e[25];let k;e[26]===l?k=e[27]:(k=l?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:l}):null,e[26]=l,e[27]=k);let A;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(Et,{}),e[28]=A):A=e[28];let j;e[29]===p?j=e[30]:(j=()=>void p(),e[29]=p,e[30]=j);let re;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,J.jsx)(ce,{"aria-hidden":!0,className:`size-4`}),e[31]=re):re=e[31];let M;e[32]===j?M=e[33]:(M=(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:j,children:[re,` All nodes`]}),e[32]=j,e[33]=M);let N;if(e[34]!==u||e[35]!==s||e[36]!==t.id||e[37]!==n||e[38]!==f){let r;e[40]===t.id?r=e[41]:(r=e=>e.id!==t.id,e[40]=t.id,e[41]=r);let i;e[42]!==u||e[43]!==s||e[44]!==f?(i=e=>(0,J.jsxs)(`button`,{type:`button`,disabled:s!==`ready`||u!==`current`||e.revokedAt!==null||e.capabilities?.nativeClientRequired===!0,title:e.capabilities?.nativeClientRequired===!0?`Open in Desktop/Mobile`:void 0,className:`flex w-full items-center justify-between rounded-md px-2 py-2 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>void f(e),children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label}),(0,J.jsx)(wt,{node:e})]},e.id),e[42]=u,e[43]=s,e[44]=f,e[45]=i):i=e[45],N=n.filter(r).map(i),e[34]=u,e[35]=s,e[36]=t.id,e[37]=n,e[38]=f,e[39]=N}else N=e[39];let P;e[46]!==M||e[47]!==N?(P=(0,J.jsxs)(`div`,{className:`mt-3 max-h-48 space-y-1 overflow-auto border-t border-border pt-3`,children:[M,N]}),e[46]=M,e[47]=N,e[48]=P):P=e[48];let F;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsxs)(O,{size:`sm`,variant:`outline`,onClick:Mt,children:[(0,J.jsx)(te,{"aria-hidden":!0}),` Refresh`]}),e[49]=F):F=e[49];let I;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsxs)(O,{size:`sm`,variant:`ghost`,onClick:jt,children:[(0,J.jsx)(ee,{"aria-hidden":!0}),` Sign out`]}),e[50]=I):I=e[50];let L;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-border pt-3`,children:[F,I,(0,J.jsxs)(O,{size:`sm`,variant:`ghost`,onClick:()=>{m.current&&(m.current.open=!1),Te({kind:`account`,section:`security`})},children:[(0,J.jsx)(ne,{"aria-hidden":!0}),` Security details`]})]}),e[51]=L):L=e[51];let R;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsxs)(`div`,{className:`mt-3 space-y-3 border-t border-border pt-3`,children:[(0,J.jsx)(at,{}),(0,J.jsx)(vt,{compact:!0})]}),e[52]=R):R=e[52];let z;e[53]!==k||e[54]!==P||e[55]!==w||e[56]!==E||e[57]!==D?(z=(0,J.jsxs)(`div`,{className:`absolute right-0 z-50 mt-2 w-72 rounded-xl border border-border bg-popover p-3 shadow-xl`,children:[w,E,D,k,A,P,L,R]}),e[53]=k,e[54]=P,e[55]=w,e[56]=E,e[57]=D,e[58]=z):z=e[58];let B;return e[59]!==z||e[60]!==C?(B=(0,J.jsx)(`div`,{className:`relative max-w-full`,children:(0,J.jsxs)(`details`,{ref:m,className:`group relative`,children:[C,z]})}),e[59]=z,e[60]=C,e[61]=B):B=e[61],B}function jt(){v.signOut()}function Mt(){v.refreshDirectory()}function Nt(e){return e.browserStatus}function Pt(e){return e.errorMessage}function Ft(e){return e.effectiveRole}function It(e){return e.directoryStatus}function Lt(e){return e.selectionStatus}function Rt(e){return e.sessionStatus}function zt(e){return e.transportStatus}function Bt(e){return e.nodes}function Vt(e){return e.selectedNode}function Ht(e){let t=(0,G.c)(66),{open:n,onOpenChange:r}=e,i=o($t),a=o(Qt),s=o(Zt),c=o(Xt),l=o(Yt),u=o(Jt),d=o(qt),f=o(Kt),p=o(Gt),m=ie(),{switchNode:h,returnToAllNodes:g}=Tt();if(!i)return null;let _,v;if(t[0]!==p||t[1]!==m||t[2]!==l||t[3]!==c||t[4]!==s){let e={browserStatus:p,sessionStatus:c,selectionStatus:l,transportStatus:s,e2eeStatus:m};_=ae(e),v=oe(e),t[0]=p,t[1]=m,t[2]=l,t[3]=c,t[4]=s,t[5]=_,t[6]=v}else _=t[5],v=t[6];let y=v,b=u!==`ready`||p!==`current`,x;t[7]===y?x=t[8]:(x=(0,J.jsx)(Ct,{indicator:y,className:`size-4`}),t[7]=y,t[8]=x);let S;t[9]===i.label?S=t[10]:(S=(0,J.jsx)(`span`,{className:`truncate`,children:i.label}),t[9]=i.label,t[10]=S);let C;t[11]!==x||t[12]!==S?(C=(0,J.jsxs)(M,{className:`flex items-center gap-2`,children:[x,S]}),t[11]=x,t[12]=S,t[13]=C):C=t[13];let w=d??`Role unavailable`,T;t[14]!==_||t[15]!==w?(T=(0,J.jsxs)(re,{className:`capitalize`,children:[w,` · `,_]}),t[14]=_,t[15]=w,t[16]=T):T=t[16];let E;t[17]!==i.label||t[18]!==_?(E=(0,J.jsxs)(`p`,{className:`sr-only`,"aria-live":`polite`,children:[`Node `,i.label,`: `,_,`.`]}),t[17]=i.label,t[18]=_,t[19]=E):E=t[19];let D;t[20]!==C||t[21]!==T||t[22]!==E?(D=(0,J.jsxs)(j,{children:[C,T,E]}),t[20]=C,t[21]=T,t[22]=E,t[23]=D):D=t[23];let k;t[24]===f?k=t[25]:(k=f?(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:f}):null,t[24]=f,t[25]=k);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(Et,{}),t[26]=F):F=t[26];let I;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsx)(ne,{"aria-hidden":!0,className:`size-4 shrink-0`}),t[27]=I):I=t[27];let L;t[28]===r?L=t[29]:(L=(0,J.jsx)(N,{label:`Security details`,icon:I,onClick:()=>{r(!1),Te({kind:`account`,section:`security`})}}),t[28]=r,t[29]=L);let R;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsx)(ce,{"aria-hidden":!0,className:`size-4 shrink-0`}),t[30]=R):R=t[30];let z;t[31]!==r||t[32]!==g?(z=(0,J.jsx)(N,{label:`All nodes`,icon:R,onClick:()=>{r(!1),g()}}),t[31]=r,t[32]=g,t[33]=z):z=t[33];let B;if(t[34]!==i.id||t[35]!==a||t[36]!==r||t[37]!==h||t[38]!==b){let e;t[40]===i.id?e=t[41]:(e=e=>e.id!==i.id,t[40]=i.id,t[41]=e);let n;t[42]!==r||t[43]!==h||t[44]!==b?(n=e=>(0,J.jsx)(N,{label:e.label,disabled:b||e.revokedAt!==null||e.capabilities?.nativeClientRequired===!0,disabledReason:e.capabilities?.nativeClientRequired===!0?`Open in Desktop/Mobile`:e.revokedAt===null?`Node switching is unavailable until the directory and this browser are current.`:`Access to this node was revoked.`,trailing:(0,J.jsx)(wt,{node:e}),onClick:()=>{r(!1),h(e)}},e.id),t[42]=r,t[43]=h,t[44]=b,t[45]=n):n=t[45],B=a.filter(e).map(n),t[34]=i.id,t[35]=a,t[36]=r,t[37]=h,t[38]=b,t[39]=B}else B=t[39];let V;t[46]!==L||t[47]!==z||t[48]!==B?(V=(0,J.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-border pt-3`,children:[L,z,B]}),t[46]=L,t[47]=z,t[48]=B,t[49]=V):V=t[49];let se=u===`loading`,H;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsx)(te,{"aria-hidden":!0}),t[50]=H):H=t[50];let U;t[51]===se?U=t[52]:(U=(0,J.jsxs)(O,{size:`sm`,variant:`outline`,className:`min-h-11`,disabled:se,onClick:Wt,children:[H,` Refresh nodes`]}),t[51]=se,t[52]=U);let W;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,J.jsxs)(O,{size:`sm`,variant:`ghost`,className:`min-h-11`,onClick:Ut,children:[(0,J.jsx)(ee,{"aria-hidden":!0}),` Sign out`]}),t[53]=W):W=t[53];let K;t[54]===U?K=t[55]:(K=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-border pt-3`,children:[U,W]}),t[54]=U,t[55]=K);let le;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,J.jsx)(`div`,{className:`mt-3 space-y-3 border-t border-border pt-3`,children:(0,J.jsx)(vt,{compact:!0})}),t[56]=le):le=t[56];let q;t[57]!==V||t[58]!==K||t[59]!==k?(q=(0,J.jsxs)(A,{children:[k,F,V,K,le]}),t[57]=V,t[58]=K,t[59]=k,t[60]=q):q=t[60];let ue;return t[61]!==r||t[62]!==n||t[63]!==q||t[64]!==D?(ue=(0,J.jsxs)(P,{open:n,onOpenChange:r,label:`Connection`,children:[D,q]}),t[61]=r,t[62]=n,t[63]=q,t[64]=D,t[65]=ue):ue=t[65],ue}function Ut(){v.signOut()}function Wt(){v.refreshDirectory()}function Gt(e){return e.browserStatus}function Kt(e){return e.errorMessage}function qt(e){return e.effectiveRole}function Jt(e){return e.directoryStatus}function Yt(e){return e.selectionStatus}function Xt(e){return e.sessionStatus}function Zt(e){return e.transportStatus}function Qt(e){return e.nodes}function $t(e){return e.selectedNode}function en(){let e=(0,G.c)(25),t=o(on),n=o(an),r=o(rn),i=o(nn),a=o(tn),s=ie(),[c,l]=(0,K.useState)(!1);if(!t)return null;let u,d;if(e[0]!==a||e[1]!==s||e[2]!==i||e[3]!==r||e[4]!==n){let t={browserStatus:a,sessionStatus:r,selectionStatus:i,transportStatus:n,e2eeStatus:s};u=ae(t),d=oe(t),e[0]=a,e[1]=s,e[2]=i,e[3]=r,e[4]=n,e[5]=u,e[6]=d}else u=e[5],d=e[6];let f=d,p;e[7]!==t.label||e[8]!==c||e[9]!==r||e[10]!==u?(p=c?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{role:`status`,"aria-live":`polite`,"data-testid":`hosted-connection-status-announcer`,className:`sr-only`,children:[`Node `,t.label,`: `,u,`.`]}),r===`delivery-unknown`?(0,J.jsx)(`span`,{role:`alert`,className:`sr-only`,children:`Delivery unknown: a request may or may not have reached the node. Open the connection controls to acknowledge.`}):null]}),e[7]=t.label,e[8]=c,e[9]=r,e[10]=u,e[11]=p):p=e[11];let m=`Connection: ${t.label}, ${u}`,h;e[12]===f?h=e[13]:(h=(0,J.jsx)(Ct,{indicator:f,testId:`hosted-connection-icon`,className:`size-3.5 shrink-0`}),e[12]=f,e[13]=h);let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>l(!0),e[14]=g):g=e[14];let _;e[15]!==f.shortLabel||e[16]!==m||e[17]!==h?(_=(0,J.jsx)(nt,{testId:`hosted-connection-pill`,label:m,status:f.shortLabel,icon:h,onClick:g}),e[15]=f.shortLabel,e[16]=m,e[17]=h,e[18]=_):_=e[18];let v;e[19]===c?v=e[20]:(v=(0,J.jsx)(Ht,{open:c,onOpenChange:l}),e[19]=c,e[20]=v);let y;return e[21]!==p||e[22]!==_||e[23]!==v?(y=(0,J.jsxs)(J.Fragment,{children:[p,_,v]}),e[21]=p,e[22]=_,e[23]=v,e[24]=y):y=e[24],y}function tn(e){return e.browserStatus}function nn(e){return e.selectionStatus}function rn(e){return e.sessionStatus}function an(e){return e.transportStatus}function on(e){return e.selectedNode}function sn(){let e=(0,G.c)(2),t=k(),n;return e[0]===t?n=e[1]:(n=t===`phone`?(0,J.jsx)(en,{}):(0,J.jsx)(At,{}),e[0]=t,e[1]=n),n}export{De as _,Tt as a,Le as c,et as d,Pe as f,Ee as g,Te as h,wt as i,Ze as l,me as m,en as n,vt as o,pe as p,At as r,_t as s,sn as t,Ne as u,U as v};