@spencerboucher/switchyard 0.19.0 → 0.21.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 (163) hide show
  1. package/README.md +23 -16
  2. package/dist/bridge/enroll.js +36 -6
  3. package/dist/bridge/switchyard-terminal.js +2 -1
  4. package/dist/policies/worker.js +1042 -1018
  5. package/dist/switchyard.mjs +3622 -2671
  6. package/package.json +1 -1
  7. package/web-dist/assets/AutomationView-8yzlARUS.js +2 -0
  8. package/web-dist/assets/{AutomationView-X-U6Fpm7.js.map → AutomationView-8yzlARUS.js.map} +1 -1
  9. package/web-dist/assets/Button-C7TQGuSX.js +2 -0
  10. package/web-dist/assets/Button-C7TQGuSX.js.map +1 -0
  11. package/web-dist/assets/{Card-WONLvqGM.js → Card-DzHrwFrv.js} +2 -2
  12. package/web-dist/assets/{Card-WONLvqGM.js.map → Card-DzHrwFrv.js.map} +1 -1
  13. package/web-dist/assets/{Checkbox-BmiLcC-z.js → Checkbox-BnRsg6ki.js} +2 -2
  14. package/web-dist/assets/{Checkbox-BmiLcC-z.js.map → Checkbox-BnRsg6ki.js.map} +1 -1
  15. package/web-dist/assets/{DangerZone-Ch2KNmob.js → DangerZone-BicyqXv8.js} +2 -2
  16. package/web-dist/assets/{DangerZone-Ch2KNmob.js.map → DangerZone-BicyqXv8.js.map} +1 -1
  17. package/web-dist/assets/Field-DBm2uYcg.js +2 -0
  18. package/web-dist/assets/Field-DBm2uYcg.js.map +1 -0
  19. package/web-dist/assets/{Markdown-BKOAPNDn.js → Markdown-BijzTpiJ.js} +2 -2
  20. package/web-dist/assets/{Markdown-BKOAPNDn.js.map → Markdown-BijzTpiJ.js.map} +1 -1
  21. package/web-dist/assets/Menu-BCTLk6pj.js +2 -0
  22. package/web-dist/assets/Menu-BCTLk6pj.js.map +1 -0
  23. package/web-dist/assets/{Priority-DTBkp1nb.js → Priority-DAhFDJ7E.js} +2 -2
  24. package/web-dist/assets/{Priority-DTBkp1nb.js.map → Priority-DAhFDJ7E.js.map} +1 -1
  25. package/web-dist/assets/ScopeSelect-CMmLEwNw.js +2 -0
  26. package/web-dist/assets/ScopeSelect-CMmLEwNw.js.map +1 -0
  27. package/web-dist/assets/{SegmentedControl-Ca8Fsw-g.js → SegmentedControl-Cvkz7C_A.js} +2 -2
  28. package/web-dist/assets/{SegmentedControl-Ca8Fsw-g.js.map → SegmentedControl-Cvkz7C_A.js.map} +1 -1
  29. package/web-dist/assets/{Select-YFnt2Br2.js → Select-CDRJ35wi.js} +2 -2
  30. package/web-dist/assets/{Select-YFnt2Br2.js.map → Select-CDRJ35wi.js.map} +1 -1
  31. package/web-dist/assets/{Switch-DHX-YYPr.js → Switch-D5pVfZgf.js} +2 -2
  32. package/web-dist/assets/{Switch-DHX-YYPr.js.map → Switch-D5pVfZgf.js.map} +1 -1
  33. package/web-dist/assets/{Tabs-DrFCe494.js → Tabs-D1t1tQzS.js} +2 -2
  34. package/web-dist/assets/{Tabs-DrFCe494.js.map → Tabs-D1t1tQzS.js.map} +1 -1
  35. package/web-dist/assets/{TextLink-CCc3WEdm.js → TextLink-BGtYWCW9.js} +2 -2
  36. package/web-dist/assets/{TextLink-CCc3WEdm.js.map → TextLink-BGtYWCW9.js.map} +1 -1
  37. package/web-dist/assets/{UINodeRenderer-BdvzPTz0.js → UINodeRenderer-CzoNfuWZ.js} +2 -2
  38. package/web-dist/assets/{UINodeRenderer-BdvzPTz0.js.map → UINodeRenderer-CzoNfuWZ.js.map} +1 -1
  39. package/web-dist/assets/UnfilteredNote-ddFROo9x.js +2 -0
  40. package/web-dist/assets/UnfilteredNote-ddFROo9x.js.map +1 -0
  41. package/web-dist/assets/api-hJ_Ikv1a.js +2 -0
  42. package/web-dist/assets/api-hJ_Ikv1a.js.map +1 -0
  43. package/web-dist/assets/{arrow-down-YwTzxo-r.js → arrow-down-Dn3KG_JI.js} +2 -2
  44. package/web-dist/assets/{arrow-down-YwTzxo-r.js.map → arrow-down-Dn3KG_JI.js.map} +1 -1
  45. package/web-dist/assets/{arrow-up-Bzh112dp.js → arrow-up-BiPtOqqy.js} +2 -2
  46. package/web-dist/assets/{arrow-up-Bzh112dp.js.map → arrow-up-BiPtOqqy.js.map} +1 -1
  47. package/web-dist/assets/attention-8UbWvCkj.js +2 -0
  48. package/web-dist/assets/attention-8UbWvCkj.js.map +1 -0
  49. package/web-dist/assets/{automations-CkbEL-3K.js → automations-ClK2gYj8.js} +2 -2
  50. package/web-dist/assets/{automations-CkbEL-3K.js.map → automations-ClK2gYj8.js.map} +1 -1
  51. package/web-dist/assets/board-4FKGJU8D.js +6 -0
  52. package/web-dist/assets/board-4FKGJU8D.js.map +1 -0
  53. package/web-dist/assets/{calendar-clock-CwOgyN2z.js → calendar-clock-DVlat602.js} +2 -2
  54. package/web-dist/assets/{calendar-clock-CwOgyN2z.js.map → calendar-clock-DVlat602.js.map} +1 -1
  55. package/web-dist/assets/check-CEnbWw4D.js +2 -0
  56. package/web-dist/assets/{check-DTN2VHtE.js.map → check-CEnbWw4D.js.map} +1 -1
  57. package/web-dist/assets/chevron-right-BM1IJI2z.js +2 -0
  58. package/web-dist/assets/{chevron-right-aaHL5Igi.js.map → chevron-right-BM1IJI2z.js.map} +1 -1
  59. package/web-dist/assets/code-BD2TozC7.js +25 -0
  60. package/web-dist/assets/code-BD2TozC7.js.map +1 -0
  61. package/web-dist/assets/{core.esm-C84Qlq9d.js → core.esm-B2OVQjr5.js} +2 -2
  62. package/web-dist/assets/{core.esm-C84Qlq9d.js.map → core.esm-B2OVQjr5.js.map} +1 -1
  63. package/web-dist/assets/{describe-Bt36Y0d7.js → describe-DBhLxCUs.js} +2 -2
  64. package/web-dist/assets/{describe-Bt36Y0d7.js.map → describe-DBhLxCUs.js.map} +1 -1
  65. package/web-dist/assets/{enroll--c9VSPgK.js → enroll-JhMxQuxw.js} +2 -2
  66. package/web-dist/assets/{enroll--c9VSPgK.js.map → enroll-JhMxQuxw.js.map} +1 -1
  67. package/web-dist/assets/{external-link-CI-Uzhfh.js → external-link-B3hnazCa.js} +2 -2
  68. package/web-dist/assets/{external-link-CI-Uzhfh.js.map → external-link-B3hnazCa.js.map} +1 -1
  69. package/web-dist/assets/{hand-HCdmhGph.js → hand-B6lvj014.js} +2 -2
  70. package/web-dist/assets/{hand-HCdmhGph.js.map → hand-B6lvj014.js.map} +1 -1
  71. package/web-dist/assets/{index-C6YuwL8H.js → index-Bc5JWkn9.js} +6 -6
  72. package/web-dist/assets/index-Bc5JWkn9.js.map +1 -0
  73. package/web-dist/assets/index-C9iuCGwg.css +2 -0
  74. package/web-dist/assets/{keyboardLayers-DKHA_Gcs.js → keyboardLayers-4IDHV-jq.js} +2 -2
  75. package/web-dist/assets/{keyboardLayers-DKHA_Gcs.js.map → keyboardLayers-4IDHV-jq.js.map} +1 -1
  76. package/web-dist/assets/{link-2-D6l0YZ-8.js → link-2-CCq9WzMy.js} +2 -2
  77. package/web-dist/assets/{link-2-D6l0YZ-8.js.map → link-2-CCq9WzMy.js.map} +1 -1
  78. package/web-dist/assets/{logic-CzU-NdeO.js → logic-BnSIy9_P.js} +2 -2
  79. package/web-dist/assets/{logic-CzU-NdeO.js.map → logic-BnSIy9_P.js.map} +1 -1
  80. package/web-dist/assets/logic-DUKcqVPg.js +4 -0
  81. package/web-dist/assets/logic-DUKcqVPg.js.map +1 -0
  82. package/web-dist/assets/{more-Dca-1nh1.js → more-CUfPZ6AG.js} +2 -2
  83. package/web-dist/assets/{more-Dca-1nh1.js.map → more-CUfPZ6AG.js.map} +1 -1
  84. package/web-dist/assets/{pencil-BtK08_f_.js → pencil-DeML-0z2.js} +2 -2
  85. package/web-dist/assets/{pencil-BtK08_f_.js.map → pencil-DeML-0z2.js.map} +1 -1
  86. package/web-dist/assets/{play-j138GLHB.js → play-NHO6U6cY.js} +2 -2
  87. package/web-dist/assets/{play-j138GLHB.js.map → play-NHO6U6cY.js.map} +1 -1
  88. package/web-dist/assets/{plus-D935l0Os.js → plus-C83uJhbf.js} +2 -2
  89. package/web-dist/assets/{plus-D935l0Os.js.map → plus-C83uJhbf.js.map} +1 -1
  90. package/web-dist/assets/policyLogic-Btk1SjgX.js +2 -0
  91. package/web-dist/assets/policyLogic-Btk1SjgX.js.map +1 -0
  92. package/web-dist/assets/{queue-CbFYHdtZ.js → queue-gs6Ez_u3.js} +2 -2
  93. package/web-dist/assets/queue-gs6Ez_u3.js.map +1 -0
  94. package/web-dist/assets/repo-T2dxdBnU.js +2 -0
  95. package/web-dist/assets/repo-T2dxdBnU.js.map +1 -0
  96. package/web-dist/assets/{rotate-ccw-mfO3Crkq.js → rotate-ccw-BRrlVEAQ.js} +2 -2
  97. package/web-dist/assets/{rotate-ccw-mfO3Crkq.js.map → rotate-ccw-BRrlVEAQ.js.map} +1 -1
  98. package/web-dist/assets/{search-DdgUAUi7.js → search-C5H14z0D.js} +2 -2
  99. package/web-dist/assets/{search-DdgUAUi7.js.map → search-C5H14z0D.js.map} +1 -1
  100. package/web-dist/assets/selection-DBzwvhnW.js +7 -0
  101. package/web-dist/assets/selection-DBzwvhnW.js.map +1 -0
  102. package/web-dist/assets/settings-DpK1_7vb.js +12 -0
  103. package/web-dist/assets/settings-DpK1_7vb.js.map +1 -0
  104. package/web-dist/assets/states-DL6w2pmK.js +58 -0
  105. package/web-dist/assets/states-DL6w2pmK.js.map +1 -0
  106. package/web-dist/assets/{terminal-DKqo1lis.js → terminal-CATQN_17.js} +2 -2
  107. package/web-dist/assets/{terminal-DKqo1lis.js.map → terminal-CATQN_17.js.map} +1 -1
  108. package/web-dist/assets/terminal-login-DNyAyWlB.js +2 -0
  109. package/web-dist/assets/{terminal-login-CK1PXQq9.js.map → terminal-login-DNyAyWlB.js.map} +1 -1
  110. package/web-dist/assets/{timer-CDGYPIoD.js → timer-DFrvOKOy.js} +2 -2
  111. package/web-dist/assets/{timer-CDGYPIoD.js.map → timer-DFrvOKOy.js.map} +1 -1
  112. package/web-dist/assets/{useBreakpoint-kT0J1Dnk.js → useBreakpoint-BYCN9s8X.js} +2 -2
  113. package/web-dist/assets/{useBreakpoint-kT0J1Dnk.js.map → useBreakpoint-BYCN9s8X.js.map} +1 -1
  114. package/web-dist/assets/useNow-wwKWj7oX.js +2 -0
  115. package/web-dist/assets/useNow-wwKWj7oX.js.map +1 -0
  116. package/web-dist/assets/{useResource-OCKiw9Xe.js → useResource-D_GOVIub.js} +2 -2
  117. package/web-dist/assets/{useResource-OCKiw9Xe.js.map → useResource-D_GOVIub.js.map} +1 -1
  118. package/web-dist/assets/workboard-B89WFLVO.js +3 -0
  119. package/web-dist/assets/workboard-B89WFLVO.js.map +1 -0
  120. package/web-dist/index.html +8 -8
  121. package/web-dist/sw.js +1 -1
  122. package/web-dist/sw.js.map +1 -1
  123. package/web-dist/assets/AutomationView-X-U6Fpm7.js +0 -2
  124. package/web-dist/assets/Button-BKQW9doW.js +0 -2
  125. package/web-dist/assets/Button-BKQW9doW.js.map +0 -1
  126. package/web-dist/assets/Copy-CdlOSzns.js +0 -2
  127. package/web-dist/assets/Copy-CdlOSzns.js.map +0 -1
  128. package/web-dist/assets/InteractionCard-CMLAH54x.js +0 -4
  129. package/web-dist/assets/InteractionCard-CMLAH54x.js.map +0 -1
  130. package/web-dist/assets/UnfilteredNote-C44Gi9gP.js +0 -2
  131. package/web-dist/assets/UnfilteredNote-C44Gi9gP.js.map +0 -1
  132. package/web-dist/assets/ViewSelect-Dr9Akgak.js +0 -2
  133. package/web-dist/assets/ViewSelect-Dr9Akgak.js.map +0 -1
  134. package/web-dist/assets/api-Dbc6zmlY.js +0 -2
  135. package/web-dist/assets/api-Dbc6zmlY.js.map +0 -1
  136. package/web-dist/assets/attention-BWVl_pfs.js +0 -2
  137. package/web-dist/assets/attention-BWVl_pfs.js.map +0 -1
  138. package/web-dist/assets/board-DRNTDqMF.js +0 -6
  139. package/web-dist/assets/board-DRNTDqMF.js.map +0 -1
  140. package/web-dist/assets/check-DTN2VHtE.js +0 -2
  141. package/web-dist/assets/chevron-right-aaHL5Igi.js +0 -2
  142. package/web-dist/assets/code-0I1wn1N7.js +0 -25
  143. package/web-dist/assets/code-0I1wn1N7.js.map +0 -1
  144. package/web-dist/assets/index-9TW72kVM.css +0 -2
  145. package/web-dist/assets/index-C6YuwL8H.js.map +0 -1
  146. package/web-dist/assets/policyLogic-Bs-3OIqh.js +0 -2
  147. package/web-dist/assets/policyLogic-Bs-3OIqh.js.map +0 -1
  148. package/web-dist/assets/queue-CbFYHdtZ.js.map +0 -1
  149. package/web-dist/assets/repo-BB50Kdri.js +0 -2
  150. package/web-dist/assets/repo-BB50Kdri.js.map +0 -1
  151. package/web-dist/assets/selection-QGVHfoxz.js +0 -7
  152. package/web-dist/assets/selection-QGVHfoxz.js.map +0 -1
  153. package/web-dist/assets/settings-BvUmCxtY.js +0 -12
  154. package/web-dist/assets/settings-BvUmCxtY.js.map +0 -1
  155. package/web-dist/assets/states-DM6omTC-.js +0 -58
  156. package/web-dist/assets/states-DM6omTC-.js.map +0 -1
  157. package/web-dist/assets/terminal-login-CK1PXQq9.js +0 -2
  158. package/web-dist/assets/trackers-BIhLByAc.js +0 -2
  159. package/web-dist/assets/trackers-BIhLByAc.js.map +0 -1
  160. package/web-dist/assets/useNow-DOQOgv7k.js +0 -2
  161. package/web-dist/assets/useNow-DOQOgv7k.js.map +0 -1
  162. package/web-dist/assets/workboard-C0XpNo0s.js +0 -3
  163. package/web-dist/assets/workboard-C0XpNo0s.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import{S as e,_ as t,a as n,h as r,i,l as a,o,t as s,v as c,y as l}from"./Button-BKQW9doW.js";import{C as u,u as d,w as f,y as ee}from"./keyboardLayers-DKHA_Gcs.js";import{Ft as p,It as m,L as h,M as te,Nt as ne,O as re,Pt as g,Rt as ie,c as _,f as v,i as ae,lt as y,m as b,n as x,r as S,s as oe,t as C,tt as w,u as T,zt as E}from"./states-DM6omTC-.js";import{t as D}from"./calendar-clock-CwOgyN2z.js";import{n as O,r as k,t as se}from"./Priority-DTBkp1nb.js";import{a as ce,c as le,i as ue,p as de,s as A,t as fe}from"./useBreakpoint-kT0J1Dnk.js";import{n as pe,r as me}from"./Copy-CdlOSzns.js";import{n as he}from"./timer-CDGYPIoD.js";import{t as ge}from"./play-j138GLHB.js";import{t as j}from"./plus-D935l0Os.js";import{n as _e,t as ve}from"./DangerZone-Ch2KNmob.js";import{c as ye,s as M,t as N,u as be}from"./policyLogic-Bs-3OIqh.js";import{G as xe,I as P,L as F,R as Se,U as Ce,X as I,tt as we}from"./index-C6YuwL8H.js";import{t as L}from"./TextLink-CCc3WEdm.js";import{t as R}from"./SegmentedControl-Ca8Fsw-g.js";import{t as z}from"./Card-WONLvqGM.js";import{t as B}from"./Select-YFnt2Br2.js";import{t as V}from"./Switch-DHX-YYPr.js";import{E as H,O as Te,S as Ee,T as U,a as W,b as De,d as Oe,f as G,g as K,h as ke,i as Ae,l as q,m as je,n as Me,o as Ne,p as J,r as Pe,s as Fe,t as Ie,u as Le,v as Re,w as Y,x as ze,y as Be}from"./describe-Bt36Y0d7.js";var Ve={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`}]]};Ve.node;var He=o(Ve),X=e(l(),1),Z=i(),Ue=e=>`/tasks/${encodeURIComponent(e)}`;function Q(e){return E(e)&&(e.status===404||e.status===405||e.status===501)}function We({summary:e,errorCount:t}){return(0,Z.jsxs)(z,{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)(b,{"aria-hidden":!0,className:`size-4 shrink-0`}),t===1?`1 field needs attention`:`${t} fields need attention`]})]})}async function Ge(e,t,n){return e&&!n?g(Y(e,`/preview`)):m(`/api/automations/preview`,t)}function Ke({automationId:e,dirty:t,getInput:n,currentKey:r}){let[i,a]=(0,X.useState)({status:`idle`}),o=async()=>{let r=n();if(!r)A.error(`Fix the highlighted fields to preview the task`);else{a({status:`loading`});try{let n=await Ge(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)(z,{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)(s,{icon:(0,Z.jsx)(ee,{className:`size-4`}),busy:i.status===`loading`,onClick:()=>void o(),children:`Preview resulting task`})}),i.status===`unsupported`&&(0,Z.jsx)(T,{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)(x,{compact:!0,title:`Could not preview`,error:i.error,onRetry:()=>void o()}),i.status===`done`&&(0,Z.jsx)(qe,{preview:i.preview,stale:i.key!==r})]})}function qe({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)(b,{"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)(O,{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)(he,{"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:J(e)}),(0,Z.jsx)(`span`,{className:`text-muted`,children:v(e)})]},e))})]})]})}function Je({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)(s,{size:`sm`,icon:(0,Z.jsx)(me,{className:`size-3.5`}),onClick:()=>void pe(t,`${e} copied`),"aria-label":`Copy ${e.toLowerCase()}`,children:`Copy`})]})]})}function Ye({automation:e}){let[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),u=e.webhookTokenSet||a!==null,d=async()=>{i(!1),n(!0);try{let t=await m(Y(e.id,`/webhook-token`)),n=w.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}),A.success(u?`Webhook token rotated`:`Webhook token created`)}catch(e){Q(e)?l(!0):A.error(`Could not issue a webhook token: ${ie(e)}`)}finally{n(!1)}};return(0,Z.jsxs)(z,{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:u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(de,{"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`]})}),c?(0,Z.jsx)(T,{capability:`Webhook tokens`,reason:`This coordinator does not issue webhook tokens.`}):(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{icon:(0,Z.jsx)(I,{className:`size-4`}),busy:t,onClick:()=>u?i(!0):void d(),children:u?`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)(b,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),`This token is shown once. Copy it now.`]}),(0,Z.jsx)(Je,{label:`Token`,value:a.token}),(0,Z.jsx)(Je,{label:`URL`,value:a.url}),(0,Z.jsx)(Je,{label:`Example`,value:Ne(a.token,a.url)}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{size:`sm`,onClick:()=>o(null),children:`I have copied it`})})]}),(0,Z.jsx)(Se,{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 d()})]})}var Xe=[];function Ze({automationId:e,refreshKey:t,onRun:n}){let r=h(t=>t.occurrences[e]??Xe),i=h(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(Y(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=K(a.status===`done`?a.items:[],r);return(0,Z.jsxs)(z,{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)(T,{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)(x,{compact:!0,title:`Could not load history`,error:a.error,onRetry:()=>void s()}),a.status===`loading`&&c.length===0?(0,Z.jsx)(_,{label:`Loading history…`,className:`py-4`}):c.length===0&&a.status!==`error`?(0,Z.jsx)(C,{className:`py-4`,icon:(0,Z.jsx)(He,{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)(ge,{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:J(t)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:v(t)})]}),r&&(0,Z.jsx)(`p`,{className:`text-sm break-words text-muted`,children:r}),e.taskId&&(0,Z.jsxs)(L,{to:Ue(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 Qe=`/automations`,$e=e=>`/automations/${encodeURIComponent(e)}`,et=`sy:automation-draft`;function tt(){let{automationId:e=`new`}=c();return(0,Z.jsx)(nt,{automationId:e},e)}function nt({automationId:e}){let t=e===`new`,n=h(e=>e.hydrated),r=H(t?void 0:e),[i,a]=(0,X.useState)({status:`idle`}),o=(0,X.useCallback)(async()=>{a({status:`loading`});try{let t=await g(Y(e)),n=y.safeParse(t);if(!n.success){a({status:`fatal`,error:Error(`The coordinator returned this automation in an unexpected format.`)});return}U.getState().put(n.data),a({status:`idle`})}catch(e){E(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)(ot,{automation:null}):r?(0,Z.jsx)(ot,{automation:r}):i.status===`notfound`?(0,Z.jsx)(C,{icon:(0,Z.jsx)(xe,{className:`size-8`}),title:`Automation not found`,description:`It may have been deleted, or the link is wrong.`,action:{label:`Back to automations`,to:Qe}}):i.status===`error`?(0,Z.jsx)(x,{title:`Could not load this automation`,error:i.error,onRetry:()=>void o()}):i.status===`fatal`?(0,Z.jsx)(S,{error:i.error}):(0,Z.jsx)(_,{label:n?`Loading automation…`:`Loading…`})}function rt(e){let t=Oe({projectId:e,timezone:ke()});try{let e=sessionStorage.getItem(et);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 it(e){try{e?sessionStorage.setItem(et,JSON.stringify(e)):sessionStorage.removeItem(et)}catch{}}var $=e=>JSON.stringify(Le(e));function at(e){if(!E(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=G(t);i!==`form`&&!r[i]&&(r[i]=n)}return r}function ot({automation:e}){let i=t(),o=r(),c=ce(Qe),l=fe(),d=l===`desktop`,f=te(),ee=re(),g=h(e=>e.hosts),_=h(e=>e.profiles),v=h(e=>e.tasks),y=h(e=>e.projects),x=e===null,S=(0,X.useId)(),C=(0,X.useRef)(null),[w,T]=(0,X.useState)(()=>e?q(e):rt(f[0]?.id)),[E,D]=(0,X.useState)(()=>$(w)),[O,k]=(0,X.useState)(!1),[se,de]=(0,X.useState)({}),[pe,me]=(0,X.useState)(!1),[he,j]=(0,X.useState)(!1),[M,N]=(0,X.useState)(!1),[xe,P]=(0,X.useState)(!1),[F,Ce]=(0,X.useState)(0),I=(0,X.useRef)(e?.updatedAt),L=$(w),R=L!==E;(0,X.useEffect)(()=>{if(!e||e.updatedAt===I.current)return;I.current=e.updatedAt;let t=q(e),n=$(t);L===E?(T(t),P(!1)):n!==L&&P(!0),D(n)},[e,L,E]),(0,X.useEffect)(()=>{x&&it(w)},[x,w]),(0,X.useEffect)(()=>{x&&!w.projectId&&f[0]&&T(e=>e.projectId?e:{...e,projectId:f[0].id})},[x,w.projectId,f]);let z=(0,X.useCallback)((e,t)=>{T(n=>({...n,[e]:t})),de(e=>Object.keys(e).length?{}:e)},[]),B=(0,X.useMemo)(()=>Ee(w),[w]),V={...se,...O?B.errors:{}},H=e=>V[e],W=y[w.projectId],G=w.hostId||W?.defaultHostId||null,K=G?g[G]:void 0,Ae=w.profileId||W?.defaultProfileId||null,je=(0,X.useCallback)(e=>v[e]?.title,[v]),Me=(0,X.useMemo)(()=>De(Le(w),{projectName:W?.name,hostName:w.hostId?g[w.hostId]?.name??null:null,profileName:w.profileId?_[w.profileId]?.name??null:null,taskTitle:je}),[w,W?.name,g,_,je]),Ne=()=>{requestAnimationFrame(()=>{C.current?.querySelector(`[aria-invalid="true"]`)?.focus()})},J=()=>(k(!0),B.input||Ne(),B.input),Pe=async()=>{let t=J();if(!t)A.error(`Fix the highlighted fields before saving`);else{me(!0);try{if(x){let e=await m(`/api/automations`,t);if(!e||typeof e!=`object`||!e.id)throw Error(`The coordinator did not return the new automation`);U.getState().put(e),it(null),A.success(`Created ${e.name}`),i($e(e.id),{replace:!0,state:o.state});return}let n=await p(Y(e.id),t);if(n&&typeof n==`object`&&n.id){U.getState().put(n),I.current=n.updatedAt;let e=q(n);T(e),D($(e))}else D(L);P(!1),k(!1),A.success(`Saved ${t.name}`)}catch(e){let t=at(e);de(t),Object.keys(t).length&&Ne(),A.error(`Could not save: ${ie(e)}. Your changes are kept.`)}finally{me(!1)}}},Fe=async()=>{if(e){j(!0);try{await ne(Y(e.id)),N(!1),A.success(`Deleted ${e.name}`),c(),U.getState().remove(e.id)}catch(e){A.error(`Could not delete: ${ie(e)}`)}finally{j(!1)}}},{busy:Ie,run:Re}=Te(()=>Ce(e=>e+1)),ze=e?!!Ie[e.id]:!1,Be=()=>e&&void Re(e),Ve=()=>{let e=Oe({projectId:f[0]?.id,timezone:ke()});T(e),k(!1),it(null)},He=x?`New automation`:e.name,Ue=(0,Z.jsxs)(Z.Fragment,{children:[!x&&(0,Z.jsx)(s,{icon:(0,Z.jsx)(ge,{className:`size-4`}),busy:ze,onClick:Be,title:R?`Runs the saved version`:void 0,children:`Run now`}),x&&R&&(0,Z.jsx)(s,{variant:`ghost`,icon:(0,Z.jsx)(le,{className:`size-4`}),onClick:Ve,children:`Discard draft`})]}),Q=e=>(0,Z.jsx)(s,{type:`submit`,form:S,variant:`primary`,busy:pe,block:e,icon:(0,Z.jsx)(_e,{className:`size-4`}),children:x?`Create automation`:`Save`}),Ge=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{summary:Me,errorCount:O?Object.keys(B.errors).length:0}),(0,Z.jsx)(Ke,{automationId:e?.id??null,dirty:R,getInput:J,currentKey:JSON.stringify(B.input)}),e&&e.trigger.kind===`webhook`&&(0,Z.jsx)(Ye,{automation:e}),e&&(0,Z.jsx)(Ze,{automationId:e.id,refreshKey:F,onRun:Be})]});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)(a,{to:Qe,onClick:ue(c),className:`tap inline-flex items-center gap-1 self-start rounded text-sm text-muted hover:text-text`,children:[(0,Z.jsx)(we,{"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}),R&&(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,Z.jsx)(u,{"aria-hidden":!0,className:`size-3.5`}),`Unsaved changes`]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ue,d&&Q()]})]})]}),(0,Z.jsx)(oe,{subject:`automations`,consequence:`Changes are sent once the coordinator is reachable again.`}),K&&K.connectivity!==`connected`&&(0,Z.jsx)(ae,{compact:!0,hostName:K.name,connectivity:K.connectivity,lastSeenAt:K.lastSeenAt,detail:`Occurrences are still recorded; their tasks wait until the host is reachable.`}),xe&&(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)(b,{"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:n(`grid min-w-0 gap-4`,d?`grid-cols-[minmax(0,1fr)_minmax(320px,400px)] items-start`:`grid-cols-1`),children:[(0,Z.jsxs)(`form`,{id:S,ref:C,noValidate:!0,"aria-label":He,onSubmit:e=>{e.preventDefault(),Pe()},className:`flex min-w-0 flex-col gap-4`,children:[(0,Z.jsx)(st,{draft:w,update:z,err:H,projects:f}),(0,Z.jsx)(ut,{draft:w,update:z,err:H,tasks:v,projectsById:y,savedAutomation:e,segmented:l!==`mobile`}),(0,Z.jsx)(dt,{draft:w,setDraft:T,err:H}),(0,Z.jsx)(ft,{draft:w,update:z,err:H}),(0,Z.jsx)(mt,{draft:w,update:z,err:H,hosts:ee,profiles:Object.values(_).sort((e,t)=>e.name.localeCompare(t.name)),defaultHostName:W?.defaultHostId?g[W.defaultHostId]?.name:void 0,defaultProfileName:W?.defaultProfileId?_[W.defaultProfileId]?.name:void 0,selectedProfileMissing:!!Ae&&!_[Ae]}),(0,Z.jsx)(ht,{draft:w,update:z}),(0,Z.jsx)(gt,{draft:w,update:z,err:H}),(0,Z.jsx)(_t,{draft:w,update:z,err:H,projectChecks:W?.checks}),V.form&&(0,Z.jsx)(ye,{children:V.form})]}),(0,Z.jsx)(`aside`,{"aria-label":`Summary, preview and history`,className:`flex min-w-0 flex-col gap-4`,children:Ge})]}),!x&&e&&(0,Z.jsx)(ve,{description:`Future occurrences stop. Tasks it already created stay on the board; its history is removed.`,children:(0,Z.jsx)(s,{variant:`danger`,icon:(0,Z.jsx)(be,{className:`size-4`}),onClick:()=>N(!0),children:`Delete automation`})}),d?(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:R?`Unsaved changes`:x?`Not saved yet`:`All changes saved`}),Q()]}),(0,Z.jsx)(Se,{open:M,onClose:()=>N(!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)(be,{className:`size-4`}),busy:he,onConfirm:()=>void Fe()})]})}function st({draft:e,update:t,err:n,projects:r}){return(0,Z.jsxs)(z,{stack:!0,title:`Basics`,children:[(0,Z.jsx)(M,{label:`Name`,error:n(`name`),children:n=>(0,Z.jsx)(F,{...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)(M,{label:`Project`,error:n(`projectId`),hint:r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[`No projects yet.`,` `,(0,Z.jsx)(L,{to:`/settings/projects`,children:`Add a project in Settings`}),`.`]}):void 0,children:n=>(0,Z.jsxs)(B,{...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)(M,{label:`Status`,hint:`Disabled automations keep their history and can still run manually.`,children:n=>(0,Z.jsx)(V,{...n,checked:e.enabled,onChange:e=>t(`enabled`,e),label:`Enabled`,onText:`Enabled`,offText:`Disabled`,className:`self-start`})})]})]})}var ct=[`manual`,`once`,`cron`,`webhook`,`dependency`],lt={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 ut({draft:e,update:t,err:n,tasks:r,projectsById:i,savedAutomation:a,segmented:o}){let s=h(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=ke(),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]),p=e.triggerKind===`once`?je(e.onceAt):``;return(0,Z.jsxs)(z,{stack:!0,title:`Trigger`,description:lt[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)(R,{label:`Trigger kind`,value:e.triggerKind,onChange:e=>t(`triggerKind`,e),options:ct.map(e=>({value:e,label:W[e]}))})})]}):(0,Z.jsx)(M,{label:`Trigger kind`,children:n=>(0,Z.jsx)(B,{...n,value:e.triggerKind,onChange:e=>t(`triggerKind`,e.target.value),children:ct.map(e=>(0,Z.jsx)(`option`,{value:e,children:W[e]},e))})}),e.triggerKind===`once`&&(0,Z.jsx)(M,{label:`Run at`,error:n(`onceAt`),hint:`Local time (${f})${p?`; saved as ${p}`:``}.`,children:n=>(0,Z.jsx)(F,{...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)(M,{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)(F,{...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)(M,{label:`Timezone`,error:n(`cronTimezone`),hint:e.cronTimezone.trim()===f?`IANA timezone name; daylight saving is handled.`:(0,Z.jsxs)(L,{onClick:()=>t(`cronTimezone`,f),children:[`Use this device's timezone (`,f,`)`]}),children:n=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{...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)(M,{label:`When this task is done`,error:n(`dependencyTaskId`),hint:`Fires once each time the task enters Done.`,children:n=>(0,Z.jsxs)(B,{...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 dt({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)(z,{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)(M,{label:`Path ${i+1}`,error:n(`filters.${i}.path`),children:t=>(0,Z.jsx)(F,{...t,value:e.path,onChange:e=>r(i,{path:e.target.value}),placeholder:`action`,className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})}),(0,Z.jsx)(M,{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)(F,{...t,value:e.equals,onChange:e=>r(i,{equals:e.target.value}),placeholder:`opened`})}),(0,Z.jsx)(Ce,{label:`Remove filter ${i+1}`,icon:(0,Z.jsx)(le,{className:`size-4`}),onClick:()=>t(e=>({...e,filters:e.filters.filter((e,t)=>t!==i)}))})]},i)),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{size:`sm`,icon:(0,Z.jsx)(j,{className:`size-3.5`}),onClick:()=>t(e=>({...e,filters:[...e.filters,{path:``,equals:``}]})),children:`Add filter`})})]})}function ft({draft:e,update:t,err:n}){return(0,Z.jsxs)(z,{stack:!0,title:`Task template`,description:`Use ${Ae.join(`, `)} in the title, objective, criteria and grouping key.`,children:[(0,Z.jsx)(M,{label:`Task title`,error:n(`title`),children:n=>(0,Z.jsx)(F,{...n,value:e.title,onChange:e=>t(`title`,e.target.value),placeholder:`Triage new issues for {{date}}`})}),(0,Z.jsx)(M,{label:`Objective`,error:n(`objective`),children:n=>(0,Z.jsx)(P,{...n,minRows:4,value:e.objective,onChange:e=>t(`objective`,e.target.value)})}),(0,Z.jsx)(M,{label:`Acceptance criteria`,error:n(`criteria`),hint:`One criterion per line.`,optional:!0,children:n=>(0,Z.jsx)(P,{...n,minRows:3,value:e.criteria,onChange:e=>t(`criteria`,e.target.value)})}),(0,Z.jsx)(M,{label:`Priority`,error:n(`priority`),children:n=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(se,{priority:e.priority}),(0,Z.jsx)(k,{...n,value:e.priority,onChange:e=>t(`priority`,e),className:`sm:max-w-48`})]})})]})}function pt({legend:e,value:t,options:r,onChange:i,hint:a}){let o=(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:r.map(e=>(0,Z.jsxs)(`label`,{className:n(`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:o,value:e.value,checked:t===e.value,onChange:()=>i(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))}),a&&(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:a})]})}function mt({draft:e,update:t,err:n,hosts:r,profiles:i,defaultHostName:a,defaultProfileName:o,selectedProfileMissing:s}){return(0,Z.jsxs)(z,{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)(M,{label:`Host`,error:n(`hostId`),children:n=>(0,Z.jsxs)(B,{...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)(M,{label:`Profile`,error:n(`profileId`),hint:s?`The selected profile is no longer available.`:void 0,children:n=>(0,Z.jsxs)(B,{...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)(pt,{legend:`Mode`,value:e.mode,options:Me,onChange:e=>t(`mode`,e)}),(0,Z.jsx)(M,{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)(F,{...n,value:e.groupingKey,onChange:e=>t(`groupingKey`,e.target.value),className:`font-mono`,autoCapitalize:`off`,spellCheck:!1})})]})}function ht({draft:e,update:t}){let n=e.triggerKind===`cron`||e.triggerKind===`once`;return(0,Z.jsxs)(z,{stack:!0,title:`Overlap and missed runs`,children:[(0,Z.jsx)(pt,{legend:`When previous work is still open`,value:e.overlap,options:Pe,onChange:e=>t(`overlap`,e)}),(0,Z.jsx)(pt,{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 gt({draft:e,update:t,err:n}){return(0,Z.jsxs)(z,{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)(M,{label:`Automatic continuation`,children:n=>(0,Z.jsx)(V,{...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)(M,{label:`Continuation objective`,error:n(`continuationObjective`),hint:`What the agent must achieve before it reports done.`,children:n=>(0,Z.jsx)(P,{...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)(M,{label:`Max continuations`,error:n(`maxContinuations`),hint:`1–50`,children:n=>(0,Z.jsx)(F,{...n,type:`number`,inputMode:`numeric`,min:1,max:50,step:1,value:e.maxContinuations,onChange:e=>t(`maxContinuations`,e.target.value)})}),(0,Z.jsx)(M,{label:`Max elapsed minutes`,error:n(`maxElapsedMinutes`),hint:`1–1440`,children:n=>(0,Z.jsx)(F,{...n,type:`number`,inputMode:`numeric`,min:1,max:1440,step:1,value:e.maxElapsedMinutes,onChange:e=>t(`maxElapsedMinutes`,e.target.value)})}),(0,Z.jsx)(M,{label:`Continuation budget: tokens`,optional:!0,error:n(`maxTokens`),children:n=>(0,Z.jsx)(F,{...n,type:`number`,inputMode:`numeric`,min:1,step:1,value:e.maxTokens,onChange:e=>t(`maxTokens`,e.target.value)})}),(0,Z.jsx)(M,{label:`Continuation budget: cost (USD)`,optional:!0,error:n(`maxCostUsd`),children:n=>(0,Z.jsx)(F,{...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:N})]})]})}function _t({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)(z,{stack:!0,title:`Review`,children:[(0,Z.jsx)(M,{label:`Checks`,optional:!0,error:n(`checks`),hint:`One command per line. Leave empty to use ${i}.`,children:n=>(0,Z.jsx)(P,{...n,minRows:2,value:e.checks,onChange:e=>t(`checks`,e.target.value),className:`font-mono`,spellCheck:!1,autoCapitalize:`off`})}),(0,Z.jsx)(M,{label:`Human review`,hint:`When on, finished work waits in Review for you instead of completing on passing checks.`,children:n=>(0,Z.jsx)(V,{...n,checked:e.requireHumanReview,onChange:e=>t(`requireHumanReview`,e),label:`Require human review`,onText:`Required`,offText:`Not required`,className:`self-start`})})]})}export{tt as default};
2
- //# sourceMappingURL=AutomationView-X-U6Fpm7.js.map
@@ -1,2 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function ne(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=j(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(ne(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function re(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ie=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ae(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,ie)}catch(e){ie(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function oe(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ae(oe.bind(null,e))}var se={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=se,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=oe,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ee.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ee.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:re}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ae,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,p=/^[\\/]{2}/;function m(e,t){return t+e.replace(/\\/g,`/`)}var h=`popstate`;function g(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function _(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return S(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:C(t)}return T(t,n,null,e)}function v(e,t){if(e===!1||e==null)throw Error(t)}function y(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function b(){return Math.random().toString(36).substring(2,10)}function x(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function S(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?w(t):t,state:n,key:t&&t.key||r||b(),mask:i}}function C({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function w(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function T(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:_.location,delta:t})}function f(e,t){s=`PUSH`;let r=g(e)?e:S(_.location,e,t);n&&n(r,e),l=u()+1;let d=x(r,l),f=_.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:_.location,delta:1})}function p(e,t){s=`REPLACE`;let r=g(e)?e:S(_.location,e,t);n&&n(r,e),l=u();let i=x(r,l),d=_.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:_.location,delta:0})}function m(e){return ee(i,e)}let _={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(h,d),c=e,()=>{i.removeEventListener(h,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return _}function ee(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),v(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:C(t);return i=i.replace(/ $/,`%20`),!n&&p.test(i)&&(i=r+i),new URL(i,r)}var E=l(d(),1);function te(e,t,n=`/`){return D(e,t,n,!1)}function D(e,t,n,r,i){let a=P((typeof t==`string`?w(t):t).pathname||`/`,n);if(a==null)return null;let o=i??O(e),s=null,c=he(a);for(let e=0;s==null&&e<o.length;++e)s=fe(o[e],c,r);return s}function O(e){let t=k(e);return ne(t),t}function k(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;v(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=F([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(v(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),k(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:ue(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=me(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of A(e.path))a(e,t,!0,n)}),t}function A(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=A(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ne(e){e.sort((e,t)=>e.score===t.score?de(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var j=/^:[\w-]+$/,M=/^:[\w-]+/,re=3.5,ie=3,ae=2,oe=1,se=10,ce=-2,le=e=>e===`*`;function ue(e,t){let n=e.split(`/`),r=n.length;return n.some(le)&&(r+=ce),t&&(r+=ae),n.filter(e=>!le(e)).reduce((e,t)=>e+(j.test(t)?ie:M.test(t)?re:t===``?oe:se),r)}function de(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function fe(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?pe(u,l,s.matcher,s.compiledParams):N(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=N({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:F([a,d.pathname]),pathnameBase:Ce(F([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=F([a,d.pathnameBase]))}return o}function N(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=me(e.path,e.caseSensitive,e.end);return pe(e,t,n,r)}function pe(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=I(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=I(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function me(e,t=!1,n=!0){y(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/((?:[^/?()[\]*^\\]|\\.)+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function he(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return y(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function P(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function ge(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?w(e):e,a;return n?(n=Se(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?_e(n.substring(1),`/`):_e(n,t)):a=t,{pathname:a,search:we(r),hash:Te(i)}}function _e(e,t){let n=I(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ve(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ye(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function be(e){let t=ye(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function xe(e,t,n,r=!1){let i;typeof e==`string`?i=w(e):(i={...e},v(!i.pathname||!i.pathname.includes(`?`),ve(`?`,`pathname`,`search`,i)),v(!i.pathname||!i.pathname.includes(`#`),ve(`#`,`pathname`,`hash`,i)),v(!i.search||!i.search.includes(`#`),ve(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=ge(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Se=e=>e.replace(/[\\/]{2,}/g,`/`),F=e=>Se(e.join(`/`));function I(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Ce=e=>I(e).replace(/^\/*/,`/`),we=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Te=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ee=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function De(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Oe(e){return F(e.map(e=>e.route.path).filter(Boolean))||`/`}var ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ae(e,t){let n=e;if(typeof n!=`string`||!f.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ke)try{let e=new URL(window.location.href),r=p.test(n)?new URL(m(n,e.protocol)):new URL(n),a=P(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{y(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var je=new URL(`http://localhost`);function Me(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),je)}catch{return je}}function Ne(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Pe(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function Fe(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Ne(i,n),s=!Ne(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Pe(e,i)||!Ne(i,a)))throw Error(`External navigation is not allowed`)}var Ie=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Ie);var Le=[`GET`,...Ie];new Set(Le);var Re=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function ze(e){try{return Re.includes(new URL(e).protocol)}catch{return!1}}var L=E.createContext(null);L.displayName=`DataRouter`;var Be=E.createContext(null);Be.displayName=`DataRouterState`;var Ve=E.createContext(null);Ve.displayName=`DataRouterData`;var He=E.createContext(null);He.displayName=`DataRouterNavigation`;var Ue=E.createContext(!1);function We(){return E.useContext(Ue)}var Ge=E.createContext({isTransitioning:!1});Ge.displayName=`ViewTransition`;var Ke=E.createContext(null);Ke.displayName=`Fetchers`;var qe=E.createContext(null);qe.displayName=`Await`;var R=E.createContext(null);R.displayName=`Navigation`;var z=E.createContext(null);z.displayName=`Location`;var B=E.createContext({outlet:null,matches:[],isDataRoute:!1});B.displayName=`Route`;var V=E.createContext(!1);V.displayName=`IsDataRoute`;var H=E.createContext(void 0);H.displayName=`RouteId`;var Je=E.createContext(null);Je.displayName=`RouteError`;var Ye=`REACT_ROUTER_ERROR`,Xe=`REDIRECT`,Ze=`ROUTE_ERROR_RESPONSE`;function Qe(e){if(e.startsWith(`${Ye}:${Xe}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function $e(e){if(e.startsWith(`${Ye}:${Ze}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ee(t.status,t.statusText,t.data)}catch{}}function et(e,{relative:t}={}){v(U(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=E.useContext(R),{hash:i,pathname:a,search:o}=K(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:F([n,a])),r.createHref({pathname:s,search:o,hash:i})}function U(){return E.useContext(z)!=null}function W(){return v(U(),`useLocation() may be used only in the context of a <Router> component.`),E.useContext(z).location}function tt(e){v(U(),`useMatch() may be used only in the context of a <Router> component.`);let{pathname:t}=W();return E.useMemo(()=>N(e,he(t)),[t,e])}var nt=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function G(){return E.useContext(V)?xt():rt()}function rt(){v(U(),`useNavigate() may be used only in the context of a <Router> component.`);let e=E.useContext(L),{basename:t,navigator:n}=E.useContext(R),{matches:r}=E.useContext(B),{pathname:i}=W(),a=JSON.stringify(be(r)),o=E.useRef(!1);return E.useLayoutEffect(()=>{o.current=!0}),E.useCallback((r,s={})=>{if(y(o.current,nt),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=xe(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:F([t,c.pathname])),Fe(typeof r==`string`?r:C(r),n.createHref(c),Me(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var it=E.createContext(null);function at(e){let t=E.useContext(B).outlet;return E.useMemo(()=>t&&E.createElement(it.Provider,{value:e},t),[t,e])}function ot(){let{matches:e}=E.useContext(B);return e[e.length-1]?.params??{}}function K(e,{relative:t}={}){let{matches:n}=E.useContext(B),{pathname:r}=W(),i=JSON.stringify(be(n));return E.useMemo(()=>xe(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function st(e,t){return ct(e,t)}function ct(e,t,n){v(U(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=E.useContext(R),{matches:i}=E.useContext(B),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=W(),l;if(t){let e=typeof t==`string`?w(t):t;v(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f;f=n?n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):n.router.match(n.state.location):te(e,{pathname:d});let p=ht(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:F([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:F([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?E.createElement(z.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function lt(){let e=bt(),t=De(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return E.createElement(E.Fragment,null,E.createElement(`h2`,null,`Unexpected Application Error!`),E.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?E.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var ut=E.createElement(lt,null),dt=class extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=Ue;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=$e(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:E.createElement(B.Provider,{value:this.props.routeContext},E.createElement(V.Provider,{value:this.props.routeContext.isDataRoute},E.createElement(H.Provider,{value:this.props.routeContext.matches[this.props.routeContext.matches.length-1]?.route.id},E.createElement(Je.Provider,{value:e,children:this.props.component}))));return this.context?E.createElement(pt,{error:e},t):t}},ft=new WeakMap;function pt({children:e,error:t}){let{basename:n,navigator:r}=E.useContext(R);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Qe(t.digest);if(e){let i=ft.get(t);if(i)throw i;let a=Ae(e.location,n),o=a.absoluteURL||a.to;if(Fe(e.location,o,Me(r),`allow-explicit`),ze(o))throw Error(`Invalid redirect location`);if(ke&&!ft.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw ft.set(t,n),n}}return E.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function mt({routeContext:e,match:t,children:n}){let r=E.useContext(L);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(B.Provider,{value:e},E.createElement(V.Provider,{value:e.isDataRoute},E.createElement(H.Provider,{value:t.route.id},n)))}function ht(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);v(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Oe(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||ut,o&&(s<0&&c===0?(Ct(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?E.createElement(n.route.Component,null):n.route.element?n.route.element:e,E.createElement(mt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?E.createElement(dt,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function q(e){let t=E.useContext(L);return v(t,gt(e)),t}function _t(e){let t=E.useContext(Be);return v(t,gt(e)),t}function vt(e){let t=E.useContext(Ve);return v(t,gt(e)),t}function yt(e){let t=E.useContext(H);return v(t,`${e} can only be used on routes that contain a unique "id"`),t}function bt(){let e=E.useContext(Je),t=vt(`useRouteError`),n=yt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function xt(){let{router:e}=q(`useNavigate`),t=yt(`useNavigate`),n=E.useRef(!1);return E.useLayoutEffect(()=>{n.current=!0}),E.useCallback(async(r,i={})=>{y(n.current,nt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var St={};function Ct(e,t,n){!t&&!St[e]&&(St[e]=!0,y(!1,n))}function wt(e,t){if(e===!1||e==null)throw Error(t)}function Tt(e,t,n){let r=typeof e==`string`?new URL(e,n??(typeof window>`u`?`server://singlefetch/`:window.location.origin)):new URL(e);return n&&r.origin!==n&&(r=new URL(r.pathname+r.search+r.hash,n)),r.pathname.endsWith(`/`)?r.pathname=`${r.pathname}_.${t}`:r.pathname=`${r.pathname}.${t}`,r}async function Et(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Dt(e){return e!=null&&typeof e.page==`string`}function Ot(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function kt(e,t,n){return Pt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Et(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ot).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function At(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function jt(e,t,{includeHydrateFallback:n}={}){return Mt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Mt(e){return[...new Set(e)]}function Nt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Pt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Dt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Nt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}var J=E.createContext(void 0);J.displayName=`FrameworkContext`;function Y(){let e=E.useContext(J);return wt(e,`You must render this element inside a <HydratedRouter> element`),e}function Ft(e,t){let n=E.useContext(J),[r,i]=E.useState(!1),[a,o]=E.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=E.useRef(null);E.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),E.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:X(s,p),onBlur:X(c,m),onMouseEnter:X(l,p),onMouseLeave:X(u,m),onTouchStart:X(d,p)}]:[a,f,{}]:[!1,f,{}]}function X(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function It({page:e,...t}){let n=We(),{nonce:r}=Y(),{router:i}=q(`PrefetchPageLinks`),a=E.useMemo(()=>i.match(e),[i,i.routes,e]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?E.createElement(Rt,{page:e,matches:a,...t}):E.createElement(zt,{page:e,matches:a,...t})):null}function Lt(e){let{manifest:t,routeModules:n}=Y(),[r,i]=E.useState([]);return E.useEffect(()=>{let r=!1;return kt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Rt({page:e,matches:t,...n}){let r=W(),{unstable_apiServerOrigin:i}=Y(),a=E.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Tt(e,`rsc`,i),a=!1,o=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?a=!0:o.push(e.route.id);return a&&o.length>0&&n.searchParams.set(`_routes`,o.join(`,`)),[i?n.toString():n.pathname+n.search]},[e,r,t,i]);return E.createElement(E.Fragment,null,a.map(e=>E.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function zt({page:e,matches:t,...n}){let r=W(),{manifest:i,routeModules:a,unstable_apiServerOrigin:o}=Y(),{matches:s}=_t(`PrefetchPageLinks`),{loaderData:c}=vt(`PrefetchPageLinks`),l=E.useMemo(()=>At(e,t,s,i,r,`data`),[e,t,s,i,r]),u=E.useMemo(()=>At(e,t,s,i,r,`assets`),[e,t,s,i,r]),d=E.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!l.some(t=>t.route.id===e.route.id)&&e.route.id in c&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=Tt(e,`data`,o);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[o?u.toString():u.pathname+u.search]},[c,r,i,l,t,e,a,o]),f=E.useMemo(()=>jt(u,i),[u,i]),p=Lt(u);return E.createElement(E.Fragment,null,d.map(e=>E.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>E.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),p.map(({key:e,link:t})=>E.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Bt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}E.memo(Vt);function Vt({routes:e,manifest:t,state:n,isStatic:r,onError:i}){let a=E.useContext(L);v(a,`You must render this element inside a <DataRouterContext.Provider> element`);let o=E.useContext(J)?.routeDiscoveryRuntime;return E.useEffect(()=>{n.initialized&&o?.markReady()},[n.initialized,o]),ct(e,void 0,{router:a.router,manifest:t,state:n,isStatic:r,onError:i})}function Ht({to:e,replace:t,state:n,relative:r}){v(U(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=E.useContext(R);y(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=E.useContext(B),{pathname:s}=W(),c=G(),l=xe(e,be(o),s,r===`path`);Fe(typeof e==`string`?e:C(e),a.createHref(l),Me(a),`reject`);let u=JSON.stringify(l);return E.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function Ut(e){return at(e.context)}function Wt(e){v(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Gt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){v(!U(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=E.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=w(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=E.useMemo(()=>{let e=P(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return y(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:E.createElement(R.Provider,{value:c},E.createElement(z.Provider,{children:t,value:h}))}function Kt({children:e,location:t}){return st(qt(e),t)}E.Component;function qt(e,t=[]){let n=[];return E.Children.forEach(e,(e,r)=>{if(!E.isValidElement(e))return;let i=[...t,r];if(e.type===E.Fragment){n.push.apply(n,qt(e.props.children,i));return}v(e.type===Wt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;v(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=qt(a.children,i)),n.push(o)}),n}var Z=`application/x-www-form-urlencoded`;function Jt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Yt(e){return Jt(e)&&e.tagName.toLowerCase()===`button`}function Xt(e){return Jt(e)&&e.tagName.toLowerCase()===`form`}function Zt(e){return Jt(e)&&e.tagName.toLowerCase()===`input`}function Qt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $t(e,t){return e.button===0&&(!t||t===`_self`)&&!Qt(e)}function en(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function tn(e,t){let n=en(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var nn=null;function rn(){if(nn===null)try{new FormData(document.createElement(`form`),0),nn=!1}catch{nn=!0}return nn}var an=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function on(e){return e!=null&&!an.has(e)?(y(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Z}"`),null):e}function sn(e,t){let n,r,i,a,o;if(Xt(e)){let o=e.getAttribute(`action`);r=o?P(o,t):null,n=e.getAttribute(`method`)||`get`,i=on(e.getAttribute(`enctype`))||Z,a=new FormData(e)}else if(Yt(e)||Zt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?P(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=on(e.getAttribute(`formenctype`))||on(o.getAttribute(`enctype`))||Z,a=new FormData(o,e),!rn()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Jt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=Z,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}var cn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{cn&&(window.__reactRouterVersion=`8`)}catch{}function ln({basename:e,children:t,useTransitions:n,window:r}){let i=E.useRef(null);i.current??=_({window:r,v5Compat:!0});let a=i.current,[o,s]=E.useState({action:a.action,location:a.location}),c=E.useCallback(e=>{n===!1?s(e):E.startTransition(()=>s(e))},[n]);return E.useLayoutEffect(()=>a.listen(c),[a,c]),E.createElement(Gt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var un=E.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,useTransitions:v}=E.useContext(R),y=typeof l==`string`&&f.test(l),b=Ae(l,g);l=b.to;let x=et(l,{relative:r}),S=W(),C=null;if(o){let e=xe(o,[],S.mask?S.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:F([g,e.pathname])),C=_.createHref(e)}let[w,T,ee]=Ft(n,m),te=pn(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:p,useTransitions:v});function D(t){e&&e(t),t.defaultPrevented||te(t)}let O=!(b.isExternal||i),k=E.createElement(`a`,{...m,...ee,href:(O?C:void 0)||b.absoluteURL||x,onClick:O?D:e,ref:Bt(h,T),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return w&&!y?E.createElement(E.Fragment,null,k,E.createElement(It,{page:x})):k});un.displayName=`Link`;var dn=E.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=K(a,{relative:c.relative}),d=W(),f=E.useContext(He),{navigator:p,basename:m}=E.useContext(R),h=f!=null&&yn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f?.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=P(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return E.createElement(un,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});dn.displayName=`NavLink`;var fn=E.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=E.useContext(R),_=_n(),v=vn(s,{relative:l}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof s==`string`&&f.test(s);return E.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,f=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:p});g&&n!==!1?E.startTransition(()=>f()):f()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});fn.displayName=`Form`;function pn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=G(),d=W(),f=K(e,{relative:o});return E.useCallback(p=>{if($t(p,t)){p.preventDefault();let t=n===void 0?C(d)===C(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?E.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function mn(e){y(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=E.useRef(en(e)),n=E.useRef(!1),r=W(),i=E.useMemo(()=>tn(r.search,n.current?null:t.current),[r.search]),a=G();return[i,E.useCallback((e,t)=>{let r=en(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var hn=0,gn=()=>`__${String(++hn)}__`;function _n(){let{router:e}=q(`useSubmit`),{basename:t}=E.useContext(R),n=yt(`useSubmit`),r=e.fetch,i=e.navigate;return E.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=sn(e,t);a.navigate===!1?await r(a.fetcherKey||gn(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,relative:a.relative,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function vn(e,{relative:t}={}){let{basename:n}=E.useContext(R),r=E.useContext(B);v(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...K(e||`.`,{relative:t})},o=W();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:F([n,a.pathname])),C(a)}function yn(e,{relative:t}={}){let n=E.useContext(Ge);v(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=q(`useViewTransitionState`),i=K(e,{relative:t});if(!n.isTransitioning)return!1;let a=P(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=P(n.nextLocation.pathname,r)||n.nextLocation.pathname;return N(i.pathname,o)!=null||N(i.pathname,a)!=null}var bn=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},xn=(e=>e?bn(e):bn),Sn=e=>e;function Cn(e,t=Sn){let n=E.useSyncExternalStore(e.subscribe,E.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return E.useDebugValue(n),n}var wn=e=>{let t=xn(e),n=e=>Cn(t,e);return Object.assign(n,t),n},Tn=(e=>e?wn(e):wn),En=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function Dn(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:En(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var On=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},kn=e=>{let t=On(e);return t.charAt(0).toUpperCase()+t.slice(1)},An=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Q={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function jn(e){return e!=null}function Mn(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??Q.width,a=e.size??e.height??Q.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?An(...c):An(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??Q[`stroke-width`])*Number(e.size??e.width??Q.width)/Number(t.size??t.width??Q.width):t.strokeWidth??Q[`stroke-width`];return[`svg`,{...Object.entries(Q).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&jn(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&jn(t.width)&&{[r(`width`)]:t.width},...`height`in t&&jn(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function Nn(e,t={}){return Mn(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var Pn=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Fn=(0,E.createContext)({}),In=()=>(0,E.useContext)(Fn),Ln=(0,E.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=In()??{},y=!!c||Pn(d),[b,x,S=[]]=Nn(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:An(v,s),hasA11yProp:y,attributes:d});return(0,E.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,E.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function Rn(e,t=[],n=[]){let r=typeof e==`string`?Dn(e,t,n):e,i=(0,E.forwardRef)(({className:e,...t},n)=>(0,E.createElement)(Ln,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=kn(r.name)),i}function zn(...e){return e.filter(Boolean).join(` `)}var Bn=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Vn=o(((e,t)=>{t.exports=Bn()})),$=Vn();function Hn({className:e,label:t}){return(0,$.jsxs)(`svg`,{className:zn(`size-4 shrink-0 animate-spin`,e),viewBox:`0 0 24 24`,fill:`none`,role:t?`img`:void 0,"aria-label":t,"aria-hidden":!t||void 0,children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`currentColor`,strokeOpacity:`0.25`,strokeWidth:`3`}),(0,$.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`})]})}var Un={primary:`bg-accent text-accent-fg border-accent hover:bg-accent-hover hover:border-accent-hover`,secondary:`bg-surface text-text border-border hover:bg-surface-2`,ghost:`bg-transparent text-text border-transparent hover:bg-surface-2`,danger:`bg-danger text-danger-fg border-danger hover:bg-danger-hover hover:border-danger-hover`},Wn={sm:`h-8 px-2.5 text-sm gap-1.5`,md:`h-9 px-3.5 text-sm gap-2`};function Gn(e=`secondary`,t=`md`,n){return zn(`tap inline-flex items-center justify-center rounded-md border font-medium whitespace-nowrap select-none`,`transition-colors disabled:opacity-55 disabled:pointer-events-none`,Un[e],Wn[t],n)}var Kn=(0,E.forwardRef)(function({variant:e=`secondary`,size:t=`md`,icon:n,busy:r,block:i,className:a,children:o,disabled:s,type:c,...l},u){return(0,$.jsxs)(`button`,{ref:u,type:c??`button`,disabled:s||r,"aria-busy":r||void 0,className:Gn(e,t,zn(i&&`w-full`,a)),...l,children:[r?(0,$.jsx)(Hn,{}):n,o]})});export{l as S,G as _,zn as a,o as b,ln as c,Ht as d,Ut as f,tt as g,W as h,Vn as i,un as l,Kt as m,Gn as n,Rn as o,Wt as p,Hn as r,Tn as s,Kn as t,mn as u,ot as v,s as x,d as y};
2
- //# sourceMappingURL=Button-BKQW9doW.js.map