@kky42/pievo-server 2.0.2 → 2.0.3
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.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{LoopView-XXW59HAV.js → LoopView-CCYqXrKq.js} +3 -3
- package/.output/public/assets/{Modal-BnCPgN_k.js → Modal-BhRzAXQg.js} +1 -1
- package/.output/public/assets/{SignIn-BAoOONQ9.js → SignIn-CV3jqX_8.js} +1 -1
- package/.output/public/assets/{actionUi-Dxe9cHAc.js → actionUi-BRtdWVvO.js} +1 -1
- package/.output/public/assets/app-B03JVnFn.css +2 -0
- package/.output/public/assets/index-BATGA0jG.js +12 -0
- package/.output/public/assets/{invite._token-BAqaXvte.js → invite._token-CQgv8lTC.js} +1 -1
- package/.output/public/assets/{invite._token-q54LLZ6A.js → invite._token-Dp2HL9X5.js} +1 -1
- package/.output/public/assets/lifecycleUi-C3k2MlX8.js +1 -0
- package/.output/public/assets/loops._loopId-C9vRjZ8W.js +4 -0
- package/.output/public/assets/{loops._loopId_.runs._runId-lGYlHXTN.js → loops._loopId_.runs._runId-BNN-dLrW.js} +2 -2
- package/.output/public/assets/notifyFns-DuBElaqG.js +1 -0
- package/.output/public/assets/{preload-helper-ycaoAemE.js → preload-helper-3xcHsDtt.js} +1 -1
- package/.output/public/assets/{routes-C7Pw5lGn.js → routes-CmuCVIIS.js} +1 -1
- package/.output/public/assets/{routes-D0zKR7gK.js → routes-YnrsFY5X.js} +1 -1
- package/.output/public/assets/{t._teamId-CCgajlMS.js → t._teamId-Bi-C9s5j.js} +1 -1
- package/.output/public/assets/{t._teamId-Cn7cRGAh.js → t._teamId-BlE4mCSj.js} +1 -1
- package/.output/public/assets/ui-By58RJgB.js +1 -0
- package/.output/server/_ssr/{DashboardView-BhJBW7IL.mjs → DashboardView-2eNPqWcy.mjs} +34 -109
- package/.output/server/_ssr/{LoopPlaybook-BC9Dvnw2.mjs → LoopPlaybook-CnQ8Qgyf.mjs} +8 -8
- package/.output/server/_ssr/{LoopView-Dom6Ad5G.mjs → LoopView-DM30OPCN.mjs} +13 -13
- package/.output/server/_ssr/{Modal-CfWC9R49.mjs → Modal-B7gBr5Pm.mjs} +2 -2
- package/.output/server/_ssr/{SignIn-D70NUJsN.mjs → SignIn-CaAi4_mk.mjs} +3 -3
- package/.output/server/_ssr/{actionUi-mDYOvJdB.mjs → actionUi-Be7dmMxb.mjs} +2 -2
- package/.output/server/_ssr/{adapters-D0d1fBKK.mjs → adapters-CHURWoZx.mjs} +4 -8
- package/.output/server/_ssr/{artifactFiles-BfE1070_.mjs → artifactFiles-D6b_RP78.mjs} +3 -3
- package/.output/server/_ssr/artifacts-CXMpBzMY.mjs +2 -0
- package/.output/server/_ssr/{auth-BP81awUE.mjs → auth-B_OxPpFr.mjs} +9 -9
- package/.output/server/_ssr/{boot-sM4t8RJu.mjs → boot-BNoivm21.mjs} +250 -489
- package/.output/server/_ssr/boot-C9VAWt9Z.mjs +2 -0
- package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-CZJuWL5Z.mjs → bun-sqlite-dialect-BW9W1_Ps-B3RHdVjo.mjs} +2 -2
- package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-C2PCtZfI.mjs → d1-sqlite-dialect-BLC8LXE6-DpVe1foU.mjs} +2 -2
- package/.output/server/_ssr/db-C11vQNxP.mjs +2 -0
- package/.output/server/_ssr/{dist-Z7v6ihws.mjs → dist-BTx1ljg7.mjs} +2 -2
- package/.output/server/_ssr/{factory-BQ_XiP23.mjs → factory-TSnFcS96.mjs} +2 -2
- package/.output/server/_ssr/{invite._token-CRAl6-yK.mjs → invite._token-CDpO3cfB.mjs} +5 -5
- package/.output/server/_ssr/{invite._token-23daBIfe.mjs → invite._token-CvqaKH2R.mjs} +2 -2
- package/.output/server/_ssr/{invite._token-VKmyC9-R.mjs → invite._token-DWOPXXLS.mjs} +4 -4
- package/.output/server/_ssr/{kysely-adapter-DjQPkqgJ.mjs → kysely-adapter-BWjzeCGK.mjs} +1 -1
- package/.output/server/_ssr/{lifecycleUi-l3nx9i3T.mjs → lifecycleUi-5jMhxINb.mjs} +1 -3
- package/.output/server/_ssr/logger-DE_PU5bE.mjs +2 -0
- package/.output/server/_ssr/{loopApi-i7xdpokI.mjs → loopApi-Cpm8YV3U.mjs} +22 -16
- package/.output/server/_ssr/{loops._loopId-jXSgPWG1.mjs → loops._loopId-C-y4Pux_.mjs} +3 -3
- package/.output/server/_ssr/{loops._loopId-DOPfN_Op.mjs → loops._loopId-DfrHw2mZ.mjs} +31 -57
- package/.output/server/_ssr/{loops._loopId_.runs._runId-BhoM6DWj.mjs → loops._loopId_.runs._runId-BXyyqXwX.mjs} +3 -3
- package/.output/server/_ssr/{loops._loopId_.runs._runId-DiBP2rCe.mjs → loops._loopId_.runs._runId-C9d0EC2Q.mjs} +9 -16
- package/.output/server/_ssr/{machineFns-ChO1NM3C.mjs → machineFns-CRbwYxD3.mjs} +3 -3
- package/.output/server/_ssr/{node-sqlite-dialect-BGlhyZkk.mjs → node-sqlite-dialect-B10G6C4W.mjs} +2 -2
- package/.output/server/_ssr/{notifyFns-DWotltSJ.mjs → notifyFns-CtmSVNmE.mjs} +6 -7
- package/.output/server/_ssr/{notifyFns-B1MSIzrT.mjs → notifyFns-DvH4C-GH.mjs} +3 -3
- package/.output/server/_ssr/{router-BOHN4CWd.mjs → router-B4ipreZ4.mjs} +30 -30
- package/.output/server/_ssr/{routes-DjaTMZqZ.mjs → routes-DKox93l0.mjs} +2 -2
- package/.output/server/_ssr/{routes-BQjhKV-m.mjs → routes-iHT61OkI.mjs} +5 -5
- package/.output/server/_ssr/{routes-C2VJzARp.mjs → routes-l7tUe3lr.mjs} +5 -5
- package/.output/server/_ssr/{runDiff-SlGPjjNq.mjs → runDiff-Bohd5W5R.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +48 -48
- package/.output/server/_ssr/store-Ck7kCAGf.mjs +2 -0
- package/.output/server/_ssr/{t._teamId-D_vi_OuG.mjs → t._teamId-B3g0Cs8B.mjs} +2 -2
- package/.output/server/_ssr/{t._teamId-o86wLJrg.mjs → t._teamId-BPK2mrN3.mjs} +5 -5
- package/.output/server/_ssr/{t._teamId-CRgNlDGk.mjs → t._teamId-jO8dUmSQ.mjs} +5 -5
- package/.output/server/_ssr/{teamFns-C3vnwAqv.mjs → teamFns-6zjFV7lM.mjs} +3 -3
- package/.output/server/_ssr/tokens-oJm6yFyt.mjs +2 -0
- package/.output/server/_ssr/{ui-WGITbP6Z.mjs → ui-CI-OeTr7.mjs} +2 -18
- package/.output/server/{_tanstack-start-manifest_v-DYC0z7st.mjs → _tanstack-start-manifest_v-CxHUYCv8.mjs} +26 -26
- package/.output/server/drizzle/0014_luxuriant_scrambler.sql +5 -0
- package/.output/server/drizzle/meta/_journal.json +7 -0
- package/.output/server/index.mjs +106 -106
- package/drizzle/0014_luxuriant_scrambler.sql +5 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/.output/public/assets/app-DzFILlbu.css +0 -2
- package/.output/public/assets/index-BtvLZjhl.js +0 -12
- package/.output/public/assets/lifecycleUi-B8Je9exd.js +0 -1
- package/.output/public/assets/loops._loopId-BCK4oIRv.js +0 -4
- package/.output/public/assets/notifyFns-BneSItOi.js +0 -1
- package/.output/public/assets/ui-RFP3R3lU.js +0 -1
- package/.output/server/_ssr/artifacts-CSGRJdSy.mjs +0 -2
- package/.output/server/_ssr/boot-pUGFIxSA.mjs +0 -2
- package/.output/server/_ssr/db-Cc6I8bWL.mjs +0 -2
- package/.output/server/_ssr/logger-CHoC5_kz.mjs +0 -2
- package/.output/server/_ssr/store-BjXC623Z.mjs +0 -2
- package/.output/server/_ssr/tokens-BCOvumer.mjs +0 -2
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,4 +0,0 @@
|
|
|
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 c,r as ee,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-BneSItOi.js";import{D as le,M as ue,N as de,O as fe,P as pe,S as p,T as me,_ as m,b as he,c as ge,d as h,g as _e,i as ve,k as ye,l as be,m as g,n as xe,o as _,p as v,r as y,s as Se,t as Ce,v as b,w as x,x as we}from"./ui-RFP3R3lU.js";import{i as Te,n as Ee,r as De,t as Oe}from"./lifecycleUi-B8Je9exd.js";import{c as ke,r as S}from"./index-BtvLZjhl.js";import{a as C,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(),k=e=>e.split(`/`).pop()||e;function A(e){let t=e.match(/\.([a-z0-9]+)$/i);return t?t[1].toLowerCase():`file`}function Re({loopId:e,taskFile:t,taskFileContent:n,taskFileSyncedAt:r,running:i}){let[a,o]=(0,D.useState)(null),[s,ee]=(0,D.useState)(null),l=(0,D.useRef)(0),u=(0,D.useCallback)(async()=>{let t=++l.current;try{let n=await c({data:{loopId:e}});t===l.current&&o(n)}catch{t===l.current&&o(e=>e??[])}},[e]);(0,D.useEffect)(()=>{o(null),ee(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)(()=>C(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!==k(e.path)?i:k(e.path),o=e.path.includes(`/`)||a!==k(e.path);return(0,O.jsx)(`li`,{children:(0,O.jsxs)(`button`,{type:`button`,onClick:()=>ee(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:A(e.path)})]})},e.path)})})}),(0,O.jsx)(`div`,{className:`min-w-0 overflow-y-auto`,children:ne&&f?(0,O.jsx)(j,{path:f.path,content:n,syncedAt:r}):f?.kind===`artifact`?(0,O.jsx)(M,{loopId:e,file:f.file}):null})]})]})}function j({path:e,content:t,syncedAt:n}){return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(w,{path:e,meta:n?`Task file · synced ${me(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 M({loopId:e,file:t}){let n=[t.size==null?``:le(t.size),`synced ${me(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 ze=[`claude-code`,`codex`];function N(e){return{executor:`claude`,workdir:e.workdir.trim(),model:e.model.trim(),reasoningEffort:e.reasoningEffort.trim(),allowControl:e.allowControl}}var P=(0,D.lazy)(()=>ie(()=>import(`./CodeField-dOzyFQNH.js`),__vite__mapDeps([0,1])));function F(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 I=`mt-1 text-caption leading-snug text-disabled`,L={"claude-code":`Claude Code`,codex:`Codex`};function R({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:g,children:e}),(0,O.jsx)(`input`,{id:o,type:`text`,className:r?`${v} font-mono`:v,value:t,placeholder:i,onChange:e=>n(e.target.value)}),a&&(0,O.jsx)(`div`,{className:I,children:a})]})}function z({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:m,children:e}),t&&(0,O.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function B({minHeight:e}){return(0,O.jsx)(`div`,{className:`rounded-control border border-wire bg-raised`,style:{minHeight:e}})}var Be=(0,D.forwardRef)(function({initial:e,channels:t},n){let[r,i]=(0,D.useState)(()=>F(e)),a=(e,t)=>i(n=>({...n,[e]:t})),[o,s]=(0,D.useState)(null),[c,ee]=(0,D.useState)([]),l=t??c;return(0,D.useEffect)(()=>{t||se().then(ee).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:N(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)(z,{title:`Basics`}),(0,O.jsx)(R,{label:`Name`,value:r.name,onChange:e=>a(`name`,e)}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`label`,{className:g,children:`Schedule mode`}),(0,O.jsxs)(`select`,{"aria-label":`Schedule mode`,className:b,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:`${v} 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:he(r.cron)}),(0,O.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-secondary`,children:r.cron})]}):(0,O.jsx)(R,{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:I,children:`Cron is retained while continuous mode is active, so switching back restores it.`})]}),(0,O.jsx)(R,{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)(z,{title:`Notifications`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`label`,{className:g,children:`Notify`}),(0,O.jsx)(`select`,{"aria-label":`Notify`,className:b,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:I,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:g,children:`Push channel`}),(0,O.jsxs)(`select`,{"aria-label":`Push channel`,className:b,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)(z,{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:g,children:`Coding agent`}),(0,O.jsx)(`select`,{"aria-label":`Coding agent`,className:b,value:r.agent,onChange:e=>a(`agent`,e.target.value),children:ze.map(e=>(0,O.jsx)(`option`,{value:e,children:L[e]??e},e))}),(0,O.jsx)(`div`,{className:I,children:`Which coding agent executes this loop on the bound machine.`})]}),(0,O.jsx)(R,{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)(R,{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)(R,{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)(z,{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:g,children:`Metrics schema · JSON array`}),(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(B,{minHeight:`90px`}),children:(0,O.jsx)(P,{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:I,children:`Per-run metrics the agent reports; they feed the dashboard charts.`}),(0,O.jsx)(`label`,{className:g,children:`Dashboard template · HTML`}),(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(B,{minHeight:`240px`}),children:(0,O.jsx)(P,{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:I,children:[`Agent-authored HTML with `,`{{bindings}}`,` and loop-chart / loop-embed / loop-calendar / loop-kanban elements.`]})]})]})}),Ve={"claude-code":`Claude Code`,codex:`Codex`},He=[{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: `}],Ue=(0,D.lazy)(()=>ie(()=>import(`./LoopView-XXW59HAV.js`).then(e=>({default:e.LoopView})),__vite__mapDeps([2,1,3,4,5,6])));function We({id:e}){let t=re(),[n,c]=(0,D.useState)(null),[f,ie]=(0,D.useState)([]),[oe,le]=(0,D.useState)(null),[de,p]=(0,D.useState)(null),[m,h]=(0,D.useState)(!1),[g,v]=(0,D.useState)(!1),[b,x]=(0,D.useState)(``),[S,C]=(0,D.useState)(!1),[Ae,w]=(0,D.useState)(!1),[T,E]=(0,D.useState)(null),je=(0,D.useRef)(null),[k,A]=(0,D.useState)(!1),[j,M]=(0,D.useState)(null),[ze,N]=(0,D.useState)(!1),[P,F]=Me(),I=(0,D.useRef)(null),L=(0,D.useRef)(!1),[R,z]=(0,D.useState)([]),B=(0,D.useCallback)(async(n=!1)=>{try{let t=await l({data:e});c(t),L.current=t.summary.deleteRequestedAt!=null,le(null)}catch(e){L.current?t({to:`/`}):n||le(String(e))}},[e]);(0,D.useEffect)(()=>{c(null),h(!1),v(!1),x(``),C(!1),w(!1),E(null),N(!1),z([]),B(),se().then(ie).catch(()=>{})},[e,B]);let We=!!n?.summary.running;(0,D.useEffect)(()=>{if(m)return;let e=setInterval(()=>void B(!0),We||L.current?3e3:8e3);return()=>clearInterval(e)},[m,We,B]);async function V(){await B()}async function Je(){p(null),M(`run`);try{let t=await a({data:e});if(t?.error)return p(`Run failed: ${t.error}`);F({label:t.coalesced?`Already queued`:`Queued`,hold:4e3}),await V()}finally{M(null)}}async function Ye(){p(null),M(`evolve`);try{let t=await s({data:e});if(t?.error)return p(`Evolve failed: ${t.error}`);F({label:t.coalesced?`Evolve already queued`:`Evolve queued`,hold:4e3}),await V()}finally{M(null)}}async function H(n){p(null),M(`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 ee({data:e});if(a.error)return p(`${n[0].toUpperCase()+n.slice(1)} failed: ${a.error}`);if(N(!1),a.deleted){L.current=!1,t({to:`/`});return}n===`delete`&&(L.current=!0),await V(),F({label:n===`start`?`Started`:n===`reopen`?`Reopened`:n===`pause`?`Paused`:n===`stop`?`Stop requested`:`Deleting`})}finally{M(null)}}async function Xe(){let t=I.current?.read();if(t){p(null),M(`save`);try{let n=await i({data:{id:e,patch:t}});if(n.error)return p(`Save failed: ${n.error}`);h(!1),await V(),F({label:`Saved`})}finally{M(null)}}}async function Ze(){let t=b.trim();if(t){p(null),M(`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),v(!1),x(``),await V()}finally{M(null)}}}let Qe=(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)(Ke,{back:Qe,children:(0,O.jsx)(Pe,{title:`Couldn't load this loop.`,detail:oe,onRetry:()=>void B()})});if(!n)return(0,O.jsx)(Ke,{back:Qe,children:(0,O.jsx)(xe,{})});let{job:U,summary:W,runs:$e}=n,et=!!U.ui,tt=!!j,nt=n.machine.online,G=n.machine.presence===`asleep`,rt=nt?void 0:G?`Machine asleep - requests will stay queued until it wakes`:`Machine offline - requests will stay queued until it reconnects`,K=ye(W),q=De(W),it=Te(n),at=Ee(n.machine.daemonProtocol),ot=fe(W)&&!K,st=n.machine.name?`“${n.machine.name}”`:`the bound machine`,J=Ae&&T?$e.find(e=>e.id===T):void 0,ct=!!J&&!J.queued&&!J.running,lt=()=>{w(!1),E(null)},ut=Ie(U.taskFile),dt=async()=>{try{await navigator.clipboard.writeText(Le({loopId:e,loopName:W.name,instruction:b})),C(!0),setTimeout(()=>C(!1),4e3)}catch{p(`Could not copy the prompt - try again or copy it manually.`)}},ft=P&&(0,O.jsx)(`div`,{className:`mb-2.5`,children:(0,O.jsx)(Ne,{label:P.label,tone:P.tone,onUndo:P.undo})}),Y=q===`deleting`,pt=!W.enabled&&!K&&!Y,mt=W.enabled&&!K&&!Y,X=tt||Y,Z=mt||pt,ht=Z&&!!W.running&&at.supported,gt=W.running&&!at.supported?Oe:W.running?void 0:`No run is currently running`,_t=(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:be,disabled:X||!Z,onClick:()=>void Je(),title:Z?rt??(U.exec?`Spends credits`:void 0):`Unavailable for a completed or deleting loop`,"aria-label":U.exec?`Run once - spends credits`:`Run once`,children:j===`run`?`Queuing…`:`Run once`}),(0,O.jsx)(`button`,{className:_,disabled:X||!(Z||K),title:`Dispatch or copy a prompt for an owner-requested edit`,onClick:()=>v(!0),children:`Agent edit`}),(0,O.jsx)(`button`,{className:_,disabled:X||!Z,title:Z?rt??`Spends credits`:`Unavailable for a completed or deleting loop`,onClick:()=>void Ye(),children:j===`evolve`?`Evolving…`:`Evolve once`}),(0,O.jsx)(`button`,{className:_,disabled:X,onClick:()=>h(!0),children:`Settings`}),(0,O.jsx)(`button`,{className:_,disabled:X||!pt,onClick:()=>void H(`start`),children:`Start`}),(0,O.jsx)(`button`,{className:_,disabled:X||!mt,onClick:()=>void H(`pause`),children:`Pause`}),(0,O.jsx)(`button`,{className:ge,disabled:X||!ht,title:gt,onClick:()=>void H(`stop`),children:`Stop`}),(0,O.jsx)(`button`,{className:_,disabled:X||!K,onClick:()=>void H(`reopen`),children:`Reopen`}),(0,O.jsx)(`button`,{className:ge,disabled:X,onClick:()=>N(!0),children:Y?`Deleting…`:`Delete`})]}),ze&&!Y&&(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:tt,onConfirm:()=>void H(`delete`),onCancel:()=>N(!1)})}),Y&&(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.`}),g&&!Y&&(0,O.jsxs)(`div`,{className:`mt-4 border-t border-hairline pt-4`,onKeyDown:e=>{e.key===`Escape`&&j!==`edit`&&(e.stopPropagation(),v(!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 `,st,` · spends credits`]})]}),(0,O.jsx)(`textarea`,{ref:je,autoFocus:!0,value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&b.trim()&&j!==`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`}),!b.trim()&&(0,O.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:He.map(e=>(0,O.jsx)(`button`,{type:`button`,onClick:()=>{x(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:Se,disabled:j===`edit`||!b.trim(),title:rt,onClick:()=>void Ze(),children:j===`edit`?`Dispatching…`:`Dispatch to your coding agent`}),(0,O.jsx)(`button`,{type:`button`,className:_,disabled:j===`edit`,onClick:()=>void dt(),children:S?`✓ Prompt copied`:`Copy prompt`}),(0,O.jsx)(`button`,{className:_,disabled:j===`edit`,onClick:()=>v(!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:S?(0,O.jsxs)(`span`,{className:`text-secondary`,children:[`✓ Copied · run your coding agent`,` `,ut?(0,O.jsxs)(O.Fragment,{children:[`in `,(0,O.jsx)(`code`,{className:`break-all font-mono text-primary`,children:ut})]}):`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.`})})]})]}),vt=de&&(0,O.jsx)(Ce,{message:de,onDismiss:()=>p(null),className:`mb-2.5`}),Q=n.team&&!n.team.isActive?n.team:null,yt=e=>{ke(e),t({to:`/t/$teamId`,params:{teamId:e}})},bt=Q&&(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 `,Q.name]}),(0,O.jsx)(`span`,{className:`text-meta text-secondary`,children:`- not your active team.`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>yt(Q.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`})]}),xt=n.machine.needsUpdate&&(0,O.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-control border border-warn/40 bg-warn/10 px-4 py-2.5`,children:[(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-meta font-medium text-primary`,children:[(0,O.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full bg-warn`}),`Daemon update required`]}),(0,O.jsxs)(`span`,{className:`text-meta text-secondary`,children:[`This server requires v`,n.machine.requiredDaemonVersion,`; `,n.machine.name?`“${n.machine.name}”`:`the bound machine`,` reports `,n.machine.daemonVersion?`v${n.machine.daemonVersion}`:`an unknown version`,`. Queued work will wait.`]}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>A(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Update daemon`})]}),St=!nt&&(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 ${G?`bg-rubik-yellow`:`bg-disabled`}`}),`Machine `,n.machine.name?`“${n.machine.name}” `:``,G?`seems to be asleep or offline`:`offline`]}),(0,O.jsxs)(`span`,{className:`text-meta text-secondary`,children:[G?`- 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:()=>A(!0),className:`ml-auto cursor-pointer text-meta font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Reconnect`})]});if(m)return(0,O.jsxs)(Ke,{back:Qe,children:[(0,O.jsx)(Ge,{name:W.name,onBack:()=>h(!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)(Be,{ref:I,initial:U,channels:f}),(0,O.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[vt,(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,O.jsx)(`button`,{className:be,disabled:j===`save`,onClick:Xe,children:j===`save`?`Saving…`:`Save`}),(0,O.jsx)(`button`,{className:_,disabled:j===`save`,onClick:()=>h(!1),children:`Cancel`})]})]})]})]});let Ct=Ve[U.agent??`claude-code`]??U.agent??`Claude Code`,wt=U.exec?.model?.trim()||`default`,Tt=U.exec?.reasoningEffort?.trim()||`default`,Et=$e[0],Dt=Et?.reportIncident?Et:void 0,$=(0,O.jsx)(`span`,{className:`text-wire`,children:`·`});return(0,O.jsxs)(Ke,{back:Qe,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:W.name}),q===`completed`?(0,O.jsx)(y,{tone:`success`,dot:`green`,children:`Completed`}):(0,O.jsx)(y,{tone:q===`stopping`?`running`:void 0,dot:q===`stopping`?`pulse`:void 0,children:it}),W.queued&&q===`active`?(0,O.jsx)(y,{tone:`outline`,children:`Queued`}):null,ot&&(0,O.jsx)(y,{tone:`success`,title:W.goal??void 0,children:`Goal`}),(0,O.jsx)(y,{tone:`outline`,title:`Recorded coding agent`,children:Ct}),(0,O.jsx)(y,{tone:`outline`,title:`Model: ${wt}`,children:(0,O.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Model: `,wt]})}),(0,O.jsx)(y,{tone:`outline`,title:`Reasoning: ${Tt}`,children:(0,O.jsxs)(`span`,{className:`max-w-72 truncate`,children:[`Reasoning: `,Tt]})}),Q&&(0,O.jsx)(y,{tone:`outline`,title:`This loop belongs to another of your teams`,children:Q.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:U.cron,children:U.scheduleMode===`continuous`?`continuous · ${U.continuousDelayMinutes}m delay`:he(U.cron)}),$,(0,O.jsxs)(`span`,{children:[`next `,me(W.nextRun)]}),W.nextRun&&W.enabled&&!K&&(0,O.jsxs)(`span`,{className:`text-disabled`,children:[`(`,pe(W.nextRun),`)`]}),$,(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:nt?`Machine online`:G?`Machine asleep`:`Machine offline`,children:[(0,O.jsx)(`span`,{className:`size-1.5 rounded-full ${nt?`bg-rubik-green`:G?`bg-rubik-yellow`:`bg-disabled`}`}),n.machine.name||`machine`]}),$,(0,O.jsx)(`span`,{title:`Breaking daemon/server lifecycle protocol`,children:at.label}),$,(0,O.jsx)(`code`,{className:`font-mono text-label text-disabled`,children:W.id})]}),ot&&W.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:W.goal})]}),q===`completed`&&(0,O.jsxs)(`div`,{className:`mt-2 text-body leading-snug text-success`,children:[`Completed`,W.completedAt?` · ${me(W.completedAt)}`:``,W.completionReason&&(0,O.jsxs)(`span`,{className:`text-secondary`,children:[` - `,W.completionReason]})]}),Dt?.reportIncident&&(0,O.jsx)(`div`,{className:`mt-2 text-body leading-snug text-secondary`,children:Dt.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:[bt,xt,St,vt,ft,_t]})]}),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:[!J||J.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 `,st,` and higher-priority work…`]})]}):J.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:_e}),(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:we(J)}}),(0,O.jsx)(`span`,{className:`font-medium`,style:{color:we(J)},children:J.canceled?`Edit canceled`:J.phase===`error`?`Edit failed`:`Edit applied`}),J.error&&(0,O.jsxs)(`span`,{className:`truncate text-secondary`,children:[`· `,J.error]})]}),(0,O.jsxs)(`div`,{className:`ml-auto flex items-center gap-3.5`,children:[J&&(0,O.jsx)(ne,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:J.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:lt,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:ct?`Done`:`Hide`})]})]}),ct&&J.message&&(0,O.jsx)(`div`,{className:`mt-3.5`,children:(0,O.jsx)(ve,{children:J.message})})]}),et&&(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)(xe,{className:`py-4`}),children:(0,O.jsx)(Ue,{html:U.ui,runs:$e,loopId:e,taskFile:U.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)(Re,{loopId:e,taskFile:U.taskFile,taskFileContent:n.taskFileContent,taskFileSyncedAt:n.taskFileSyncedAt,running:We}),(0,O.jsx)(qe,{loopId:e,summary:W,runs:$e,older:R,onMore:async()=>{let t=(R.length?ce(W.runs??[],R):W.runs??[])[0];if(!t)return 0;let n=await o({data:{loopId:e,beforeTs:t.ts,limit:16}});return n.length&&z(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:k,onClose:()=>A(!1)})]})}function Ge({name:e,onBack:t}){return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`button`,{type:`button`,onClick:t,className:h,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 Ke({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:m,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:we(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:x(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:_e}),(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}=S.useParams(),{auth:t}=S.useLoaderData()??{auth:{enabled:!1}},{data:n,isPending:r}=f();return t?.enabled&&!r&&!n?(0,O.jsx)(je,{callbackURL:`/loops/${e}`}):(0,O.jsx)(We,{id:e})}export{V as component};
|
|
@@ -1 +0,0 @@
|
|
|
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)})]})]}),e.needsUpdate&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-control border border-warn/40 bg-warn/10 p-3`,children:[(0,Z.jsx)(`div`,{className:`text-label font-medium text-primary`,children:`Daemon needs update before this server will dispatch runs.`}),(0,Z.jsxs)(`div`,{className:`text-label text-secondary`,children:[`running `,e.daemonVersion?`v${e.daemonVersion}`:`unknown version`,` · required v`,e.requiredDaemonVersion]}),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.needsUpdate&&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 +0,0 @@
|
|
|
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};
|