@spencerboucher/switchyard 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/dist/bridge/pi-model.js +12 -0
  3. package/dist/bridge/switchyard-terminal.js +66 -1
  4. package/dist/switchyard.mjs +394 -51
  5. package/dist/terminal/holder.js +47 -1
  6. package/package.json +1 -1
  7. package/web-dist/assets/AutomationView-CrKqim2i.js +2 -0
  8. package/web-dist/assets/{AutomationView-BsTwLnMp.js.map → AutomationView-CrKqim2i.js.map} +1 -1
  9. package/web-dist/assets/{Card-CAFxHoHd.js → Card-XMb6DfZU.js} +2 -2
  10. package/web-dist/assets/{Card-CAFxHoHd.js.map → Card-XMb6DfZU.js.map} +1 -1
  11. package/web-dist/assets/{Checkbox-rDvnQnxc.js → Checkbox-CeUPbVi7.js} +2 -2
  12. package/web-dist/assets/{Checkbox-rDvnQnxc.js.map → Checkbox-CeUPbVi7.js.map} +1 -1
  13. package/web-dist/assets/{Copy-D8xhl7eJ.js → Copy-CGnl0Vga.js} +2 -2
  14. package/web-dist/assets/{Copy-D8xhl7eJ.js.map → Copy-CGnl0Vga.js.map} +1 -1
  15. package/web-dist/assets/Field-DVurWE-E.js +2 -0
  16. package/web-dist/assets/Field-DVurWE-E.js.map +1 -0
  17. package/web-dist/assets/{InteractionCard-Yu5wgLC3.js → InteractionCard-1ePc4XOF.js} +4 -4
  18. package/web-dist/assets/{InteractionCard-Yu5wgLC3.js.map → InteractionCard-1ePc4XOF.js.map} +1 -1
  19. package/web-dist/assets/{Menu-euseM8yR.js → Menu-CYZQ97c0.js} +2 -2
  20. package/web-dist/assets/{Menu-euseM8yR.js.map → Menu-CYZQ97c0.js.map} +1 -1
  21. package/web-dist/assets/Overlay-DlLhg1cK.js +2 -0
  22. package/web-dist/assets/Overlay-DlLhg1cK.js.map +1 -0
  23. package/web-dist/assets/Priority-BCHLJqWN.js +2 -0
  24. package/web-dist/assets/{Priority-Ca1B2yFr.js.map → Priority-BCHLJqWN.js.map} +1 -1
  25. package/web-dist/assets/{SegmentedControl-D2d-NEr-.js → SegmentedControl-CSO0EMTX.js} +2 -2
  26. package/web-dist/assets/{SegmentedControl-D2d-NEr-.js.map → SegmentedControl-CSO0EMTX.js.map} +1 -1
  27. package/web-dist/assets/{Select-C9L1HKMm.js → Select-Dgmnmpz3.js} +2 -2
  28. package/web-dist/assets/{Select-C9L1HKMm.js.map → Select-Dgmnmpz3.js.map} +1 -1
  29. package/web-dist/assets/{Switch-DAcUcSbH.js → Switch-DS4NRENd.js} +2 -2
  30. package/web-dist/assets/{Switch-DAcUcSbH.js.map → Switch-DS4NRENd.js.map} +1 -1
  31. package/web-dist/assets/{Tabs-xtagjtA5.js → Tabs-9xp-tGja.js} +4 -4
  32. package/web-dist/assets/{Tabs-xtagjtA5.js.map → Tabs-9xp-tGja.js.map} +1 -1
  33. package/web-dist/assets/{TextArea-CKGHwURx.js → TextArea-PfVKaz29.js} +2 -2
  34. package/web-dist/assets/{TextArea-CKGHwURx.js.map → TextArea-PfVKaz29.js.map} +1 -1
  35. package/web-dist/assets/{TextLink-Bub7sMxr.js → TextLink-CYqiAUlK.js} +2 -2
  36. package/web-dist/assets/{TextLink-Bub7sMxr.js.map → TextLink-CYqiAUlK.js.map} +1 -1
  37. package/web-dist/assets/attention-CTkX5JXq.js +2 -0
  38. package/web-dist/assets/attention-CTkX5JXq.js.map +1 -0
  39. package/web-dist/assets/automations-CsdtA3xp.js +2 -0
  40. package/web-dist/assets/{automations-BzpsJoa3.js.map → automations-CsdtA3xp.js.map} +1 -1
  41. package/web-dist/assets/board-CJL75uGb.js +10 -0
  42. package/web-dist/assets/{board-CeJxBVHC.js.map → board-CJL75uGb.js.map} +1 -1
  43. package/web-dist/assets/code-B1njb2Cr.css +1 -0
  44. package/web-dist/assets/code-CEYPZt-J.js +21 -0
  45. package/web-dist/assets/code-CEYPZt-J.js.map +1 -0
  46. package/web-dist/assets/describe-DjRsBpcB.js +5 -0
  47. package/web-dist/assets/{describe-CVXeUClF.js.map → describe-DjRsBpcB.js.map} +1 -1
  48. package/web-dist/assets/enroll-DcEYGgoX.js +2 -0
  49. package/web-dist/assets/{enroll-jnKygG4L.js.map → enroll-DcEYGgoX.js.map} +1 -1
  50. package/web-dist/assets/index-BeJqGnFE.css +2 -0
  51. package/web-dist/assets/index-DSJZdQ79.js +11 -0
  52. package/web-dist/assets/index-DSJZdQ79.js.map +1 -0
  53. package/web-dist/assets/more-BQSa_-H6.js +2 -0
  54. package/web-dist/assets/{more-DvKHMdBk.js.map → more-BQSa_-H6.js.map} +1 -1
  55. package/web-dist/assets/plus-BLP-wIYD.js +2 -0
  56. package/web-dist/assets/plus-BLP-wIYD.js.map +1 -0
  57. package/web-dist/assets/preload-helper-Huh16h6r.js +13 -0
  58. package/web-dist/assets/preload-helper-Huh16h6r.js.map +1 -0
  59. package/web-dist/assets/queue-CCjBjQhT.js +2 -0
  60. package/web-dist/assets/{queue-B2Vl0uSh.js.map → queue-CCjBjQhT.js.map} +1 -1
  61. package/web-dist/assets/repo-pkFfpra6.js +2 -0
  62. package/web-dist/assets/repo-pkFfpra6.js.map +1 -0
  63. package/web-dist/assets/settings-vrxspmWN.js +7 -0
  64. package/web-dist/assets/settings-vrxspmWN.js.map +1 -0
  65. package/web-dist/assets/shared-Bm6Rhfqw.js +3 -0
  66. package/web-dist/assets/shared-Bm6Rhfqw.js.map +1 -0
  67. package/web-dist/assets/states-BQxrRFdh.js +56 -0
  68. package/web-dist/assets/states-BQxrRFdh.js.map +1 -0
  69. package/web-dist/assets/{terminal-login-BK5UjUir.js → terminal-login-D9enO0EH.js} +2 -2
  70. package/web-dist/assets/{terminal-login-BK5UjUir.js.map → terminal-login-D9enO0EH.js.map} +1 -1
  71. package/web-dist/assets/timer-BCIucSXh.js +2 -0
  72. package/web-dist/assets/timer-BCIucSXh.js.map +1 -0
  73. package/web-dist/assets/useBreakpoint-LY_qlpRG.js +2 -0
  74. package/web-dist/assets/useBreakpoint-LY_qlpRG.js.map +1 -0
  75. package/web-dist/assets/useNow-BUvGqrfn.js +2 -0
  76. package/web-dist/assets/{useNow-Cm-tdyod.js.map → useNow-BUvGqrfn.js.map} +1 -1
  77. package/web-dist/assets/{useResource-BBqCoY2q.js → useResource-Dul6MTDM.js} +2 -2
  78. package/web-dist/assets/{useResource-BBqCoY2q.js.map → useResource-Dul6MTDM.js.map} +1 -1
  79. package/web-dist/index.html +10 -7
  80. package/web-dist/sw.js +1 -1
  81. package/web-dist/sw.js.map +1 -1
  82. package/web-dist/assets/AutomationView-BsTwLnMp.js +0 -2
  83. package/web-dist/assets/Field-Dbg_8KTt.js +0 -2
  84. package/web-dist/assets/Field-Dbg_8KTt.js.map +0 -1
  85. package/web-dist/assets/Overlay-BNPvMjLX.js +0 -2
  86. package/web-dist/assets/Overlay-BNPvMjLX.js.map +0 -1
  87. package/web-dist/assets/Priority-Ca1B2yFr.js +0 -2
  88. package/web-dist/assets/StatusChip-BYuVxYS7.js +0 -2
  89. package/web-dist/assets/StatusChip-BYuVxYS7.js.map +0 -1
  90. package/web-dist/assets/attention-CI4dHY81.js +0 -2
  91. package/web-dist/assets/attention-CI4dHY81.js.map +0 -1
  92. package/web-dist/assets/auth-308hUVgi.js +0 -2
  93. package/web-dist/assets/auth-308hUVgi.js.map +0 -1
  94. package/web-dist/assets/automations-BzpsJoa3.js +0 -2
  95. package/web-dist/assets/bell-DSwa2PAb.js +0 -2
  96. package/web-dist/assets/bell-DSwa2PAb.js.map +0 -1
  97. package/web-dist/assets/board-CeJxBVHC.js +0 -10
  98. package/web-dist/assets/code-DkNQvMI9.js +0 -12
  99. package/web-dist/assets/code-DkNQvMI9.js.map +0 -1
  100. package/web-dist/assets/describe-CVXeUClF.js +0 -5
  101. package/web-dist/assets/enroll-jnKygG4L.js +0 -2
  102. package/web-dist/assets/index-BHGZTS2e.js +0 -16
  103. package/web-dist/assets/index-BHGZTS2e.js.map +0 -1
  104. package/web-dist/assets/index-D2ml031z.css +0 -2
  105. package/web-dist/assets/more-DvKHMdBk.js +0 -2
  106. package/web-dist/assets/queue-B2Vl0uSh.js +0 -2
  107. package/web-dist/assets/repo-BDS8RBxq.js +0 -2
  108. package/web-dist/assets/repo-BDS8RBxq.js.map +0 -1
  109. package/web-dist/assets/server-BqZ-w6M8.js +0 -2
  110. package/web-dist/assets/server-BqZ-w6M8.js.map +0 -1
  111. package/web-dist/assets/settings-CLt7x9u8.js +0 -8
  112. package/web-dist/assets/settings-CLt7x9u8.js.map +0 -1
  113. package/web-dist/assets/states-C773NlHo.js +0 -56
  114. package/web-dist/assets/states-C773NlHo.js.map +0 -1
  115. package/web-dist/assets/useBackTo-BIrCq3W2.js +0 -2
  116. package/web-dist/assets/useBackTo-BIrCq3W2.js.map +0 -1
  117. package/web-dist/assets/useBreakpoint-BphHBrzF.js +0 -2
  118. package/web-dist/assets/useBreakpoint-BphHBrzF.js.map +0 -1
  119. package/web-dist/assets/useNow-Cm-tdyod.js +0 -2
@@ -1,2 +0,0 @@
1
- import{_ as e,f as t,i as n,m as r,n as i,p as a,t as o,u as s}from"./jsx-runtime-D13aM9HY.js";import{b as c,g as l,h as u,o as d,x as f}from"./StatusChip-BYuVxYS7.js";import{A as ee,P as te,_ as ne,_t as re,bt as p,c as m,d as h,gt as g,h as _,ht as ie,i as ae,it as oe,n as v,nt as y,r as b,s as se,t as x,u as S,v as C,vt as ce,yt as w,z as T}from"./states-C773NlHo.js";import{a as le,i as ue,n as de,t as E}from"./Field-Dbg_8KTt.js";import{t as D}from"./calendar-clock-B8zE4JsX.js";import{n as fe,r as pe}from"./Copy-D8xhl7eJ.js";import{n as me,r as he,t as ge}from"./Priority-Ca1B2yFr.js";import{a as _e,i as O,t as ve,u as ye}from"./useBreakpoint-BphHBrzF.js";import{t as be}from"./key-round-VDbE9E4X.js";import{t as xe}from"./play-CjoDg3ws.js";import{i as k,n as Se,r as Ce}from"./useBackTo-BIrCq3W2.js";import{n as we,t as Te}from"./DangerZone-og55TRug.js";import{x as Ee}from"./index-BHGZTS2e.js";import{o as A,t as De}from"./Overlay-BNPvMjLX.js";import{n as j,r as M}from"./TextArea-CKGHwURx.js";import{t as N}from"./TextLink-Bub7sMxr.js";import{t as P}from"./SegmentedControl-D2d-NEr-.js";import{t as F}from"./Card-CAFxHoHd.js";import{t as I}from"./Select-C9L1HKMm.js";import{t as L}from"./Switch-DAcUcSbH.js";import{E as R,O as Oe,S as ke,T as z,a as B,b as Ae,d as je,f as V,g as H,h as U,i as W,l as G,m as Me,n as Ne,o as Pe,p as K,r as q,s as Fe,t as Ie,u as Le,v as Re,w as J,x as ze,y as Be}from"./describe-CVXeUClF.js";var Y={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};Y.node;var Ve=i(Y),X=e(r(),1),Z=o(),He=e=>`/tasks/${encodeURIComponent(e)}`;function Q(e){return p(e)&&(e.status===404||e.status===405||e.status===501)}function Ue({summary:e,errorCount:t}){return(0,Z.jsxs)(F,{stack:!0,title:`Summary`,testId:`automation-summary`,children:[(0,Z.jsx)(`p`,{className:`text-sm break-words`,children:e}),t>0&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm text-danger`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`size-4 shrink-0`}),t===1?`1 field needs attention`:`${t} fields need attention`]})]})}async function We(e,t,n){return e&&!n?g(J(e,`/preview`)):ce(`/api/automations/preview`,t)}function Ge({automationId:e,dirty:t,getInput:n,currentKey:r}){let[i,a]=(0,X.useState)({status:`idle`}),o=async()=>{let r=n();if(!r)O.error(`Fix the highlighted fields to preview the task`);else{a({status:`loading`});try{let n=await We(e,r,t);a({status:`done`,preview:n,key:JSON.stringify(r)})}catch(e){a(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}}};return(0,Z.jsxs)(F,{stack:!0,title:`Preview`,description:`See the task an occurrence would create, and when it would run next.`,testId:`automation-preview`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(h,{icon:(0,Z.jsx)(l,{className:`size-4`}),busy:i.status===`loading`,onClick:()=>void o(),children:`Preview resulting task`})}),i.status===`unsupported`&&(0,Z.jsx)(S,{capability:`Task preview`,reason:`This coordinator does not offer automation previews.`,fallback:`Read the summary above, or save and use Run now to see a real task.`}),i.status===`error`&&(0,Z.jsx)(v,{compact:!0,title:`Could not preview`,error:i.error,onRetry:()=>void o()}),i.status===`done`&&(0,Z.jsx)(Ke,{preview:i.preview,stale:i.key!==r})]})}function Ke({preview:e,stale:t}){let{task:n}=e;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-warning`,role:`status`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),`The form changed since this preview. Preview again to refresh it.`]}),(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:e.summary}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border bg-surface-2 p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`min-w-0 font-medium break-words`,children:n.title}),(0,Z.jsx)(me,{priority:n.priority,muted:!0,className:`shrink-0 text-xs`})]}),n.objective?(0,Z.jsx)(`p`,{className:`text-sm break-words whitespace-pre-wrap`,children:n.objective}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No objective.`}),n.acceptanceCriteria.length>0&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h4`,{className:`flex items-center gap-1 text-xs font-medium text-muted`,children:[(0,Z.jsx)(u,{"aria-hidden":!0,className:`size-3.5`}),`Acceptance criteria`]}),(0,Z.jsx)(`ul`,{className:`mt-1 list-disc pl-5 text-sm`,children:n.acceptanceCriteria.map((e,t)=>(0,Z.jsx)(`li`,{className:`break-words`,children:e},t))})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Next occurrences`}),e.next.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No scheduled times: this trigger fires on demand, on a webhook, or when a task is done.`}):(0,Z.jsx)(`ol`,{className:`mt-1 flex flex-col gap-0.5 text-sm`,children:e.next.slice(0,5).map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,Z.jsx)(`time`,{dateTime:e,children:K(e)}),(0,Z.jsx)(`span`,{className:`text-muted`,children:_(e)})]},e))})]})]})}function qe({label:e,value:t,mono:n=!0}){return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 rounded border border-border bg-surface px-2 py-1.5 text-xs break-all select-all ${n?`font-mono`:``}`,children:t}),(0,Z.jsx)(h,{size:`sm`,icon:(0,Z.jsx)(pe,{className:`size-3.5`}),onClick:()=>void fe(t,`${e} copied`),"aria-label":`Copy ${e.toLowerCase()}`,children:`Copy`})]})]})}function Je({automation:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(!1),l=e.webhookTokenSet||a!==null,u=async()=>{i(!1),n(!0);try{let t=await ce(J(e.id,`/webhook-token`)),n=y.safeParse(t);if(!n.success)throw Error(`The coordinator returned an unexpected token response`);let r=new URL(n.data.url,window.location.origin).toString();o({token:n.data.token,url:r}),O.success(l?`Webhook token rotated`:`Webhook token created`)}catch(e){Q(e)?c(!0):O.error(`Could not issue a webhook token: ${w(e)}`)}finally{n(!1)}};return(0,Z.jsxs)(F,{stack:!0,title:`Webhook`,description:`POST JSON to the URL with the token as a Bearer header. Filters decide which payloads fire.`,testId:`webhook-token`,children:[(0,Z.jsx)(`p`,{className:`flex items-center gap-1.5 text-sm`,children:l?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ye,{"aria-hidden":!0,className:`size-4 shrink-0 text-success`}),`A token is set`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted`}),`No token yet: webhook calls are rejected until you create one`]})}),s?(0,Z.jsx)(S,{capability:`Webhook tokens`,reason:`This coordinator does not issue webhook tokens.`}):(0,Z.jsx)(`div`,{children:(0,Z.jsx)(h,{icon:(0,Z.jsx)(be,{className:`size-4`}),busy:t,onClick:()=>l?i(!0):void u(),children:l?`Rotate token`:`Create token`})}),a&&(0,Z.jsxs)(`div`,{role:`alert`,className:`flex min-w-0 flex-col gap-3 rounded-md border border-warning bg-warning-soft p-3`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-sm font-medium`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),`This token is shown once. Copy it now.`]}),(0,Z.jsx)(qe,{label:`Token`,value:a.token}),(0,Z.jsx)(qe,{label:`URL`,value:a.url}),(0,Z.jsx)(qe,{label:`Example`,value:Pe(a.token,a.url)}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(h,{size:`sm`,onClick:()=>o(null),children:`I have copied it`})})]}),(0,Z.jsx)(De,{open:r,onClose:()=>i(!1),title:`Rotate webhook token?`,description:`The current token stops working immediately. Update every sender with the new token.`,confirmLabel:`Rotate token`,busy:t,onConfirm:()=>void u()})]})}var Ye=[];function Xe({automationId:e,refreshKey:t,onRun:n}){let r=T(t=>t.occurrences[e]??Ye),i=T(e=>e.tasks),[a,o]=(0,X.useState)({status:`loading`}),s=(0,X.useCallback)(async t=>{o(e=>e.status===`done`?e:{status:`loading`});try{let n=await g(J(e,`/history`),{},t);o({status:`done`,items:Re(n)})}catch(e){if(t?.aborted)return;o(Q(e)?{status:`unsupported`}:{status:`error`,error:e})}},[e]);(0,X.useEffect)(()=>{let e=new AbortController;return s(e.signal),()=>e.abort()},[s,t]);let c=H(a.status===`done`?a.items:[],r);return(0,Z.jsxs)(F,{stack:!0,title:`History`,description:`Occurrences of this automation. Routine successes are hidden from the board and appear only here.`,testId:`automation-history`,children:[a.status===`unsupported`&&(0,Z.jsx)(S,{capability:`Automation history`,reason:`This coordinator does not serve stored history; only occurrences seen live in this session are shown.`}),a.status===`error`&&(0,Z.jsx)(v,{compact:!0,title:`Could not load history`,error:a.error,onRetry:()=>void s()}),a.status===`loading`&&c.length===0?(0,Z.jsx)(m,{label:`Loading history…`,className:`py-4`}):c.length===0&&a.status!==`error`?(0,Z.jsx)(x,{className:`py-4`,icon:(0,Z.jsx)(Ve,{className:`size-6`}),title:`No occurrences yet`,description:`Occurrences appear here when the trigger fires or you run it.`,action:{label:`Run now`,onClick:n,icon:(0,Z.jsx)(xe,{className:`size-4`})}}):(0,Z.jsx)(`ol`,{className:`flex flex-col divide-y divide-border`,children:c.map(e=>{let t=Be(e),n=e.taskId?i[e.taskId]:void 0,r=[e.reason,e.outcome].filter(Boolean).join(` · `);return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1 py-2 first:pt-0 last:pb-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(d,{kind:`occurrence`,value:e.state,size:`sm`}),(0,Z.jsx)(`time`,{dateTime:t,className:`text-sm`,children:K(t)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:_(t)})]}),r&&(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:r}),e.taskId&&(0,Z.jsxs)(N,{to:He(e.taskId),variant:`action`,size:`sm`,className:`self-start`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:n?`Task: ${n.title}`:`Open task`}),n?.hiddenFromBoard&&(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted`,children:`(hidden from board)`})]})]},e.id)})})]})}var Ze=`/automations`,Qe=e=>`/automations/${encodeURIComponent(e)}`,$e=`sy:automation-draft`;function et(){let{automationId:e=`new`}=a();return(0,Z.jsx)(tt,{automationId:e},e)}function tt({automationId:e}){let t=e===`new`,n=T(e=>e.hydrated),r=R(t?void 0:e),[i,a]=(0,X.useState)({status:`idle`}),o=(0,X.useCallback)(async()=>{a({status:`loading`});try{let t=await g(J(e)),n=oe.safeParse(t);if(!n.success){a({status:`fatal`,error:Error(`The coordinator returned this automation in an unexpected format.`)});return}z.getState().put(n.data),a({status:`idle`})}catch(e){p(e)&&e.status===404?a({status:`notfound`}):a({status:`error`,error:e})}},[e]),s=!t&&!r;return(0,X.useEffect)(()=>{s&&i.status===`idle`&&o()},[s,i.status,o]),t?(0,Z.jsx)(at,{automation:null}):r?(0,Z.jsx)(at,{automation:r}):i.status===`notfound`?(0,Z.jsx)(x,{icon:(0,Z.jsx)(Ee,{className:`size-8`}),title:`Automation not found`,description:`It may have been deleted, or the link is wrong.`,action:{label:`Back to automations`,to:Ze}}):i.status===`error`?(0,Z.jsx)(v,{title:`Could not load this automation`,error:i.error,onRetry:()=>void o()}):i.status===`fatal`?(0,Z.jsx)(b,{error:i.error}):(0,Z.jsx)(m,{label:n?`Loading automation…`:`Loading…`})}function nt(e){let t=je({projectId:e,timezone:U()});try{let e=sessionStorage.getItem($e);if(!e)return t;let n=JSON.parse(e);return!n||typeof n!=`object`?t:{...t,...n,filters:Array.isArray(n.filters)?n.filters:[]}}catch{return t}}function rt(e){try{e?sessionStorage.setItem($e,JSON.stringify(e)):sessionStorage.removeItem($e)}catch{}}var $=e=>JSON.stringify(Le(e));function it(e){if(!p(e))return{};let t=e.details,n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.issues)?t.issues:[],r={};for(let e of n){if(!e||typeof e!=`object`)continue;let{path:t,message:n}=e;if(!Array.isArray(t)||typeof n!=`string`)continue;let i=V(t);i!==`form`&&!r[i]&&(r[i]=n)}return r}function at({automation:e}){let r=t(),i=s(),a=Ce(Ze),o=ve(),l=o===`desktop`,u=te(),d=ee(),f=T(e=>e.hosts),p=T(e=>e.profiles),m=T(e=>e.tasks),g=T(e=>e.projects),_=e===null,oe=(0,X.useId)(),v=(0,X.useRef)(null),[y,b]=(0,X.useState)(()=>e?G(e):nt(u[0]?.id)),[x,S]=(0,X.useState)(()=>$(y)),[E,D]=(0,X.useState)(!1),[fe,pe]=(0,X.useState)({}),[me,he]=(0,X.useState)(!1),[ge,ye]=(0,X.useState)(!1),[be,k]=(0,X.useState)(!1),[Ee,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(0),N=(0,X.useRef)(e?.updatedAt),P=$(y),F=P!==x;(0,X.useEffect)(()=>{if(!e||e.updatedAt===N.current)return;N.current=e.updatedAt;let t=G(e),n=$(t);P===x?(b(t),A(!1)):n!==P&&A(!0),S(n)},[e,P,x]),(0,X.useEffect)(()=>{_&&rt(y)},[_,y]),(0,X.useEffect)(()=>{_&&!y.projectId&&u[0]&&b(e=>e.projectId?e:{...e,projectId:u[0].id})},[_,y.projectId,u]);let I=(0,X.useCallback)((e,t)=>{b(n=>({...n,[e]:t})),pe(e=>Object.keys(e).length?{}:e)},[]),L=(0,X.useMemo)(()=>ke(y),[y]),R={...fe,...E?L.errors:{}},B=e=>R[e],V=g[y.projectId],H=y.hostId||V?.defaultHostId||null,W=H?f[H]:void 0,Me=y.profileId||V?.defaultProfileId||null,Ne=(0,X.useCallback)(e=>m[e]?.title,[m]),Pe=(0,X.useMemo)(()=>Ae(Le(y),{projectName:V?.name,hostName:y.hostId?f[y.hostId]?.name??null:null,profileName:y.profileId?p[y.profileId]?.name??null:null,taskTitle:Ne}),[y,V?.name,f,p,Ne]),K=()=>{requestAnimationFrame(()=>{v.current?.querySelector(`[aria-invalid="true"]`)?.focus()})},q=()=>(D(!0),L.input||K(),L.input),Fe=async()=>{let t=q();if(!t)O.error(`Fix the highlighted fields before saving`);else{he(!0);try{if(_){let e=await ce(`/api/automations`,t);if(!e||typeof e!=`object`||!e.id)throw Error(`The coordinator did not return the new automation`);z.getState().put(e),rt(null),O.success(`Created ${e.name}`),r(Qe(e.id),{replace:!0,state:i.state});return}let n=await re(J(e.id),t);if(n&&typeof n==`object`&&n.id){z.getState().put(n),N.current=n.updatedAt;let e=G(n);b(e),S($(e))}else S(P);A(!1),D(!1),O.success(`Saved ${t.name}`)}catch(e){let t=it(e);pe(t),Object.keys(t).length&&K(),O.error(`Could not save: ${w(e)}. Your changes are kept.`)}finally{he(!1)}}},Ie=async()=>{if(e){ye(!0);try{await ie(J(e.id)),k(!1),O.success(`Deleted ${e.name}`),a(),z.getState().remove(e.id)}catch(e){O.error(`Could not delete: ${w(e)}`)}finally{ye(!1)}}},{busy:Re,run:ze}=Oe(()=>M(e=>e+1)),Be=e?!!Re[e.id]:!1,Y=()=>e&&void ze(e),Ve=()=>{let e=je({projectId:u[0]?.id,timezone:U()});b(e),D(!1),rt(null)},He=_?`New automation`:e.name,Q=(0,Z.jsxs)(Z.Fragment,{children:[!_&&(0,Z.jsx)(h,{icon:(0,Z.jsx)(xe,{className:`size-4`}),busy:Be,onClick:Y,title:F?`Runs the saved version`:void 0,children:`Run now`}),_&&F&&(0,Z.jsx)(h,{variant:`ghost`,icon:(0,Z.jsx)(_e,{className:`size-4`}),onClick:Ve,children:`Discard draft`})]}),We=e=>(0,Z.jsx)(h,{type:`submit`,form:oe,variant:`primary`,busy:me,block:e,icon:(0,Z.jsx)(we,{className:`size-4`}),children:_?`Create automation`:`Save`}),Ke=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ue,{summary:Pe,errorCount:E?Object.keys(L.errors).length:0}),(0,Z.jsx)(Ge,{automationId:e?.id??null,dirty:F,getInput:q,currentKey:JSON.stringify(L.input)}),e&&e.trigger.kind===`webhook`&&(0,Z.jsx)(Je,{automation:e}),e&&(0,Z.jsx)(Xe,{automationId:e.id,refreshKey:j,onRun:Y})]});return(0,Z.jsxs)(`div`,{"data-testid":`automation-editor`,className:`flex w-full min-w-0 flex-col gap-4 px-4 pt-4 md:px-6`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(n,{to:Ze,onClick:Se(a),className:`tap inline-flex items-center gap-1 self-start rounded text-sm text-muted hover:text-text`,children:[(0,Z.jsx)(le,{"aria-hidden":!0,className:`size-4`}),`Automations`]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`min-w-0 text-lg font-semibold break-words`,children:He}),F&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,Z.jsx)(c,{"aria-hidden":!0,className:`size-3.5`}),`Unsaved changes`]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Q,l&&We()]})]})]}),(0,Z.jsx)(se,{subject:`automations`,consequence:`Changes are sent once the coordinator is reachable again.`}),W&&W.connectivity!==`connected`&&(0,Z.jsx)(ae,{compact:!0,hostName:W.name,connectivity:W.connectivity,lastSeenAt:W.lastSeenAt,detail:`Occurrences are still recorded; their tasks wait until the host is reachable.`}),Ee&&(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-start gap-1.5 rounded-md border border-border bg-warning-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(C,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-warning`}),`This automation changed elsewhere. Saving overwrites those changes with yours.`]}),(0,Z.jsxs)(`div`,{className:ne(`grid min-w-0 gap-4`,l?`grid-cols-[minmax(0,1fr)_minmax(320px,400px)] items-start`:`grid-cols-1`),children:[(0,Z.jsxs)(`form`,{id:oe,ref:v,noValidate:!0,"aria-label":He,onSubmit:e=>{e.preventDefault(),Fe()},className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(ot,{draft:y,update:I,err:B,projects:u}),(0,Z.jsx)(lt,{draft:y,update:I,err:B,tasks:m,projectsById:g,savedAutomation:e,segmented:o!==`mobile`}),(0,Z.jsx)(ut,{draft:y,setDraft:b,err:B}),(0,Z.jsx)(dt,{draft:y,update:I,err:B}),(0,Z.jsx)(pt,{draft:y,update:I,err:B,hosts:d,profiles:Object.values(p).sort((e,t)=>e.name.localeCompare(t.name)),defaultHostName:V?.defaultHostId?f[V.defaultHostId]?.name:void 0,defaultProfileName:V?.defaultProfileId?p[V.defaultProfileId]?.name:void 0,selectedProfileMissing:!!Me&&!p[Me]}),(0,Z.jsx)(mt,{draft:y,update:I}),(0,Z.jsx)(ht,{draft:y,update:I,err:B}),(0,Z.jsx)(gt,{draft:y,update:I,err:B,projectChecks:V?.checks}),R.form&&(0,Z.jsx)(de,{children:R.form})]}),(0,Z.jsx)(`aside`,{"aria-label":`Summary, preview and history`,className:`flex min-w-0 flex-col gap-4`,children:Ke})]}),!_&&e&&(0,Z.jsx)(Te,{description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,children:(0,Z.jsx)(h,{variant:`danger`,icon:(0,Z.jsx)(ue,{className:`size-4`}),onClick:()=>k(!0),children:`Delete automation`})}),l?(0,Z.jsx)(`div`,{className:`h-4`}):(0,Z.jsxs)(`div`,{className:`sticky bottom-0 z-10 -mx-4 flex items-center gap-3 border-t border-border bg-surface px-4 py-2 md:-mx-6 md:px-6`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-muted`,children:F?`Unsaved changes`:_?`Not saved yet`:`All changes saved`}),We()]}),(0,Z.jsx)(De,{open:be,onClose:()=>k(!1),title:`Delete ${e?.name??`automation`}?`,description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,confirmLabel:`Delete automation`,confirmIcon:(0,Z.jsx)(ue,{className:`size-4`}),busy:ge,onConfirm:()=>void Ie()})]})}function ot({draft:e,update:t,err:n,projects:r}){return(0,Z.jsxs)(F,{stack:!0,title:`Basics`,children:[(0,Z.jsx)(E,{label:`Name`,error:n(`name`),children:n=>(0,Z.jsx)(M,{...n,value:e.name,onChange:e=>t(`name`,e.target.value),placeholder:`Daily dependency check`,autoComplete:`off`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(E,{label:`Project`,error:n(`projectId`),hint:r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[`No projects yet.`,` `,(0,Z.jsx)(N,{to:`/settings/projects`,children:`Add a project in Settings`}),`.`]}):void 0,children:n=>(0,Z.jsxs)(I,{...n,value:e.projectId,onChange:e=>t(`projectId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a project`}),r.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,Z.jsx)(E,{label:`Status`,hint:`Disabled automations keep their history and can still run manually.`,children:n=>(0,Z.jsx)(L,{...n,checked:e.enabled,onChange:e=>t(`enabled`,e),label:`Enabled`,onText:`Enabled`,offText:`Disabled`,className:`self-start`})})]})]})}var st=[`manual`,`once`,`cron`,`webhook`,`dependency`],ct={manual:`Runs only when you press Run now (or from the CLI).`,once:`Runs a single time at the chosen moment.`,cron:`Runs on a timezone-aware cron schedule.`,webhook:`Runs when an authenticated JSON POST arrives at this automation's webhook URL.`,dependency:`Runs when the chosen task is done.`};function lt({draft:e,update:t,err:n,tasks:r,projectsById:i,savedAutomation:a,segmented:o}){let s=T(e=>e.hydrated),c=e.triggerKind===`cron`?ze(e.cronExpr):null,l=e.triggerKind===`cron`&&!c?Fe(e.cronExpr,e.cronTimezone.trim()||void 0)??`Valid expression (no plain-language description available)`:null,u=(0,X.useMemo)(()=>{try{return Intl.supportedValuesOf?.(`timeZone`)}catch{return}},[]),d=(0,X.useId)(),f=U(),ee=(0,X.useMemo)(()=>Object.values(r).filter(t=>t.state!==`canceled`||t.id===e.dependencyTaskId).sort((e,t)=>e.title.localeCompare(t.title)),[r,e.dependencyTaskId]),te=e.triggerKind===`once`?Me(e.onceAt):``;return(0,Z.jsxs)(F,{stack:!0,title:`Trigger`,description:ct[e.triggerKind],children:[o?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`text-sm font-medium`,children:`Trigger kind`}),(0,Z.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Z.jsx)(P,{label:`Trigger kind`,value:e.triggerKind,onChange:e=>t(`triggerKind`,e),options:st.map(e=>({value:e,label:B[e]}))})})]}):(0,Z.jsx)(E,{label:`Trigger kind`,children:n=>(0,Z.jsx)(I,{...n,value:e.triggerKind,onChange:e=>t(`triggerKind`,e.target.value),children:st.map(e=>(0,Z.jsx)(`option`,{value:e,children:B[e]},e))})}),e.triggerKind===`once`&&(0,Z.jsx)(E,{label:`Run at`,error:n(`onceAt`),hint:`Local time (${f})${te?`; saved as ${te}`:``}.`,children:n=>(0,Z.jsx)(M,{...n,type:`datetime-local`,value:e.onceAt,onChange:e=>t(`onceAt`,e.target.value)})}),e.triggerKind===`cron`&&(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(E,{label:`Cron expression`,error:n(`cronExpr`)??c??void 0,hint:`minute hour day-of-month month day-of-week, e.g. 0 9 * * 1-5`,children:n=>(0,Z.jsx)(M,{...n,"aria-invalid":c?!0:n[`aria-invalid`],value:e.cronExpr,onChange:e=>t(`cronExpr`,e.target.value),className:`font-mono`,autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(E,{label:`Timezone`,error:n(`cronTimezone`),hint:e.cronTimezone.trim()===f?`IANA timezone name; daylight saving is handled.`:(0,Z.jsxs)(N,{onClick:()=>t(`cronTimezone`,f),children:[`Use this device's timezone (`,f,`)`]}),children:n=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M,{...n,list:u?d:void 0,value:e.cronTimezone,onChange:e=>t(`cronTimezone`,e.target.value),autoComplete:`off`,spellCheck:!1,autoCapitalize:`off`}),u&&(0,Z.jsx)(`datalist`,{id:d,children:u.map(e=>(0,Z.jsx)(`option`,{value:e},e))})]})}),l&&(0,Z.jsxs)(`p`,{className:`flex items-start gap-1.5 text-sm sm:col-span-2`,"aria-live":`polite`,"data-testid":`cron-description`,children:[(0,Z.jsx)(D,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-words`,children:l})]})]}),e.triggerKind===`webhook`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Senders POST a JSON body (up to 256 KB) with`,` `,(0,Z.jsx)(`code`,{children:`Authorization: Bearer <token>`}),`. Use the filters below to fire only for matching payloads, and `,(0,Z.jsx)(`code`,{children:`{{payload.<path>}}`}),` to copy payload values into the task.`]}),a?a.trigger.kind===`webhook`?(0,Z.jsxs)(`p`,{children:[`Token:`,` `,a.webhookTokenSet?`set (see Webhook below to rotate)`:`not created yet`]}):(0,Z.jsx)(`p`,{children:`Save to switch this automation to a webhook trigger, then create a token.`}):(0,Z.jsx)(`p`,{children:`Save the automation to create its webhook token and URL.`})]}),e.triggerKind===`dependency`&&(0,Z.jsx)(E,{label:`When this task is done`,error:n(`dependencyTaskId`),hint:`Fires once each time the task enters Done.`,children:n=>(0,Z.jsxs)(I,{...n,value:e.dependencyTaskId,onChange:e=>t(`dependencyTaskId`,e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`Choose a task`}),e.dependencyTaskId&&!r[e.dependencyTaskId]&&(0,Z.jsx)(`option`,{value:e.dependencyTaskId,children:s?`Deleted task`:`Loading task…`}),ee.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.title,i[e.projectId]?` (${i[e.projectId].name})`:``,e.state===`done`?` - done`:``]},e.id))]})})]})}function ut({draft:e,setDraft:t,err:n}){let r=(e,n)=>t(t=>({...t,filters:t.filters.map((t,r)=>r===e?{...t,...n}:t)})),i=e.triggerKind===`webhook`;return(0,Z.jsxs)(F,{stack:!0,title:`Filters`,description:`Filters apply to webhook payloads. Each row compares a dot path (for example pull_request.base.ref) with an exact value; all rows must match. Payloads that do not match are recorded as Filtered out.`,children:[!i&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Filters are ignored unless the trigger is Webhook.`}),e.filters.length===0&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No filters: every payload fires.`}),e.filters.map((e,i)=>(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-end gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,Z.jsx)(E,{label:`Path ${i+1}`,error:n(`filters.${i}.path`),children:t=>(0,Z.jsx)(M,{...t,value:e.path,onChange:e=>r(i,{path:e.target.value}),placeholder:`action`,className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})}),(0,Z.jsx)(E,{label:`Equals ${i+1}`,error:n(`filters.${i}.equals`),className:`col-start-1 row-start-2 sm:col-start-auto sm:row-start-auto`,children:t=>(0,Z.jsx)(M,{...t,value:e.equals,onChange:e=>r(i,{equals:e.target.value}),placeholder:`opened`})}),(0,Z.jsx)(A,{label:`Remove filter ${i+1}`,icon:(0,Z.jsx)(_e,{className:`size-4`}),onClick:()=>t(e=>({...e,filters:e.filters.filter((e,t)=>t!==i)}))})]},i)),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(h,{size:`sm`,icon:(0,Z.jsx)(k,{className:`size-3.5`}),onClick:()=>t(e=>({...e,filters:[...e.filters,{path:``,equals:``}]})),children:`Add filter`})})]})}function dt({draft:e,update:t,err:n}){return(0,Z.jsxs)(F,{stack:!0,title:`Task template`,description:`Use ${W.join(`, `)} in the title, objective, criteria and grouping key.`,children:[(0,Z.jsx)(E,{label:`Task title`,error:n(`title`),children:n=>(0,Z.jsx)(M,{...n,value:e.title,onChange:e=>t(`title`,e.target.value),placeholder:`Triage new issues for {{date}}`})}),(0,Z.jsx)(E,{label:`Objective`,error:n(`objective`),children:n=>(0,Z.jsx)(j,{...n,minRows:4,value:e.objective,onChange:e=>t(`objective`,e.target.value)})}),(0,Z.jsx)(E,{label:`Acceptance criteria`,error:n(`criteria`),hint:`One criterion per line.`,optional:!0,children:n=>(0,Z.jsx)(j,{...n,minRows:3,value:e.criteria,onChange:e=>t(`criteria`,e.target.value)})}),(0,Z.jsx)(E,{label:`Priority`,error:n(`priority`),children:n=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ge,{priority:e.priority}),(0,Z.jsx)(he,{...n,value:e.priority,onChange:e=>t(`priority`,e),className:`sm:max-w-48`})]})})]})}function ft({legend:e,value:t,options:n,onChange:r,hint:i}){let a=(0,X.useId)();return(0,Z.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:e}),(0,Z.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:n.map(e=>(0,Z.jsxs)(`label`,{className:ne(`tap flex min-w-0 cursor-pointer items-start gap-2 rounded-md border p-2.5 text-sm`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-1`,t===e.value?`border-accent bg-accent-soft`:`border-border hover:bg-surface-2`),children:[(0,Z.jsx)(`input`,{type:`radio`,name:a,value:e.value,checked:t===e.value,onChange:()=>r(e.value),className:`mt-0.5 size-4 shrink-0 accent-[var(--color-accent)]`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:e.label}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,children:e.explanation})]})]},e.value))}),i&&(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:i})]})}function pt({draft:e,update:t,err:n,hosts:r,profiles:i,defaultHostName:a,defaultProfileName:o,selectedProfileMissing:s}){return(0,Z.jsxs)(F,{stack:!0,title:`Where and how it runs`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(E,{label:`Host`,error:n(`hostId`),children:n=>(0,Z.jsxs)(I,{...n,value:e.hostId,onChange:e=>t(`hostId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,a?` (${a})`:``]}),e.hostId&&!r.some(t=>t.id===e.hostId)&&(0,Z.jsx)(`option`,{value:e.hostId,children:`Unknown host`}),r.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.name,e.connectivity===`connected`?``:` (${e.connectivity})`]},e.id))]})}),(0,Z.jsx)(E,{label:`Profile`,error:n(`profileId`),hint:s?`The selected profile is no longer available.`:void 0,children:n=>(0,Z.jsxs)(I,{...n,value:e.profileId,onChange:e=>t(`profileId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,o?` (${o})`:``]}),e.profileId&&!i.some(t=>t.id===e.profileId)&&(0,Z.jsx)(`option`,{value:e.profileId,children:`Unknown profile`}),i.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsx)(ft,{legend:`Mode`,value:e.mode,options:Ne,onChange:e=>t(`mode`,e)}),(0,Z.jsx)(E,{label:`Grouping key`,optional:e.mode!==`continue`,error:n(`groupingKey`),hint:`Occurrences with the same rendered key are the same work: Continue reuses that task and overlap checks compare it. Supports template variables, e.g. pr-{{payload.number}}.`,children:n=>(0,Z.jsx)(M,{...n,value:e.groupingKey,onChange:e=>t(`groupingKey`,e.target.value),className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})})]})}function mt({draft:e,update:t}){let n=e.triggerKind===`cron`||e.triggerKind===`once`;return(0,Z.jsxs)(F,{stack:!0,title:`Overlap and missed runs`,children:[(0,Z.jsx)(ft,{legend:`When previous work is still open`,value:e.overlap,options:q,onChange:e=>t(`overlap`,e)}),(0,Z.jsx)(ft,{legend:`Missed runs`,value:e.missed,options:Ie,onChange:e=>t(`missed`,e),hint:n?`A run is missed when the coordinator was down at its scheduled time.`:`Only applies to Schedule and Once triggers.`})]})}function ht({draft:e,update:t,err:n}){return(0,Z.jsxs)(F,{stack:!0,title:`Limits`,description:`Continuation prompts the agent to keep going after a turn ends without finishing. It is off by default.`,children:[(0,Z.jsx)(E,{label:`Automatic continuation`,children:n=>(0,Z.jsx)(L,{...n,checked:e.continuationEnabled,onChange:e=>t(`continuationEnabled`,e),label:`Automatic continuation`,className:`self-start`})}),e.continuationEnabled&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(E,{label:`Continuation objective`,error:n(`continuationObjective`),hint:`What the agent must achieve before it reports done.`,children:n=>(0,Z.jsx)(j,{...n,minRows:2,value:e.continuationObjective,onChange:e=>t(`continuationObjective`,e.target.value)})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(E,{label:`Max continuations`,error:n(`maxContinuations`),hint:`1–50`,children:n=>(0,Z.jsx)(M,{...n,type:`number`,inputMode:`numeric`,min:1,max:50,step:1,value:e.maxContinuations,onChange:e=>t(`maxContinuations`,e.target.value)})}),(0,Z.jsx)(E,{label:`Max elapsed minutes`,error:n(`maxElapsedMinutes`),hint:`1–1440`,children:n=>(0,Z.jsx)(M,{...n,type:`number`,inputMode:`numeric`,min:1,max:1440,step:1,value:e.maxElapsedMinutes,onChange:e=>t(`maxElapsedMinutes`,e.target.value)})}),(0,Z.jsx)(E,{label:`Max tokens`,optional:!0,error:n(`maxTokens`),children:n=>(0,Z.jsx)(M,{...n,type:`number`,inputMode:`numeric`,min:1,step:1,value:e.maxTokens,onChange:e=>t(`maxTokens`,e.target.value)})}),(0,Z.jsx)(E,{label:`Max cost (USD)`,optional:!0,error:n(`maxCostUsd`),children:n=>(0,Z.jsx)(M,{...n,type:`number`,inputMode:`decimal`,min:.01,step:.01,value:e.maxCostUsd,onChange:e=>t(`maxCostUsd`,e.target.value)})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Token and cost limits are enforced only when the provider reports accounting; otherwise the run shows that accounting is unavailable and only the count and time limits apply.`})]})]})}function gt({draft:e,update:t,err:n,projectChecks:r}){let i=r&&r.length>0?`the project's checks (${r.join(`, `)})`:`the project's checks`;return(0,Z.jsxs)(F,{stack:!0,title:`Review`,children:[(0,Z.jsx)(E,{label:`Checks`,optional:!0,error:n(`checks`),hint:`One command per line. Leave empty to use ${i}.`,children:n=>(0,Z.jsx)(j,{...n,minRows:2,value:e.checks,onChange:e=>t(`checks`,e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(E,{label:`Human review`,hint:`When on, finished work waits in Review for you instead of completing on passing checks.`,children:n=>(0,Z.jsx)(L,{...n,checked:e.requireHumanReview,onChange:e=>t(`requireHumanReview`,e),label:`Require human review`,onText:`Required`,offText:`Not required`,className:`self-start`})})]})}export{et as default};
2
- //# sourceMappingURL=AutomationView-BsTwLnMp.js.map
@@ -1,2 +0,0 @@
1
- import{_ as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{_ as i,v as a}from"./states-C773NlHo.js";var o={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};o.node;var s=n(o),c={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};c.node;var l=n(c),u=e(t(),1),d=r();function f(e,t){let n=[t.hint&&`${e}-hint`,t.error&&`${e}-error`].filter(Boolean);return{"aria-describedby":n.length?n.join(` `):void 0,"aria-invalid":t.error?!0:void 0}}function p({id:e,children:t}){return(0,d.jsxs)(`p`,{id:e,className:`flex items-start gap-1 text-xs text-danger`,"data-field-error":!0,children:[(0,d.jsx)(a,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),(0,d.jsx)(`span`,{className:`min-w-0 whitespace-pre-line break-words`,children:t})]})}function m({label:e,hint:t,error:n,optional:r,id:a,className:o,children:s}){let c=(0,u.useId)(),l=a??c;return(0,d.jsxs)(`div`,{className:i(`flex w-full min-w-0 max-w-2xl flex-col gap-1`,o),children:[(0,d.jsxs)(`label`,{htmlFor:l,className:`text-sm font-medium`,children:[e,r&&(0,d.jsx)(`span`,{className:`font-normal text-muted`,children:` (optional)`})]}),typeof s==`function`?s({id:l,...f(l,{hint:!!t,error:n})}):s,t&&(0,d.jsx)(`p`,{id:`${l}-hint`,className:`text-xs text-muted`,children:t}),n&&(0,d.jsx)(p,{id:`${l}-error`,children:n})]})}export{s as a,l as i,p as n,f as r,m as t};
2
- //# sourceMappingURL=Field-Dbg_8KTt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Field-Dbg_8KTt.js","names":["__iconData","useId","__toESM","require_react","require_jsx_runtime","cn","TriangleAlert","__iconData$1","ArrowLeft","createLucideIcon","__iconData","Trash","import_react","import_jsx_runtime","fieldControlProps","ids","opts","id","FieldError","Field","generated","controlId","className","label","optional","children","hint","error"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/arrow-left.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/trash.mjs","../../src/components/ui/Field.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"arrow-left\",\n size: 24,\n node: [\n [\"path\", { d: \"m12 19-7-7 7-7\", key: \"1l729n\" }],\n [\"path\", { d: \"M19 12H5\", key: \"x3x0zl\" }]\n ]\n};\n__iconData.node;\nconst ArrowLeft = createLucideIcon(__iconData);\n\nexport { __iconData, ArrowLeft as default };\n//# sourceMappingURL=arrow-left.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"trash\",\n size: 24,\n node: [\n [\"path\", { d: \"M10 11v6\", key: \"nco0om\" }],\n [\"path\", { d: \"M14 11v6\", key: \"outv1u\" }],\n [\"path\", { d: \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\", key: \"miytrc\" }],\n [\"path\", { d: \"M3 6h18\", key: \"d0wm0j\" }],\n [\"path\", { d: \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\", key: \"e791ji\" }]\n ],\n aliases: [\"trash-2\"]\n};\n__iconData.node;\nconst Trash = createLucideIcon(__iconData);\n\nexport { __iconData, Trash as default };\n//# sourceMappingURL=trash.mjs.map\n","import { TriangleAlert } from \"lucide-react\";\nimport { type ReactElement, type ReactNode, useId } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\n/** Props to spread on the control inside a Field. */\nexport interface FieldControlProps {\n id: string;\n \"aria-invalid\"?: true;\n \"aria-describedby\"?: string;\n}\n\nexport interface FieldProps {\n label: ReactNode;\n hint?: ReactNode;\n error?: string | null;\n /** Appends \" (optional)\" in muted text. */\n optional?: boolean;\n /** Control id; defaults to a generated one. */\n id?: string;\n className?: string;\n /** The control, or a render function that receives the props to spread on it. */\n children: ReactNode | ((p: FieldControlProps) => ReactElement);\n}\n\n/** aria-describedby / aria-invalid props for the control of a Field with this id. */\nexport function fieldControlProps(\n id: string,\n opts: { hint?: boolean; error?: string | null },\n): Omit<FieldControlProps, \"id\"> {\n const ids = [opts.hint && `${id}-hint`, opts.error && `${id}-error`].filter(Boolean);\n return {\n \"aria-describedby\": ids.length ? ids.join(\" \") : undefined,\n \"aria-invalid\": opts.error ? true : undefined,\n };\n}\n\n/** Inline field error with an icon (the icon keeps it from relying on colour). */\nexport function FieldError({ id, children }: { id?: string; children: ReactNode }) {\n return (\n <p id={id} className=\"flex items-start gap-1 text-xs text-danger\" data-field-error>\n <TriangleAlert aria-hidden className=\"mt-0.5 size-3.5 shrink-0\" />\n <span className=\"min-w-0 whitespace-pre-line break-words\">{children}</span>\n </p>\n );\n}\n\n/** Label, control, hint and error. Controls must use the `id` and described-by props. */\nexport function Field({ label, hint, error, optional, id, className, children }: FieldProps) {\n const generated = useId();\n const controlId = id ?? generated;\n return (\n <div className={cn(\"flex w-full min-w-0 max-w-2xl flex-col gap-1\", className)}>\n <label htmlFor={controlId} className=\"text-sm font-medium\">\n {label}\n {optional && <span className=\"font-normal text-muted\"> (optional)</span>}\n </label>\n {typeof children === \"function\"\n ? children({ id: controlId, ...fieldControlProps(controlId, { hint: !!hint, error }) })\n : children}\n {hint && (\n <p id={`${controlId}-hint`} className=\"text-xs text-muted\">\n {hint}\n </p>\n )}\n {error && <FieldError id={`${controlId}-error`}>{error}</FieldError>}\n </div>\n );\n}\n"],"ignoreList":[0,1],"mappings":"A,8GASA,IAAMA,EAAa,CACjB,KAAM,aACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,iBAAkB,IAAK,QAAS,CAAC,EAC/C,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,CAC3C,CACF,EACAA,EAAW,KACX,IAAMQ,EAAYC,EAAiBT,CAAU,ECTvCU,EAA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,QAASQ,EAAW,UAAU,sBAArC,SAAA,CACGE,EACAC,IAAY,EAAAX,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,yBAAyB,SAAA,aAAiB,CAAA,CAClE,C,GACN,OAAOY,GAAa,WACjBA,EAAS,CAAE,GAAIJ,EAAW,GAAGP,EAAkBO,EAAW,CAAE,KAAM,CAAC,CAACK,EAAM,OAAM,CAAC,CAAE,CAAC,EACpFD,EACHC,IACC,EAAAb,EAAA,IAAA,CAAC,IAAD,CAAG,GAAI,GAAGQ,EAAU,OAAQ,UAAU,qBACnC,SAAAK,CACA,CAAA,EAEJC,IAAS,EAAAd,EAAA,IAAA,CAACK,EAAD,CAAY,GAAI,GAAGG,EAAU,QAAU,SAAAM,CAAkB,CAAA,CAChE,C,EAET,C"}
@@ -1,2 +0,0 @@
1
- import{_ as e,m as t,t as n}from"./jsx-runtime-D13aM9HY.js";import{S as r}from"./StatusChip-BYuVxYS7.js";import{_ as i,a,d as o,n as s,yt as c}from"./states-C773NlHo.js";import{a as l}from"./useBreakpoint-BphHBrzF.js";var u=r(),d=e(t(),1),f=n(),p=(0,d.forwardRef)(function({label:e,icon:t,variant:n=`ghost`,size:r=`md`,className:a,type:o,...s},c){return(0,f.jsx)(`button`,{ref:c,type:o??`button`,"aria-label":e,title:e,className:i(`tap inline-flex shrink-0 items-center justify-center rounded-md border transition-colors`,`disabled:opacity-55 disabled:pointer-events-none`,r===`sm`?`size-8`:`size-9`,n===`ghost`&&`border-transparent text-muted hover:bg-surface-2 hover:text-text`,n===`secondary`&&`border-border bg-surface text-text hover:bg-surface-2`,n===`danger`&&`border-transparent text-danger hover:bg-danger-soft`,a),...s,children:t})}),m=`a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]`;function h(e){return[...e.querySelectorAll(m)].filter(e=>!e.hasAttribute(`inert`)&&e.getClientRects().length>0)}function g(e,t,n,r){let i=(0,d.useRef)(n);i.current=n;let a=(0,d.useRef)(null),o=(0,d.useRef)(!1);t&&!o.current&&typeof document<`u`&&(a.current=document.activeElement),o.current=t,(0,d.useEffect)(()=>{if(!t)return;let n=e.current;if(!n)return;let o=a.current,s=o&&!n.contains(o)?o:document.activeElement,c=r?.current??h(n)[0]??n,l=requestAnimationFrame(()=>{(r?.current||!n.contains(document.activeElement))&&c.focus({preventScroll:!0})}),u=e=>{if(e.key===`Escape`&&i.current){e.stopPropagation(),i.current();return}if(e.key!==`Tab`)return;let t=h(n);if(t.length===0){e.preventDefault(),n.focus();return}let r=t[0],a=t[t.length-1],o=document.activeElement;e.shiftKey&&(o===r||!n.contains(o))?(e.preventDefault(),a.focus()):e.shiftKey||o!==a&&n.contains(o)||(e.preventDefault(),r.focus())};return n.addEventListener(`keydown`,u),()=>{cancelAnimationFrame(l),n.removeEventListener(`keydown`,u),s&&document.contains(s)&&s.focus({preventScroll:!0})}},[t,e,r])}function _(e){(0,d.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e])}function v({placement:e,open:t,onClose:n,title:r,description:a,children:o,footer:s,initialFocus:c,dismissOnBackdrop:m=!0,headerActions:h,className:v,flush:y,bodyClassName:b,fullHeight:x,style:S}){let C=(0,d.useRef)(null),w=(0,d.useId)(),T=(0,d.useId)();return g(C,t,n,c),_(t),t?(0,u.createPortal)((0,f.jsxs)(`div`,{className:i(`fixed inset-0 z-50 flex`,e===`right`&&`justify-end`,e===`bottom`&&`items-end`,e===`center`&&`items-center justify-center p-4`),children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-overlay`,"aria-hidden":!0,onClick:m?n:void 0}),(0,f.jsxs)(`div`,{ref:C,role:`dialog`,"aria-modal":`true`,"aria-labelledby":w,"aria-describedby":a?T:void 0,tabIndex:-1,style:S,className:i(`relative flex flex-col bg-surface text-text shadow-pop outline-none`,e===`right`&&`h-full max-w-full border-l border-border safe-pt safe-pb`,e===`bottom`&&(x?`h-dvh w-full safe-pt safe-pb`:`max-h-[90dvh] w-full rounded-t-xl border-t border-border safe-pb`),e===`center`&&`max-h-[min(90dvh,720px)] w-full max-w-lg rounded-xl border border-border`,v),children:[e===`bottom`&&!x&&(0,f.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,f.jsx)(`div`,{className:`h-1 w-10 rounded-full bg-border-strong`})}),(0,f.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-border px-4 py-3`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(`h2`,{id:w,className:`text-base font-semibold leading-6`,children:r}),a&&(0,f.jsx)(`p`,{id:T,className:`text-sm text-muted`,children:a})]}),h,(0,f.jsx)(p,{label:`Close`,icon:(0,f.jsx)(l,{className:`size-4`}),onClick:n})]}),(0,f.jsx)(`div`,{className:i(`min-h-0 flex-1 overflow-y-auto overscroll-contain`,!y&&`px-4 py-3`,b),children:o}),s&&(0,f.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3`,children:s})]})]}),document.body):null}function y({width:e=520,...t}){return(0,f.jsx)(v,{...t,placement:`right`,style:{width:`min(${e}px, 100vw)`}})}function b(e){return(0,f.jsx)(v,{...e,placement:`bottom`})}function x(e){return(0,f.jsx)(v,{...e,placement:`center`})}function S({open:e,onClose:t,title:n,description:r,confirmLabel:i,onConfirm:l,busy:u,error:d,errorTitle:p,danger:m=!0,confirmIcon:h,confirmDisabled:g,disabledReason:_,children:v}){return(0,f.jsx)(x,{open:e,onClose:u?()=>void 0:t,dismissOnBackdrop:!u,title:n,description:r,footer:(0,f.jsxs)(f.Fragment,{children:[g&&_&&(0,f.jsx)(`p`,{className:`mr-auto min-w-0 flex-1 basis-full text-xs text-muted sm:basis-auto`,children:_}),(0,f.jsx)(o,{onClick:t,disabled:u,children:`Cancel`}),(0,f.jsx)(o,{variant:m?`danger`:`primary`,icon:h,busy:u,disabled:g,onClick:l,children:i})]}),children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v,p?!!d&&(0,f.jsx)(s,{compact:!0,title:p,error:c(d)}):(0,f.jsx)(a,{error:d})]})})}export{g as a,b as i,x as n,p as o,y as r,S as t};
2
- //# sourceMappingURL=Overlay-BNPvMjLX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Overlay-BNPvMjLX.js","names":["forwardRef","useRef","useRef","useId","createPortal","_Fragment","__toESM","require_react","require_jsx_runtime","require_react_dom","cn","Button","ErrorState","errorMessage","X","import_react_dom","import_react","import_jsx_runtime","IconButton","rest","type","label","size","variant","className","icon","FOCUSABLE","focusableWithin","root","el","useFocusTrap","escRef","onEscape","triggerRef","wasActive","active","ref","captured","previous","target","initialFocus","raf","onKey","items","first","last","activeEl","useScrollLock","prev","Surface","titleId","descId","open","onClose","placement","dismissOnBackdrop","description","fullHeight","title","headerActions","flush","bodyClassName","footer","Drawer","props","width","Sheet","Dialog","ConfirmDialog","busy","confirmDisabled","disabledReason","danger","confirmIcon","onConfirm","confirmLabel","children","errorTitle","error","InlineError"],"sources":["../../src/components/ui/IconButton.tsx","../../src/components/ui/useFocusTrap.ts","../../src/components/ui/Overlay.tsx"],"sourcesContent":["import { type ButtonHTMLAttributes, forwardRef, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"aria-label\"> {\n /** Accessible name (also the tooltip). Required: icon-only controls need a label. */\n label: string;\n icon: ReactNode;\n variant?: \"ghost\" | \"secondary\" | \"danger\";\n size?: \"sm\" | \"md\";\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { label, icon, variant = \"ghost\", size = \"md\", className, type, ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n aria-label={label}\n title={label}\n className={cn(\n \"tap inline-flex shrink-0 items-center justify-center rounded-md border transition-colors\",\n \"disabled:opacity-55 disabled:pointer-events-none\",\n size === \"sm\" ? \"size-8\" : \"size-9\",\n variant === \"ghost\" && \"border-transparent text-muted hover:bg-surface-2 hover:text-text\",\n variant === \"secondary\" && \"border-border bg-surface text-text hover:bg-surface-2\",\n variant === \"danger\" && \"border-transparent text-danger hover:bg-danger-soft\",\n className,\n )}\n {...rest}\n >\n {icon}\n </button>\n );\n});\n","import { type RefObject, useEffect, useRef } from \"react\";\n\nconst FOCUSABLE =\n 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\nexport function focusableWithin(root: HTMLElement): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (el) => !el.hasAttribute(\"inert\") && el.getClientRects().length > 0,\n );\n}\n\n/**\n * Modal focus management: moves focus into `ref` when `active`, keeps Tab\n * inside it, closes on Escape, and returns focus to the element that had it\n * (the trigger) when deactivated.\n */\nexport function useFocusTrap(\n ref: RefObject<HTMLElement | null>,\n active: boolean,\n onEscape?: () => void,\n initialFocus?: RefObject<HTMLElement | null>,\n): void {\n const escRef = useRef(onEscape);\n escRef.current = onEscape;\n // Remember the trigger while rendering the opening frame: by the time effects run, an\n // `autoFocus` field inside the surface has already taken focus.\n const triggerRef = useRef<HTMLElement | null>(null);\n const wasActive = useRef(false);\n if (active && !wasActive.current && typeof document !== \"undefined\") {\n triggerRef.current = document.activeElement as HTMLElement | null;\n }\n wasActive.current = active;\n useEffect(() => {\n if (!active) return;\n const root = ref.current;\n if (!root) return;\n const captured = triggerRef.current;\n const previous =\n captured && !root.contains(captured)\n ? captured\n : (document.activeElement as HTMLElement | null);\n const target = initialFocus?.current ?? focusableWithin(root)[0] ?? root;\n // Defer so the element is laid out (portals, transitions).\n // An `autoFocus` field inside keeps its focus unless an explicit initial focus was given.\n const raf = requestAnimationFrame(() => {\n if (!initialFocus?.current && root.contains(document.activeElement)) return;\n target.focus({ preventScroll: true });\n });\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && escRef.current) {\n e.stopPropagation();\n escRef.current();\n return;\n }\n if (e.key !== \"Tab\") return;\n const items = focusableWithin(root);\n if (items.length === 0) {\n e.preventDefault();\n root.focus();\n return;\n }\n const first = items[0]!;\n const last = items[items.length - 1]!;\n const activeEl = document.activeElement;\n if (e.shiftKey && (activeEl === first || !root.contains(activeEl))) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && (activeEl === last || !root.contains(activeEl))) {\n e.preventDefault();\n first.focus();\n }\n };\n root.addEventListener(\"keydown\", onKey);\n return () => {\n cancelAnimationFrame(raf);\n root.removeEventListener(\"keydown\", onKey);\n if (previous && document.contains(previous)) previous.focus({ preventScroll: true });\n };\n }, [active, ref, initialFocus]);\n}\n\n/** Lock body scroll while a modal surface is open. */\nexport function useScrollLock(active: boolean): void {\n useEffect(() => {\n if (!active) return;\n const prev = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = prev;\n };\n }, [active]);\n}\n","import { X } from \"lucide-react\";\nimport { type ReactNode, type RefObject, useId, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../lib/cn\";\nimport { errorMessage } from \"../../sync/api\";\nimport { Button } from \"./Button\";\nimport { IconButton } from \"./IconButton\";\nimport { ErrorState, InlineError } from \"./states\";\nimport { useFocusTrap, useScrollLock } from \"./useFocusTrap\";\n\nexport interface OverlayProps {\n open: boolean;\n onClose: () => void;\n /** Visible heading; also the accessible name. */\n title: ReactNode;\n /** Accessible description shown under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Sticky footer (actions). */\n footer?: ReactNode;\n /** Element to focus first (defaults to the first focusable). */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Close when the backdrop is clicked (default true). */\n dismissOnBackdrop?: boolean;\n /** Extra header controls before the close button. */\n headerActions?: ReactNode;\n className?: string;\n /** No padding around the body (for content that draws its own edges). */\n flush?: boolean;\n /** Extra body classes. Additive only: it cannot override the padding, use `flush`. */\n bodyClassName?: string;\n /** Bottom sheet only: fill the viewport height. */\n fullHeight?: boolean;\n}\n\ntype Placement = \"right\" | \"bottom\" | \"center\";\n\nfunction Surface({\n placement,\n open,\n onClose,\n title,\n description,\n children,\n footer,\n initialFocus,\n dismissOnBackdrop = true,\n headerActions,\n className,\n flush,\n bodyClassName,\n fullHeight,\n style,\n}: OverlayProps & { placement: Placement; style?: React.CSSProperties }) {\n const ref = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const descId = useId();\n useFocusTrap(ref, open, onClose, initialFocus);\n useScrollLock(open);\n if (!open) return null;\n return createPortal(\n <div\n className={cn(\n \"fixed inset-0 z-50 flex\",\n placement === \"right\" && \"justify-end\",\n placement === \"bottom\" && \"items-end\",\n placement === \"center\" && \"items-center justify-center p-4\",\n )}\n >\n <div\n className=\"absolute inset-0 bg-overlay\"\n aria-hidden\n onClick={dismissOnBackdrop ? onClose : undefined}\n />\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={description ? descId : undefined}\n tabIndex={-1}\n style={style}\n className={cn(\n \"relative flex flex-col bg-surface text-text shadow-pop outline-none\",\n placement === \"right\" && \"h-full max-w-full border-l border-border safe-pt safe-pb\",\n placement === \"bottom\" &&\n (fullHeight\n ? \"h-dvh w-full safe-pt safe-pb\"\n : \"max-h-[90dvh] w-full rounded-t-xl border-t border-border safe-pb\"),\n placement === \"center\" &&\n \"max-h-[min(90dvh,720px)] w-full max-w-lg rounded-xl border border-border\",\n className,\n )}\n >\n {placement === \"bottom\" && !fullHeight && (\n <div className=\"flex justify-center pt-2\" aria-hidden>\n <div className=\"h-1 w-10 rounded-full bg-border-strong\" />\n </div>\n )}\n <div className=\"flex items-start gap-2 border-b border-border px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <h2 id={titleId} className=\"text-base font-semibold leading-6\">\n {title}\n </h2>\n {description && (\n <p id={descId} className=\"text-sm text-muted\">\n {description}\n </p>\n )}\n </div>\n {headerActions}\n <IconButton label=\"Close\" icon={<X className=\"size-4\" />} onClick={onClose} />\n </div>\n <div\n className={cn(\n \"min-h-0 flex-1 overflow-y-auto overscroll-contain\",\n !flush && \"px-4 py-3\",\n bodyClassName,\n )}\n >\n {children}\n </div>\n {footer && (\n <div className=\"flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3\">\n {footer}\n </div>\n )}\n </div>\n </div>,\n document.body,\n );\n}\n\nexport interface DrawerProps extends OverlayProps {\n /** Width in px (default 520, the task drawer width). Never wider than the viewport. */\n width?: number;\n}\n\n/** Right-side drawer with focus trap, Escape to close, and focus returned to the trigger. */\nexport function Drawer({ width = 520, ...props }: DrawerProps) {\n return <Surface {...props} placement=\"right\" style={{ width: `min(${width}px, 100vw)` }} />;\n}\n\n/** Bottom sheet for mobile; same accessibility behavior as Drawer. */\nexport function Sheet(props: OverlayProps) {\n return <Surface {...props} placement=\"bottom\" />;\n}\n\n/** Centered modal dialog. */\nexport function Dialog(props: OverlayProps) {\n return <Surface {...props} placement=\"center\" />;\n}\n\nexport interface ConfirmDialogProps {\n open: boolean;\n onClose: () => void;\n title: ReactNode;\n description?: ReactNode;\n confirmLabel: string;\n onConfirm: () => void;\n busy?: boolean;\n error?: unknown;\n /** Heading for the error; renders a titled error panel instead of the plain message. */\n errorTitle?: string;\n danger?: boolean;\n /** Icon before the confirm label. */\n confirmIcon?: ReactNode;\n confirmDisabled?: boolean;\n /** Shown next to the actions when the confirm button is disabled. */\n disabledReason?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * Confirmation dialog. Never closes on its own: the caller closes it after the\n * server acknowledges (no optimistic success). It cannot be dismissed while busy.\n */\nexport function ConfirmDialog({\n open,\n onClose,\n title,\n description,\n confirmLabel,\n onConfirm,\n busy,\n error,\n errorTitle,\n danger = true,\n confirmIcon,\n confirmDisabled,\n disabledReason,\n children,\n}: ConfirmDialogProps) {\n return (\n <Dialog\n open={open}\n onClose={busy ? () => undefined : onClose}\n dismissOnBackdrop={!busy}\n title={title}\n description={description}\n footer={\n <>\n {confirmDisabled && disabledReason && (\n <p className=\"mr-auto min-w-0 flex-1 basis-full text-xs text-muted sm:basis-auto\">\n {disabledReason}\n </p>\n )}\n <Button onClick={onClose} disabled={busy}>\n Cancel\n </Button>\n <Button\n variant={danger ? \"danger\" : \"primary\"}\n icon={confirmIcon}\n busy={busy}\n disabled={confirmDisabled}\n onClick={onConfirm}\n >\n {confirmLabel}\n </Button>\n </>\n }\n >\n <div className=\"flex flex-col gap-3\">\n {children}\n {errorTitle ? (\n !!error && <ErrorState compact title={errorTitle} error={errorMessage(error)} />\n ) : (\n <InlineError error={error} />\n )}\n </div>\n </Dialog>\n );\n}\n"],"mappings":"A,qPAYakB,GAAA,EAAalB,EAAAA,WAAAA,CAA+C,SACvE,CAAE,QAAO,OAAM,UAAU,QAAS,OAAO,KAAM,YAAW,OAAM,GAAGmB,GACnE,EACA,CACA,OACE,EAAAF,EAAA,IAAA,CAAC,SAAD,CACO,MACL,KAAMG,GAAQ,SACd,aAAYC,EACZ,MAAOA,EACP,UAAWX,EACT,2FACA,mDACAY,IAAS,KAAO,SAAW,SAC3BC,IAAY,SAAW,mEACvBA,IAAY,aAAe,wDAC3BA,IAAY,UAAY,sDACxBC,CACF,EACA,GAAIL,EAEH,SAAAM,CACK,CAAA,CAEZ,CAAC,EClCKC,EACJ,+MAEF,SAAgBC,EAAgB,EAAkC,CAChE,MAAO,CAAC,GAAGC,EAAK,iBAA8BF,CAAS,CAAC,CAAC,CAAC,OACvD,GAAO,CAACG,EAAG,aAAa,OAAO,GAAKA,EAAG,eAAe,CAAC,CAAC,OAAS,CACpE,CACF,CAOA,SAAgBC,EACd,EACA,EACA,EACA,EACM,CACN,IAAMC,GAAA,EAAS9B,EAAAA,OAAAA,CAAO+B,CAAQ,EAC9B,EAAO,QAAUA,EAGjB,IAAMC,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AIe,EAAO,UAAU,QAAU,CAAA,CACjD,CA0BA,SAAgBI,EAAc,CAC5B,OACA,UACA,QACA,cACA,eACA,YACA,OACA,QACA,aACA,SAAS,GACT,cACA,kBACA,iBACA,YACqB,CACrB,OACE,EAAAnD,EAAA,IAAA,CAACkD,EAAD,CACQ,OACN,QAASE,MAAa,IAAA,GAAYhB,EAClC,kBAAmB,CAACgB,EACb,QACM,cACb,QACE,EAAApD,EAAA,KAAA,CAAAZ,EAAAA,SAAA,CAAA,SAAA,CACGiE,GAAmBC,IAClB,EAAAtD,EAAA,IAAA,CAAC,IAAD,CAAG,UAAU,qEACV,SAAAsD,CACA,CAAA,GAEL,EAAAtD,EAAA,IAAA,CAACN,EAAD,CAAQ,QAAS0C,EAAS,SAAUgB,EAAM,SAAA,QAElC,CAAA,GACR,EAAApD,EAAA,IAAA,CAACN,EAAD,CACE,QAAS6D,EAAS,SAAW,UAC7B,KAAMC,EACA,OACN,SAAUH,EACV,QAASI,EAER,SAAAC,CACK,CAAA,CACR,CAAA,CAAA,EAGJ,UAAA,EAAA1D,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,sBAAf,SAAA,CACG2D,EACAC,EACC,CAAC,CAACC,IAAS,EAAA7D,EAAA,IAAA,CAACL,EAAD,CAAY,QAAA,GAAQ,MAAOiE,EAAY,MAAOhE,EAAaiE,CAAK,CAAI,CAAA,GAE/E,EAAA7D,EAAA,IAAA,CAAC8D,EAAD,CAAoB,OAAQ,CAAA,CAE3B,C,EACC,CAAA,CAEZ,C"}
@@ -1,2 +0,0 @@
1
- import{n as e,t}from"./jsx-runtime-D13aM9HY.js";import{f as n}from"./StatusChip-BYuVxYS7.js";import{_ as r,lt as i}from"./states-C773NlHo.js";import{t as a}from"./arrow-down-C-iLrN8I.js";import{t as o}from"./arrow-up-Dj-VTKx4.js";import{t as s}from"./Select-C9L1HKMm.js";var c={name:`chevrons-up`,size:24,node:[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]};c.node;var l=e(c),u={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};u.node;var d=e(u),f=t(),p={0:{label:i[0],icon:l,tone:`danger`},1:{label:i[1],icon:o,tone:`warning`},2:{label:i[2],icon:d,tone:`neutral`},3:{label:i[3],icon:a,tone:`neutral`}};function m({priority:e,className:t,colored:i=!0}){let a=p[e]??p[2],o=a.icon;return(0,f.jsx)(o,{"aria-hidden":!0,className:r(`shrink-0`,i&&n[a.tone],t??`size-4`)})}function h({priority:e,className:t,suffix:i,muted:a}){let o=p[e]??p[2];return(0,f.jsxs)(`span`,{className:r(`inline-flex items-center gap-1`,a?`text-muted`:n[o.tone],t),children:[(0,f.jsx)(m,{priority:e,className:`size-3.5`}),o.label,i]})}function g({value:e,onChange:t,...n}){return(0,f.jsx)(s,{...n,value:e,onChange:e=>t(Number(e.target.value)),children:i.map((e,t)=>(0,f.jsx)(`option`,{value:t,children:e},e))})}export{h as n,g as r,m as t};
2
- //# sourceMappingURL=Priority-Ca1B2yFr.js.map
@@ -1,2 +0,0 @@
1
- import{h as e,m as t,n,t as r}from"./jsx-runtime-D13aM9HY.js";import{C as i,T as a,_ as o,ct as s,p as c,v as l,w as u,x as d}from"./states-C773NlHo.js";import{c as f,l as p,o as m,u as h}from"./useBreakpoint-BphHBrzF.js";var ee=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.1`})),te=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=ee()})),g={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};g.node;var _=n(g),v={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};v.node;var y=n(v),b={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};b.node;var x=n(b),S={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};S.node;var C=n(S),w={name:`circle-pause`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]],aliases:[`pause-circle`]};w.node;var T=n(w),E={name:`circle-play`,size:24,node:[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`play-circle`]};E.node;var D=n(E),O={name:`circle-slash`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]};O.node;var k=n(O),A={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};A.node;var ne=n(A),j={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};j.node;var M=n(j),N={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};N.node;var P=n(N),F={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};F.node;var I=n(F),L={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};L.node;var R=n(L),z={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};z.node;var B=n(z),V={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};V.node;var H=n(V),U={name:`wifi`,size:24,node:[[`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`}]]};U.node;var W=n(U),G=r(),K={neutral:`bg-surface-2 text-muted border-border`,info:`bg-info-soft text-info border-transparent`,success:`bg-success-soft text-success border-transparent`,warning:`bg-warning-soft text-warning border-transparent`,danger:`bg-danger-soft text-danger border-transparent`,accent:`bg-accent text-accent-fg border-transparent`},re={neutral:`text-muted`,info:`text-info`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,accent:`text-accent`};function q({children:e,tone:t=`neutral`,label:n,className:r}){return(0,G.jsxs)(`span`,{className:o(`inline-flex min-w-5 items-center justify-center rounded-full border px-1.5 text-xs leading-5 font-medium tabular-nums`,K[t],r),title:n,children:[(0,G.jsx)(`span`,{"aria-hidden":n?!0:void 0,children:e}),n&&(0,G.jsx)(`span`,{className:`sr-only`,children:n})]})}function ie({count:e,label:t,tone:n=`danger`,className:r}){return e<=0?null:(0,G.jsx)(q,{tone:n,label:`${e} ${t}`,className:r,children:e>99?`99+`:e})}var J={starting:{label:`Starting…`,icon:R,tone:`info`,spin:!0},idle:{label:`Idle`,icon:C,tone:`neutral`},running:{label:`Running`,icon:_,tone:`info`,pulse:!0},waiting_input:{label:`Needs input`,icon:i,tone:`warning`},interrupted:{label:`Interrupted`,icon:T,tone:`warning`},failed:{label:`Failed`,icon:p,tone:`danger`},stopped:{label:`Stopped`,icon:H,tone:`neutral`}},ae={label:`Ready to review`,icon:M,tone:`success`},Y={backlog:{label:`Backlog`,icon:u,tone:`neutral`},ready:{label:`Ready`,icon:D,tone:`info`},in_progress:{label:`In progress`,icon:R,tone:`info`},review:{label:`Review`,icon:M,tone:`warning`},done:{label:`Done`,icon:h,tone:`success`},canceled:{label:`Canceled`,icon:y,tone:`neutral`}},X={queued:{label:`Queued`,icon:f,tone:`neutral`},dispatching:{label:`Dispatching…`,icon:R,tone:`info`,spin:!0},uncertain:{label:`Awaiting host confirmation`,icon:P,tone:`warning`},running:{label:`Running`,icon:_,tone:`info`,pulse:!0},waiting_input:{label:`Needs input`,icon:i,tone:`warning`},checking:{label:`Running checks`,icon:I,tone:`info`,spin:!1},succeeded:{label:`Succeeded`,icon:h,tone:`success`},failed:{label:`Failed`,icon:p,tone:`danger`},interrupted:{label:`Interrupted`,icon:T,tone:`warning`},canceled:{label:`Canceled`,icon:y,tone:`neutral`}},oe={connected:{label:`Connected`,icon:W,tone:`success`},reconnecting:{label:`Reconnecting…`,icon:d,tone:`warning`,spin:!0},unreachable:{label:`Unreachable`,icon:m,tone:`danger`}},se={connecting:{label:`Connecting…`,icon:R,tone:`info`,spin:!0},live:{label:`Live`,icon:W,tone:`success`},reconnecting:{label:`Reconnecting…`,icon:d,tone:`warning`,spin:!0},offline:{label:`Offline`,icon:ne,tone:`danger`}},ce={pending:{label:`Needs input`,icon:i,tone:`warning`},resolved:{label:`Answered`,icon:h,tone:`success`},expired:{label:`Expired`,icon:P,tone:`neutral`},canceled:{label:`Canceled`,icon:k,tone:`neutral`},unsupported:{label:`Unsupported here`,icon:l,tone:`warning`}},Z={needs_input:{label:`Needs input`,icon:i,tone:`warning`},failed:{label:`Failed`,icon:p,tone:`danger`},ready_for_review:{label:`Ready for review`,icon:M,tone:`info`},unsupported_interaction:{label:`Unsupported interaction`,icon:l,tone:`warning`},host_unreachable:{label:`Host unreachable`,icon:m,tone:`danger`}},le={fired:{label:`Fired`,icon:D,tone:`info`},skipped_overlap:{label:`Skipped (overlap)`,icon:k,tone:`neutral`},skipped_missed:{label:`Skipped (missed)`,icon:k,tone:`neutral`},queued:{label:`Queued`,icon:f,tone:`neutral`},appended:{label:`Appended`,icon:B,tone:`info`},failed:{label:`Failed`,icon:p,tone:`danger`},filtered:{label:`Filtered out`,icon:x,tone:`neutral`}},Q={label:`Unknown`,icon:a,tone:`neutral`};function $(e){switch(e.kind){case`runtime`:return J[e.value]??Q;case`task`:return Y[e.value]??Q;case`run`:return X[e.value]??Q;case`host`:return oe[e.value]??Q;case`connection`:return se[e.value]??Q;case`interaction`:{let t=s.safeParse(e.value);return t.success?ce[t.data]:Q}case`attention`:return Z[e.value]??Q;case`occurrence`:return le[e.value]??Q;case`custom`:return e.status}}function ue(e){let t=$(e),n=t.icon,r=e.size===`sm`;return(0,G.jsxs)(`span`,{"data-status-chip":e.kind,className:o(`inline-flex max-w-full items-center gap-1 rounded-full border font-medium whitespace-nowrap`,r?`px-1.5 text-xs leading-5`:`px-2 text-xs leading-6`,K[t.tone],e.className),children:[t.spin?(0,G.jsx)(c,{className:r?`size-3`:`size-3.5`}):(0,G.jsx)(n,{"aria-hidden":!0,className:o(r?`size-3`:`size-3.5`,`shrink-0`,t.pulse&&`animate-pulse`)}),(0,G.jsx)(`span`,{className:`truncate`,children:e.label??t.label})]})}function de({icon:e,label:t,tone:n=`neutral`,spin:r,className:i}){return(0,G.jsxs)(`span`,{className:o(`inline-flex max-w-full items-center gap-1 rounded-full border px-2 text-xs leading-6 font-medium`,K[n],i),children:[r?(0,G.jsx)(c,{className:`size-3.5`}):(0,G.jsx)(e,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}export{te as S,k as _,X as a,C as b,$ as c,K as d,re as f,M as g,I as h,J as i,q as l,R as m,de as n,ue as o,H as p,ae as r,Y as s,Z as t,ie as u,D as v,x,T as y};
2
- //# sourceMappingURL=StatusChip-BYuVxYS7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StatusChip-BYuVxYS7.js","names":["__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","__iconData","MessageCircleQuestion","__commonJSMin","require_react","require_jsx_runtime","MessageCircleQuestionMark","CircleAlert","cn","InteractionState","Spinner","TriangleAlert","Inbox","RefreshCw","Clock","CircleX","WifiOff","CircleCheck","require_react_dom_production","React","formatProdErrorMessage","url","code","i","noop","Internals","REACT_PORTAL_TYPE","REACT_RECOVERABLE_TYPE","REACT_OPTIMISTIC_KEY","createPortal$1","key","ReactSharedInternals","getCrossOriginStringAs","as","input","reason","container","children","previousTransition","previousUpdatePriority","fn","href","options","crossOrigin","integrity","fetchPriority","form","a","action","initialState","permalink","require_react_dom","checkDCE","err","__iconData$14","Activity","createLucideIcon","__iconData$13","Ban","__iconData$12","CircleDashed","__iconData$11","CircleDot","__iconData$10","CirclePause","__iconData$9","CirclePlay","__iconData$8","CircleSlash","__iconData$7","CloudOff","__iconData$6","Eye","__iconData$5","Hourglass","__iconData$4","ListChecks","__iconData$3","LoaderCircle","__iconData$2","Repeat","__iconData$1","Square","__iconData","Wifi","import_jsx_runtime","TONE_CLASSES","TONE_TEXT","Badge","tone","className","label","CountBadge","count","RUNTIME_STATUS","REVIEW_STATUS","TASK_STATUS","RUN_STATUS","HOST_STATUS","CONNECTION_STATUS","INTERACTION_STATUS","ATTENTION_STATUS","OCCURRENCE_STATUS","FALLBACK","statusInfo","props","s","StatusChip","info","Icon","sm","InlineStatus","spin"],"sources":["../../../../node_modules/.pnpm/react-dom@19.3.1_react@19.3.1/node_modules/react-dom/cjs/react-dom.production.js","../../../../node_modules/.pnpm/react-dom@19.3.1_react@19.3.1/node_modules/react-dom/index.js","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/activity.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/ban.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/circle-dashed.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/circle-dot.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/circle-pause.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/circle-play.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/circle-slash.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/cloud-off.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/eye.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/hourglass.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/list-checks.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/loader-circle.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/repeat.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/square.mjs","../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/wifi.mjs","../../src/components/ui/Badge.tsx","../../src/components/ui/StatusChip.tsx"],"sourcesContent":["/**\n * @license React\n * react-dom.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction formatProdErrorMessage(code) {\n var url = \"https://react.dev/errors/\" + code;\n if (1 < arguments.length) {\n url += \"?args[]=\" + encodeURIComponent(arguments[1]);\n for (var i = 2; i < arguments.length; i++)\n url += \"&args[]=\" + encodeURIComponent(arguments[i]);\n }\n return (\n \"Minified React error #\" +\n code +\n \"; visit \" +\n url +\n \" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.\"\n );\n}\nfunction noop() {}\nvar Internals = {\n d: {\n f: noop,\n r: function () {\n throw Error(formatProdErrorMessage(522));\n },\n D: noop,\n C: noop,\n L: noop,\n m: noop,\n X: noop,\n S: noop,\n M: noop\n },\n p: 0,\n findDOMNode: null\n },\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_RECOVERABLE_TYPE = Symbol.for(\"react.recoverable\"),\n REACT_OPTIMISTIC_KEY = Symbol.for(\"react.optimistic_key\");\nfunction createPortal$1(children, containerInfo, implementation) {\n var key =\n 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;\n return {\n $$typeof: REACT_PORTAL_TYPE,\n key:\n null == key\n ? null\n : key === REACT_OPTIMISTIC_KEY\n ? REACT_OPTIMISTIC_KEY\n : \"\" + key,\n children: children,\n containerInfo: containerInfo,\n implementation: implementation\n };\n}\nvar ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;\nfunction getCrossOriginStringAs(as, input) {\n if (\"font\" === as) return \"\";\n if (\"string\" === typeof input)\n return \"use-credentials\" === input ? input : \"\";\n}\nexports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =\n Internals;\nexports.browser = function (reason) {\n return { $$typeof: REACT_RECOVERABLE_TYPE, _reason: reason };\n};\nexports.createPortal = function (children, container) {\n var key =\n 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;\n if (\n !container ||\n (1 !== container.nodeType &&\n 9 !== container.nodeType &&\n 11 !== container.nodeType)\n )\n throw Error(formatProdErrorMessage(299));\n return createPortal$1(children, container, null, key);\n};\nexports.flushSync = function (fn) {\n var previousTransition = ReactSharedInternals.T,\n previousUpdatePriority = Internals.p;\n try {\n if (((ReactSharedInternals.T = null), (Internals.p = 2), fn)) return fn();\n } finally {\n (ReactSharedInternals.T = previousTransition),\n (Internals.p = previousUpdatePriority),\n Internals.d.f();\n }\n};\nexports.preconnect = function (href, options) {\n \"string\" === typeof href &&\n (options\n ? ((options = options.crossOrigin),\n (options =\n \"string\" === typeof options\n ? \"use-credentials\" === options\n ? options\n : \"\"\n : void 0))\n : (options = null),\n Internals.d.C(href, options));\n};\nexports.prefetchDNS = function (href) {\n \"string\" === typeof href && Internals.d.D(href);\n};\nexports.preinit = function (href, options) {\n if (\"string\" === typeof href && options && \"string\" === typeof options.as) {\n var as = options.as,\n crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),\n integrity =\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n fetchPriority =\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0;\n \"style\" === as\n ? Internals.d.S(\n href,\n \"string\" === typeof options.precedence ? options.precedence : void 0,\n {\n crossOrigin: crossOrigin,\n integrity: integrity,\n fetchPriority: fetchPriority\n }\n )\n : \"script\" === as &&\n Internals.d.X(href, {\n crossOrigin: crossOrigin,\n integrity: integrity,\n fetchPriority: fetchPriority,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0\n });\n }\n};\nexports.preinitModule = function (href, options) {\n if (\"string\" === typeof href)\n if (\"object\" === typeof options && null !== options) {\n if (null == options.as || \"script\" === options.as) {\n var crossOrigin = getCrossOriginStringAs(\n options.as,\n options.crossOrigin\n );\n Internals.d.M(href, {\n crossOrigin: crossOrigin,\n integrity:\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0,\n fetchPriority:\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0\n });\n }\n } else null == options && Internals.d.M(href);\n};\nexports.preload = function (href, options) {\n if (\n \"string\" === typeof href &&\n \"object\" === typeof options &&\n null !== options &&\n \"string\" === typeof options.as\n ) {\n var as = options.as,\n crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);\n Internals.d.L(href, as, {\n crossOrigin: crossOrigin,\n integrity:\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0,\n type: \"string\" === typeof options.type ? options.type : void 0,\n fetchPriority:\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0,\n referrerPolicy:\n \"string\" === typeof options.referrerPolicy\n ? options.referrerPolicy\n : void 0,\n imageSrcSet:\n \"string\" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,\n imageSizes:\n \"string\" === typeof options.imageSizes ? options.imageSizes : void 0,\n media: \"string\" === typeof options.media ? options.media : void 0\n });\n }\n};\nexports.preloadModule = function (href, options) {\n if (\"string\" === typeof href)\n if (options) {\n var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);\n Internals.d.m(href, {\n as:\n \"string\" === typeof options.as && \"script\" !== options.as\n ? options.as\n : void 0,\n crossOrigin: crossOrigin,\n integrity:\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0,\n fetchPriority:\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0\n });\n } else Internals.d.m(href);\n};\nexports.requestFormReset = function (form) {\n Internals.d.r(form);\n};\nexports.unstable_batchedUpdates = function (fn, a) {\n return fn(a);\n};\nexports.useFormState = function (action, initialState, permalink) {\n return ReactSharedInternals.H.useFormState(action, initialState, permalink);\n};\nexports.useFormStatus = function () {\n return ReactSharedInternals.H.useHostTransitionStatus();\n};\nexports.version = \"19.3.1\";\n","'use strict';\n\nfunction checkDCE() {\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\n if (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'\n ) {\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n // This branch is unreachable because this function is only called\n // in production, but the condition is true only in development.\n // Therefore if the branch is still here, dead code elimination wasn't\n // properly applied.\n // Don't change the message. React DevTools relies on it. Also make sure\n // this message doesn't occur elsewhere in this function, or it will cause\n // a false positive.\n throw new Error('^_^');\n }\n try {\n // Verify that the code above has been dead code eliminated (DCE'd).\n __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);\n } catch (err) {\n // DevTools shouldn't crash React, no matter what.\n // We should still report in case we break this code.\n console.error(err);\n }\n}\n\nif (process.env.NODE_ENV === 'production') {\n // DCE check should happen before ReactDOM bundle executes so that\n // DevTools can report bad minification during injection.\n checkDCE();\n module.exports = require('./cjs/react-dom.production.js');\n} else {\n module.exports = require('./cjs/react-dom.development.js');\n}\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"activity\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\",\n key: \"169zse\"\n }\n ]\n ]\n};\n__iconData.node;\nconst Activity = createLucideIcon(__iconData);\n\nexport { __iconData, Activity as default };\n//# sourceMappingURL=activity.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"ban\",\n size: 24,\n node: [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"M4.929 4.929 19.07 19.071\", key: \"196cmz\" }]\n ]\n};\n__iconData.node;\nconst Ban = createLucideIcon(__iconData);\n\nexport { __iconData, Ban as default };\n//# sourceMappingURL=ban.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"circle-dashed\",\n size: 24,\n node: [\n [\"path\", { d: \"M10.1 2.182a10 10 0 0 1 3.8 0\", key: \"5ilxe3\" }],\n [\"path\", { d: \"M13.9 21.818a10 10 0 0 1-3.8 0\", key: \"11zvb9\" }],\n [\"path\", { d: \"M17.609 3.721a10 10 0 0 1 2.69 2.7\", key: \"1iw5b2\" }],\n [\"path\", { d: \"M2.182 13.9a10 10 0 0 1 0-3.8\", key: \"c0bmvh\" }],\n [\"path\", { d: \"M20.279 17.609a10 10 0 0 1-2.7 2.69\", key: \"1ruxm7\" }],\n [\"path\", { d: \"M21.818 10.1a10 10 0 0 1 0 3.8\", key: \"qkgqxc\" }],\n [\"path\", { d: \"M3.721 6.391a10 10 0 0 1 2.7-2.69\", key: \"1mcia2\" }],\n [\"path\", { d: \"M6.391 20.279a10 10 0 0 1-2.69-2.7\", key: \"1fvljs\" }]\n ]\n};\n__iconData.node;\nconst CircleDashed = createLucideIcon(__iconData);\n\nexport { __iconData, CircleDashed as default };\n//# sourceMappingURL=circle-dashed.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"circle-dot\",\n size: 24,\n node: [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"1\", key: \"41hilf\" }],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }]\n ]\n};\n__iconData.node;\nconst CircleDot = createLucideIcon(__iconData);\n\nexport { __iconData, CircleDot as default };\n//# sourceMappingURL=circle-dot.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"circle-pause\",\n size: 24,\n node: [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"line\", { x1: \"10\", x2: \"10\", y1: \"15\", y2: \"9\", key: \"c1nkhi\" }],\n [\"line\", { x1: \"14\", x2: \"14\", y1: \"15\", y2: \"9\", key: \"h65svq\" }]\n ],\n aliases: [\"pause-circle\"]\n};\n__iconData.node;\nconst CirclePause = createLucideIcon(__iconData);\n\nexport { __iconData, CirclePause as default };\n//# sourceMappingURL=circle-pause.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"circle-play\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z\",\n key: \"kmsa83\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }]\n ],\n aliases: [\"play-circle\"]\n};\n__iconData.node;\nconst CirclePlay = createLucideIcon(__iconData);\n\nexport { __iconData, CirclePlay as default };\n//# sourceMappingURL=circle-play.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"circle-slash\",\n size: 24,\n node: [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"line\", { x1: \"9\", x2: \"15\", y1: \"15\", y2: \"9\", key: \"1dfufj\" }]\n ]\n};\n__iconData.node;\nconst CircleSlash = createLucideIcon(__iconData);\n\nexport { __iconData, CircleSlash as default };\n//# sourceMappingURL=circle-slash.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"cloud-off\",\n size: 24,\n node: [\n [\n \"path\",\n { d: \"M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057\", key: \"1uxyv8\" }\n ],\n [\"path\", { d: \"M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78\", key: \"99tcn7\" }],\n [\"path\", { d: \"m2 2 20 20\", key: \"1ooewy\" }]\n ]\n};\n__iconData.node;\nconst CloudOff = createLucideIcon(__iconData);\n\nexport { __iconData, CloudOff as default };\n//# sourceMappingURL=cloud-off.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"eye\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\",\n key: \"1nclc0\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n ]\n};\n__iconData.node;\nconst Eye = createLucideIcon(__iconData);\n\nexport { __iconData, Eye as default };\n//# sourceMappingURL=eye.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"hourglass\",\n size: 24,\n node: [\n [\"path\", { d: \"M5 22h14\", key: \"ehvnwv\" }],\n [\"path\", { d: \"M5 2h14\", key: \"pdyrp9\" }],\n [\n \"path\",\n {\n d: \"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22\",\n key: \"1d314k\"\n }\n ],\n [\n \"path\",\n {\n d: \"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2\",\n key: \"1vvvr6\"\n }\n ]\n ]\n};\n__iconData.node;\nconst Hourglass = createLucideIcon(__iconData);\n\nexport { __iconData, Hourglass as default };\n//# sourceMappingURL=hourglass.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"list-checks\",\n size: 24,\n node: [\n [\"path\", { d: \"M13 5h8\", key: \"a7qcls\" }],\n [\"path\", { d: \"M13 12h8\", key: \"h98zly\" }],\n [\"path\", { d: \"M13 19h8\", key: \"c3s6r1\" }],\n [\"path\", { d: \"m3 17 2 2 4-4\", key: \"1jhpwq\" }],\n [\"path\", { d: \"m3 7 2 2 4-4\", key: \"1obspn\" }]\n ]\n};\n__iconData.node;\nconst ListChecks = createLucideIcon(__iconData);\n\nexport { __iconData, ListChecks as default };\n//# sourceMappingURL=list-checks.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"loader-circle\",\n size: 24,\n node: [[\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\", key: \"13zald\" }]],\n aliases: [\"loader-2\"]\n};\n__iconData.node;\nconst LoaderCircle = createLucideIcon(__iconData);\n\nexport { __iconData, LoaderCircle as default };\n//# sourceMappingURL=loader-circle.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"repeat\",\n size: 24,\n node: [\n [\"path\", { d: \"m17 2 4 4-4 4\", key: \"nntrym\" }],\n [\"path\", { d: \"M3 11v-1a4 4 0 0 1 4-4h14\", key: \"84bu3i\" }],\n [\"path\", { d: \"m7 22-4-4 4-4\", key: \"1wqhfi\" }],\n [\"path\", { d: \"M21 13v1a4 4 0 0 1-4 4H3\", key: \"1rx37r\" }]\n ]\n};\n__iconData.node;\nconst Repeat = createLucideIcon(__iconData);\n\nexport { __iconData, Repeat as default };\n//# sourceMappingURL=repeat.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"square\",\n size: 24,\n node: [[\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }]]\n};\n__iconData.node;\nconst Square = createLucideIcon(__iconData);\n\nexport { __iconData, Square as default };\n//# sourceMappingURL=square.mjs.map\n","/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"wifi\",\n size: 24,\n node: [\n [\"path\", { d: \"M12 20h.01\", key: \"zekei9\" }],\n [\"path\", { d: \"M2 8.82a15 15 0 0 1 20 0\", key: \"dnpr2z\" }],\n [\"path\", { d: \"M5 12.859a10 10 0 0 1 14 0\", key: \"1x1e6c\" }],\n [\"path\", { d: \"M8.5 16.429a5 5 0 0 1 7 0\", key: \"1bycff\" }]\n ]\n};\n__iconData.node;\nconst Wifi = createLucideIcon(__iconData);\n\nexport { __iconData, Wifi as default };\n//# sourceMappingURL=wifi.mjs.map\n","import type { ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport type Tone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"accent\";\n\nexport const TONE_CLASSES: Record<Tone, string> = {\n neutral: \"bg-surface-2 text-muted border-border\",\n info: \"bg-info-soft text-info border-transparent\",\n success: \"bg-success-soft text-success border-transparent\",\n warning: \"bg-warning-soft text-warning border-transparent\",\n danger: \"bg-danger-soft text-danger border-transparent\",\n accent: \"bg-accent text-accent-fg border-transparent\",\n};\n\n/** Text colour for each tone (the Badge classes colour the background too). */\nexport const TONE_TEXT: Record<Tone, string> = {\n neutral: \"text-muted\",\n info: \"text-info\",\n success: \"text-success\",\n warning: \"text-warning\",\n danger: \"text-danger\",\n accent: \"text-accent\",\n};\n\nexport interface BadgeProps {\n children: ReactNode;\n tone?: Tone;\n /** Accessible text when the visible content is terse (e.g. a count). */\n label?: string;\n className?: string;\n}\n\n/** Small pill for counts and tags. */\nexport function Badge({ children, tone = \"neutral\", label, className }: BadgeProps) {\n return (\n <span\n className={cn(\n \"inline-flex min-w-5 items-center justify-center rounded-full border px-1.5 text-xs leading-5 font-medium tabular-nums\",\n TONE_CLASSES[tone],\n className,\n )}\n title={label}\n >\n <span aria-hidden={label ? true : undefined}>{children}</span>\n {label && <span className=\"sr-only\">{label}</span>}\n </span>\n );\n}\n\n/** Count badge; renders nothing at zero. Caps at 99+. */\nexport function CountBadge({\n count,\n label,\n tone = \"danger\",\n className,\n}: {\n count: number;\n label: string;\n tone?: Tone;\n className?: string;\n}) {\n if (count <= 0) return null;\n return (\n <Badge tone={tone} label={`${count} ${label}`} className={className}>\n {count > 99 ? \"99+\" : count}\n </Badge>\n );\n}\n","import type {\n AttentionReason,\n Connectivity,\n OccurrenceState,\n RunState,\n RuntimeState,\n TaskState,\n} from \"@switchyard/protocol\";\nimport { InteractionState } from \"@switchyard/protocol\";\nimport {\n Activity,\n Ban,\n CircleAlert,\n CircleCheck,\n CircleDashed,\n CircleDot,\n CirclePause,\n CirclePlay,\n CircleSlash,\n CircleX,\n Clock,\n CloudOff,\n Eye,\n Hourglass,\n Inbox,\n ListChecks,\n LoaderCircle,\n type LucideIcon,\n MessageCircleQuestion,\n RefreshCw,\n Repeat,\n Square,\n TriangleAlert,\n Wifi,\n WifiOff,\n} from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\nimport type { ConnectionState } from \"../../sync/store\";\nimport { TONE_CLASSES, type Tone } from \"./Badge\";\nimport { Spinner } from \"./Spinner\";\n\n/** A status presentation: always an icon plus a text label (never color alone). */\nexport interface StatusInfo {\n label: string;\n icon: LucideIcon;\n tone: Tone;\n /** Spin the icon (in-flight states). */\n spin?: boolean;\n /** Pulse the icon (ongoing, not transitional). */\n pulse?: boolean;\n}\n\nexport const RUNTIME_STATUS: Record<RuntimeState, StatusInfo> = {\n starting: { label: \"Starting…\", icon: LoaderCircle, tone: \"info\", spin: true },\n idle: { label: \"Idle\", icon: CircleDot, tone: \"neutral\" },\n running: { label: \"Running\", icon: Activity, tone: \"info\", pulse: true },\n waiting_input: { label: \"Needs input\", icon: MessageCircleQuestion, tone: \"warning\" },\n interrupted: { label: \"Interrupted\", icon: CirclePause, tone: \"warning\" },\n failed: { label: \"Failed\", icon: CircleX, tone: \"danger\" },\n stopped: { label: \"Stopped\", icon: Square, tone: \"neutral\" },\n};\n\n/** A finished session nobody has looked at yet. */\nexport const REVIEW_STATUS: StatusInfo = { label: \"Ready to review\", icon: Eye, tone: \"success\" };\n\nexport const TASK_STATUS: Record<TaskState, StatusInfo> = {\n backlog: { label: \"Backlog\", icon: Inbox, tone: \"neutral\" },\n ready: { label: \"Ready\", icon: CirclePlay, tone: \"info\" },\n in_progress: { label: \"In progress\", icon: LoaderCircle, tone: \"info\" },\n review: { label: \"Review\", icon: Eye, tone: \"warning\" },\n done: { label: \"Done\", icon: CircleCheck, tone: \"success\" },\n canceled: { label: \"Canceled\", icon: Ban, tone: \"neutral\" },\n};\n\nexport const RUN_STATUS: Record<RunState, StatusInfo> = {\n queued: { label: \"Queued\", icon: Clock, tone: \"neutral\" },\n dispatching: { label: \"Dispatching…\", icon: LoaderCircle, tone: \"info\", spin: true },\n uncertain: { label: \"Awaiting host confirmation\", icon: Hourglass, tone: \"warning\" },\n running: { label: \"Running\", icon: Activity, tone: \"info\", pulse: true },\n waiting_input: { label: \"Needs input\", icon: MessageCircleQuestion, tone: \"warning\" },\n checking: { label: \"Running checks\", icon: ListChecks, tone: \"info\", spin: false },\n succeeded: { label: \"Succeeded\", icon: CircleCheck, tone: \"success\" },\n failed: { label: \"Failed\", icon: CircleX, tone: \"danger\" },\n interrupted: { label: \"Interrupted\", icon: CirclePause, tone: \"warning\" },\n canceled: { label: \"Canceled\", icon: Ban, tone: \"neutral\" },\n};\n\n/** Host connectivity. */\nexport const HOST_STATUS: Record<Connectivity, StatusInfo> = {\n connected: { label: \"Connected\", icon: Wifi, tone: \"success\" },\n reconnecting: { label: \"Reconnecting…\", icon: RefreshCw, tone: \"warning\", spin: true },\n unreachable: { label: \"Unreachable\", icon: WifiOff, tone: \"danger\" },\n};\n\n/** This client's link to the coordinator. */\nexport const CONNECTION_STATUS: Record<ConnectionState, StatusInfo> = {\n connecting: { label: \"Connecting…\", icon: LoaderCircle, tone: \"info\", spin: true },\n live: { label: \"Live\", icon: Wifi, tone: \"success\" },\n reconnecting: { label: \"Reconnecting…\", icon: RefreshCw, tone: \"warning\", spin: true },\n offline: { label: \"Offline\", icon: CloudOff, tone: \"danger\" },\n};\n\nexport const INTERACTION_STATUS: Record<InteractionState, StatusInfo> = {\n pending: { label: \"Needs input\", icon: MessageCircleQuestion, tone: \"warning\" },\n resolved: { label: \"Answered\", icon: CircleCheck, tone: \"success\" },\n expired: { label: \"Expired\", icon: Hourglass, tone: \"neutral\" },\n canceled: { label: \"Canceled\", icon: CircleSlash, tone: \"neutral\" },\n unsupported: { label: \"Unsupported here\", icon: TriangleAlert, tone: \"warning\" },\n};\n\nexport const ATTENTION_STATUS: Record<AttentionReason, StatusInfo> = {\n needs_input: { label: \"Needs input\", icon: MessageCircleQuestion, tone: \"warning\" },\n failed: { label: \"Failed\", icon: CircleX, tone: \"danger\" },\n ready_for_review: { label: \"Ready for review\", icon: Eye, tone: \"info\" },\n unsupported_interaction: {\n label: \"Unsupported interaction\",\n icon: TriangleAlert,\n tone: \"warning\",\n },\n host_unreachable: { label: \"Host unreachable\", icon: WifiOff, tone: \"danger\" },\n};\n\nexport const OCCURRENCE_STATUS: Record<OccurrenceState, StatusInfo> = {\n fired: { label: \"Fired\", icon: CirclePlay, tone: \"info\" },\n skipped_overlap: { label: \"Skipped (overlap)\", icon: CircleSlash, tone: \"neutral\" },\n skipped_missed: { label: \"Skipped (missed)\", icon: CircleSlash, tone: \"neutral\" },\n queued: { label: \"Queued\", icon: Clock, tone: \"neutral\" },\n appended: { label: \"Appended\", icon: Repeat, tone: \"info\" },\n failed: { label: \"Failed\", icon: CircleX, tone: \"danger\" },\n filtered: { label: \"Filtered out\", icon: CircleDashed, tone: \"neutral\" },\n};\n\nexport type StatusChipProps =\n | { kind: \"runtime\"; value: RuntimeState; label?: string; className?: string; size?: \"sm\" | \"md\" }\n | { kind: \"task\"; value: TaskState; label?: string; className?: string; size?: \"sm\" | \"md\" }\n | { kind: \"run\"; value: RunState; label?: string; className?: string; size?: \"sm\" | \"md\" }\n | { kind: \"host\"; value: Connectivity; label?: string; className?: string; size?: \"sm\" | \"md\" }\n | {\n kind: \"connection\";\n value: ConnectionState;\n label?: string;\n className?: string;\n size?: \"sm\" | \"md\";\n }\n | {\n kind: \"interaction\";\n value: InteractionState;\n label?: string;\n className?: string;\n size?: \"sm\" | \"md\";\n }\n | {\n kind: \"attention\";\n value: AttentionReason;\n label?: string;\n className?: string;\n size?: \"sm\" | \"md\";\n }\n | {\n kind: \"occurrence\";\n value: OccurrenceState;\n label?: string;\n className?: string;\n size?: \"sm\" | \"md\";\n }\n | { kind: \"custom\"; status: StatusInfo; label?: string; className?: string; size?: \"sm\" | \"md\" };\n\nconst FALLBACK: StatusInfo = { label: \"Unknown\", icon: CircleAlert, tone: \"neutral\" };\n\nexport function statusInfo(props: StatusChipProps): StatusInfo {\n switch (props.kind) {\n case \"runtime\":\n return RUNTIME_STATUS[props.value] ?? FALLBACK;\n case \"task\":\n return TASK_STATUS[props.value] ?? FALLBACK;\n case \"run\":\n return RUN_STATUS[props.value] ?? FALLBACK;\n case \"host\":\n return HOST_STATUS[props.value] ?? FALLBACK;\n case \"connection\":\n return CONNECTION_STATUS[props.value] ?? FALLBACK;\n case \"interaction\": {\n // Offline-cache values may still carry the pre-0.9 spelling.\n const s = InteractionState.safeParse(props.value);\n return s.success ? INTERACTION_STATUS[s.data] : FALLBACK;\n }\n case \"attention\":\n return ATTENTION_STATUS[props.value] ?? FALLBACK;\n case \"occurrence\":\n return OCCURRENCE_STATUS[props.value] ?? FALLBACK;\n case \"custom\":\n return props.status;\n }\n}\n\n/** Status pill: icon + text label, tone only reinforces. `label` overrides the text. */\nexport function StatusChip(props: StatusChipProps) {\n const info = statusInfo(props);\n const Icon = info.icon;\n const sm = props.size === \"sm\";\n return (\n <span\n data-status-chip={props.kind}\n className={cn(\n \"inline-flex max-w-full items-center gap-1 rounded-full border font-medium whitespace-nowrap\",\n sm ? \"px-1.5 text-xs leading-5\" : \"px-2 text-xs leading-6\",\n TONE_CLASSES[info.tone],\n props.className,\n )}\n >\n {info.spin ? (\n <Spinner className={sm ? \"size-3\" : \"size-3.5\"} />\n ) : (\n <Icon\n aria-hidden\n className={cn(sm ? \"size-3\" : \"size-3.5\", \"shrink-0\", info.pulse && \"animate-pulse\")}\n />\n )}\n <span className=\"truncate\">{props.label ?? info.label}</span>\n </span>\n );\n}\n\n/** Icon plus text status, the tone only reinforces. */\nexport function InlineStatus({\n icon: Icon,\n label,\n tone = \"neutral\",\n spin,\n className,\n}: {\n icon: LucideIcon;\n label: ReactNode;\n tone?: Tone;\n spin?: boolean;\n className?: string;\n}) {\n return (\n <span\n className={cn(\n \"inline-flex max-w-full items-center gap-1 rounded-full border px-2 text-xs leading-6 font-medium\",\n TONE_CLASSES[tone],\n className,\n )}\n >\n {spin ? <Spinner className=\"size-3.5\" /> : <Icon aria-hidden className=\"size-3.5 shrink-0\" />}\n <span className=\"min-w-0 truncate\">{label}</span>\n </span>\n );\n}\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"mappings":"A,4OAWA,IAAI+B,EAAAf,EAAA,EACJ,SAASgB,EAAuB,EAAM,CACpC,IAAIC,EAAM,4BAA8BC,EACxC,GAAI,EAAI,UAAU,OAAQ,CACxB,GAAO,WAAa,mBAAmB,UAAU,EAAE,EACnD,IAAK,IAAIC,EAAI,EAAGA,EAAI,UAAU,OAAQ,IACpC,GAAO,WAAa,mBAAmB,UAAUA,EAAE,CACvD,CACA,MACE,yBACAD,EACA,WACAD,EACA,gHAEJ,CACA,SAASG,GAAO,CAAC,CACjB,IAAIC,EAAY,CACZ,EAAG,CACD,EAAGD,EACH,EAAG,UAAY,CACb,MAAM,MAAMJ,EAAuB,GAAG,CAAC,CACzC,EACA,EAAGI,EACH,EAAGA,EACH,EAAGA,EACH,EAAGA,EACH,EAAGA,EACH,EAAGA,EACH,EAAGA,CACL,EACA,EAAG,EACH,YAAa,IACf,EACAE,EAAoB,OAAO,IAAI,cAAc,EAC7CC,EAAyB,OAAO,IAAI,mBAAmB,EACvDC,EAAuB,OAAO,IAAI,sBAAsB,EAC1D,SAASC,EAAe,EAAU,EAAe,EAAgB,CAC/D,IAAIC,EACF,EAAI,UAAU,QAAqB,UAAU,KAArB,IAAK,GAAqB,UAAU,GAAK,KACnE,MAAO,CACL,SAAUJ,EACV,IACUI,GAAR,KACI,KACAA,IAAQF,EACNA,EACA,GAAKE,EAC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ACT,mGACA8E,EAAaG,GACbC,CACF,EALF,SAAA,CAOGsB,GAAO,EAAA3B,EAAA,IAAA,CAAC3E,EAAD,CAAS,UAAU,UAAY,CAAA,GAAI,EAAA2E,EAAA,IAAA,CAACwB,EAAD,CAAM,cAAA,GAAY,UAAU,mBAAqB,CAAA,GAC5F,EAAAxB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mBAAoB,SAAAM,CAAY,CAAA,CAC5C,C,EAEV,C"}
@@ -1,2 +0,0 @@
1
- import{_ as e,i as t,m as n,n as r,t as i}from"./jsx-runtime-D13aM9HY.js";import{g as a,o,t as s}from"./StatusChip-BYuVxYS7.js";import{b as c,c as l,d as u,f as d,gt as f,h as p,i as m,j as h,n as g,s as _,t as v,u as y,vt as b,yt as x,z as S}from"./states-C773NlHo.js";import{t as C}from"./bell-DSwa2PAb.js";import{i as w,u as T}from"./useBreakpoint-BphHBrzF.js";import{t as E}from"./external-link-3jjTxo92.js";import{n as D,t as O}from"./InteractionCard-Yu5wgLC3.js";import{t as k}from"./server-BqZ-w6M8.js";import{c as A,y as j}from"./index-BHGZTS2e.js";import{t as M}from"./SegmentedControl-D2d-NEr-.js";import{r as N}from"./useResource-BBqCoY2q.js";var P={name:`list-todo`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]};P.node;var F=r(P),I=e(n(),1),L=[`needs_input`,`failed`,`ready_for_review`,`unsupported_interaction`,`host_unreachable`];function R(e){let t=Object.fromEntries(L.map(e=>[e,[]]));for(let n of e)t[n.reason]?.push(n);return t}function z(e){return e===`dismissed`||e===`history`?e:`open`}function B(e,t){return t===`history`?[]:e.filter(e=>t===`open`?!e.acknowledgedAt:!!e.acknowledgedAt)}function V(e,t,n){return[e?.name,t?.title,n&&n.title!==t?.title?n.title:null].filter(Boolean).join(` · `)||`Switchyard`}function H(e){let t=N(e?`attention-history`:null,e=>f(`/api/attention`,{resolvedOnly:`true`,limit:200},e),{refreshMs:3e4,check:Array.isArray}),n=S(e=>e.attention),r=(0,I.useRef)(!0),{reload:i}=t;return(0,I.useEffect)(()=>{if(r.current){r.current=!1;return}if(!e)return;let t=setTimeout(i,500);return()=>clearTimeout(t)},[n,e,i]),t}var U=i(),W={needs_input:`Questions from Pi waiting for your answer.`,failed:`Runs that failed or were blocked. Open the task to see why.`,ready_for_review:`Finished runs waiting for your review.`,unsupported_interaction:`Questions this client cannot display. Answer them in a terminal attached to the session.`,host_unreachable:`Running work on hosts that stopped responding. Nothing is restarted elsewhere.`};function G(){let e=h(),t=S(e=>e.hydrated),[n,r]=j(`attentionShow`,`open`),i=z(n),a=e=>r(e),o=(0,I.useMemo)(()=>B(e,i),[e,i]),u=(0,I.useMemo)(()=>B(e,`dismissed`).length,[e]),d=(0,I.useMemo)(()=>R(o),[o]),f=H(i===`history`);return(0,U.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-4 px-4 pb-4 safe-pt-4 md:px-6`,children:[(0,U.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,U.jsx)(`h1`,{className:`flex-1 text-lg font-semibold`,children:`Attention`}),(0,U.jsx)(M,{label:`Show`,className:`max-sm:w-full max-sm:basis-full`,value:i,onChange:a,options:[{value:`open`,label:`Open`},{value:`dismissed`,label:`Dismissed`},{value:`history`,label:`History`}]})]}),(0,U.jsx)(_,{subject:`attention items`,consequence:`Answers are sent once the connection is back.`,show:t}),i===`history`?(0,U.jsx)(`div`,{"data-testid":`attention-history`,className:`flex min-w-0 flex-col gap-2`,children:!f.data&&f.loading?(0,U.jsx)(l,{label:`Loading history…`}):!f.data&&f.error?(0,U.jsx)(g,{compact:!0,title:`Could not load history`,error:x(f.error),onRetry:f.reload}):!f.data||f.data.length===0?(0,U.jsx)(v,{icon:(0,U.jsx)(c,{className:`size-8`}),title:`No history yet`,description:`Resolved questions, failures and reviews show up here.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:f.data.map(e=>(0,U.jsx)(`li`,{className:`min-w-0`,children:(0,U.jsx)(q,{item:e})},e.id))}),f.data.length>=200&&(0,U.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Showing the `,200,` most recent.`]})]})}):t?o.length===0?i===`dismissed`?(0,U.jsx)(v,{icon:(0,U.jsx)(C,{className:`size-8`}),title:`No dismissed items`,description:`Items you dismiss stay here until their question or task is resolved.`,action:{label:`Show open`,onClick:()=>a(`open`)}}):(0,U.jsx)(v,{icon:(0,U.jsx)(C,{className:`size-8`}),title:u>0?`All caught up`:`Nothing needs your attention`,description:u>0?`${u} dismissed ${u===1?`item is`:`items are`} still open.`:`Questions, failures and finished work show up here.`,action:u>0?{label:`Show dismissed`,onClick:()=>a(`dismissed`)}:{label:`Go to Sessions`,to:A.code},secondaryAction:u>0?{label:`Go to Sessions`,to:A.code}:{label:`Go to Board`,to:A.board}}):L.filter(e=>d[e].length>0).map(e=>{let t=s[e],n=t.icon;return(0,U.jsxs)(`section`,{"data-testid":`attention-group-${e}`,"aria-labelledby":`att-${e}`,className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h2`,{id:`att-${e}`,className:`flex items-center gap-2 text-base font-semibold`,children:[(0,U.jsx)(n,{"aria-hidden":!0,className:`size-4 text-muted`}),t.label,(0,U.jsxs)(`span`,{className:`text-sm font-normal text-muted`,children:[`(`,d[e].length,`)`]})]}),(0,U.jsx)(`p`,{className:`text-sm text-muted`,children:W[e]})]}),(0,U.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:d[e].map(e=>(0,U.jsx)(`li`,{className:`min-w-0`,children:(0,U.jsx)(K,{item:e})},e.id))})]},e)}):(0,U.jsx)(l,{label:`Loading attention…`})]})}function K({item:e}){let n=S(t=>e.projectId?t.projects[e.projectId]:void 0),r=S(t=>e.taskId?t.tasks[e.taskId]:void 0),i=S(t=>e.sessionId?t.sessions[e.sessionId]:void 0),c=S(e=>i?e.hosts[i.hostId]:void 0),l=S(t=>e.interactionId?t.interactions[e.interactionId]:void 0),[f,h]=(0,I.useState)(!1),[_,v]=(0,I.useState)(null),C=async()=>{h(!0),v(null);try{let t=await b(`/api/attention/${encodeURIComponent(e.id)}/acknowledge`),n=t&&typeof t==`object`&&`id`in t?t:{...e,acknowledgedAt:new Date().toISOString()};S.setState(t=>t.attention[e.id]?{attention:{...t.attention,[e.id]:n}}:{}),w.success(`Dismissed. It stays under All until the task or question is resolved.`)}catch(e){v(e)}finally{h(!1)}},j=e.sessionId?e.interactionId?A.interaction(e.sessionId,e.interactionId):A.session(e.sessionId):null,M=!!c&&c.connectivity!==`connected`,N=null;switch(e.reason){case`needs_input`:N=l&&l.state===`pending`?(0,U.jsx)(O,{flush:!0,interaction:l,readOnlyReason:M?`Host ${c?.name} is offline. You can answer once it reconnects.`:i?.readOnly?`This session is read-only.`:null}):l?(0,U.jsx)(O,{flush:!0,interaction:l}):j?(0,U.jsxs)(t,{to:j,className:d(`primary`,`sm`),children:[(0,U.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}),`Answer in session`]}):null;break;case`failed`:N=e.taskId?(0,U.jsxs)(t,{to:A.task(e.taskId),className:d(`primary`,`sm`),children:[(0,U.jsx)(F,{"aria-hidden":!0,className:`size-3.5`}),`Open task`]}):null;break;case`ready_for_review`:N=e.sessionId?(0,U.jsxs)(t,{to:`${A.session(e.sessionId)}?tab=changes`,className:d(`primary`,`sm`),children:[(0,U.jsx)(a,{"aria-hidden":!0,className:`size-3.5`}),`Review changes`]}):e.taskId?(0,U.jsxs)(t,{to:A.task(e.taskId),className:d(`primary`,`sm`),children:[(0,U.jsx)(a,{"aria-hidden":!0,className:`size-3.5`}),`Open review`]}):null;break;case`unsupported_interaction`:N=l?(0,U.jsx)(O,{interaction:l,readOnlyReason:M?`Host ${c?.name} is offline. You can choose once it reconnects.`:i?.readOnly?`This session is read-only.`:null}):(0,U.jsx)(y,{capability:`This dialog`,reason:`An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.`});break;case`host_unreachable`:N=c?(0,U.jsx)(m,{compact:!0,hostName:c.name,connectivity:c.connectivity===`reconnecting`?`reconnecting`:`unreachable`,lastSeenAt:c.lastSeenAt}):null}let P=V(n,r,i),L=!!l&&(e.reason===`needs_input`||e.reason===`unsupported_interaction`);return e.reason===`needs_input`&&l?.state===`pending`&&D(l.presentation)?(0,U.jsxs)(`article`,{"aria-label":`Plan awaiting approval: ${P}`,className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0 basis-full truncate sm:basis-auto sm:flex-1`,children:P}),j&&(0,U.jsxs)(t,{to:j,className:d(`ghost`,`sm`),children:[(0,U.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]}),(0,U.jsx)(`time`,{dateTime:e.createdAt,className:`shrink-0 text-xs text-subtle sm:ml-auto`,children:p(e.createdAt)}),!e.acknowledgedAt&&(0,U.jsx)(u,{size:`sm`,variant:`ghost`,busy:f,onClick:()=>void C(),children:`Dismiss`})]}),N,_!==null&&(0,U.jsx)(g,{compact:!0,title:`Could not dismiss`,error:x(_),onRetry:()=>void C()})]}):(0,U.jsxs)(`article`,{"aria-label":`${s[e.reason].label}: ${r?.title??i?.title??e.summary}`,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(o,{kind:`attention`,value:e.reason,size:`sm`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted`,children:P}),(0,U.jsx)(`time`,{dateTime:e.createdAt,className:`shrink-0 text-xs text-subtle`,children:p(e.createdAt)})]}),!L&&(0,U.jsx)(`p`,{className:`min-w-0 text-sm break-words`,children:e.summary}),N&&(0,U.jsx)(`div`,{className:`flex min-w-0 flex-col items-start`,children:N}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.reason!==`failed`&&e.taskId&&(0,U.jsxs)(t,{to:A.task(e.taskId),className:d(`ghost`,`sm`),children:[(0,U.jsx)(F,{"aria-hidden":!0,className:`size-3.5`}),`Task`]}),j&&(0,U.jsxs)(t,{to:j,className:d(`ghost`,`sm`),children:[(0,U.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]}),e.reason===`host_unreachable`&&c&&(0,U.jsxs)(t,{to:`${A.settings(`hosts`)}/${encodeURIComponent(c.id)}`,className:d(`ghost`,`sm`),children:[(0,U.jsx)(k,{"aria-hidden":!0,className:`size-3.5`}),`Host details`]}),(0,U.jsx)(`span`,{className:`ml-auto`}),e.acknowledgedAt?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,U.jsx)(T,{"aria-hidden":!0,className:`size-3.5`}),`Dismissed `,p(e.acknowledgedAt)]}):(0,U.jsx)(u,{size:`sm`,busy:f,onClick:()=>void C(),children:`Dismiss`})]}),_!==null&&(0,U.jsx)(g,{compact:!0,title:`Could not dismiss`,error:x(_),onRetry:()=>void C()})]})}function q({item:e}){let n=S(t=>e.projectId?t.projects[e.projectId]:void 0),r=S(t=>e.taskId?t.tasks[e.taskId]:void 0),i=S(t=>e.sessionId?t.sessions[e.sessionId]:void 0);return(0,U.jsxs)(`article`,{"aria-label":`${s[e.reason].label}: ${r?.title??i?.title??e.summary}`,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(o,{kind:`attention`,value:e.reason,size:`sm`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted`,children:V(n,r,i)}),e.resolvedAt&&(0,U.jsxs)(`time`,{dateTime:e.resolvedAt,className:`shrink-0 text-xs text-subtle`,children:[`Resolved `,p(e.resolvedAt)]})]}),(0,U.jsx)(`p`,{className:`min-w-0 text-sm break-words`,children:e.summary}),(e.taskId||e.sessionId)&&(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.taskId&&(0,U.jsxs)(t,{to:A.task(e.taskId),className:d(`ghost`,`sm`),children:[(0,U.jsx)(F,{"aria-hidden":!0,className:`size-3.5`}),`Task`]}),e.sessionId&&(0,U.jsxs)(t,{to:A.session(e.sessionId),className:d(`ghost`,`sm`),children:[(0,U.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]})]})]})}export{G as default};
2
- //# sourceMappingURL=attention-CI4dHY81.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attention-CI4dHY81.js","names":["useRef","useMemo","History","_Fragment","useState","__toESM","Link","require_react","createLucideIcon","require_jsx_runtime","Eye","ATTENTION_STATUS","RotateCcwClock","LoadingState","Button","buttonClasses","apiGet","formatRelative","HostUnavailable","useOpenAttention","ErrorState","LastKnownNote","EmptyState","UnsupportedCapability","apiPost","errorMessage","useSyncStore","Bell","toast","CircleCheck","ExternalLink","isDocumentPresentation","InteractionCard","Server","ROUTES","useFilter","SegmentedControl","useResource","__iconData","ListTodo","import_react","ATTENTION_GROUPS","groupAttention","out","r","a","items","normalizeShow","v","visibleAttention","show","all","attentionMeta","project","task","session","useAttentionHistory","res","enabled","signal","attention","s","first","reload","import_jsx_runtime","GROUP_HINT","AttentionView","hydrated","stored","setStored","setShow","dismissedCount","groups","history","HistoryRow","info","reason","Icon","AttentionRow","item","host","interaction","busy","setBusy","ackError","setAckError","acknowledge","next","sessionHref","hostOffline","action","metaText","showsCard","StatusChip"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/list-todo.mjs","../../src/features/attention/logic.ts","../../src/features/attention/useAttentionHistory.ts","../../src/features/attention/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"list-todo\",\n size: 24,\n node: [\n [\"path\", { d: \"M13 5h8\", key: \"a7qcls\" }],\n [\"path\", { d: \"M13 12h8\", key: \"h98zly\" }],\n [\"path\", { d: \"M13 19h8\", key: \"c3s6r1\" }],\n [\"path\", { d: \"m3 17 2 2 4-4\", key: \"1jhpwq\" }],\n [\"rect\", { x: \"3\", y: \"4\", width: \"6\", height: \"6\", rx: \"1\", key: \"cif1o7\" }]\n ]\n};\n__iconData.node;\nconst ListTodo = createLucideIcon(__iconData);\n\nexport { __iconData, ListTodo as default };\n//# sourceMappingURL=list-todo.mjs.map\n","import type { AttentionItem, AttentionReason, Project, Session, Task } from \"@switchyard/protocol\";\n\nexport const ATTENTION_GROUPS: AttentionReason[] = [\n \"needs_input\",\n \"failed\",\n \"ready_for_review\",\n \"unsupported_interaction\",\n \"host_unreachable\",\n];\n\n/** Group open attention by reason, keeping the input order within a group. */\nexport function groupAttention(items: AttentionItem[]): Record<AttentionReason, AttentionItem[]> {\n const out = Object.fromEntries(ATTENTION_GROUPS.map((r) => [r, [] as AttentionItem[]])) as Record<\n AttentionReason,\n AttentionItem[]\n >;\n for (const a of items) out[a.reason]?.push(a);\n return out;\n}\n\nexport type AttentionShow = \"open\" | \"dismissed\" | \"history\";\n\n/** Stored prefs from before History: \"all\" (open + dismissed) and unknown values read as \"open\". */\nexport function normalizeShow(v: unknown): AttentionShow {\n return v === \"dismissed\" || v === \"history\" ? v : \"open\";\n}\n\n/** Unacknowledged items for \"open\", acknowledged for \"dismissed\"; [] for \"history\". */\nexport function visibleAttention(all: AttentionItem[], show: AttentionShow): AttentionItem[] {\n if (show === \"history\") return [];\n return all.filter((a) => (show === \"open\" ? !a.acknowledgedAt : !!a.acknowledgedAt));\n}\n\n/** \"project · task · session\" (session only when its title differs from the task's), else \"Switchyard\". */\nexport function attentionMeta(project?: Project, task?: Task, session?: Session): string {\n return (\n [project?.name, task?.title, session && session.title !== task?.title ? session.title : null]\n .filter(Boolean)\n .join(\" · \") || \"Switchyard\"\n );\n}\n","import type { AttentionItem } from \"@switchyard/protocol\";\nimport { useEffect, useRef } from \"react\";\nimport { type Resource, useResource } from \"../../lib/useResource\";\nimport { apiGet } from \"../../sync/api\";\nimport { useSyncStore } from \"../../sync/store\";\n\nexport const HISTORY_LIMIT = 200;\n\n/**\n * Resolved attention items, newest first. The sync store drops resolved items, so they come\n * from the API; refetched when open attention changes (debounced) and every 30 s.\n */\nexport function useAttentionHistory(enabled: boolean): Resource<AttentionItem[]> {\n const res = useResource<AttentionItem[]>(\n enabled ? \"attention-history\" : null,\n (signal) =>\n apiGet<AttentionItem[]>(\n \"/api/attention\",\n { resolvedOnly: \"true\", limit: HISTORY_LIMIT },\n signal,\n ),\n { refreshMs: 30_000, check: Array.isArray },\n );\n const attention = useSyncStore((s) => s.attention);\n const first = useRef(true);\n const { reload } = res;\n // biome-ignore lint/correctness/useExhaustiveDependencies: refetch on attention changes\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n if (!enabled) return;\n const t = setTimeout(reload, 500);\n return () => clearTimeout(t);\n }, [attention, enabled, reload]);\n return res;\n}\n","import type { AttentionItem, AttentionReason } from \"@switchyard/protocol\";\nimport { Bell, CircleCheck, ExternalLink, Eye, History, ListTodo, Server } from \"lucide-react\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\nimport { ROUTES } from \"../../app/routes\";\nimport { InteractionCard, isDocumentPresentation } from \"../../components/intent/InteractionCard\";\nimport { Button, buttonClasses } from \"../../components/ui/Button\";\nimport { SegmentedControl } from \"../../components/ui/SegmentedControl\";\nimport { ATTENTION_STATUS, StatusChip } from \"../../components/ui/StatusChip\";\nimport {\n EmptyState,\n ErrorState,\n HostUnavailable,\n LastKnownNote,\n LoadingState,\n UnsupportedCapability,\n} from \"../../components/ui/states\";\nimport { toast } from \"../../components/ui/Toast\";\nimport { formatRelative } from \"../../lib/time\";\nimport { useFilter } from \"../../prefs\";\nimport { apiPost, errorMessage } from \"../../sync/api\";\nimport { useOpenAttention, useSyncStore } from \"../../sync/store\";\nimport {\n ATTENTION_GROUPS,\n type AttentionShow,\n attentionMeta,\n groupAttention,\n normalizeShow,\n visibleAttention,\n} from \"./logic\";\nimport { HISTORY_LIMIT, useAttentionHistory } from \"./useAttentionHistory\";\n\nconst GROUP_HINT: Record<AttentionReason, string> = {\n needs_input: \"Questions from Pi waiting for your answer.\",\n failed: \"Runs that failed or were blocked. Open the task to see why.\",\n ready_for_review: \"Finished runs waiting for your review.\",\n unsupported_interaction:\n \"Questions this client cannot display. Answer them in a terminal attached to the session.\",\n host_unreachable:\n \"Running work on hosts that stopped responding. Nothing is restarted elsewhere.\",\n};\n\n/** /attention: Needs input, Failed, Ready for review (plus unsupported and unreachable). */\nexport default function AttentionView() {\n const all = useOpenAttention();\n const hydrated = useSyncStore((s) => s.hydrated);\n const [stored, setStored] = useFilter<AttentionShow | \"all\">(\"attentionShow\", \"open\");\n const show = normalizeShow(stored);\n const setShow = (v: AttentionShow) => setStored(v);\n const items = useMemo(() => visibleAttention(all, show), [all, show]);\n const dismissedCount = useMemo(() => visibleAttention(all, \"dismissed\").length, [all]);\n const groups = useMemo(() => groupAttention(items), [items]);\n const history = useAttentionHistory(show === \"history\");\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-4 px-4 pb-4 safe-pt-4 md:px-6\">\n <header className=\"flex min-w-0 flex-wrap items-center gap-3\">\n <h1 className=\"flex-1 text-lg font-semibold\">Attention</h1>\n <SegmentedControl\n label=\"Show\"\n className=\"max-sm:w-full max-sm:basis-full\"\n value={show}\n onChange={setShow}\n options={[\n { value: \"open\", label: \"Open\" },\n { value: \"dismissed\", label: \"Dismissed\" },\n { value: \"history\", label: \"History\" },\n ]}\n />\n </header>\n <LastKnownNote\n subject=\"attention items\"\n consequence=\"Answers are sent once the connection is back.\"\n show={hydrated}\n />\n {show === \"history\" ? (\n <div data-testid=\"attention-history\" className=\"flex min-w-0 flex-col gap-2\">\n {!history.data && history.loading ? (\n <LoadingState label=\"Loading history…\" />\n ) : !history.data && history.error ? (\n <ErrorState\n compact\n title=\"Could not load history\"\n error={errorMessage(history.error)}\n onRetry={history.reload}\n />\n ) : !history.data || history.data.length === 0 ? (\n <EmptyState\n icon={<History className=\"size-8\" />}\n title=\"No history yet\"\n description=\"Resolved questions, failures and reviews show up here.\"\n />\n ) : (\n <>\n <ul className=\"flex min-w-0 flex-col gap-2\">\n {history.data.map((a) => (\n <li key={a.id} className=\"min-w-0\">\n <HistoryRow item={a} />\n </li>\n ))}\n </ul>\n {history.data.length >= HISTORY_LIMIT && (\n <p className=\"text-sm text-muted\">Showing the {HISTORY_LIMIT} most recent.</p>\n )}\n </>\n )}\n </div>\n ) : !hydrated ? (\n <LoadingState label=\"Loading attention…\" />\n ) : items.length === 0 ? (\n show === \"dismissed\" ? (\n <EmptyState\n icon={<Bell className=\"size-8\" />}\n title=\"No dismissed items\"\n description=\"Items you dismiss stay here until their question or task is resolved.\"\n action={{ label: \"Show open\", onClick: () => setShow(\"open\") }}\n />\n ) : (\n <EmptyState\n icon={<Bell className=\"size-8\" />}\n title={dismissedCount > 0 ? \"All caught up\" : \"Nothing needs your attention\"}\n description={\n dismissedCount > 0\n ? `${dismissedCount} dismissed ${dismissedCount === 1 ? \"item is\" : \"items are\"} still open.`\n : \"Questions, failures and finished work show up here.\"\n }\n action={\n dismissedCount > 0\n ? { label: \"Show dismissed\", onClick: () => setShow(\"dismissed\") }\n : { label: \"Go to Sessions\", to: ROUTES.code }\n }\n secondaryAction={\n dismissedCount > 0\n ? { label: \"Go to Sessions\", to: ROUTES.code }\n : { label: \"Go to Board\", to: ROUTES.board }\n }\n />\n )\n ) : (\n ATTENTION_GROUPS.filter((r) => groups[r].length > 0).map((reason) => {\n const info = ATTENTION_STATUS[reason];\n const Icon = info.icon;\n return (\n <section\n key={reason}\n data-testid={`attention-group-${reason}`}\n aria-labelledby={`att-${reason}`}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <div>\n <h2\n id={`att-${reason}`}\n className=\"flex items-center gap-2 text-base font-semibold\"\n >\n <Icon aria-hidden className=\"size-4 text-muted\" />\n {info.label}\n <span className=\"text-sm font-normal text-muted\">({groups[reason].length})</span>\n </h2>\n <p className=\"text-sm text-muted\">{GROUP_HINT[reason]}</p>\n </div>\n <ul className=\"flex min-w-0 flex-col gap-2\">\n {groups[reason].map((a) => (\n <li key={a.id} className=\"min-w-0\">\n <AttentionRow item={a} />\n </li>\n ))}\n </ul>\n </section>\n );\n })\n )}\n </div>\n );\n}\n\nfunction AttentionRow({ item }: { item: AttentionItem }) {\n const project = useSyncStore((s) => (item.projectId ? s.projects[item.projectId] : undefined));\n const task = useSyncStore((s) => (item.taskId ? s.tasks[item.taskId] : undefined));\n const session = useSyncStore((s) => (item.sessionId ? s.sessions[item.sessionId] : undefined));\n const host = useSyncStore((s) => (session ? s.hosts[session.hostId] : undefined));\n const interaction = useSyncStore((s) =>\n item.interactionId ? s.interactions[item.interactionId] : undefined,\n );\n const [busy, setBusy] = useState(false);\n const [ackError, setAckError] = useState<unknown>(null);\n\n const acknowledge = async () => {\n setBusy(true);\n setAckError(null);\n try {\n const res = await apiPost<AttentionItem>(\n `/api/attention/${encodeURIComponent(item.id)}/acknowledge`,\n );\n const next =\n res && typeof res === \"object\" && \"id\" in res\n ? res\n : { ...item, acknowledgedAt: new Date().toISOString() };\n useSyncStore.setState((s) =>\n s.attention[item.id] ? { attention: { ...s.attention, [item.id]: next } } : {},\n );\n toast.success(\"Dismissed. It stays under All until the task or question is resolved.\");\n } catch (e) {\n setAckError(e);\n } finally {\n setBusy(false);\n }\n };\n\n const sessionHref = item.sessionId\n ? item.interactionId\n ? ROUTES.interaction(item.sessionId, item.interactionId)\n : ROUTES.session(item.sessionId)\n : null;\n const hostOffline = !!host && host.connectivity !== \"connected\";\n\n let action: React.ReactNode = null;\n switch (item.reason) {\n case \"needs_input\":\n action =\n interaction && interaction.state === \"pending\" ? (\n <InteractionCard\n flush\n interaction={interaction}\n readOnlyReason={\n hostOffline\n ? `Host ${host?.name} is offline. You can answer once it reconnects.`\n : session?.readOnly\n ? \"This session is read-only.\"\n : null\n }\n />\n ) : interaction ? (\n <InteractionCard flush interaction={interaction} />\n ) : sessionHref ? (\n <Link to={sessionHref} className={buttonClasses(\"primary\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Answer in session\n </Link>\n ) : null;\n break;\n case \"failed\":\n action = item.taskId ? (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"primary\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Open task\n </Link>\n ) : null;\n break;\n case \"ready_for_review\":\n action = item.sessionId ? (\n <Link\n to={`${ROUTES.session(item.sessionId)}?tab=changes`}\n className={buttonClasses(\"primary\", \"sm\")}\n >\n <Eye aria-hidden className=\"size-3.5\" />\n Review changes\n </Link>\n ) : item.taskId ? (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"primary\", \"sm\")}>\n <Eye aria-hidden className=\"size-3.5\" />\n Open review\n </Link>\n ) : null;\n break;\n case \"unsupported_interaction\":\n action = interaction ? (\n <InteractionCard\n interaction={interaction}\n readOnlyReason={\n hostOffline\n ? `Host ${host?.name} is offline. You can choose once it reconnects.`\n : session?.readOnly\n ? \"This session is read-only.\"\n : null\n }\n />\n ) : (\n <UnsupportedCapability\n capability=\"This dialog\"\n reason=\"An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.\"\n />\n );\n break;\n case \"host_unreachable\":\n action = host ? (\n <HostUnavailable\n compact\n hostName={host.name}\n connectivity={host.connectivity === \"reconnecting\" ? \"reconnecting\" : \"unreachable\"}\n lastSeenAt={host.lastSeenAt}\n />\n ) : null;\n break;\n }\n\n const metaText = attentionMeta(project, task, session);\n\n const showsCard =\n !!interaction && (item.reason === \"needs_input\" || item.reason === \"unsupported_interaction\");\n\n // A plan awaiting approval gets the whole width: one meta line, no card around it.\n if (\n item.reason === \"needs_input\" &&\n interaction?.state === \"pending\" &&\n isDocumentPresentation(interaction.presentation)\n ) {\n return (\n <article\n aria-label={`Plan awaiting approval: ${metaText}`}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted\">\n <span className=\"min-w-0 basis-full truncate sm:basis-auto sm:flex-1\">{metaText}</span>\n {sessionHref && (\n <Link to={sessionHref} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n <time dateTime={item.createdAt} className=\"shrink-0 text-xs text-subtle sm:ml-auto\">\n {formatRelative(item.createdAt)}\n </time>\n {!item.acknowledgedAt && (\n <Button size=\"sm\" variant=\"ghost\" busy={busy} onClick={() => void acknowledge()}>\n Dismiss\n </Button>\n )}\n </div>\n {action}\n {ackError !== null && (\n <ErrorState\n compact\n title=\"Could not dismiss\"\n error={errorMessage(ackError)}\n onRetry={() => void acknowledge()}\n />\n )}\n </article>\n );\n }\n\n return (\n <article\n aria-label={`${ATTENTION_STATUS[item.reason].label}: ${task?.title ?? session?.title ?? item.summary}`}\n className=\"flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n <StatusChip kind=\"attention\" value={item.reason} size=\"sm\" />\n <span className=\"min-w-0 flex-1 truncate text-xs text-muted\">{metaText}</span>\n <time dateTime={item.createdAt} className=\"shrink-0 text-xs text-subtle\">\n {formatRelative(item.createdAt)}\n </time>\n </div>\n {!showsCard && <p className=\"min-w-0 text-sm break-words\">{item.summary}</p>}\n {action && <div className=\"flex min-w-0 flex-col items-start\">{action}</div>}\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n {item.reason !== \"failed\" && item.taskId && (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"ghost\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Task\n </Link>\n )}\n {sessionHref && (\n <Link to={sessionHref} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n {item.reason === \"host_unreachable\" && host && (\n <Link\n to={`${ROUTES.settings(\"hosts\")}/${encodeURIComponent(host.id)}`}\n className={buttonClasses(\"ghost\", \"sm\")}\n >\n <Server aria-hidden className=\"size-3.5\" />\n Host details\n </Link>\n )}\n <span className=\"ml-auto\" />\n {item.acknowledgedAt ? (\n <span className=\"inline-flex items-center gap-1 text-xs text-muted\">\n <CircleCheck aria-hidden className=\"size-3.5\" />\n Dismissed {formatRelative(item.acknowledgedAt)}\n </span>\n ) : (\n <Button size=\"sm\" busy={busy} onClick={() => void acknowledge()}>\n Dismiss\n </Button>\n )}\n </div>\n {ackError !== null && (\n <ErrorState\n compact\n title=\"Could not dismiss\"\n error={errorMessage(ackError)}\n onRetry={() => void acknowledge()}\n />\n )}\n </article>\n );\n}\n\nfunction HistoryRow({ item }: { item: AttentionItem }) {\n const project = useSyncStore((s) => (item.projectId ? s.projects[item.projectId] : undefined));\n const task = useSyncStore((s) => (item.taskId ? s.tasks[item.taskId] : undefined));\n const session = useSyncStore((s) => (item.sessionId ? s.sessions[item.sessionId] : undefined));\n return (\n <article\n aria-label={`${ATTENTION_STATUS[item.reason].label}: ${task?.title ?? session?.title ?? item.summary}`}\n className=\"flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n <StatusChip kind=\"attention\" value={item.reason} size=\"sm\" />\n <span className=\"min-w-0 flex-1 truncate text-xs text-muted\">\n {attentionMeta(project, task, session)}\n </span>\n {item.resolvedAt && (\n <time dateTime={item.resolvedAt} className=\"shrink-0 text-xs text-subtle\">\n Resolved {formatRelative(item.resolvedAt)}\n </time>\n )}\n </div>\n <p className=\"min-w-0 text-sm break-words\">{item.summary}</p>\n {(item.taskId || item.sessionId) && (\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n {item.taskId && (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"ghost\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Task\n </Link>\n )}\n {item.sessionId && (\n <Link to={ROUTES.session(item.sessionId)} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n </div>\n )}\n </article>\n );\n}\n"],"ignoreList":[0],"mappings":"A,8oBASA,IAAMsC,EAAa,CACjB,KAAM,YACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,UAAW,IAAK,QAAS,CAAC,EACxC,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,gBAAiB,IAAK,QAAS,CAAC,EAC9C,CAAC,OAAQ,CAAE,EAAG,IAAK,EAAG,IAAK,MAAO,IAAK,OAAQ,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,CAC9E,CACF,EACAA,EAAW,KACX,IAAMC,EAAW/B,EAAiB8B,CAAU,E,WCnB/BG,EAAsC,CACjD,cACA,SACA,mBACA,0BACA,kBACF,EAGA,SAAgBC,EAAe,EAAkE,CAC/F,IAAMC,EAAM,OAAO,YAAYF,EAAiB,IAAK,GAAM,CAACG,EAAG,CAAC,CAAoB,CAAC,CAAC,EAItF,IAAK,IAAMC,KAAKC,EAAOH,EAAIE,EAAE,OAAO,EAAE,KAAKA,CAAC,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M,GAAI4B,EAAO,QAAQ6C,EAAK,SAAS,EAAG,UAAWhE,EAAc,QAAS,IAAI,EAAhF,SAAA,EACE,EAAAiD,EAAA,IAAA,CAAClC,EAAD,CAAc,cAAA,GAAY,UAAU,UAAY,CAAA,EAAC,cAE7C,CAEL,CAAA,CAAA,C,EAEA,C,EAEb,C"}
@@ -1,2 +0,0 @@
1
- import{D as e,H as t,St as n,gt as r,pt as i,xt as a}from"./states-C773NlHo.js";import{t as o}from"./presence-05bJD5G3.js";var s=`switchyard`,c=`kv`,l=`sync`,u=`sy:sync-cache`,d=null;function f(){return d||(d=new Promise(e=>{if(typeof indexedDB>`u`)return e(null);try{let t=indexedDB.open(s,1);t.onupgradeneeded=()=>t.result.createObjectStore(c),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}catch{e(null)}}),d)}function p(e,t){return f().then(n=>new Promise((r,i)=>{if(!n)return i(Error(`no indexeddb`));let a=t(n.transaction(c,e).objectStore(c));a.onsuccess=()=>r(a.result),a.onerror=()=>i(a.error)}))}async function m(){try{let e=await p(`readonly`,e=>e.get(l));if(e)return e}catch{}try{let e=localStorage.getItem(u);return e?JSON.parse(e):null}catch{return null}}async function h(e){try{await p(`readwrite`,t=>t.put(e,l));return}catch{}try{localStorage.setItem(u,JSON.stringify(e))}catch{}}async function g(){try{await p(`readwrite`,e=>e.delete(l))}catch{}try{localStorage.removeItem(u)}catch{}}var _=25e3,v=1e4,y=1e3,b=3e4,x=1500,S=1e4,C=5e3,w=class{url;ws=null;stopped=!0;everLive=!1;attempts=0;retryTimer=null;pingTimer=null;pongTimer=null;persistTimer=null;connectTimer=null;lastFrameAt=0;unsubscribeStore=null;liveListeners=new Set;logoutListeners=new Set;cacheLoaded=null;constructor(e=T()){this.url=e}start(){this.stopped&&(this.stopped=!1,window.addEventListener(`online`,this.onOnline),window.addEventListener(`offline`,this.onOffline),document.addEventListener(`visibilitychange`,this.onVisibility),window.addEventListener(`pageshow`,this.onForeground),window.addEventListener(`focus`,this.onForeground),this.unsubscribeStore=e.subscribe((e,t)=>{e.synced&&e.seq!==t.seq&&this.schedulePersist()}),this.cacheLoaded??=m().then(t=>{t&&!e.getState().synced&&e.getState().hydrateFromCache(t.seq,t.state,t.savedAt)}),this.cacheLoaded.then(()=>this.connect()))}stop(){this.stopped=!0,window.removeEventListener(`online`,this.onOnline),window.removeEventListener(`offline`,this.onOffline),document.removeEventListener(`visibilitychange`,this.onVisibility),window.removeEventListener(`pageshow`,this.onForeground),window.removeEventListener(`focus`,this.onForeground),this.unsubscribeStore?.(),this.unsubscribeStore=null,this.clearTimers();let e=this.ws;this.ws=null,e?.close(1e3,`client stopped`)}send(e){return this.ws?.readyState===WebSocket.OPEN&&(this.ws.send(JSON.stringify(e)),!0)}get isLive(){return e.getState().connection.state===`live`}onLive(e){return this.liveListeners.add(e),()=>this.liveListeners.delete(e)}onLogout(e){return this.logoutListeners.add(e),()=>this.logoutListeners.delete(e)}reconnectNow(){this.stopped||(this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=null,!(this.ws&&this.ws.readyState<=WebSocket.OPEN)&&this.connect())}connect(){if(this.stopped)return;if(typeof navigator<`u`&&navigator.onLine===!1){e.getState().setConnection({state:`offline`});return}e.getState().setConnection({state:this.everLive?`reconnecting`:`connecting`});let t;try{t=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=t,this.connectTimer&&clearTimeout(this.connectTimer);let n=S*Math.min(1+this.attempts,3);this.connectTimer=setTimeout(()=>{this.connectTimer=null,this.ws===t&&this.dropSocket(4e3,`connect timeout`)},n);let r=!1;t.onopen=()=>{if(this.ws!==t)return;r=!0;let n=e.getState().seq;t.send(JSON.stringify({type:`hello`,cursor:n}))},t.onmessage=e=>{if(this.ws!==t)return;this.lastFrameAt=Date.now();let n;try{n=JSON.parse(typeof e.data==`string`?e.data:``)}catch{return}this.handle(n)},t.onclose=e=>{this.ws===t&&(this.ws=null,this.clearTimers(),!this.stopped&&(e.code===4401||e.code===4403||e.code===1008?this.emitLogout(e.reason||`unauthorized`):(!r&&this.attempts%5==0&&this.probeAuth(),this.scheduleReconnect())))},t.onerror=()=>{}}probing=!1;probeAuth(){this.probing||(this.probing=!0,r(`/api/me`).catch(()=>void 0).finally(()=>{this.probing=!1}))}handle(t){let n=e.getState();switch(t.type){case`snapshot`:n.applySnapshot(t.seq,t.state),this.becomeLive();break;case`replay`:n.applyReplay(t.seq,t.events),this.becomeLive();break;case`event`:n.applyEvent(t.event);break;case`stream`:n.applyStream(t.delta);break;case`pong`:this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=null,n.markSynced();break;case`force_logout`:this.emitLogout(t.reason)}}becomeLive(){this.connectTimer&&clearTimeout(this.connectTimer),this.connectTimer=null,this.everLive=!0,this.attempts=0,e.getState().setConnection({state:`live`,attempts:0}),this.startPing(),this.schedulePersist();for(let e of this.liveListeners)e()}emitLogout(t){this.stop(),g(),e.getState().reset();for(let e of this.logoutListeners)e(t)}startPing(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=setInterval(()=>{this.send({type:`ping`})&&(this.pongTimer||this.armPongTimeout(v))},_)}armPongTimeout(e){this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=setTimeout(()=>{this.pongTimer=null,this.dropSocket(4e3,`pong timeout`)},e)}dropSocket(e,t){let n=this.ws;if(n){this.ws=null,this.clearTimers();try{n.close(e,t)}catch{}this.scheduleReconnect()}}scheduleReconnect(){if(this.stopped)return;if(typeof navigator<`u`&&navigator.onLine===!1){e.getState().setConnection({state:`offline`});return}this.attempts++;let t=Math.min(b,y*2**(this.attempts-1)),n=t/2+t/2*Math.random();e.getState().setConnection({state:this.everLive?`reconnecting`:`connecting`,attempts:this.attempts}),this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.connect()},n)}schedulePersist(){this.persistTimer||=setTimeout(()=>{this.persistTimer=null;let n=e.getState();n.synced&&n.seq!==null&&h({seq:n.seq,state:t(n),savedAt:new Date().toISOString()})},x)}clearTimers(){this.retryTimer&&clearTimeout(this.retryTimer),this.pingTimer&&clearInterval(this.pingTimer),this.pongTimer&&clearTimeout(this.pongTimer),this.connectTimer&&clearTimeout(this.connectTimer),this.connectTimer=null,this.retryTimer=null,this.pingTimer=null,this.pongTimer=null}onOnline=()=>{this.attempts=0,this.reconnectNow()};onVisibility=()=>{document.visibilityState===`visible`&&this.onForeground()};onForeground=()=>{if(!(this.stopped||document.visibilityState===`hidden`)){if(this.isLive){if(Date.now()-this.lastFrameAt<5e3)return;this.send({type:`ping`})&&this.armPongTimeout(C)}else this.attempts=0,this.reconnectNow()}};onOffline=()=>{e.getState().setConnection({state:`offline`}),this.ws?.close(4e3,`offline`)}};function T(){return`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}/ws/client`}var E=new w(typeof location>`u`?``:T()),D=n()(()=>({status:`checking`,me:null,error:null,signedOutReason:null})),O=`sy:me`,k=`sy:returnTo`,A=null;function j(){E.start(),A??=o(E)}function M(){E.stop(),A?.(),A=null}function N(){return D.getState().me?.device?.id??null}async function P(){D.setState({status:`checking`,error:null});try{let e=await r(`/api/me`);try{localStorage.setItem(O,JSON.stringify(e))}catch{}return D.setState({status:`authenticated`,me:e,signedOutReason:null}),j(),`authenticated`}catch(e){if(e instanceof i&&(e.status===401||e.code===`device_revoked`))return I(e.code===`device_revoked`?`This device was revoked.`:null),`unauthenticated`;let t=F();return t?(D.setState({status:`authenticated`,me:t}),j(),`authenticated`):(D.setState({status:`error`,error:e}),`error`)}}function F(){try{let e=localStorage.getItem(O),t=e?JSON.parse(e):null;return t?.device?.id?t:null}catch{return null}}function I(t){M(),g(),e.getState().reset();try{localStorage.removeItem(O)}catch{}D.setState({status:`unauthenticated`,me:null,signedOutReason:t})}function L(e){if(!(e.startsWith(`/sign-in`)||e.startsWith(`/enroll`)))try{localStorage.setItem(k,e)}catch{}}function R(e){let t=null;try{t=localStorage.getItem(k),localStorage.removeItem(k)}catch{}let n=e??t;return n?.startsWith(`/`)&&!n.startsWith(`//`)&&!n.startsWith(`/sign-in`)&&!n.startsWith(`/enroll`)?n:`/`}var z=!1;function B(){z||(z=!0,a(e=>{D.getState().status===`authenticated`&&I(e===`device_revoked`?`This device was revoked.`:null)}),E.onLogout(e=>{I(e===`unauthorized`?null:`Signed out: ${e}`)}))}export{I as a,E as c,L as i,N as n,R as o,B as r,D as s,P as t};
2
- //# sourceMappingURL=auth-308hUVgi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-308hUVgi.js","names":["syncStore","toSyncState","create","apiGet","ApiClientError","onUnauthorized","startPresence","DB_NAME","STORE","KEY","LS_KEY","dbPromise","openDb","resolve","req","idb","db","reject","fn","mode","loadCache","v","s","raw","saveCache","value","clearCache","PING_INTERVAL_MS","PONG_TIMEOUT_MS","BACKOFF_BASE_MS","BACKOFF_MAX_MS","PERSIST_DELAY_MS","CONNECT_TIMEOUT_MS","RESUME_PONG_TIMEOUT_MS","SyncClient","defaultWsUrl","url","prev","cached","ws","msg","timeoutMs","opened","cursor","ev","store","reason","ms","code","delay","jittered","syncClient","useAuth","ME_KEY","RETURN_KEY","stopPresence","startSync","stopSync","currentDeviceId","checkAuth","me","signOut","readCachedMe","saveReturnTo","takeReturnTo","saved","candidate","fromQuery","wired","initAuth"],"sources":["../../src/sync/cache.ts","../../src/sync/client.ts","../../src/app/auth.ts"],"sourcesContent":["import type { SyncState } from \"@switchyard/protocol\";\n\n/**\n * Offline cache of the last synced state and its cursor, so the UI shows\n * last-known data while reconnecting and the WS resumes with `hello {cursor}`.\n * IndexedDB when available, localStorage otherwise.\n */\n\nexport interface CachedSync {\n seq: number;\n state: SyncState;\n savedAt: string;\n}\n\nconst DB_NAME = \"switchyard\";\nconst STORE = \"kv\";\nconst KEY = \"sync\";\nconst LS_KEY = \"sy:sync-cache\";\n\nlet dbPromise: Promise<IDBDatabase | null> | null = null;\n\nfunction openDb(): Promise<IDBDatabase | null> {\n if (dbPromise) return dbPromise;\n dbPromise = new Promise((resolve) => {\n if (typeof indexedDB === \"undefined\") return resolve(null);\n try {\n const req = indexedDB.open(DB_NAME, 1);\n req.onupgradeneeded = () => req.result.createObjectStore(STORE);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => resolve(null);\n req.onblocked = () => resolve(null);\n } catch {\n resolve(null);\n }\n });\n return dbPromise;\n}\n\nfunction idb<T>(mode: IDBTransactionMode, fn: (s: IDBObjectStore) => IDBRequest<T>): Promise<T> {\n return openDb().then(\n (db) =>\n new Promise<T>((resolve, reject) => {\n if (!db) return reject(new Error(\"no indexeddb\"));\n const tx = db.transaction(STORE, mode);\n const req = fn(tx.objectStore(STORE));\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n }),\n );\n}\n\nexport async function loadCache(): Promise<CachedSync | null> {\n try {\n const v = await idb<CachedSync | undefined>(\"readonly\", (s) => s.get(KEY));\n if (v) return v;\n } catch {\n // fall through to localStorage\n }\n try {\n const raw = localStorage.getItem(LS_KEY);\n return raw ? (JSON.parse(raw) as CachedSync) : null;\n } catch {\n return null;\n }\n}\n\nexport async function saveCache(value: CachedSync): Promise<void> {\n try {\n await idb(\"readwrite\", (s) => s.put(value, KEY));\n return;\n } catch {\n // fall through\n }\n try {\n localStorage.setItem(LS_KEY, JSON.stringify(value));\n } catch {\n // quota exceeded: the cache is best effort\n }\n}\n\nexport async function clearCache(): Promise<void> {\n try {\n await idb(\"readwrite\", (s) => s.delete(KEY));\n } catch {\n // ignore\n }\n try {\n localStorage.removeItem(LS_KEY);\n } catch {\n // ignore\n }\n}\n","import type { ClientToServer, ServerToClient } from \"@switchyard/protocol\";\nimport { apiGet } from \"./api\";\nimport { clearCache, loadCache, saveCache } from \"./cache\";\nimport { toSyncState } from \"./reduce\";\nimport { syncStore } from \"./store\";\n\n/**\n * Live sync over `/ws/client`.\n *\n * - On open: `hello {cursor}` with the last applied seq (from memory or the\n * offline cache); the server answers `replay` (events since cursor) or\n * `snapshot` (full SyncState).\n * - Then applies `event` and `stream` frames to the store.\n * - Reconnects with exponential backoff and jitter; `offline` while the\n * browser reports no network.\n * - Probes the link when the page returns to the foreground (a backgrounded phone often\n * holds a dead socket) and gives up on a socket that opens but never syncs.\n * - Persists `{seq, state}` (throttled) so last-known data shows on reload\n * and while reconnecting.\n */\n\nconst PING_INTERVAL_MS = 25_000;\nconst PONG_TIMEOUT_MS = 10_000;\nconst BACKOFF_BASE_MS = 1_000;\nconst BACKOFF_MAX_MS = 30_000;\nconst PERSIST_DELAY_MS = 1_500;\n/** open -> live; scaled by attempts (1x, 2x, 3x) so a large snapshot gets longer on retries. */\nexport const CONNECT_TIMEOUT_MS = 10_000;\nexport const RESUME_PONG_TIMEOUT_MS = 5_000;\n/** Skip the resume ping if a frame arrived this recently. */\nexport const RESUME_FRESH_MS = 5_000;\n\ntype Listener = () => void;\n\nexport class SyncClient {\n private ws: WebSocket | null = null;\n private stopped = true;\n private everLive = false;\n private attempts = 0;\n private retryTimer: ReturnType<typeof setTimeout> | null = null;\n private pingTimer: ReturnType<typeof setInterval> | null = null;\n private pongTimer: ReturnType<typeof setTimeout> | null = null;\n private persistTimer: ReturnType<typeof setTimeout> | null = null;\n private connectTimer: ReturnType<typeof setTimeout> | null = null;\n private lastFrameAt = 0;\n private unsubscribeStore: (() => void) | null = null;\n private liveListeners = new Set<Listener>();\n private logoutListeners = new Set<(reason: string) => void>();\n private cacheLoaded: Promise<void> | null = null;\n\n constructor(private readonly url: string = defaultWsUrl()) {}\n\n /** Load the offline cache into the store and connect. Idempotent. */\n start(): void {\n if (!this.stopped) return;\n this.stopped = false;\n window.addEventListener(\"online\", this.onOnline);\n window.addEventListener(\"offline\", this.onOffline);\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n window.addEventListener(\"pageshow\", this.onForeground);\n window.addEventListener(\"focus\", this.onForeground);\n this.unsubscribeStore = syncStore.subscribe((s, prev) => {\n if (s.synced && s.seq !== prev.seq) this.schedulePersist();\n });\n this.cacheLoaded ??= loadCache().then((cached) => {\n if (cached && !syncStore.getState().synced) {\n syncStore.getState().hydrateFromCache(cached.seq, cached.state, cached.savedAt);\n }\n });\n void this.cacheLoaded.then(() => this.connect());\n }\n\n stop(): void {\n this.stopped = true;\n window.removeEventListener(\"online\", this.onOnline);\n window.removeEventListener(\"offline\", this.onOffline);\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n window.removeEventListener(\"pageshow\", this.onForeground);\n window.removeEventListener(\"focus\", this.onForeground);\n this.unsubscribeStore?.();\n this.unsubscribeStore = null;\n this.clearTimers();\n const ws = this.ws;\n this.ws = null;\n ws?.close(1000, \"client stopped\");\n }\n\n /** Send a frame when connected. Returns false when it could not be sent. */\n send(msg: ClientToServer): boolean {\n if (this.ws?.readyState !== WebSocket.OPEN) return false;\n this.ws.send(JSON.stringify(msg));\n return true;\n }\n\n get isLive(): boolean {\n return syncStore.getState().connection.state === \"live\";\n }\n\n /** Called each time the connection becomes live (after replay or snapshot). */\n onLive(fn: Listener): () => void {\n this.liveListeners.add(fn);\n return () => this.liveListeners.delete(fn);\n }\n\n /** Called on `force_logout` (device revoked) and on auth failures. */\n onLogout(fn: (reason: string) => void): () => void {\n this.logoutListeners.add(fn);\n return () => this.logoutListeners.delete(fn);\n }\n\n /** Reconnect now (for example from a \"Retry\" button). */\n reconnectNow(): void {\n if (this.stopped) return;\n if (this.retryTimer) clearTimeout(this.retryTimer);\n this.retryTimer = null;\n if (this.ws && this.ws.readyState <= WebSocket.OPEN) return;\n this.connect();\n }\n\n private connect(): void {\n if (this.stopped) return;\n if (typeof navigator !== \"undefined\" && navigator.onLine === false) {\n syncStore.getState().setConnection({ state: \"offline\" });\n return;\n }\n syncStore.getState().setConnection({ state: this.everLive ? \"reconnecting\" : \"connecting\" });\n let ws: WebSocket;\n try {\n ws = new WebSocket(this.url);\n } catch {\n this.scheduleReconnect();\n return;\n }\n this.ws = ws;\n if (this.connectTimer) clearTimeout(this.connectTimer);\n const timeoutMs = CONNECT_TIMEOUT_MS * Math.min(1 + this.attempts, 3);\n this.connectTimer = setTimeout(() => {\n this.connectTimer = null;\n if (this.ws === ws) this.dropSocket(4000, \"connect timeout\");\n }, timeoutMs);\n let opened = false;\n ws.onopen = () => {\n if (this.ws !== ws) return;\n opened = true;\n const cursor = syncStore.getState().seq;\n ws.send(JSON.stringify({ type: \"hello\", cursor } satisfies ClientToServer));\n };\n ws.onmessage = (ev) => {\n if (this.ws !== ws) return;\n this.lastFrameAt = Date.now();\n let msg: ServerToClient;\n try {\n msg = JSON.parse(typeof ev.data === \"string\" ? ev.data : \"\") as ServerToClient;\n } catch {\n return;\n }\n this.handle(msg);\n };\n ws.onclose = (ev) => {\n if (this.ws !== ws) return;\n this.ws = null;\n this.clearTimers();\n if (this.stopped) return;\n // 4401: the coordinator revoked this device (it also sends `force_logout` first).\n // 4403/1008 are treated the same for proxies that map auth failures to close codes.\n if (ev.code === 4401 || ev.code === 4403 || ev.code === 1008) {\n this.emitLogout(ev.reason || \"unauthorized\");\n return;\n }\n // An upgrade rejected with HTTP 401 surfaces only as 1006 before open. Probe\n // GET /api/me: a 401 there signs out through the api() unauthorized listeners.\n if (!opened && this.attempts % 5 === 0) this.probeAuth();\n // 1013 (client too slow) and 1001 (coordinator stopping): reconnect with the cursor.\n this.scheduleReconnect();\n };\n ws.onerror = () => {\n // onclose follows and schedules the reconnect.\n };\n }\n\n private probing = false;\n private probeAuth(): void {\n if (this.probing) return;\n this.probing = true;\n void apiGet(\"/api/me\")\n .catch(() => undefined)\n .finally(() => {\n this.probing = false;\n });\n }\n\n private handle(msg: ServerToClient): void {\n const store = syncStore.getState();\n switch (msg.type) {\n case \"snapshot\":\n store.applySnapshot(msg.seq, msg.state);\n this.becomeLive();\n break;\n case \"replay\":\n store.applyReplay(msg.seq, msg.events);\n this.becomeLive();\n break;\n case \"event\":\n store.applyEvent(msg.event);\n break;\n case \"stream\":\n store.applyStream(msg.delta);\n break;\n case \"pong\":\n if (this.pongTimer) clearTimeout(this.pongTimer);\n this.pongTimer = null;\n store.markSynced();\n break;\n case \"force_logout\":\n this.emitLogout(msg.reason);\n break;\n }\n }\n\n private becomeLive(): void {\n if (this.connectTimer) clearTimeout(this.connectTimer);\n this.connectTimer = null;\n this.everLive = true;\n this.attempts = 0;\n syncStore.getState().setConnection({ state: \"live\", attempts: 0 });\n this.startPing();\n this.schedulePersist();\n for (const fn of this.liveListeners) fn();\n }\n\n private emitLogout(reason: string): void {\n this.stop();\n void clearCache();\n syncStore.getState().reset();\n for (const fn of this.logoutListeners) fn(reason);\n }\n\n private startPing(): void {\n if (this.pingTimer) clearInterval(this.pingTimer);\n this.pingTimer = setInterval(() => {\n if (!this.send({ type: \"ping\" })) return;\n if (!this.pongTimer) this.armPongTimeout(PONG_TIMEOUT_MS);\n }, PING_INTERVAL_MS);\n }\n\n private armPongTimeout(ms: number): void {\n if (this.pongTimer) clearTimeout(this.pongTimer);\n this.pongTimer = setTimeout(() => {\n this.pongTimer = null;\n // No pong: assume a dead socket and reconnect.\n this.dropSocket(4000, \"pong timeout\");\n }, ms);\n }\n\n /** Detach and close a socket we consider dead, then reconnect without waiting for onclose. */\n private dropSocket(code: number, reason: string): void {\n const ws = this.ws;\n if (!ws) return;\n this.ws = null; // its late onclose hits the `this.ws !== ws` guard\n this.clearTimers();\n try {\n ws.close(code, reason);\n } catch {\n // already closing\n }\n this.scheduleReconnect();\n }\n\n private scheduleReconnect(): void {\n if (this.stopped) return;\n if (typeof navigator !== \"undefined\" && navigator.onLine === false) {\n syncStore.getState().setConnection({ state: \"offline\" });\n return;\n }\n this.attempts++;\n const delay = Math.min(BACKOFF_MAX_MS, BACKOFF_BASE_MS * 2 ** (this.attempts - 1));\n const jittered = delay / 2 + Math.random() * (delay / 2);\n syncStore.getState().setConnection({\n state: this.everLive ? \"reconnecting\" : \"connecting\",\n attempts: this.attempts,\n });\n if (this.retryTimer) clearTimeout(this.retryTimer);\n this.retryTimer = setTimeout(() => {\n this.retryTimer = null;\n this.connect();\n }, jittered);\n }\n\n private schedulePersist(): void {\n if (this.persistTimer) return;\n this.persistTimer = setTimeout(() => {\n this.persistTimer = null;\n const s = syncStore.getState();\n if (!s.synced || s.seq === null) return;\n void saveCache({ seq: s.seq, state: toSyncState(s), savedAt: new Date().toISOString() });\n }, PERSIST_DELAY_MS);\n }\n\n private clearTimers(): void {\n if (this.retryTimer) clearTimeout(this.retryTimer);\n if (this.pingTimer) clearInterval(this.pingTimer);\n if (this.pongTimer) clearTimeout(this.pongTimer);\n if (this.connectTimer) clearTimeout(this.connectTimer);\n this.connectTimer = null;\n this.retryTimer = null;\n this.pingTimer = null;\n this.pongTimer = null;\n }\n\n private onOnline = () => {\n this.attempts = 0;\n this.reconnectNow();\n };\n\n private onVisibility = () => {\n if (document.visibilityState === \"visible\") this.onForeground();\n };\n\n /** Back in the foreground (resume, bfcache restore, focus): check the link now. */\n private onForeground = () => {\n if (this.stopped || document.visibilityState === \"hidden\") return;\n if (this.isLive) {\n if (Date.now() - this.lastFrameAt < RESUME_FRESH_MS) return;\n if (this.send({ type: \"ping\" })) this.armPongTimeout(RESUME_PONG_TIMEOUT_MS);\n return;\n }\n this.attempts = 0;\n this.reconnectNow();\n };\n\n private onOffline = () => {\n syncStore.getState().setConnection({ state: \"offline\" });\n this.ws?.close(4000, \"offline\");\n };\n}\n\nexport function defaultWsUrl(): string {\n const proto = location.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n return `${proto}//${location.host}/ws/client`;\n}\n\n/** The app-wide client instance. */\nexport const syncClient = new SyncClient(typeof location === \"undefined\" ? \"\" : defaultWsUrl());\n","import type { MeResponse } from \"@switchyard/protocol\";\nimport { create } from \"zustand\";\nimport { startPresence } from \"../presence\";\nimport { ApiClientError, apiGet, onUnauthorized } from \"../sync/api\";\nimport { clearCache } from \"../sync/cache\";\nimport { syncClient } from \"../sync/client\";\nimport { syncStore } from \"../sync/store\";\n\n/** Response of GET /api/me (protocol `MeResponse`). */\nexport type Me = MeResponse;\n\nexport type AuthStatus = \"checking\" | \"authenticated\" | \"unauthenticated\" | \"error\";\n\ninterface AuthStore {\n status: AuthStatus;\n me: Me | null;\n error: unknown;\n /** Why the device was signed out (device revoked, force_logout reason). */\n signedOutReason: string | null;\n}\n\nexport const useAuth = create<AuthStore>()(() => ({\n status: \"checking\",\n me: null,\n error: null,\n signedOutReason: null,\n}));\n\nconst ME_KEY = \"sy:me\";\nconst RETURN_KEY = \"sy:returnTo\";\n\nlet stopPresence: (() => void) | null = null;\n\nfunction startSync(): void {\n syncClient.start();\n stopPresence ??= startPresence(syncClient);\n}\n\nfunction stopSync(): void {\n syncClient.stop();\n stopPresence?.();\n stopPresence = null;\n}\n\n/** The current device id, when known. */\nexport function currentDeviceId(): string | null {\n const me = useAuth.getState().me;\n return me?.device?.id ?? null;\n}\n\n/** GET /api/me; starts live sync when authenticated. */\nexport async function checkAuth(): Promise<AuthStatus> {\n useAuth.setState({ status: \"checking\", error: null });\n try {\n const me = await apiGet<Me>(\"/api/me\");\n try {\n localStorage.setItem(ME_KEY, JSON.stringify(me));\n } catch {\n // ignore\n }\n useAuth.setState({ status: \"authenticated\", me, signedOutReason: null });\n startSync();\n return \"authenticated\";\n } catch (e) {\n if (e instanceof ApiClientError && (e.status === 401 || e.code === \"device_revoked\")) {\n signOut(e.code === \"device_revoked\" ? \"This device was revoked.\" : null);\n return \"unauthenticated\";\n }\n // Coordinator unreachable: run from the offline cache if this device enrolled before.\n const cached = readCachedMe();\n if (cached) {\n useAuth.setState({ status: \"authenticated\", me: cached });\n startSync();\n return \"authenticated\";\n }\n useAuth.setState({ status: \"error\", error: e });\n return \"error\";\n }\n}\n\nfunction readCachedMe(): Me | null {\n try {\n const raw = localStorage.getItem(ME_KEY);\n const me = raw ? (JSON.parse(raw) as Partial<Me>) : null;\n // Ignore caches written before the shape was known.\n return me?.device?.id ? (me as Me) : null;\n } catch {\n return null;\n }\n}\n\n/** Forget the local session and show sign-in. */\nexport function signOut(reason: string | null): void {\n stopSync();\n void clearCache();\n syncStore.getState().reset();\n try {\n localStorage.removeItem(ME_KEY);\n } catch {\n // ignore\n }\n useAuth.setState({ status: \"unauthenticated\", me: null, signedOutReason: reason });\n}\n\n/** Remember where to go after sign-in (deep links survive authentication). */\nexport function saveReturnTo(url: string): void {\n if (url.startsWith(\"/sign-in\") || url.startsWith(\"/enroll\")) return;\n try {\n localStorage.setItem(RETURN_KEY, url);\n } catch {\n // ignore\n }\n}\n\n/** Saved deep link (consumed). Only same-origin paths are honored. */\nexport function takeReturnTo(fromQuery: string | null): string {\n let saved: string | null = null;\n try {\n saved = localStorage.getItem(RETURN_KEY);\n localStorage.removeItem(RETURN_KEY);\n } catch {\n // ignore\n }\n const candidate = fromQuery ?? saved;\n if (\n candidate?.startsWith(\"/\") &&\n !candidate.startsWith(\"//\") &&\n !candidate.startsWith(\"/sign-in\") &&\n !candidate.startsWith(\"/enroll\")\n ) {\n return candidate;\n }\n return \"/\";\n}\n\nlet wired = false;\n/** Wire global auth listeners once. */\nexport function initAuth(): void {\n if (wired) return;\n wired = true;\n onUnauthorized((code) => {\n if (useAuth.getState().status === \"authenticated\") {\n signOut(code === \"device_revoked\" ? \"This device was revoked.\" : null);\n }\n });\n syncClient.onLogout((reason) => {\n signOut(reason === \"unauthorized\" ? null : `Signed out: ${reason}`);\n });\n}\n"],"mappings":"A,2HAcA,IAAMO,EAAU,aACVC,EAAQ,KACRC,EAAM,OACNC,EAAS,gBAEXC,EAAgD,KAEpD,SAASC,GAAsC,CAc7C,OAbID,IACJ,EAAY,IAAI,QAAS,GAAY,CACnC,GAAI,OAAO,UAAc,IAAa,OAAOE,EAAQ,IAAI,EACzD,GAAI,CACF,IAAMC,EAAM,UAAU,KAAKP,EAAS,CAAC,EACrC,EAAI,oBAAwBO,EAAI,OAAO,kBAAkBN,CAAK,EAC9D,EAAI,cAAkBK,EAAQC,EAAI,MAAM,EACxC,EAAI,YAAgBD,EAAQ,IAAI,EAChC,EAAI,cAAkBA,EAAQ,IAAI,CACpC,MAAQ,CACNA,EAAQ,IAAI,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