@kky42/pievo-server 1.0.1 → 2.0.1

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 (86) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{LoopView-d0XYkzpx.js → LoopView-XXW59HAV.js} +3 -3
  3. package/.output/public/assets/{Modal-D_od-AuP.js → Modal-BnCPgN_k.js} +1 -1
  4. package/.output/public/assets/{SignIn-CbMeIAJZ.js → SignIn-BAoOONQ9.js} +1 -1
  5. package/.output/public/assets/{actionUi-ChGGALzg.js → actionUi-Dxe9cHAc.js} +1 -1
  6. package/.output/public/assets/app-Cr02jQtI.css +2 -0
  7. package/.output/public/assets/index-Dg07vo1l.js +12 -0
  8. package/.output/public/assets/{invite._token-DJtd-XE2.js → invite._token-BAqaXvte.js} +1 -1
  9. package/.output/public/assets/{invite._token-CnyCmLfD.js → invite._token-DclJQM6f.js} +1 -1
  10. package/.output/public/assets/{lifecycleUi-DGVOf5yS.js → lifecycleUi-B8Je9exd.js} +1 -1
  11. package/.output/public/assets/loops._loopId-vRXeqe7u.js +4 -0
  12. package/.output/public/assets/{loops._loopId_.runs._runId-DTwSFHkl.js → loops._loopId_.runs._runId-Cz3Z0VE_.js} +2 -2
  13. package/.output/public/assets/notifyFns-BDwtMV1G.js +1 -0
  14. package/.output/public/assets/{routes-CTtlM_qt.js → routes-C7Pw5lGn.js} +1 -1
  15. package/.output/public/assets/{routes-G3WYRyPN.js → routes-DPWJg52d.js} +1 -1
  16. package/.output/public/assets/{t._teamId-CGv7Oq6A.js → t._teamId-BW5yIkA-.js} +1 -1
  17. package/.output/public/assets/{t._teamId-gR7BVKkR.js → t._teamId-CCgajlMS.js} +1 -1
  18. package/.output/public/assets/ui-RFP3R3lU.js +1 -0
  19. package/.output/server/_ssr/{CodeField-tm4rr6G3.mjs → CodeField-B7oOmmwH.mjs} +3 -3
  20. package/.output/server/_ssr/{DashboardView-CmDqjCiq.mjs → DashboardView-DJlDpXxU.mjs} +13 -10
  21. package/.output/server/_ssr/{LoopPlaybook-BBn-xXpG.mjs → LoopPlaybook-BxKPoWAp.mjs} +2 -2
  22. package/.output/server/_ssr/{LoopView-DdyJYOCY.mjs → LoopView-B0AwFjwS.mjs} +4 -4
  23. package/.output/server/_ssr/{Modal-DpKZHLZK.mjs → Modal-CfWC9R49.mjs} +2 -2
  24. package/.output/server/_ssr/{SignIn-RJN_0GFZ.mjs → SignIn-C1duN7oy.mjs} +3 -3
  25. package/.output/server/_ssr/{actionUi-CZbEixbf.mjs → actionUi-mDYOvJdB.mjs} +2 -2
  26. package/.output/server/_ssr/{adapters-CJUhP66K.mjs → adapters-C10CmWK4.mjs} +4 -5
  27. package/.output/server/_ssr/{artifactFiles-zP43a-_v.mjs → artifactFiles-uxLErS_7.mjs} +3 -3
  28. package/.output/server/_ssr/artifacts-Dnvoxi-_.mjs +2 -0
  29. package/.output/server/_ssr/{auth-D2SlCxwE.mjs → auth-C6uZpC6v.mjs} +9 -9
  30. package/.output/server/_ssr/{boot-aI3l2EYT.mjs → boot-BpqTI96x.mjs} +119 -280
  31. package/.output/server/_ssr/{boot-BHTcCXzm.mjs → boot-C-47Ycr2.mjs} +1 -1
  32. package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-B-3PhI3u.mjs → bun-sqlite-dialect-BW9W1_Ps-DlRsM3s1.mjs} +2 -2
  33. package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-Dm_NrETM.mjs → d1-sqlite-dialect-BLC8LXE6-Ct-4mGlC.mjs} +2 -2
  34. package/.output/server/_ssr/db-DB8pQ07M.mjs +2 -0
  35. package/.output/server/_ssr/{dist-DW3TO9NM.mjs → dist-lkoxB9C9.mjs} +2 -2
  36. package/.output/server/_ssr/{factory-Voe90MEY.mjs → factory-D73dkxmb.mjs} +2 -2
  37. package/.output/server/_ssr/{invite._token-DJxGLILJ.mjs → invite._token-23daBIfe.mjs} +2 -2
  38. package/.output/server/_ssr/{invite._token-CeD9PCvh.mjs → invite._token-C80Kxhqw.mjs} +5 -5
  39. package/.output/server/_ssr/{invite._token-D80GP0-u.mjs → invite._token-D-KuiRD1.mjs} +4 -4
  40. package/.output/server/_ssr/{kysely-adapter-DSLWmYjO.mjs → kysely-adapter-YDb9pnV-.mjs} +1 -1
  41. package/.output/server/_ssr/{lifecycleUi-BhRsBvJ7.mjs → lifecycleUi-l3nx9i3T.mjs} +3 -3
  42. package/.output/server/_ssr/logger-Dhuet6zm.mjs +2 -0
  43. package/.output/server/_ssr/{loopApi-ByX_X17-.mjs → loopApi-BXHLHlt_.mjs} +12 -13
  44. package/.output/server/_ssr/{loops._loopId-u8Dr2J5f.mjs → loops._loopId-BVPj6kiH.mjs} +3 -3
  45. package/.output/server/_ssr/{loops._loopId-BODmoHPu.mjs → loops._loopId-DVG3dDvp.mjs} +16 -40
  46. package/.output/server/_ssr/{loops._loopId_.runs._runId-DaKJdso2.mjs → loops._loopId_.runs._runId-Db6cTcUT.mjs} +6 -6
  47. package/.output/server/_ssr/{loops._loopId_.runs._runId-kGL-CMG6.mjs → loops._loopId_.runs._runId-DbEF9MQu.mjs} +3 -3
  48. package/.output/server/_ssr/{machineFns-MMSoHs7N.mjs → machineFns-B1ZLIrOn.mjs} +3 -3
  49. package/.output/server/_ssr/{node-sqlite-dialect-Y22MTyEv.mjs → node-sqlite-dialect-01BHn7am.mjs} +2 -2
  50. package/.output/server/_ssr/{notifyFns-Bmqhlrkc.mjs → notifyFns-CM35mqF2.mjs} +3 -3
  51. package/.output/server/_ssr/{notifyFns-CdrijMGW.mjs → notifyFns-qZ6FYwAL.mjs} +6 -5
  52. package/.output/server/_ssr/{router-CdxedJtm.mjs → router-B8W3-k_h.mjs} +30 -30
  53. package/.output/server/_ssr/{routes-ROFun1nJ.mjs → routes-BiAkIPos.mjs} +5 -5
  54. package/.output/server/_ssr/{routes-Bcs4T1ox.mjs → routes-DjaTMZqZ.mjs} +2 -2
  55. package/.output/server/_ssr/{routes-Bhay1OjL.mjs → routes-hr1KuV9-.mjs} +5 -5
  56. package/.output/server/_ssr/{runDiff-DWwt7qXb.mjs → runDiff-CyN5ZR5F.mjs} +2 -2
  57. package/.output/server/_ssr/ssr.mjs +48 -48
  58. package/.output/server/_ssr/store-DUMLJS0E.mjs +2 -0
  59. package/.output/server/_ssr/{t._teamId-CGba9PRq.mjs → t._teamId-B9E7Vgt3.mjs} +5 -5
  60. package/.output/server/_ssr/{t._teamId-DTKU7GOp.mjs → t._teamId-CxuiffZZ.mjs} +5 -5
  61. package/.output/server/_ssr/{t._teamId-Dy_McbRt.mjs → t._teamId-D_vi_OuG.mjs} +2 -2
  62. package/.output/server/_ssr/{teamFns-BMDqynoT.mjs → teamFns-DKpLbIiB.mjs} +3 -3
  63. package/.output/server/_ssr/{tokens-BHjz7Lvx.mjs → tokens-DuV-D_RB.mjs} +1 -1
  64. package/.output/server/_ssr/{ui-Dej2qjuS.mjs → ui-WGITbP6Z.mjs} +72 -51
  65. package/.output/server/{_tanstack-start-manifest_v-BwejIUux.mjs → _tanstack-start-manifest_v-ClkHkr-O.mjs} +25 -25
  66. package/.output/server/drizzle/0011_steep_marvel_zombies.sql +3 -0
  67. package/.output/server/drizzle/0012_blocked_run_status.sql +12 -0
  68. package/.output/server/drizzle/0013_drop_run_outcome.sql +2 -0
  69. package/.output/server/drizzle/meta/0011_snapshot.json +1872 -0
  70. package/.output/server/drizzle/meta/_journal.json +21 -0
  71. package/.output/server/index.mjs +106 -106
  72. package/drizzle/0011_steep_marvel_zombies.sql +3 -0
  73. package/drizzle/0012_blocked_run_status.sql +12 -0
  74. package/drizzle/0013_drop_run_outcome.sql +2 -0
  75. package/drizzle/meta/0011_snapshot.json +1872 -0
  76. package/drizzle/meta/_journal.json +21 -0
  77. package/package.json +1 -1
  78. package/.output/public/assets/app-BKySt9Ta.css +0 -2
  79. package/.output/public/assets/index-C4UaIr-9.js +0 -12
  80. package/.output/public/assets/loops._loopId-DdWM2f1F.js +0 -5
  81. package/.output/public/assets/notifyFns-b_jCi5XK.js +0 -1
  82. package/.output/public/assets/ui-Dp88qUWh.js +0 -1
  83. package/.output/server/_ssr/artifacts-CwCDal_d.mjs +0 -2
  84. package/.output/server/_ssr/db-7gZ8_zkc.mjs +0 -2
  85. package/.output/server/_ssr/logger-Dbz2vUU-.mjs +0 -2
  86. package/.output/server/_ssr/store-D75hcTob.mjs +0 -2
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-ChGGALzg.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't open this invite.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
1
+ import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-Dxe9cHAc.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't open this invite.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
@@ -1 +1 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{a as r,c as i,p as a}from"./preload-helper-ycaoAemE.js";import{l as o}from"./ui-Dp88qUWh.js";import{c as s,n as c,s as l}from"./index-C4UaIr-9.js";import{t as u}from"./SignIn-CbMeIAJZ.js";var d=t(e()),f=n();function p({children:e}){return(0,f.jsxs)(`div`,{className:`mx-auto mt-32 max-w-sm text-center`,children:[(0,f.jsx)(r,{size:52}),(0,f.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold tracking-tight text-display`,children:`Team invite`}),e]})}function m(){let e=c.useLoaderData(),{data:t,isPending:n}=i(),r=a(),[m,h]=(0,d.useState)(`idle`),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(!1),y=e.auth.enabled,b=y?!!t:!1;return(0,d.useEffect)(()=>{!y||n||!b||v.current||(v.current=!0,h(`redeeming`),(async()=>{let t=await l({data:e.token});if(t.ok){s(t.teamId),r({to:`/t/$teamId`,params:{teamId:t.teamId}});return}_(t.error),h(`error`)})())},[y,n,b,e.token,r]),y?!n&&!b?(0,f.jsx)(u,{callbackURL:`/invite/${e.token}`}):m===`error`?(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-3 text-sm text-accent`,children:g}),(0,f.jsx)(`button`,{className:`${o} mt-6`,onClick:()=>void r({to:`/`}),children:`Go to the dashboard`})]}):(0,f.jsx)(p,{children:(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`Joining the team…`})}):(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`This Pievo server runs in open mode (a single shared workspace), so team invites don't apply here.`}),(0,f.jsx)(`button`,{className:`${o} mt-6`,onClick:()=>void r({to:`/`}),children:`Go to the dashboard`})]})}export{m as component};
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{a as r,c as i,p as a}from"./preload-helper-ycaoAemE.js";import{l as o}from"./ui-RFP3R3lU.js";import{c as s,n as c,s as l}from"./index-Dg07vo1l.js";import{t as u}from"./SignIn-BAoOONQ9.js";var d=t(e()),f=n();function p({children:e}){return(0,f.jsxs)(`div`,{className:`mx-auto mt-32 max-w-sm text-center`,children:[(0,f.jsx)(r,{size:52}),(0,f.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold tracking-tight text-display`,children:`Team invite`}),e]})}function m(){let e=c.useLoaderData(),{data:t,isPending:n}=i(),r=a(),[m,h]=(0,d.useState)(`idle`),[g,_]=(0,d.useState)(null),v=(0,d.useRef)(!1),y=e.auth.enabled,b=y?!!t:!1;return(0,d.useEffect)(()=>{!y||n||!b||v.current||(v.current=!0,h(`redeeming`),(async()=>{let t=await l({data:e.token});if(t.ok){s(t.teamId),r({to:`/t/$teamId`,params:{teamId:t.teamId}});return}_(t.error),h(`error`)})())},[y,n,b,e.token,r]),y?!n&&!b?(0,f.jsx)(u,{callbackURL:`/invite/${e.token}`}):m===`error`?(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-3 text-sm text-accent`,children:g}),(0,f.jsx)(`button`,{className:`${o} mt-6`,onClick:()=>void r({to:`/`}),children:`Go to the dashboard`})]}):(0,f.jsx)(p,{children:(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`Joining the team…`})}):(0,f.jsxs)(p,{children:[(0,f.jsx)(`p`,{className:`mt-2 text-sm text-secondary`,children:`This Pievo server runs in open mode (a single shared workspace), so team invites don't apply here.`}),(0,f.jsx)(`button`,{className:`${o} mt-6`,onClick:()=>void r({to:`/`}),children:`Go to the dashboard`})]})}export{m as component};
@@ -1 +1 @@
1
- var e="Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.";function t(e){if(e.deleteRequestedAt!=null)return`deleting`;if(e.completedAt!=null)return`completed`;let t=e.runs.find(e=>e.running);return!e.enabled&&t?.cancelRequested?`stopping`:!e.enabled&&(e.running||t)?`paused-finishing`:e.enabled?`active`:`paused`}function n(e){return e===2?{supported:!0,label:`Daemon protocol 2 · Stop supported`}:{supported:!1,label:`Daemon protocol ${e??`unknown`} · upgrade required`}}function r(n){let r=t(n.summary),i=n.summary.runs.find(e=>e.running);if(i&&n.machine.daemonProtocol!==2)return e;if(r===`stopping`&&i&&!n.machine.online)return`Stopping · waiting for ${n.machine.name||`machine`}`;switch(r){case`completed`:return`Completed`;case`deleting`:return`Deleting`;case`stopping`:return`Stopping`;case`paused-finishing`:return n.summary.pauseCause?.kind===`owner`?`Paused by owner · current run finishing`:`Paused · current run finishing`;case`paused`:return n.summary.pauseCause?.kind===`failure-streak`?`Paused automatically`:n.summary.pauseCause?.kind===`owner`?`Paused by owner`:`Paused`;case`active`:return`Active`}}export{r as i,n,t as r,e as t};
1
+ var e="Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.";function t(e){if(e.deleteRequestedAt!=null)return`deleting`;if(e.completedAt!=null)return`completed`;let t=e.runs.find(e=>e.running);return!e.enabled&&t?.cancelRequested?`stopping`:!e.enabled&&(e.running||t)?`paused-finishing`:e.enabled?`active`:`paused`}function n(e){return e===2?{supported:!0,label:`Daemon protocol 2 · Stop supported`}:{supported:!1,label:`Daemon protocol ${e??`unknown`} · upgrade required`}}function r(n){let r=t(n.summary),i=n.summary.runs.find(e=>e.running);if(i&&n.machine.daemonProtocol!==2)return e;if(r===`stopping`&&i&&!n.machine.online)return`Stopping · waiting for ${n.machine.name||`machine`}`;switch(r){case`completed`:return`Completed`;case`deleting`:return`Deleting`;case`stopping`:return`Stopping`;case`paused-finishing`:return n.summary.pauseCause?.kind===`blocked`?`Paused — blocked · current run finishing`:n.summary.pauseCause?.kind===`owner`?`Paused by owner · current run finishing`:`Paused · current run finishing`;case`paused`:return n.summary.pauseCause?.kind===`blocked`?`Paused — blocked`:n.summary.pauseCause?.kind===`failure-streak`?`Paused automatically`:n.summary.pauseCause?.kind===`owner`?`Paused by owner`:`Paused`;case`active`:return`Active`}}export{r as i,n,t as r,e as t};
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeField-dOzyFQNH.js","assets/jsx-runtime-BseJUIpC.js","assets/LoopView-XXW59HAV.js","assets/Modal-BnCPgN_k.js","assets/loopApi-5s2-kCnu.js","assets/ui-RFP3R3lU.js","assets/artifactView-DekEs5ME.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{S as r,_ as i,b as a,h as o,i as s,o as ee,r as c,u as l,v as u,x as d,y as te}from"./loopApi-5s2-kCnu.js";import{c as f,f as ne,p as re,t as ie}from"./preload-helper-ycaoAemE.js";import{a as ae,o as oe,r as se,s as ce}from"./notifyFns-BDwtMV1G.js";import{D as le,M as ue,N as de,O as fe,P as pe,S as p,T as m,_ as h,b as me,c as he,d as g,g as ge,i as _e,k as ve,l as ye,m as _,n as be,o as v,p as y,r as b,s as xe,t as Se,v as x,w as S,x as Ce}from"./ui-RFP3R3lU.js";import{i as we,n as Te,r as Ee,t as De}from"./lifecycleUi-B8Je9exd.js";import{c as Oe,r as C}from"./index-Dg07vo1l.js";import{a as ke,i as Ae,n as w,o as T,t as E}from"./artifactView-DekEs5ME.js";import{t as je}from"./SignIn-BAoOONQ9.js";import{i as Me,n as Ne,r as Pe,t as Fe}from"./actionUi-Dxe9cHAc.js";var D=t(e(),1);function Ie(e){if(!e)return null;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):null}function Le({loopId:e,loopName:t,instruction:n}){let r=n?.trim()||`Describe the change you want to make to this loop.`;return[`I want to adjust my Pievo loop "${t}" (loop id: ${e}).`,``,`The change I want:`,r,``,`Use the installed pievo CLI/skill to apply it: run \`pievo loops\` to find the loop, then \`pievo edit ${e} ...\` to make the change, and confirm the loop now reflects it. Ask me first if anything is unclear.`].join(`
3
+ `)}var O=n(),Re=e=>e.split(`/`).pop()||e;function ze(e){let t=e.match(/\.([a-z0-9]+)$/i);return t?t[1].toLowerCase():`file`}function Be({loopId:e,taskFile:t,taskFileContent:n,taskFileSyncedAt:r,running:i}){let[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(null),l=(0,D.useRef)(0),u=(0,D.useCallback)(async()=>{let t=++l.current;try{let n=await ee({data:{loopId:e}});t===l.current&&o(n)}catch{t===l.current&&o(e=>e??[])}},[e]);(0,D.useEffect)(()=>{o(null),c(null),u()},[e,u]),(0,D.useEffect)(()=>{let e=setInterval(()=>void u(),i?4e3:12e3);return()=>clearInterval(e)},[i,u]);let d=(0,D.useMemo)(()=>ke(t,a??[]),[t,a]),te=s&&d.some(e=>e.path===s)?s:d[0]?.path??null,f=d.find(e=>e.path===te)??null,ne=T(f);return(0,O.jsxs)(`section`,{id:`files`,className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,O.jsxs)(`h2`,{className:`text-label font-semibold text-secondary`,children:[`Files`,a?` (${d.length})`:``]}),(0,O.jsx)(`span`,{className:`text-caption font-medium text-disabled`,children:`Spec + synced artifacts`})]}),d.length===0?(0,O.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled shadow-card`,children:a==null?`Loading…`:`No files yet - the task file and synced artifacts appear here.`}):(0,O.jsxs)(`div`,{className:`grid h-[min(600px,68vh)] grid-cols-1 overflow-hidden rounded-card border border-hairline bg-surface shadow-card sm:grid-cols-[210px_1fr]`,children:[(0,O.jsx)(`nav`,{className:`max-h-44 overflow-y-auto border-b border-hairline sm:max-h-none sm:border-b-0 sm:border-r`,children:(0,O.jsx)(`ul`,{className:`py-1.5`,children:d.map(e=>{let t=e.path===te,n=T(e),r=!n&&e.kind===`artifact`?e.file.meta:null,i=r?.title?.trim()||``,a=i&&i!==Re(e.path)?i:Re(e.path),o=e.path.includes(`/`)||a!==Re(e.path);return(0,O.jsx)(`li`,{children:(0,O.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:`flex w-full items-center gap-2 border-l-2 px-3 py-2 text-left transition-colors ${t?`border-display bg-raised`:`border-transparent hover:bg-raised/60`}`,children:[(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`span`,{className:`block truncate font-mono text-label ${t?`text-display`:`text-primary`}`,title:e.path,children:a}),o&&(0,O.jsx)(`span`,{className:`block truncate font-mono text-micro text-disabled`,title:e.path,children:e.path})]}),n?(0,O.jsx)(`span`,{className:`shrink-0 rounded-full bg-interactive-soft px-2 text-caption font-medium text-interactive`,children:`Task`}):r?.type?(0,O.jsx)(`span`,{className:`shrink-0 truncate rounded-full bg-raised px-2 text-caption font-medium text-secondary`,title:`type: ${r.type}`,children:r.type}):(0,O.jsx)(`span`,{className:`shrink-0 font-mono text-micro text-disabled`,children:ze(e.path)})]})},e.path)})})}),(0,O.jsx)(`div`,{className:`min-w-0 overflow-y-auto`,children:ne&&f?(0,O.jsx)(k,{path:f.path,content:n,syncedAt:r}):f?.kind===`artifact`?(0,O.jsx)(A,{loopId:e,file:f.file}):null})]})]})}function k({path:e,content:t,syncedAt:n}){return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(w,{path:e,meta:n?`Task file · synced ${m(n)}`:`Task file`}),t==null?(0,O.jsx)(`div`,{className:`px-5 py-6 text-body text-disabled`,children:`(syncs from the machine on the next run)`}):(0,O.jsx)(Ae,{content:t})]})}function A({loopId:e,file:t}){let n=[t.size==null?``:le(t.size),`synced ${m(t.updatedAt)}`].filter(Boolean).join(` · `);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(w,{path:t.path,meta:n}),(0,O.jsx)(E,{loopId:e,file:t})]})}var Ve=[`claude-code`,`codex`];function j(e){return{executor:`claude`,workdir:e.workdir.trim(),model:e.model.trim(),reasoningEffort:e.reasoningEffort.trim(),allowControl:e.allowControl}}var M=(0,D.lazy)(()=>ie(()=>import(`./CodeField-dOzyFQNH.js`),__vite__mapDeps([0,1])));function N(e){let t=e?.exec;return{name:e?.name??``,cron:e?.cron??`0 */3 * * *`,scheduleMode:e?.scheduleMode??`cron`,continuousDelayMinutes:String(e?.continuousDelayMinutes??1),taskFile:e?.taskFile??``,notify:e?.notify??`auto`,channelId:e?.channelId??``,stateSchema:e?.stateSchema?JSON.stringify(e.stateSchema):``,ui:e?.ui??``,agent:e?.agent??`claude-code`,workdir:t?.workdir??``,model:t?.model??``,reasoningEffort:t?.reasoningEffort??``,allowControl:!!t?.allowControl}}var P=`mt-1 text-caption leading-snug text-disabled`,F={"claude-code":`Claude Code`,codex:`Codex`};function I({label:e,value:t,onChange:n,mono:r,ph:i,hint:a}){let o=(0,D.useId)();return(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`label`,{htmlFor:o,className:_,children:e}),(0,O.jsx)(`input`,{id:o,type:`text`,className:r?`${y} font-mono`:y,value:t,placeholder:i,onChange:e=>n(e.target.value)}),a&&(0,O.jsx)(`div`,{className:P,children:a})]})}function L({title:e,hint:t}){return(0,O.jsxs)(`div`,{className:`mb-1 mt-7 border-b border-hairline pb-1.5`,children:[(0,O.jsx)(`h2`,{className:h,children:e}),t&&(0,O.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function R({minHeight:e}){return(0,O.jsx)(`div`,{className:`rounded-control border border-wire bg-raised`,style:{minHeight:e}})}var He=(0,D.forwardRef)(function({initial:e,channels:t},n){let[r,i]=(0,D.useState)(()=>N(e)),a=(e,t)=>i(n=>({...n,[e]:t})),[o,s]=(0,D.useState)(null),[ee,c]=(0,D.useState)([]),l=t??ee;return(0,D.useEffect)(()=>{t||se().then(c).catch(()=>{})},[t]),(0,D.useImperativeHandle)(n,()=>({read(){let e,t=r.stateSchema.trim();if(t)try{e=JSON.parse(t)}catch{return s(`Not valid JSON - expected an array like [{"key":"mrr","label":"MRR","unit":"$"}]`),null}return{name:r.name.trim(),cron:r.cron.trim(),scheduleMode:r.scheduleMode,continuousDelayMinutes:Math.max(1,Number.parseInt(r.continuousDelayMinutes,10)||1),taskFile:r.taskFile.trim(),notify:r.notify,channelId:r.channelId||null,ui:r.ui.trim()||void 0,agent:r.agent,exec:j(r),stateSchema:e}}})),(0,O.jsxs)(`div`,{className:`grid gap-x-10 lg:grid-cols-[minmax(300px,380px)_minmax(0,1fr)]`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(L,{title:`Basics`}),(0,O.jsx)(I,{label:`Name`,value:r.name,onChange:e=>a(`name`,e)}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`label`,{className:_,children:`Schedule mode`}),(0,O.jsxs)(`select`,{"aria-label":`Schedule mode`,className:x,value:r.scheduleMode,onChange:e=>a(`scheduleMode`,e.target.value),children:[(0,O.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,O.jsx)(`option`,{value:`continuous`,children:`Continuous`})]}),r.scheduleMode===`cron`?(0,O.jsxs)(`div`,{className:`${y} flex cursor-default select-none items-center justify-between gap-2 bg-raised`,title:r.cron,children:[(0,O.jsx)(`span`,{className:`truncate text-primary`,children:me(r.cron)}),(0,O.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-secondary`,children:r.cron})]}):(0,O.jsx)(I,{label:`Delay after each exec (minutes)`,value:r.continuousDelayMinutes,onChange:e=>a(`continuousDelayMinutes`,e),mono:!0,hint:`At least 1 minute. Done and error continue; canceled runs do not.`}),(0,O.jsx)(`div`,{className:P,children:`Cron is retained while continuous mode is active, so switching back restores it.`})]}),(0,O.jsx)(I,{label:`Task file`,value:r.taskFile,onChange:e=>a(`taskFile`,e),mono:!0,hint:`Path of the markdown file this loop tracks/maintains on the machine (optional).`}),(0,O.jsx)(L,{title:`Notifications`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`label`,{className:_,children:`Notify`}),(0,O.jsx)(`select`,{"aria-label":`Notify`,className:x,value:r.notify,onChange:e=>a(`notify`,e.target.value),children:[`auto`,`always`,`never`].map(e=>(0,O.jsx)(`option`,{children:e},e))}),(0,O.jsx)(`div`,{className:P,children:`auto pushes only when a run found something; never silences everything.`})]}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`label`,{className:_,children:`Push channel`}),(0,O.jsxs)(`select`,{"aria-label":`Push channel`,className:x,value:r.channelId,onChange:e=>a(`channelId`,e.target.value),children:[(0,O.jsx)(`option`,{value:``,children:`none (dashboard only)`}),l.map(e=>(0,O.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,O.jsx)(L,{title:`Execution`,hint:`Which coding agent on the machine runs this loop.`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`label`,{className:_,children:`Coding agent`}),(0,O.jsx)(`select`,{"aria-label":`Coding agent`,className:x,value:r.agent,onChange:e=>a(`agent`,e.target.value),children:Ve.map(e=>(0,O.jsx)(`option`,{value:e,children:F[e]??e},e))}),(0,O.jsx)(`div`,{className:P,children:`Which coding agent executes this loop on the bound machine.`})]}),(0,O.jsx)(I,{label:`Working directory`,value:r.workdir,onChange:e=>a(`workdir`,e),mono:!0,ph:`/Users/you/Workspace/project`,hint:`Project root on the machine. Empty lets the daemon use a scratch directory.`}),(0,O.jsx)(I,{label:`Model`,value:r.model,onChange:e=>a(`model`,e),ph:`default`,hint:`Optional arbitrary model id. Empty uses the coding-agent CLI default.`}),(0,O.jsx)(I,{label:`Reasoning effort`,value:r.reasoningEffort,onChange:e=>a(`reasoningEffort`,e),ph:`default`,hint:`Optional arbitrary effort value. Empty uses the coding-agent CLI default.`}),(0,O.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-center gap-2 text-body text-primary`,children:[(0,O.jsx)(`input`,{type:`checkbox`,className:`accent-[color:var(--color-display)]`,checked:r.allowControl,onChange:e=>a(`allowControl`,e.target.checked)}),`Allow self-rescheduling`]})]}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(L,{title:`Agent-authored content`,hint:`Metrics and dashboard - usually written by evolve passes; edit by hand here when you know exactly what you want.`}),(0,O.jsx)(`label`,{className:_,children:`Metrics schema · JSON array`}),(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(R,{minHeight:`90px`}),children:(0,O.jsx)(M,{lang:`json`,value:r.stateSchema,onChange:e=>{a(`stateSchema`,e),s(null)},minHeight:`90px`,invalid:!!o,placeholder:`[{"key":"mrr","label":"MRR","unit":"$"},{"key":"paid"}]`})}),o?(0,O.jsx)(`div`,{className:`mt-1 text-caption leading-snug text-accent`,children:o}):(0,O.jsx)(`div`,{className:P,children:`Per-run metrics the agent reports; they feed the dashboard charts.`}),(0,O.jsx)(`label`,{className:_,children:`Dashboard template · HTML`}),(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(R,{minHeight:`240px`}),children:(0,O.jsx)(M,{lang:`html`,value:r.ui,onChange:e=>a(`ui`,e),minHeight:`240px`,placeholder:`<h3>{{latest.mrr}}$</h3>
4
+ <loop-chart series="mrr:MRR:$"></loop-chart>`})}),(0,O.jsxs)(`div`,{className:P,children:[`Agent-authored HTML with `,`{{bindings}}`,` and loop-chart / loop-embed / loop-calendar / loop-kanban elements.`]})]})]})}),Ue={"claude-code":`Claude Code`,codex:`Codex`},We=[{label:`Change the schedule`,seed:`Change the schedule: `},{label:`Adjust what it does`,seed:`Change what this loop does: `},{label:`Improve the dashboard`,seed:`Improve the dashboard: `},{label:`Set a finish line`,seed:`Give this loop a goal, and finish it once the goal is met: `}],Ge=(0,D.lazy)(()=>ie(()=>import(`./LoopView-XXW59HAV.js`).then(e=>({default:e.LoopView})),__vite__mapDeps([2,1,3,4,5,6])));function z({id:e}){let t=re(),[n,ee]=(0,D.useState)(null),[f,ie]=(0,D.useState)([]),[oe,le]=(0,D.useState)(null),[de,p]=(0,D.useState)(null),[h,g]=(0,D.useState)(!1),[_,y]=(0,D.useState)(!1),[x,S]=(0,D.useState)(``),[C,ke]=(0,D.useState)(!1),[Ae,w]=(0,D.useState)(!1),[T,E]=(0,D.useState)(null),je=(0,D.useRef)(null),[Re,ze]=(0,D.useState)(!1),[k,A]=(0,D.useState)(null),[Ve,j]=(0,D.useState)(!1),[M,N]=Me(),P=(0,D.useRef)(null),F=(0,D.useRef)(!1),[I,L]=(0,D.useState)([]),R=(0,D.useCallback)(async(n=!1)=>{try{let t=await l({data:e});ee(t),F.current=t.summary.deleteRequestedAt!=null,le(null)}catch(e){F.current?t({to:`/`}):n||le(String(e))}},[e]);(0,D.useEffect)(()=>{ee(null),g(!1),y(!1),S(``),ke(!1),w(!1),E(null),j(!1),L([]),R(),se().then(ie).catch(()=>{})},[e,R]);let z=!!n?.summary.running;(0,D.useEffect)(()=>{if(h)return;let e=setInterval(()=>void R(!0),z||F.current?3e3:8e3);return()=>clearInterval(e)},[h,z,R]);async function V(){await R()}async function Je(){p(null),A(`run`);try{let t=await a({data:e});if(t?.error)return p(`Run failed: ${t.error}`);N({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await V()}finally{A(null)}}async function Ye(){p(null),A(`evolve`);try{let t=await s({data:e});if(t?.error)return p(`Evolve failed: ${t.error}`);N({label:t.coalesced?`Evolve already queued`:`Evolve queued`,hold:4e3}),await V()}finally{A(null)}}async function H(n){p(null),A(`lifecycle`);try{let a=n===`pause`?await u({data:e}):n===`start`?await d({data:e}):n===`stop`?await r({data:e}):n===`reopen`?await i({data:{id:e,patch:{enabled:!0}}}):await c({data:e});if(a.error)return p(`${n[0].toUpperCase()+n.slice(1)} failed: ${a.error}`);if(j(!1),a.deleted){F.current=!1,t({to:`/`});return}n===`delete`&&(F.current=!0),await V(),N({label:n===`start`?`Started`:n===`reopen`?`Reopened`:n===`pause`?`Paused`:n===`stop`?`Stop requested`:`Deleting`})}finally{A(null)}}async function Xe(){let t=P.current?.read();if(t){p(null),A(`save`);try{let n=await i({data:{id:e,patch:t}});if(n.error)return p(`Save failed: ${n.error}`);g(!1),await V(),N({label:`Saved`})}finally{A(null)}}}async function Ze(){let t=x.trim();if(t){p(null),A(`edit`);try{let n=await te({data:{id:e,instruction:t}});if(n.error)return p(`Couldn't queue the edit: ${n.error}`);E(n.runId??null),w(!0),y(!1),S(``),await V()}finally{A(null)}}}let U=(0,O.jsxs)(ne,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary transition-colors hover:text-display`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(oe)return(0,O.jsx)(B,{back:U,children:(0,O.jsx)(Pe,{title:`Couldn't load this loop.`,detail:oe,onRetry:()=>void R()})});if(!n)return(0,O.jsx)(B,{back:U,children:(0,O.jsx)(be,{})});let{job:W,summary:G,runs:Qe}=n,$e=!!W.ui,et=!!k,tt=n.machine.online,K=n.machine.presence===`asleep`,nt=tt?void 0:K?`Machine asleep - requests will stay queued until it wakes`:`Machine offline - requests will stay queued until it reconnects`,q=ve(G),J=Ee(G),rt=we(n),it=Te(n.machine.daemonProtocol),at=fe(G)&&!q,ot=n.machine.name?`“${n.machine.name}”`:`the bound machine`,Y=Ae&&T?Qe.find(e=>e.id===T):void 0,st=!!Y&&!Y.queued&&!Y.running,ct=()=>{w(!1),E(null)},lt=Ie(W.taskFile),ut=async()=>{try{await navigator.clipboard.writeText(Le({loopId:e,loopName:G.name,instruction:x})),ke(!0),setTimeout(()=>ke(!1),4e3)}catch{p(`Could not copy the prompt - try again or copy it manually.`)}},dt=M&&(0,O.jsx)(`div`,{className:`mb-2.5`,children:(0,O.jsx)(Ne,{label:M.label,tone:M.tone,onUndo:M.undo})}),X=J===`deleting`,ft=!G.enabled&&!q&&!X,pt=G.enabled&&!q&&!X,Z=et||X,Q=pt||ft,mt=Q&&!!G.running&&it.supported,ht=G.running&&!it.supported?De:G.running?void 0:`No run is currently running`,gt=(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,O.jsx)(`button`,{className:ye,disabled:Z||!Q,onClick:()=>void Je(),title:Q?nt??(W.exec?`Spends credits`:void 0):`Unavailable for a completed or deleting loop`,"aria-label":W.exec?`Run once - spends credits`:`Run once`,children:k===`run`?`Queuing…`:`Run once`}),(0,O.jsx)(`button`,{className:v,disabled:Z||!(Q||q),title:`Dispatch or copy a prompt for an owner-requested edit`,onClick:()=>y(!0),children:`Agent edit`}),(0,O.jsx)(`button`,{className:v,disabled:Z||!Q,title:Q?nt??`Spends credits`:`Unavailable for a completed or deleting loop`,onClick:()=>void Ye(),children:k===`evolve`?`Evolving…`:`Evolve once`}),(0,O.jsx)(`button`,{className:v,disabled:Z,onClick:()=>g(!0),children:`Settings`}),(0,O.jsx)(`button`,{className:v,disabled:Z||!ft,onClick:()=>void H(`start`),children:`Start`}),(0,O.jsx)(`button`,{className:v,disabled:Z||!pt,onClick:()=>void H(`pause`),children:`Pause`}),(0,O.jsx)(`button`,{className:he,disabled:Z||!mt,title:ht,onClick:()=>void H(`stop`),children:`Stop`}),(0,O.jsx)(`button`,{className:v,disabled:Z||!q,onClick:()=>void H(`reopen`),children:`Reopen`}),(0,O.jsx)(`button`,{className:he,disabled:Z,onClick:()=>j(!0),children:X?`Deleting…`:`Delete`})]}),Ve&&!X&&(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(Fe,{prompt:`Stop this loop and delete its server data?`,note:`This stops the loop and deletes server history and synced artifacts. Local files are not deleted. If the machine is unreachable, server data is still deleted and its local process may continue running.`,cta:`Delete`,danger:!0,busy:et,onConfirm:()=>void H(`delete`),onCancel:()=>j(!1)})}),X&&(0,O.jsx)(`div`,{className:`mt-3 rounded-md border border-wire bg-raised px-4 py-3 text-meta text-secondary`,children:`Deleting… graceful stop is waiting for execution authority to end.`}),_&&!X&&(0,O.jsxs)(`div`,{className:`mt-4 border-t border-hairline pt-4`,onKeyDown:e=>{e.key===`Escape`&&k!==`edit`&&(e.stopPropagation(),y(!1))},children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,O.jsx)(`span`,{className:`text-body font-medium text-display`,children:`Edit with your coding agent`}),(0,O.jsxs)(`span`,{className:`text-meta text-secondary`,children:[`One agent pass on `,ot,` · spends credits`]})]}),(0,O.jsx)(`textarea`,{ref:je,autoFocus:!0,value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&x.trim()&&k!==`edit`&&Ze()},rows:3,placeholder:`e.g. run at 9am on weekdays instead, and also check coffee stock`,className:`mt-3 w-full resize-y rounded-control border border-wire bg-raised p-3 font-mono text-label leading-relaxed text-primary outline-none transition-shadow placeholder:text-disabled focus:border-transparent focus:shadow-focus`}),!x.trim()&&(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:We.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>{S(e.seed),je.current?.focus()},className:`cursor-pointer rounded-full border border-wire bg-surface px-3 py-1 text-label font-medium text-secondary transition-colors hover:bg-raised hover:text-display`,children:e.label},e.label))}),(0,O.jsxs)(`div`,{className:`mt-3.5 flex flex-wrap items-center gap-x-2.5 gap-y-2`,children:[(0,O.jsx)(`button`,{className:xe,disabled:k===`edit`||!x.trim(),title:nt,onClick:()=>void Ze(),children:k===`edit`?`Dispatching…`:`Dispatch to your coding agent`}),(0,O.jsx)(`button`,{type:`button`,className:v,disabled:k===`edit`,onClick:()=>void ut(),children:C?`✓ Prompt copied`:`Copy prompt`}),(0,O.jsx)(`button`,{className:v,disabled:k===`edit`,onClick:()=>y(!1),children:`Cancel`}),(0,O.jsx)(`span`,{className:`hidden text-caption text-disabled sm:inline`,children:`⌘↩ dispatch · esc cancel`})]}),(0,O.jsx)(`div`,{className:`mt-2 text-caption leading-snug text-disabled`,children:C?(0,O.jsxs)(`span`,{className:`text-secondary`,children:[`✓ Copied · run your coding agent`,` `,lt?(0,O.jsxs)(O.Fragment,{children:[`in `,(0,O.jsx)(`code`,{className:`break-all font-mono text-primary`,children:lt})]}):`in the loop’s local directory on this machine`,` `,`and paste the prompt to adjust the loop yourself.`]}):(0,O.jsx)(O.Fragment,{children:`Prefer to adjust it yourself? Copy prompt drops a ready-to-paste prompt for your own coding agent - no dispatch, no credits.`})})]})]}),_t=de&&(0,O.jsx)(Se,{message:de,onDismiss:()=>p(null),className:`mb-2.5`}),$=n.team&&!n.team.isActive?n.team:null,vt=e=>{Oe(e),t({to:`/t/$teamId`,params:{teamId:e}})},yt=$&&(0,O.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-control border border-hairline bg-raised px-4 py-2.5`,children:[(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-interactive`}),`Viewing a loop in `,$.name]}),(0,O.jsx)(`span`,{className:`text-meta text-secondary`,children:`- not your active team.`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>vt($.id),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Switch to this team`})]}),bt=!tt&&(0,O.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-control border border-hairline bg-raised px-4 py-2.5`,children:[(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-secondary`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full ${K?`bg-rubik-yellow`:`bg-disabled`}`}),`Machine `,n.machine.name?`“${n.machine.name}” `:``,K?`seems to be asleep or offline`:`offline`]}),(0,O.jsxs)(`span`,{className:`text-meta text-secondary`,children:[K?`- queued work starts automatically when it reconnects.`:`- manual run, evolve, and edit requests remain safely queued.`,n.machine.lastSeen?` Last seen ${ue(n.machine.lastSeen)}.`:``]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>ze(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Reconnect`})]});if(h)return(0,O.jsxs)(B,{back:U,children:[(0,O.jsx)(Ke,{name:G.name,onBack:()=>g(!1)}),(0,O.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,O.jsx)(He,{ref:P,initial:W,channels:f}),(0,O.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[_t,(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,O.jsx)(`button`,{className:ye,disabled:k===`save`,onClick:Xe,children:k===`save`?`Saving…`:`Save`}),(0,O.jsx)(`button`,{className:v,disabled:k===`save`,onClick:()=>g(!1),children:`Cancel`})]})]})]})]});let xt=Ue[W.agent??`claude-code`]??W.agent??`Claude Code`,St=W.exec?.model?.trim()||`default`,Ct=W.exec?.reasoningEffort?.trim()||`default`,wt=Qe[0],Tt=wt?.reportIncident?wt:void 0,Et=(0,O.jsx)(`span`,{className:`text-wire`,children:`·`});return(0,O.jsxs)(B,{back:U,children:[(0,O.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,O.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,O.jsx)(`h1`,{className:`text-[28px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:G.name}),J===`completed`?(0,O.jsx)(b,{tone:`success`,dot:`green`,children:`Completed`}):(0,O.jsx)(b,{tone:J===`stopping`?`running`:void 0,dot:J===`stopping`?`pulse`:void 0,children:rt}),G.queued&&J===`active`?(0,O.jsx)(b,{tone:`outline`,children:`Queued`}):null,at&&(0,O.jsx)(b,{tone:`success`,title:G.goal??void 0,children:`Goal`}),(0,O.jsx)(b,{tone:`outline`,title:`Recorded coding agent`,children:xt}),(0,O.jsx)(b,{tone:`outline`,title:`Model: ${St}`,children:(0,O.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Model: `,St]})}),(0,O.jsx)(b,{tone:`outline`,title:`Reasoning: ${Ct}`,children:(0,O.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Reasoning: `,Ct]})}),$&&(0,O.jsx)(b,{tone:`outline`,title:`This loop belongs to another of your teams`,children:$.name})]}),(0,O.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-meta text-secondary`,children:[(0,O.jsx)(`span`,{className:`text-primary`,title:W.cron,children:W.scheduleMode===`continuous`?`continuous · ${W.continuousDelayMinutes}m delay`:me(W.cron)}),Et,(0,O.jsxs)(`span`,{children:[`next `,m(G.nextRun)]}),G.nextRun&&G.enabled&&!q&&(0,O.jsxs)(`span`,{className:`text-disabled`,children:[`(`,pe(G.nextRun),`)`]}),Et,(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:tt?`Machine online`:K?`Machine asleep`:`Machine offline`,children:[(0,O.jsx)(`span`,{className:`size-1.5 rounded-full ${tt?`bg-rubik-green`:K?`bg-rubik-yellow`:`bg-disabled`}`}),n.machine.name||`machine`]}),Et,(0,O.jsx)(`span`,{title:`Breaking daemon/server lifecycle protocol`,children:it.label}),Et,(0,O.jsx)(`code`,{className:`font-mono text-label text-disabled`,children:G.id})]}),at&&G.goal&&(0,O.jsxs)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:[`Working toward: `,(0,O.jsx)(`span`,{className:`text-primary`,children:G.goal})]}),J===`completed`&&(0,O.jsxs)(`div`,{className:`mt-2 text-body leading-snug text-success`,children:[`Completed`,G.completedAt?` · ${m(G.completedAt)}`:``,G.completionReason&&(0,O.jsxs)(`span`,{className:`text-secondary`,children:[` - `,G.completionReason]})]}),Tt?.reportIncident&&(0,O.jsx)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:Tt.phase===`error`?`Last run failed · Terminal report rejected`:`Last run telemetry warning · Terminal report rejected`})]})}),(0,O.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[yt,bt,_t,dt,gt]})]}),Ae&&(0,O.jsxs)(`section`,{className:`mt-6 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,style:{animation:`fadeIn 0.2s ease-out`},"aria-live":`polite`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[!Y||Y.queued?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-body text-secondary`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full bg-disabled`}),(0,O.jsx)(`span`,{className:`font-medium text-primary`,children:`Edit queued`}),(0,O.jsxs)(`span`,{children:[`waiting for `,ot,` and higher-priority work…`]})]}):Y.running?(0,O.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5 text-body text-secondary`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full`,style:ge}),(0,O.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:`Applying your edit`})]}):(0,O.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-body`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-2.5 shrink-0 rounded-[2px]`,style:{background:Ce(Y)}}),(0,O.jsx)(`span`,{className:`font-medium`,style:{color:Ce(Y)},children:Y.canceled?`Edit canceled`:Y.phase===`error`?`Edit failed`:`Edit applied`}),Y.error&&(0,O.jsxs)(`span`,{className:`truncate text-secondary`,children:[`· `,Y.error]})]}),(0,O.jsxs)(`div`,{className:`ml-auto flex items-center gap-3.5`,children:[Y&&(0,O.jsx)(ne,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:Y.id},className:`text-label font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`View run →`}),(0,O.jsx)(`button`,{type:`button`,onClick:ct,className:`inline-flex cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-meta font-medium text-secondary transition-colors hover:text-display`,children:st?`Done`:`Hide`})]})]}),st&&Y.message&&(0,O.jsx)(`div`,{className:`mt-3.5`,children:(0,O.jsx)(_e,{children:Y.message})})]}),$e&&(0,O.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,O.jsx)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 text-label font-semibold text-secondary`,children:`Dashboard`}),(0,O.jsx)(`div`,{className:`min-w-0 overflow-x-auto`,children:(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(be,{className:`py-4`}),children:(0,O.jsx)(Ge,{html:W.ui,runs:Qe,loopId:e,taskFile:W.taskFile})})})]}),(0,O.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,O.jsx)(Be,{loopId:e,taskFile:W.taskFile,taskFileContent:n.taskFileContent,taskFileSyncedAt:n.taskFileSyncedAt,running:z}),(0,O.jsx)(qe,{loopId:e,summary:G,runs:Qe,older:I,onMore:async()=>{let t=(I.length?ce(G.runs??[],I):G.runs??[])[0];if(!t)return 0;let n=await o({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&L(e=>ce(e,n)),n.length},onPickRun:n=>t({to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id}})})]}),(0,O.jsx)(ae,{open:Re,onClose:()=>ze(!1)})]})}function Ke({name:e,onBack:t}){return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`button`,{type:`button`,onClick:t,className:g,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,O.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold leading-tight tracking-[-0.015em] text-display`,children:[`Settings · `,e]}),(0,O.jsx)(`p`,{className:`mt-1.5 max-w-[640px] text-meta leading-snug text-secondary`,children:`Loop configuration, notifications, and push channel, saved directly - no agent pass or credits. For changes in plain words, use Agent edit instead.`})]})}function B({back:e,children:t}){return(0,O.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,O.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function qe({loopId:e,summary:t,runs:n,older:r,onMore:i,onPickRun:a}){let o=(0,D.useMemo)(()=>r.length?ce(t.runs??[],r):t.runs??[],[t.runs,r]);return(0,O.jsxs)(`section`,{className:`min-w-0`,children:[(0,O.jsx)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:(0,O.jsxs)(`h2`,{className:h,children:[`Runs (`,t.runCount,`)`]})}),t.runCount===0?(0,O.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,O.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,O.jsx)(oe,{job:t,runs:o,total:t.runCount,onLoadMore:i,onPickRun:a}),(0,O.jsx)(`ul`,{className:`mt-5 max-h-[clamp(280px,46vh,520px)] divide-y divide-hairline overflow-y-auto border-t border-hairline`,children:n.map(t=>(0,O.jsx)(`li`,{children:(0,O.jsxs)(ne,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:t.id},className:`flex items-start gap-2.5 py-2.5 transition-colors hover:bg-raised`,children:[(0,O.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:Ce(t)},title:p(t),"aria-label":p(t)}),(0,O.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2`,children:[(0,O.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:de(t.ts)}),(0,O.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:S(t.durationMs)})]}),(0,O.jsx)(`span`,{className:`mt-0.5 block`,children:t.queued?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-disabled`}),(0,O.jsx)(`span`,{children:`Queued`})]}):t.running?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta text-secondary`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:ge}),(0,O.jsx)(`span`,{children:`Running`})]}):t.error?(0,O.jsx)(`span`,{className:`line-clamp-2 text-meta text-secondary`,children:t.error}):(0,O.jsx)(`span`,{className:`line-clamp-2 text-meta text-primary`,children:t.message||p(t)})})]})]})},t.id))})]})]})}function V(){let{loopId:e}=C.useParams(),{auth:t}=C.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=f();return t?.enabled&&!r&&!n?(0,O.jsx)(je,{callbackURL:`/loops/${e}`}):(0,O.jsx)(z,{id:e})}export{V as component};
@@ -1,3 +1,3 @@
1
- import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{C as r,d as i,h as a,u as o}from"./loopApi-5s2-kCnu.js";import{c as s,f as c}from"./preload-helper-ycaoAemE.js";import{C as l,E as u,T as d,_ as f,a as p,c as m,g as h,n as g,o as _,r as v,w as y}from"./ui-Dp88qUWh.js";import"./lifecycleUi-DGVOf5yS.js";import{t as b}from"./index-C4UaIr-9.js";import{t as x}from"./SignIn-CbMeIAJZ.js";import{r as S}from"./actionUi-ChGGALzg.js";var C=t(e(),1);function w(e,t){return e.startsWith(`@@`)?{kind:`hunk`,text:e,gutter:``}:t?e.startsWith(`+`)?{kind:`add`,text:e.slice(1),gutter:`+`}:e.startsWith(`-`)?{kind:`del`,text:e.slice(1),gutter:`-`}:e.startsWith(` `)?{kind:`context`,text:e.slice(1),gutter:``}:{kind:`context`,text:e,gutter:``}:e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`Index:`)||e.startsWith(`===`)?{kind:`meta`,text:e,gutter:``}:{kind:`context`,text:e,gutter:``}}function T(e){if(!e)return[];let t=e.endsWith(`
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{C as r,d as i,h as a,u as o}from"./loopApi-5s2-kCnu.js";import{c as s,f as c}from"./preload-helper-ycaoAemE.js";import{D as l,E as u,T as d,_ as f,a as p,c as m,g as h,n as g,o as _,r as v,w as y}from"./ui-RFP3R3lU.js";import"./lifecycleUi-B8Je9exd.js";import{t as b}from"./index-Dg07vo1l.js";import{t as x}from"./SignIn-BAoOONQ9.js";import{r as S}from"./actionUi-Dxe9cHAc.js";var C=t(e(),1);function w(e,t){return e.startsWith(`@@`)?{kind:`hunk`,text:e,gutter:``}:t?e.startsWith(`+`)?{kind:`add`,text:e.slice(1),gutter:`+`}:e.startsWith(`-`)?{kind:`del`,text:e.slice(1),gutter:`-`}:e.startsWith(` `)?{kind:`context`,text:e.slice(1),gutter:``}:{kind:`context`,text:e,gutter:``}:e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`Index:`)||e.startsWith(`===`)?{kind:`meta`,text:e,gutter:``}:{kind:`context`,text:e,gutter:``}}function T(e){if(!e)return[];let t=e.endsWith(`
2
2
  `)?e.slice(0,-1):e,n=!1;return t.split(`
3
- `).map(e=>{let t=w(e,n);return t.kind===`hunk`&&(n=!0),t})}function E(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var D=n(),O={added:`Added`,modified:`Changed`,removed:`Removed`},k={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function A(e){return e==null||e===0?``:`${e>0?`+`:`−`}${u(e)}`}var j={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},M={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function N({lines:e}){return(0,D.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,D.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex ${j[e.kind]}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${M[e.kind]}`,children:e.gutter}),(0,D.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function P({f:e,lines:t}){let n=A(e.sizeDelta),r=t?E(t):null;return(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,D.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${k[e.status]}`,children:O[e.status]}),(0,D.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,D.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,D.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var F=40;function I({files:e}){return(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,D.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,D.jsx)(P,{f:e,lines:null})},e.path);let t=T(e.diff);return(0,D.jsxs)(`details`,{open:t.length<=F,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,D.jsx)(P,{f:e,lines:t})]}),(0,D.jsx)(N,{lines:t})]},e.path)})})}function L({label:e,count:t,children:n}){return(0,D.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,D.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${f}`,children:[e,t!=null&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function R({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,D.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function z({run:e}){let[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(e.queued||e.running)return;let t=!0;return i({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.queued,e.running]),e.queued||e.running?(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,D.jsx)(L,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,D.jsx)(I,{files:t.files})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(g,{})})}function B({run:e}){let t=l(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:h}),(0,D.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function V({id:e}){let[t,n]=(0,C.useState)(!1);return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var H=64;function U({loopId:e,runId:t}){let[n,i]=(0,C.useState)(null),[s,u]=(0,C.useState)(null),[f,h]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),w=(0,C.useCallback)(async()=>{try{i(await o({data:e})),x(null)}catch(e){x(String(e))}},[e]),T=(0,C.useCallback)(async()=>{try{i(await o({data:e}))}catch{}},[e]);(0,C.useEffect)(()=>{i(null),u(null),h(!1),x(null),w()},[e,t,w]);let E=n?.runs.find(e=>e.id===t)??s;(0,C.useEffect)(()=>{if(!n||E||f)return;let r=!0;return(async()=>{try{let i=n.runs.length?n.runs[n.runs.length-1].ts:new Date().toISOString();for(let n=0;n<H&&r;n++){let n=await a({data:{loopId:e,beforeTs:i,limit:100}});if(!n.length)break;let o=n.find(e=>e.id===t);if(o){r&&u(o);return}i=n[0].ts}}finally{r&&h(!0)}})(),()=>{r=!1}},[n,E,f,e,t]);let O=!!(E?.queued||E?.running);(0,C.useEffect)(()=>{if(!O)return;let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[O,T]);async function k(){if(!E||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await r({data:E.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(b)return(0,D.jsx)(S,{title:`Couldn't load this run.`,detail:b,onRetry:()=>void w()});if(!n||!E&&!f)return(0,D.jsx)(g,{});if(!E)return(0,D.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,D.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let A=n.summary.name,j=E.role||null;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,A]}),(0,D.jsx)(p,{run:E,colorText:!0})]}),(0,D.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,D.jsx)(`span`,{className:`text-primary`,children:y(E.ts)}),(0,D.jsx)(`span`,{className:`text-wire`,children:`·`}),j&&(0,D.jsx)(v,{children:j}),E.durationMs!=null&&(0,D.jsx)(v,{tone:`ink`,children:l(E.durationMs)}),(0,D.jsx)(`code`,{className:`font-mono text-disabled`,children:E.id})]})]})}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:_,children:`View the whole loop →`}),(E.queued||E.running)&&(0,D.jsx)(`button`,{type:`button`,onClick:k,className:m,disabled:!!E.running&&n.machine.daemonProtocol!==2,title:E.running&&n.machine.daemonProtocol!==2?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,D.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[E.queued?(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):E.running?(0,D.jsx)(B,{run:E}):null,E.reportIncident&&(0,D.jsx)(L,{label:`Terminal report rejected`,children:(0,D.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:E.reportIncident.code}),(0,D.jsx)(`div`,{className:`break-words text-secondary`,children:E.reportIncident.reason}),(0,D.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,D.jsx)(`dd`,{children:E.reportIncident.faultDomain}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,D.jsx)(`dd`,{className:`break-words`,children:E.reportIncident.recommendedAction}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,D.jsx)(`dd`,{className:`break-all font-mono`,children:E.reportIncident.reportId})]})]})}),E.message&&(0,D.jsx)(L,{label:`Report`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded-control border border-hairline bg-raised px-4 py-3.5 text-body leading-relaxed text-primary`,children:E.message})}),(0,D.jsx)(z,{run:E}),E.control&&E.control.length>0&&(0,D.jsx)(L,{label:`Control actions`,count:E.control.length,children:(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:E.control.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 font-mono text-label`,children:[(0,D.jsx)(`span`,{className:`text-display`,children:e.command}),(0,D.jsx)(`span`,{className:`min-w-0 break-all text-secondary`,children:JSON.stringify(e.args)}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`text-wire`,children:`→`}),(0,D.jsx)(`span`,{className:`text-primary`,children:e.result}),e.detail&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[`(`,e.detail,`)`]})]},t))})}),E.finalText&&(0,D.jsx)(L,{label:`Final output`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:E.finalText})})]}),(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,D.jsx)(L,{label:`Details`,children:(0,D.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,D.jsx)(R,{k:`State`,children:(0,D.jsx)(p,{run:E,colorText:!0})}),E.status&&(0,D.jsx)(R,{k:`Status`,children:E.status}),E.durationMs!=null&&(0,D.jsx)(R,{k:`Duration`,children:l(E.durationMs)}),E.exitCode!=null&&(0,D.jsx)(R,{k:`Exit code`,children:E.exitCode}),E.usage&&(0,D.jsx)(R,{k:`Token usage`,children:(0,D.jsxs)(`span`,{className:`text-disabled`,children:[d((E.usage.inputTokens??0)+(E.usage.cacheReadTokens??0)+(E.usage.cacheCreationTokens??0)),` in · `,d(E.usage.outputTokens??0),` out`]})}),E.state!=null&&(0,D.jsx)(R,{k:`Run state`,children:(0,D.jsx)(`code`,{className:`block break-all font-mono text-label text-secondary`,children:JSON.stringify(E.state)})}),E.error&&(0,D.jsx)(R,{k:`Error`,children:(0,D.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:E.error})}),E.sessionId&&(0,D.jsx)(R,{k:`Session`,children:(0,D.jsx)(V,{id:E.sessionId})})]})})})]})]})}function W(){let{loopId:e,runId:t}=b.useParams(),{auth:n}=b.useLoaderData()??{auth:{enabled:!1}},{data:r,isPending:i}=s();return(0,D.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,D.jsx)(`div`,{className:`mb-5`,children:(0,D.jsxs)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),n?.enabled&&!i&&!r?(0,D.jsx)(x,{callbackURL:`/loops/${e}/runs/${t}`}):(0,D.jsx)(U,{loopId:e,runId:t})]})}export{W as component};
3
+ `).map(e=>{let t=w(e,n);return t.kind===`hunk`&&(n=!0),t})}function E(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var D=n(),O={added:`Added`,modified:`Changed`,removed:`Removed`},k={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function A(e){return e==null||e===0?``:`${e>0?`+`:`−`}${l(e)}`}var j={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},M={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function N({lines:e}){return(0,D.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,D.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`flex ${j[e.kind]}`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${M[e.kind]}`,children:e.gutter}),(0,D.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function P({f:e,lines:t}){let n=A(e.sizeDelta),r=t?E(t):null;return(0,D.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,D.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${k[e.status]}`,children:O[e.status]}),(0,D.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,D.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,D.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,D.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,D.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var F=40;function I({files:e}){return(0,D.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,D.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,D.jsx)(P,{f:e,lines:null})},e.path);let t=T(e.diff);return(0,D.jsxs)(`details`,{open:t.length<=F,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,D.jsx)(P,{f:e,lines:t})]}),(0,D.jsx)(N,{lines:t})]},e.path)})})}function L({label:e,count:t,children:n}){return(0,D.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,D.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${f}`,children:[e,t!=null&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function R({k:e,children:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,D.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function z({run:e}){let[t,n]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(e.queued||e.running)return;let t=!0;return i({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.queued,e.running]),e.queued||e.running?(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,D.jsx)(L,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,D.jsx)(I,{files:t.files})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,D.jsx)(L,{label:`Changes`,children:(0,D.jsx)(g,{})})}function B({run:e}){let t=y(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:h}),(0,D.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function V({id:e}){let[t,n]=(0,C.useState)(!1);return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var H=64;function U({loopId:e,runId:t}){let[n,i]=(0,C.useState)(null),[s,l]=(0,C.useState)(null),[f,h]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),w=(0,C.useCallback)(async()=>{try{i(await o({data:e})),x(null)}catch(e){x(String(e))}},[e]),T=(0,C.useCallback)(async()=>{try{i(await o({data:e}))}catch{}},[e]);(0,C.useEffect)(()=>{i(null),l(null),h(!1),x(null),w()},[e,t,w]);let E=n?.runs.find(e=>e.id===t)??s;(0,C.useEffect)(()=>{if(!n||E||f)return;let r=!0;return(async()=>{try{let i=n.runs.length?n.runs[n.runs.length-1].ts:new Date().toISOString();for(let n=0;n<H&&r;n++){let n=await a({data:{loopId:e,beforeTs:i,limit:100}});if(!n.length)break;let o=n.find(e=>e.id===t);if(o){r&&l(o);return}i=n[0].ts}}finally{r&&h(!0)}})(),()=>{r=!1}},[n,E,f,e,t]);let O=!!(E?.queued||E?.running);(0,C.useEffect)(()=>{if(!O)return;let e=setInterval(()=>void T(),3e3);return()=>clearInterval(e)},[O,T]);async function k(){if(!E||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await r({data:E.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await w()}if(b)return(0,D.jsx)(S,{title:`Couldn't load this run.`,detail:b,onRetry:()=>void w()});if(!n||!E&&!f)return(0,D.jsx)(g,{});if(!E)return(0,D.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,D.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let A=n.summary.name,j=E.role||null;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,A]}),(0,D.jsx)(p,{run:E,colorText:!0})]}),(0,D.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,D.jsx)(`span`,{className:`text-primary`,children:d(E.ts)}),(0,D.jsx)(`span`,{className:`text-wire`,children:`·`}),j&&(0,D.jsx)(v,{children:j}),E.durationMs!=null&&(0,D.jsx)(v,{tone:`ink`,children:y(E.durationMs)}),(0,D.jsx)(`code`,{className:`font-mono text-disabled`,children:E.id})]})]})}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,D.jsx)(c,{to:`/loops/$loopId`,params:{loopId:e},className:_,children:`View the whole loop →`}),(E.queued||E.running)&&(0,D.jsx)(`button`,{type:`button`,onClick:k,className:m,disabled:!!E.running&&n.machine.daemonProtocol!==2,title:E.running&&n.machine.daemonProtocol!==2?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,D.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[E.queued?(0,D.jsx)(L,{label:`Activity`,children:(0,D.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):E.running?(0,D.jsx)(B,{run:E}):null,E.reportIncident&&(0,D.jsx)(L,{label:`Terminal report rejected`,children:(0,D.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,D.jsx)(`div`,{className:`font-medium`,children:E.reportIncident.code}),(0,D.jsx)(`div`,{className:`break-words text-secondary`,children:E.reportIncident.reason}),(0,D.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,D.jsx)(`dd`,{children:E.reportIncident.faultDomain}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,D.jsx)(`dd`,{className:`break-words`,children:E.reportIncident.recommendedAction}),(0,D.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,D.jsx)(`dd`,{className:`break-all font-mono`,children:E.reportIncident.reportId})]})]})}),E.message&&(0,D.jsx)(L,{label:`Report`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded-control border border-hairline bg-raised px-4 py-3.5 text-body leading-relaxed text-primary`,children:E.message})}),(0,D.jsx)(z,{run:E}),E.control&&E.control.length>0&&(0,D.jsx)(L,{label:`Control actions`,count:E.control.length,children:(0,D.jsx)(`ul`,{className:`space-y-1.5`,children:E.control.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 font-mono text-label`,children:[(0,D.jsx)(`span`,{className:`text-display`,children:e.command}),(0,D.jsx)(`span`,{className:`min-w-0 break-all text-secondary`,children:JSON.stringify(e.args)}),(0,D.jsx)(`span`,{"aria-hidden":!0,className:`text-wire`,children:`→`}),(0,D.jsx)(`span`,{className:`text-primary`,children:e.result}),e.detail&&(0,D.jsxs)(`span`,{className:`text-disabled`,children:[`(`,e.detail,`)`]})]},t))})}),E.finalText&&(0,D.jsx)(L,{label:`Final output`,children:(0,D.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:E.finalText})})]}),(0,D.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,D.jsx)(L,{label:`Details`,children:(0,D.jsxs)(`div`,{className:`space-y-3.5`,children:[(0,D.jsx)(R,{k:`State`,children:(0,D.jsx)(p,{run:E,colorText:!0})}),E.status&&(0,D.jsx)(R,{k:`Status`,children:E.status}),E.durationMs!=null&&(0,D.jsx)(R,{k:`Duration`,children:y(E.durationMs)}),E.exitCode!=null&&(0,D.jsx)(R,{k:`Exit code`,children:E.exitCode}),E.usage&&(0,D.jsx)(R,{k:`Token usage`,children:(0,D.jsxs)(`span`,{className:`text-disabled`,children:[u((E.usage.inputTokens??0)+(E.usage.cacheReadTokens??0)+(E.usage.cacheCreationTokens??0)),` in · `,u(E.usage.outputTokens??0),` out`]})}),E.state!=null&&(0,D.jsx)(R,{k:`Run state`,children:(0,D.jsx)(`code`,{className:`block break-all font-mono text-label text-secondary`,children:JSON.stringify(E.state)})}),E.error&&(0,D.jsx)(R,{k:`Error`,children:(0,D.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:E.error})}),E.sessionId&&(0,D.jsx)(R,{k:`Session`,children:(0,D.jsx)(V,{id:E.sessionId})})]})})})]})]})}function W(){let{loopId:e,runId:t}=b.useParams(),{auth:n}=b.useLoaderData()??{auth:{enabled:!1}},{data:r,isPending:i}=s();return(0,D.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,D.jsx)(`div`,{className:`mb-5`,children:(0,D.jsxs)(c,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,D.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),n?.enabled&&!i&&!r?(0,D.jsx)(x,{callbackURL:`/loops/${e}/runs/${t}`}):(0,D.jsx)(U,{loopId:e,runId:t})]})}export{W as component};
@@ -0,0 +1 @@
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";import{D as r,I as i,c as a,w as o}from"./loopApi-5s2-kCnu.js";import{$ as s,A as c,At as l,B as u,Bt as d,C as f,Ct as p,D as m,Dt as h,E as g,Et as _,F as v,Ft as y,G as b,Gt as x,H as S,Ht as C,I as w,It as T,J as E,Jt as D,K as O,Kt as k,L as A,Lt as j,M,Mt as N,N as P,Nt as F,O as I,Ot as L,P as ee,Pt as R,Q as te,R as z,Rt as ne,S as re,St as ie,T as ae,Tt as oe,U as se,Ut as ce,V as le,Vt as ue,W as de,Wt as fe,X as B,Xt as pe,Y as V,Yt as me,Z as H,_ as he,_t as ge,a as _e,at as ve,b as ye,bt as be,c as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,ft as De,g as Oe,gt as ke,h as Ae,ht as je,i as Me,it as U,j as Ne,jt as W,k as Pe,kt as Fe,l as Ie,m as Le,mt as Re,n as ze,nt as Be,o as Ve,ot as G,p as He,pt as K,q as Ue,qt as q,r as We,rt as J,s as Ge,st as Y,t as Ke,tt as qe,u as Je,ut as Ye,v as Xe,vt as Ze,w as Qe,wt as $e,x as et,xt as X,y as tt,yt as nt,z as rt,zt as it}from"./Modal-BnCPgN_k.js";import{C as at,M as ot,P as st,S as ct,T as lt,c as ut,h as dt,k as ft,l as pt,m as mt,o as ht,p as gt,t as _t,w as vt,x as yt,y as bt}from"./ui-RFP3R3lU.js";import{n as xt}from"./lifecycleUi-B8Je9exd.js";var St=t(i(),1),Z=n(),Q=t(e(),1),Ct=Q.createContext(void 0);function wt(e){let t=Q.useContext(Ct);if(t===void 0&&!e)throw Error(k(72));return t}function Tt(e,t){return t!=null&&!d(t)?0:typeof e==`function`?e():e}function Et(e,t,n){let r=Tt(e,n);return typeof r==`number`?r:r?.[t]}function Dt(e){return typeof e==`function`?e():e}function Ot(e,t){return t||e===`click`||e===`mousedown`}function kt(e){return e?.includes(`mouse`)&&e!==`mousedown`}var At=Q.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ce,currentIdRef:{current:null},currentContextRef:{current:null}});function jt(e,t){e.current=t.current}function Mt(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Q.useRef(n),a=Q.useRef(n),o=Q.useRef(null),s=Q.useRef(null),c=fe();return q(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:Et(i.current,`open`),close:Et(n,`close`)}},[n,o,i,a]),(0,Z.jsx)(At.Provider,{value:Q.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Nt(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Q.useContext(At),[f,p]=Q.useState(!1),m=Q.useRef(n),h=Q.useRef(!1);return q(()=>{m.current=n},[n]),q(()=>()=>{h.current=!0},[]),q(()=>{function e(){h.current||p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),q(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:Et(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,Y(we))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),q(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,jt(o,c),d.clear()}},[l,a,o,i,c,d]),Q.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function Pt(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Ft(e){return e!=null&&e.clientX!=null}function It(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Q.useRef(!1),u=Q.useRef(null),[f,p]=Q.useState(),[m,h]=Q.useState([]),g=J(e=>{i.set(`positionReference`,e)}),_=J((e,t,n)=>{l.current||c.current.openEvent&&!Ft(c.current.openEvent)||i.set(`positionReference`,Pt(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:f}))}),v=J(e=>{a?u.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=d(f)?o:a;Q.useEffect(()=>{if(!n){g(s);return}if(!y)return;function e(){u.current?.(),u.current=null}let t=W(o);function r(t){X(o,ie(t))?e():_(t.clientX,t.clientY)}return!c.current.openEvent||Ft(c.current.openEvent)?u.current=G(t,`mousemove`,r):g(s),e},[y,n,o,c,s,i,_,g,m]),Q.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Q.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Q.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let b=Q.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return Q.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}function Lt(e,t,n){let{reference:r,floating:i}=e,a=B(t),o=le(t),s=se(o),c=V(t),l=a===`y`,d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2,m;switch(c){case`top`:m={x:d,y:r.y-i.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(u(t)){case`start`:m[o]-=p*(n&&l?-1:1);break;case`end`:m[o]+=p*(n&&l?-1:1);break}return m}async function Rt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=z(t,e),m=E(p),h=o[f?d===`floating`?`reference`:`floating`:d],g=s(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(h))??!0?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},b=s(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var zt=50,Bt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Rt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Lt(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<zt&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Lt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Vt=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=V(r),_=B(o),v=V(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ue(o)]:de(o)),x=p!==`none`;!d&&x&&b.push(...O(o,m,p,y));let C=[o,...b],w=await s.detectOverflow(t,h),T=[],E=i.flip?.overflows||[];if(l&&T.push(w[g]),u){let e=S(r,a,y);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=C[e];if(t&&(!(u===`alignment`&&_!==B(t))||E.every(e=>B(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=E.filter(e=>{if(x){let t=B(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ht(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ut(e){return qe.some(t=>e[t]>=0)}var Wt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=z(e,t);switch(i){case`referenceHidden`:{let e=Ht(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ut(e)}}}case`escaped`:{let e=Ht(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ut(e)}}}default:return{}}}}},Gt=new Set([`left`,`top`]);async function Kt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=V(n),s=u(n),c=B(n)===`y`,l=Gt.has(o)?-1:1,d=a&&c?-1:1,f=z(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof h==`number`&&(m=s===`end`?h*-1:h),c?{x:m*d,y:p*l}:{x:p*l,y:m*d}}var qt=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Kt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Jt=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=B(V(i)),p=b(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=w(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=w(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Yt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=z(e,t),u={x:n,y:r},d=B(i),f=b(d),p=u[f],m=u[d],h=z(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Gt.has(V(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Xt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=z(e,t),d=await o.detectOverflow(t,l),f=V(i),p=u(i),m=B(i)===`y`,{width:h,height:g}=a.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=te(g-d[_],y),S=te(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=y),C&&!p){let e=H(d.left,0),t=H(d.right,0),n=H(d.top,0),r=H(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:H(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:H(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:w});let E=await o.getDimensions(s.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function Zt(e){let t=p(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=R(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Te(n)!==a||Te(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qt(e){return F(e)?e:e.contextElement}function $t(e){let t=Qt(e);if(!R(t))return A(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Zt(t),o=(a?Te(n.width):n.width)/r,s=(a?Te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var en=A(0);function tn(e){let t=W(e);return!it()||!t.visualViewport?en:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function rn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qt(e),o=A(1);t&&(r?F(r)&&(o=$t(r)):o=$t(e));let c=nn(a,n,r)?tn(a):A(0),l=(i.left+c.x)/o.x,u=(i.top+c.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(a){let e=W(a),t=r&&F(r)?W(r):r,n=e,i=_(n);for(;i&&r&&t!==n;){let e=$t(i),t=i.getBoundingClientRect(),r=p(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=a,u+=o,n=W(i),i=_(n)}}return s({width:d,height:f,x:l,y:u})}function an(e,t){let n=L(e).scrollLeft;return t?t.left+n:rn(oe(e)).left+n}function on(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-an(e,n),y:n.top+t.scrollTop}}function sn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=oe(r),s=t?ne(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=A(1),u=A(0),d=R(r);if((d||!d&&!a)&&((h(r)!==`body`||T(o))&&(c=L(r)),d)){let e=rn(r);l=$t(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?on(o,c):A(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function cn(e){return Array.from(e.getClientRects())}function ln(e){let t=oe(e),n=L(e),r=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+an(e),s=-n.scrollTop;return p(r).direction===`rtl`&&(o+=H(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var un=25;function dn(e,t){let n=W(e),r=oe(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=an(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=un&&(a-=o)}else l<=un&&(a+=l);return{width:a,height:o,x:s,y:c}}function fn(e,t){let n=rn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=R(e)?$t(e):A(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function pn(e,t,n){let r;if(t===`viewport`)r=dn(e,n);else if(t===`document`)r=ln(oe(e));else if(F(t))r=fn(t,n);else{let n=tn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return s(r)}function mn(e,t){let n=l(e);return n===t||!F(n)||y(n)?!1:p(n).position===`fixed`||mn(n,t)}function hn(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>F(e)&&h(e)!==`body`),i=null,a=p(e).position===`fixed`,o=a?l(e):e;for(;F(o)&&!y(o);){let t=p(o),n=N(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||T(o)&&!n&&mn(e,o))?r=r.filter(e=>e!==o):i=t,o=l(o)}return t.set(e,r),r}function gn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ne(t)?[]:hn(t,this._c):[].concat(n),r],o=pn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=pn(t,a[e],i);s=H(n.top,s),c=te(n.right,c),l=te(n.bottom,l),u=H(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function _n(e){let{width:t,height:n}=Zt(e);return{width:t,height:n}}function vn(e,t,n){let r=R(t),i=oe(t),a=n===`fixed`,o=rn(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=A(0);function l(){c.x=an(i)}if(r||!r&&!a)if((h(t)!==`body`||T(i))&&(s=L(t)),r){let e=rn(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?on(i,s):A(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function yn(e){return p(e).position===`static`}function bn(e,t){if(!R(e)||p(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return oe(e)===n&&(n=n.ownerDocument.body),n}function xn(e,t){let n=W(e);if(ne(e))return n;if(!R(e)){let t=l(e);for(;t&&!y(t);){if(F(t)&&!yn(t))return t;t=l(t)}return n}let r=bn(e,t);for(;r&&j(r)&&yn(r);)r=bn(r,t);return r&&y(r)&&yn(r)&&!N(r)?n:r||$e(e)||n}var Sn=async function(e){let t=this.getOffsetParent||xn,n=this.getDimensions,r=await n(e.floating);return{reference:vn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cn(e){return p(e).direction===`rtl`}var wn={convertOffsetParentRelativeRectToViewportRelativeRect:sn,getDocumentElement:oe,getClippingRect:gn,getOffsetParent:xn,getElementRects:Sn,getClientRects:cn,getDimensions:_n,getScale:$t,isElement:F,isRTL:Cn};function Tn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function En(e,t){let n=null,r,i=oe(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=rt(d),h=rt(i.clientWidth-(u+f)),g=rt(i.clientHeight-(d+p)),_=rt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H(0,te(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Tn(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Dn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Qt(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?En(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?rn(e):null;c&&g();function g(){let t=rn(e);h&&!Tn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var On=qt,kn=Jt,An=Vt,jn=Xt,Mn=Wt,Nn=Yt,Pn=(e,t,n)=>{let r=new Map,i={platform:wn,...n},a={...i.platform,_c:r};return Bt(e,t,{...i,platform:a})},Fn=typeof document<`u`?Q.useLayoutEffect:function(){};function In(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!In(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!In(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ln(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Rn(e,t){let n=Ln(e);return Math.round(t*n)/n}function zn(e){let t=Q.useRef(e);return Fn(()=>{t.current=e}),t}function Bn(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Q.useState(r);In(f,r)||p(r);let[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(u),T=c!=null,E=zn(c),D=zn(i),O=zn(l),k=Q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Pn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!In(w.current,t)&&(w.current=t,St.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Fn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Q.useRef(!1);Fn(()=>(A.current=!0,()=>{A.current=!1}),[]),Fn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Rn(M.floating,u.x),r=Rn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ln(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Vn=(e,t)=>{let n=On(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>{let n=kn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Un=(e,t)=>({fn:Nn(e).fn,options:[e,t]}),Wn=(e,t)=>{let n=An(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gn=(e,t)=>{let n=jn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kn=(e,t)=>{let n=Mn(e);return{name:n.name,fn:n.fn,options:[e,t]}};function qn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=P(),a=g()!=null,o=pe(()=>new re({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ce,floatingId:i,syncOnly:!1,nested:a})).current;return q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=F(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Jn(e={}){let{nodeId:t,externalTree:n}=e,r=qn(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=Q.useState(null),[f,p]=Q.useState(void 0),[h,g]=Q.useState(void 0),_=Q.useRef(null),v=m(n),y=Q.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),b=Bn({...e,elements:{...y,...u&&{reference:u}}}),x=F(f)?f:null,S=h===void 0?i.state.floatingElement:h;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:x),i.useSyncedValue(`floatingElement`,S);let C=Q.useCallback(e=>{let t=F(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),b.refs.setReference(t)},[b.refs]),w=Q.useCallback(e=>{(F(e)||e===null)&&(_.current=e,p(e)),(F(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!F(e))&&b.refs.setReference(e)},[b.refs,p]),T=Q.useCallback(e=>{g(e),b.refs.setFloating(e)},[b.refs]),E=Q.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:_}),[b.refs,w,T,C]),D=Q.useMemo(()=>({...b.elements,domReference:s}),[b.elements,s]),O=Q.useMemo(()=>({...b,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,c,l]);return q(()=>{s&&(_.current=s)},[s]),q(()=>{i.context.dataRef.current.floatingContext=O;let e=v?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),Q.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Yn=C&&ue;function Xn(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Q.useRef(!1),c=Q.useRef(null),l=Q.useRef(!0),u=fe();Q.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=W(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&R(e)&&e===be(Be(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return ve(G(t,`blur`,r),Yn&&G(t,`keydown`,a,!0),Yn&&G(t,`pointerdown`,o,!0))},[i,n]),Q.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);F(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Q.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=ie(t.nativeEvent);if(F(a)){if(Yn&&!t.relatedTarget){if(!l.current&&!Ze(a))return}else if(!nt(a))return}let o=ge(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,Y(De,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,Y(De,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=F(n)&&n.hasAttribute(ee(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=be(Be(e));!n&&t===e||X(o.current.floatingContext?.refs.floating.current,t)||X(e,t)||a||ge(n??t,i.context.triggerElements)||i.setOpen(!1,Y(De,r))})}}},[o,r,i,u]);return Q.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Zn=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ce,this.restTimeout=new ce,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Qn=new WeakMap;function $n(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Qn.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Qn.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function er(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Qn.get(n);a&&a!==e&&$n(a),$n(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Qn.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function tr(e){let t=e.context.dataRef.current,n=pe(()=>t.hoverInteractionState??Zn.create()).current;return t.hoverInteractionState||=n,x(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function nr(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=m(),d=g(),f=tr(a),p=fe(),h=J(()=>Ot(l.current.openEvent?.type,f.interactedInside)),_=J(()=>kt(l.current.openEvent?.type)),y=J(()=>{$n(f)});q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,y())},[o,f,y]),Q.useEffect(()=>y,[y]),q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&_()&&F(c)&&s){let e=c,t=s,n=Be(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r;return er(f,{scopeElement:f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,o,c,s,f,_,u,d,y]),Q.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&v(u.nodesRef.current,d).length>0)}function t(e){let t=Et(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,Y(K,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=ie(e);if(!ke(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,g),y()}function m(n){if(e()&&u){u.events.on(`floating.closed`,g);return}if(ge(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&F(o)&&v(u.nodesRef.current,r,!1).some(e=>X(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}y(),_()&&!h()&&t(n)}}function g(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,g),a.setOpen(!1,Y(K,t)),u.events.emit(`floating.closed`,t)})}let b=s;return ve(b&&G(b,`mouseenter`,c),b&&G(b,`mouseleave`,m),b&&G(b,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,g)})},[n,s,a,l,r,i,_,h,y,f,u,d,p])}var rr={current:null};function ir(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=rr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:h}=t,g=`rootStore`in e?e.rootStore:e,{dataRef:_,events:v}=g.context,y=m(l),b=tr(g),x=Q.useRef(!1),S=U(i),C=U(r),w=U(o),T=U(n),E=U(h),D=U(p),O=J(()=>Ot(_.current.openEvent?.type,b.interactedInside)),k=J(()=>E.current?.()!==!1),A=J((e,t,n)=>{let r=g.context.triggerElements;if(r.hasElement(t))return!e||!X(e,t);if(!F(n))return!1;let i=n;return r.hasMatchingElement(e=>X(e,i))&&(!e||!X(e,i))}),j=J(()=>{b.handler&&=(Be(g.select(`domReferenceElement`)).removeEventListener(`mousemove`,b.handler),void 0)}),M=J(()=>{$n(b)});return u&&(b.handleCloseOptions=S.current?.__options),Q.useEffect(()=>j,[j]),Q.useEffect(()=>{if(!n)return;function e(e){e.open?x.current=!1:(x.current=e.reason===K,j(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}return v.on(`openchange`,e),()=>{v.off(`openchange`,e)}},[n,v,b,j]),Q.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Et(C.current,`close`,b.pointerType);n?b.openChangeTimeout.start(n,()=>{g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e)}):t&&(b.openChangeTimeout.clear(),g.setOpen(!1,Y(K,e)),y?.events.emit(`floating.closed`,e))}let t=c.current??(u?g.select(`domReferenceElement`):null);if(!F(t))return;function r(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,a&&!d(b.pointerType))return;let t=Dt(w.current),n=Et(C.current,`open`,b.pointerType),r=ie(e),i=e.currentTarget??null,o=g.select(`domReferenceElement`),s=i;if(F(r)&&!g.context.triggerElements.hasElement(r)){for(let e of g.context.triggerElements.elements())if(X(e,r)){s=e;break}}F(i)&&F(o)&&!g.context.triggerElements.hasElement(i)&&X(i,o)&&(s=o);let c=s==null?!1:A(o,s,r),l=g.select(`open`),u=D.current?.()??g.select(`transitionStatus`)===`ending`,f=!l&&u&&x.current,p=!c&&F(s)&&F(o)&&X(o,s)&&f,m=t>0&&!n,h=c&&(l||f)||p,_=!l||c;if(h){k()&&g.setOpen(!0,Y(K,e,s));return}m||(n?b.openChangeTimeout.start(n,()=>{_&&k()&&g.setOpen(!0,Y(K,e,s))}):_&&k()&&g.setOpen(!0,Y(K,e,s)))}function i(t){if(O()){M();return}j();let n=Be(g.select(`domReferenceElement`));b.restTimeout.clear(),b.restTimeoutPending=!1;let r=_.current.floatingContext??f?.();if(!ge(t.relatedTarget,g.context.triggerElements)){if(S.current&&r){g.select(`open`)||b.openChangeTimeout.clear();let i=c.current;b.handler=S.current({...r,tree:y,x:t.clientX,y:t.clientY,onClose(){M(),j(),T.current&&!O()&&i===g.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,b.handler),b.handler(t);return}(b.pointerType!==`touch`||!X(g.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?ve(G(t,`mousemove`,r,{once:!0}),G(t,`mouseenter`,r),G(t,`mouseleave`,i)):ve(G(t,`mouseenter`,r),G(t,`mouseleave`,i))},[j,M,_,C,g,n,S,b,u,A,O,a,s,w,c,y,T,f,D,k]),Q.useMemo(()=>{if(!n)return;function e(e){b.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=g.select(`domReferenceElement`),i=g.select(`open`),o=A(r,n,e.target);if(a&&!d(b.pointerType))return;if(i&&o&&b.handleCloseOptions?.blockPointerEvents){let e=g.select(`floatingElement`);e&&er(b,{scopeElement:b.handleCloseOptions?.getScope?.()??n.ownerDocument.body,referenceElement:n,floatingElement:e})}let s=Dt(w.current);if(i&&!o||s===0||!o&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;b.restTimeout.clear();function c(){if(b.restTimeoutPending=!1,O())return;let e=g.select(`open`);!b.blockMouseMove&&(!e||o)&&k()&&g.setOpen(!0,Y(K,t,n))}b.pointerType===`touch`?St.flushSync(()=>{c()}):o&&i?c():(b.restTimeoutPending=!0,b.restTimeout.start(s,c))}}},[n,b,O,A,a,g,w,k])}var ar=.1,or=ar*ar,$=.5;function sr(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function cr(e,t,n,r,i,a,o,s,c,l){let u=!1;return sr(e,t,n,r,i,a)&&(u=!u),sr(e,t,i,a,o,s)&&(u=!u),sr(e,t,o,s,c,l)&&(u=!u),sr(e,t,c,l,n,r)&&(u=!u),u}function lr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function ur(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function dr(e={}){let{blockPointerEvents:t=!1}=e,n=new ce,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*or;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=ie(r),g=r.type===`mouseleave`,_=X(u,h),y=X(a,h);if(_&&(l=!0,!g))return;if(y&&(l=!1,!g)){l=!0;return}if(g&&F(r.relatedTarget)&&X(u,r.relatedTarget))return;function b(){return!!(s&&v(s.nodesRef.current,o).length>0)}function x(){b()||m()}if(b())return;let S=a.getBoundingClientRect(),C=u.getBoundingClientRect(),w=e>C.right-C.width/2,T=t>C.bottom-C.height/2,E=C.width>S.width,D=C.height>S.height,O=(E?S:C).left,k=(E?S:C).right,A=(D?S:C).top,j=(D?S:C).bottom;if(c===`top`&&t>=S.bottom-1||c===`bottom`&&t<=S.top+1||c===`left`&&e>=S.right-1||c===`right`&&e<=S.left+1){x();return}let M=!1;switch(c){case`top`:M=ur(d,f,O,S.top+1,k,C.bottom-1);break;case`bottom`:M=ur(d,f,O,C.top+1,k,S.bottom-1);break;case`left`:M=ur(d,f,C.right-1,j,S.left+1,A);break;case`right`:M=ur(d,f,S.right-1,j,C.left+1,A);break;default:}if(M)return;if(l&&!lr(d,f,S)){x();return}if(!g&&p(d,f)){x();return}let N=!1;switch(c){case`top`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t+$+1,o=w||E?C.bottom-$:C.top,s=w?E?C.bottom-$:C.top:C.bottom-$;N=cr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`bottom`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t-$,o=w||E?C.top+$:C.bottom,s=w?E?C.top+$:C.bottom:C.top+$;N=cr(d,f,r,a,i,a,C.left,o,C.right,s);break}case`left`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e+$+1,o=T||D?C.right-$:C.left,s=T?D?C.right-$:C.left:C.right-$;N=cr(d,f,o,C.top,s,C.bottom,a,r,a,i);break}case`right`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e-$,o=T||D?C.left+$:C.right,s=T?D?C.left+$:C.right:C.left+$;N=cr(d,f,a,r,a,i,o,C.top,s,C.bottom);break}default:}N?l||n.start(40,x):x()}};return r.__options={...e,blockPointerEvents:t},r}var fr={...Je,disabled:Qe(e=>e.disabled),instantType:Qe(e=>e.instantType),isInstantPhase:Qe(e=>e.isInstantPhase),trackCursorAxis:Qe(e=>e.trackCursorAxis),disableHoverablePopup:Qe(e=>e.disableHoverablePopup),lastOpenChangeReason:Qe(e=>e.openChangeReason),closeOnClick:Qe(e=>e.closeOnClick),closeDelay:Qe(e=>e.closeDelay),hasViewport:Qe(e=>e.hasViewport)},pr=class e extends f{constructor(e,t,n=!1){let r=new Ce,i={...mr(),...e};i.floatingRootContext=Ie(r,t,n),super(i,{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},fr)}setOpen=(e,t)=>{He(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,Y(Re,e))}static useStore(t,n){return Xe(t,(t,r)=>new e(n,t,r)).store}};function mr(){return{...xe(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var hr=D(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=pr.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});Ae(p,r,n,d),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),Le(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Oe(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Q.useRef(null);q(()=>{m&&t&&p.setOpen(!1,Y(Se))},[m,t,p]),q(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=Q.useCallback(()=>{p.setOpen(!1,Y(Ye))},[p]);Q.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,Z.jsxs)(Ct.Provider,{value:p,children:[E&&(0,Z.jsx)(gr,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function gr({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=ae(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=It(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return he(e,{activeTriggerProps:Q.useMemo(()=>M(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:Q.useMemo(()=>M(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:Q.useMemo(()=>M(Ee,a.floating,i.floating),[a.floating,i.floating])}),null}var _r=Q.createContext(void 0);function vr(){return Q.useContext(_r)}var yr=function(e){return e[e.popupOpen=_e.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),br=`data-base-ui-tooltip-trigger`;function xr(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(F(n))return n}}let t=e.target;return F(t)?t:null}function Sr(e){let t=e;for(;t;){if(t.hasAttribute(br))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&F(n.host)?n.host:null}return null}var Cr=me(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:f,...p}=e,m=wt(!0),h=a?.store??m;if(!h)throw Error(k(82));let g=Me(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`isOpenedByTrigger`,g),y=h.useState(`floatingRootContext`),b=Q.useRef(null),x=c??600,S=u??0,{registerTrigger:C,isMountedByThisTrigger:w}=tt(g,b,h,{payload:o,closeOnClick:l,closeDelay:S}),T=vr(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Nt(y,{open:v}),A=tr(y);h.useSyncedValue(`isInstantPhase`,D);let j=h.useState(`disabled`),M=s??j,N=U(M),P=h.useState(`trackCursorAxis`),F=h.useState(`disableHoverablePopup`),I=Q.useRef(!1),L=fe(),ee=Q.useRef(void 0);function R(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:c??e??x),n}function te(e){let t=b.current;if(!t||!e)return!1;let n=Sr(e);return n!==null&&n!==t&&X(t,n)}function z(e){let t=te(e);return I.current=t,t&&(A.openChangeTimeout.clear(),A.restTimeout.clear(),A.restTimeoutPending=!1,L.clear()),t}let ne=ir(y,{enabled:!M,mouseOnly:!0,move:!1,handleClose:!F&&P!==`both`?dr():null,restMs:R,delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return u==null&&O&&(t=e),{close:t}},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`,shouldOpen(){return!I.current}}),re=Xn(y,{enabled:!M}).reference,ie=e=>{let t=I.current,n=xr(e),r=z(n),i=b.current,a=i&&n&&X(i,n);if(r&&h.select(`open`)&&h.select(`lastOpenChangeReason`)===`trigger-hover`){h.setOpen(!1,Y(K,e));return}if(t&&!r&&a&&!N.current&&!h.select(`open`)&&i&&d(ee.current)){let t=()=>{!I.current&&!N.current&&!h.select(`open`)&&h.setOpen(!0,Y(K,e,i))},n=R();n===0?(L.clear(),t()):L.start(n,t)}},ae=h.useState(`triggerProps`,w);return Ne(`button`,e,{state:{open:v},ref:[t,C,b],props:[ne,re,w||P!==`none`?ae:void 0,{onMouseOver(e){ie(e.nativeEvent)},onFocus(e){te(xr(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){I.current=!1,L.clear(),ee.current=void 0},onPointerEnter(e){ee.current=e.pointerType},onPointerDown(e){ee.current=e.pointerType,h.set(`closeOnClick`,l),l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!h.select(`open`)&&h.cancelPendingOpen(e.nativeEvent)},id:g,[yr.triggerDisabled]:M?``:void 0,[br]:M?void 0:``},p],stateAttributesMapping:Ge})}),wr=Q.createContext(void 0);function Tr(){let e=Q.useContext(wr);if(e===void 0)throw Error(k(70));return e}var Er=Q.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=I({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Z.jsxs)(Q.Fragment,{children:[l,c&&St.createPortal(n,c)]})}),Dr=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return wt().useState(`mounted`)||n?(0,Z.jsx)(wr.Provider,{value:n,children:(0,Z.jsx)(Er,{ref:t,...r})}):null}),Or=Q.createContext(void 0);function kr(){let e=Q.useContext(Or);if(e===void 0)throw Error(k(71));return e}var Ar=Q.createContext(void 0);function jr(){return Q.useContext(Ar)?.direction??`ltr`}var Mr=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:d=0,offsetParent:f=`real`}=z(e,t)||{};if(l==null)return{};let p=E(d),m={x:n,y:r},h=le(i),g=se(h),_=await o.getDimensions(l),v=h===`y`,y=v?`top`:`left`,b=v?`bottom`:`right`,x=v?`clientHeight`:`clientWidth`,S=a.reference[g]+a.reference[h]-m[h]-a.floating[g],C=m[h]-a.reference[h],T=f===`real`?await o.getOffsetParent?.(l):s.floating,D=s.floating[x]||a.floating[g];(!D||!await o.isElement?.(T))&&(D=s.floating[x]||a.floating[g]);let O=S/2-C/2,k=D/2-_[g]/2-1,A=Math.min(p[y],k),j=Math.min(p[b],k),M=A,N=D-_[g]-j,P=D/2-_[g]/2+O,F=w(M,P,N),I=!c.arrow&&u(i)!=null&&P!==F&&a.reference[g]/2-(P<M?A:j)-_[g]/2<0,L=I?P<M?P-M:P-N:0;return{[h]:m[h]+L,data:{[h]:F,centerOffset:P-F-L,...I&&{alignmentOffset:L}},reset:I}}}),Nr=(e,t)=>({...Mr(e),options:[e,t]}),Pr=Kn().fn,Fr={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Pr(e)).data?.referenceHidden||a}}}},Ir={sideX:`left`,sideY:`top`},Lr={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=W(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Ir};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=Be(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=V(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Ir.sideX,g=f===`top`?`bottom`:Ir.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Rr(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function zr(e,t,n){let{rects:r,placement:i}=e;return{side:Rr(t,V(i),n),align:u(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Br(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Q.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=J(O),A=O?k:t,j=U(t),M=U(g),N=jr()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),ee=+(r===`top`),R=+(r===`right`),te=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+te,bottom:I+ee,left:I+R}:I&&={top:(I.top||0)+L,right:(I.right||0)+te,bottom:(I.bottom||0)+ee,left:(I.left||0)+R};let z={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},ne=Q.useRef(null),re=U(i),ie=U(o),ae=typeof i==`function`?0:i,oe=typeof o==`function`?0:o,se=[];p&&se.push(p),se.push(Vn(e=>{let t=zr(e,r,N),n=typeof re.current==`function`?re.current(t):re.current,i=typeof ie.current==`function`?ie.current(t):ie.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[ae,oe,N,r]));let ce=E===`none`&&T!==`shift`,le=!ce&&(l||v||T===`shift`),ue=T===`none`?null:Wn({...z,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!v&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),de=ce?null:Hn(e=>{let t=Be(e.elements.floating).documentElement;return{...z,rootBoundary:v?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:le,limiter:l||v?void 0:Un(e=>{if(!ne.current)return{};let{width:t,height:n}=ne.current.getBoundingClientRect(),r=B(V(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[z,l,v,I,E]);T===`shift`||E===`shift`||a===`center`?se.push(de,ue):se.push(ue,de),se.push(Gn({...z,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=W(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Nr(e=>({element:ne.current||Be(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=V(a),l=B(c),u=ne.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(zr(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,le&&l===`y`&&b?S:x),{}}},Fr,b),q(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let fe=Q.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:H,y:he,middlewareData:ge,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=Jn({rootContext:h,open:m?g:void 0,placement:F,middleware:se,strategy:n,whileElementsMounted:m?void 0:(...e)=>Dn(...e,fe),nodeId:y,externalTree:S}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||Ir,we=be?n:`fixed`,Te=Q.useMemo(()=>{let e=b?{position:we,[Se]:H,[Ce]:he}:{position:we,...xe};return be||(e.opacity=0),e},[b,we,Se,H,Ce,he,xe,be]),Ee=Q.useRef(null);q(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(Vr(t)?t.current:t)||null;n!==Ee.current&&(pe.setPositionReference(n),Ee.current=n)},[g,pe,A,j]),Q.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&Vr(e)&&e.current!==Ee.current&&(pe.setPositionReference(e.current),Ee.current=e.current)},[g,pe,A,j]),Q.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return Dn(me.reference,me.floating,_e,fe)},[m,g,me,_e,fe]);let De=V(ve),Oe=Rr(r,De,N),ke=u(ve)||`center`,Ae=!!ge.hide?.referenceHidden;q(()=>{x&&g&&be&&w(De)},[x,g,be,De]);let je=Q.useMemo(()=>({position:`absolute`,top:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.arrow?.centerOffset!==0;return Q.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:ne,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:pe,context:ye,isPositioned:be,update:_e}),[Te,je,ne,Me,Oe,ke,De,Ae,pe,ye,be,_e])}function Vr(e){return e!=null&&`current`in e}function Hr(e){return e===`starting`?Pe:je}function Ur(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),Ne(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Hr(r),i],stateAttributesMapping:Ve})}var Wr=Q.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=c,style:_,...v}=e,y=wt(),b=Tr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`trackCursorAxis`),w=y.useState(`disableHoverablePopup`),T=y.useState(`floatingRootContext`),E=y.useState(`instantType`),D=y.useState(`transitionStatus`),O=Br({anchor:i,positionMethod:a,floatingRootContext:T,mounted:S,side:o,sideOffset:l,align:s,alignOffset:u,collisionBoundary:d,collisionPadding:f,sticky:m,arrowPadding:p,disableAnchorTracking:h,keepMounted:b,collisionAvoidance:g,adaptiveOrigin:y.useState(`hasViewport`)?Lr:void 0}),k=Ur(e,Q.useMemo(()=>({open:x,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:C===`none`?E:`tracking-cursor`}),[x,O.side,O.align,O.anchorHidden,C,E]),{styles:O.positionerStyles,transitionStatus:D,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x||C===`both`||w});return(0,Z.jsx)(Or.Provider,{value:O,children:k})}),Gr={...Ve,...et},Kr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=wt(),{side:s,align:c}=kr(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);ye({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),nr(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return Ne(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,Hr(d),a],stateAttributesMapping:Gr})}),qr=o({method:`GET`}).handler(r(`aa46310016bb8a58b273a648ffd498c87f1f450d12827e30110a3b83ba6a27d9`)),Jr=o({method:`POST`}).handler(r(`ed679b4e1e05e903a5d4ba4a70d9b9d883991ab22ed59b4d2d69078941818415`)),Yr=o({method:`GET`}).handler(r(`169566e7637a22599b4eb32ee3775574e99677406922bbef7482a102036c33dd`)),Xr=o({method:`POST`}).handler(r(`27d7eba0b6a2257949392fdd56057275a5c5366484ae01faf3b5897a225ecd83`)),Zr=o({method:`POST`}).handler(r(`a6384dc7154d9930422d29396f5de64b3ac69c62ad3824bc4a22d745fc07b293`));function Qr(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r.sort((e,t)=>e.ts<t.ts?-1:+(e.ts>t.ts)),r}var $r=16,ei=`rounded-[4px]`,ti=`h-5 w-[18px] shrink-0 ${ei}`;function ni({run:e,onClick:t}){let n=e.error||e.message||``,r=e.durationMs?` · ${vt(e.durationMs)}`:``;return(0,Z.jsxs)(hr,{children:[(0,Z.jsx)(Cr,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":ct(e),className:`${ti} cursor-pointer transition-opacity hover:opacity-70`,style:{background:yt(e),opacity:at(e),...e.running?dt:{}}})}),(0,Z.jsx)(Dr,{children:(0,Z.jsx)(Wr,{sideOffset:8,children:(0,Z.jsxs)(Kr,{className:`glass-strong pointer-events-none max-w-[340px] rounded-control px-3.5 py-2.5 text-meta leading-snug text-primary`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,Z.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:yt(e)}}),ct(e),(0,Z.jsxs)(`span`,{className:`ml-auto whitespace-nowrap pl-3 font-mono text-caption font-normal text-secondary`,children:[lt(e.ts),r]})]}),n&&(0,Z.jsx)(`div`,{className:`mt-1.5 max-h-[150px] overflow-hidden whitespace-pre-wrap ${e.error?`text-accent`:`text-secondary`}`,children:n})]})})})]})}function ri({count:e,onClick:t,loading:n}){return e?(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},className:`flex h-5 w-[18px] shrink-0 items-center justify-center overflow-hidden border border-wire px-0 font-mono text-[9px] leading-none text-disabled transition-colors hover:border-display hover:text-primary ${ei} ${n?`animate-pulse`:`cursor-pointer`}`,title:`${e} more - click to reveal`,children:n?`…`:e}):null}function ii({job:e,runs:t,total:n,onLoadMore:r,onPickRun:i}){let a=t,o=e.enabled,s=ft(e),c=a.length,l=Math.max(0,n-c),u=bt(),[d,f]=(0,Q.useState)(-1),[p,m]=(0,Q.useState)(!1),h=Math.max(0,c-16),g=d<0?h:Math.min(d,h),_=Math.min(g+16,c),v=a.slice(g,_),y=l+g,b=c-_,x=b===0,S=async()=>{let e=g-$r;if(e<0&&l>0&&!p){m(!0);let e=await r().catch(()=>0);m(!1),f(Math.max(0,g+e-$r));return}f(Math.max(0,e))},C=()=>{let e=g+$r;f(e>=h?-1:e)},w=!!(e.running||e.queued)&&x,T=x&&o&&!s&&!!e.nextRun&&!w;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[3px] overflow-x-auto`,children:[(0,Z.jsx)(ri,{count:y,onClick:S,loading:p}),v.map(e=>(0,Z.jsx)(ni,{run:e,onClick:()=>i(e)},e.id)),T?(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-12 border-t border-dashed border-wire`}),(0,Z.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-full border border-wire`,title:u?`Next scheduled run · ${lt(e.nextRun)}`:void 0}),(0,Z.jsx)(`span`,{className:`text-caption text-disabled`,children:u?st(e.nextRun):``})]}):!x&&(0,Z.jsx)(ri,{count:b,onClick:C})]})}function ai(e,t,n=Date.now()){let r=t?Date.parse(t):NaN;if(!Number.isFinite(r))return`offline`;let i=n-r;return e&&i<3e4?`online`:i<216e5?`asleep`:`offline`}function oi(e){let t=/^\s*v?(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function si(e){return/^\s*v?\d+\.\d+\.\d+-/.test(e)}function ci(e,t){if(!e||!t)return!1;let n=oi(e),r=oi(t);if(!n||!r)return!1;for(let e=0;e<3;e++){let t=n[e],i=r[e];if(t<i)return!0;if(t>i)return!1}return si(e)&&!si(t)}function li(e,t,n,r){let i=`${n} daemon start --server-url ${e} --connect-key ${t}`;return r?i:`npm install -g @kky42/pievo@latest && ${i}`}function ui(e,t){let n=`${e} daemon restart`;return t?n:`npm install -g @kky42/pievo@latest && ${n}`}function di(e,t,n){return li(typeof window<`u`?window.location.origin:`http://127.0.0.1:3000`,e,t,n)}function fi({text:e}){let[t,n]=(0,Q.useState)(!1);return(0,Z.jsx)(`button`,{className:ht,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1400)},children:t?`Copied ✓`:`Copy`})}function pi({open:e,onClose:t,teamId:n}){let[r,i]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!e){h(null);return}let t=!0;return _(null),y(!1),a().then(e=>{t&&_(e)}).catch(()=>{t&&y(!0)}),()=>{t=!1}},[e]);let b=(0,Q.useCallback)(async()=>{try{i(await qr({data:n}))}catch{}},[n]),x=(0,Q.useRef)(e);x.current=e,(0,Q.useEffect)(()=>{if(!e||o)return;b();let t=setInterval(()=>x.current&&void b(),3e3);return()=>clearInterval(t)},[e,o,b]),(0,Q.useEffect)(()=>{if(!o)return;let e=!0,t=async()=>{let t=await Yr({data:o.id}).catch(()=>void 0);!e||t===void 0||(l(t),t?.online&&t.hostname&&d(e=>e||t.hostname||``))};t();let n=setInterval(t,2e3);return()=>{e=!1,clearInterval(n)}},[o]);async function S(){p(!0),h(null);try{let e=await Jr({data:n});if(`error`in e){h(e.error);return}l(null),d(``),s(e)}finally{p(!1)}}async function C(){o&&await Zr({data:o.id}),s(null),l(null),await b()}async function w(){o&&u.trim()&&await Xr({data:{id:o.id,name:u.trim()}}),s(null),l(null),await b()}async function T(e){h(null);let t=await Zr({data:e});if(!t.ok){h(t.error??`Could not delete this machine.`),await b();return}await b()}let E=!!c?.online;return o?(0,Z.jsxs)(Ke,{open:e,onClose:C,children:[(0,Z.jsx)(ze,{title:E?`Computer connected`:`Connect computer`}),E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mt-5 flex items-center gap-3 rounded-control border border-hairline bg-success-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`text-xl text-success`,children:`✓`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-[15px] font-medium text-display`,children:`Computer connected successfully!`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[c?.hostname??`unknown`,c?.platform?` - ${c.platform} ${c.arch??``}`:``]})]})]}),(0,Z.jsxs)(`div`,{className:`mt-5`,children:[(0,Z.jsx)(`label`,{className:mt,children:`Computer name`}),(0,Z.jsx)(`input`,{className:gt,value:u,onChange:e=>d(e.target.value),placeholder:c?.hostname??`My computer`}),(0,Z.jsx)(`div`,{className:`mt-1 text-label text-secondary`,children:`A friendly name for this computer.`})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-5 text-body font-medium text-display`,children:`Run this command on your computer to connect:`}),g?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-4 font-mono text-label leading-relaxed text-paper`,children:di(o.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(fi,{text:di(o.token,g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`mt-2 text-body text-secondary`,children:v?`Could not load the connection command. Close and try again.`:`Loading connection command…`}),(0,Z.jsxs)(`div`,{className:`mt-4 flex items-center gap-2.5 rounded-control border border-hairline bg-warn-soft px-4 py-3`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 animate-pulse rounded-full bg-rubik-orange`}),(0,Z.jsx)(`span`,{className:`text-[14px] font-medium text-warn`,children:`Waiting for computer to connect…`})]})]}),(0,Z.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,Z.jsx)(`button`,{className:ht,onClick:()=>void C(),children:`Cancel`}),(0,Z.jsx)(`button`,{className:pt,disabled:!E||!u.trim(),onClick:()=>void w(),children:`Done`})]})]}):(0,Z.jsxs)(Ke,{open:e,onClose:t,children:[(0,Z.jsx)(ze,{title:`Machines`,sub:`Each machine runs a pievo daemon that executes your loops via your local coding agent.`}),(0,Z.jsx)(We,{children:`Connected machines`}),m&&(0,Z.jsx)(_t,{message:m,onDismiss:()=>h(null)}),r.length===0&&(0,Z.jsx)(`div`,{className:`py-3 text-body text-secondary`,children:`No machines yet.`}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=ai(e.online,e.lastSeen),n=t===`online`?`bg-rubik-green`:t===`asleep`?`bg-rubik-yellow`:`bg-disabled`,r=t===`online`?`online`:t===`asleep`?`asleep${e.lastSeen?` · seen ${ot(e.lastSeen)}`:``}`:e.lastSeen?`offline · seen ${ot(e.lastSeen)}`:`offline`;return(0,Z.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-control border border-hairline bg-surface px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`,title:t}),(0,Z.jsx)(`span`,{className:`text-[15px] font-medium text-display`,children:e.name}),(0,Z.jsxs)(`span`,{className:`text-label text-secondary`,children:[r,e.platform?` · ${e.platform} ${e.arch??``}`:``,e.loopCount>0?` · ${e.loopCount} loop${e.loopCount===1?``:`s`}`:``]})]}),(0,Z.jsx)(`button`,{className:ut,disabled:e.loopCount>0,title:e.loopCount>0?`Delete its loops first`:void 0,onClick:()=>void T(e.id),children:`Delete`})]}),(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:xt(e.daemonProtocol).label}),e.daemonProtocol!==2&&(0,Z.jsx)(`div`,{className:`text-label text-accent`,children:`Daemon upgrade required to stop a running process`}),!e.online&&!e.token&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:`Reconnect command available from the machine owner's account.`}),!e.online&&e.token&&!g&&(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the reconnect command. Close and try again.`:`Loading reconnect command…`}),!e.online&&e.token&&g&&(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer select-none text-label font-medium text-secondary marker:content-[''] hover:text-display`,children:`Reconnect command`}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:di(e.token,g.pievoCli,g.customCli)}),(0,Z.jsx)(fi,{text:di(e.token,g.pievoCli,g.customCli)})]})]}),ci(e.daemonVersion,e.latestDaemonVersion)&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`daemon v`,e.daemonVersion,` · upgrade available (v`,e.latestDaemonVersion,`)`]}),g?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:`flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded-control bg-display p-3 font-mono text-caption leading-relaxed text-paper`,children:ui(g.pievoCli,g.customCli)}),(0,Z.jsx)(fi,{text:ui(g.pievoCli,g.customCli)})]}):(0,Z.jsx)(`div`,{className:`text-label text-secondary`,children:v?`Could not load the upgrade command. Close and try again.`:`Loading upgrade command…`})]})]},e.id)})}),(0,Z.jsx)(`div`,{className:`mt-6`,children:(0,Z.jsx)(`button`,{className:pt,disabled:f,onClick:()=>void S(),children:f?`Preparing…`:`+ Connect computer`})})]})}var mi=o({method:`GET`}).handler(r(`ced5641f28e3e64d3b8773ea4c875b78ee305bd08caba90a2207e86ef1ab3327`)),hi=o({method:`POST`}).handler(r(`d6cb1ea6f7fdaf940fbbe91d6b0898a0d5ac2308f8bc572dc3b856824a1f4581`)),gi=o({method:`POST`}).handler(r(`9defc1b5d0f4316d61621e2c4614a70dc052ad6b7a3aa2ead00836f7d5cb5b4c`)),_i=o({method:`POST`}).handler(r(`a4e3ae06af7087a3dc291236cf6d5ad272e2f754884c1f948e75a18a4ebada93`));export{pi as a,qr as c,_i as i,_r as l,gi as n,ii as o,mi as r,Qr as s,hi as t,Mt as u};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-ChGGALzg.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't load the dashboard.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
1
+ import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-Dxe9cHAc.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't load the dashboard.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-ycaoAemE.js";import{a as n,o as r}from"./index-C4UaIr-9.js";import{t as i}from"./SignIn-CbMeIAJZ.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{initial:e.initial})}export{o as component};
1
+ import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-ycaoAemE.js";import{a as n,o as r}from"./index-Dg07vo1l.js";import{t as i}from"./SignIn-BAoOONQ9.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{initial:e.initial})}export{o as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-ycaoAemE.js";import{i as n,o as r}from"./index-C4UaIr-9.js";import{t as i}from"./SignIn-CbMeIAJZ.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{teamId:e.teamId,initial:e.initial},e.teamId)}export{o as component};
1
+ import{t as e}from"./jsx-runtime-BseJUIpC.js";import{c as t}from"./preload-helper-ycaoAemE.js";import{i as n,o as r}from"./index-Dg07vo1l.js";import{t as i}from"./SignIn-BAoOONQ9.js";var a=e();function o(){let e=n.useLoaderData(),{data:o,isPending:s}=t();return e?.auth?.enabled&&!s&&!o||e?.mode===`signin`?(0,a.jsx)(i,{}):(0,a.jsx)(r,{teamId:e.teamId,initial:e.initial},e.teamId)}export{o as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-ChGGALzg.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't open this team.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
1
+ import{t as e}from"./jsx-runtime-BseJUIpC.js";import{t}from"./useRouter-DsjH8G0p.js";import{r as n}from"./actionUi-Dxe9cHAc.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't open this team.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
@@ -0,0 +1 @@
1
+ import{n as e,s as t,t as n}from"./jsx-runtime-BseJUIpC.js";var r=t(e(),1),i=e=>e?new Date(e).toLocaleString():`—`,a=e=>{if(!e)return``;let t=Math.round((Date.now()-Date.parse(e))/1e3);if(t<60)return`${t}s ago`;let n=Math.round(t/60);if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`},o=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function s(e){let t=(e||``).trim().split(/\s+/);if(t.length!==5)return e;let[n,r,i,a,s]=t,c=i===`*`&&a===`*`,l=r.match(/^\*\/(\d+)$/);if(l&&c&&s===`*`)return`every ${l[1]}h`;let u=n.match(/^\*\/(\d+)$/);if(u&&r===`*`&&c&&s===`*`)return`every ${u[1]}m`;if(r===`*`&&/^\d+$/.test(n)&&c&&s===`*`)return`hourly :${n.padStart(2,`0`)}`;if(/^\d+$/.test(n)&&/^\d+$/.test(r)&&c){let e=`${r.padStart(2,`0`)}:${n.padStart(2,`0`)}`;if(s===`*`)return`daily ${e}`;if(/^[0-6]$/.test(s))return`${o[Number(s)]} ${e}`}return e}var c=e=>{if(!e)return``;let t=Math.round((Date.parse(e)-Date.now())/1e3);if(t<=0)return`due`;let n=Math.round(t/60);if(n<60)return`in ${n}m`;let r=Math.round(n/60);return r<24?`in ${r}h`:`in ${Math.round(r/24)}d`},l=e=>{let t=new Date(e);return`${t.getMonth()+1}/${t.getDate()}`},u=e=>{if(!e)return`—`;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`},d=e=>Math.abs(e)>=1e3?`${Math.round(e/100)/10}k`:`${Math.round(e*100)/100}`,f=e=>e?`${Math.round(e/1e3)}s`:``;function p(e){let t=Math.abs(e);return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}var m={kept:{c:`var(--color-run-kept)`,label:`Kept`},"no-change":{c:`var(--color-run-no-change)`,label:`No change`},blocked:{c:`var(--color-run-blocked)`,label:`Blocked`},error:{c:`var(--color-run-error)`,label:`Error`},warning:{c:`var(--color-run-warning)`,label:`Missing status`},canceled:{c:`var(--color-run-canceled)`,label:`Canceled`},queued:{c:`var(--color-run-queued)`,label:`Queued`},"active-exec":{c:`var(--color-run-active-exec)`,label:`Running…`},"active-edit":{c:`var(--color-run-active-edit)`,label:`Editing…`},"active-evolve":{c:`var(--color-run-active-evolve)`,label:`Evolving…`}},h=e=>e===`kept`||e===`no-change`||e===`blocked`?m[e]:void 0,g=e=>e.role===`edit`?`edit`:e.role===`evolve`?`evolve`:`exec`,_=e=>g(e)===`edit`?`Edited`:g(e)===`evolve`?`Improved`:`Kept`;function v(e){return e.running?m[`active-${g(e)}`].c:e.status===`blocked`?m.blocked.c:e.queued?m.queued.c:e.phase===`error`?m.error.c:e.canceled||e.phase===`canceled`?m.canceled.c:e.phase===`done`&&!h(e.status)?m.warning.c:(h(e.status)??m[`no-change`]).c}function y(e){return e.running||e.status===`blocked`||e.phase===`error`?1:e.queued?.7:e.canceled||e.phase===`canceled`?.5:e.phase===`done`&&!h(e.status)?.9:e.status===`no-change`?.55:1}function b(e){return e.queued?m.queued.label:e.running?e.cancelRequested?`Stopping…`:m[`active-${g(e)}`].label:e.status===`blocked`?m.blocked.label:e.phase===`error`?e.cancelRequested?`Failed while stopping`:m.error.label:e.canceled||e.phase===`canceled`?(e.error,`Canceled`):e.cancelRequested&&e.phase===`done`?`Succeeded while stopping`:e.status===`kept`?_(e):e.status===`no-change`?m[`no-change`].label:e.phase===`done`?m.warning.label:m[`no-change`].label}var x=e=>{let t=e.runs??[];return t.length?t[t.length-1]:null};function S(e){return e.completedAt!=null}function C(e){return e.goal!=null&&e.goal!==``}var w=n(),T=()=>()=>{},E=()=>(0,r.useSyncExternalStore)(T,()=>!0,()=>!1),D=`focus-visible:outline-none focus-visible:shadow-focus`,O=`inline-flex cursor-pointer items-center gap-1.5 rounded-control px-4 py-2 text-body font-medium transition-colors duration-150 disabled:cursor-default disabled:opacity-40 ${D}`,k=`${O} border border-wire bg-surface text-primary hover:bg-raised`,A=`${O} border border-display bg-display text-paper hover:opacity-85`,j=`${O} border border-transparent bg-rubik-red text-white hover:opacity-85`,M=`${O} border border-display bg-transparent text-display hover:bg-[color:var(--color-display)]/8`,N=`inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-full border border-wire bg-surface px-3 py-1 text-label font-medium text-primary transition-colors duration-150 hover:bg-raised disabled:cursor-default disabled:opacity-40 ${D}`,P=`inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-full border border-display bg-display px-4 py-2 text-body font-medium text-paper transition-colors duration-150 hover:opacity-85 disabled:cursor-default disabled:opacity-40 ${D}`,F=`inline-flex cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-meta font-medium text-secondary transition-colors hover:text-display`,I=`text-label font-semibold text-secondary`,L=`mb-1.5 mt-3 block text-label font-medium text-secondary`,R=`w-full rounded-control border border-wire bg-surface px-3 py-2.5 text-sm text-primary outline-none transition-shadow focus:border-transparent focus:shadow-focus`,z=`${R} lp-select cursor-pointer`,B={animation:`runPulse 1.1s ease-in-out infinite`},V={background:`var(--color-rubik-yellow)`,...B};function H({message:e,onDismiss:t,className:n=`mb-2`}){return(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-body text-accent ${n}`,children:[(0,w.jsx)(`span`,{className:`mt-[5px] size-2 shrink-0 rounded-full bg-rubik-red`,"aria-hidden":!0}),(0,w.jsx)(`span`,{children:e}),t&&(0,w.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto shrink-0 cursor-pointer border-none bg-transparent p-0 text-label text-secondary transition-colors hover:text-display`,children:`Dismiss`})]})}function U({children:e}){return(0,w.jsx)(`pre`,{className:`max-h-[300px] overflow-auto whitespace-pre-wrap rounded-control border border-hairline bg-raised px-4 py-3.5 font-mono text-meta leading-relaxed text-secondary`,children:e})}var W={neutral:`bg-raised text-secondary`,ink:`bg-raised text-primary`,outline:`border border-hairline text-secondary`,running:`bg-running-soft text-running`,success:`bg-success-soft text-success`,accent:`bg-accent-soft text-accent`,warn:`bg-warn-soft text-warn`};function G({tone:e=`neutral`,dot:t,title:n,children:r}){return(0,w.jsxs)(`span`,{title:n,className:`inline-flex h-[22px] items-center gap-1.5 rounded-full px-2.5 text-caption font-medium ${W[e]}`,children:[t&&(0,w.jsx)(`span`,{className:`size-1.5 rounded-full`,style:t===`pulse`?V:{background:`var(--color-rubik-green)`}}),r]})}function K({className:e=``}){return(0,w.jsx)(`div`,{className:`text-body text-disabled ${e}`,children:`Loading…`})}function q({run:e,colorText:t}){return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,style:t?{color:v(e)}:void 0,children:[(0,w.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:v(e),opacity:y(e)}}),b(e)]})}export{x as A,y as C,p as D,d as E,a as M,u as N,C as O,c as P,b as S,i as T,I as _,q as a,s as b,j as c,F as d,N as f,V as g,B as h,U as i,l as j,S as k,A as l,L as m,K as n,k as o,R as p,G as r,M as s,H as t,P as u,z as v,f as w,v as x,E as y};
@@ -4,11 +4,11 @@ import { t as ReactCodeMirror } from "../_libs/uiw__react-codemirror.mjs";
4
4
  import { t as createTheme } from "../_libs/uiw__codemirror-themes.mjs";
5
5
  import { n as javascript, t as html } from "../_libs/@codemirror/lang-html+[...].mjs";
6
6
  import { t as json } from "../_libs/@codemirror/lang-json+[...].mjs";
7
- //#region node_modules/.nitro/vite/services/ssr/assets/CodeField-tm4rr6G3.js
7
+ //#region node_modules/.nitro/vite/services/ssr/assets/CodeField-B7oOmmwH.js
8
8
  var import_jsx_runtime = require_jsx_runtime();
9
9
  /**
10
- * CodeMirror-backed code field for the manual settings form (workflow JS /
11
- * metrics JSON / dashboard HTML). Lives in its OWN lazy chunk - LoopForm
10
+ * CodeMirror-backed code field for the manual settings form (metrics JSON /
11
+ * dashboard HTML). Lives in its OWN lazy chunk - LoopForm
12
12
  * `lazy()`-imports it, so CodeMirror never rides in the base client bundle
13
13
  * (same discipline as the recharts-bearing LoopView chunk).
14
14
  *
@@ -1,15 +1,15 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
2
  import { g as require_jsx_runtime, h as require_react, t as TooltipProvider } from "../_libs/@base-ui/react+[...].mjs";
3
- import { A as selectCls, C as labelCls, E as rel, N as useHydrated, S as isCompleted, _ as fmt, b as inputCls, c as btnDanger, f as btnSm, h as dotLabel, l as btnPrimary, o as btn, p as cronText, r as Pill, t as ErrorBanner, u as btnPrimaryPill, w as lastRunOf, x as isClosed } from "./ui-Dej2qjuS.mjs";
3
+ import { C as isCompleted, D as rel, P as useHydrated, S as isClosed, T as lastRunOf, c as btnDanger, f as btnSm, h as dotLabel, j as selectCls, l as btnPrimary, o as btn, p as cronText, r as Pill, t as ErrorBanner, u as btnPrimaryPill, v as fmt, w as labelCls, x as inputCls } from "./ui-WGITbP6Z.mjs";
4
4
  import { d as useNavigate } from "../_libs/@tanstack/react-router+[...].mjs";
5
5
  import { _ as mintClaim, g as loadOlderRuns, l as getConfig, m as listMyTeams, n as claimStatus, p as listJobs } from "./loopApi-BfMnXaKT.mjs";
6
- import { n as ModalHead, r as ModalSection, t as Modal } from "./Modal-DpKZHLZK.mjs";
7
- import { i as PievoLogo, n as GitHubIcon, r as LoopPlaybook, t as GITHUB_URL } from "./LoopPlaybook-BBn-xXpG.mjs";
6
+ import { n as ModalHead, r as ModalSection, t as Modal } from "./Modal-CfWC9R49.mjs";
7
+ import { i as PievoLogo, n as GitHubIcon, r as LoopPlaybook, t as GITHUB_URL } from "./LoopPlaybook-BxKPoWAp.mjs";
8
8
  import { t as setActiveTeamCookie } from "./teamCookie-B7hLOIie.mjs";
9
9
  import { a as getTeamDetail, d as revokeTeamInvite, f as setTeamMemberRole, i as deleteTeam, l as removeTeamMember, n as createTeam, o as leaveTeam, r as createTeamInvite, s as listManagedTeams, t as addTeamMember, u as renameTeam } from "./teamFns-D4I-0dEB.mjs";
10
- import { r as deriveLoopLifecycle } from "./lifecycleUi-BhRsBvJ7.mjs";
11
- import { a as listChannels, c as testChannel, i as deleteChannel, n as Timeline, o as listMachines, r as createChannel, s as mergeRuns, t as MachinesModal } from "./notifyFns-CdrijMGW.mjs";
12
- //#region node_modules/.nitro/vite/services/ssr/assets/DashboardView-CmDqjCiq.js
10
+ import { r as deriveLoopLifecycle } from "./lifecycleUi-l3nx9i3T.mjs";
11
+ import { a as listChannels, c as testChannel, i as deleteChannel, n as Timeline, o as listMachines, r as createChannel, s as mergeRuns, t as MachinesModal } from "./notifyFns-qZ6FYwAL.mjs";
12
+ //#region node_modules/.nitro/vite/services/ssr/assets/DashboardView-DJlDpXxU.js
13
13
  var import_react = /* @__PURE__ */ __toESM(require_react());
14
14
  var import_jsx_runtime = require_jsx_runtime();
15
15
  function LoopCard({ job, onOpen, onPickRun }) {
@@ -36,7 +36,7 @@ function LoopCard({ job, onOpen, onPickRun }) {
36
36
  };
37
37
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
38
38
  onClick: () => onOpen(job.id),
39
- className: `mb-[18px] cursor-pointer rounded-card border border-hairline bg-surface px-[26px] pb-5 pt-[22px] shadow-card transition-colors hover:border-wire ${en || latestIncidentRun?.reportIncident || job.pauseCause?.kind === "failure-streak" ? "" : "opacity-60"}`,
39
+ className: `mb-[18px] cursor-pointer rounded-card border border-hairline bg-surface px-[26px] pb-5 pt-[22px] shadow-card transition-colors hover:border-wire ${en || latestIncidentRun?.reportIncident || job.pauseCause?.kind === "failure-streak" || job.pauseCause?.kind === "blocked" ? "" : "opacity-60"}`,
40
40
  style: { animation: "fadeIn .25s cubic-bezier(0.25,0.1,0.25,1) both" },
41
41
  children: [
42
42
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
@@ -55,7 +55,7 @@ function LoopCard({ job, onOpen, onPickRun }) {
55
55
  tone: "running",
56
56
  dot: "pulse",
57
57
  children: "Stopping"
58
- }) : lifecycle === "paused-finishing" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { children: job.pauseCause?.kind === "owner" ? "Paused by owner · current run finishing" : "Paused · current run finishing" }) : lifecycle === "deleting" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { children: "Deleting" }) : job.running ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
58
+ }) : lifecycle === "paused-finishing" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { children: job.pauseCause?.kind === "blocked" ? "Paused — blocked · current run finishing" : job.pauseCause?.kind === "owner" ? "Paused by owner · current run finishing" : "Paused · current run finishing" }) : lifecycle === "deleting" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { children: "Deleting" }) : job.running ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
59
59
  tone: "running",
60
60
  dot: "pulse",
61
61
  children: "Running"
@@ -74,7 +74,10 @@ function LoopCard({ job, onOpen, onPickRun }) {
74
74
  title: job.goal ?? void 0,
75
75
  children: "Goal"
76
76
  }),
77
- !completed && lifecycle === "paused" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, { children: job.pauseCause?.kind === "failure-streak" ? "Paused automatically" : job.pauseCause?.kind === "owner" ? "Paused by owner" : "Paused" }),
77
+ !completed && lifecycle === "paused" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pill, {
78
+ tone: job.pauseCause?.kind === "blocked" ? "accent" : void 0,
79
+ children: job.pauseCause?.kind === "blocked" ? "Paused — blocked" : job.pauseCause?.kind === "failure-streak" ? "Paused automatically" : job.pauseCause?.kind === "owner" ? "Paused by owner" : "Paused"
80
+ }),
78
81
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
79
82
  className: "ml-auto min-w-0 text-right text-meta text-secondary",
80
83
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
@@ -121,7 +124,7 @@ function LoopCard({ job, onOpen, onPickRun }) {
121
124
  }),
122
125
  latestIncidentRun?.reportIncident && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
123
126
  className: "mt-1.5 text-label text-secondary",
124
- children: latestIncidentRun.outcome === "error" ? "Last run failed · Terminal report rejected" : "Last run telemetry warning · Terminal report rejected"
127
+ children: latestIncidentRun.phase === "error" ? "Last run failed · Terminal report rejected" : "Last run telemetry warning · Terminal report rejected"
125
128
  }),
126
129
  completed && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
127
130
  className: "mt-1.5 text-label text-success",
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
2
  import { g as require_jsx_runtime, h as require_react } from "../_libs/@base-ui/react+[...].mjs";
3
- import { A as defu, H as getBaseURL, T as createFetch, Zt as toKebabCase, _ as capitalizeFirstLetter, dt as isSafeUrlScheme } from "./boot-aI3l2EYT.mjs";
4
- //#region node_modules/.nitro/vite/services/ssr/assets/LoopPlaybook-BBn-xXpG.js
3
+ import { A as defu, H as getBaseURL, T as createFetch, Zt as toKebabCase, _ as capitalizeFirstLetter, dt as isSafeUrlScheme } from "./boot-BpqTI96x.mjs";
4
+ //#region node_modules/.nitro/vite/services/ssr/assets/LoopPlaybook-BxKPoWAp.js
5
5
  var import_react = /* @__PURE__ */ __toESM(require_react());
6
6
  var import_jsx_runtime = require_jsx_runtime();
7
7
  var PROTO_POLLUTION_PATTERNS = {
@@ -1,15 +1,15 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
2
  import { g as require_jsx_runtime, h as require_react } from "../_libs/@base-ui/react+[...].mjs";
3
- import { pt as isTaskPath } from "./boot-aI3l2EYT.mjs";
4
- import { T as md, _ as fmt, j as tsShort, v as fnum } from "./ui-Dej2qjuS.mjs";
3
+ import { pt as isTaskPath } from "./boot-BpqTI96x.mjs";
4
+ import { E as md, M as tsShort, v as fmt, y as fnum } from "./ui-WGITbP6Z.mjs";
5
5
  import { s as getArtifacts } from "./loopApi-BfMnXaKT.mjs";
6
6
  import { t as artifactKind } from "./artifactKind-BW0isV8L.mjs";
7
7
  import { t as purify } from "../_libs/dompurify.mjs";
8
8
  import { i as isMarkdown, r as ViewerHead, t as ArtifactBody } from "./artifactView-CYV1r48i.mjs";
9
- import { n as ModalHead, t as Modal } from "./Modal-DpKZHLZK.mjs";
9
+ import { n as ModalHead, t as Modal } from "./Modal-CfWC9R49.mjs";
10
10
  import { n as import_lib, t as esm_default } from "../_libs/html-react-parser+[...].mjs";
11
11
  import { a as Area, c as Tooltip, i as XAxis, l as ResponsiveContainer, n as LineChart, o as Line, r as YAxis, s as CartesianGrid, t as AreaChart } from "../_libs/recharts+victory-vendor.mjs";
12
- //#region node_modules/.nitro/vite/services/ssr/assets/LoopView-DdyJYOCY.js
12
+ //#region node_modules/.nitro/vite/services/ssr/assets/LoopView-B0AwFjwS.js
13
13
  var import_react = /* @__PURE__ */ __toESM(require_react());
14
14
  var import_jsx_runtime = require_jsx_runtime();
15
15
  /** Parse a `<loop-chart series="key:label:unit, ...">` attribute into StateField[]. */
@@ -1,6 +1,6 @@
1
1
  import { c as DialogRoot, d as DialogClose, f as DialogBackdrop, g as require_jsx_runtime, l as DialogPortal, s as DialogTitle, u as DialogPopup } from "../_libs/@base-ui/react+[...].mjs";
2
- import { k as sectionHeadCls } from "./ui-Dej2qjuS.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/Modal-DpKZHLZK.js
2
+ import { A as sectionHeadCls } from "./ui-WGITbP6Z.mjs";
3
+ //#region node_modules/.nitro/vite/services/ssr/assets/Modal-CfWC9R49.js
4
4
  var import_jsx_runtime = require_jsx_runtime();
5
5
  /** Shared modal shell — Base UI Dialog handles focus trap, Esc, scroll lock.
6
6
  * Content-height, optically centered — sized for the small form/compose dialogs
@@ -1,8 +1,8 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
2
  import { g as require_jsx_runtime, h as require_react } from "../_libs/@base-ui/react+[...].mjs";
3
- import { l as btnPrimary } from "./ui-Dej2qjuS.mjs";
4
- import { i as PievoLogo, n as GitHubIcon, o as signIn, r as LoopPlaybook, t as GITHUB_URL } from "./LoopPlaybook-BBn-xXpG.mjs";
5
- //#region node_modules/.nitro/vite/services/ssr/assets/SignIn-RJN_0GFZ.js
3
+ import { l as btnPrimary } from "./ui-WGITbP6Z.mjs";
4
+ import { i as PievoLogo, n as GitHubIcon, o as signIn, r as LoopPlaybook, t as GITHUB_URL } from "./LoopPlaybook-BxKPoWAp.mjs";
5
+ //#region node_modules/.nitro/vite/services/ssr/assets/SignIn-C1duN7oy.js
6
6
  var import_react = /* @__PURE__ */ __toESM(require_react());
7
7
  var import_jsx_runtime = require_jsx_runtime();
8
8
  /**
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "../_runtime.mjs";
2
2
  import { g as require_jsx_runtime, h as require_react } from "../_libs/@base-ui/react+[...].mjs";
3
- import { c as btnDanger, l as btnPrimary, o as btn } from "./ui-Dej2qjuS.mjs";
4
- //#region node_modules/.nitro/vite/services/ssr/assets/actionUi-CZbEixbf.js
3
+ import { c as btnDanger, l as btnPrimary, o as btn } from "./ui-WGITbP6Z.mjs";
4
+ //#region node_modules/.nitro/vite/services/ssr/assets/actionUi-mDYOvJdB.js
5
5
  var import_react = /* @__PURE__ */ __toESM(require_react());
6
6
  var import_jsx_runtime = require_jsx_runtime();
7
7
  /**
@@ -1,5 +1,5 @@
1
- import { Ct as listRuns, S as countRuns, Z as getMachine, at as hasRunningRun, it as hasPendingRun, jt as machinePresence } from "./boot-aI3l2EYT.mjs";
2
- //#region node_modules/.nitro/vite/services/ssr/assets/adapters-CJUhP66K.js
1
+ import { Ct as listRuns, S as countRuns, Z as getMachine, at as hasRunningRun, it as hasPendingRun, jt as machinePresence } from "./boot-BpqTI96x.mjs";
2
+ //#region node_modules/.nitro/vite/services/ssr/assets/adapters-C10CmWK4.js
3
3
  /**
4
4
  * Map the new relational rows (Loop + Run) onto the shapes the UI already
5
5
  * renders (JobSummary / JobDetail / RunSummary / JobFull), so the dashboard
@@ -16,12 +16,12 @@ function toRunSummary(r) {
16
16
  ts: r.ts,
17
17
  queued: r.phase === "pending",
18
18
  running: r.phase === "running",
19
+ phase: r.phase,
19
20
  requestedBy: r.requestedBy,
20
21
  canceled: r.phase === "canceled",
21
22
  cancelRequested: r.cancelRequestedAt != null,
22
23
  role: r.role,
23
24
  agent: r.agent ?? null,
24
- outcome: r.outcome ?? "silent",
25
25
  status: r.status ?? null,
26
26
  message: r.message ?? null,
27
27
  durationMs: r.durationMs ?? null,
@@ -62,7 +62,7 @@ async function toJobSummary(loop) {
62
62
  cron: loop.cron,
63
63
  scheduleMode: loop.scheduleMode,
64
64
  continuousDelayMinutes: loop.continuousDelayMinutes,
65
- kind: loop.workflow ? "workflow" : `exec:${loop.agent}`,
65
+ kind: `exec:${loop.agent}`,
66
66
  model: loop.model ?? null,
67
67
  reasoningEffort: loop.reasoningEffort ?? null,
68
68
  hasUi: !!loop.ui,
@@ -96,7 +96,6 @@ function toJobFull(loop) {
96
96
  completionReason: loop.completionReason ?? null,
97
97
  pauseCause: loop.pauseCause ?? null,
98
98
  taskFile: loop.taskFile ?? void 0,
99
- workflow: loop.workflow ?? void 0,
100
99
  stateSchema: loop.stateSchema ?? void 0,
101
100
  ui: loop.ui ?? void 0,
102
101
  channelId: loop.channelId ?? null,
@@ -1,6 +1,6 @@
1
- import { B as getArtifactFile, Gt as safeRelPath, V as getArtifactSync, _t as listArtifactsWithMeta } from "./boot-aI3l2EYT.mjs";
2
- import { t as toArtifactSummary } from "./adapters-CJUhP66K.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/artifactFiles-zP43a-_v.js
1
+ import { B as getArtifactFile, Gt as safeRelPath, V as getArtifactSync, _t as listArtifactsWithMeta } from "./boot-BpqTI96x.mjs";
2
+ import { t as toArtifactSummary } from "./adapters-C10CmWK4.mjs";
3
+ //#region node_modules/.nitro/vite/services/ssr/assets/artifactFiles-uxLErS_7.js
4
4
  /**
5
5
  * Server-side reads over a loop's live-synced artifacts (Phase 2). Pure helpers
6
6
  * (no request/session context) so they're shared by the lazy server fns
@@ -0,0 +1,2 @@
1
+ import { d as SYNC_BODY_CAP, i as BLOB_CAP } from "./boot-BpqTI96x.mjs";
2
+ export { BLOB_CAP, SYNC_BODY_CAP };