@wkoutre/teamwork-os 1.0.3 → 1.0.5
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/README.md +0 -10
- package/cli.js +14 -2
- package/cli.jsc +0 -0
- package/dist/assets/AnalyticsPage-C24BvG1R.js +1 -0
- package/dist/assets/{BriefsPage-BsBjNIJT.js → BriefsPage-DrMSESEG.js} +1 -1
- package/dist/assets/{ChatPanel-BUNJ-rXp.js → ChatPanel-CC0ta99_.js} +1 -1
- package/dist/assets/{ContinuousImprovementPage-F6fizSUr.js → ContinuousImprovementPage-DyTwV7gP.js} +1 -1
- package/dist/assets/{HeartbeatPanel-q7mW5VDk.js → HeartbeatPanel-Dk6plplc.js} +1 -1
- package/dist/assets/IdeasContainer-DeZZF8d9.js +3 -0
- package/dist/assets/{MemoryExplore-wFiVBkXu.js → MemoryExplore-DS4IYHl2.js} +1 -1
- package/dist/assets/{MemoryHygiene-C_lFMujk.js → MemoryHygiene-DxUcjusq.js} +2 -2
- package/dist/assets/{MemoryInjections-F6D1_uAX.js → MemoryInjections-BO_kUrBn.js} +1 -1
- package/dist/assets/{MemoryPage-DS6LWMdS.js → MemoryPage-C2hIk5fW.js} +2 -2
- package/dist/assets/{MemoryWiki-cypT6R3l.js → MemoryWiki-Dh1MtBZV.js} +2 -2
- package/dist/assets/OrgPage-BAbdwx53.js +33 -0
- package/dist/assets/{SessionHistory-DwX-i9Io.js → SessionHistory-DXsOaHFV.js} +1 -1
- package/dist/assets/{SettingsPage-C6Xq22uB.js → SettingsPage-C1QRyGEh.js} +2 -2
- package/dist/assets/SupervisorDashboardPage-5IZyxfvh.css +1 -0
- package/dist/assets/SupervisorDashboardPage-Cnd1zMt9.js +1 -0
- package/dist/assets/{UsagePage-Cm8NsPw7.js → UsagePage-BcK454ym.js} +2 -2
- package/dist/assets/{events-CCBP4a9s.js → events-BK5ucyUu.js} +1 -1
- package/dist/assets/index-CiIY3MTP.css +1 -0
- package/dist/assets/index-DzJsiq8q.js +93 -0
- package/dist/assets/{lib-osArdP58.js → lib-CncUdc6D.js} +4 -4
- package/dist/assets/{types-CNhs8RVF.js → types-BeZJlDCI.js} +1 -1
- package/dist/assets/ui-DvNuX5MF.js +1 -0
- package/dist/index.html +5 -5
- package/gateway.jsc +0 -0
- package/onboarding-plugin/.claude-plugin/plugin.json +5 -0
- package/onboarding-plugin/skills/onboarding/SKILL.md +54 -0
- package/package.json +2 -1
- package/dist/assets/AnalyticsPage-BoafbdRY.js +0 -1
- package/dist/assets/IdeasContainer-DDhsyl1f.js +0 -3
- package/dist/assets/OrgPage-DP2-hcbf.js +0 -33
- package/dist/assets/SupervisorDashboardPage-BEuElLHE.css +0 -1
- package/dist/assets/SupervisorDashboardPage-CrsOGBZ8.js +0 -1
- package/dist/assets/index-C57L9wdB.css +0 -1
- package/dist/assets/index-tOLuwPW6.js +0 -93
- package/dist/assets/ui-Bx41p7g8.js +0 -1
- /package/dist/assets/{Button-xBBZQ0ie.js → Button-DTO6bgnL.js} +0 -0
- /package/dist/assets/{Input-HhV6M0tu.js → Input-iymdcwsf.js} +0 -0
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatPanel-BUNJ-rXp.js","assets/jsx-runtime-Bq3x7umQ.js","assets/lib-osArdP58.js","assets/events-CCBP4a9s.js","assets/useWebSocket-Hg3RO6sx.js","assets/styles-Ds5gMQAQ.js","assets/Input-HhV6M0tu.js","assets/Input-C6Eciq4Y.css","assets/ChatPanel-CK_zI3mg.css","assets/OrgPage-DP2-hcbf.js","assets/dagre.esm-DBOl5nQa.js","assets/value-A1VqfRmL.js","assets/react-dom-Cnw6SoYl.js","assets/dagre-CHpVij2M.css","assets/OrgPage-nDdhTt3V.css","assets/SessionHistory-DwX-i9Io.js","assets/ui-Bx41p7g8.js","assets/SettingsRow-4w9Ab9mk.js","assets/AnalyticsPage-BoafbdRY.js","assets/KpiTile-pXTBj77S.js","assets/SettingsPage-C6Xq22uB.js","assets/types-CNhs8RVF.js","assets/Button-xBBZQ0ie.js","assets/Button-BOCZ-tMU.css","assets/Card-u29day7d.js","assets/Card-Q-x7mRn3.css","assets/ScheduleOptimizerPage-Cmje0CoX.js","assets/MemoryPage-DS6LWMdS.js","assets/MemoryPage-DkvxMEXj.css","assets/BriefsPage-BsBjNIJT.js","assets/BriefsPage-C2lUZ05b.css","assets/IdeasContainer-DDhsyl1f.js","assets/generateCategoricalChart-pfORgeJG.js","assets/RelativeTime-CARWwY-H.js","assets/IdeasContainer-Cl1WkgLe.css","assets/PipelinesPage-BzYkkX-n.js","assets/PipelinesPage-VXjq7839.css","assets/UsagePage-Cm8NsPw7.js","assets/UsagePage-DlwHL1zI.css","assets/HeartbeatPanel-q7mW5VDk.js","assets/HeartbeatPanel-D5azjMkJ.css","assets/ContinuousImprovementPage-F6fizSUr.js","assets/ContinuousImprovementPage-DQDtZtX3.css","assets/SupervisorDashboardPage-CrsOGBZ8.js","assets/SupervisorDashboardPage-BEuElLHE.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./jsx-runtime-Bq3x7umQ.js";import{t as s}from"./react-dom-Cnw6SoYl.js";import{a as c,i as l,l as u,n as d,o as f,r as p,s as m}from"./useWebSocket-Hg3RO6sx.js";import{a as h,c as g,d as _,f as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k}from"./styles-Ds5gMQAQ.js";import{b as A,l as j,x as M}from"./events-CCBP4a9s.js";import{t as N}from"./Card-u29day7d.js";import{n as ee,t as P}from"./Input-HhV6M0tu.js";import{t as F}from"./Button-xBBZQ0ie.js";import{t as te}from"./useGet-CU5_p7vA.js";import{t as I}from"./RelativeTime-CARWwY-H.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=a(i((e=>{var t=s();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),1),L=a(n(),1),re=`/api`;async function R(e,t){let n=await fetch(`${re}${e}`,{headers:{"Content-Type":`application/json`},...t});return n.ok?n.json():null}async function z(e,t){let n=await fetch(`${re}${e}`,{headers:{"Content-Type":`application/json`},...t});if(!n.ok){let e=`${n.status} ${n.statusText}`;try{let t=await n.json();typeof t?.error==`string`&&(e=t.error)}catch{}throw Error(e)}return n.json()}var ie=new Set([`success`,`failed`,`timeout`]);function ae(e){let[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)([]),[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)([]),[u,d]=(0,L.useState)([]),[f,m]=(0,L.useState)(null),[h,g]=(0,L.useState)({}),[_,v]=(0,L.useState)([]),[y,b]=(0,L.useState)(0),[x,S]=(0,L.useState)(null),C=(0,L.useRef)([]),w=(0,L.useRef)(null),T=l(),E=(0,L.useCallback)(async()=>{try{let[t,r,a,o,s]=await Promise.all([R(`/jobs`),R(`/health`).catch(()=>({alerts:[]})),R(`/feed`).catch(()=>[]),R(`/global-pause/state`).catch(()=>null),R(`/missed-runs`).catch(()=>null)]);if(S(Date.now()),t&&(n(e=>JSON.stringify(e)===JSON.stringify(t)?e:t),e)){let n=w.current;if(n!==null)for(let r of t){let t=n.get(r.id),i=r.lastStatus;if(i!==t&&ie.has(i)){let t=i===`success`?`completed successfully`:i===`failed`?`failed`:`timed out`;e(r.name,`Job ${t}`)}}w.current=new Map(t.map(e=>[e.id,e.lastStatus]))}let c=r?.alerts??[];i(e=>JSON.stringify(e)===JSON.stringify(c)?e:c);let l=a??[];d(e=>JSON.stringify(e)===JSON.stringify(l)?e:l),o&&m(e=>JSON.stringify(e)===JSON.stringify(o)?e:o);let u=s?.missedRuns??[];v(e=>JSON.stringify(e)===JSON.stringify(u)?e:u);let f=(await R(`/goals`).catch(()=>null))?.filter(e=>e.status!==`created`).length??0;if(b(e=>e===f?e:f),t?.some(e=>e.lastStatus===`running`)){let e=await R(`/progress`).catch(()=>null);e&&g(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)}else g(e=>Object.keys(e).length===0?e:{})}catch(e){console.error(`Failed to load jobs:`,e)}},[]);return(0,L.useEffect)(()=>{E()},[E]),(0,L.useEffect)(()=>{R(`/health/dismissed`).then(e=>{e&&o(e)}).catch(()=>{})},[]),(0,L.useEffect)(()=>{R(`/focus/dismissed`).then(e=>{e&&c(e)}).catch(()=>{})},[]),p(`ws:reconnected`,(0,L.useCallback)(()=>{E()},[E])),p(`job:updated`,(0,L.useCallback)(t=>{let r=t;if(!r?.job)return;let i=r.job;if(n(e=>{let t=e.findIndex(e=>e.id===i.id);if(t===-1)return e;let n=[...e];return n[t]={...n[t],...i},n}),e&&ie.has(i.lastStatus)&&w.current?.get(i.id)!==i.lastStatus){let t=i.lastStatus===`success`?`completed successfully`:i.lastStatus===`failed`?`failed`:`timed out`;e(i.name,`Job ${t}`)}w.current&&w.current.set(i.id,i.lastStatus),S(Date.now())},[e])),p(`job:created`,(0,L.useCallback)(e=>{let t=e;t?.job&&(n(e=>e.some(e=>e.id===t.job.id)?e:[...e,t.job]),S(Date.now()))},[])),p(`job:deleted`,(0,L.useCallback)(e=>{let t=e;t?.jobId&&(n(e=>e.filter(e=>e.id!==t.jobId)),S(Date.now()))},[])),p(`jobs:refresh`,(0,L.useCallback)(()=>{E()},[E])),p(`global-pause:changed`,(0,L.useCallback)(()=>{R(`/global-pause/state`).then(e=>{e&&m(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)}).catch(()=>{})},[])),p(`job:progress`,(0,L.useCallback)(e=>{let t=e;t?.jobId&&g(e=>{let n={...e};return n[t.jobId]={events:t.events??[],latestStep:t.latestStep??null,totalSteps:t.totalSteps??null,latestMessage:t.latestMessage??null},n})},[])),(0,L.useEffect)(()=>()=>{C.current.forEach(e=>clearTimeout(e)),C.current=[]},[]),{jobs:t,healthAlerts:r,dismissedAlertKeys:a,dismissAlert:(0,L.useCallback)(async e=>{o(t=>t.includes(e)?t:[...t,e]),await R(`/health/dismissed`,{method:`POST`,body:JSON.stringify({keys:[e]})})},[]),focusDismissedKeys:s,dismissFocusItem:(0,L.useCallback)(async e=>{c(t=>t.includes(e)?t:[...t,e]),await R(`/focus/dismissed`,{method:`POST`,body:JSON.stringify({keys:[e]})})},[]),feed:u,globalPauseState:f,progress:h,missedRuns:_,dismissMissedRun:(0,L.useCallback)(async e=>{v(t=>t.filter(t=>t.jobId!==e)),await R(`/missed-runs/${e}/dismiss`,{method:`POST`})},[]),dismissAllMissedRuns:(0,L.useCallback)(async()=>{v([]),await R(`/missed-runs/dismiss-all`,{method:`POST`})},[]),actionableGoalsCount:y,lastRefresh:x,wsStatus:T,refresh:E,createJob:(0,L.useCallback)(async e=>{await z(`/jobs`,{method:`POST`,body:JSON.stringify(e)})},[]),updateJob:(0,L.useCallback)(async(e,t)=>{await z(`/jobs/${e}`,{method:`PUT`,body:JSON.stringify(t)})},[]),deleteJob:(0,L.useCallback)(async e=>{await R(`/jobs/${e}`,{method:`DELETE`})},[]),toggleEnabled:(0,L.useCallback)(async(e,t)=>{await R(`/jobs/${e}/enable`,{method:`POST`,body:JSON.stringify({enabled:t})})},[]),runJob:(0,L.useCallback)(async e=>{await R(`/jobs/${e}/run`,{method:`POST`}),n(t=>t.map(t=>t.id===e?{...t,lastStatus:`running`,lastRun:new Date().toISOString()}:t))},[]),cancelJob:(0,L.useCallback)(async e=>{await R(`/jobs/${e}/cancel`,{method:`POST`})},[]),installCron:(0,L.useCallback)(async()=>await R(`/install`,{method:`POST`})??{ok:!1,error:`Request failed`},[]),fetchResult:(0,L.useCallback)(async(e,t)=>{try{let n=t?`?file=${encodeURIComponent(t)}`:``,r=await fetch(`${re}/jobs/${e}/result${n}`,{headers:{"Content-Type":`application/json`}});return r.ok?await r.json():null}catch{return null}},[]),fetchHistory:(0,L.useCallback)(async e=>{try{return await R(`/jobs/${e}/history`)??[]}catch{return[]}},[]),fetchTrace:(0,L.useCallback)(async(e,t)=>{try{return await R(`/jobs/${e}/runs/${t}/trace`)}catch{return null}},[]),fetchChangelog:(0,L.useCallback)(async e=>{try{return await R(`/jobs/${e}/prompt-changelog`)??[]}catch{return[]}},[]),snoozeJob:(0,L.useCallback)(async(e,t)=>{await R(`/jobs/${e}/snooze`,{method:`POST`,body:JSON.stringify({until:t})}),await E()},[E]),fetchFocus:(0,L.useCallback)(async(e=24)=>{try{return await R(`/focus?maxAge=${e}`)}catch{return null}},[]),fetchIntegrations:(0,L.useCallback)(async()=>{try{return await R(`/integrations`)}catch{return null}},[]),fetchSettings:(0,L.useCallback)(async()=>{try{return await R(`/settings`)}catch{return null}},[]),updateSettings:(0,L.useCallback)(async e=>{try{return await R(`/settings`,{method:`PUT`,body:JSON.stringify(e)})}catch{return null}},[]),fetchGlobalPauseState:(0,L.useCallback)(async()=>{try{return await R(`/global-pause/state`)}catch{return null}},[]),pauseAll:(0,L.useCallback)(async()=>{let e=(await R(`/settings`))?.globalPause??{manual:{enabled:!1},schedules:[]},t={manual:{...e.manual,enabled:!0},schedules:e.schedules};return await R(`/settings`,{method:`PUT`,body:JSON.stringify({globalPause:t})})!==null},[]),resumeAll:(0,L.useCallback)(async()=>{let e={manual:{enabled:!1},schedules:((await R(`/settings`))?.globalPause??{manual:{enabled:!1},schedules:[]}).schedules};return await R(`/settings`,{method:`PUT`,body:JSON.stringify({globalPause:e})})!==null},[]),exportJob:(0,L.useCallback)(async e=>{try{return await R(`/jobs/${e}/export`)}catch{return null}},[]),importJob:(0,L.useCallback)(async e=>await R(`/jobs/import`,{method:`POST`,body:JSON.stringify(e)}),[])}}function oe(){return typeof window>`u`||!(`Notification`in window)?`denied`:Notification.permission}function se(){let[e,t]=(0,L.useState)(oe);return{permission:e,requestPermission:(0,L.useCallback)(async()=>{if(!(typeof window>`u`||!(`Notification`in window))){if(Notification.permission===`granted`){t(`granted`);return}t(await Notification.requestPermission())}},[]),notify:(0,L.useCallback)((e,t,n)=>{typeof window>`u`||!(`Notification`in window)||Notification.permission===`granted`&&new Notification(e,{body:t,icon:`/favicon.ico`,...n})},[])}}var B=o(),V=(0,L.createContext)(null),ce=[`dashboard-section-layout`,`jobs-view-mode`,`job-table-sort`,`claude-cron-advisor-dismissed`,`onboarding-completed`];function le(){let e={},t=!1;try{let n=localStorage.getItem(`dashboard-section-layout`);n&&(e.sectionLayout=JSON.parse(n),t=!0)}catch{}try{let n=localStorage.getItem(`jobs-view-mode`);(n===`list`||n===`grouped`||n===`table`)&&(e.jobsViewMode=n,t=!0)}catch{}try{let n=localStorage.getItem(`job-table-sort`);n&&(e.jobTableSort=JSON.parse(n),t=!0)}catch{}try{let n=localStorage.getItem(`claude-cron-advisor-dismissed`);n&&(e.advisorDismissed=JSON.parse(n),t=!0)}catch{}try{localStorage.getItem(`onboarding-completed`)===`true`&&(e.onboardingCompleted=!0,t=!0)}catch{}return t?e:null}function ue(){for(let e of ce)localStorage.removeItem(e)}var de=500,fe=[0,500,1500,3500,1e4];async function pe(e){for(let t=0;t<fe.length;t++){if(e())return null;let n=fe[t];if(n>0&&(await new Promise(e=>setTimeout(e,n)),e()))return null;try{let e=await fetch(`/api/preferences`);if(!e.ok)throw Error(`preferences GET ${e.status}`);return await e.json()}catch(e){if(t===fe.length-1)return console.warn(`[preferences] mount fetch failed after retries`,e),null}}return null}function me({children:e}){let[t,n]=(0,L.useState)({}),[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null),c=(0,L.useRef)(),l=(0,L.useCallback)(e=>{fetch(`/api/preferences`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}).then(e=>{if(!e.ok)throw Error(`preferences PUT ${e.status}`)}).catch(e=>{console.warn(`[preferences] Failed to save preferences:`,e)})},[]);(0,L.useEffect)(()=>{let e=!1;return pe(()=>e).then(t=>{if(e)return;if(t===null){let e=le();e&&n(e),o(!0),i(!0);return}let r=Object.keys(t).length>0,a=le();!r&&a?(n(a),l(a),ue()):r&&(n(t),ue()),i(!0)}),()=>{e=!0}},[l]);let u=(0,L.useCallback)((e,t)=>{n(n=>{let r=typeof t==`function`?t(n[e]):t,i={...n,[e]:r};return s.current=i,clearTimeout(c.current),c.current=setTimeout(()=>{s.current&&=(l(s.current),null)},de),i})},[l]);return(0,L.useEffect)(()=>()=>{clearTimeout(c.current),s.current&&l(s.current)},[l]),(0,B.jsx)(V.Provider,{value:{prefs:t,setPref:u,loaded:r,loadFailed:a},children:e})}function he(){let e=(0,L.useContext)(V);if(!e)throw Error(`usePreferences must be used within PreferencesProvider`);return e}function ge(e,t){switch(t){case`all`:return!0;case`active`:return e.enabled;case`failed`:return[`failed`,`timeout`].includes(e.lastStatus??``);case`running`:return e.lastStatus===`running`;case`disabled`:return!e.enabled}}function _e(e,t){if(!t)return!0;let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)}function ve(e,t){return t?e.employee===t:!0}function ye(e,t){return t.length===0?!0:t.some(t=>e.tags?.includes(t))}function be(e,t){switch(t){case`all`:return!0;case`team`:return e.flow===`seam-v1`;case`solo`:return e.flow!==`seam-v1`&&!!e.employee;case`unassigned`:return e.flow!==`seam-v1`&&!e.employee}}function xe(e){let{prefs:t,setPref:n,loaded:r}=he(),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(`all`),[c,l]=(0,L.useState)(`list`),[u,d]=(0,L.useState)(`compact`),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)([]),[g,_]=(0,L.useState)(`all`),v=(0,L.useRef)(!1);(0,L.useEffect)(()=>{!r||v.current||(v.current=!0,t.jobsViewMode&&l(t.jobsViewMode),t.jobsDensity&&d(t.jobsDensity))},[r,t.jobsViewMode,t.jobsDensity]);let y=e=>{l(e),n(`jobsViewMode`,e)};(0,L.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),t=()=>{e.matches&&c===`table`&&l(`list`)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[c]);let b=e=>{d(e),n(`jobsDensity`,e)},x=(0,L.useMemo)(()=>e.filter(e=>_e(e,i)&&ge(e,o)&&ve(e,f)&&ye(e,m)&&be(e,g)),[e,i,o,f,m,g]);return{searchTerm:i,setSearchTerm:a,activeFilter:o,setActiveFilter:s,viewMode:c,setViewMode:y,jobsDensity:u,setJobsDensity:b,employeeFilter:f,setEmployeeFilter:p,tagFilter:m,setTagFilter:h,runsByFilter:g,setRunsByFilter:_,allTags:(0,L.useMemo)(()=>{let t=new Set;for(let n of e)if(n.tags)for(let e of n.tags)t.add(e);return Array.from(t).sort()},[e]),filteredJobs:x,groupedJobs:(0,L.useMemo)(()=>{let e=[{label:`Needs Attention`,key:`attention`,jobs:[],defaultExpanded:!0},{label:`Running`,key:`running`,jobs:[],defaultExpanded:!0},{label:`Healthy`,key:`healthy`,jobs:[],defaultExpanded:!1},{label:`Disabled`,key:`disabled`,jobs:[],defaultExpanded:!1},{label:`Other`,key:`other`,jobs:[],defaultExpanded:!1}];for(let t of x)t.enabled?t.lastStatus===`running`?e[1].jobs.push(t):[`failed`,`timeout`].includes(t.lastStatus??``)?e[0].jobs.push(t):t.lastStatus===`success`?e[2].jobs.push(t):e[4].jobs.push(t):e[3].jobs.push(t);return e.filter(e=>e.jobs.length>0)},[x]),filterCounts:(0,L.useMemo)(()=>{let t={all:e.length,active:0,failed:0,running:0,disabled:0};for(let n of e)n.enabled&&t.active++,n.enabled||t.disabled++,n.lastStatus===`running`&&t.running++,[`failed`,`timeout`].includes(n.lastStatus??``)&&t.failed++;return t},[e]),runsByCounts:(0,L.useMemo)(()=>{let t={all:e.length,team:0,solo:0,unassigned:0};for(let n of e)n.flow===`seam-v1`?t.team++:n.employee?t.solo++:t.unassigned++;return t},[e])}}var Se=[{chord:`c`,display:`g c`,page:`cron`,label:`Cron`},{chord:`o`,display:`g o`,page:`org`,label:`Organization`},{chord:`h`,display:`g h`,page:`chat`,label:`Chat`},{chord:`m`,display:`g m`,page:`memory`,label:`Memory`},{chord:`i`,display:`g i`,page:`ideas`,label:`Ideas`},{chord:`b`,display:`g b`,page:`briefs`,label:`Briefs`},{chord:`s`,display:`g s`,page:`sessions`,label:`Sessions`},{chord:`a`,display:`g a`,page:`analytics`,label:`Analytics`},{chord:`,`,display:`g ,`,page:`settings`,label:`Settings`}],Ce=Object.fromEntries(Se.map(e=>[e.chord,e.page]));function we(e){let[t,n]=(0,L.useState)(!1),r=(0,L.useCallback)(()=>n(e=>!e),[]),i=(0,L.useRef)(null),a=(0,L.useRef)(null);return(0,L.useEffect)(()=>{function o(o){let s=o.target.tagName;if(s===`INPUT`||s===`TEXTAREA`||o.target.isContentEditable){i.current&&=(a.current&&clearTimeout(a.current),null),o.key===`Escape`&&o.target.blur();return}if((o.metaKey||o.ctrlKey)&&o.key===`k`){o.preventDefault(),e.onCommandPalette();return}if((o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key===`f`){o.preventDefault(),e.onOutputSearch();return}if(i.current===`g`){if(o.metaKey||o.ctrlKey||o.altKey){a.current&&clearTimeout(a.current),i.current=null;return}if(o.key===`Escape`)a.current&&clearTimeout(a.current),i.current=null;else{a.current&&clearTimeout(a.current),i.current=null;let t=Ce[o.key];t&&(o.preventDefault(),e.onNavigate(t));return}}if(!((o.metaKey||o.ctrlKey||o.altKey)&&o.key!==`Escape`)){if(o.key===`g`){o.preventDefault(),i.current=`g`,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i.current=null},1500);return}switch(o.key){case`?`:o.preventDefault(),r();break;case`/`:o.preventDefault(),e.onFocusSearch();break;case`n`:o.preventDefault(),e.onNewJob();break;case`r`:o.preventDefault(),e.onRefresh();break;case`a`:o.preventDefault(),e.onToggleActivity();break;case`f`:o.preventDefault(),e.onToggleFocus();break;case`,`:o.preventDefault(),e.onToggleSettings();break;case`i`:o.preventDefault(),e.onSyncCron();break;case`Escape`:o.preventDefault(),t?n(!1):e.onEscape();break}}}return document.addEventListener(`keydown`,o),()=>{document.removeEventListener(`keydown`,o),a.current&&clearTimeout(a.current)}},[e,t,r]),{helpOpen:t,setHelpOpen:n}}function Te(){let{prefs:e,loaded:t,loadFailed:n}=he(),[r,i]=(0,L.useState)(!1),a=(0,L.useRef)(!1);return(0,L.useEffect)(()=>{!t||a.current||n||(a.current=!0,e.onboardingCompleted!==!0&&i(!0))},[t,n,e.onboardingCompleted]),{showOnboarding:r,setShowOnboarding:i}}function Ee(e){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(0),s=(0,L.useCallback)(async(t=24)=>{i(!0);try{n(await e(t))}finally{i(!1)}},[e]);return(0,L.useEffect)(()=>{s()},[s]),{focusData:t,focusLoading:r,focusActiveCount:a,setFocusActiveCount:o,loadFocus:s}}function De(e,t,n){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{e().then(o),t().then(c)},[e,t]),(0,L.useEffect)(()=>{fetch(`/api/config`).then(e=>e.json()).then(i).catch(e=>console.warn(`Config fetch failed:`,e))},[]),{runtimeConfig:r,integrations:a,setIntegrations:o,settings:s,setSettings:c,verifying:l,setVerifying:u,applySettingsPatch:(0,L.useCallback)(async e=>{let t=await n(e);t&&c(t)},[n]),verifyIntegrationsWithPolling:(0,L.useCallback)(async()=>{u(!0);try{await fetch(`/api/integrations/verify`,{method:`POST`});let t=setInterval(async()=>{let n=await e();if(!n)return;o(n);let r=Date.now();[`notion`,`linear`,`slack`].some(e=>{let t=n[e];return t.verifiedAt&&r-new Date(t.verifiedAt).getTime()<12e4})&&(clearInterval(t),u(!1))},5e3);setTimeout(()=>{clearInterval(t),u(!1)},12e4)}catch{u(!1)}},[e])}}function Oe(e,t,n){let r=[],i=e.split(`,`);for(let e of i)if(e===`*`)for(let e=t;e<=n;e++)r.push(e);else if(e.startsWith(`*/`)){let i=parseInt(e.slice(2),10);if(isNaN(i)||i<=0)return null;for(let e=t;e<=n;e+=i)r.push(e)}else if(e.includes(`/`)){let[i,a]=e.split(`/`),o=parseInt(a,10);if(isNaN(o)||o<=0)return null;if(i===`*`)for(let e=t;e<=n;e+=o)r.push(e);else if(i.includes(`-`)){let[e,t]=i.split(`-`),n=parseInt(e,10),a=parseInt(t,10);if(isNaN(n)||isNaN(a))return null;for(let e=n;e<=a;e+=o)r.push(e)}else{let e=parseInt(i,10);if(isNaN(e))return null;for(let t=e;t<=n;t+=o)r.push(t)}}else if(e.includes(`-`)){let[t,n]=e.split(`-`),i=parseInt(t,10),a=parseInt(n,10);if(isNaN(i)||isNaN(a))return null;for(let e=i;e<=a;e++)r.push(e)}else{let t=parseInt(e,10);if(isNaN(t))return null;r.push(t)}for(let e of r)if(e<t||e>n)return null;return[...new Set(r)].sort((e,t)=>e-t)}function ke(e){if(e==null||e===``)return null;if(typeof e!=`string`)return console.warn(`[cronParser] expected string, got`,typeof e,e),null;if(!e.trim())return null;let t=e.trim().split(/\s+/);if(t.length!==5)return null;let[n,r,i,a,o]=t,s=Oe(n,0,59),c=Oe(r,0,23),l=Oe(i,1,31),u=Oe(a,1,12),d=Oe(o,0,7);return d&&=[...new Set(d.map(e=>e===7?0:e))].sort((e,t)=>e-t),!s||!c||!l||!u||!d?null:{minutes:s,hours:c,daysOfMonth:l,months:u,daysOfWeek:d}}function Ae(e,t){let n=ke(e);if(!n)return null;let{minutes:r,hours:i,daysOfMonth:a,months:o,daysOfWeek:s}=n,c=e.trim().split(/\s+/),l=c[2]===`*`,u=c[4]===`*`,d=t?new Date(t):new Date;d.setSeconds(0,0),d.setMinutes(d.getMinutes()+1);let f=new Date(d);f.setFullYear(f.getFullYear()+4);let p=new Date(d);for(;p<f;){let e=p.getMonth()+1,t=p.getDate(),n=p.getDay(),c=p.getHours(),d=p.getMinutes();if(!o.includes(e)){let t=o.find(t=>t>e);t===void 0?(p.setFullYear(p.getFullYear()+1),p.setMonth(o[0]-1,1),p.setHours(0,0,0,0)):(p.setMonth(t-1,1),p.setHours(0,0,0,0));continue}let f=l||a.includes(t),m=u||s.includes(n);if(!(l?m:u?f:f||m)){p.setDate(p.getDate()+1),p.setHours(0,0,0,0);continue}if(!i.includes(c)){let e=i.find(e=>e>c);e===void 0?(p.setDate(p.getDate()+1),p.setHours(i[0],r[0],0,0)):p.setHours(e,r[0],0,0);continue}if(!r.includes(d)){let e=r.find(e=>e>d);if(e!==void 0)p.setMinutes(e,0,0);else{let e=i.find(e=>e>c);e===void 0?(p.setDate(p.getDate()+1),p.setHours(i[0],r[0],0,0)):p.setHours(e,r[0],0,0)}continue}return new Date(p)}return null}function je(e){return e==null||typeof e!=`string`||e.trim()===``?!1:Ae(e)===null}function Me(e){let t=new Date,n=e.getTime()-t.getTime();if(n<=0)return`now`;let r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24),s=e.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`});if(i<60)return`in ${i}m`;if(a<24){let e=a,t=i%60;return t>0?`in ${e}h ${t}m`:`in ${e}h`}let c=new Date(t);return c.setDate(c.getDate()+1),e.getDate()===c.getDate()&&e.getMonth()===c.getMonth()&&e.getFullYear()===c.getFullYear()?`tomorrow at ${s}`:o<7?`${e.toLocaleDateString(`en-US`,{weekday:`short`})} at ${s}`:`${e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})} at ${s}`}var Ne={grid:`_grid_kqdb6_1`,card:`_card_kqdb6_9`,fadeInUp:`_fadeInUp_kqdb6_1`,label:`_label_kqdb6_17`,value:`_value_kqdb6_24`,sub:`_sub_kqdb6_31`,subBroken:`_subBroken_kqdb6_37 _sub_kqdb6_31`,pulse:`_pulse_kqdb6_1`,alertBadge:`_alertBadge_kqdb6_44`},Pe={accent:`var(--color-primary)`,green:`var(--color-positive)`,red:`var(--color-negative)`,warning:`var(--color-warning, #d29922)`};function Fe({label:e,value:t,sub:n,color:r,index:i,emphasize:a}){let o={"--card-color":r??`var(--color-text)`,animationDelay:`${i*.05}s`};return(0,B.jsxs)(`div`,{className:`${Ne.card} stat-card`,style:o,children:[(0,B.jsx)(`div`,{className:Ne.label,children:e}),(0,B.jsx)(`div`,{className:`${Ne.value} stat-value`,children:t}),n&&(0,B.jsx)(`div`,{className:a?Ne.subBroken:Ne.sub,children:n})]})}function Ie({jobs:e,alertCount:t,feed:n=[]}){let r=e.length,i=e.filter(e=>e.enabled).length,a=e.filter(e=>e.lastStatus===`success`).length,o=e.filter(e=>e.lastStatus===`failed`||e.lastStatus===`timeout`||e.lastStatus===`degraded`).length,s=e.filter(e=>e.enabled&&je(e.schedule)).length,c=Date.now(),l=null;for(let t of e){if(!t.enabled||t.snoozedUntil&&new Date(t.snoozedUntil).getTime()>c)continue;let e=Ae(t.schedule);e&&(!l||e<l)&&(l=e)}let u=l?Me(l):void 0,d=n.filter(e=>e.status===`success`||e.status===`failed`||e.status===`timeout`||e.status===`degraded`),f=d.filter(e=>e.status===`success`).length,p=d.length,m=p>=2?`${Math.round(f/p*100)}% (24h)`:void 0,h=d.filter(e=>e.status===`failed`||e.status===`timeout`||e.status===`degraded`).length;return(0,B.jsxs)(`div`,{className:`${Ne.grid} responsive-stats`,children:[(0,B.jsx)(Fe,{label:`Total Jobs`,value:r,color:Pe.accent,index:0}),(0,B.jsx)(Fe,{label:`Active`,value:i,sub:u?`Next: ${u}`:void 0,color:Pe.green,index:1}),(0,B.jsx)(Fe,{label:`Last OK`,value:a,sub:m,color:Pe.green,index:2}),(0,B.jsx)(Fe,{label:`Last Failed`,value:o,sub:h>0?`${h} failure${h===1?``:`s`} (24h)`:void 0,color:o>0?Pe.red:void 0,index:3}),s>0&&(0,B.jsx)(Fe,{label:`Broken`,value:s,sub:`schedule${s===1?``:`s`} invalid`,color:Pe.warning,index:4,emphasize:!0}),t!=null&&t>0&&(0,B.jsxs)(`div`,{className:Ne.alertBadge,children:[`⚠`,` `,t,` `,t===1?`alert`:`alerts`]})]})}function Le({alerts:e,dismissedKeys:t,onDismiss:n}){let r=new Set(t),i=e.filter(e=>{let t=`${e.jobId}:${e.type}`;return!r.has(t)});return i.length===0?null:(0,B.jsx)(`div`,{style:{marginBottom:16},children:i.map((e,t)=>{let r=`${e.jobId}:${e.type}`,i=e.severity===`critical`,a=i?`var(--color-negative)`:C.warning;return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 14px`,background:i?`rgba(248,81,73,0.1)`:`rgba(210,153,34,0.1)`,border:`1px solid ${a}`,borderRadius:8,marginBottom:8,animation:`fadeInUp 0.3s ease-out both`,animationDelay:`${t*.08}s`},children:[(0,B.jsx)(`span`,{style:{color:a,fontSize:16,flexShrink:0},children:i?`⚠`:`⚡`}),(0,B.jsx)(`span`,{style:{fontSize:13,color:C.text,flex:1},children:e.message}),(0,B.jsx)(`button`,{onClick:()=>n(r),style:{background:`none`,border:`none`,color:`var(--color-text-muted)`,cursor:`pointer`,fontSize:14,padding:0,lineHeight:1},"aria-label":`Dismiss alert`,children:`✕`})]},r)})})}function Re(e){return!e||e===`null`?`never`:new Date(e).toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ze(e){if(e<=0)return`0s`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?n>0?`${t}h ${n}m`:`${t}h`:n>0?r>0?`${n}m ${r}s`:`${n}m`:`${r}s`}function Be(e){let t=Date.now(),n=new Date(e).getTime(),r=Math.floor((t-n)/1e3);return r<60?`just now`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:Re(e)}function Ve(e,t){return e.length<=t?e:e.slice(0,t-1)+`…`}function He(e){if(!e)return e;let t=e.match(/^claude-([a-z]+)-(\d+)-(\d+)-\d{8}$/);if(t)return`${t[1]}-${t[2]}.${t[3]}`;let n=e.match(/^claude-(\d+)-(\d+)-([a-z]+)-\d{8}$/);if(n)return`${n[3]}-${n[1]}.${n[2]}`;let r=e.match(/^claude-(\d+)-([a-z]+)-\d{8}$/);if(r)return`${r[2]}-${r[1]}`;let i=e.match(/^claude-([a-z]+)-(\d+)$/);return i?`${i[1]}-${i[2]}`:e.replace(/^claude-/,``)}var Ue=C.warning,We=`rgba(210,153,34,0.1)`,Ge=`rgba(210,153,34,0.3)`;function Ke(e){switch(e){case`detected`:return`Queued`;case`triggered`:return`Triggered`;case`dismissed`:return`Dismissed`}}function qe(e){switch(e){case`detected`:return Ue;case`triggered`:return C.blue;case`dismissed`:return C.muted}}function Je(e){return new Date(e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`})}function Ye({missedRuns:e,onDismiss:t,onDismissAll:n,onSelectJob:r}){if(e.length===0)return null;let i=e.length,a=i===1?`1 job missed its scheduled run`:`${i} jobs missed their scheduled runs`;return(0,B.jsxs)(`div`,{style:{marginBottom:16,animation:`fadeInUp 0.4s ease-out both`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 14px`,background:We,border:`1px solid ${Ge}`,borderRadius:e.length===1?8:`8px 8px 0 0`,fontFamily:g},children:[(0,B.jsx)(`span`,{style:{color:Ue,fontSize:16,flexShrink:0},children:`⏰`}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,B.jsx)(`div`,{style:{fontSize:13,color:C.text,fontWeight:500},children:a}),(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,marginTop:2},children:`Your machine was likely asleep or offline. Catch-up runs have been queued.`})]}),(0,B.jsx)(`button`,{onClick:n,style:{background:`none`,border:`1px solid ${Ge}`,borderRadius:4,color:Ue,cursor:`pointer`,fontSize:11,padding:`3px 8px`,fontFamily:g,flexShrink:0,opacity:.8,transition:`opacity 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.8`},children:`Dismiss all`})]}),e.map((n,i)=>{let a=qe(n.catchUpStatus),o=Ke(n.catchUpStatus);return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 14px 8px 40px`,background:We,borderLeft:`1px solid ${Ge}`,borderRight:`1px solid ${Ge}`,borderBottom:`1px solid ${Ge}`,borderRadius:i===e.length-1?`0 0 8px 8px`:0,fontFamily:g,animation:`fadeInUp 0.3s ease-out both`,animationDelay:`${(i+1)*.08}s`},children:[r?(0,B.jsx)(`button`,{onClick:()=>r(n.jobId),style:{background:`none`,border:`none`,color:C.blue,cursor:`pointer`,fontSize:13,padding:0,fontFamily:g,textDecoration:`none`,transition:`opacity 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.textDecoration=`underline`},onMouseLeave:e=>{e.currentTarget.style.textDecoration=`none`},children:n.jobName}):(0,B.jsx)(`span`,{style:{fontSize:13,color:C.text},children:n.jobName}),(0,B.jsxs)(`span`,{style:{fontSize:12,color:C.muted,flex:1},children:[n.lastRun?`last ran ${Be(n.lastRun)}`:`never ran`,` · `,`missed run at `,Je(n.missedAt)]}),(0,B.jsx)(`span`,{style:{fontSize:11,color:a,background:`${a}18`,border:`1px solid ${a}40`,borderRadius:4,padding:`2px 6px`,flexShrink:0,fontFamily:g},children:o}),(0,B.jsx)(`button`,{onClick:()=>t(n.jobId),style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:14,padding:`2px 4px`,lineHeight:1,flexShrink:0,opacity:.6,transition:`opacity 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.6`},"aria-label":`Dismiss ${n.jobName}`,children:`×`})]},n.jobId)})]})}var Xe=/^([01]\d|2[0-3]):[0-5]\d$/;function Ze(e,t){try{let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,weekday:`short`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(t),r=n.find(e=>e.type===`weekday`)?.value??``,i=n.find(e=>e.type===`hour`)?.value??``,a=n.find(e=>e.type===`minute`)?.value??``,o={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6}[r];if(o===void 0)return null;let s=parseInt(i,10);s===24&&(s=0);let c=parseInt(a,10);return Number.isNaN(s)||Number.isNaN(c)?null:{dayOfWeek:o,minutes:s*60+c}}catch{return null}}function Qe(e,t=new Date){if(!e.enabled)return!1;if(e.type===`oneshot`){let n=Date.parse(e.pauseAt),r=Date.parse(e.resumeAt);if(Number.isNaN(n)||Number.isNaN(r)||r<=n)return!1;let i=t.getTime();return i>=n&&i<r}if(!Xe.test(e.pauseAt)||!Xe.test(e.resumeAt))return!1;let n=Ze(e.createdTimezone||`UTC`,t);if(!n)return!1;let r=e.days??[];if(r.length===0)return!1;let[i,a]=e.pauseAt.split(`:`).map(e=>parseInt(e,10)),[o,s]=e.resumeAt.split(`:`).map(e=>parseInt(e,10)),c=i*60+a,l=o*60+s;if(c===0&&l===0)return r.includes(n.dayOfWeek);if(c<l)return r.includes(n.dayOfWeek)&&n.minutes>=c&&n.minutes<l;if(r.includes(n.dayOfWeek)&&n.minutes>=c)return!0;let u=(n.dayOfWeek+6)%7;return!!(r.includes(u)&&n.minutes<l)}function $e(e,t=new Date){let n=`manual`in e&&`schedules`in e?e:e.globalPause;if(!n)return{paused:!1};if(n.manual?.enabled)if(n.manual.until){let e=Date.parse(n.manual.until);if(Number.isNaN(e))return{paused:!0,reason:`manual`,source:`manual`};if(!(e<=t.getTime()))return{paused:!0,reason:`manual`,source:`manual`,until:n.manual.until}}else return{paused:!0,reason:`manual`,source:`manual`};let r=n.schedules??[];for(let e of r)if(Qe(e,t))return{paused:!0,reason:`scheduled`,source:e.label||e.id};return{paused:!1}}var et={auto:{id:`auto`,label:`Auto`,icon:`✨`,shortDescription:`Agents decide — subagent or team based on task`},subagent:{id:`subagent`,label:`Subagent`,icon:`🤖`,shortDescription:`Lead delegates one subagent at a time and synthesizes results`},team:{id:`team`,label:`Team`,icon:`⫶`,shortDescription:`Agents work as a team, share a task list, and message each other directly`}};function tt(e){return`
|
|
3
|
-
|
|
4
|
-
Before you exit, write a retrospective for each participant (yourself included) that did substantive work this run. The participant ids are {${e.join(`, `)}}. For an id that produced something a future run would benefit from knowing (file paths, counts, channel posts, decisions, problems hit), write the file ./retro/<id>.md (path is relative to your cwd): a single short paragraph, ~3 sentences max, \u2264300 characters, concrete and specific, no generic praise. If a participant was not invoked, did nothing, or the run was a routine no-op (nothing to do, nothing found), do NOT create a retro file for it; skip it entirely rather than writing a "did not contribute" note. Write all retro files in your final turn. Do not delegate this step.`}function nt(e){return`\n\nYou are ${e.lead}, the orchestrator for this run, and also a full participant in the work (not just a router). Delegate only to subagents other than yourself ("${e.lead}" is you).\n\nDelegate one at a time via the Agent tool: call Agent(subagent_type: "<subagent-id>", prompt: "<handoff>") to run each subagent in your session. Each subagent runs in its own context window and returns a summary in the tool_result. Do your own step of the work, then hand off to the next subagent; synthesize the responses and finish.\n\nAvailable subagents (materialized under .claude/agents/):\n${e.agentDescriptions}`}function rt(e){return`\n\nSpawn a team with these agent types: ${e.teammates.join(`, `)}.\n\nYou are ${e.lead}, the team lead — also a full participant in the work, not just a router. Delegate only to teammates other than yourself ("${e.lead}" is you).\n\nThe teammates run as a team, each in its own context, and communicate directly with each other via the team mailbox (the SendMessage tool). Do NOT invoke the Agent tool to dispatch work one-at-a-time — that runs as isolated subagents and defeats the team coordination model; if you find yourself reaching for Agent(subagent_type: ...), stop and use the team mailbox instead.\n\nAfter the teammates have all reported back via the mailbox, synthesize their findings into a single result.\n\nTeammates on the team:\n${e.agentDescriptions}`}function it(e){return`\n\nYou are ${e.lead}, leading a group of ${e.teammates.length+1} (yourself plus: ${e.teammates.join(`, `)}). Delegate only to members other than yourself ("${e.lead}" is you).\n\nExamine the task and pick ONE of the two paths below. Commit fully — do NOT mix approaches. Announce your choice in your first message, then follow ONLY the instructions under that path.\n\nWhen in doubt, pick PATH A (subagent). Subagent delegation handles nearly every workflow well — ordered phases, fan-out + synthesize, comparisons. PATH B (team) is for the rare case where teammates must message each other mid-flight (live debate, mutually-redirecting investigations).\n\n=== PATH A — SUBAGENT (default) ===`+nt(e)+`
|
|
5
|
-
|
|
6
|
-
=== PATH B — TEAM (only when teammates must cross-talk) ===`+rt(e)}function at(e){return e.length===0?``:`
|
|
7
|
-
|
|
8
|
-
Some of your teammates run on non-Claude engines. For those, do NOT call \`Agent(subagent_type: ...)\` and do NOT route to them via the team mailbox — both are Claude-Code primitives that only reach Claude teammates. Call the gateway MCP tool \`mcp__gateway__dispatch_to_employee({ employeeId, prompt })\` and treat the plain-text response as their reply. Non-Claude teammates:\n${e.map(e=>{let t=e.model?`, model: ${e.model}`:``;return`- ${e.id} (engine: ${e.engine}${t})`}).join(`
|
|
9
|
-
`)}`}function ot(e){let t=e.nonClaudeParticipants??[];if(e.participants.length<=1)return`${e.task}\n\nYou are the sole agent. Complete the task autonomously.${at(t)}${tt(e.participants)}`;let n=e.participants.filter(t=>t!==e.lead),r={lead:e.lead,teammates:n,agentDescriptions:e.agentDescriptions},i;switch(e.hint){case`subagent`:i=nt(r);break;case`team`:i=rt(r);break;case`auto`:i=it(r);break;default:{let t=e.hint;throw Error(`buildOrchestrationDirective: unknown coordinationHint '${String(t)}'`)}}return`${e.task}${i}${at(t)}${tt(e.participants)}`}var st=`rgba(88,166,255,0.08)`,ct=`rgba(88,166,255,0.3)`;function lt(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(!1);if(p(j,(0,L.useCallback)(e=>{let n=e;n?.pending?t(n):t(null)},[])),!e)return null;let i=e.changedFiles.length,a=i===1?e.changedFiles[0]:`${i} files`;return(0,B.jsx)(`div`,{style:{marginBottom:16,animation:`fadeInUp 0.4s ease-out both`},children:(0,B.jsxs)(`div`,{style:{background:st,border:`1px solid ${ct}`,borderRadius:10,padding:`12px 16px`,display:`flex`,alignItems:`center`,gap:10,fontFamily:g,fontSize:13,color:C.blue},children:[(0,B.jsx)(`span`,{style:{fontSize:16},children:`↻`}),(0,B.jsxs)(`span`,{style:{flex:1},children:[`Gateway restart pending — `,a,` changed.`,n?` Restarting...`:` Will auto-restart when idle.`]}),!n&&(0,B.jsx)(`button`,{className:`btn btn-sm`,onClick:async()=>{r(!0);try{await fetch(`/api/gateway/restart`,{method:`POST`})}catch{}},style:{color:C.blue,borderColor:ct,fontSize:12,whiteSpace:`nowrap`},children:`Restart Now`})]})})}function ut(){}function dt(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var ft=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mt={};function ht(e,t){return((t||mt).jsx?pt:ft).test(e)}var gt=/[ \t\n\f\r]/g;function _t(e){return typeof e==`object`?e.type===`text`?vt(e.value):!1:vt(e)}function vt(e){return e.replace(gt,``)===``}var yt=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};yt.prototype.normal={},yt.prototype.property={},yt.prototype.space=void 0;function bt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new yt(n,r,t)}function xt(e){return e.toLowerCase()}var St=class{constructor(e,t){this.attribute=t,this.property=e}};St.prototype.attribute=``,St.prototype.booleanish=!1,St.prototype.boolean=!1,St.prototype.commaOrSpaceSeparated=!1,St.prototype.commaSeparated=!1,St.prototype.defined=!1,St.prototype.mustUseProperty=!1,St.prototype.number=!1,St.prototype.overloadedBoolean=!1,St.prototype.property=``,St.prototype.spaceSeparated=!1,St.prototype.space=void 0;var Ct=e({boolean:()=>H,booleanish:()=>Tt,commaOrSpaceSeparated:()=>kt,commaSeparated:()=>Ot,number:()=>U,overloadedBoolean:()=>Et,spaceSeparated:()=>Dt}),wt=0,H=At(),Tt=At(),Et=At(),U=At(),Dt=At(),Ot=At(),kt=At();function At(){return 2**++wt}var jt=Object.keys(Ct),Mt=class extends St{constructor(e,t,n,r){let i=-1;if(super(e,t),Nt(this,`space`,r),typeof n==`number`)for(;++i<jt.length;){let e=jt[i];Nt(this,jt[i],(n&Ct[e])===Ct[e])}}};Mt.prototype.defined=!0;function Nt(e,t,n){n&&(e[t]=n)}function Pt(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Mt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[xt(r)]=r,n[xt(a.attribute)]=r}return new yt(t,n,e.space)}var Ft=Pt({properties:{ariaActiveDescendant:null,ariaAtomic:Tt,ariaAutoComplete:null,ariaBusy:Tt,ariaChecked:Tt,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:Dt,ariaCurrent:null,ariaDescribedBy:Dt,ariaDetails:null,ariaDisabled:Tt,ariaDropEffect:Dt,ariaErrorMessage:null,ariaExpanded:Tt,ariaFlowTo:Dt,ariaGrabbed:Tt,ariaHasPopup:null,ariaHidden:Tt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dt,ariaLevel:U,ariaLive:null,ariaModal:Tt,ariaMultiLine:Tt,ariaMultiSelectable:Tt,ariaOrientation:null,ariaOwns:Dt,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:Tt,ariaReadOnly:Tt,ariaRelevant:null,ariaRequired:Tt,ariaRoleDescription:Dt,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:Tt,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function It(e,t){return t in e?e[t]:t}function Lt(e,t){return It(e,t.toLowerCase())}var Rt=Pt({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Ot,acceptCharset:Dt,accessKey:Dt,action:null,allow:null,allowFullScreen:H,allowPaymentRequest:H,allowUserMedia:H,alt:null,as:null,async:H,autoCapitalize:null,autoComplete:Dt,autoFocus:H,autoPlay:H,blocking:Dt,capture:null,charSet:null,checked:H,cite:null,className:Dt,cols:U,colSpan:null,content:null,contentEditable:Tt,controls:H,controlsList:Dt,coords:U|Ot,crossOrigin:null,data:null,dateTime:null,decoding:null,default:H,defer:H,dir:null,dirName:null,disabled:H,download:Et,draggable:Tt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:H,formTarget:null,headers:Dt,height:U,hidden:Et,high:U,href:null,hrefLang:null,htmlFor:Dt,httpEquiv:Dt,id:null,imageSizes:null,imageSrcSet:null,inert:H,inputMode:null,integrity:null,is:null,isMap:H,itemId:null,itemProp:Dt,itemRef:Dt,itemScope:H,itemType:Dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:H,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:H,muted:H,name:null,nonce:null,noModule:H,noValidate:H,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:H,optimum:U,pattern:null,ping:Dt,placeholder:null,playsInline:H,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:H,referrerPolicy:null,rel:Dt,required:H,reversed:H,rows:U,rowSpan:U,sandbox:Dt,scope:null,scoped:H,seamless:H,selected:H,shadowRootClonable:H,shadowRootDelegatesFocus:H,shadowRootMode:null,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:Tt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:H,useMap:null,value:Tt,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dt,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:H,declare:H,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:H,noHref:H,noShade:H,noWrap:H,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:Tt,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:H,disableRemotePlayback:H,prefix:null,property:null,results:U,security:null,unselectable:null},space:`html`,transform:Lt}),zt=Pt({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:kt,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,className:Dt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:H,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ot,g2:Ot,glyphName:Ot,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:kt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:U,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kt,rev:kt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kt,requiredFeatures:kt,requiredFonts:kt,requiredFormats:kt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:kt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kt,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:It}),Bt=Pt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Vt=Pt({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Lt}),Ht=Pt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Ut={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Wt=/[A-Z]/g,Gt=/-[a-z]/g,Kt=/^data[-\w.:]+$/i;function qt(e,t){let n=xt(t),r=t,i=St;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Kt.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Gt,Yt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Gt.test(e)){let n=e.replace(Wt,Jt);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Mt}return new i(r,t)}function Jt(e){return`-`+e.toLowerCase()}function Yt(e){return e.charAt(1).toUpperCase()}var Xt=bt([Ft,Rt,Bt,Vt,Ht],`html`),Zt=bt([Ft,zt,Bt,Vt,Ht],`svg`);function Qt(e){return e.join(` `).trim()}var $t=i(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
10
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),en=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t($t());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),tn=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),nn=i(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(en()),r=tn();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),rn=on(`end`),an=on(`start`);function on(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function sn(e){let t=an(e),n=rn(e);if(t&&n)return{start:t,end:n}}function cn(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?un(e.position):`start`in e||`end`in e?un(e):`line`in e||`column`in e?ln(e):``}function ln(e){return dn(e&&e.line)+`:`+dn(e&&e.column)}function un(e){return ln(e&&e.start)+`-`+ln(e&&e.end)}function dn(e){return e&&typeof e==`number`?e:1}var fn=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=cn(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};fn.prototype.file=``,fn.prototype.name=``,fn.prototype.reason=``,fn.prototype.message=``,fn.prototype.stack=``,fn.prototype.column=void 0,fn.prototype.line=void 0,fn.prototype.ancestors=void 0,fn.prototype.cause=void 0,fn.prototype.fatal=void 0,fn.prototype.place=void 0,fn.prototype.ruleId=void 0,fn.prototype.source=void 0;var pn=a(nn(),1),mn={}.hasOwnProperty,hn=new Map,gn=/[A-Z]/g,_n=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),vn=new Set([`td`,`th`]),yn=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function bn(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=jn(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=An(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Zt:Xt,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=xn(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function xn(e,t,n){if(t.type===`element`)return Sn(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Cn(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Tn(e,t,n);if(t.type===`mdxjsEsm`)return wn(e,t);if(t.type===`root`)return En(e,t,n);if(t.type===`text`)return Dn(e,t)}function Sn(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Zt,e.schema=i),e.ancestors.push(t);let a=Ln(e,t.tagName,!1),o=Mn(e,t),s=Pn(e,t);return _n.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!_t(e):!0})),On(e,o,a,t),kn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Cn(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Rn(e,t.position)}function wn(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Rn(e,t.position)}function Tn(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Zt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Ln(e,t.name,!0),o=Nn(e,t),s=Pn(e,t);return On(e,o,a,t),kn(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function En(e,t,n){let r={};return kn(r,Pn(e,t)),e.create(t,e.Fragment,r,n)}function Dn(e,t){return t.value}function On(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function kn(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function An(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function jn(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=an(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Mn(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&mn.call(t.properties,i)){let a=Fn(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&vn.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Nn(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Rn(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Rn(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Pn(e,t){let n=[],r=-1,i=e.passKeys?new Map:hn;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=xn(e,a,o);s!==void 0&&n.push(s)}return n}function Fn(e,t,n){let r=qt(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?dt(n):Qt(n)),r.property===`style`){let t=typeof n==`object`?n:In(e,String(n));return e.stylePropertyNameCase===`css`&&(t=zn(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Ut[r.property]||r.property:r.attribute,n]}}function In(e,t){try{return(0,pn.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new fn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=yn+`#cannot-parse-style-attribute`,r}}function Ln(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=ht(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=ht(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return mn.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Rn(e)}function Rn(e,t){let n=new fn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=yn+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function zn(e){let t={},n;for(n in e)mn.call(e,n)&&(t[Bn(n)]=e[n]);return t}function Bn(e){let t=e.replace(gn,Vn);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Vn(e){return`-`+e.toLowerCase()}var Hn={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Un={};function Wn(e,t){let n=t||Un;return Gn(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Gn(e,t,n){if(qn(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Kn(e.children,t,n)}return Array.isArray(e)?Kn(e,t,n):``}function Kn(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Gn(e[i],t,n);return r.join(``)}function qn(e){return!!(e&&typeof e==`object`)}var Jn=document.createElement(`i`);function Yn(e){let t=`&`+e+`;`;Jn.innerHTML=t;let n=Jn.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function Xn(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Zn(e,t){return e.length>0?(Xn(e,e.length,0,t),e):t}var Qn={}.hasOwnProperty;function $n(e){let t={},n=-1;for(;++n<e.length;)er(t,e[n]);return t}function er(e,t){let n;for(n in t){let r=(Qn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Qn.call(r,a)||(r[a]=[]);let e=i[a];tr(r[a],Array.isArray(e)?e:e?[e]:[])}}}function tr(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Xn(e,0,0,r)}function nr(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function rr(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var ir=hr(/[A-Za-z]/),ar=hr(/[\dA-Za-z]/),or=hr(/[#-'*+\--9=?A-Z^-~]/);function sr(e){return e!==null&&(e<32||e===127)}var cr=hr(/\d/),lr=hr(/[\dA-Fa-f]/),ur=hr(/[!-/:-@[-`{-~]/);function W(e){return e!==null&&e<-2}function dr(e){return e!==null&&(e<0||e===32)}function fr(e){return e===-2||e===-1||e===32}var pr=hr(/\p{P}|\p{S}/u),mr=hr(/\s/);function hr(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function gr(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&ar(e.charCodeAt(n+1))&&ar(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function _r(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return fr(r)?(e.enter(n),s(r)):t(r)}function s(r){return fr(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var vr={tokenize:yr};function yr(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),_r(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return W(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var br={tokenize:Sr},xr={tokenize:Cr};function Sr(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Xn(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(xr,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(xr,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return W(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Xn(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Cr(e,t,n){return _r(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function wr(e){if(e===null||dr(e)||mr(e))return 1;if(pr(e))return 2}function Tr(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Er={name:`attention`,resolveAll:Dr,tokenize:Or};function Dr(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};kr(d,-c),kr(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Zn(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Zn(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Zn(l,Tr(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Zn(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Zn(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Xn(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Or(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=wr(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=wr(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function kr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Ar={name:`autolink`,tokenize:jr};function jr(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return ir(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||ar(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||ar(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||sr(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):or(t)?(e.consume(t),l):n(t)}function u(e){return ar(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||ar(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Mr={partial:!0,tokenize:Nr};function Nr(e,t,n){return r;function r(t){return fr(t)?_r(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||W(e)?t(e):n(e)}}var Pr={continuation:{tokenize:Ir},exit:Lr,name:`blockQuote`,tokenize:Fr};function Fr(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return fr(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Ir(e,t,n){let r=this;return i;function i(t){return fr(t)?_r(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Pr,t,n)(r)}}function Lr(e){e.exit(`blockQuote`)}var Rr={name:`characterEscape`,tokenize:zr};function zr(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return ur(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Br={name:`characterReference`,tokenize:Vr};function Vr(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=ar,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=lr,u):(e.enter(`characterReferenceValue`),a=7,o=cr,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===ar&&!Yn(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Hr={partial:!0,tokenize:Gr},Ur={concrete:!0,name:`codeFenced`,tokenize:Wr};function Wr(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),fr(t)?_r(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||W(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Hr,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):fr(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),_r(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||W(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||W(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&fr(t)?_r(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||W(t)?e.check(Hr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||W(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),fr(t)?_r(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),fr(t)?_r(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||W(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Gr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Kr={name:`codeIndented`,tokenize:Jr},qr={partial:!0,tokenize:Yr};function Jr(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),_r(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):W(t)?e.attempt(qr,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||W(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Yr(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):_r(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):W(e)?i(e):n(e)}}var Xr={name:`codeText`,previous:Qr,resolve:Zr,tokenize:$r};function Zr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Qr(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function $r(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||W(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var ei=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&ti(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),ti(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ti(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);ti(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);ti(this.left,t.reverse())}}};function ti(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ni(e){let t={},n=-1,r,i,a,o,s,c,l,u=new ei(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,ri(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Xn(e,0,1/0,u.slice(0)),!l}function ri(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var ii={resolve:oi,tokenize:si},ai={partial:!0,tokenize:ci};function oi(e){return ni(e),e}function si(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):W(t)?e.check(ai,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function ci(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_r(e,a,`linePrefix`)}function a(i){if(i===null||W(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function li(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||sr(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||W(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||dr(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||sr(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function ui(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):W(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||W(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!fr(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function di(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_r(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||W(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function fi(e,t){let n;return r;function r(i){return W(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):fr(i)?_r(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var pi={name:`definition`,tokenize:hi},mi={partial:!0,tokenize:gi};function hi(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return ui.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return dr(t)?fi(e,l)(t):l(t)}function l(t){return li(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(mi,d,d)(t)}function d(t){return fr(t)?_r(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||W(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function gi(e,t,n){return r;function r(t){return dr(t)?fi(e,i)(t):n(t)}function i(t){return di(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return fr(t)?_r(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||W(e)?t(e):n(e)}}var _i={name:`hardBreakEscape`,tokenize:vi};function vi(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return W(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var yi={name:`headingAtx`,resolve:bi,tokenize:xi};function bi(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Xn(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function xi(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||dr(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||W(n)?(e.exit(`atxHeading`),t(n)):fr(n)?_r(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||dr(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Si=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Ci=[`pre`,`script`,`style`,`textarea`],wi={concrete:!0,name:`htmlFlow`,resolveTo:Di,tokenize:Oi},Ti={partial:!0,tokenize:Ai},Ei={partial:!0,tokenize:ki};function Di(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Oi(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:F):ir(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):ir(a)?(e.consume(a),i=4,r.interrupt?t:F):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:F):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return ir(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||dr(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Ci.includes(l)?(i=1,r.interrupt?t(s):O(s)):Si.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||ar(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return fr(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||ir(t)?(e.consume(t),b):fr(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||ar(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):fr(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):fr(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||W(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||dr(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||fr(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||W(t)?O(t):fr(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),te):t===63&&i===3?(e.consume(t),F):t===93&&i===5?(e.consume(t),P):W(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Ti,I,k)(t)):t===null||W(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Ei,A,I)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||W(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),F):O(t)}function N(t){return t===47?(e.consume(t),o=``,ee):O(t)}function ee(t){if(t===62){let n=o.toLowerCase();return Ci.includes(n)?(e.consume(t),te):O(t)}return ir(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ee):O(t)}function P(t){return t===93?(e.consume(t),F):O(t)}function F(t){return t===62?(e.consume(t),te):t===45&&i===2?(e.consume(t),F):O(t)}function te(t){return t===null||W(t)?(e.exit(`htmlFlowData`),I(t)):(e.consume(t),te)}function I(n){return e.exit(`htmlFlow`),t(n)}}function ki(e,t,n){let r=this;return i;function i(t){return W(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Ai(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Mr,t,n)}}var ji={name:`htmlText`,tokenize:Mi};function Mi(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):ir(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):ir(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):W(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):W(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):W(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):W(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return ir(t)?(e.consume(t),S):n(t)}function S(t){return t===45||ar(t)?(e.consume(t),S):C(t)}function C(t){return W(t)?(o=C,N(t)):fr(t)?(e.consume(t),C):M(t)}function w(t){return t===45||ar(t)?(e.consume(t),w):t===47||t===62||dr(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||ir(t)?(e.consume(t),E):W(t)?(o=T,N(t)):fr(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||ar(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):W(t)?(o=D,N(t)):fr(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):W(t)?(o=O,N(t)):fr(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):W(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||dr(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||dr(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ee}function ee(t){return fr(t)?_r(e,P,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):P(t)}function P(t){return e.enter(`htmlTextData`),o(t)}}var Ni={name:`labelEnd`,resolveAll:Li,resolveTo:Ri,tokenize:zi},Pi={tokenize:Bi},Fi={tokenize:Vi},Ii={tokenize:Hi};function Li(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Xn(e,0,e.length,n),e}function Ri(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Zn(s,e.slice(a+1,a+r+3)),s=Zn(s,[[`enter`,u,t]]),s=Zn(s,Tr(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Zn(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Zn(s,e.slice(o+1)),s=Zn(s,[[`exit`,c,t]]),Xn(e,a,e.length,s),e}function zi(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(rr(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Pi,u,o?u:d)(t):t===91?e.attempt(Fi,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Ii,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Bi(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return dr(t)?fi(e,a)(t):a(t)}function a(t){return t===41?u(t):li(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return dr(t)?fi(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?di(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return dr(t)?fi(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Vi(e,t,n){let r=this;return i;function i(t){return ui.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Hi(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Ui={name:`labelStartImage`,resolveAll:Ni.resolveAll,tokenize:Wi};function Wi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Gi={name:`labelStartLink`,resolveAll:Ni.resolveAll,tokenize:Ki};function Ki(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var qi={name:`lineEnding`,tokenize:Ji};function Ji(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),_r(e,t,`linePrefix`)}}var Yi={name:`thematicBreak`,tokenize:Xi};function Xi(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||W(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),fr(t)?_r(e,s,`whitespace`)(t):s(t))}}var Zi={continuation:{tokenize:ta},exit:ra,name:`list`,tokenize:ea},Qi={partial:!0,tokenize:ia},$i={partial:!0,tokenize:na};function ea(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:cr(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Yi,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return cr(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Mr,r.interrupt?n:u,e.attempt(Qi,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return fr(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function ta(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Mr,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_r(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!fr(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt($i,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,_r(e,e.attempt(Zi,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function na(e,t,n){let r=this;return _r(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function ra(e){e.exit(this.containerState.type)}function ia(e,t,n){let r=this;return _r(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!fr(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var aa={name:`setextUnderline`,resolveTo:oa,tokenize:sa};function oa(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function sa(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),fr(t)?_r(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||W(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var ca={tokenize:la};function la(e){let t=this,n=e.attempt(Mr,r,e.attempt(this.parser.constructs.flowInitial,i,_r(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ii,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ua={resolveAll:ma()},da=pa(`string`),fa=pa(`text`);function pa(e){return{resolveAll:ma(e===`text`?ha:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function ma(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function ha(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var ga=e({attentionMarkers:()=>wa,contentInitial:()=>va,disable:()=>Ta,document:()=>_a,flow:()=>ba,flowInitial:()=>ya,insideSpan:()=>Ca,string:()=>xa,text:()=>Sa}),_a={42:Zi,43:Zi,45:Zi,48:Zi,49:Zi,50:Zi,51:Zi,52:Zi,53:Zi,54:Zi,55:Zi,56:Zi,57:Zi,62:Pr},va={91:pi},ya={[-2]:Kr,[-1]:Kr,32:Kr},ba={35:yi,42:Yi,45:[aa,Yi],60:wi,61:aa,95:Yi,96:Ur,126:Ur},xa={38:Br,92:Rr},Sa={[-5]:qi,[-4]:qi,[-3]:qi,33:Ui,38:Br,42:Er,60:[Ar,ji],91:Gi,92:[_i,Rr],93:Ni,95:Er,96:Xr},Ca={null:[Er,ua]},wa={null:[42,95]},Ta={null:[]};function Ea(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Zn(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Tr(a,l.events,l),l.events):[]}function f(e,t){return Oa(p(e),t)}function p(e){return Da(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){W(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Xn(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Da(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Oa(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
11
|
-
`;break;case-3:o=`\r
|
|
12
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function ka(e){let t={constructs:$n([ga,...(e||{}).extensions||[]]),content:n(vr),defined:[],document:n(br),flow:n(ca),lazy:{},string:n(da),text:n(fa)};return t;function n(e){return n;function n(n){return Ea(t,e,n)}}}function Aa(e){for(;!ni(e););return e}var ja=/[\0\t\n\r]/g;function Ma(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(ja.lastIndex=u,c=ja.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Na=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Pa(e){return e.replace(Na,Fa)}function Fa(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return nr(n.slice(t?2:1),t?16:10)}return Yn(n)||e}var Ia={}.hasOwnProperty;function La(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Ra(n)(Aa(ka(n).document().write(Ma()(e,t,!0))))}function Ra(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(pe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(le),blockQuote:a(oe),characterEscape:T,characterReference:T,codeFenced:a(se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(se,o),codeText:a(B,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(V),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ce),hardBreakEscape:a(ue),hardBreakTrailing:a(ue),htmlFlow:a(de,o),htmlFlowData:T,htmlText:a(de,o),htmlTextData:T,image:a(fe),label:o,link:a(pe),listItem:a(he),listItemValue:f,listOrdered:a(me,d),listUnordered:a(me),paragraph:a(ge),reference:ne,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(le),strong:a(_e),thematicBreak:a(ye)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ae,autolinkProtocol:ie,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:R,characterReference:z,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:P,labelText:ee,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:L,resourceDestinationString:F,resourceTitleString:te,resource:I,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Ba(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Ia.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Ha).call(a,void 0,e[0])}for(r.position={start:za(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:za(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:za(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Ha).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+cn({start:e.start,end:e.end})+`): it’s not open`);n.position.end=za(e.end)}function u(){return Wn(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=rr(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ve(),n.position={start:za(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=za(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=za(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Pa(t),n.identifier=rr(t).toLowerCase()}function P(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function F(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function I(){this.data.inReference=void 0}function ne(){this.data.referenceType=`collapsed`}function L(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=rr(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function re(e){this.data.characterReferenceType=e.type}function R(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=nr(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Yn(t);let i=this.stack[this.stack.length-1];i.value+=r}function z(e){let t=this.stack.pop();t.position.end=za(e.end)}function ie(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ae(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function oe(){return{type:`blockquote`,children:[]}}function se(){return{type:`code`,lang:null,meta:null,value:``}}function B(){return{type:`inlineCode`,value:``}}function V(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ce(){return{type:`emphasis`,children:[]}}function le(){return{type:`heading`,depth:0,children:[]}}function ue(){return{type:`break`}}function de(){return{type:`html`,value:``}}function fe(){return{type:`image`,title:null,url:``,alt:null}}function pe(){return{type:`link`,title:null,url:``,children:[]}}function me(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function he(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function ge(){return{type:`paragraph`,children:[]}}function _e(){return{type:`strong`,children:[]}}function ve(){return{type:`text`,value:``}}function ye(){return{type:`thematicBreak`}}}function za(e){return{line:e.line,column:e.column,offset:e.offset}}function Ba(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Ba(e,r):Va(e,r)}}function Va(e,t){let n;for(n in t)if(Ia.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Ha(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+cn({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cn({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+cn({start:t.start,end:t.end})+`) is still open`)}function Ua(e){let t=this;t.parser=n;function n(n){return La(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Wa(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Ga(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
13
|
-
`}]}function Ka(e,t){let n=t.value?t.value+`
|
|
14
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function qa(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ja(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ya(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=gr(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Xa(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Za(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Qa(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function $a(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Qa(e,t);let i={src:gr(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function eo(e,t){let n={src:gr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function to(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function no(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Qa(e,t);let i={href:gr(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function ro(e,t){let n={href:gr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function io(e,t,n){let r=e.all(t),i=n?ao(n):oo(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
15
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
16
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function ao(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=oo(n[r])}return t}function oo(e){return e.spread??e.children.length>1}function so(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function co(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lo(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function uo(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fo(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=an(t.children[1]),o=rn(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function po(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function mo(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var ho=9,go=32;function _o(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(vo(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(vo(t.slice(i),i>0,!1)),a.join(``)}function vo(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===ho||t===go;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===ho||t===go;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function yo(e,t){let n={type:`text`,value:_o(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bo(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var xo={blockquote:Wa,break:Ga,code:Ka,delete:qa,emphasis:Ja,footnoteReference:Ya,heading:Xa,html:Za,imageReference:$a,image:eo,inlineCode:to,linkReference:no,link:ro,listItem:io,list:so,paragraph:co,root:lo,strong:uo,table:fo,tableCell:mo,tableRow:po,text:yo,thematicBreak:bo,toml:So,yaml:So,definition:So,footnoteDefinition:So};function So(){}var Co=typeof self==`object`?self:globalThis,wo=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new Co[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new Co[a](o),i)};return r},To=e=>wo(new Map,e)(0),Eo=``,{toString:Do}={},{keys:Oo}=Object,ko=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Do.call(e).slice(8,-1);switch(n){case`Array`:return[1,Eo];case`Object`:return[2,Eo];case`Date`:return[3,Eo];case`RegExp`:return[4,Eo];case`Map`:return[5,Eo];case`Set`:return[6,Eo];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Ao=([e,t])=>e===0&&(t===`function`||t===`symbol`),jo=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=ko(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Oo(r))(e||!Ao(ko(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Ao(ko(n))||Ao(ko(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Ao(ko(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Mo=(e,{json:t,lossy:n}={})=>{let r=[];return jo(!(t||n),!!t,new Map,r)(e),r},No=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?To(Mo(e,t)):structuredClone(e):(e,t)=>To(Mo(e,t));function Po(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Fo(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Io(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Po,r=e.options.footnoteBackLabel||Fo,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=gr(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...No(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
17
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
18
|
-
`}]}}var Lo=(function(e){if(e==null)return Ho;if(typeof e==`function`)return Vo(e);if(typeof e==`object`)return Array.isArray(e)?Ro(e):zo(e);if(typeof e==`string`)return Bo(e);throw Error(`Expected function, string, or object as test`)});function Ro(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Lo(e[n]);return Vo(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function zo(e){let t=e;return Vo(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Bo(e){return Vo(t);function t(t){return t&&t.type===e}}function Vo(e){return t;function t(t,n,r){return!!(Uo(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Ho(){return!0}function Uo(e){return typeof e==`object`&&!!e&&`type`in e}function Wo(e){return e}var Go=[];function Ko(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Lo(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+Wo(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Go,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=qo(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function qo(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Go:[e]}function Jo(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Ko(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Yo={}.hasOwnProperty,Xo={};function Zo(e,t){let n=t||Xo,r=new Map,i=new Map,a={all:s,applyData:$o,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...xo,...n.handlers},one:o,options:n,patch:Qo,wrap:ts};return Jo(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(Yo.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=No(n);return r.children=a.all(e),r}return No(e)}return(a.options.unknownHandler||es)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=ns(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=ns(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Qo(e,t){e.position&&(t.position=sn(e))}function $o(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,No(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function es(e,t){let n=t.data||{},r=`value`in t&&!(Yo.call(n,`hProperties`)||Yo.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function ts(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
19
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
20
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
21
|
-
`}),n}function ns(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function rs(e,t){let n=Zo(e,t),r=n.one(e,void 0),i=Io(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
22
|
-
`},i)),a}function is(e,t){return e&&`run`in e?async function(n,r){let i=rs(n,{file:r,...t});await e.run(i,r)}:function(n,r){return rs(n,{file:r,...e||t})}}function as(e){if(e)throw e}var os=i(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function ss(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function cs(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?ls(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function ls(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var us={basename:ds,dirname:fs,extname:ps,join:ms,sep:`/`};function ds(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);_s(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function fs(e){if(_s(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ps(e){_s(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function ms(...e){let t=-1,n;for(;++t<e.length;)_s(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:hs(n)}function hs(e){_s(e);let t=e.codePointAt(0)===47,n=gs(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function gs(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function _s(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var vs={cwd:ys};function ys(){return`/`}function bs(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function xs(e){if(typeof e==`string`)e=new URL(e);else if(!bs(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Ss(e)}function Ss(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Cs=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],ws=class{constructor(e){let t;t=e?bs(e)?{path:e}:typeof e==`string`||Os(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:vs.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Cs.length;){let e=Cs[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Cs.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?us.basename(this.path):void 0}set basename(e){Es(e,`basename`),Ts(e,`basename`),this.path=us.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?us.dirname(this.path):void 0}set dirname(e){Ds(this.basename,`dirname`),this.path=us.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?us.extname(this.path):void 0}set extname(e){if(Ts(e,`extname`),Ds(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=us.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){bs(e)&&(e=xs(e)),Es(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?us.basename(this.path,this.extname):void 0}set stem(e){Es(e,`stem`),Ts(e,`stem`),this.path=us.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new fn(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Ts(e,t){if(e&&e.includes(us.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+us.sep+"`")}function Es(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Ds(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Os(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var ks=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),As=a(os(),1),js={}.hasOwnProperty,Ms=new class e extends ks{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=cs()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,As.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Fs(`data`,this.frozen),this.namespace[e]=t,this):js.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Fs(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Rs(e),n=this.parser||this.Parser;return Ns(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Ns(`process`,this.parser||this.Parser),Ps(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Rs(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Bs(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Ns(`processSync`,this.parser||this.Parser),Ps(`processSync`,this.compiler||this.Compiler),this.process(e,r),Ls(`processSync`,`process`,t),n;function r(e,r){t=!0,as(e),n=r}}run(e,t,n){Is(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Rs(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Ls(`runSync`,`run`,n),r;function i(e,t){as(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Rs(t),r=this.compiler||this.Compiler;return Ps(`stringify`,r),Is(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Fs(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,As.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];ss(o)&&ss(r)&&(r=(0,As.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Ns(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ps(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Fs(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Is(e){if(!ss(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Ls(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Rs(e){return zs(e)?e:new ws(e)}function zs(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Bs(e){return typeof e==`string`||Vs(e)}function Vs(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Hs=[],Us={allowDangerousHtml:!0},Ws=/^(https?|ircs?|mailto|xmpp)$/i,Gs=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Ks(e){let t=qs(e),n=Js(e);return Ys(t.runSync(t.parse(n),n),e)}function qs(e){let t=e.rehypePlugins||Hs,n=e.remarkPlugins||Hs,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Us}:Us;return Ms().use(Ua).use(n).use(is,r).use(t)}function Js(e){let t=e.children||``,n=new ws;return typeof t==`string`?n.value=t:``+t,n}function Ys(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Xs;for(let e of Gs)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Jo(e,l),bn(e,{Fragment:B.Fragment,components:i,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Hn)if(Object.hasOwn(Hn,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Hn[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Xs(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Ws.test(e.slice(0,t))?e:``}function Zs(){let[e,t]=(0,L.useState)([]),[n,r]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{fetch(`/api/chat/history`).then(e=>e.ok?e.json():Promise.resolve([])).then(e=>{e.length>0&&t(e.map(e=>({...e,isHistory:!0})))}).catch(()=>{})},[]),{messages:e,loading:n,sendMessage:(0,L.useCallback)(async n=>{let i={role:`user`,content:n};t(e=>[...e,i]),r(!0);try{let n=[...e,i],r=await fetch(`/api/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({messages:n})});if(!r.ok)throw Error(`HTTP ${r.status}`);let a={role:`assistant`,content:(await r.json()).content};t(e=>[...e,a])}catch{let e={role:`assistant`,content:`Sorry, I couldn't process that request.`};t(t=>[...t,e])}finally{r(!1)}},[e]),clearMessages:(0,L.useCallback)(async()=>{try{await fetch(`/api/chat/session`,{method:`DELETE`})}catch{}t([])},[])}}var Qs=8;function $s(e){try{let t=localStorage.getItem(e);if(!t)return null;let n=JSON.parse(t);if(n&&typeof n.x==`number`&&typeof n.y==`number`)return{x:n.x,y:n.y}}catch{}return null}function ec(e,t){if(typeof window>`u`)return e;let n=Math.max(Qs,window.innerWidth-t-Qs),r=Math.max(Qs,window.innerHeight-t-Qs);return{x:Math.min(Math.max(Qs,e.x),n),y:Math.min(Math.max(Qs,e.y),r)}}function tc(e,t=52){let[n,r]=(0,L.useState)(()=>$s(e)),[i,a]=(0,L.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 767px)`).matches),[o,s]=(0,L.useState)(0);(0,L.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),t=()=>a(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,L.useEffect)(()=>{let e=()=>s(e=>e+1);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,L.useEffect)(()=>{if(n)try{localStorage.setItem(e,JSON.stringify(n))}catch{}},[n,e]);let c=(0,L.useMemo)(()=>n?ec(n,t):null,[n,t,o]),l=(0,L.useRef)(null),u=(0,L.useRef)(!1),d=(0,L.useCallback)(e=>{if(i||e.button!==0&&e.pointerType===`mouse`)return;let t=e.currentTarget,n=t.getBoundingClientRect();l.current={pointerId:e.pointerId,startX:n.left,startY:n.top,downX:e.clientX,downY:e.clientY,moved:!1,size:n.width};try{t.setPointerCapture(e.pointerId)}catch{}},[i]),f=(0,L.useCallback)(e=>{let t=l.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.downX,i=e.clientY-t.downY;if(!t.moved){if(Math.abs(n)+Math.abs(i)<4)return;t.moved=!0}r(ec({x:t.startX+n,y:t.startY+i},t.size))},[]),p=(0,L.useCallback)(e=>{let t=l.current;if(!(!t||t.pointerId!==e.pointerId)){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}t.moved&&(u.current=!0),l.current=null}},[]),m=(0,L.useCallback)(()=>{let e=u.current;return u.current=!1,e},[]);return{position:c,isMobile:i,handlers:{onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p},consumeJustDragged:m}}var nc=380,rc=480,ic=12,ac=8;function oc(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(``),{messages:c,loading:l,sendMessage:u,clearMessages:d}=Zs(),f=(0,L.useRef)(null),p=(0,L.useRef)(null),m=(0,L.useRef)(null),h=(0,L.useRef)(null),{position:g,isMobile:_,handlers:v,consumeJustDragged:y}=tc(`fab:askClaude`),[b,x]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(e){r(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>a(!0))});let e=setTimeout(()=>f.current?.focus(),200);return()=>clearTimeout(e)}else if(a(!1),n){let e=setTimeout(()=>r(!1),250);return()=>clearTimeout(e)}},[e,n]),(0,L.useEffect)(()=>{h.current?.scrollIntoView({behavior:`smooth`})},[c,l]),(0,L.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e]),(0,L.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target;n&&(p.current&&p.current.contains(n)||t(!1))};return document.addEventListener(`pointerdown`,n),()=>document.removeEventListener(`pointerdown`,n)},[e]),(0,L.useLayoutEffect)(()=>{if(!e)return;if(_){x(null);return}let t=m.current?.getBoundingClientRect();if(!t)return;let n=t.left+t.width/2<window.innerWidth/2,r=t.top+t.height/2<window.innerHeight/2,i=n?t.right+ic:t.left-nc-ic,a=r?t.top:t.bottom-rc;i=Math.min(Math.max(ac,i),window.innerWidth-nc-ac),a=Math.min(Math.max(ac,a),window.innerHeight-rc-ac),x({x:i,y:a,origin:`${r?`top`:`bottom`} ${n?`left`:`right`}`})},[e,_,g]);let S=c.findIndex(e=>!e.isHistory),w=S>0,T=async e=>{e.preventDefault();let t=o.trim();!t||l||(s(``),await u(t),f.current?.focus())},E=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),T(e))},D={position:`fixed`,zIndex:e?1100:1e3,..._?{}:g?{left:g.x,top:g.y}:{bottom:24,right:24}},k={...b?{position:`fixed`,left:b.x,top:b.y}:{position:`absolute`,bottom:64,right:0},width:nc,height:rc,...O,boxShadow:`0 8px 32px rgba(0,0,0,0.5)`,display:`flex`,flexDirection:`column`,overflow:`hidden`,transformOrigin:b?.origin??`bottom right`,transition:`transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease`,transform:i?`scale(1) translateY(0)`:`scale(0.95) translateY(16px)`,opacity:+!!i};return(0,B.jsxs)(`div`,{ref:p,className:`dashboard-chat-fab`,style:D,children:[n&&(0,B.jsx)(`div`,{className:`dashboard-chat-backdrop`,onClick:()=>t(!1)}),n&&(0,B.jsxs)(`div`,{className:`dashboard-chat-panel`,style:k,children:[(0,B.jsxs)(`div`,{style:{padding:`14px 16px`,borderBottom:`1px solid #30363d`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexShrink:0,background:`rgba(22,27,34,0.6)`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`span`,{style:{width:24,height:24,borderRadius:6,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(188,140,255,0.12)`,color:`var(--color-primary)`},children:(0,B.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M12 2v4M12 18v4M2 12h4M18 12h4M5 5l2.5 2.5M16.5 16.5L19 19M5 19l2.5-2.5M16.5 7.5L19 5`}),(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]})}),(0,B.jsx)(`span`,{style:{color:C.text,fontSize:15,fontWeight:600,letterSpacing:`-0.01em`},children:`Ask Claude`})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[c.length>0&&(0,B.jsx)(`button`,{onClick:()=>{d()},style:{background:`none`,border:`none`,color:`var(--color-text-muted)`,cursor:`pointer`,fontSize:12,padding:`2px 6px`,borderRadius:4},title:`Clear conversation`,children:`Clear`}),(0,B.jsx)(`button`,{onClick:()=>t(!1),style:{background:`none`,border:`none`,color:`var(--color-text-muted)`,cursor:`pointer`,fontSize:18,lineHeight:1,padding:`0 4px`},children:`×`})]})]}),(0,B.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:`12px`,display:`flex`,flexDirection:`column`,gap:8},children:[c.length===0&&!l&&(0,B.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--color-text-muted)`,fontSize:13,textAlign:`center`,padding:`0 16px`,userSelect:`none`},children:`Ask me about your jobs, schedules, health alerts, or recent activity.`}),c.map((e,t)=>(0,B.jsxs)(L.Fragment,{children:[w&&t===S&&(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,margin:`4px 0`},children:[(0,B.jsx)(`div`,{style:{flex:1,height:1,background:`var(--color-border)`}}),(0,B.jsx)(`span`,{style:{color:`var(--color-border-strong)`,fontSize:11,whiteSpace:`nowrap`},children:`New session`}),(0,B.jsx)(`div`,{style:{flex:1,height:1,background:`var(--color-border)`}})]}),(0,B.jsx)(`div`,{style:{display:`flex`,justifyContent:e.role===`user`?`flex-end`:`flex-start`,opacity:e.isHistory?.55:1,transition:`opacity 0.15s`},children:(0,B.jsx)(`div`,{style:{maxWidth:`80%`,background:e.role===`user`?`#7c3aed`:`var(--color-hover)`,color:C.text,borderRadius:e.role===`user`?`12px 12px 2px 12px`:`12px 12px 12px 2px`,padding:`8px 12px`,fontSize:13,lineHeight:1.5,wordBreak:`break-word`},children:e.role===`assistant`?(0,B.jsx)(Ks,{components:{p:({children:e})=>(0,B.jsx)(`p`,{style:{margin:`4px 0`},children:e}),strong:({children:e})=>(0,B.jsx)(`strong`,{children:e}),code:({children:e})=>(0,B.jsx)(`code`,{style:{background:`var(--color-bg-raised)`,padding:`1px 5px`,borderRadius:3,fontSize:12},children:e}),ol:({children:e})=>(0,B.jsx)(`ol`,{style:{margin:`4px 0`,paddingLeft:20},children:e}),ul:({children:e})=>(0,B.jsx)(`ul`,{style:{margin:`4px 0`,paddingLeft:20},children:e}),li:({children:e})=>(0,B.jsx)(`li`,{style:{marginBottom:2},children:e}),h1:({children:e})=>(0,B.jsx)(`div`,{style:{fontSize:15,fontWeight:600,margin:`4px 0 2px`},children:e}),h2:({children:e})=>(0,B.jsx)(`div`,{style:{fontSize:14,fontWeight:600,margin:`4px 0 2px`},children:e}),h3:({children:e})=>(0,B.jsx)(`div`,{style:{fontSize:13,fontWeight:600,margin:`4px 0 2px`},children:e})},children:e.content}):e.content})})]},t)),l&&(0,B.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-start`},children:(0,B.jsx)(`div`,{style:{background:C.hover,borderRadius:`12px 12px 12px 2px`,padding:`8px 12px`,fontSize:13,color:`var(--color-text-muted)`},children:`Thinking...`})}),(0,B.jsx)(`div`,{ref:h})]}),(0,B.jsx)(`form`,{onSubmit:T,className:`tw-composer`,style:{display:`flex`,flexDirection:`column`,gap:6,padding:`10px 12px`,borderTop:`1px solid #30363d`,flexShrink:0},children:(0,B.jsxs)(`div`,{className:`tw-composer-row`,style:{display:`flex`,gap:8,alignItems:`flex-end`},children:[(0,B.jsx)(`input`,{ref:f,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:E,placeholder:`Ask Claude…`,disabled:l,className:`chat-input-textarea tw-composer-input`,style:{flex:1,background:`var(--color-bg)`,border:`1px solid #30363d`,borderRadius:20,outline:`none`,color:C.text,fontSize:14,padding:`10px 14px`,opacity:l?.6:1}}),(0,B.jsx)(`button`,{type:`submit`,disabled:!o.trim()||l,className:`tw-composer-btn`,"aria-label":`Send`,title:`Send`,style:{width:40,height:40,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid rgba(188,140,255,0.45)`,background:!o.trim()||l?`rgba(188,140,255,0.08)`:`rgba(188,140,255,0.18)`,color:`var(--color-primary)`,cursor:!o.trim()||l?`not-allowed`:`pointer`,opacity:!o.trim()||l?.5:1,transition:`background 150ms ease, transform 150ms ease`,flexShrink:0},children:(0,B.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M3.5 12L20.5 3.75 14.5 20.5l-3-7.25-8-1.25z`}),(0,B.jsx)(`path`,{d:`M11.5 13.25L14.5 10.25`})]})})]})})]}),(0,B.jsx)(`button`,{ref:m,onClick:()=>{y()||t(e=>!e)},onPointerDown:v.onPointerDown,onPointerMove:v.onPointerMove,onPointerUp:v.onPointerUp,onPointerCancel:v.onPointerCancel,style:{width:52,height:52,borderRadius:`50%`,background:e?`var(--color-border)`:`#7c3aed`,border:`none`,cursor:_?`pointer`:`grab`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:e?`0 2px 8px rgba(0,0,0,0.3)`:`0 4px 16px rgba(0,0,0,0.4)`,transition:`background 0.3s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s`,transform:e?`rotate(45deg) scale(0.9)`:`rotate(0deg) scale(1)`,position:`relative`,touchAction:`none`},onMouseEnter:t=>{e||(t.currentTarget.style.transform=`scale(1.1)`)},onMouseLeave:t=>{t.currentTarget.style.transform=e?`rotate(45deg) scale(0.9)`:`scale(1)`},title:`Ask Claude (drag to move)`,children:e?(0,B.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`white`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,B.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})}):(0,B.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`white`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,B.jsx)(`path`,{d:`M10 2C10 8 8 10 2 10C8 10 10 12 10 18C10 12 12 10 18 10C12 10 10 8 10 2Z`}),(0,B.jsx)(`path`,{d:`M19 12C19 15 18 16 15 16C18 16 19 17 19 20C19 17 20 16 23 16C20 16 19 15 19 12Z`})]})})]})}function sc({message:e,onDone:t}){let[n,r]=(0,L.useState)(!1),i=(0,L.useRef)(t);return i.current=t,(0,L.useEffect)(()=>{r(!1);let e=setTimeout(()=>r(!0),2500),t=setTimeout(()=>i.current(),3e3);return()=>{clearTimeout(e),clearTimeout(t)}},[e]),(0,B.jsx)(`div`,{style:{position:`fixed`,bottom:24,right:24,padding:`12px 20px`,background:`var(--color-bg-raised)`,border:`1px solid #30363d`,borderRadius:8,fontSize:13,zIndex:200,animation:n?`toastOut 0.5s ease-in forwards`:`toastIn 0.3s ease-out`},children:e})}var cc={badge:`_badge_13jn8_1`,dot:`_dot_13jn8_13`,pulse:`_pulse_13jn8_1`,statusSuccess:`_statusSuccess_13jn8_22`,statusFailed:`_statusFailed_13jn8_23`,statusDegraded:`_statusDegraded_13jn8_24`,statusRunning:`_statusRunning_13jn8_25`,statusQueued:`_statusQueued_13jn8_27`,statusTimeout:`_statusTimeout_13jn8_28`,statusCancelled:`_statusCancelled_13jn8_29`,statusSkipped:`_statusSkipped_13jn8_30`,statusRetrying:`_statusRetrying_13jn8_31`,statusNever:`_statusNever_13jn8_32`},lc={success:cc.statusSuccess,failed:cc.statusFailed,degraded:cc.statusDegraded,running:cc.statusRunning,retrying:cc.statusRetrying,queued:cc.statusQueued,timeout:cc.statusTimeout,cancelled:cc.statusCancelled,skipped:cc.statusSkipped,never:cc.statusNever};function uc({status:e}){let t=e||`never run`,n=lc[e||`never`]??cc.statusNever,r=e===`running`;return(0,B.jsxs)(`span`,{className:[cc.badge,n,r?`badge-running`:null].filter(Boolean).join(` `),children:[r&&(0,B.jsx)(`span`,{className:cc.dot}),t]})}function dc(e){fetch(`/api/feed/read`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({keys:e})}).catch(()=>{})}function fc(e){fetch(`/api/feed/read`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({keys:`all`,feedKeys:e})}).catch(()=>{})}function pc(e){fetch(`/api/feed/cleared`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({keys:e})}).catch(()=>{})}function mc(e){fetch(`/api/feed/cleared`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({keys:`all`,feedKeys:e})}).catch(()=>{})}function hc(e){fetch(`/api/feed/cleared`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({keys:e})}).catch(()=>{})}function gc({feed:e,open:t,onClose:n,onSelectJob:r,onUnreadCountChange:i}){let[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(new Set),[l,u]=(0,L.useState)(new Set),d=(0,L.useRef)(!1);(0,L.useEffect)(()=>{Promise.all([fetch(`/api/feed/read`).then(e=>e.json()).catch(()=>[]),fetch(`/api/feed/cleared`).then(e=>e.json()).catch(()=>[])]).then(([e,t])=>{Array.isArray(e)&&c(new Set(e)),Array.isArray(t)&&u(new Set(t)),d.current=!0}).catch(()=>{d.current=!0})},[]);let[f,p]=(0,L.useState)(!1),m=e=>`${e.jobId}-${e.timestamp}`,h=e.filter(e=>!l.has(m(e))),_=e.filter(e=>l.has(m(e))),v=h.filter(e=>!s.has(m(e))).length;(0,L.useEffect)(()=>{i?.(v)},[v,i]);let y=e=>{c(t=>new Set(t).add(e)),dc([e])},b=e=>{let t=s.has(e);c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),t?fetch(`/api/feed/read`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({keys:[e]})}).catch(()=>{}):dc([e])},x=()=>{let e=h.map(m);c(new Set(e)),fc(e)},S=()=>{let t=e.map(m);u(new Set(t)),o(null),mc(t)},w=e=>{u(t=>new Set(t).add(e)),pc([e])},T=e=>{u(t=>{let n=new Set(t);return n.delete(e),n}),hc([e])},E=()=>{let e=[...l];u(new Set),hc(e)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:n,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.5)`,zIndex:999,opacity:+!!t,pointerEvents:t?`auto`:`none`,transition:`opacity 0.2s ease`}}),(0,B.jsxs)(`div`,{className:`activity-feed-drawer`,style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:420,maxWidth:`90vw`,background:`var(--color-bg)`,borderLeft:`1px solid ${C.border}`,zIndex:1e3,transform:t?`translateX(0)`:`translateX(100%)`,transition:`transform 0.25s ease`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{padding:`16px 20px 12px`,borderBottom:`1px solid ${C.border}`,flexShrink:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`div`,{style:{...k,fontWeight:600,letterSpacing:.8,margin:0},children:`Activity Feed`}),v>0&&(0,B.jsxs)(`span`,{style:{background:C.green,color:`var(--color-bg)`,fontSize:10,fontWeight:700,lineHeight:1,padding:`2px 6px`,borderRadius:8},children:[v,` new`]})]}),(0,B.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,color:C.muted,fontSize:18,cursor:`pointer`,padding:`4px 8px`,lineHeight:1},"aria-label":`Close activity feed`,children:`✕`})]}),h.length>0&&(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(`button`,{onClick:x,disabled:v===0,style:{background:`none`,border:`1px solid ${C.border}`,borderRadius:6,color:v===0?C.border:C.blue,fontSize:11,padding:`4px 10px`,cursor:v===0?`default`:`pointer`,opacity:v===0?.5:1},children:`✓ Mark all read`}),(0,B.jsx)(`button`,{onClick:S,style:{background:`none`,border:`1px solid ${C.border}`,borderRadius:6,color:C.muted,fontSize:11,padding:`4px 10px`,cursor:`pointer`},children:`✕ Clear all`})]})]}),(0,B.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:`16px 20px`},children:[h.length===0?(0,B.jsxs)(`div`,{style:{padding:`48px 20px`,textAlign:`center`},children:[(0,B.jsx)(`div`,{style:{fontSize:40,marginBottom:12,opacity:.6},children:e.length===0?`⏳`:`✨`}),(0,B.jsx)(`div`,{style:{color:C.text,fontSize:15,fontWeight:500,marginBottom:6},children:e.length===0?`Nothing yet`:`All caught up!`}),(0,B.jsx)(`div`,{style:{color:C.muted,fontSize:13},children:e.length===0?`Your agents haven’t run in the last 24 hours. Jobs will appear here after their next scheduled run.`:`You’ve reviewed everything. New activity will appear as your agents complete their runs.`})]}):(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:h.map((e,t)=>{let i=m(e),c=s.has(i),l=a===t,u=e.summary.length>0,d=e.actionItems.length>0;return(0,B.jsxs)(`div`,{className:`feed-card-enter`,style:{background:c?C.darkBg:C.cardBg,border:`1px solid ${c?C.border:C.blue+`44`}`,borderRadius:8,padding:`12px 16px`,animationDelay:`${t*.04}s`,opacity:c?.7:1,transition:`opacity 0.2s, border-color 0.2s, background 0.2s`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:u||d?8:0},children:[(0,B.jsx)(`button`,{onClick:()=>{r(e.jobId),n()},style:{background:`none`,border:`none`,padding:0,color:C.blue,fontSize:13,fontWeight:500,fontFamily:g,cursor:`pointer`,textDecoration:`none`},onMouseEnter:e=>{e.currentTarget.style.textDecoration=`underline`},onMouseLeave:e=>{e.currentTarget.style.textDecoration=`none`},children:e.jobName}),(0,B.jsx)(uc,{status:e.status}),e.durationSeconds>0&&(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,fontFamily:`var(--font-mono)`},children:ze(e.durationSeconds)}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,marginLeft:`auto`,whiteSpace:`nowrap`},children:Be(e.timestamp)})]}),u&&(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>{o(l?null:t),c||y(i)},style:{background:`none`,border:`none`,padding:0,color:C.muted,fontSize:12,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(`span`,{style:{display:`inline-block`,transition:`transform 0.15s`,transform:l?`rotate(90deg)`:`rotate(0deg)`},children:`▸`}),l?`Hide summary`:`Show summary`]}),l&&(0,B.jsx)(`pre`,{style:{marginTop:8,padding:`10px 12px`,background:`var(--color-bg-raised)`,border:`1px solid ${C.border}`,borderRadius:6,fontSize:12,fontFamily:`var(--font-mono)`,color:C.text,whiteSpace:`pre-wrap`,wordBreak:`break-word`,maxHeight:200,overflowY:`auto`,lineHeight:1.5},children:e.summary})]}),d&&l&&(0,B.jsxs)(`div`,{style:{marginTop:8},children:[(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,fontWeight:600,marginBottom:4},children:`Action Items`}),(0,B.jsx)(`ul`,{style:{margin:0,paddingLeft:18,fontSize:12,color:C.text,lineHeight:1.6},children:e.actionItems.map((e,t)=>(0,B.jsx)(`li`,{children:e},t))})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:12,marginTop:8,borderTop:`1px solid ${C.border}`,paddingTop:8},children:[(0,B.jsx)(`button`,{onClick:()=>b(i),style:{background:`none`,border:`none`,padding:0,color:c?C.warning:C.green,fontSize:11,cursor:`pointer`},children:c?`○ Mark unread`:`✓ Mark read`}),(0,B.jsx)(`button`,{onClick:()=>w(i),style:{background:`none`,border:`none`,padding:0,color:C.red,fontSize:11,cursor:`pointer`},children:`✕ Dismiss`})]})]},i)})}),_.length>0&&(0,B.jsxs)(`div`,{style:{marginTop:24},children:[(0,B.jsxs)(`button`,{onClick:()=>p(e=>!e),style:{background:`none`,border:`none`,padding:0,color:C.muted,fontSize:12,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:6,marginBottom:8},children:[(0,B.jsx)(`span`,{style:{display:`inline-block`,transition:`transform 0.15s`,transform:f?`rotate(90deg)`:`rotate(0deg)`},children:`▸`}),(0,B.jsxs)(`span`,{style:{...k,margin:0,fontSize:11},children:[`Cleared (`,_.length,`)`]})]}),f&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{style:{marginBottom:8},children:(0,B.jsx)(`button`,{onClick:E,style:{background:`none`,border:`1px solid ${C.border}`,borderRadius:6,color:C.muted,fontSize:11,padding:`4px 10px`,cursor:`pointer`},children:`Restore all`})}),(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:_.map(e=>{let t=m(e);return(0,B.jsxs)(`div`,{style:{background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:8,padding:`10px 14px`,opacity:.5,transition:`opacity 0.2s`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:13,fontFamily:`var(--font-mono)`},children:e.jobName}),(0,B.jsx)(uc,{status:e.status}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,marginLeft:`auto`,whiteSpace:`nowrap`},children:Be(e.timestamp)})]}),(0,B.jsx)(`div`,{style:{marginTop:6,borderTop:`1px solid ${C.border}`,paddingTop:6},children:(0,B.jsx)(`button`,{onClick:()=>T(t),style:{background:`none`,border:`none`,padding:0,color:C.blue,fontSize:11,cursor:`pointer`},children:`Restore`})})]},t)})})]})]})]})]})]})}function _c({size:e=14,color:t=`currentColor`}){return(0,B.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:t,children:(0,B.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z`})})}function vc({size:e=14,color:t=`currentColor`}){return(0,B.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:t,children:(0,B.jsx)(`path`,{d:`M3.3 1.5c.5.4.7.4 1.6.3l7.4-.4c.2 0 0-.2 0-.2L11.6.5c-.3-.2-.6-.4-1.2-.4L3.6.5c-.5.1-.6.3-.4.5l.1.5zM4 3.6v8c0 .4.2.6.7.5l8-.5c.4 0 .5-.3.5-.6V3.1c0-.4-.1-.5-.4-.5l-8.4.5c-.3 0-.4.2-.4.5zm7.9.3c0 .2-.1.3-.3.3l-.4.1v5.9c-.3.2-.6.3-.8.3-.4 0-.5-.1-.8-.5L7.1 6.1v3.7l.8.2s0 .3-.4.3l-1.2.1c0-.2 0-.5.3-.5l.3-.1V5.2l-.4 0c0-.2.1-.5.5-.5l1.3-.1 2.6 4V5.5l-.7-.1c0-.3.2-.4.5-.4l1.2-.1zM2.2 0.7L9.8 0c.7-.1 1 0 1.3.2l1.9 1.3c.3.2.4.4.4.7v9.4c0 .5-.2.8-.8.9l-8.5.5c-.5 0-.7-.1-.9-.3l-1.4-1.8c-.2-.3-.3-.5-.3-.9V1.5c0-.4.2-.7.7-.8z`})})}function yc({size:e=14,color:t=`currentColor`}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,children:[(0,B.jsx)(`path`,{d:`M3.34 10.1a1.3 1.3 0 11-1.3-1.3h1.3v1.3zm.66 0a1.3 1.3 0 112.6 0v3.26a1.3 1.3 0 11-2.6 0V10.1z`,fill:t===`currentColor`?`#E01E5A`:t}),(0,B.jsx)(`path`,{d:`M5.9 3.34a1.3 1.3 0 111.3-1.3v1.3H5.9zm0 .66a1.3 1.3 0 110 2.6H2.64a1.3 1.3 0 010-2.6H5.9z`,fill:t===`currentColor`?`#36C5F0`:t}),(0,B.jsx)(`path`,{d:`M12.66 5.9a1.3 1.3 0 111.3 1.3h-1.3V5.9zm-.66 0a1.3 1.3 0 11-2.6 0V2.64a1.3 1.3 0 112.6 0V5.9z`,fill:t===`currentColor`?`#2EB67D`:t}),(0,B.jsx)(`path`,{d:`M10.1 12.66a1.3 1.3 0 11-1.3 1.3v-1.3h1.3zm0-.66a1.3 1.3 0 110-2.6h3.26a1.3 1.3 0 110 2.6H10.1z`,fill:t===`currentColor`?`#ECB22E`:t})]})}function bc({size:e=14,color:t=`currentColor`}){return(0,B.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:t,children:(0,B.jsx)(`path`,{d:`M.34 9.24a.2.2 0 01-.04-.24 7.97 7.97 0 013.86-3.86.2.2 0 01.24.04l5.42 5.42a.2.2 0 01.04.24 7.97 7.97 0 01-3.86 3.86.2.2 0 01-.24-.04L.34 9.24zM7.98.02a.2.2 0 01.2.04l7.76 7.76a.2.2 0 01-.1.33 8 8 0 01-5.32-.42.2.2 0 01-.08-.05L5.31 2.56a.2.2 0 01-.05-.08A8 8 0 014.84.16a.2.2 0 01.33-.1L7.98.02zM3.06 3.06a.2.2 0 01.32-.02l9.58 9.58a.2.2 0 01-.02.32 8.03 8.03 0 01-1.84 1.16.2.2 0 01-.24-.04L1.94 5.14a.2.2 0 01-.04-.24c.3-.67.7-1.28 1.16-1.84z`})})}function xc({size:e=14,color:t=`currentColor`}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,stroke:t,strokeWidth:`1.2`,strokeLinecap:`round`,children:[(0,B.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`}),(0,B.jsx)(`path`,{d:`M1.5 8h13M8 1.5c-2 2.5-2 9.5 0 13M8 1.5c2 2.5 2 9.5 0 13`})]})}var Sc={github:_c,notion:vc,slack:yc,linear:bc,other:xc};function Cc({link:e}){let[t,n]=(0,L.useState)(!1),r=E[e.type]||E.other,i=Sc[e.type]||Sc.other;return(0,B.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{display:`inline-flex`,alignItems:`center`,gap:5,padding:`4px 10px`,borderRadius:6,background:t?`rgba(255,255,255,0.07)`:`var(--color-subtle-bg)`,border:`1px solid ${t?r:C.border}`,fontSize:12,color:t?C.text:C.textSecondary,textDecoration:`none`,transition:`all 0.2s ease`,cursor:`pointer`},children:[(0,B.jsx)(i,{size:13,color:r}),(0,B.jsx)(`span`,{style:{lineHeight:1.3},children:e.title})]})}var wc={color:`var(--color-info)`,textDecoration:`none`,transition:`opacity 0.15s`};function Tc(e,t,n){return(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,style:wc,onMouseEnter:e=>{e.currentTarget.style.textDecoration=`underline`},onMouseLeave:e=>{e.currentTarget.style.textDecoration=`none`},children:t},n)}function Ec(e){let t=new Map;for(let n of e)if(n.type===`github`)try{let e=new URL(n.url);if(!e.hostname.includes(`github.com`))continue;let r=e.pathname.split(`/`).filter(Boolean);if(r.length>=2){let e=r[0],n=r[1];t.set(n.toLowerCase(),`${e}/${n}`)}}catch{}return t}function Dc(e,t){let n=/(https?:\/\/[^\s)<>"]+)|([A-Z]{2,}-\d+)|([\w-]+(?:\/[\w-]+)?)\s*#(\d+)/g,r=[];for(let i of e.matchAll(n)){let e=i.index,n=i[0];if(i[1]){let t=i[1].replace(/[.,;:!?)]+$/,``),n=t;try{let e=new URL(t);if(e.hostname.includes(`github.com`)){let t=e.pathname.split(`/`).filter(Boolean);t.length>=4&&(t[2]===`pull`||t[2]===`issues`)?n=`${t[0]}/${t[1]}#${t[3]}`:t.length>=2&&(n=`${t[0]}/${t[1]}`)}else if(e.hostname.includes(`notion.so`))n=`Notion page`;else if(e.hostname.includes(`linear.app`)){let t=e.pathname.match(/([A-Z]+-\d+)/);n=t?t[1]:`Linear issue`}else e.hostname.includes(`slack.com`)&&(n=`Slack message`)}catch{}r.push({index:e,length:t.length,node:Tc(t,n,e)})}else if(i[2]){let t=i[2];r.push({index:e,length:n.length,node:Tc(`https://linear.app/issue/${t}`,t,e)})}else if(i[3]&&i[4]){let a=i[3],o=i[4];if(a.includes(`/`))r.push({index:e,length:n.length,node:Tc(`https://github.com/${a}/issues/${o}`,`${a}#${o}`,e)});else{let i=t?.get(a.toLowerCase());i?r.push({index:e,length:n.length,node:Tc(`https://github.com/${i}/issues/${o}`,`${i}#${o}`,e)}):r.push({index:e,length:n.length,node:Tc(`https://github.com/search?q=${encodeURIComponent(a)}+%23${o}&type=issues`,`${a}#${o}`,e)})}}}let i=0,a=[];for(let t of r)t.index>i&&a.push(e.slice(i,t.index)),a.push(t.node),i=t.index+t.length;return i<e.length&&a.push(e.slice(i)),a.length>0?a:[e]}function Oc({isOpen:e,children:t}){let n=(0,L.useRef)(null),[r,i]=(0,L.useState)(0);return(0,L.useLayoutEffect)(()=>{let t=n.current;if(t)if(e){i(t.scrollHeight);let e=setTimeout(()=>i(`auto`),200);return()=>clearTimeout(e)}else i(t.scrollHeight),requestAnimationFrame(()=>i(0))},[e]),(0,B.jsx)(`div`,{style:{height:typeof r==`number`?r:`auto`,overflow:`hidden`,transition:`height 0.2s ease`},children:(0,B.jsx)(`div`,{ref:n,children:t})})}var kc={"mcp-auth":`🔑`,"consecutive-failures":`⚠️`,"stale-job":`⏰`,"job-degraded":`🟡`,"job-auto-paused":`⏸️`};function Ac(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function jc({alert:e,dismissed:t,onDismiss:n}){let[r,i]=(0,L.useState)(!1);if(t)return null;let a=e.severity===`critical`,o=a?C.red:C.warning,s=a?`rgba(248,81,73,0.06)`:`rgba(210,153,34,0.06)`,c=a?`rgba(248,81,73,0.12)`:`rgba(210,153,34,0.12)`,l=kc[e.type]||`⚠️`;return(0,B.jsxs)(`div`,{onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`10px 12px`,borderRadius:8,background:r?c:s,border:`1px solid ${o}33`,marginBottom:8,transition:`background 0.15s`,minHeight:44},children:[(0,B.jsx)(`span`,{style:{fontSize:15,flexShrink:0,marginTop:1},children:l}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,B.jsx)(`div`,{style:{fontSize:13,color:C.text,fontWeight:500,lineHeight:1.4},children:e.message}),e.detail&&(0,B.jsx)(`div`,{style:{fontSize:12,color:C.text,marginTop:4,opacity:.85,lineHeight:1.4},children:e.detail}),(0,B.jsxs)(`div`,{style:{fontSize:11,color:C.muted,marginTop:4},children:[e.jobName,` · `,Ac(e.detectedAt)]})]}),(0,B.jsx)(`button`,{onClick:()=>n(e.id),style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:13,padding:`4px 8px`,lineHeight:1,opacity:r?.9:.5,flexShrink:0,transition:`opacity 0.15s`},"aria-label":`Dismiss alert`,title:`Dismiss`,children:`✕`})]})}var Mc=[{label:`2h`,hours:2},{label:`4h`,hours:4},{label:`8h`,hours:8},{label:`24h`,hours:24},{label:`3d`,hours:72},{label:`7d`,hours:168},{label:`14d`,hours:336},{label:`30d`,hours:720}];function Nc(e){return`${e.source}:${e.text.slice(0,50)}`}var Pc=[`github`,`notion`,`slack`,`linear`,`other`],Fc={github:`GitHub`,notion:`Notion`,slack:`Slack`,linear:`Linear`,other:`Other`};function Ic({item:e,dismissed:t,onToggle:n,repoMap:r}){let[i,a]=(0,L.useState)(!1);return(0,B.jsxs)(`div`,{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`6px 8px`,borderRadius:6,background:i?`rgba(255,255,255,0.03)`:`transparent`,transition:`background 0.15s`},children:[(0,B.jsx)(`button`,{onClick:n,style:{width:18,height:18,borderRadius:4,flexShrink:0,marginTop:1,border:t?`1px solid ${C.green}`:`1px solid ${C.border}`,background:t?`var(--color-positive-soft)`:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:C.green,fontSize:11},title:t?`Mark undone`:`Dismiss`,children:t?`✓`:``}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,B.jsx)(`span`,{style:{fontSize:13,color:t?C.muted:C.textSecondary,textDecoration:t?`line-through`:`none`,transition:`all 0.2s`},children:Dc(e.text,r)}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,marginLeft:8},children:e.sourceName})]})]})}function Lc({alerts:e,activeItemsCount:t,archivedItemsCount:n,uniqueLinksCount:r}){return(0,B.jsxs)(`div`,{style:{fontSize:13,color:C.textSecondary,marginBottom:20,lineHeight:1.5,padding:`10px 12px`,background:`var(--color-subtle-bg)`,borderRadius:8,border:`1px solid ${C.border}`,display:`flex`,gap:16,flexWrap:`wrap`},children:[e.length>0&&(0,B.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:e.some(e=>e.severity===`critical`)?C.red:C.warning,flexShrink:0}}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{style:{color:C.text},children:e.length}),` alert`,e.length===1?``:`s`]})]}),t>0&&(0,B.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:C.blue,flexShrink:0}}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{style:{color:C.text},children:t}),` open`]})]}),n>0&&(0,B.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:C.green,flexShrink:0}}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{style:{color:C.text},children:n}),` archived`]})]}),r>0&&(0,B.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`var(--color-primary)`,flexShrink:0}}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{style:{color:C.text},children:r}),` links`]})]}),e.length===0&&t===0&&n===0&&r===0&&(0,B.jsx)(`span`,{style:{color:C.muted},children:`No pending items or links.`})]})}function Rc({alerts:e,archived:t,onDismiss:n}){return e.length===0?null:(0,B.jsxs)(`div`,{style:{marginBottom:20},children:[(0,B.jsxs)(`div`,{style:{...k,marginBottom:8,display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{children:`Alerts`}),(0,B.jsxs)(`span`,{style:{fontSize:11,color:e.some(e=>e.severity===`critical`)?C.red:C.warning},children:[`(`,e.length,`)`]})]}),e.map(e=>(0,B.jsx)(jc,{alert:e,dismissed:t.has(e.id),onDismiss:n},e.id))]})}function zc({activeItems:e,pendingItemsCount:t,localDismissed:n,repoMap:r,onToggle:i,onArchiveSelected:a,onArchiveAll:o}){return e.length===0?null:(0,B.jsxs)(`div`,{style:{marginBottom:20},children:[(0,B.jsxs)(`div`,{style:{...k,marginBottom:8,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsxs)(`span`,{children:[`Priority Actions`,t>0&&(0,B.jsxs)(`span`,{style:{marginLeft:6,color:C.blue},children:[`(`,t,`)`]})]}),(0,B.jsxs)(`span`,{style:{display:`flex`,gap:6},children:[n.size>0&&(0,B.jsxs)(`button`,{onClick:a,style:{background:`none`,border:`1px solid ${C.green}`,borderRadius:4,color:C.green,fontSize:11,padding:`2px 8px`,cursor:`pointer`,fontWeight:500},children:[`Archive `,n.size,` selected`]}),(0,B.jsx)(`button`,{onClick:o,style:{background:`none`,border:`1px solid ${C.border}`,borderRadius:4,color:C.muted,fontSize:11,padding:`2px 8px`,cursor:`pointer`,fontWeight:500},children:`Archive all`})]})]}),(0,B.jsx)(`div`,{children:e.map(e=>{let t=Nc(e);return(0,B.jsx)(Ic,{item:e,dismissed:n.has(t),onToggle:e=>i(t,e),repoMap:r},t)})})]})}function Bc({archivedItems:e,showArchived:t,onToggleShow:n,onUnarchive:r}){return e.length===0?null:(0,B.jsxs)(`div`,{style:{marginBottom:20},children:[(0,B.jsxs)(`button`,{onClick:n,style:{background:`none`,border:`none`,padding:0,color:C.muted,fontSize:11,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:4,textTransform:`uppercase`,letterSpacing:.5,fontWeight:600},children:[(0,B.jsx)(`span`,{style:{display:`inline-block`,transition:`transform 0.15s`,transform:t?`rotate(90deg)`:`rotate(0deg)`},children:`▸`}),`Archived (`,e.length,`)`]}),t&&(0,B.jsx)(`div`,{style:{marginTop:8},children:e.map(e=>{let t=Nc(e);return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`4px 8px`,borderRadius:6},children:[(0,B.jsx)(`span`,{style:{color:C.green,fontSize:11,flexShrink:0},children:`✓`}),(0,B.jsx)(`span`,{style:{flex:1,fontSize:13,color:C.muted,textDecoration:`line-through`},children:e.text}),(0,B.jsx)(`button`,{onClick:()=>r(t),style:{background:`none`,border:`none`,padding:0,color:C.muted,fontSize:10,cursor:`pointer`},title:`Restore`,children:`↩`})]},t)})})]})}function Vc({uniqueLinks:e,uniqueLinksByType:t,expandedLinkTypes:n,onToggleExpanded:r,linkMaxAge:i,onLinkMaxAgeChange:a}){return e.length===0?null:(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:12},children:[(0,B.jsx)(`div`,{style:k,children:`Quick Links`}),(0,B.jsx)(`select`,{value:i,onChange:e=>a(Number(e.target.value)),style:{fontSize:11,padding:`2px 6px`,borderRadius:4,border:`1px solid ${C.border}`,background:C.darkBg,color:C.muted,cursor:`pointer`,outline:`none`},children:Mc.map(e=>(0,B.jsx)(`option`,{value:e.hours,children:e.label},e.hours))})]}),Pc.filter(e=>t[e]?.length).map(e=>{let i=n.has(e),a=t[e],o=Sc[e]||Sc.other,s=E[e]||E.other;return(0,B.jsxs)(`div`,{style:{marginBottom:4},children:[(0,B.jsxs)(`button`,{onClick:()=>r(e),style:{width:`100%`,background:`none`,border:`none`,padding:`6px 8px`,borderRadius:6,color:i?C.text:C.muted,fontSize:12,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:8,fontWeight:500,transition:`all 0.15s ease`,letterSpacing:.2},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.03)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,B.jsx)(`span`,{style:{display:`inline-flex`,transition:`transform 0.2s ease`,transform:i?`rotate(90deg)`:`rotate(0deg)`,color:C.muted,fontSize:10},children:`▸`}),(0,B.jsx)(`span`,{style:{display:`inline-flex`,opacity:.9},children:(0,B.jsx)(o,{size:15,color:s})}),(0,B.jsx)(`span`,{children:Fc[e]}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,fontWeight:400,marginLeft:-2},children:a.length})]}),(0,B.jsx)(Oc,{isOpen:i,children:(0,B.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,padding:`4px 8px 8px 30px`},children:a.map((e,t)=>(0,B.jsx)(Cc,{link:e},`${e.url}-${t}`))})})]},e)})]})}function Hc({data:e,loading:t,open:n,onClose:r,onRefresh:i,onActiveCountChange:a,dismissedKeys:o,onDismiss:s}){let c=new Set(o),[l,u]=(0,L.useState)(()=>new Set),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(()=>new Set),[h,g]=(0,L.useState)(24),_=(0,L.useRef)(n),v=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(_.current&&!n){for(let e of l)s(e);u(new Set),f(!1),v.current=null}_.current=n},[n,l,s]);let y=(e?.alerts??[]).filter(e=>!c.has(e.id)),b=e?.actionItems.filter(e=>!c.has(Nc(e)))??[],x=b.map(Nc),S=(0,L.useCallback)((e,t)=>{let n=x.indexOf(e);if(t.shiftKey&&v.current!==null){let t=x.indexOf(v.current);if(t!==-1&&n!==-1){let r=Math.min(t,n),i=Math.max(t,n);u(e=>{let t=new Set(e);for(let e=r;e<=i;e++)t.add(x[e]);return t}),v.current=e;return}}v.current=e,u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[x]),w=(0,L.useCallback)(()=>{for(let e of l)s(e);u(new Set),v.current=null},[l,s]),T=(0,L.useCallback)(()=>{for(let e of x)s(e);u(new Set),v.current=null},[x,s]),E=(0,L.useCallback)(e=>{i()},[i]),D=e?.actionItems.filter(e=>c.has(Nc(e)))??[];(0,L.useEffect)(()=>{a?.(b.length+y.length)},[b.length,y.length,a]);let O=b.filter(e=>!l.has(Nc(e))),k=e=>e.replace(/#.*$/,``).replace(/\/+$/,``),A=[],j=new Set;if(e)for(let t of e.links){let e=k(t.url);j.has(e)||(j.add(e),A.push(t))}let M=Ec(A),N={};for(let e of A)N[e.type]||(N[e.type]=[]),N[e.type].push(e);let ee=(0,L.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),P=(0,L.useCallback)(e=>{g(e),i(e)},[i]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:r,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.5)`,zIndex:999,opacity:+!!n,pointerEvents:n?`auto`:`none`,transition:`opacity 0.2s ease`}}),(0,B.jsxs)(`div`,{className:`focus-mode-drawer`,style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:420,maxWidth:`90vw`,background:`var(--color-bg)`,borderLeft:`1px solid ${C.border}`,zIndex:1e3,transform:n?`translateX(0)`:`translateX(100%)`,transition:`transform 0.25s ease`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`14px 20px`,borderBottom:`1px solid ${C.border}`,flexShrink:0,background:`rgba(255,255,255,0.01)`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,B.jsx)(`span`,{style:{fontSize:16,opacity:.7},children:`☆`}),(0,B.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:C.text,letterSpacing:.3},children:`Focus`}),(0,B.jsx)(`button`,{onClick:()=>i(),disabled:t,"aria-label":`Refresh focus data`,title:t?`Loading…`:`Refresh focus data`,style:{background:`none`,border:`1px solid ${C.border}`,borderRadius:4,color:C.muted,fontSize:13,padding:`2px 7px`,cursor:t?`default`:`pointer`,opacity:t?.4:.7,transition:`opacity 0.15s`,lineHeight:1.4,fontFamily:`inherit`},onMouseEnter:e=>{t||(e.currentTarget.style.opacity=`1`)},onMouseLeave:e=>{e.currentTarget.style.opacity=t?`0.4`:`0.7`},children:t?`…`:`↻`})]}),(0,B.jsx)(`button`,{onClick:r,style:{background:`none`,border:`none`,color:C.muted,fontSize:16,cursor:`pointer`,padding:`4px 8px`,lineHeight:1,opacity:.7,transition:`opacity 0.15s`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.7`},"aria-label":`Close focus panel`,children:`✕`})]}),(0,B.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`16px 20px`},children:t&&!e?(0,B.jsx)(`div`,{style:{color:C.muted,fontSize:13,padding:`40px 0`,textAlign:`center`},children:`Loading focus data...`}):e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Lc,{alerts:y,activeItemsCount:b.length,archivedItemsCount:D.length,uniqueLinksCount:A.length}),(0,B.jsx)(Rc,{alerts:y,archived:c,onDismiss:s}),(0,B.jsx)(zc,{activeItems:b,pendingItemsCount:O.length,localDismissed:l,repoMap:M,onToggle:S,onArchiveSelected:w,onArchiveAll:T}),(0,B.jsx)(Bc,{archivedItems:D,showArchived:d,onToggleShow:()=>f(e=>!e),onUnarchive:E}),(0,B.jsx)(Vc,{uniqueLinks:A,uniqueLinksByType:N,expandedLinkTypes:p,onToggleExpanded:ee,linkMaxAge:h,onLinkMaxAgeChange:P}),y.length===0&&b.length===0&&A.length===0&&D.length===0&&(0,B.jsx)(`div`,{style:{color:C.muted,fontSize:13,textAlign:`center`,padding:`8px 0`},children:`No pending items or links from recent job runs.`})]}):(0,B.jsx)(`div`,{style:{color:C.muted,fontSize:13,padding:`40px 0`,textAlign:`center`},children:`No focus data available`})})]})]})}function Uc({title:e,description:t,children:n}){return(0,B.jsxs)(`div`,{style:{marginBottom:28},children:[(0,B.jsx)(`div`,{style:{fontSize:11,fontWeight:600,color:C.muted,textTransform:`uppercase`,letterSpacing:.5,marginBottom:t?4:12},children:e}),t&&(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,marginBottom:12,lineHeight:1.5},children:t}),n]})}var Wc=[{value:0,label:`Sunday`,short:`Sun`},{value:1,label:`Monday`,short:`Mon`},{value:2,label:`Tuesday`,short:`Tue`},{value:3,label:`Wednesday`,short:`Wed`},{value:4,label:`Thursday`,short:`Thu`},{value:5,label:`Friday`,short:`Fri`},{value:6,label:`Saturday`,short:`Sat`}],Gc={manual:{enabled:!1},schedules:[]};function Kc(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function qc(e){if(!e)return``;let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function Jc(e){if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toISOString()}function Yc(e){if(e.type===`oneshot`){let t=new Date(e.pauseAt),n=new Date(e.resumeAt);if(Number.isNaN(t.getTime())||Number.isNaN(n.getTime()))return`Invalid range`;let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});return`${r.format(t)} → ${r.format(n)}`}let t=e.days??[];return`${t.length===7?`Every day`:t.length===0?`No days`:t.slice().sort((e,t)=>e-t).map(e=>Wc[e]?.short??String(e)).join(`, `)} · ${e.pauseAt===`00:00`&&e.resumeAt===`00:00`?`all day`:`${e.pauseAt} → ${e.resumeAt}`}`}function Xc(){return{label:``,type:`recurring`,pauseAt:`22:00`,resumeAt:`06:00`,days:[0,1,2,3,4,5,6]}}function Zc(){return{label:``,type:`oneshot`,pauseAt:qc(new Date().toISOString()),resumeAt:qc(new Date(Date.now()+3600*1e3).toISOString()),days:[]}}function Qc(e){let t=new Set(e.filter(e=>Number.isInteger(e)&&e>=0&&e<=6));return Array.from(t).sort((e,t)=>e-t)}var $c={display:`inline-flex`,alignItems:`center`,gap:4,fontSize:11,fontWeight:500,padding:`3px 8px`,borderRadius:999,border:`1px solid ${C.border}`,color:C.muted,background:`var(--color-subtle-bg)`},el={background:`rgba(188,140,255,0.15)`,border:`1px solid rgba(188,140,255,0.35)`,color:`var(--color-text)`,padding:`8px 14px`,borderRadius:6,fontSize:13,fontWeight:500,cursor:`pointer`,minHeight:36},tl={background:`transparent`,border:`1px solid ${C.border}`,color:C.muted,padding:`6px 12px`,borderRadius:6,fontSize:12,cursor:`pointer`,minHeight:32},nl={background:`transparent`,border:`1px solid rgba(248,81,73,0.3)`,color:`var(--color-negative)`,padding:`6px 12px`,borderRadius:6,fontSize:12,cursor:`pointer`,minHeight:32};function rl({draft:e,onChange:t,onCancel:n,onSave:r}){function i(n){let r=e.days.includes(n);t({...e,days:r?e.days.filter(e=>e!==n):[...e.days,n]})}return(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>t({...Xc(),label:e.label}),style:{...tl,background:e.type===`recurring`?`rgba(188,140,255,0.15)`:`transparent`,borderColor:e.type===`recurring`?`rgba(188,140,255,0.35)`:C.border,color:e.type===`recurring`?C.text:C.muted},children:`Recurring`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>t({...Zc(),label:e.label}),style:{...tl,background:e.type===`oneshot`?`rgba(188,140,255,0.15)`:`transparent`,borderColor:e.type===`oneshot`?`rgba(188,140,255,0.35)`:C.border,color:e.type===`oneshot`?C.text:C.muted},children:`One-shot`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{...D,marginBottom:4},children:`Label`}),(0,B.jsx)(`input`,{type:`text`,value:e.label,onChange:n=>t({...e,label:n.target.value}),placeholder:e.type===`recurring`?`Quiet hours`:`Planned maintenance`,style:{...w,width:`100%`}})]}),e.type===`recurring`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{...D,marginBottom:6},children:`Days`}),(0,B.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:Wc.map(t=>{let n=e.days.includes(t.value);return(0,B.jsx)(`button`,{type:`button`,onClick:()=>i(t.value),style:{minHeight:36,minWidth:48,padding:`6px 10px`,borderRadius:6,border:`1px solid ${n?`rgba(188,140,255,0.45)`:C.border}`,background:n?`rgba(188,140,255,0.15)`:`transparent`,color:n?C.text:C.muted,fontSize:12,fontWeight:500,cursor:`pointer`},children:t.short},t.value)})}),(0,B.jsxs)(`div`,{style:{...b,marginTop:6},children:[`Set both times to `,(0,B.jsx)(`code`,{children:`00:00`}),` for all-day.`]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:[(0,B.jsxs)(`div`,{style:{flex:1,minWidth:140},children:[(0,B.jsx)(`div`,{style:{...D,marginBottom:4},children:`Pause at (HH:MM)`}),(0,B.jsx)(`input`,{type:`time`,value:e.pauseAt,onChange:n=>t({...e,pauseAt:n.target.value}),style:{...w,width:`100%`}})]}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:140},children:[(0,B.jsx)(`div`,{style:{...D,marginBottom:4},children:`Resume at (HH:MM)`}),(0,B.jsx)(`input`,{type:`time`,value:e.resumeAt,onChange:n=>t({...e,resumeAt:n.target.value}),style:{...w,width:`100%`}})]})]})]}):(0,B.jsxs)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:[(0,B.jsxs)(`div`,{style:{flex:1,minWidth:220},children:[(0,B.jsx)(`div`,{style:{...D,marginBottom:4},children:`Start`}),(0,B.jsx)(`input`,{type:`datetime-local`,value:e.pauseAt,onChange:n=>t({...e,pauseAt:n.target.value}),style:{...w,width:`100%`}})]}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:220},children:[(0,B.jsx)(`div`,{style:{...D,marginBottom:4},children:`End`}),(0,B.jsx)(`input`,{type:`datetime-local`,value:e.resumeAt,onChange:n=>t({...e,resumeAt:n.target.value}),style:{...w,width:`100%`}})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8,justifyContent:`flex-end`},children:[(0,B.jsx)(`button`,{type:`button`,onClick:n,style:tl,children:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,onClick:r,style:el,children:`Save`})]})]})}function il({settings:e,onUpdateSettings:t}){let n=e?.globalPause??Gc,[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),s=Kc(),c=(0,L.useMemo)(()=>$e(n),[n]);function l(e){t({globalPause:{manual:e.manual??n.manual,schedules:e.schedules??n.schedules}})}function u(e){let t={...n.manual,...e};l({manual:t.until===void 0?{enabled:t.enabled}:{enabled:t.enabled,until:t.until}})}function d(e){i(`__new__`),o(e===`recurring`?Xc():Zc())}function f(e){i(e.id),o({label:e.label,type:e.type,pauseAt:e.type===`oneshot`?qc(e.pauseAt):e.pauseAt,resumeAt:e.type===`oneshot`?qc(e.resumeAt):e.resumeAt,days:e.days??[]})}function p(){i(null),o(null)}function m(){if(!a)return;let e=a.pauseAt,t=a.resumeAt;if(a.type===`oneshot`){let n=Jc(a.pauseAt),r=Jc(a.resumeAt);if(!n||!r)return;e=n,t=r}let i=a.label.trim()||(a.type===`recurring`?`Recurring pause`:`Scheduled pause`);if(r===`__new__`||!r){let r={id:crypto.randomUUID(),label:i,createdTimezone:s,enabled:!0,type:a.type,pauseAt:e,resumeAt:t,...a.type===`recurring`?{days:Qc(a.days)}:{}};l({schedules:[...n.schedules,r]})}else{let o=n.schedules.find(e=>e.id===r);if(!o)return;let s={...o,label:i,type:a.type,pauseAt:e,resumeAt:t,...a.type===`recurring`?{days:Qc(a.days)}:{}};l({schedules:n.schedules.map(e=>e.id===s.id?s:e)})}p()}function h(e,t){l({schedules:n.schedules.map(n=>n.id===e?{...n,enabled:t}:n)})}function g(e){l({schedules:n.schedules.filter(t=>t.id!==e)})}function _(e){l({schedules:n.schedules.map(t=>t.id===e?{...t,createdTimezone:s}:t)})}function y(){l({schedules:n.schedules.map(e=>({...e,createdTimezone:s}))})}let x=n.schedules.filter(e=>e.createdTimezone&&e.createdTimezone!==s);return(0,B.jsxs)(Uc,{title:`Pauses`,description:`Globally pause scheduled job runs. A manual toggle short-circuits all schedules. Recurring + one-shot windows cover the rest. Jobs with 'Ignore pauses' on are immune.`,children:[(0,B.jsx)(`div`,{style:{...v,marginBottom:16,borderColor:c.paused?`rgba(210,153,34,0.4)`:C.border,background:c.paused?`rgba(210,153,34,0.08)`:v.background},children:(0,B.jsxs)(`div`,{style:T,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:D,children:c.paused?`Currently paused`:`Not paused`}),(0,B.jsx)(`div`,{style:b,children:c.paused?c.reason===`manual`?`Manual override${c.until?` · clears at ${new Date(c.until).toLocaleString()}`:``}`:`Scheduled · ${c.source??`override`}`:`Scheduled jobs will run normally.`})]}),(0,B.jsx)(`span`,{style:{...$c,color:c.paused?`var(--color-warning)`:`var(--color-positive)`,borderColor:c.paused?`rgba(210,153,34,0.4)`:`rgba(63,185,80,0.4)`},children:c.paused?`Paused`:`Live`})]})}),(0,B.jsxs)(`div`,{style:{...v,marginBottom:16},children:[(0,B.jsxs)(`div`,{style:{...T,marginBottom:12},children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:D,children:`Manual global pause`}),(0,B.jsx)(`div`,{style:b,children:`When on, scheduled runs are skipped until you turn it off or the auto-clear time passes.`})]}),(0,B.jsxs)(`label`,{style:{display:`inline-flex`,alignItems:`center`,gap:8,minHeight:36,cursor:`pointer`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:n.manual.enabled,onChange:e=>u({enabled:e.target.checked}),style:{width:18,height:18,cursor:`pointer`}}),(0,B.jsx)(`span`,{style:{fontSize:13,color:C.text},children:n.manual.enabled?`On`:`Off`})]})]}),n.manual.enabled&&(0,B.jsxs)(`div`,{style:{borderTop:`1px solid ${C.border}`,paddingTop:12},children:[(0,B.jsxs)(`div`,{style:{marginBottom:6},children:[(0,B.jsx)(`div`,{style:D,children:`Auto-clear at (optional)`}),(0,B.jsx)(`div`,{style:b,children:`Manual pause switches off at this wall-clock time.`})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`},children:[(0,B.jsx)(`input`,{type:`datetime-local`,value:qc(n.manual.until),onChange:e=>{let t=Jc(e.target.value);t!==void 0&&u({until:t})},onBlur:e=>{e.target.value===``&&n.manual.until!==void 0&&u({until:void 0})},style:{...w,minWidth:220}}),n.manual.until&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>u({until:void 0}),style:tl,children:`Clear`})]})]})]}),x.length>0&&(0,B.jsx)(`div`,{style:{...v,marginBottom:16,borderColor:`rgba(88,166,255,0.35)`,background:`rgba(88,166,255,0.08)`},children:(0,B.jsxs)(`div`,{style:{...T,flexWrap:`wrap`,gap:8},children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:D,children:`Timezone drift`}),(0,B.jsxs)(`div`,{style:b,children:[x.length,` schedule`,x.length===1?``:`s`,` created in a different timezone. Shifting keeps the same wall-clock time but re-anchors it to `,(0,B.jsx)(`strong`,{children:s}),`.`]})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:y,style:el,children:[`Shift all to `,s]})]})}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10,marginBottom:16},children:[n.schedules.length===0&&r!==`__new__`&&(0,B.jsx)(`div`,{style:{...v,textAlign:`center`,color:C.muted,fontSize:13,padding:`24px 16px`},children:`No pause schedules. Add one below for quiet hours, weekends, or a one-shot window.`}),n.schedules.map(e=>{let t=r===e.id,n=e.createdTimezone&&e.createdTimezone!==s;return(0,B.jsx)(`div`,{style:v,children:t&&a?(0,B.jsx)(rl,{draft:a,onChange:o,onCancel:p,onSave:m}):(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)(`div`,{style:{...T,flexWrap:`wrap`,gap:10},children:[(0,B.jsxs)(`div`,{style:{flex:1,minWidth:220},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:t=>h(e.id,t.target.checked),style:{width:18,height:18,cursor:`pointer`}}),(0,B.jsx)(`span`,{style:{...D,opacity:e.enabled?1:.6},children:e.label}),(0,B.jsx)(`span`,{style:$c,children:e.type===`recurring`?`Recurring`:`One-shot`}),n&&(0,B.jsx)(`span`,{style:{...$c,color:`var(--color-info)`,borderColor:`rgba(88,166,255,0.35)`},title:`Created in ${e.createdTimezone}`,children:e.createdTimezone})]}),(0,B.jsx)(`div`,{style:{...b,marginTop:4},children:Yc(e)})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:[n&&(0,B.jsxs)(`button`,{type:`button`,onClick:()=>_(e.id),style:tl,children:[`Shift to `,s]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(e),style:tl,children:`Edit`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>g(e.id),style:nl,children:`Delete`})]})]})})},e.id)}),r===`__new__`&&a&&(0,B.jsx)(`div`,{style:v,children:(0,B.jsx)(rl,{draft:a,onChange:o,onCancel:p,onSave:m})})]}),r===null&&(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`recurring`),style:el,children:`+ Add recurring window`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>d(`oneshot`),style:tl,children:`+ Add one-shot window`})]})]})}function al({sections:e,onReorder:t,onToggleVisibility:n,onReset:r}){let[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),c=(e,t)=>{a(t),e.dataTransfer.effectAllowed=`move`;let n=document.createElement(`div`);n.style.position=`absolute`,n.style.top=`-9999px`,document.body.appendChild(n),e.dataTransfer.setDragImage(n,0,0),setTimeout(()=>document.body.removeChild(n),0)},l=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,s(t)},u=(n,r)=>{if(n.preventDefault(),i===null||i===r){a(null),s(null);return}let o=[...e],[c]=o.splice(i,1);o.splice(r,0,c),t(o.map(e=>e.id)),a(null),s(null)},d=()=>{a(null),s(null)};return(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:1},children:[e.map((e,t)=>{let r=i===t,a=o===t&&i!==null&&i!==t;return(0,B.jsxs)(`div`,{children:[a&&i!==null&&i>t&&(0,B.jsx)(`div`,{className:`section-nav-drop-indicator`}),(0,B.jsxs)(`div`,{draggable:!0,onDragStart:e=>c(e,t),onDragOver:e=>l(e,t),onDrop:e=>u(e,t),onDragEnd:d,className:r?`section-nav-item-dragging`:void 0,style:{display:`flex`,alignItems:`center`,gap:6,padding:`5px 8px`,borderRadius:6,cursor:`grab`,opacity:r?.5:1,transition:`opacity 0.1s ease, background 0.1s ease`,background:a?`var(--color-primary)10`:`transparent`,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif`},children:[(0,B.jsx)(`span`,{style:{color:`var(--color-text-muted)`,fontSize:12,cursor:`grab`,flexShrink:0,lineHeight:1,userSelect:`none`},title:`Drag to reorder`,children:`⠿`}),(0,B.jsxs)(`span`,{className:e.visible?void 0:`section-nav-item-hidden`,style:{flex:1,fontSize:11,color:e.visible?C.textSecondary:`var(--color-text-muted)`,fontWeight:400,letterSpacing:.2,userSelect:`none`,display:`flex`,alignItems:`center`,gap:5},children:[e.label,!e.visible&&(0,B.jsx)(`span`,{style:{fontSize:9,fontWeight:600,letterSpacing:.5,textTransform:`uppercase`,color:`var(--color-text-muted)`,background:`var(--color-muted-bg)`,padding:`1px 4px`,borderRadius:3,lineHeight:1.4},children:`Hidden`})]}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),n(e.id)},title:e.visible?`Hide section`:`Show section`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,border:`1px solid ${e.visible?C.border:`var(--color-border-strong)`}`,borderRadius:4,background:e.visible?`var(--color-muted-bg)`:`transparent`,padding:`2px 5px`,cursor:`pointer`,opacity:e.visible?1:.5,fontSize:11,color:e.visible?C.textSecondary:`var(--color-text-muted)`,transition:`opacity 0.15s ease, color 0.15s ease, background 0.15s ease`,flexShrink:0,lineHeight:1},onMouseEnter:t=>{t.currentTarget.style.color=e.visible?C.text:C.muted,t.currentTarget.style.opacity=`1`,t.currentTarget.style.background=(e.visible,`var(--color-muted-bg)`)},onMouseLeave:t=>{t.currentTarget.style.color=e.visible?C.textSecondary:`var(--color-text-muted)`,t.currentTarget.style.opacity=e.visible?`1`:`0.5`,t.currentTarget.style.background=e.visible?`var(--color-muted-bg)`:`transparent`},children:e.visible?`◉`:`○`})]}),a&&i!==null&&i<t&&(0,B.jsx)(`div`,{className:`section-nav-drop-indicator`})]},e.id)}),(0,B.jsx)(`div`,{style:{borderTop:`1px solid ${C.border}`,marginTop:4,paddingTop:6,paddingLeft:8},children:(0,B.jsx)(`button`,{onClick:r,style:{border:`none`,background:`transparent`,color:`var(--color-text-muted)`,fontSize:10,cursor:`pointer`,padding:0,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif`,letterSpacing:.2,textDecoration:`underline`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=C.muted},onMouseLeave:e=>{e.currentTarget.style.color=`var(--color-text-muted)`},children:`Reset to defaults`})})]})}var G={sectionLabel:`_sectionLabel_1399f_11`,sectionBlock:`_sectionBlock_1399f_20`,sectionCard:`_sectionCard_1399f_24`,sectionCardBg:`_sectionCardBg_1399f_31`,settingsRow:`_settingsRow_1399f_40`,rowLabel:`_rowLabel_1399f_47`,rowHint:`_rowHint_1399f_53`,rowHintInline:`_rowHintInline_1399f_59`,clickableRow:`_clickableRow_1399f_68`,formFieldLabel:`_formFieldLabel_1399f_93`,blockLabelCompact:`_blockLabelCompact_1399f_102`,microLabel:`_microLabel_1399f_110`,sectionDividerText:`_sectionDividerText_1399f_118`,rowText:`_rowText_1399f_125`,strongLabel:`_strongLabel_1399f_131`,spacerMd:`_spacerMd_1399f_138`,flexOne:`_flexOne_1399f_139`,flexRowCenter:`_flexRowCenter_1399f_141`,flexRowBetween:`_flexRowBetween_1399f_147`,relative:`_relative_1399f_154`,pageContainer:`_pageContainer_1399f_156`,pageH1:`_pageH1_1399f_162`,emptyState:`_emptyState_1399f_168`,fieldLabel:`_fieldLabel_1399f_176`,tabBar:`_tabBar_1399f_188`,tabButton:`_tabButton_1399f_197`,tabButtonActive:`_tabButtonActive_1399f_221`,iconButton:`_iconButton_1399f_228`};function ol({sectionLayout:e,onSectionReorder:t,onSectionToggleVisibility:n,onSectionReset:r}){return(0,B.jsxs)(`div`,{className:G.sectionBlock,children:[(0,B.jsx)(`div`,{className:G.sectionLabel,children:`Dashboard Sections`}),(0,B.jsx)(`div`,{style:{padding:`10px 8px`,background:`var(--color-subtle-bg)`,borderRadius:8,border:`1px solid ${C.border}`},children:(0,B.jsx)(al,{sections:e,onReorder:t,onToggleVisibility:n,onReset:r})})]})}var K={a121ccb:`_a121ccb_1mmzm_6`,a5e2dad:`_a5e2dad_1mmzm_12`,a3a5e34:`_a3a5e34_1mmzm_18`,ab44e5b:`_ab44e5b_1mmzm_24`,a449e94:`_a449e94_1mmzm_29`,ad65170:`_ad65170_1mmzm_34`,aaa2a79:`_aaa2a79_1mmzm_40`,a76e529:`_a76e529_1mmzm_46`,a4a06f5:`_a4a06f5_1mmzm_54`,a6c2755:`_a6c2755_1mmzm_63`,a8fbc9a:`_a8fbc9a_1mmzm_68`,a665ec0:`_a665ec0_1mmzm_74`,a84130c:`_a84130c_1mmzm_80`,a35be97:`_a35be97_1mmzm_84`,abf8a20:`_abf8a20_1mmzm_90`,a77934d:`_a77934d_1mmzm_96`,a1b0494:`_a1b0494_1mmzm_103`,aa27e73:`_aa27e73_1mmzm_110`,a09fc71:`_a09fc71_1mmzm_114`,a1f410c:`_a1f410c_1mmzm_120`,a5692ee:`_a5692ee_1mmzm_125`,a7902d9:`_a7902d9_1mmzm_131`,a5c2518:`_a5c2518_1mmzm_136`,a3aa7fa:`_a3aa7fa_1mmzm_141`,a46df60:`_a46df60_1mmzm_145`,a18147d:`_a18147d_1mmzm_149`,aaf97c6:`_aaf97c6_1mmzm_157`,aa8f93f:`_aa8f93f_1mmzm_163`,ae7dac0:`_ae7dac0_1mmzm_167`,aa6bf89:`_aa6bf89_1mmzm_174`,a349e79:`_a349e79_1mmzm_182`,a375095:`_a375095_1mmzm_189`,a4b3aa9:`_a4b3aa9_1mmzm_201`,a99f090:`_a99f090_1mmzm_209`,a21c854:`_a21c854_1mmzm_218`,a931073:`_a931073_1mmzm_223`,a187613:`_a187613_1mmzm_233`,a740d2b:`_a740d2b_1mmzm_240`,a6e9faa:`_a6e9faa_1mmzm_247`,a86c6f9:`_a86c6f9_1mmzm_255`,a3cd9d8:`_a3cd9d8_1mmzm_269`,a2d6462:`_a2d6462_1mmzm_276`,a2ee1fa:`_a2ee1fa_1mmzm_282`,a07a367:`_a07a367_1mmzm_289`,a77618d:`_a77618d_1mmzm_294`};function sl({notificationPermission:e,onRequestNotifications:t}){return(0,B.jsxs)(`div`,{className:G.sectionBlock,children:[(0,B.jsx)(`div`,{className:G.sectionLabel,children:`Notifications`}),(0,B.jsx)(`div`,{className:G.sectionCard,children:e===`granted`?(0,B.jsxs)(`div`,{className:K.abf8a20,children:[(0,B.jsx)(`span`,{className:K.a77618d,children:`✓ Notifications enabled`}),(0,B.jsx)(`span`,{className:K.a07a367,children:`— you'll be alerted on job completion and failure`})]}):e===`denied`?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:K.a2ee1fa,children:`Notifications blocked`}),(0,B.jsx)(`div`,{className:K.a2d6462,children:`Browser notifications are blocked. To enable, update the permission in your browser's site settings for this page.`})]}):(0,B.jsxs)(`div`,{className:G.settingsRow,children:[(0,B.jsxs)(`div`,{className:G.rowLabel,children:[`Enable browser notifications`,(0,B.jsx)(`div`,{className:K.a3cd9d8,children:`Get alerted on job completion or failure, even when this tab is in the background.`})]}),(0,B.jsx)(`button`,{onClick:t,className:K.a86c6f9,children:`Enable`})]})})]})}function cl({settings:e,onUpdateSettings:t}){return(0,B.jsxs)(`div`,{className:G.sectionBlock,children:[(0,B.jsx)(`div`,{className:G.sectionLabel,children:`Scheduling`}),(0,B.jsxs)(`div`,{className:G.sectionCardBg,children:[(0,B.jsxs)(`div`,{className:K.a187613,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:G.rowLabel,children:`Max Concurrent Jobs`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Jobs exceeding this limit are queued by priority`})]}),(0,B.jsx)(`select`,{value:e?.maxConcurrentJobs??3,onChange:e=>t({maxConcurrentJobs:Number(e.target.value)}),style:{background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${C.border}`,borderRadius:6,padding:`4px 10px`,fontSize:13,cursor:`pointer`,minWidth:60,textAlign:`center`},children:[1,2,3,4,5,6,8,10,15,20].map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),(0,B.jsx)(`div`,{style:{borderTop:`1px solid ${C.border}`,paddingTop:10,marginTop:10},children:(0,B.jsxs)(`div`,{className:K.a5e2dad,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:G.rowLabel,children:`Auto-Tune Timeouts`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Automatically adjust job timeouts based on historical run durations`})]}),(0,B.jsxs)(`label`,{className:K.a6e9faa,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e?.autoTuneTimeouts??!0,onChange:e=>t({autoTuneTimeouts:e.target.checked}),className:K.a740d2b}),(0,B.jsx)(`span`,{style:{position:`absolute`,inset:0,borderRadius:10,background:e?.autoTuneTimeouts??!0?C.green:`var(--color-border)`,transition:`background 0.2s`}}),(0,B.jsx)(`span`,{style:{position:`absolute`,top:2,left:e?.autoTuneTimeouts??!0?18:2,width:16,height:16,borderRadius:`50%`,background:C.text,transition:`left 0.2s`}})]})]})})]})]})}function ll({settings:e,onUpdateSettings:t}){let[n,r]=(0,L.useState)(null);return(0,B.jsxs)(`div`,{className:G.sectionBlock,children:[(0,B.jsx)(`div`,{className:G.sectionLabel,children:`Link Enrichment`}),(0,B.jsxs)(`div`,{style:{padding:`12px 14px`,background:`var(--color-subtle-bg)`,borderRadius:8,border:`1px solid ${C.border}`,marginBottom:12},children:[(0,B.jsxs)(`div`,{className:K.a187613,children:[(0,B.jsxs)(`label`,{className:K.a931073,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e?.autoEnrich??!0,onChange:e=>t({autoEnrich:e.target.checked}),className:K.a21c854}),`Auto-enrich links`]}),e?.autoEnrich&&(0,B.jsx)(`span`,{className:K.a99f090,children:`ON`})]}),(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,lineHeight:1.5,marginBottom:e?.autoEnrich?12:0},children:e?.autoEnrich?`Claude automatically resolves link titles from your job results using connected integrations. Runs in a background session.`:`When disabled, links show URL-based labels only. Enable to have Claude resolve titles from Notion, Linear, Slack, and GitHub.`}),e?.autoEnrich&&(0,B.jsxs)(`div`,{className:K.a4b3aa9,children:[(0,B.jsx)(`span`,{children:`Interval:`}),(0,B.jsxs)(`select`,{value:e.autoEnrichIntervalMinutes,onChange:e=>t({autoEnrichIntervalMinutes:Number(e.target.value)}),style:{background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${C.border}`,borderRadius:4,padding:`3px 8px`,fontSize:12,cursor:`pointer`},children:[(0,B.jsx)(`option`,{value:30,children:`30 min`}),(0,B.jsx)(`option`,{value:60,children:`1 hour`}),(0,B.jsx)(`option`,{value:120,children:`2 hours`}),(0,B.jsx)(`option`,{value:240,children:`4 hours`}),(0,B.jsx)(`option`,{value:480,children:`8 hours`})]}),(0,B.jsx)(`button`,{onClick:()=>{fetch(`/api/focus`).then(()=>{r(`triggered`),setTimeout(()=>r(null),3e3)}).catch(()=>{r(`error`),setTimeout(()=>r(null),3e3)})},className:K.a375095,children:n===`triggered`?`✓ Triggered`:n===`error`?`Failed`:`Test`})]})]})]})}function ul({size:e=14,color:t=`currentColor`}){return(0,B.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:t,children:(0,B.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z`})})}function dl({size:e=14,color:t=`currentColor`}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 100 100`,fill:`none`,children:[(0,B.jsx)(`path`,{d:`M6.017 4.313l55.333-4.087c6.797-.583 8.543-.19 12.817 2.917l17.663 12.443c2.913 2.14 3.883 2.723 3.883 5.053v68.243c0 4.277-1.553 6.807-6.99 7.193L24.467 99.967c-4.08.193-6.023-.39-8.16-3.113L3.3 79.94c-2.333-3.113-3.3-5.443-3.3-8.167V11.113c0-3.497 1.553-6.413 6.017-6.8z`,fill:t}),(0,B.jsx)(`path`,{d:`M61.35.227l-55.333 4.087C.573 4.7-.977 7.617-.977 11.113v60.66c0 2.723.967 5.053 3.3 8.167l12.99 16.913c2.137 2.723 4.08 3.307 8.16 3.113l64.257-3.89c5.433-.387 6.99-2.917 6.99-7.193V20.64c0-2.21-.82-2.873-3.277-4.627L75.753 3.57`,fill:t}),(0,B.jsx)(`path`,{d:`M28.45 26.32c0 2.723-.193 3.113-1.747 4.083L18.28 36.127c-1.553.97-2.327.583-2.327-1.553V16.18c0-2.527 1.163-3.887 3.3-4.08l9.107-.777c2.137-.193 3.09 1.163 3.09 3.5v11.497zm-3.69 53.963V40.597L62.08 38.07v39.3`,fill:`#fff`})]})}function fl({size:e=14,color:t=`currentColor`}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 100 100`,fill:t,children:[(0,B.jsx)(`path`,{d:`M1.22541 61.5228c-.04261-.0915.00702-.1855.08037-.2555L49.2213 13.3509c.0697-.0697.1543-.1084.2441-.1048.104.0042.1936.0664.2496.1572l16.1758 26.2664-14.2742 14.2742L25.8428 80.6176c-.1015.1015-.2741.094-.356-.0171L1.22541 61.5228z`}),(0,B.jsx)(`path`,{d:`M75.4913 43.5228l-8.1697-13.2668L50.4444 47.1332l13.2668 8.1697L75.4913 43.5228z`}),(0,B.jsx)(`path`,{d:`M86.5913 48.5228l-6.1697-10.0168L67.7444 51.1832l10.0168 6.1697L86.5913 48.5228z`})]})}function pl({size:e=14}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,children:[(0,B.jsx)(`path`,{d:`M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52z`,fill:`#E01E5A`}),(0,B.jsx)(`path`,{d:`M6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z`,fill:`#E01E5A`}),(0,B.jsx)(`path`,{d:`M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834z`,fill:`#36C5F0`}),(0,B.jsx)(`path`,{d:`M8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z`,fill:`#36C5F0`}),(0,B.jsx)(`path`,{d:`M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834z`,fill:`#2EB67D`}),(0,B.jsx)(`path`,{d:`M17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312z`,fill:`#2EB67D`}),(0,B.jsx)(`path`,{d:`M15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52z`,fill:`#ECB22E`}),(0,B.jsx)(`path`,{d:`M15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z`,fill:`#ECB22E`})]})}var ml=[{key:`github`,label:`GitHub`,icon:ul,isActive:e=>!!e.connected,instruction:`Run gh auth login in your terminal`},{key:`notion`,label:`Notion`,icon:dl,isActive:e=>!!e.configured,instruction:`Add Notion MCP server to Claude`},{key:`linear`,label:`Linear`,icon:fl,isActive:e=>!!e.configured,instruction:`Add Linear MCP server to Claude`},{key:`slack`,label:`Slack`,icon:pl,isActive:e=>!!e.configured,instruction:`Add Slack MCP server to Claude`}];function hl({integrations:e,onVerify:t,verifying:n}){return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:K.a349e79,children:[(0,B.jsx)(`div`,{className:K.aa6bf89,children:`Configured Integrations`}),(0,B.jsx)(`button`,{onClick:t,disabled:n,style:{background:`rgba(210, 153, 34, 0.15)`,border:`1px solid rgba(210, 153, 34, 0.4)`,color:C.warning,fontSize:10,padding:`2px 8px`,borderRadius:4,cursor:n?`default`:`pointer`,opacity:n?.6:1,whiteSpace:`nowrap`},children:n?`Verifying...`:`Verify connections`})]}),(0,B.jsxs)(`div`,{className:K.ae7dac0,children:[`Some integrations (plugins, CLI tools) are detected locally. Cloud-hosted MCP servers (claude.ai Notion, Linear, etc.) can only be detected by running `,(0,B.jsx)(`strong`,{className:K.aa8f93f,children:`Verify connections`}),`.`]}),(0,B.jsx)(`div`,{style:{padding:`10px 14px`,background:`var(--color-subtle-bg)`,borderRadius:8,border:`1px solid ${C.border}`},children:(0,B.jsx)(`div`,{className:K.aaf97c6,children:ml.map(t=>{let n=e?e[t.key]:void 0,r=n?t.isActive(n):!1,i=n?.verified===!0,a=n?.verifiedAt,o=t.icon;return(0,B.jsxs)(`div`,{className:K.a18147d,children:[(0,B.jsx)(o,{size:15,color:i?C.green:r?C.warning:C.muted}),(0,B.jsx)(`span`,{style:{color:r||i?C.text:C.muted,fontWeight:500,minWidth:56},children:t.label}),i?(0,B.jsxs)(`span`,{className:K.a46df60,children:[(0,B.jsx)(`span`,{className:K.a3aa7fa,children:`✓ Connected`}),a&&(0,B.jsx)(`span`,{className:K.a5c2518,children:new Date(a).toLocaleDateString()})]}):r?(0,B.jsx)(`span`,{className:K.a7902d9,children:`Installed — verify to check`}):(0,B.jsx)(`span`,{className:K.a5692ee,children:`Not detected — verify to check`})]},t.key)})})})]})}function gl({onNavigate:e}){return(0,B.jsx)(`div`,{className:K.a1f410c,children:(0,B.jsxs)(`a`,{href:`#/settings`,style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 14px`,background:`rgba(188,140,255,0.06)`,border:`1px solid rgba(188,140,255,0.2)`,borderRadius:8,color:`var(--color-primary)`,fontSize:13,fontWeight:500,textDecoration:`none`,transition:`all 0.15s ease`},onClick:e,children:[`Platform Settings`,(0,B.jsx)(`span`,{className:K.a09fc71,children:`— Engine, integrations, org defaults`})]})})}function _l({onImportFromSync:e}){let[t,n]=(0,L.useState)(``),[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(new Set),[p,m]=(0,L.useState)(new Set);async function h(){let e=r.trim();if(!e){u(`Paste a directory path above, e.g. ~/Dropbox/teamwork-os-sync`);return}c(!0),u(``),o([]);try{let t=await fetch(`/api/sharing/sync-dir?dir=${encodeURIComponent(e)}`);if(!t.ok){u((await t.json()).error??`Failed to list packages`);return}let r=await t.json();if(r.error){u(r.error);return}let i=r.packages??[];o(i),n(e),i.length===0&&u(`No .claude-job.json packages found in that directory`)}catch{u(`Could not reach server`)}finally{c(!1)}}async function g(n){if(e){f(e=>new Set(e).add(n.id));try{let r=await fetch(`/api/sharing/sync-dir/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:t,id:n.id})});if(!r.ok){u((await r.json()).error??`Import failed`);return}await e(await r.json()),m(e=>new Set(e).add(n.id))}catch{u(`Import request failed`)}finally{f(e=>{let t=new Set(e);return t.delete(n.id),t})}}}return(0,B.jsxs)(`div`,{className:K.aa27e73,children:[(0,B.jsx)(`div`,{className:G.sectionLabel,children:`Job Sync`}),(0,B.jsxs)(`div`,{className:G.sectionCard,children:[(0,B.jsxs)(`div`,{className:K.a1b0494,children:[`Paste the path to a shared directory containing `,(0,B.jsx)(`code`,{className:K.a77934d,children:`.claude-job.json`}),` files (e.g. an iCloud Drive, Dropbox, or Git folder).`]}),(0,B.jsxs)(`div`,{className:K.abf8a20,children:[(0,B.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h()},placeholder:`/path/to/shared/jobs`,style:{flex:1,padding:`6px 10px`,borderRadius:6,border:`1px solid ${C.border}`,background:`var(--color-bg)`,color:C.text,fontFamily:`inherit`,fontSize:13,transition:`border-color 0.2s ease`}}),(0,B.jsx)(`button`,{className:`btn btn-sm ${K.a449e94}`,onClick:h,disabled:s,children:s?`Scanning…`:`Scan`})]}),l&&(0,B.jsx)(`div`,{className:K.a35be97,children:l}),a.length>0&&(0,B.jsxs)(`div`,{className:K.a84130c,children:[(0,B.jsxs)(`div`,{className:K.a665ec0,children:[a.length,` package`,a.length===1?``:`s`,` found`]}),(0,B.jsx)(`div`,{className:K.a8fbc9a,children:a.map((t,n)=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 10px`,background:`var(--color-bg)`,borderRadius:6,border:`1px solid ${p.has(t.id)?`rgba(63,185,80,0.4)`:C.border}`,animation:`syncFadeUp 0.25s ease both`,animationDelay:`${n*40}ms`},children:[(0,B.jsx)(`style`,{children:`@keyframes syncFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }`}),(0,B.jsxs)(`div`,{className:K.a6c2755,children:[(0,B.jsx)(`div`,{className:K.a4a06f5,children:t.name}),t.description&&(0,B.jsx)(`div`,{className:K.a76e529,children:t.description}),t._exportedAt&&(0,B.jsx)(`div`,{className:K.aaa2a79,children:new Date(t._exportedAt).toLocaleDateString()})]}),p.has(t.id)?(0,B.jsx)(`span`,{className:K.ad65170,children:`✓ Imported`}):(0,B.jsx)(`button`,{className:`btn btn-sm ${K.a449e94}`,onClick:()=>g(t),disabled:d.has(t.id)||!e,children:d.has(t.id)?`Importing…`:`Import`})]},t.id))})]})]})]})}function vl({open:e,onClose:t,embedded:n,settings:r,integrations:i,onUpdateSettings:a,onVerify:o,verifying:s,notificationPermission:c,onRequestNotifications:l,onImportFromSync:u,sectionLayout:d,onSectionReorder:f,onSectionToggleVisibility:p,onSectionReset:m}){let[h,g]=(0,L.useState)(!1),_=(0,B.jsxs)(`div`,{className:`settings-panel-content`,style:{flex:1,overflowY:`auto`,padding:n?`0`:`16px 20px`},children:[(0,B.jsx)(`div`,{className:G.sectionBlock,children:(0,B.jsx)(il,{settings:r,onUpdateSettings:a})}),(0,B.jsx)(ol,{sectionLayout:d,onSectionReorder:f,onSectionToggleVisibility:p,onSectionReset:m}),(0,B.jsx)(sl,{notificationPermission:c,onRequestNotifications:l}),(0,B.jsx)(cl,{settings:r,onUpdateSettings:a}),(0,B.jsx)(ll,{settings:r,onUpdateSettings:a}),(0,B.jsx)(hl,{integrations:i,onVerify:o,verifying:s}),(0,B.jsx)(gl,{onNavigate:t}),(0,B.jsx)(_l,{onImportFromSync:u})]});return n?(0,B.jsxs)(`div`,{className:K.ab44e5b,children:[(0,B.jsx)(`h1`,{className:K.a3a5e34,children:`Settings`}),_]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:t,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.5)`,zIndex:999,opacity:+!!e,pointerEvents:e?`auto`:`none`,transition:`opacity 0.2s ease`}}),(0,B.jsxs)(`div`,{className:`responsive-settings-drawer`,style:{position:`fixed`,top:0,right:0,bottom:0,width:400,maxWidth:`100vw`,background:`var(--color-bg)`,borderLeft:`1px solid ${C.border}`,zIndex:1e3,transform:e?`translateX(0)`:`translateX(100%)`,transition:`transform 0.25s ease`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,B.jsx)(`div`,{style:{padding:`16px 20px 12px`,borderBottom:`1px solid ${C.border}`,flexShrink:0},children:(0,B.jsxs)(`div`,{className:K.a5e2dad,children:[(0,B.jsx)(`h2`,{className:K.a121ccb,children:`Cron Settings`}),(0,B.jsx)(`button`,{onClick:t,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{background:`none`,border:`none`,color:C.muted,fontSize:18,cursor:`pointer`,padding:`2px 6px`,opacity:h?1:.6,transition:`opacity 0.15s`},"aria-label":`Close settings`,children:`✕`})]})}),_]})]})}var yl=e=>e.lastStatus===`running`?C.blue:e.lastStatus===`queued`?`#a78bfa`:e.lastStatus===`success`?C.green:e.lastStatus===`failed`||e.lastStatus===`timeout`?C.red:e.lastStatus===`degraded`?C.warning:(e.lastStatus,C.muted);function bl({job:e,onSelect:t}){let[n,r]=(0,L.useState)(!1);return(0,B.jsxs)(`button`,{onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`,padding:`8px 12px`,borderRadius:6,background:n?`rgba(255,255,255,0.03)`:`transparent`,border:`none`,cursor:`pointer`,textAlign:`left`,opacity:e.enabled?1:.5,transition:`background 0.15s`},children:[(0,B.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:yl(e),flexShrink:0}}),(0,B.jsx)(`span`,{style:{fontSize:13,fontFamily:g,color:C.textSecondary,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name})]})}function xl({jobs:e,open:t,onClose:n,onSelectJob:r}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:n,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.5)`,zIndex:999,opacity:+!!t,pointerEvents:t?`auto`:`none`,transition:`opacity 0.2s ease`}}),(0,B.jsxs)(`div`,{style:{position:`fixed`,top:0,left:0,bottom:0,width:220,maxWidth:`80vw`,background:`var(--color-bg)`,borderRight:`1px solid ${C.border}`,zIndex:1e3,transform:t?`translateX(0)`:`translateX(-100%)`,transition:`transform 0.25s ease`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`16px 16px`,borderBottom:`1px solid ${C.border}`,flexShrink:0},children:[(0,B.jsx)(`div`,{style:{...k,fontWeight:600,letterSpacing:.8,margin:0},children:`Jobs`}),(0,B.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,color:C.muted,fontSize:18,cursor:`pointer`,padding:`4px 8px`,lineHeight:1},"aria-label":`Close job navigator`,children:`✕`})]}),(0,B.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`8px 4px`},children:e.map(e=>(0,B.jsx)(bl,{job:e,onSelect:()=>r(e.id)},e.id))})]})]})}function Sl({title:e,action:t,style:n}){return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,...n},children:[(0,B.jsx)(`span`,{style:k,children:e}),t]})}var Cl={shell:`_shell_784ks_1`,fadeInUp:`_fadeInUp_784ks_1`,card:`_card_784ks_6`,header:`_header_784ks_14`,row:`_row_784ks_18`,rowClickable:`_rowClickable_784ks_33`,time:`_time_784ks_41`,timeImminent:`_timeImminent_784ks_51`,dot:`_dot_784ks_55`,dotImminent:`_dotImminent_784ks_64`,name:`_name_784ks_68`,nameImminent:`_nameImminent_784ks_77`,brokenDivider:`_brokenDivider_784ks_81`,brokenLabel:`_brokenLabel_784ks_87`,brokenRow:`_brokenRow_784ks_96 _row_784ks_18`,brokenTime:`_brokenTime_784ks_104 _time_784ks_41`,pulse:`_pulse_784ks_1`,brokenDot:`_brokenDot_784ks_114 _dot_784ks_55`,brokenOverflow:`_brokenOverflow_784ks_120`},wl=3,Tl=8,El=5;function Dl({jobs:e,onSelectJob:t}){let n=(0,L.useMemo)(()=>{let t=Date.now(),n=[];for(let r of e){if(!r.enabled||r.snoozedUntil&&new Date(r.snoozedUntil).getTime()>t)continue;let e;for(let t=0;t<wl;t++){let t=Ae(r.schedule,e);if(!t)break;n.push({jobId:r.id,jobName:r.name,time:t}),e=t}}return n.sort((e,t)=>e.time.getTime()-t.time.getTime()),n.slice(0,Tl)},[e]),r=(0,L.useMemo)(()=>e.filter(e=>e.enabled&&je(e.schedule)).map(e=>({jobId:e.id,jobName:e.name})),[e]),i=r.slice(0,El),a=r.length-i.length;if(n.length===0&&r.length===0)return null;let o=t?`${Cl.row} ${Cl.rowClickable}`:Cl.row;return(0,B.jsxs)(`div`,{className:Cl.shell,children:[(0,B.jsx)(`div`,{className:Cl.header,children:(0,B.jsx)(Sl,{title:`Upcoming`})}),(0,B.jsxs)(`div`,{className:Cl.card,children:[n.map((e,n)=>{let r=e.time.getTime()-Date.now()<36e5;return(0,B.jsxs)(t?`button`:`div`,{type:t?`button`:void 0,onClick:()=>t?.(e.jobId),className:o,children:[(0,B.jsx)(`span`,{className:`${Cl.time} ${r?Cl.timeImminent:``}`,children:Me(e.time)}),(0,B.jsx)(`span`,{className:`${Cl.dot} ${r?Cl.dotImminent:``}`}),(0,B.jsx)(`span`,{className:`${Cl.name} ${r?Cl.nameImminent:``}`,children:e.jobName})]},`${e.jobId}-${e.time.getTime()}-${n}`)}),i.length>0&&(0,B.jsxs)(B.Fragment,{children:[n.length>0&&(0,B.jsx)(`div`,{className:Cl.brokenDivider}),(0,B.jsxs)(`div`,{className:Cl.brokenLabel,children:[`⚠ `,`Schedule invalid`]}),i.map(e=>(0,B.jsxs)(t?`button`:`div`,{type:t?`button`:void 0,onClick:()=>t?.(e.jobId),className:t?`${Cl.brokenRow} ${Cl.rowClickable}`:Cl.brokenRow,title:`Schedule unparseable. Open job to fix.`,children:[(0,B.jsx)(`span`,{className:Cl.brokenTime,children:`Invalid`}),(0,B.jsx)(`span`,{className:Cl.brokenDot}),(0,B.jsx)(`span`,{className:Cl.name,children:e.jobName})]},`broken-${e.jobId}`)),a>0&&(0,B.jsx)(`div`,{className:Cl.brokenOverflow,children:`+${a} more`})]})]})]})}var Ol=12,kl={success:C.green,failed:C.red,timeout:C.red,running:C.blue,retrying:C.warning,queued:`#a78bfa`,cancelled:C.muted,skipped:C.muted},Al={success:`Succeeded`,failed:`Failed`,timeout:`Timed out`,running:`Running`,retrying:`Retrying`,cancelled:`Cancelled`,skipped:`Skipped`};function jl({entry:e}){return(0,B.jsxs)(`div`,{style:{position:`absolute`,bottom:`100%`,left:`50%`,transform:`translateX(-50%)`,marginBottom:6,padding:`4px 8px`,background:`var(--color-bg-raised)`,border:`1px solid ${C.border}`,borderRadius:6,fontSize:11,color:C.text,whiteSpace:`nowrap`,pointerEvents:`none`,zIndex:10,boxShadow:`0 4px 12px rgba(0,0,0,0.4)`},children:[(0,B.jsx)(`span`,{style:{color:kl[e.status??``]||C.muted},children:Al[e.status??``]||e.status}),(0,B.jsx)(`span`,{style:{color:C.muted},children:` · `}),(0,B.jsx)(`span`,{style:{color:C.muted},children:Be(e.timestamp)})]})}function Ml({entry:e}){let[t,n]=(0,L.useState)(!1),r=kl[e.status??``]||C.muted,i=e.status===`running`||e.status===`retrying`;return(0,B.jsxs)(`span`,{onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{position:`relative`,display:`inline-flex`},children:[(0,B.jsx)(`span`,{style:{display:`inline-block`,width:10,height:10,borderRadius:`50%`,background:r,opacity:i?1:.85,animation:i?`pulse 2s infinite`:`none`,transition:`opacity 0.15s, transform 0.15s`,transform:t?`scale(1.3)`:`scale(1)`,cursor:`pointer`}}),t&&(0,B.jsx)(jl,{entry:e})]})}function Nl({feed:e,jobs:t,onSelectJob:n}){let r=(0,L.useMemo)(()=>{let t=new Map;for(let n of e)t.has(n.jobId)||t.set(n.jobId,{name:n.jobName,runs:[]}),t.get(n.jobId).runs.push(n);let n=[];for(let[e,r]of t){r.runs.sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime());let t=r.runs.slice(-Ol),i=t.filter(e=>e.status===`success`||e.status===`failed`||e.status===`timeout`),a=i.filter(e=>e.status===`success`).length,o=i.length>0?a/i.length:1;n.push({jobId:e,name:r.name,runs:t,successRate:o})}return n.sort((e,t)=>e.successRate-t.successRate||t.runs.length-e.runs.length),n},[e]),i=(0,L.useMemo)(()=>{let e=new Set(r.map(e=>e.jobId)),n=t.filter(t=>t.enabled&&!e.has(t.id)).map(e=>({jobId:e.id,name:e.name,runs:[],successRate:1}));return[...r,...n]},[r,t]);return i.length===0?null:(0,B.jsxs)(`div`,{style:{marginBottom:24,animation:`fadeInUp 0.4s ease-out both`},children:[(0,B.jsx)(`div`,{style:{fontSize:11,fontWeight:600,color:C.muted,textTransform:`uppercase`,letterSpacing:.8,marginBottom:8},children:`Run Health`}),(0,B.jsx)(`div`,{style:{background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:10,padding:`12px 16px`,overflow:`hidden`},children:i.map((e,t)=>(0,B.jsxs)(`div`,{onClick:()=>n(e.jobId),style:{display:`flex`,alignItems:`center`,gap:12,padding:`6px 0`,cursor:`pointer`,borderBottom:t<i.length-1?`1px solid var(--color-border)`:`none`,transition:`background 0.15s`,borderRadius:4,marginLeft:-4,marginRight:-4,paddingLeft:4,paddingRight:4},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(88,166,255,0.06)`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,B.jsx)(`span`,{className:`job-health-name`,style:{width:140,flexShrink:0,fontSize:12,fontFamily:g,color:C.textSecondary,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:Ve(e.name,18)}),(0,B.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flex:1},children:e.runs.length>0?e.runs.map((e,t)=>(0,B.jsx)(Ml,{entry:e},`${e.timestamp}-${t}`)):(0,B.jsx)(`span`,{style:{fontSize:11,color:`var(--color-border-strong)`,fontStyle:`italic`},children:`no runs today`})}),e.runs.length>=2&&(0,B.jsxs)(`span`,{style:{fontSize:10,fontFamily:`var(--font-mono)`,color:e.successRate>=.9?C.green:e.successRate>=.7?C.warning:C.red,flexShrink:0,minWidth:28,textAlign:`right`},children:[Math.round(e.successRate*100),`%`]})]},e.jobId))})]})}function Pl(e){let t=e.reduce((e,t)=>e+t.runs,0),n=e.reduce((e,t)=>e+t.successes,0),r=e.reduce((e,t)=>e+t.failures,0),i=e.reduce((e,t)=>e+t.totalSeconds,0),a=n+r;return{runs:t,successes:n,failures:r,totalSeconds:i,successRate:a>0?n/a:1}}function Fl({label:e,current:t,previous:n,unit:r,formatFn:i}){let a=t-n,o=n>0?Math.round(a/n*100):t>0?100:0;if(t===0&&n===0)return null;let s=a>0,c=a===0,l=c?C.muted:s?C.green:C.red,u=c?``:a>0?`↑`:`↓`,d=a>0?`+`:``,f=i?i(Math.abs(a)):`${Math.abs(a)}`;return(0,B.jsxs)(`span`,{title:`This week: ${i?i(t):t}${r||``} | Last week: ${i?i(n):n}${r||``} (${d}${o}%)`,style:{display:`inline-flex`,alignItems:`center`,gap:4,fontSize:12,fontFamily:g,color:C.textSecondary},children:[(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:10,textTransform:`uppercase`,letterSpacing:.3},children:e}),(0,B.jsxs)(`span`,{style:{fontVariantNumeric:`tabular-nums`},children:[i?i(t):t,r||``]}),!c&&(0,B.jsxs)(`span`,{style:{fontSize:10,fontVariantNumeric:`tabular-nums`,color:l,background:`${l}15`,padding:`1px 5px`,borderRadius:3,whiteSpace:`nowrap`},children:[d,f,` `,u]})]})}function Il(){let[e,t]=(0,L.useState)([]);(0,L.useEffect)(()=>{fetch(`/api/stats/weekly?days=14`).then(e=>e.json()).then(e=>{Array.isArray(e)&&t(e)}).catch(()=>{})},[]);let n=e.slice(-7),r=(0,L.useMemo)(()=>Math.max(1,...n.map(e=>e.runs)),[e]),i=(0,L.useMemo)(()=>n.reduce((e,t)=>e+t.runs,0),[e]),a=(0,L.useMemo)(()=>n.reduce((e,t)=>e+t.totalSeconds,0),[e]),o=(0,L.useMemo)(()=>n.reduce((e,t)=>e+t.successes,0),[e]),s=(0,L.useMemo)(()=>n.reduce((e,t)=>e+t.successes+t.failures,0),[e]),{thisWeek:c,lastWeek:l,hasComparison:u}=(0,L.useMemo)(()=>{if(e.length<14)return{thisWeek:Pl([]),lastWeek:Pl([]),hasComparison:!1};let t=e.slice(-7),n=e.slice(-14,-7),r=Pl(t),i=Pl(n);return{thisWeek:r,lastWeek:i,hasComparison:i.runs>0}},[e]);if(i===0)return null;let d=s>0?o/s:1,f=d>=.9?C.green:d>=.7?C.warning:C.red;return(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:0,padding:`10px 16px`,marginBottom:20,background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:10,animation:`fadeInUp 0.4s ease-out both`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:`8px 16px`},children:[(0,B.jsx)(`span`,{style:{fontSize:10,fontWeight:600,color:C.muted,textTransform:`uppercase`,letterSpacing:.8,flexShrink:0},children:`This Week`}),(0,B.jsx)(`div`,{style:{display:`flex`,alignItems:`flex-end`,gap:4,flex:1,minWidth:0},children:n.map(e=>{let t=e.successes+e.failures,n=t>0?e.successes/t:1,i=e.runs===0?`var(--color-hover)`:n>=.9?C.green:n>=.7?C.warning:C.red,a=e.runs>0?Math.max(4,Math.round(e.runs/r*24)):2;return(0,B.jsxs)(`div`,{title:e.runs===0?`${e.label} \u2014 no runs`:`${e.label} \u2014 ${e.runs} run${e.runs===1?``:`s`}, ${Math.round(n*100)}% success, ${ze(e.totalSeconds)}`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:3,flex:1,minWidth:0,cursor:`default`},children:[(0,B.jsx)(`span`,{style:{fontSize:9,color:e.isToday?C.blue:C.muted,fontWeight:e.isToday?600:400,fontFamily:g,letterSpacing:-.3},children:e.label.slice(0,2)}),(0,B.jsx)(`div`,{style:{width:`100%`,maxWidth:28,height:a,borderRadius:2,background:i,opacity:e.runs===0?.3:.85,transition:`height 0.6s ease-out, opacity 0.3s ease`}}),e.runs>0&&(0,B.jsx)(`span`,{style:{fontSize:9,color:C.muted,fontFamily:`var(--font-mono)`,fontVariantNumeric:`tabular-nums`},children:e.runs})]},e.date)})}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,fontSize:12,fontFamily:g,color:C.textSecondary,flexShrink:0},children:[(0,B.jsxs)(`span`,{children:[i,` runs`]}),(0,B.jsx)(`span`,{style:{color:C.muted},children:`·`}),(0,B.jsx)(`span`,{children:ze(a)}),(0,B.jsx)(`span`,{style:{color:C.muted},children:`·`}),(0,B.jsxs)(`span`,{style:{color:f},children:[Math.round(d*100),`%`]})]})]}),u&&c.runs>0&&(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:`6px 20px`,paddingTop:8,marginTop:6,borderTop:`1px solid ${C.border}`},children:[(0,B.jsx)(`span`,{style:{fontSize:10,fontWeight:600,color:C.muted,textTransform:`uppercase`,letterSpacing:.8,flexShrink:0},children:`vs Last Week`}),(0,B.jsx)(Fl,{label:`Runs`,current:c.runs,previous:l.runs}),(0,B.jsx)(`span`,{style:{color:C.border,fontSize:10},children:`·`}),(0,B.jsx)(Fl,{label:`Success`,current:c.successRate,previous:l.successRate,formatFn:e=>`${Math.round(e*100)}%`}),(0,B.jsx)(`span`,{style:{color:C.border,fontSize:10},children:`·`}),(0,B.jsx)(Fl,{label:`Agent Time`,current:c.totalSeconds,previous:l.totalSeconds,formatFn:e=>ze(Math.round(e))})]})]})}function Ll(e,t){let n=new Set(t.filter(e=>e.lastStatus===`running`||e.lastStatus===`retrying`).map(e=>e.id)),r=new Set,i=[];for(let e of t)e.enabled||!e.pausedReason||r.has(e.id)||(r.add(e.id),i.push({kind:`paused`,jobId:e.id,jobName:e.name||e.id,timestamp:e.lastRun??new Date().toISOString(),evidenceTimestamp:e.lastRun??null,summary:e.pausedReason,isCurrentlyRunning:!1}));for(let t of e){if(r.has(t.jobId))continue;r.add(t.jobId);let e=t.status===`failed`?`failed`:t.status===`timeout`?`timeout`:t.status===`degraded`?`degraded`:null;e&&i.push({kind:e,jobId:t.jobId,jobName:t.jobName,timestamp:t.timestamp,evidenceTimestamp:t.timestamp,summary:t.summary||``,isCurrentlyRunning:n.has(t.jobId)})}return i}function Rl(e,t){if(!t)return!1;if(e.evidenceTimestamp===null)return!0;let n=Date.parse(e.evidenceTimestamp),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?!1:n<=r}function zl(e,t,n){return e.filter(e=>n.has(e.jobId)||!Rl(e,t[e.jobId]))}var Bl=3,Vl=260;function Hl({feed:e,jobs:t,onSelectJob:n,onRetry:r}){let{prefs:i,setPref:a}=he(),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(new Set),u=(0,L.useRef)(new Set);(0,L.useEffect)(()=>{let e=u.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[]);let d=(0,L.useMemo)(()=>Ll(e,t),[e,t]),f=(0,L.useMemo)(()=>zl(d,i.attentionDismissed??{},c),[d,i.attentionDismissed,c]),p=(0,L.useCallback)(e=>{let t=setTimeout(()=>{u.current.delete(t),l(t=>{if(e.every(e=>!t.has(e)))return t;let n=new Set(t);for(let t of e)n.delete(t);return n})},Vl);u.current.add(t)},[]),m=(0,L.useCallback)(e=>{l(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n});let t=new Date().toISOString();a(`attentionDismissed`,n=>({...n??{},[e]:t})),p([e])},[a,p]),h=(0,L.useCallback)(()=>{let e=f.filter(e=>!c.has(e.jobId)).map(e=>e.jobId);if(e.length===0)return;l(t=>{let n=new Set(t);for(let t of e)n.add(t);return n});let t=new Date().toISOString();a(`attentionDismissed`,n=>{let r={...n??{}};for(let n of e)r[n]=t;return r}),p(e)},[f,c,a,p]);if(f.length===0)return null;let _=o?f:f.slice(0,Bl),v=f.length-Bl,y=f.filter(e=>!c.has(e.jobId)).length;return(0,B.jsxs)(`div`,{style:{marginBottom:20,background:`rgba(248, 81, 73, 0.04)`,border:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.19)`,borderRadius:10,overflow:`hidden`,animation:`fadeInUp 0.4s ease-out both`},children:[(0,B.jsxs)(`div`,{style:{padding:`10px 16px 6px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{...k,fontSize:10,fontWeight:600,letterSpacing:.8,color:C.red},children:`Needs Attention`}),(0,B.jsx)(`span`,{style:{fontSize:10,fontWeight:600,color:C.red,background:`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.09)`,padding:`1px 6px`,borderRadius:4},children:f.length})]}),y>0&&(0,B.jsx)(`button`,{onClick:h,style:{background:`none`,border:`none`,color:C.muted,fontSize:11,cursor:`pointer`,padding:0,fontFamily:`inherit`,opacity:.7,transition:`opacity 0.15s ease, color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`,e.currentTarget.style.color=C.red},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.7`,e.currentTarget.style.color=C.muted},title:`Dismiss ${y} alert${y===1?``:`s`}; they reappear if the job fails again`,children:`Dismiss all`})]}),(0,B.jsx)(`div`,{style:{padding:`0 16px 8px`},children:_.map((e,t)=>{let i=c.has(e.jobId),a=e.kind===`degraded`||e.kind===`paused`,o=a?C.warning:C.red,s=a?`rgba(210,153,34,0.15)`:`var(--color-negative-soft)`,l=e.kind===`timeout`?`⏱`:e.kind===`degraded`?`◐`:e.kind===`paused`?`⏸`:`✗`,u=e.kind===`timeout`?`timeout`:e.kind===`degraded`?`degraded`:e.kind===`paused`?`auto-paused`:null,d=e.kind!==`paused`;return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`8px 0`,borderTop:t>0?`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.07)`:`none`,overflow:`hidden`,animation:i?`fadeOutShrink ${Vl}ms ease-in forwards`:`fadeInUp 0.25s ease-out both`,animationDelay:i?`0s`:`${t*.04}s`,pointerEvents:i?`none`:void 0},children:[(0,B.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:18,height:18,borderRadius:`50%`,background:s,flexShrink:0,marginTop:1,fontSize:10,color:o},children:l}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:2},children:[(0,B.jsx)(`span`,{onClick:()=>n(e.jobId),style:{fontSize:13,fontWeight:500,color:C.text,cursor:`pointer`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=C.blue},onMouseLeave:e=>{e.currentTarget.style.color=C.text},children:e.jobName}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,fontFamily:g,flexShrink:0},children:Be(e.timestamp)}),u&&(0,B.jsx)(`span`,{style:{fontSize:10,color:o,background:a?`rgba(210,153,34,0.12)`:`rgba(248,81,73,0.12)`,padding:`1px 5px`,borderRadius:4,flexShrink:0},children:u})]}),e.summary&&(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,lineHeight:1.4,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:Ve(e.summary,160)})]}),d?(0,B.jsx)(`button`,{className:`btn btn-sm failure-retry-btn`,onClick:t=>{t.stopPropagation(),r(e.jobId)},disabled:e.isCurrentlyRunning,style:{flexShrink:0,fontSize:11,padding:`3px 10px`,color:e.isCurrentlyRunning?C.muted:C.green,borderColor:e.isCurrentlyRunning?C.border:`hsl(var(--positive-h) var(--positive-s) var(--positive-l) / 0.25)`,cursor:e.isCurrentlyRunning?`default`:`pointer`,opacity:e.isCurrentlyRunning?.5:1,transition:`opacity 0.15s, border-color 0.15s`,marginTop:1},title:e.isCurrentlyRunning?`Already running`:`Retry this job`,children:e.isCurrentlyRunning?`⏳ Running`:`↻ Retry`}):(0,B.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>n(e.jobId),style:{flexShrink:0,fontSize:11,padding:`3px 10px`,color:C.warning,borderColor:`rgba(210,153,34,0.4)`,cursor:`pointer`,marginTop:1},title:`Open job to re-enable`,children:`Re-enable`}),(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),m(e.jobId)},"aria-label":`Dismiss alert for ${e.jobName}`,title:`Dismiss this alert (it returns if the job fails again)`,style:{flexShrink:0,width:22,height:22,marginTop:1,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,background:`transparent`,border:`1px solid transparent`,borderRadius:4,color:C.muted,fontSize:14,lineHeight:1,cursor:`pointer`,padding:0,opacity:.55,transition:`opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease`},onMouseEnter:e=>{let t=e.currentTarget;t.style.opacity=`1`,t.style.color=C.text,t.style.borderColor=`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.25)`,t.style.background=`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.08)`},onMouseLeave:e=>{let t=e.currentTarget;t.style.opacity=`0.55`,t.style.color=C.muted,t.style.borderColor=`transparent`,t.style.background=`transparent`},children:`✕`})]},e.jobId)})}),v>0&&(0,B.jsx)(`div`,{style:{padding:`4px 16px 10px`,borderTop:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.07)`},children:(0,B.jsx)(`button`,{onClick:()=>s(e=>!e),style:{background:`none`,border:`none`,color:C.red,fontSize:12,cursor:`pointer`,padding:0,fontFamily:`inherit`,opacity:.8,transition:`opacity 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.8`},children:o?`Show less`:`${v} more failure${v===1?``:`s`}`})})]})}var Ul=`claude-cron-last-visit`,Wl=6e4;function Gl(e){let t=new Date,n=new Date(e),r=(t.getTime()-e)/(1e3*60*60),i=n.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`});if(r<16)return i;let a=new Date(t);return a.setDate(a.getDate()-1),n.getDate()===a.getDate()&&n.getMonth()===a.getMonth()&&n.getFullYear()===a.getFullYear()?`yesterday at ${i}`:`${n.toLocaleDateString(`en-US`,{weekday:`short`})} at ${i}`}function Kl({feed:e}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(!0),[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(!1),c=(0,L.useRef)();(0,L.useEffect)(()=>{if(s.current||e.length===0)return;let t=localStorage.getItem(Ul),r=t?parseInt(t,10):0;if(!r){localStorage.setItem(Ul,Date.now().toString()),s.current=!0;return}let i=e.filter(e=>new Date(e.timestamp).getTime()>r&&(e.status===`success`||e.status===`failed`||e.status===`timeout`));if(i.length===0){localStorage.setItem(Ul,Date.now().toString()),s.current=!0;return}let a=i.filter(e=>e.status===`success`).length,o=i.length-a,c=i.reduce((e,t)=>e+(t.durationSeconds||0),0);n({total:i.length,successes:a,failures:o,totalDuration:c,sinceLabel:Gl(r)}),s.current=!0},[e]);let l=(0,L.useCallback)(()=>{o(!0),localStorage.setItem(Ul,Date.now().toString()),setTimeout(()=>i(!1),300)},[]);if((0,L.useEffect)(()=>{if(t)return c.current=setTimeout(l,Wl),()=>clearTimeout(c.current)},[t,l]),(0,L.useEffect)(()=>{let e=()=>{document.hidden&&s.current&&localStorage.setItem(Ul,Date.now().toString())};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),!t||!r)return null;let u=t.failures===0,d=t.successes===0,f=u?C.green:d?C.red:C.warning,p;return p=u?`${t.total} run${t.total===1?``:`s`} completed \u2014 all succeeded`:d?`${t.total} run${t.total===1?``:`s`} completed \u2014 ${t.failures} failed`:`${t.total} runs completed \u2014 ${t.successes} succeeded, ${t.failures} failed`,t.totalDuration>0&&(p+=` (${ze(t.totalDuration)} agent time)`),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 14px`,marginBottom:16,background:`${f}08`,border:`1px solid ${f}30`,borderRadius:8,fontSize:13,fontFamily:g,opacity:+!a,transform:a?`translateY(-4px)`:`translateY(0)`,transition:`opacity 0.3s ease, transform 0.3s ease`,animation:`fadeInUp 0.4s ease-out both`},children:[(0,B.jsx)(`span`,{style:{display:`inline-block`,width:6,height:6,borderRadius:`50%`,background:f,flexShrink:0}}),(0,B.jsxs)(`span`,{style:{color:C.textSecondary,flex:1},children:[(0,B.jsxs)(`span`,{style:{color:C.muted},children:[`Since `,t.sinceLabel,`:`]}),` `,p]}),(0,B.jsx)(`button`,{onClick:l,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,padding:`2px 4px`,fontSize:14,lineHeight:1,flexShrink:0,opacity:.6,transition:`opacity 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.6`},title:`Dismiss`,children:`×`})]})}var ql=20,Jl=80,Yl=`section-nav-position`;function Xl(){try{let e=localStorage.getItem(Yl);if(!e)return null;let t=JSON.parse(e);if(typeof t.x==`number`&&typeof t.y==`number`)return t}catch{}return null}function Zl(e,t){try{localStorage.setItem(Yl,JSON.stringify({x:e,y:t}))}catch{}}function Ql({sections:e,onReorder:t,onToggleVisibility:n,onReset:r}){let[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)([]),[u,d]=(0,L.useState)(!1),f=(0,L.useRef)(0),p=(0,L.useRef)(null),[m,h]=(0,L.useState)(Xl),g=(0,L.useRef)(null),[_,v]=(0,L.useState)(!1),y=(0,L.useRef)(null),[b,x]=(0,L.useState)(0),S=(0,L.useRef)(null),[w,T]=(0,L.useState)(!1),E=m?m.x<window.innerWidth/2:!1;(0,L.useEffect)(()=>{let t=()=>{cancelAnimationFrame(f.current),f.current=requestAnimationFrame(()=>{let t=window.scrollY>200;s(t);let n=e.filter(e=>{if(!e.visible)return!1;let t=document.getElementById(`nav-${e.id}`);return t&&t.offsetHeight>=ql});if(l(e=>e.length===n.length&&e.every((e,t)=>e.id===n[t].id)?e:n),!t||n.length===0)return;let r=window.scrollY+Jl+40,i=null;for(let e of n){let t=document.getElementById(`nav-${e.id}`);t&&t.offsetTop<=r&&(i=e.id)}a(i)})};window.addEventListener(`scroll`,t,{passive:!0}),window.addEventListener(`resize`,t,{passive:!0});let n=setTimeout(t,500);return()=>{window.removeEventListener(`scroll`,t),window.removeEventListener(`resize`,t),cancelAnimationFrame(f.current),clearTimeout(n)}},[e]),(0,L.useEffect)(()=>{if(!u)return;let e=e=>{p.current&&!p.current.contains(e.target)&&d(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[u]),(0,L.useLayoutEffect)(()=>{u&&y.current&&x(y.current.offsetWidth+24)},[u]);let D=u&&S.current!==null&&S.current!==E;(0,L.useEffect)(()=>{if(!u){T(!1),S.current=null;return}if(S.current!==null&&S.current!==E){T(!0);let e=setTimeout(()=>T(!1),350);return S.current=E,()=>clearTimeout(e)}S.current=E},[u,E]);let O=(0,L.useCallback)(e=>{if(e.target.closest(`button`))return;e.preventDefault();let t=p.current?.getBoundingClientRect();if(!t)return;g.current={startX:e.clientX,startY:e.clientY,origX:t.left,origY:t.top},v(!0);let n=e=>{if(!g.current)return;let t=e.clientX-g.current.startX,n=e.clientY-g.current.startY;h({x:g.current.origX+t,y:g.current.origY+n})},r=()=>{if(document.removeEventListener(`pointermove`,n),document.removeEventListener(`pointerup`,r),g.current=null,v(!1),p.current){let e=p.current.getBoundingClientRect();Zl(e.left,e.top)}};document.addEventListener(`pointermove`,n),document.addEventListener(`pointerup`,r)},[]),k=(0,L.useCallback)(e=>{let t=document.getElementById(`nav-${e}`);if(!t)return;let n=t.getBoundingClientRect().top+window.scrollY-Jl-12;window.scrollTo({top:n,behavior:`smooth`})},[]);if(!o)return null;let A=c.length>=3,j=m?{position:`fixed`,left:m.x,top:m.y,zIndex:90}:{position:`fixed`,right:24,top:`50%`,transform:`translateY(-50%)`,zIndex:90},M=e=>{let t=e===`bl`,n=[4,8,12].map((e,n)=>(0,B.jsx)(`path`,{d:t?`M 0 ${14-e} A ${e} ${e} 0 0 0 ${e} 14`:`M 14 ${14-e} A ${e} ${e} 0 0 1 ${14-e} 14`,fill:`none`,stroke:C.muted,strokeWidth:`1`},n));return(0,B.jsx)(`svg`,{className:`section-nav-grip`,width:14,height:14,style:{position:`absolute`,bottom:4,[t?`left`:`right`]:4},children:n},e)};return(0,B.jsxs)(`div`,{ref:p,className:`section-nav-wrapper`,style:{...j,padding:8,margin:-8,cursor:_?`grabbing`:`grab`,touchAction:`none`},onPointerDown:O,children:[(0,B.jsx)(`style`,{children:`
|
|
23
|
-
.section-nav-grip { opacity: 0; transition: opacity 0.2s ease; }
|
|
24
|
-
.section-nav-wrapper:hover .section-nav-grip { opacity: 0.5; }
|
|
25
|
-
@keyframes panelReveal { from { opacity: 0; } to { opacity: 1; } }
|
|
26
|
-
`}),(0,B.jsxs)(`nav`,{ref:y,className:`section-nav`,style:{position:`relative`,display:`flex`,flexDirection:`column`,gap:1,padding:`6px 4px`,background:`${C.darkBg}e6`,backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`,border:`1px solid ${C.border}`,borderRadius:10,animation:`fadeIn 0.3s ease-out`},children:[M(`bl`),M(`br`),A&&c.map(e=>{let t=i===e.id;return(0,B.jsxs)(`button`,{onClick:()=>k(e.id),title:e.label,style:{display:`flex`,alignItems:`center`,gap:7,padding:`5px 10px 5px 8px`,border:`none`,borderRadius:6,background:t?`var(--color-primary-soft)`:`transparent`,color:t?C.text:C.muted,fontSize:11,fontWeight:t?600:400,cursor:`pointer`,transition:`all 0.15s ease`,whiteSpace:`nowrap`,letterSpacing:.2,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif`},onMouseEnter:e=>{t||(e.currentTarget.style.background=`var(--color-border-strong)`,e.currentTarget.style.color=C.textSecondary)},onMouseLeave:e=>{t||(e.currentTarget.style.background=`transparent`,e.currentTarget.style.color=C.muted)},children:[(0,B.jsx)(`span`,{style:{width:5,height:5,borderRadius:`50%`,background:t?`var(--color-primary)`:`var(--color-muted-bg)`,flexShrink:0,transition:`all 0.2s ease`,boxShadow:t?`0 0 6px var(--color-primary)50`:`none`}}),e.label]},e.id)}),(0,B.jsx)(`button`,{onClick:()=>d(e=>!e),title:`Customize sections`,"aria-label":`Customize sections`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`4px 4px`,border:`none`,borderRadius:6,background:u?`var(--color-primary)20`:`transparent`,color:u?`var(--color-primary)`:`var(--color-text-muted)`,fontSize:12,cursor:`pointer`,transition:`all 0.15s ease`,marginTop:2},onMouseEnter:e=>{u||(e.currentTarget.style.background=`var(--color-border-strong)`,e.currentTarget.style.color=C.muted)},onMouseLeave:e=>{u||(e.currentTarget.style.background=`transparent`,e.currentTarget.style.color=`var(--color-text-muted)`)},children:`⚙`})]}),u&&(0,B.jsxs)(`div`,{className:`section-customize-panel`,style:{position:`absolute`,top:0,left:E?b:0,transform:E?`none`:`translateX(calc(-100% - 8px))`,animation:`panelReveal 0.12s ease-out both`,transition:D||w?`left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)`:`none`,minWidth:180,background:`${C.darkBg}e6`,backdropFilter:`blur(12px)`,WebkitBackdropFilter:`blur(12px)`,border:`1px solid ${C.border}`,borderRadius:10,padding:`8px 6px`},children:[(0,B.jsx)(`div`,{style:{fontSize:10,color:`var(--color-text-muted)`,textTransform:`uppercase`,letterSpacing:.5,padding:`2px 8px 6px`,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif`},children:`Sections`}),(0,B.jsx)(al,{sections:e,onReorder:t,onToggleVisibility:n,onReset:()=>{r(),d(!1)}})]})]})}var $l=[{id:`overview`,label:`Overview`,visible:!0},{id:`attention`,label:`Attention`,visible:!0},{id:`trends`,label:`Trends`,visible:!0},{id:`insights`,label:`Insights`,visible:!0},{id:`schedule`,label:`Schedule`,visible:!0},{id:`health`,label:`Health`,visible:!0},{id:`jobs`,label:`Jobs`,visible:!0}];function eu(e){let t=new Set(e.map(e=>e.id)),n=$l.filter(e=>!t.has(e.id)),r=new Set($l.map(e=>e.id));return[...e.filter(e=>r.has(e.id)),...n].map(e=>({id:e.id,label:e.label,visible:e.visible}))}function tu(){return $l.map(e=>({...e}))}function nu(){let{prefs:e,setPref:t,loaded:n}=he(),[r,i]=(0,L.useState)(tu),a=(0,L.useRef)(!1);(0,L.useEffect)(()=>{!n||a.current||(a.current=!0,e.sectionLayout&&e.sectionLayout.length>0&&i(eu(e.sectionLayout)))},[n,e.sectionLayout]);function o(e){i(e),t(`sectionLayout`,e)}function s(e){let t=new Map(r.map(e=>[e.id,e])),n=e.flatMap(e=>{let n=t.get(e);return n?[n]:[]}),i=new Set(e);for(let e of r)i.has(e.id)||n.push(e);o(n)}function c(e){o(r.map(t=>t.id===e?{...t,visible:!t.visible}:t))}function l(){o($l.map(e=>({...e})))}return{sections:r,setOrder:s,toggleVisibility:c,resetToDefaults:l}}function ru(e){switch(e){case`enable-self-improve`:return{label:`Enable optimization`,color:`var(--color-primary)`};case`prompt-growing`:return{label:`Prompt growing`,color:C.warning};case`duration-degrading`:return{label:`Slowing down`,color:C.red};default:return{label:e,color:C.muted}}}var iu={reliability:`⚠`,performance:`↗`,setup:`○`,schedule:`⏲`,maintenance:`⚙`},au={high:C.red,medium:C.warning,low:C.muted};function ou({onSelectJob:e}){let{prefs:t,setPref:n,loaded:r}=he(),[i,a]=(0,L.useState)([]),[o,s]=(0,L.useState)(new Set),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)([]),f=(0,L.useRef)(!1);(0,L.useEffect)(()=>{!r||f.current||(f.current=!0,t.advisorDismissed&&s(new Set(t.advisorDismissed)))},[r,t.advisorDismissed]),(0,L.useEffect)(()=>{fetch(`/api/suggestions`).then(e=>e.json()).then(e=>{Array.isArray(e)&&a(e)}).catch(()=>{})},[]),(0,L.useEffect)(()=>{fetch(`/api/token-optimizer/recommendations`).then(e=>e.json()).then(e=>{Array.isArray(e)&&d(e.filter(e=>e.type!==`prompt-optimal`))}).catch(()=>{})},[]);let p=(0,L.useCallback)(e=>{s(t=>{let r=new Set(t);return r.add(e),n(`advisorDismissed`,[...r]),r})},[n]),m=i.filter(e=>!o.has(e.id));if(m.length===0&&u.length===0)return null;let h=c?m:m.slice(0,4),g=m.length-4;return(0,B.jsxs)(`div`,{style:{marginBottom:20,background:`rgba(88, 166, 255, 0.04)`,border:`1px solid ${C.blue}25`,borderRadius:10,overflow:`hidden`,animation:`fadeInUp 0.4s ease-out both`},children:[(0,B.jsxs)(`div`,{style:{padding:`10px 16px 6px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{...k,fontSize:10,fontWeight:600,letterSpacing:.8,color:C.blue},children:`Advisor`}),m.length>0&&(0,B.jsx)(`span`,{style:{fontSize:10,fontWeight:600,color:C.blue,background:`${C.blue}18`,padding:`1px 6px`,borderRadius:4},children:m.length})]}),o.size>0&&(0,B.jsx)(`button`,{onClick:()=>{s(new Set),n(`advisorDismissed`,[])},style:{background:`none`,border:`none`,color:C.muted,fontSize:11,cursor:`pointer`,padding:0,fontFamily:`inherit`,opacity:.6,transition:`opacity 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.6`},title:`Restore dismissed suggestions`,children:`Restore dismissed`})]}),m.length>0&&(0,B.jsx)(`div`,{style:{padding:`0 16px 8px`},children:h.map((t,n)=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`8px 0`,borderTop:n>0?`1px solid ${C.blue}10`:`none`,animation:`fadeInUp 0.25s ease-out both`,animationDelay:`${n*.04}s`},children:[(0,B.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:18,height:18,borderRadius:`50%`,background:`${au[t.priority]}15`,flexShrink:0,marginTop:1,fontSize:10,color:au[t.priority]},children:iu[t.category]||`ℹ`}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:2},children:[(0,B.jsx)(`span`,{onClick:()=>e(t.jobId),style:{fontSize:13,fontWeight:500,color:C.text,cursor:`pointer`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=C.blue},onMouseLeave:e=>{e.currentTarget.style.color=C.text},children:t.jobName}),(0,B.jsx)(`span`,{style:{fontSize:10,color:au[t.priority],background:`${au[t.priority]}12`,padding:`1px 5px`,borderRadius:4,flexShrink:0,textTransform:`uppercase`,fontWeight:600,letterSpacing:.3},children:t.priority})]}),(0,B.jsx)(`div`,{style:{fontSize:12,color:C.textSecondary,lineHeight:1.3,marginBottom:1},children:t.message}),(0,B.jsx)(`div`,{className:`advisor-detail`,style:{fontSize:11,color:C.muted,lineHeight:1.4,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t.detail})]}),(0,B.jsx)(`button`,{onClick:e=>{e.stopPropagation(),p(t.id)},style:{flexShrink:0,background:`none`,border:`none`,color:C.muted,fontSize:14,cursor:`pointer`,padding:`0 2px`,lineHeight:1,opacity:.4,transition:`opacity 0.15s ease`,marginTop:1},onMouseEnter:e=>{e.currentTarget.style.opacity=`0.8`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.4`},title:`Dismiss this suggestion`,children:`✕`})]},t.id))}),g>0&&(0,B.jsx)(`div`,{style:{padding:`4px 16px 10px`,borderTop:`1px solid ${C.blue}10`},children:(0,B.jsx)(`button`,{onClick:()=>l(e=>!e),style:{background:`none`,border:`none`,color:C.blue,fontSize:12,cursor:`pointer`,padding:0,fontFamily:`inherit`,opacity:.8,transition:`opacity 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.8`},children:c?`Show less`:`${g} more suggestion${g===1?``:`s`}`})}),u.length>0&&(0,B.jsxs)(`div`,{style:{borderTop:`1px solid ${C.blue}15`,padding:`8px 16px 10px`},children:[(0,B.jsx)(`div`,{style:{marginBottom:6,paddingTop:2},children:(0,B.jsx)(`span`,{style:{...k,fontSize:10,fontWeight:600,letterSpacing:.8,color:`var(--color-primary)`},children:`Token Efficiency`})}),u.map((t,n)=>{let{label:r,color:i}=ru(t.type);return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`7px 0`,borderTop:n>0?`1px solid ${C.blue}10`:`none`,animation:`fadeInUp 0.25s ease-out both`,animationDelay:`${n*.04}s`},children:[(0,B.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,marginTop:1,fontSize:10,fontWeight:600,color:i,background:`${i}15`,padding:`2px 6px`,borderRadius:4,whiteSpace:`nowrap`},children:r}),(0,B.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,B.jsx)(`span`,{onClick:()=>e(t.jobId),style:{fontSize:13,fontWeight:500,color:C.text,cursor:`pointer`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=C.blue},onMouseLeave:e=>{e.currentTarget.style.color=C.text},children:t.jobName}),(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,marginTop:2,lineHeight:1.35},children:t.message})]})]},`${t.jobId}-${t.type}`)})]})]})}var su={pill:`_pill_p99en_1`,sizeSm:`_sizeSm_p99en_17`,sizeMd:`_sizeMd_p99en_17`,dot:`_dot_p99en_29`,icon:`_icon_p99en_37`,pulse:`_pulse_p99en_43`,variantWarning:`_variantWarning_p99en_51`};function cu({label:e,color:t,bg:n,size:r=`md`,pulse:i,title:a,onClick:o,variant:s=`default`,ariaLabel:c,icon:l}){let u=r===`sm`?su.sizeSm:su.sizeMd,d=s===`warning`?su.variantWarning:``,f=[su.pill,u,d].filter(Boolean).join(` `),p=s===`default`&&(t||n)?{"--pill-bg":n,"--pill-fg":t}:void 0,m=(0,B.jsxs)(B.Fragment,{children:[l&&(0,B.jsx)(`span`,{className:su.icon,"aria-hidden":!0,children:l}),i&&(0,B.jsx)(`span`,{className:`${su.dot} ${su.pulse}`}),e]});return o?(0,B.jsx)(`button`,{type:`button`,className:f,title:a,"aria-label":c,onClick:o,style:p,children:m}):(0,B.jsx)(`span`,{className:f,title:a,style:p,children:m})}var lu={"archive idea":{action:`guide`,guide:`Click "Archive" on a draft idea card or in the detail drawer to move it to the Archived column. Archive is a terminal status reachable only from draft — use it for ideas that have been superseded, deemed irrelevant, or otherwise abandoned without ever shipping.`},"archive draft":{action:`guide`,guide:`Click "Archive" on a draft idea card or in the detail drawer to move it to the Archived column. Archive is a terminal status reachable only from draft — use it for ideas that have been superseded, deemed irrelevant, or otherwise abandoned without ever shipping.`},"archived status":{action:`guide`,guide:`The Archived column on the Ideas board (collapsed by default at the end of the row) holds drafts that were intentionally retired without going through the pipeline. Archived ideas are excluded from the active count and never picked up by the orchestrator.`},"command palette":{action:`guide`,guide:`Press Cmd+K (or Ctrl+K) to open the command palette from anywhere.`},"keyboard shortcuts":{action:`guide`,guide:`Press ? anywhere to see all keyboard shortcuts.`},"schedule heatmap":{action:`scroll`,target:`[data-section="schedule"]`},"schedule density heatmap":{action:`scroll`,target:`[data-section="schedule"]`},"upcoming schedule":{action:`scroll`,target:`[data-section="schedule"]`},"weekly trend":{action:`scroll`,target:`[data-section="trends"]`},"week-over-week":{action:`scroll`,target:`[data-section="trends"]`},"daily report":{action:`guide`,guide:`The daily report view has been consolidated. Check the Jobs section and Activity Feed for per-job run summaries.`},"daily performance report card":{action:`guide`,guide:`The daily report view has been consolidated. Check the Jobs section and Activity Feed for per-job run summaries.`},"activity timeline":{action:`guide`,guide:`The Activity Timeline has been removed. Check the Activity Feed (press A) for a chronological run log, or the Health section for the Job Health Grid.`},"recent activity":{action:`guide`,guide:`The Activity Timeline has been removed. Check the Activity Feed (press A) for a chronological run log, or the Health section for the Job Health Grid.`},"run health grid":{action:`scroll`,target:`[data-section="health"]`},"run health":{action:`scroll`,target:`[data-section="health"]`},"job health grid":{action:`scroll`,target:`[data-section="health"]`},"agent outputs":{action:`guide`,guide:`Agent output details are available in the Job Detail modal and the Activity Feed. The dedicated Agent Outputs panel has been removed.`},"agent time budget":{action:`guide`,guide:`Runtime distribution across jobs is visible in the Job Detail modal Performance tab. The dedicated Agent Time Budget panel has been removed.`},"failure digest":{action:`scroll`,target:`[data-section="attention"]`},"self-improvement":{action:`scroll`,target:`[data-section="insights"]`},"self-improvement activity log":{action:`scroll`,target:`[data-section="insights"]`},"skill-aware self-improvement":{action:`guide`,guide:`Skill-based jobs with selfImprove enabled now automatically improve the SKILL.md file instead of the prompt field. Skill edits are tracked in results/<job-id>.skill-changelog.jsonl, and SEC-009 guards both prompt and skill file from truncation.`},"skill self-improvement":{action:`guide`,guide:`Self-improvement for skill-based jobs targets the SKILL.md file where execution logic lives. Enable selfImprove on any skill job — the system detects the skill reference automatically.`},"system advisor":{action:`scroll`,target:`[data-section="insights"]`},"lifetime stats":{action:`scroll`,target:`[data-section="overview"]`},"focus mode":{action:`panel`,target:`focus`},settings:{action:`panel`,target:`settings`},"activity feed":{action:`panel`,target:`activity`},briefs:{action:`panel`,target:`briefs`},"briefs tab":{action:`panel`,target:`briefs`},"edit brief title":{action:`guide`,guide:`On the Briefs tab, click the 3-dot button on any card → Edit title. The custom title persists across subsequent agent writes — auto-resolved titles will not overwrite it.`},"delete brief":{action:`guide`,guide:`On the Briefs tab, the 3-dot menu has a Delete option. A 5-second undo toast lets you recover; deletions stick across subsequent agent writes (the row stays hidden even if the agent keeps writing to the same URL).`},"brief detection":{action:`guide`,guide:`Briefs are auto-detected from agent tool calls. Write-style MCP tools (notion-update-page, Linear save_issue, slack_create_canvas, etc.) record the target URL as a brief; URLs that only appear in tool outputs are tracked as references and stay hidden by default.`},"cli crontab install/uninstall commands":{action:`guide`,guide:"Run `teamos cron install` to sync enabled jobs into the system crontab, or `teamos cron uninstall` to remove all TeamworkOS cron entries. Works without the gateway running."},"crontab sync":{action:`guide`,guide:`The sync status indicator is in the header, next to the Refresh button.`},"crontab sync status":{action:`guide`,guide:`The sync status indicator is in the header, next to the Refresh button.`},"cron expression builder":{action:`guide`,guide:`Open any job's edit modal — the schedule field is now a visual cron builder with Weekdays, Daily, Hourly, Weekly, and Custom modes.`},"visual cron expression builder":{action:`guide`,guide:`Open any job's edit modal — the schedule field is now a visual cron builder with Weekdays, Daily, Hourly, Weekly, and Custom modes.`},"job retry":{action:`guide`,guide:`Open any job's edit modal → set "Max retries" (1-5) and "Retry delay" in the Retry on Failure section.`},"job retry on failure":{action:`guide`,guide:`Open any job's edit modal → set "Max retries" (1-5) and "Retry delay" in the Retry on Failure section.`},"job dependencies":{action:`guide`,guide:`Open any job's edit modal → check jobs in the "Dependencies" section. The job will only run when all dependencies last succeeded.`},"per-job environment variables":{action:`guide`,guide:`Open any job's edit modal → add key-value pairs in the "Environment Variables" section at the bottom.`},"webhook path customization":{action:`guide`,guide:`Open any job's edit modal → in the Webhook Triggers section, click the path to edit it.`},"remote execution":{action:`guide`,guide:`Open any job's edit modal → enable "Run on remote machine" and configure the SSH host.`},"multi-machine":{action:`guide`,guide:`Open any job's edit modal → enable "Run on remote machine" and configure the SSH host.`},"browser notifications":{action:`guide`,guide:`Open Settings → Notifications section → click "Enable notifications".`},"job run notifications":{action:`guide`,guide:`Open Settings → Notifications section → click "Enable notifications".`},"pause all":{action:`guide`,guide:`Open Settings → Job Scheduling section → click "Pause All". Configure auto-pause schedules in the section below.`},"auto-pause":{action:`guide`,guide:`Open Settings → Auto-pause Schedules section to configure quiet hours, weekend pause, or custom schedules.`},"heartbeat maintenance":{action:`guide`,guide:`The gateway runs a two-loop maintenance automaton: safety (60s) cleans orphans and stale sessions, maintenance (5m) rotates logs, prunes SQLite, checkpoints WAL, cleans temp files, and monitors disk. View stats at GET /api/maintenance.`},"maintenance automaton":{action:`guide`,guide:`Configure thresholds in Settings under the maintenance key: sessionRetentionDays, diskWarningThresholdMb, dbWarningThresholdMb. The automaton runs automatically on gateway start.`},caffeinate:{action:`guide`,guide:`On macOS, the gateway automatically prevents idle sleep using caffeinate. No configuration needed — it starts and stops with the gateway.`},"chat session persistence":{action:`guide`,guide:`The chat panel (bottom-right sparkle button) now persists messages across browser refreshes.`},"prompt changelog":{action:`guide`,guide:`Expand any self-improving job's card → scroll to the "Prompt Evolution" section to see how the AI refined its prompt.`},"result markdown":{action:`guide`,guide:`Job results now render with proper Markdown formatting — headings, lists, code blocks, and links.`},"job templates":{action:`guide`,guide:`Click "+ Add Job" → choose a template from the "Start from" row at the top of the modal.`},"reliability indicators":{action:`scroll`,target:`#job-list-section`},"live running timer":{action:`guide`,guide:`Running jobs show a live elapsed timer with a progress bar directly on the collapsed card.`},"next run preview":{action:`guide`,guide:`Each enabled job card shows "Next: in Xh Ym" below its schedule.`},"duration analytics":{action:`guide`,guide:`Each job card shows a sparkline of recent run durations. Anomalies (>2x average) are highlighted in amber.`},"since last visit":{action:`guide`,guide:`A catch-up banner appears at the top when you open the dashboard after being away.`},"connection status":{action:`guide`,guide:`The header subtitle now shows "Live — updated Xs ago" with a live connection indicator.`},"live connection status":{action:`guide`,guide:`The header subtitle now shows "Live — updated Xs ago" with a live connection indicator.`},"timeout proximity":{action:`guide`,guide:`Job cards show a color-coded "⏱ X%" pill when the typical runtime is approaching the timeout limit.`},"estimated completion time":{action:`guide`,guide:`Running jobs show "typically Xm–Ym" based on historical p25-p75 durations.`},"run streak":{action:`guide`,guide:`Job cards show 🔥 N for success streaks (5+) or ⚡ N for failure streaks (2+).`},"last result preview":{action:`guide`,guide:`Collapsed job cards show a one-line preview of the most recent result.`},"section navigator":{action:`guide`,guide:`A floating mini-nav appears on the right edge when you scroll, showing labeled dots for each section.`},"daily pulse":{action:`guide`,guide:`The Daily Pulse panel has been removed. Check the Trends section for weekly activity data and the Activity Feed for a chronological run log.`},"daily activity pulse":{action:`guide`,guide:`The Daily Activity Pulse panel has been removed. Check the Trends section for weekly activity data and the Activity Feed for a chronological run log.`},"active time coverage":{action:`guide`,guide:`Active time coverage is no longer shown as a dedicated panel. Use the Health section to review job reliability and the Trends section for weekly run statistics.`},"running agents":{action:`guide`,guide:`The running agents bar appears automatically at the top of the dashboard whenever any jobs are active. Click a name to view details, or hit the × to cancel.`},"running agents bar":{action:`guide`,guide:`The running agents bar appears automatically at the top of the dashboard whenever any jobs are active. Click a name to view details, or hit the × to cancel.`},"prompt lab":{action:`guide`,guide:`Open any job's detail view → click "Prompt Lab" in the footer. Edit the prompt, click "Test Run", and see Claude's response without affecting history. Click "Apply to Job" to save your changes.`},"prompt lab (test & iterate)":{action:`guide`,guide:`Open any job's detail view → click "Prompt Lab" in the footer. Also accessible via Cmd+K → "Prompt Lab: <job name>".`},"agent observability":{action:`guide`,guide:`Running agents emit [PROGRESS] lines that appear in real time in the Running Agents bar and on each job card. Expand a running card to see the full progress timeline.`},"structured progress":{action:`guide`,guide:`Agents emit [PROGRESS] step N/M: message during execution. The dashboard captures and displays these in real time — in the Running Agents bar, the Job Card header, and the expanded progress timeline.`},"progress reporting":{action:`guide`,guide:`Agents automatically receive instructions to emit [PROGRESS] lines via the injected template. View live progress in the Running Agents bar or expand a running job card.`},"dry run":{action:`guide`,guide:`The Prompt Lab lets you dry-run prompts. Open via Job Detail → Prompt Lab, or hit POST /api/jobs/<id>/dry-run directly.`},"smart scheduling":{action:`guide`,guide:`Open Settings → Scheduling section to set Max Concurrent Jobs. When at the limit, new jobs are queued by priority. Set per-job priority in the Job Modal. The queue is visible on the dashboard when active, and via GET /api/queue.`},"scheduling queue":{action:`guide`,guide:`The queue appears automatically on the dashboard when jobs are waiting. You can also check queue status via GET /api/queue.`},"job priority":{action:`guide`,guide:`Open any job's edit modal → set the Priority selector (Critical/High/Normal/Low). Higher priority jobs run first when the queue is active.`},concurrency:{action:`guide`,guide:`Open Settings → Scheduling → Max Concurrent Jobs to control how many agents can run simultaneously. Default is 3.`},"agent mailbox":{action:`guide`,guide:`Inter-agent messaging is available via CLI: teamos mailbox list, teamos mailbox send <from> <to> <subject>. Agents automatically receive pending messages at startup.`},"agent collaboration":{action:`guide`,guide:`Agents can send messages to each other via the mailbox. Messages are automatically injected into a job's prompt on startup. Use CLI: teamos mailbox list, teamos mailbox send <from> <to> <subject>.`},"inter-agent messaging":{action:`guide`,guide:`Agents send messages by appending JSON to results/.agent-mailbox.jsonl. On startup, pending messages for the job are injected into the prompt. Use CLI: teamos mailbox list, teamos mailbox send <from> <to> <subject>.`},"goal wizard":{action:`guide`,guide:`Click the "✨ Goal" button in the header or use Cmd+K → "Goal Wizard". Describe what you want automated in plain English, and Claude will generate jobs with prompts, schedules, and dependencies — ready for review before creation.`},"goal-oriented generation":{action:`guide`,guide:`The Goal Wizard lets you describe an automation goal in natural language. Claude decomposes it into one or more scheduled jobs, which you can review, edit, and create in one click.`},"adaptive timeout tuning":{action:`guide`,guide:`Timeouts auto-calibrate based on historical p75/p95 durations. Toggle in Settings → Scheduling → Auto-Tune Timeouts. Per-job suggestions appear in the Job Modal's Timeout field when editing an existing job.`},"auto-tune timeouts":{action:`guide`,guide:`Open Settings → Scheduling → Auto-Tune Timeouts toggle. When enabled, job timeouts are automatically adjusted after each successful run based on historical performance. Per-job suggestions also appear in the Job Modal.`},"timeout recommendation":{action:`guide`,guide:`Edit any job with run history → the Timeout field shows p75/p95 stats and a "Suggest Xs" button when the current timeout diverges from actual performance.`},"missed run detection":{action:`guide`,guide:`Missed run detection works automatically — when your machine wakes from sleep, an amber banner shows which jobs missed their scheduled runs and catch-up runs are queued automatically.`},"missed run":{action:`guide`,guide:`When your machine wakes from sleep, the gateway detects missed scheduled runs and queues catch-up runs. An amber banner at the top of the dashboard shows the status.`},"dashboard section customizer":{action:`guide`,guide:`Scroll down until the right-side section nav appears, then click the gear icon at its bottom to reorder or hide sections.`},"section visibility":{action:`guide`,guide:`Click the gear icon on the section nav (right side) to show/hide sections and drag to reorder them.`},"launchd service":{action:`guide`,guide:"Run `teamos install` to register the gateway as a macOS launchd service. It auto-starts on login and auto-restarts on crash. Use `teamos uninstall` to remove. Check `teamos status` to see launchd state."},"service management":{action:`guide`,guide:"The `teamos` CLI manages the gateway: `teamos start`, `teamos stop`, `teamos restart`, `teamos status`, `teamos install` (launchd), `teamos uninstall`."},"webhook hosting":{action:`guide`,guide:"Run `teamos tunnel` to expose webhook endpoints via Tailscale Funnel. Use `teamos webhook list` to see all configured webhooks, and `teamos webhook test <path>` to send a test POST locally."},"tailscale tunnel":{action:`guide`,guide:"Run `teamos tunnel` to start a Tailscale Funnel that exposes your gateway to the internet. The public URL and all webhook endpoints are printed on startup. Press Ctrl+C to stop."},"webhook management":{action:`guide`,guide:"`teamos webhook list` shows all jobs with webhook triggers in a table. `teamos webhook test <path> --data '{}'` sends a test POST to validate the endpoint locally before connecting external services."},"employee boundaries":{action:`guide`,guide:'Add a `"boundaries"` array to any employee JSON in `org/`. Each boundary is injected as a hard constraint in the agent\'s system prompt. Example: `"boundaries": ["Never modify production databases"]`.'},"security guardrails":{action:`guide`,guide:`Employee boundaries, CLI flags, and overage protection work together to enforce security. Boundaries are prompt-level constraints, cliFlags configure the Claude CLI per-employee, and allowOverage controls cost guardrails.`},boundaries:{action:`guide`,guide:`Boundaries are hard constraints defined in employee JSON files. They appear as an ESSENTIAL section in the system prompt, right after the agent's identity, and are never trimmed for context.`},"cli flags":{action:`guide`,guide:'Add `"cliFlags": ["--max-turns", "50"]` to an employee JSON to pass extra CLI arguments to Claude for that employee\'s sessions.'},"overage protection":{action:`guide`,guide:"Set `allowOverage: false` in Settings > Engine to prevent agents from approving extended usage credits. Default is true (overage allowed)."},"allow overage":{action:`guide`,guide:`The allowOverage setting in Settings > Engine controls whether agents can approve overage spending. When false, a system prompt instruction tells every agent to decline.`},"rate limit forecasting":{action:`guide`,guide:"Usage tracking is automatic. Check `GET /api/usage` for current state. When rate-limited, agents receive a system prompt warning to be efficient."},"usage monitoring":{action:`guide`,guide:"The gateway tracks total cost, session count, and rate limit events in `results/usage-state.json`. View via `GET /api/usage`. Near-rate-limit warnings are injected into agent prompts automatically."},"tool policy":{action:`guide`,guide:"The ToolPolicy module provides engine-agnostic tool authorization. Claude engine calls pass through (Claude Code handles its own security). Non-Claude engines enforce a hard deny list, employee boundary checks, rank escalation guards, and per-employee allowlists. Configure `allowedTools` in employee JSON files."},"engine tool authorization":{action:`guide`,guide:"Non-Claude engines (e.g., Ollama) pass every tool call through ToolPolicy before execution. Tools on the hard deny list (Bash, Write, Edit, get_session, list_sessions) are always blocked. Employee boundaries and allowlists provide additional control. Audit logs are at `results/tool-audit.jsonl`."},"ollama engine":{action:`guide`,guide:`Configure Ollama in settings: add engine.ollama with host, defaultModel, timeoutMs, maxToolCalls, maxTurns. Assign employees with "engine": "ollama" in their org JSON. The engine hits /api/chat with tool-use loop, ToolPolicy authorization, and credential filtering. View health via teamos engines list.`},ollama:{action:`guide`,guide:`The Ollama engine enables local/remote model execution. Configure host in Settings → Engine → Ollama. Assign employees with "engine": "ollama". Supports tool calling, streaming, circuit breaker, and prompt injection mitigation.`},"local model":{action:`guide`,guide:`Run employees on a local Ollama instance by setting engine.ollama.host in settings and assigning "engine": "ollama" to employees. The engine handles tool calling, streaming, and security automatically.`},"engine badge":{action:`guide`,guide:`Employee cards in the Org Grid and Org Map show a cyan badge for non-Claude engines (e.g., "ollama"). The Employee Detail panel shows the engine in a read-only Configuration section.`},"engine dashboard":{action:`guide`,guide:"The dashboard shows engine assignments on employee cards (Org Grid, Org Map) and in the Employee Detail panel. Use `teamos engines list` for a CLI table with host and model info, and `teamos status` for a health summary."},"teamos init":{action:`guide`,guide:"Run `teamos init` for the interactive setup wizard. Checks prerequisites (Node, claude, tmux), creates ~/.teamwork directories, starts the gateway, and offers to install the service. Use `teamos init --yes` for non-interactive CI/CD bootstrapping."},onboarding:{action:`guide`,guide:"Run `teamos init` to get started. The wizard walks through prerequisite checks, directory setup, gateway startup, and service installation. Use `--yes` to accept all defaults."},"teamos doctor":{action:`guide`,guide:"Run `teamos doctor` for 10-point health diagnostics: Node version, claude binary, tmux, TEAMWORK_HOME, gateway build/running, engine health, settings validity, stale PIDs, service status. Use `--fix` to auto-repair, `--json` for CI."},diagnostics:{action:`guide`,guide:"Run `teamos doctor` to diagnose issues. It checks 10 items and reports PASS/WARN/FAIL for each. `teamos doctor --fix` auto-repairs stale PIDs and missing directories. Exit code 1 if any check fails."},"teamos config":{action:`guide`,guide:"`teamos config list` shows all settings. `teamos config get engine.default` reads a value. `teamos config set maxConcurrentJobs 5` writes a value. `teamos config reset` restores defaults. `teamos config path` shows the file path."},"config management":{action:`guide`,guide:"Manage settings from the CLI: `teamos config get <key>`, `teamos config set <key> <value>`, `teamos config list`, `teamos config reset`. Dot-notation supported for nested keys (e.g., engine.default)."},"teamos backup":{action:`guide`,guide:"`teamos backup create` archives ~/.teamwork to a .tar.gz. `teamos backup list` shows available backups. `teamos backup restore <file>` restores (with confirmation). `teamos backup prune --keep 5` removes old backups."},backup:{action:`guide`,guide:"Run `teamos backup create` before risky operations. Backups go to ~/.teamwork/backups/. Restore with `teamos backup restore <file>`. Verify with `teamos backup verify <file>`. Auto-prune with `teamos backup prune`."},"teamos update":{action:`guide`,guide:"Run `teamos update` to pull latest changes, install dependencies, and rebuild. `--check` previews without applying. `--dry-run` shows steps. `--force` handles dirty git trees. Rolls back automatically on build failure."},"self-update":{action:`guide`,guide:"The `teamos update` command auto-detects git installations and runs pull + install + build. Always suggests `teamos backup create` first. Use `--check` to preview updates without applying."},"teamos logs":{action:`guide`,guide:"`teamos logs` shows recent gateway log lines. `teamos logs <jobId>` shows a specific job's log. `teamos logs -n 20` limits output. Default is 50 lines."},"log viewer":{action:`guide`,guide:"View logs from the CLI: `teamos logs` for gateway, `teamos logs <jobId>` for a specific job. Use `-n` to set line count."},"teamos completion":{action:`guide`,guide:"Generate shell completions: `teamos completion bash`, `teamos completion zsh`, `teamos completion fish`. Add `--install` to auto-configure your shell. Covers all commands and subcommands."},"shell completion":{action:`guide`,guide:"Run `teamos completion bash --install` (or zsh/fish) to enable tab completion. Restart your shell after installing. Completions cover all commands, subcommands, and flags."},"teamos dashboard":{action:`guide`,guide:"Run `teamos dashboard` to open the web dashboard in your default browser. Use `--url` to print the URL without opening."},"teamos version":{action:`guide`,guide:"Run `teamos version` to see CLI version, gateway version, Node version, platform, and TEAMWORK_HOME path. Useful for debugging version mismatches."},systemd:{action:`guide`,guide:"On Linux, `teamos install` creates a systemd user service at ~/.config/systemd/user/teamwork-os.service. Auto-starts on login, restarts on crash. Use `teamos uninstall` to remove. `teamos doctor` checks service status."},"linux service":{action:`guide`,guide:"Linux users: run `teamos install` to register a systemd user service. The gateway auto-starts on login and auto-restarts on failure. Manage with `systemctl --user status teamwork-os`."},"cron crud":{action:`guide`,guide:"`teamos cron enable <id>` and `teamos cron disable <id>` toggle jobs. `teamos cron delete <id>` removes a job (requires --yes or confirmation). Full CRUD alongside existing `teamos cron list` and `teamos cron run`."},"org crud":{action:`guide`,guide:"`teamos org show <name>` displays full employee JSON. `teamos org create <name> --department <dept> --rank <rank>` creates employees. `teamos org delete <name>` removes them (requires confirmation)."},"production cli":{action:`guide`,guide:`The teamos CLI now has 32 commands: lifecycle (start/stop/restart/status), service (install/uninstall), onboarding (init), diagnostics (doctor/version), config, backup, update, logs, completion, cron CRUD, org CRUD, webhooks, sessions, tunnel, dashboard, engines.`},"team flow":{action:`guide`,guide:`Multi-agent orchestration lives in the Team flow (seam-v1). Pick a coordination hint — Auto (lead decides), Subagent (lead delegates one subagent at a time, hub-and-spoke), or Team (teammates share a task list and message each other directly, peer-to-peer) — and a team of named participants. Create via the job modal "Team" flow selector.`},"dashboard simplification":{action:`guide`,guide:`The dashboard was simplified to focus on actionable information: Stats, Attention, Trends, Insights, Schedule, Health, and Jobs.`},"memory hygiene":{action:`guide`,guide:"The Memory Health card (top of the #/memory page) shows a live hygiene report for the file-based memory directory: total files, orphan count, dangling MEMORY.md pointers, structure compliance %, and freshness %. Use the `memory_health` MCP tool or GET /api/memory/hygiene for programmatic access. Full format spec: docs/memory-conventions.md."},"memory health":{action:`guide`,guide:`Navigate to #/memory. The Memory Health card at the top shows the hygiene report for ~/.claude/projects/<dir>/memory/ — total files, orphans, dangling pointers, structure compliance %, and freshness %. Hit Refresh to re-run on demand.`},"memory lint":{action:`guide`,guide:"Use the `memory_lint` MCP tool or GET /api/memory/hygiene/lint?project=claude-cron to get the raw lint result: orphans, dangling MEMORY.md pointers, frontmatter violations, structure violations (feedback files missing Why/How), and undocumented type values."},"memory conventions":{action:`guide`,guide:`Memory files use YAML frontmatter with required fields: name, description, type (user|feedback|project|reference). Feedback files also need **Why:** and **How to apply:** sections. See docs/memory-conventions.md for the full Level 2 spec including id, namespace, confidence, tags, and valid_until.`},"pr reconciler":{action:`guide`,guide:`The gateway runs a periodic PR reconciler that mirrors GitHub PR state into idea records. It is the sole writer of prUrl, prMergedAt, and prClosedAt. The Ideas page auto-fires a reconcile pass on first paint and on tab focus (throttled to once a minute), so the kanban converges without you clicking anything. A small red dot appears on the "PR Reconciler" header button only when the most recent pass returned an error; clicking it opens the diagnostic drawer with last-run timing, transition counts (merged/closed/changes-requested/no-op), the error detail, recent runs, and a manual "Reconcile now" button. Pre-flight short-circuits to merged/closed when a worktree-failed branch already has a shipped PR.`},reconciler:{action:`guide`,guide:'The gateway runs a periodic PR reconciler that mirrors GitHub PR state into idea records. The Ideas page auto-fires a reconcile pass on first paint and on tab focus (throttled). A red dot on the "PR Reconciler" header button signals errors; the button opens a diagnostic drawer with last-run details and a manual "Reconcile now" trigger. CLI: `teamos ideas reconcile`.'},"auto reconcile":{action:`guide`,guide:`The Ideas page reconciles GitHub PR state automatically on first paint and on tab focus (throttled to once per minute), replacing the always-visible reconciler card. The "PR Reconciler" header button remains as the entry to a diagnostic drawer; a small red dot on it signals when the most recent pass returned an error.`},"reconcile now":{action:`panel`,target:`ideas`},"memory steward":{action:`guide`,guide:`The Memory page now has a "Hygiene" tab with three sections: Proposals Inbox (pending judgment-call proposals with approve/reject), Steward Run Log (recent autonomous runs with auto-fix counts and durations), and Cross-Project Trends (sparklines of structure and freshness over time). Cluster cards on the Memory Health overview open a drill-down modal with a Synthesize button that drafts a synthesis page via a haiku session. Settings page > Memory tab gates the steward via memorySteward.enabled toggle and memorySteward.scheduleMs cadence.`},"memory steward subsystem":{action:`guide`,guide:`A gateway-internal scheduler runs the markdown memory hygiene primitives every 24h by default, plus an fs.watch validator that fires on every memory write. Auto-fix applies safe deterministic repairs (MEMORY.md regeneration, empty-dir prune, broken-path tombstoning); judgment calls (synthesis, contradictions) emit proposals to the Hygiene tab inbox for operator review.`},"memory hygiene tab":{action:`guide`,guide:`New 4th tab on the Memory page. Houses the Proposals Inbox, Steward Run Log, and Cross-Project Trends. Approving a proposal dispatches the steward to execute it; rejecting persists the reason so future runs avoid re-proposing the same change for the same target.`},"proposals inbox":{action:`guide`,guide:`On the Memory page > Hygiene tab. Pending judgment-call proposals from the memory steward (cluster synthesis drafts, deprecation tombstones, contradiction resolutions) appear with diff preview, Approve, and Reject buttons. Rejection takes a free-text reason; future steward runs dedupe against rejected proposals.`},"cluster drill down":{action:`guide`,guide:`On the Memory page, the Memory Health card now has clickable cluster cards. Clicking opens a modal with all member memories rendered in markdown, file dates, and a Synthesize button that dispatches the steward judgment.ts to draft a synthesis page. The resulting proposal lands in the Hygiene tab inbox.`},"task-driven implementing":{action:`guide`,guide:'The implementing pipeline phase walks plan tasks one at a time. Each task gets its own marker, its own retry, and its own verifier check. Per-task trace events with `taskIndex` render as "Task N: <goal>" rows under the implementing phase node in the Pipeline timeline. On gateway restart mid-phase, the orchestrator reads the trace, re-verifies each "passed" task on disk, and resumes at the first unverified task.'},"plan task cap":{action:`guide`,guide:"Plans with more than `pipelineFeatures.writingPlans.maxTasks` (default 15) are rejected by the writing-plans phase with a [fatal] error so the autonomy ladder halts immediately. Adjust the cap in Ideas Settings → Implementing phase (task-driven) → Plan task cap."},"restart resilience":{action:`guide`,guide:"On gateway restart mid-implementing, the orchestrator scans `<run>/trace.ndjson` for tasks that already passed in the current `runId`, re-verifies each one against the current worktree, and resumes at the first task that is either unverified or has missing deliverables. Tasks 1..N-1 are not redone; only the in-flight or remaining tasks run."},"state as truth":{action:`guide`,guide:"Pipeline phase position is recorded in `~/.teamwork/data/idea-runs/<idea-id>/state.json` at every orchestrator transition: phase pass, phase halt, PR open, out-of-repo done, and blocked exit paths. The state.json `pr-observed` write happens BEFORE the YAML status:opened write so the two sources stay in sync even if a downstream step (auto-merge enable, watcher start) throws. Phase prompts no longer require terminal markers (PLAN_DONE, REVIEW_DONE); outcome is derived from exit-code + on-disk verification."},"in-flight notebook":{action:`guide`,guide:`Enable in Ideas Settings → "In-flight notebook" toggle. When on, phase agents are invited to emit notebook entries mid-run using the notebook: title= / notebook: body= / notebook: end protocol. Entries are harvested into draft ideas after each run. View them in the Notebook tab of the idea detail drawer.`},"inflight notebook":{action:`guide`,guide:`Enable in Ideas Settings → "In-flight notebook" toggle. When on, phase agents are invited to emit notebook entries mid-run using the notebook: title= / notebook: body= / notebook: end protocol. Entries are harvested into draft ideas after each run. View them in the Notebook tab of the idea detail drawer.`},"notebook tab":{action:`guide`,guide:`Open any idea's detail drawer. The Notebook tab (visible when inflightNotebookEnabled is on) lists every note emitted by phase agents, with the emitting phase and body. Notes that have been harvested into a draft idea show a "drafted" badge.`},"notebook jotter":{action:`guide`,guide:`The in-flight notebook jotter lets phase agents surface insights mid-run. Enable in Ideas Settings. Agents emit notebook: title= / notebook: body= / notebook: end lines to stdout; the gateway parses, stores, and harvests them as draft ideas after the run.`},"phase pattern learning":{action:`guide`,guide:'The pipeline now accumulates per-phase patterns (e.g., implementing pitfalls) separately from review findings. Review-phase `note-only` findings route to `~/.teamwork/projects/<slug>/patterns/implementing.ndjson`. Before each implementing run, `.claude/rules/development/implementation-patterns.md` is injected as a `## Phase-specific patterns` block if it exists. A new `pipeline-self-improve --phase implementing` mode clusters 7-day entries across projects and creates draft ideas for promotion. Toggle via Ideas Settings > "Phase-specific pattern learning".'}};function uu(e){let t=e.toLowerCase();for(let[e,n]of Object.entries(lu))if(t.includes(e))return n;return null}var du={ui:{label:`UI`,color:`var(--color-primary)`,bg:`rgba(188,140,255,0.12)`},functional:{label:`Functional`,color:`var(--color-positive)`,bg:`rgba(63,185,80,0.12)`},fix:{label:`Fix`,color:C.warning,bg:`rgba(210,153,34,0.12)`},removal:{label:`Removed`,color:`var(--color-negative)`,bg:`rgba(248,81,73,0.12)`}};function fu({open:e,onClose:t,onUnreadCountChange:n}){let[r,i]=(0,L.useState)([]),[a,o]=(0,L.useState)(new Set),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(!1),p=(0,L.useRef)(!1);(0,L.useEffect)(()=>{!e&&p.current||Promise.all([fetch(`/api/changelog`).then(e=>e.json()).catch(()=>[]),fetch(`/api/changelog/read`).then(e=>e.json()).catch(()=>[])]).then(([e,t])=>{i(Array.isArray(e)?e:[]),o(new Set(Array.isArray(t)?t:[])),p.current=!0})},[e]),(0,L.useEffect)(()=>{if(!p.current)return;let e=r.filter(e=>!a.has(e.id)).length;n?.(e)},[r,a,n]),(0,L.useEffect)(()=>{if(!e||r.length===0)return;let t=r.filter(e=>!a.has(e.id)).map(e=>e.id);t.length!==0&&(o(e=>new Set([...e,...t])),fetch(`/api/changelog/read`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({ids:t})}).catch(()=>{}))},[e,r]);let m=(0,L.useCallback)(e=>{t(),e.action===`scroll`&&e.target&&setTimeout(()=>{let t=document.querySelector(e.target);t&&t.scrollIntoView({behavior:`smooth`,block:`center`})},300)},[t]),h=l?r.filter(e=>e.title.toLowerCase().includes(l.toLowerCase())||e.description.toLowerCase().includes(l.toLowerCase())):r;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:t,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.5)`,zIndex:999,opacity:+!!e,pointerEvents:e?`auto`:`none`,transition:`opacity 0.2s ease`}}),(0,B.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`What's new`,style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:440,maxWidth:`90vw`,background:`var(--color-bg)`,borderLeft:`1px solid ${C.border}`,zIndex:1e3,transform:e?`translateX(0)`:`translateX(100%)`,transition:`transform 0.25s ease`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{padding:`16px 20px 12px`,borderBottom:`1px solid ${C.border}`,flexShrink:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:10},children:[(0,B.jsx)(`h2`,{style:{fontSize:16,fontWeight:600,margin:0},children:`What's New`}),(0,B.jsx)(`button`,{onClick:t,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),"aria-label":`Close changelog`,style:{background:`none`,border:`none`,color:C.muted,fontSize:18,cursor:`pointer`,padding:`2px 6px`,opacity:d?1:.6,transition:`opacity 0.15s`},children:`✕`})]}),(0,B.jsx)(`input`,{type:`text`,placeholder:`Search changes...`,"aria-label":`Search changelog`,value:l,onChange:e=>u(e.target.value),style:{width:`100%`,boxSizing:`border-box`,background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${C.border}`,borderRadius:6,padding:`6px 10px`,fontSize:13,outline:`none`}})]}),(0,B.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`12px 20px`},children:h.length===0?(0,B.jsx)(`div`,{style:{color:C.muted,fontSize:13,textAlign:`center`,padding:`24px 0`},children:l?`No matching entries`:`No changelog entries yet`}):h.map(e=>{let t=s===e.id,n=uu(e.title),r=du[e.type]||du.ui;return(0,B.jsxs)(`div`,{style:{padding:`12px 14px`,background:`var(--color-subtle-bg)`,borderRadius:8,border:`1px solid ${C.border}`,marginBottom:10,transition:`all 0.2s ease`},children:[(0,B.jsxs)(`div`,{role:`button`,tabIndex:0,style:{cursor:`pointer`},onClick:()=>c(t?null:e.id),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),c(t?null:e.id))},"aria-expanded":t,children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:4},children:[(0,B.jsx)(cu,{label:r.label,color:r.color,bg:r.bg,size:`sm`}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted},children:new Date(e.date+`T12:00:00`).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})})]}),(0,B.jsxs)(`div`,{style:{fontSize:14,fontWeight:600,color:C.text,display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{fontSize:10,color:C.muted,transform:t?`rotate(90deg)`:`rotate(0)`,transition:`transform 0.15s ease`,display:`inline-block`},children:`▶`}),e.title]})]}),t&&(0,B.jsxs)(`div`,{style:{marginTop:10},children:[(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary,lineHeight:1.6,marginBottom:10},children:(0,B.jsx)(Ks,{components:{p:({children:e})=>(0,B.jsx)(`p`,{style:{margin:`0 0 8px`},children:e}),a:({href:e,children:t})=>(0,B.jsx)(`a`,{href:e,style:{color:`var(--color-info)`},children:t}),code:({children:e})=>(0,B.jsx)(`code`,{style:{background:`rgba(110,118,129,0.4)`,padding:`1px 5px`,borderRadius:3,fontSize:12,fontFamily:`var(--font-mono)`},children:e}),strong:({children:e})=>(0,B.jsx)(`strong`,{style:{color:C.text},children:e})},children:e.description})}),e.files.length>0&&(0,B.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginBottom:10},children:e.files.map(e=>(0,B.jsx)(`span`,{style:{fontSize:10,fontFamily:`var(--font-mono)`,color:C.muted,background:`var(--color-bg-raised)`,padding:`2px 6px`,borderRadius:3,border:`1px solid ${C.border}`},children:e},e))}),n&&(n.action===`guide`||n.guide?(0,B.jsxs)(`div`,{style:{padding:`8px 10px`,borderRadius:6,background:`rgba(63, 185, 80, 0.06)`,border:`1px solid rgba(63, 185, 80, 0.2)`,fontSize:12,color:C.textSecondary,lineHeight:1.5},children:[(0,B.jsx)(`span`,{style:{color:C.green,fontWeight:600,marginRight:6},children:`How to use:`}),n.guide]}):n.action===`scroll`||n.action===`panel`?(0,B.jsx)(`button`,{onClick:()=>m(n),style:{background:`rgba(88, 166, 255, 0.1)`,border:`1px solid rgba(88, 166, 255, 0.3)`,color:`var(--color-info)`,fontSize:12,fontWeight:500,padding:`5px 12px`,borderRadius:6,cursor:`pointer`,transition:`all 0.15s ease`},children:`Show me →`}):null)]})]},e.id)})})]})]})}var pu=5,mu=[{icon:`⏰`,title:`Jobs`,desc:`Scheduled tasks that run Claude Code agents on your behalf`,accent:`var(--color-primary)`},{icon:`📅`,title:`Schedules`,desc:`Cron expressions with a visual builder — daily, hourly, weekdays, or custom`,accent:`var(--color-positive)`},{icon:`✨`,title:`Self-Improvement`,desc:`Agents that evaluate their own runs and evolve their prompts over time`,accent:`var(--color-info)`},{icon:`📊`,title:`Results`,desc:`Structured outputs with action items, links, and Markdown-rendered content`,accent:C.warning}],hu=[{icon:`📊`,label:`Stats strip`,desc:`Totals and the latest success/failure at a glance, right under the Cron header.`,accent:`var(--color-positive)`},{icon:`⏱️`,label:`Upcoming & activity`,desc:`See what’s about to run, what just ran, and the live feed of every session event.`,accent:`var(--color-primary)`},{icon:`⚕️`,label:`Run health & advisor`,desc:`Spots failing jobs, overdue runs, and token-heavy prompts — the things you’d otherwise miss.`,accent:C.warning},{icon:`📄`,label:`Jobs list`,desc:`Every scheduled agent. Edit, disable, trigger, snooze, or inspect past runs from each row.`,accent:`var(--color-negative)`}];function gu({current:e,total:t}){return(0,B.jsx)(`div`,{style:{display:`flex`,gap:8,justifyContent:`center`},children:Array.from({length:t}).map((t,n)=>(0,B.jsx)(`div`,{style:{width:n===e?20:6,height:6,borderRadius:3,background:n===e?`var(--color-primary)`:`rgba(255,255,255,0.12)`,transition:`all 0.3s cubic-bezier(0.4, 0, 0.2, 1)`,...n===e?{animation:`guidePulse 2s ease-in-out infinite`}:{}}},n))})}function _u({children:e,primary:t,onClick:n,style:r}){let[i,a]=(0,L.useState)(!1);return(0,B.jsx)(`button`,{onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:t?`var(--color-primary)`:`transparent`,color:t?`var(--color-bg)`:`var(--color-text-muted)`,border:t?`none`:`1px solid ${C.border}`,borderRadius:8,padding:t?`11px 28px`:`8px 16px`,fontSize:14,fontWeight:t?700:500,cursor:`pointer`,width:t?`100%`:void 0,transform:i&&t?`translateY(-1px)`:`none`,boxShadow:i&&t?`0 4px 16px rgba(201,160,255,0.3)`:`none`,opacity:i&&!t?.8:1,transition:`all 0.2s ease`,...r},children:e})}function vu({step:e,direction:t,onNext:n,onClose:r,onCreateJob:i}){let a=t===`left`?`stepSlideLeft`:`stepSlideRight`;return e===0?(0,B.jsxs)(`div`,{style:{textAlign:`center`,padding:`8px 0 16px`,animation:`${a} 0.35s ease-out`},children:[(0,B.jsx)(`div`,{style:{fontSize:52,marginBottom:20,animation:`fadeInScale 0.5s ease-out 0.15s both`},children:`🤖`}),(0,B.jsx)(`h2`,{style:{fontSize:22,fontWeight:700,margin:`0 0 12px`,color:C.text,animation:`fadeInUp 0.4s ease-out 0.1s both`},children:`Welcome to TeamworkOS`}),(0,B.jsx)(`p`,{style:{fontSize:14,color:`var(--color-text-muted)`,lineHeight:1.7,margin:`0 0 32px`,maxWidth:380,marginLeft:`auto`,marginRight:`auto`,animation:`fadeInUp 0.4s ease-out 0.2s both`},children:`Your personal AI operations center. Schedule Claude Code agents to automate your daily workflow.`}),(0,B.jsxs)(`div`,{style:{animation:`fadeInUp 0.4s ease-out 0.3s both`},children:[(0,B.jsx)(_u,{primary:!0,onClick:n,children:`Get Started`}),(0,B.jsx)(`div`,{style:{marginTop:12},children:(0,B.jsx)(_u,{onClick:r,children:`Skip for now`})})]})]},`step-0`):e===1?(0,B.jsxs)(`div`,{style:{animation:`${a} 0.35s ease-out`},children:[(0,B.jsx)(`h3`,{style:{fontSize:17,fontWeight:700,margin:`0 0 6px`,color:C.text,textAlign:`center`},children:`Key Concepts`}),(0,B.jsx)(`p`,{style:{fontSize:13,color:`var(--color-text-muted)`,textAlign:`center`,margin:`0 0 20px`},children:`Here's what makes TeamworkOS tick.`}),(0,B.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:10},children:mu.map((e,t)=>(0,B.jsxs)(`div`,{style:{background:`rgba(255,255,255,0.03)`,border:`1px solid ${C.border}`,borderRadius:10,padding:`14px`,borderTop:`2px solid ${e.accent}`,animation:`fadeInUp 0.35s ease-out both`,animationDelay:`${.1+t*.08}s`,transition:`border-color 0.2s ease, background 0.2s ease`},onMouseEnter:t=>{t.currentTarget.style.borderColor=`${e.accent}50`,t.currentTarget.style.background=`rgba(255,255,255,0.05)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=C.border,e.currentTarget.style.background=`rgba(255,255,255,0.03)`},children:[(0,B.jsx)(`div`,{style:{fontSize:24,marginBottom:8},children:e.icon}),(0,B.jsx)(`div`,{style:{fontSize:13,fontWeight:700,color:C.text,marginBottom:4},children:e.title}),(0,B.jsx)(`div`,{style:{fontSize:12,color:`var(--color-text-muted)`,lineHeight:1.5},children:e.desc})]},e.title))})]},`step-1`):e===2?(0,B.jsxs)(`div`,{style:{textAlign:`center`,animation:`${a} 0.35s ease-out`},children:[(0,B.jsx)(`div`,{style:{fontSize:44,marginBottom:16,animation:`fadeInScale 0.4s ease-out 0.1s both`},children:`🚀`}),(0,B.jsx)(`h3`,{style:{fontSize:17,fontWeight:700,margin:`0 0 8px`,color:C.text},children:`Create Your First Job`}),(0,B.jsx)(`p`,{style:{fontSize:13,color:`var(--color-text-muted)`,lineHeight:1.7,margin:`0 0 24px`,maxWidth:360,marginLeft:`auto`,marginRight:`auto`},children:`Jobs are the heart of TeamworkOS. Each one schedules a Claude Code session with a prompt you define.`}),(0,B.jsx)(_u,{primary:!0,onClick:i,children:`Start from Template`}),(0,B.jsx)(`div`,{style:{marginTop:12},children:(0,B.jsx)(_u,{onClick:n,children:`I'll explore first`})})]},`step-2`):e===3?(0,B.jsxs)(`div`,{style:{animation:`${a} 0.35s ease-out`},children:[(0,B.jsx)(`h3`,{style:{fontSize:17,fontWeight:700,margin:`0 0 6px`,color:C.text,textAlign:`center`},children:`Dashboard Tour`}),(0,B.jsx)(`p`,{style:{fontSize:12,color:`var(--color-text-muted)`,textAlign:`center`,margin:`0 0 18px`},children:`Four places you'll live once jobs are running.`}),(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:hu.map((e,t)=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:10,padding:`12px 14px`,background:`var(--color-bg-raised)`,border:`1px solid ${C.border}`,borderLeft:`3px solid ${e.accent}`,borderRadius:8,animation:`fadeInUp 0.3s ease-out both`,animationDelay:`${.1+t*.08}s`},children:[(0,B.jsx)(`span`,{style:{fontSize:18,flexShrink:0,lineHeight:1},children:e.icon}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:C.text},children:e.label}),(0,B.jsx)(`div`,{style:{fontSize:12,color:`var(--color-text-muted)`,marginTop:2,lineHeight:1.5},children:e.desc})]})]},e.label))})]},`step-3`):(0,B.jsxs)(`div`,{style:{textAlign:`center`,animation:`${a} 0.35s ease-out`},children:[(0,B.jsx)(`div`,{style:{fontSize:52,marginBottom:16,animation:`fadeInScale 0.5s ease-out 0.1s both`},children:`🎉`}),(0,B.jsx)(`h3`,{style:{fontSize:17,fontWeight:700,margin:`0 0 8px`,color:C.text},children:`You're all set!`}),(0,B.jsxs)(`p`,{style:{fontSize:13,color:`var(--color-text-muted)`,lineHeight:1.7,margin:`0 0 24px`,maxWidth:360,marginLeft:`auto`,marginRight:`auto`},children:[`Open the `,(0,B.jsx)(`strong`,{style:{color:C.text},children:`Guide`}),` anytime from the header to explore all features and get step-by-step help.`]}),(0,B.jsx)(_u,{primary:!0,onClick:r,children:`Done`})]},`step-4`)}function yu({open:e,onClose:t,onCreateJob:n}){let{setPref:r}=he(),[i,a]=(0,L.useState)(0),[o,s]=(0,L.useState)(!1),c=(0,L.useRef)(`left`);(0,L.useEffect)(()=>{if(e){a(0),s(!1);let e=setTimeout(()=>s(!0),10);return()=>clearTimeout(e)}else s(!1)},[e]);let l=(0,L.useCallback)(()=>{r(`onboardingCompleted`,!0),t()},[t,r]),u=(0,L.useCallback)(()=>{r(`onboardingCompleted`,!0),n(),t()},[n,t,r]),d=(0,L.useCallback)(()=>{c.current=`left`,a(e=>Math.min(pu-1,e+1))},[]),f=(0,L.useCallback)(()=>{c.current=`right`,a(e=>Math.max(0,e-1))},[]);if((0,L.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&l(),e.key===`ArrowRight`&&i<pu-1&&d(),e.key===`ArrowLeft`&&i>0&&f()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,l,i,d,f]),!e)return null;let p=i>0;return pu-1,(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:l,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.75)`,backdropFilter:`blur(4px)`,zIndex:1100,opacity:+!!o,transition:`opacity 0.3s ease`}}),(0,B.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:1101,display:`flex`,alignItems:`center`,justifyContent:`center`,pointerEvents:`none`},children:(0,B.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:520,margin:`0 16px`,background:`var(--color-bg)`,border:`1px solid ${C.border}`,borderRadius:16,padding:`32px 32px 24px`,boxShadow:`0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,160,255,0.05)`,pointerEvents:`auto`,opacity:+!!o,transform:o?`translateY(0) scale(1)`:`translateY(16px) scale(0.96)`,transition:`opacity 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1)`,boxSizing:`border-box`},children:[(0,B.jsx)(`div`,{style:{minHeight:260,overflow:`hidden`},children:(0,B.jsx)(vu,{step:i,direction:c.current,onNext:d,onClose:l,onCreateJob:u})}),(i===1||i===3)&&(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginTop:20,paddingTop:16,borderTop:`1px solid ${C.border}`,animation:`fadeIn 0.3s ease-out 0.2s both`},children:[(0,B.jsx)(_u,{onClick:f,style:{visibility:p?`visible`:`hidden`},children:`Back`}),(0,B.jsx)(gu,{current:i,total:pu}),(0,B.jsx)(_u,{primary:!0,onClick:d,style:{width:`auto`,padding:`8px 18px`},children:`Next`})]}),i===2&&(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginTop:20,paddingTop:16,borderTop:`1px solid ${C.border}`,animation:`fadeIn 0.3s ease-out 0.2s both`},children:[(0,B.jsx)(_u,{onClick:f,children:`Back`}),(0,B.jsx)(gu,{current:i,total:pu}),(0,B.jsx)(`span`,{style:{width:64},"aria-hidden":`true`})]}),(i===0||i===4)&&(0,B.jsx)(`div`,{style:{marginTop:20,animation:`fadeIn 0.3s ease-out 0.3s both`},children:(0,B.jsx)(gu,{current:i,total:pu})})]})})]})}var bu={"getting-started":`var(--color-primary)`,"job-configuration":`var(--color-positive)`,"dashboard-features":`var(--color-info)`,"scheduling---pause-system":C.warning,integrations:`#f778ba`,advanced:`#ffa657`};function xu({children:e}){return e?(0,B.jsx)(Ks,{components:{p:({children:e})=>(0,B.jsx)(`p`,{style:{margin:`0 0 6px`,fontSize:13,color:C.textSecondary,lineHeight:1.6},children:e}),strong:({children:e})=>(0,B.jsx)(`strong`,{style:{color:C.text,fontWeight:600},children:e}),code:({children:e})=>(0,B.jsx)(`code`,{style:{background:`rgba(110,118,129,0.25)`,padding:`2px 6px`,borderRadius:4,fontSize:12,fontFamily:g,color:C.text,border:`1px solid rgba(110,118,129,0.15)`},children:e}),a:({href:e,children:t})=>(0,B.jsx)(`a`,{href:e,style:{color:`var(--color-info)`,textDecoration:`none`},children:t})},children:e}):null}function Su({label:e,color:t,icon:n,children:r}){return r?(0,B.jsxs)(`div`,{style:{padding:`10px 12px 10px 14px`,borderRadius:8,borderLeft:`3px solid ${t}`,background:`${t}08`,marginBottom:8,transition:`all 0.2s ease`},children:[(0,B.jsxs)(`div`,{style:{fontSize:10,fontWeight:700,color:t,marginBottom:5,textTransform:`uppercase`,letterSpacing:.6,display:`flex`,alignItems:`center`,gap:5},children:[(0,B.jsx)(`span`,{style:{fontSize:12},children:n}),e]}),(0,B.jsx)(xu,{children:r})]}):null}function Cu({section:e,index:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),[s,c]=(0,L.useState)(0);return(0,L.useEffect)(()=>{n&&o.current&&c(o.current.scrollHeight)},[n,e]),(0,B.jsxs)(`div`,{style:{borderBottom:`1px solid rgba(48,54,61,0.5)`,animation:`guideSlideIn 0.3s ease-out both`,animationDelay:`${t*.04}s`},children:[(0,B.jsxs)(`button`,{onClick:()=>r(!n),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{width:`100%`,background:i?`rgba(255,255,255,0.03)`:`transparent`,border:`none`,padding:`11px 14px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,cursor:`pointer`,transition:`background 0.15s ease`},children:[(0,B.jsx)(`span`,{style:{fontSize:13,fontWeight:500,color:n?C.text:C.textSecondary,transition:`color 0.15s ease`},children:e.title}),(0,B.jsx)(`span`,{style:{fontSize:10,color:C.muted,transform:n?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,display:`inline-block`},children:`▼`})]}),(0,B.jsx)(`div`,{style:{maxHeight:n?s+20:0,opacity:+!!n,overflow:`hidden`,transition:`max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease`},children:(0,B.jsxs)(`div`,{ref:o,style:{padding:`0 14px 14px`},children:[(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary,lineHeight:1.65,marginBottom:12},children:(0,B.jsx)(xu,{children:e.content})}),(0,B.jsx)(Su,{label:`How to use`,color:`var(--color-positive)`,icon:`→`,children:e.howTo}),(0,B.jsx)(Su,{label:`Where to find it`,color:`var(--color-info)`,icon:`🔍`,children:e.whereTo}),(0,B.jsx)(Su,{label:`Tips`,color:`var(--color-primary)`,icon:`✨`,children:e.tips})]})})]})}function wu({category:e,accentColor:t,isOpen:n,onToggle:r,searchActive:i}){let[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null),[c,l]=(0,L.useState)(0);return(0,L.useEffect)(()=>{if(n&&s.current){let e=setTimeout(()=>{s.current&&l(s.current.scrollHeight)},50);return()=>clearTimeout(e)}},[n,e.sections.length]),(0,B.jsxs)(`div`,{style:{borderRadius:10,border:`1px solid ${n?`${t}30`:C.border}`,background:n?`${t}06`:`rgba(255,255,255,0.015)`,marginBottom:10,overflow:`hidden`,transition:`border-color 0.3s ease, background 0.3s ease`},children:[(0,B.jsxs)(`button`,{onClick:r,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{width:`100%`,background:a?`var(--color-subtle-bg)`:`transparent`,border:`none`,padding:`13px 16px`,display:`flex`,alignItems:`center`,gap:10,cursor:`pointer`,transition:`background 0.15s ease`},children:[(0,B.jsx)(`div`,{style:{width:3,height:18,borderRadius:2,background:t,opacity:n?1:.4,transition:`opacity 0.2s ease`,flexShrink:0}}),(0,B.jsx)(`span`,{style:{fontSize:14,fontWeight:700,color:C.text,flex:1,textAlign:`left`},children:e.category}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,marginRight:4},children:e.sections.length}),(0,B.jsx)(`span`,{style:{fontSize:10,color:C.muted,transform:n?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)`,display:`inline-block`},children:`▼`})]}),(0,B.jsx)(`div`,{style:{maxHeight:n?Math.max(c,2e3):0,opacity:+!!n,overflow:`hidden`,transition:n?`max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease`:`max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease`},children:(0,B.jsx)(`div`,{ref:s,children:e.sections.map((e,t)=>(0,B.jsx)(Cu,{section:e,index:i?0:t},e.id))})})]})}function Tu({open:e,onClose:t,onStartOnboarding:n}){let{setPref:r}=he(),[i,a]=(0,L.useState)([]),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(new Set([`getting-started`])),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(!1),m=(0,L.useRef)(!1);(0,L.useEffect)(()=>{e&&(m.current||fetch(`/api/docs`).then(e=>e.json()).then(e=>{Array.isArray(e)&&(a(e),m.current=!0)}).catch(()=>{}))},[e]);let h=(0,L.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),g=o.trim().length>0,_=g?i.map(e=>({...e,sections:e.sections.filter(e=>e.title.toLowerCase().includes(o.toLowerCase())||e.content.toLowerCase().includes(o.toLowerCase())||e.howTo.toLowerCase().includes(o.toLowerCase())||e.tips.toLowerCase().includes(o.toLowerCase()))})).filter(e=>e.sections.length>0):i,v=(0,L.useCallback)(()=>{t(),setTimeout(()=>{r(`onboardingCompleted`,!1),n()},300)},[t,n,r]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:t,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.5)`,zIndex:999,opacity:+!!e,pointerEvents:e?`auto`:`none`,transition:`opacity 0.25s ease`}}),(0,B.jsxs)(`div`,{style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:440,maxWidth:`90vw`,background:`var(--color-bg)`,borderLeft:`1px solid ${C.border}`,zIndex:1e3,transform:e?`translateX(0)`:`translateX(100%)`,transition:`transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{padding:`18px 20px 14px`,borderBottom:`1px solid ${C.border}`,flexShrink:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:14},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`span`,{style:{fontSize:18},children:`📖`}),(0,B.jsx)(`h2`,{style:{fontSize:17,fontWeight:700,margin:0,color:C.text},children:`Guide`})]}),(0,B.jsx)(`button`,{onClick:t,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),"aria-label":`Close guide`,style:{background:u?`rgba(255,255,255,0.06)`:`transparent`,border:`none`,color:C.muted,fontSize:18,cursor:`pointer`,padding:`4px 8px`,borderRadius:6,opacity:u?1:.6,transition:`all 0.15s ease`},children:`✕`})]}),(0,B.jsxs)(`div`,{style:{position:`relative`},children:[(0,B.jsx)(`input`,{type:`text`,placeholder:`Search features...`,value:o,onChange:e=>s(e.target.value),style:{width:`100%`,boxSizing:`border-box`,background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${o?`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.25)`:C.border}`,borderRadius:8,padding:`9px 12px 9px 34px`,fontSize:13,outline:`none`,transition:`border-color 0.2s ease`}}),(0,B.jsx)(`span`,{style:{position:`absolute`,left:11,top:`50%`,transform:`translateY(-50%)`,fontSize:14,color:C.muted,pointerEvents:`none`},children:`🔍`})]})]}),(0,B.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`14px 16px`},children:i.length===0?(0,B.jsx)(`div`,{style:{textAlign:`center`,padding:`40px 0`,color:C.muted,fontSize:13,animation:`pulse 1.5s ease-in-out infinite`},children:`Loading guide...`}):_.length===0?(0,B.jsxs)(`div`,{style:{textAlign:`center`,padding:`40px 0`,color:C.muted,fontSize:13,animation:`fadeIn 0.2s ease-out`},children:[`No features match "`,o,`"`]}):_.map((e,t)=>(0,B.jsx)(wu,{category:e,accentColor:bu[e.id]||`var(--color-text-muted)`,isOpen:g||c.has(e.id),onToggle:()=>h(e.id),searchActive:g},e.id||e.category))}),(0,B.jsx)(`div`,{style:{padding:`12px 16px`,borderTop:`1px solid ${C.border}`,flexShrink:0},children:(0,B.jsxs)(`button`,{onClick:v,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{width:`100%`,background:f?`rgba(201,160,255,0.08)`:`transparent`,border:`1px solid ${f?`rgba(201,160,255,0.3)`:C.border}`,borderRadius:8,padding:`9px 0`,color:f?`var(--color-primary)`:C.muted,fontSize:13,fontWeight:500,cursor:`pointer`,transition:`all 0.2s ease`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:6},children:[(0,B.jsx)(`span`,{style:{fontSize:14},children:`↺`}),`Restart Tour`]})})]})]})}function Eu({jobId:e,borderless:t}){let[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),c=(0,L.useRef)(null),l=(0,L.useRef)(``);(0,L.useEffect)(()=>{l.current=``,r(``),a(!1),s(!1),fetch(`/api/jobs/${e}/terminal`).then(e=>{if(!e.ok)throw Error(`Not found`);return e.json()}).then(e=>{l.current=e.content,r(e.content),a(e.active),u()}).catch(()=>s(!0))},[e]),p(`job:progress`,(0,L.useCallback)(t=>{let n=t;if(n?.jobId!==e||!n.latestMessage)return;let i=`[PROGRESS] ${n.latestMessage}\n`;l.current.includes(i.trim())||(l.current+=i,r(l.current),a(!0),u())},[e])),p(`session:delta`,(0,L.useCallback)(t=>{let n=t;if(!(n?.jobId!==e||!n.content)){if(n.type===`tool_use`||n.type===`tool_result`){let e=n.type===`tool_use`?`[tool: ${n.toolName??`?`}] `:`[result] `;l.current+=`
|
|
27
|
-
`+e+n.content+`
|
|
28
|
-
`}else l.current+=n.content;r(l.current),a(!0),u()}},[e])),p(`job:updated`,(0,L.useCallback)(t=>{let n=t;n?.job?.id===e&&n.job.lastStatus!==`running`&&(a(!1),fetch(`/api/jobs/${e}/terminal`).then(e=>e.ok?e.json():null).then(e=>{e&&(l.current=e.content,r(e.content),u())}).catch(()=>{}))},[e]));function u(){requestAnimationFrame(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)})}return(0,B.jsxs)(`div`,{style:{background:C.darkBg,...!t&&{border:`1px solid ${C.border}`,borderRadius:8,marginTop:12},overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`6px 12px`,borderBottom:`1px solid ${C.border}`,fontSize:12},children:[(0,B.jsxs)(`span`,{style:{fontFamily:g,color:C.muted},children:[`ct-`,e]}),i?(0,B.jsxs)(`span`,{style:{color:C.green,fontWeight:600},children:[`●`,` LIVE`]}):n?(0,B.jsx)(`span`,{style:{color:C.muted},children:`Session ended`}):null]}),(0,B.jsx)(`pre`,{ref:c,style:{margin:0,padding:12,fontFamily:g,fontSize:12,lineHeight:1.5,color:C.textSecondary,maxHeight:320,overflowY:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:o?`Failed to load terminal output.`:n||`Waiting for output...`})]})}function Du({children:e,size:t=`md`}){let n=t===`sm`?11:12;return(0,B.jsx)(`code`,{style:{display:`inline`,background:C.mutedBg,padding:`1px 4px`,borderRadius:x.sm,fontSize:n,fontFamily:g,border:`1px solid ${C.mutedBg}`,color:`inherit`},children:e})}function Ou({isOpen:e,children:t,bare:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(0),[o,s]=(0,L.useState)(!1),c=(0,L.useRef)(!0),[l,u]=(0,L.useState)(e);return(0,L.useEffect)(()=>{e&&u(!0)},[e]),(0,L.useLayoutEffect)(()=>{c.current=!1},[]),(0,L.useLayoutEffect)(()=>{let t=r.current;t&&(e?(s(!0),a(0),requestAnimationFrame(()=>{requestAnimationFrame(()=>a(t.scrollHeight))})):c.current||(s(!0),a(t.scrollHeight),requestAnimationFrame(()=>{requestAnimationFrame(()=>a(0))})))},[e]),(0,B.jsx)(`div`,{onTransitionEnd:()=>{s(!1),e&&a(`auto`)},style:{height:i,overflow:o?`hidden`:e?`visible`:`hidden`,transition:`height 0.25s ease`},children:(0,B.jsx)(`div`,{ref:r,style:n?void 0:{padding:`16px 20px`,borderTop:`1px solid #30363d`},children:l&&t})})}function ku(e){return(e.current?[...e.committed,e.current]:e.committed).filter(Boolean).join(`
|
|
29
|
-
|
|
30
|
-
`)}function Au(e){if(typeof e!=`string`||e.length===0)return null;try{return JSON.parse(e)}catch{return null}}function ju(e){let t=(0,L.useRef)(new Map),n=(0,L.useRef)(new Map),[r,i]=(0,L.useState)([]),a=(0,L.useCallback)(()=>{let e=Array.from(t.current.values());e.sort((e,t)=>e.startedAt<t.startedAt?1:e.startedAt>t.startedAt?-1:0),i(e)},[]);return(0,L.useEffect)(()=>{t.current.clear(),n.current.clear(),i([])},[e]),p(`session:delta`,(0,L.useCallback)(r=>{let i=r;if(!e||i.jobId!==e)return;let o=i.sessionId;if(!(!o||!o.startsWith(`dispatch-`))){if(i.type===`status`){let e=Au(i.content);if(e&&e.kind===`dispatch-start`){t.current.set(o,{sessionId:o,employeeId:e.employeeId,engine:e.engine,model:e.model??``,prompt:e.prompt,text:``,status:`running`,startedAt:e.startedAt}),n.current.set(o,{committed:[],current:``}),a();return}let r=Au(i.content);if(r&&r.kind===`dispatch-end`){let e=t.current.get(o);e&&(t.current.set(o,{...e,status:r.status,error:r.error,endedAt:r.endedAt,durationMs:r.durationMs}),a());return}return}if(i.type===`text`||i.type===`text_snapshot`){let e=n.current.get(o),r=t.current.get(o);if(!e||!r)return;i.type===`text`?e.current+=i.content??``:(i.content&&e.committed.push(i.content),e.current=``),t.current.set(o,{...r,text:ku(e)}),a()}}},[e,a])),r}var Mu={panel:`_panel_d3jc6_6`,header:`_header_d3jc6_12`,count:`_count_d3jc6_23`,streamList:`_streamList_d3jc6_31`,streamCard:`_streamCard_d3jc6_37`,streamHeaderButton:`_streamHeaderButton_d3jc6_48`,employee:`_employee_d3jc6_70`,spacer:`_spacer_d3jc6_77`,elapsed:`_elapsed_d3jc6_81`,caret:`_caret_d3jc6_88`,caretOpen:`_caretOpen_d3jc6_96`,body:`_body_d3jc6_100`,promptLabel:`_promptLabel_d3jc6_108`,prompt:`_prompt_d3jc6_108`,promptMore:`_promptMore_d3jc6_124`,responseLabel:`_responseLabel_d3jc6_137`,response:`_response_d3jc6_137`,responsePlaceholder:`_responsePlaceholder_d3jc6_155`,errorLine:`_errorLine_d3jc6_160`},Nu=300;function Pu({jobId:e}){let t=ju(e),[n,r]=(0,L.useState)({}),i=t.some(e=>e.status===`running`);(0,L.useEffect)(()=>{r(e=>{let n={...e},r=!1;for(let e of t)n[e.sessionId]===void 0&&(n[e.sessionId]=!0,r=!0);return r?n:e})},[t]);let a=(0,L.useCallback)(e=>{r(t=>({...t,[e]:!t[e]}))},[]);return t.length===0?null:(0,B.jsx)(N,{padding:`md`,children:(0,B.jsxs)(`div`,{className:Mu.panel,children:[(0,B.jsxs)(`div`,{className:Mu.header,children:[(0,B.jsx)(`span`,{children:`Non-Claude dispatches`}),(0,B.jsxs)(`span`,{className:Mu.count,children:[t.length,` call`,t.length===1?``:`s`,i?` · streaming`:``]})]}),(0,B.jsx)(`div`,{className:Mu.streamList,children:t.map(e=>(0,B.jsx)(Fu,{stream:e,open:n[e.sessionId]??!0,onToggle:()=>a(e.sessionId)},e.sessionId))})]})})}function Fu({stream:e,open:t,onToggle:n}){let r=Ru(e),i=Iu(e.status),[a,o]=(0,L.useState)(!1),s=e.model?`${e.engine}:${e.model}`:e.engine,c=e.prompt.length>Nu,l=c&&!a?e.prompt.slice(0,Nu).trimEnd()+`…`:e.prompt;return(0,B.jsxs)(`div`,{className:Mu.streamCard,"data-status":e.status,children:[(0,B.jsxs)(`button`,{type:`button`,className:Mu.streamHeaderButton,onClick:n,"aria-expanded":t,children:[(0,B.jsx)(`span`,{className:`${Mu.caret} ${t?Mu.caretOpen:``}`,"aria-hidden":`true`,children:`▸`}),(0,B.jsx)(`span`,{className:Mu.employee,children:e.employeeId}),(0,B.jsx)(Du,{size:`sm`,children:s}),(0,B.jsx)(cu,{label:i.label,color:i.color,bg:i.bg,size:`sm`,pulse:i.pulse}),(0,B.jsx)(`span`,{className:Mu.spacer,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:Mu.elapsed,"aria-label":`Elapsed time`,children:r})]}),(0,B.jsx)(Ou,{isOpen:t,bare:!0,children:(0,B.jsxs)(`div`,{className:Mu.body,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:Mu.promptLabel,children:`Prompt`}),(0,B.jsxs)(`div`,{className:Mu.prompt,children:[l,c&&!a&&(0,B.jsx)(`button`,{type:`button`,className:Mu.promptMore,onClick:()=>o(!0),children:`Show more`})]})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:Mu.responseLabel,children:`Response`}),e.text?(0,B.jsx)(`pre`,{className:Mu.response,children:e.text}):(0,B.jsx)(`div`,{className:`${Mu.response} ${Mu.responsePlaceholder}`,children:e.status===`running`?`waiting for engine…`:`(no response)`}),e.error&&(0,B.jsxs)(`div`,{className:Mu.errorLine,children:[`Error: `,e.error]})]})]})})]})}function Iu(e){return e===`running`?{label:`RUNNING`,color:`var(--color-primary)`,bg:`var(--color-primary-soft)`,pulse:!0}:e===`success`?{label:`DONE`,color:`var(--color-positive)`,bg:`var(--color-positive-soft)`,pulse:!1}:{label:`ERROR`,color:`var(--color-negative)`,bg:`var(--color-negative-soft)`,pulse:!1}}function Lu(e){let t=e/1e3;return t<10?t.toFixed(1)+`s`:t<60?Math.round(t)+`s`:`${Math.floor(t/60)}m${Math.round(t%60).toString().padStart(2,`0`)}s`}function Ru(e){let t=(0,L.useMemo)(()=>{let t=Date.parse(e.startedAt);return Number.isNaN(t)?Date.now():t},[e.startedAt]),[n,r]=(0,L.useState)(()=>Date.now()),i=e.status===`running`;return(0,L.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>r(Date.now()),500);return()=>window.clearInterval(e)},[i]),!i&&e.durationMs!==void 0?Lu(e.durationMs):Lu(Math.max(0,n-t))}function zu(e,t){let n=e.filter(e=>e.jobId===t&&e.status===`success`&&e.durationSeconds>0).map(e=>e.durationSeconds).sort((e,t)=>e-t);if(n.length<3)return null;let r=Math.floor(n.length/2);return n.length%2==0?(n[r-1]+n[r])/2:n[r]}function Bu({jobs:e,feed:t,progress:n,onSelectJob:r,onCancel:i}){let[a,o]=(0,L.useState)(Date.now()),[s,c]=(0,L.useState)(null),l=(0,L.useMemo)(()=>e.filter(e=>e.lastStatus===`running`&&e.lastRun),[e]);(0,L.useEffect)(()=>{if(l.length===0)return;let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[l.length]),(0,L.useEffect)(()=>{s&&!l.some(e=>e.id===s)&&c(null)},[l,s]);let u=(0,L.useCallback)(e=>{c(t=>t===e?null:e)},[]);return l.length===0?null:(0,B.jsxs)(`div`,{style:{marginBottom:20,animation:`fadeInUp 0.35s ease-out both`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:8},children:[(0,B.jsx)(`span`,{style:{...S,background:C.blue,animation:`pulse 2s infinite`}}),(0,B.jsxs)(`span`,{style:{fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.5},children:[l.length,` Agent`,l.length===1?``:`s`,` Running`]})]}),(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:l.map((e,o)=>{let c=new Date(e.lastRun).getTime(),l=Math.max(0,Math.floor((a-c)/1e3)),d=e.timeout||1800,f=Math.min(l/d,1.5),p=Math.min(f*100,100),m=zu(t,e.id),h=n[e.id],_=s===e.id,v=C.blue,y=`rgba(88,166,255,0.15)`;return f>=1?(v=C.red,y=`var(--color-negative-soft)`):f>=.75&&(v=C.warning,y=`rgba(210,153,34,0.15)`),(0,B.jsxs)(`div`,{style:{animation:`fadeInUp 0.3s ease-out both`,animationDelay:`${o*.06}s`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,background:C.cardBg,border:`1px solid ${_?`var(--color-border-strong)`:C.border}`,borderRadius:_?`8px 8px 0 0`:8,padding:`8px 14px`,transition:`border-color 0.2s`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`var(--color-border-strong)`},onMouseLeave:e=>{_||(e.currentTarget.style.borderColor=C.border)},children:[(0,B.jsx)(`button`,{onClick:()=>u(e.id),"aria-label":_?`Collapse terminal`:`Show live terminal`,"aria-expanded":_,style:{background:`none`,border:`none`,padding:0,color:C.muted,fontSize:10,cursor:`pointer`,transition:`transform 0.2s`,transform:_?`rotate(90deg)`:`rotate(0deg)`,flexShrink:0,width:16,height:16,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`▶`}),(0,B.jsx)(`button`,{onClick:()=>r(e.id),style:{background:`none`,border:`none`,padding:0,color:C.text,fontSize:13,fontWeight:500,cursor:`pointer`,whiteSpace:`nowrap`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:200,textAlign:`left`},title:`Open ${e.name} details`,children:e.name}),h?.latestMessage&&(0,B.jsxs)(`span`,{title:h.latestStep!=null&&h.totalSteps!=null?`Step ${h.latestStep}/${h.totalSteps}: ${h.latestMessage}`:h.latestMessage,style:{fontSize:11,color:C.muted,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:240,minWidth:0,fontStyle:`italic`},children:[h.latestStep!=null&&h.totalSteps!=null&&(0,B.jsxs)(`span`,{style:{color:C.blue,fontStyle:`normal`,fontVariantNumeric:`tabular-nums`,marginRight:4},children:[h.latestStep,`/`,h.totalSteps]}),h.latestMessage]}),(0,B.jsxs)(`div`,{style:{flex:1,height:6,borderRadius:3,background:`rgba(255,255,255,0.06)`,overflow:`hidden`,position:`relative`,minWidth:80},children:[(0,B.jsx)(`div`,{style:{width:`${p}%`,height:`100%`,borderRadius:3,background:v,boxShadow:`0 0 8px ${y}`,transition:`width 1s linear, background 0.5s ease`}}),m&&m<d&&(0,B.jsx)(`div`,{title:`Typically finishes around ${ze(m)}`,style:{position:`absolute`,left:`${m/d*100}%`,top:-1,width:1,height:8,background:`rgba(255,255,255,0.3)`}})]}),(0,B.jsx)(`span`,{style:{fontSize:12,fontFamily:g,color:f>=1?C.red:f>=.75?C.warning:C.textSecondary,whiteSpace:`nowrap`,minWidth:48,textAlign:`right`},children:ze(l)}),m&&l<m*1.5&&(0,B.jsxs)(`span`,{style:{fontSize:11,color:C.muted,whiteSpace:`nowrap`},title:`Median duration: ${ze(m)}`,children:[`/ ~`,ze(m)]}),(0,B.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>i(e.id),"aria-label":`Cancel ${e.name}`,style:{padding:`3px 8px`,fontSize:11,flexShrink:0},children:`✕`})]}),_&&(0,B.jsxs)(`div`,{style:{background:C.darkBg,border:`1px solid #484f58`,borderTop:`none`,borderRadius:`0 0 8px 8px`,overflow:`hidden`,animation:`fadeInUp 0.2s ease-out both`},children:[(0,B.jsx)(Eu,{jobId:e.id,borderless:!0}),e.flow===`seam-v1`&&(0,B.jsx)(Pu,{jobId:e.id})]})]},e.id)})})]})}var Vu={critical:`var(--color-negative)`,high:`#e3b341`,normal:`var(--color-text-muted)`,low:`var(--color-border-strong)`},Hu={critical:`Critical`,high:`High`,normal:`Normal`,low:`Low`};function Uu(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:`${Math.floor(t/3600)}h ago`}function Wu({onOpenJob:e}){let[t,n]=(0,L.useState)(null),r=(0,L.useCallback)(()=>{fetch(`/api/queue`).then(e=>e.ok?e.json():null).then(e=>n(e)).catch(()=>{})},[]);(0,L.useEffect)(()=>{r();let e=setInterval(r,5e3);return()=>clearInterval(e)},[r]);let i=e=>{fetch(`/api/queue/${e}`,{method:`DELETE`}).then(()=>r()).catch(()=>{})},a=()=>{fetch(`/api/queue/process`,{method:`POST`}).then(()=>r()).catch(()=>{})};if(!t||t.entries.length===0&&t.runningCount<t.maxConcurrentJobs)return null;let o=t.runningCount>=t.maxConcurrentJobs;return(0,B.jsxs)(`div`,{style:{...O,padding:`16px 20px`,marginBottom:16},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:t.entries.length>0?12:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,B.jsx)(`span`,{style:{fontSize:14,fontWeight:600,color:C.text},children:`Scheduling Queue`}),(0,B.jsxs)(`span`,{style:{fontSize:11,padding:`2px 8px`,borderRadius:10,background:o?`rgba(227, 179, 65, 0.15)`:`rgba(63, 185, 80, 0.15)`,color:o?`#e3b341`:`var(--color-positive)`,fontWeight:500},children:[t.runningCount,`/`,t.maxConcurrentJobs,` slots`]}),t.entries.length>0&&(0,B.jsxs)(`span`,{style:{fontSize:11,padding:`2px 8px`,borderRadius:10,background:`rgba(136, 100, 255, 0.15)`,color:`#a78bfa`,fontWeight:500},children:[t.entries.length,` queued`]})]}),t.entries.length>0&&(0,B.jsx)(`button`,{onClick:a,style:{background:`none`,border:`1px solid #30363d`,borderRadius:6,color:`var(--color-text-muted)`,fontSize:11,padding:`3px 10px`,cursor:`pointer`},children:`Process Queue`})]}),t.entries.length>0&&(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:t.entries.map((t,n)=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,background:`var(--color-bg)`,borderRadius:8,padding:`8px 12px`,border:`1px solid #21262d`},children:[(0,B.jsxs)(`span`,{style:{fontSize:11,color:`var(--color-border-strong)`,fontWeight:600,width:20,textAlign:`center`},children:[`#`,n+1]}),(0,B.jsx)(`span`,{onClick:()=>e?.(t.jobId),style:{flex:1,color:C.text,fontSize:13,fontWeight:500,cursor:e?`pointer`:`default`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:t.jobName,children:t.jobName}),(0,B.jsx)(`span`,{style:{fontSize:10,padding:`2px 7px`,borderRadius:8,fontWeight:600,background:`${Vu[t.priority]}20`,color:Vu[t.priority],textTransform:`uppercase`,letterSpacing:`0.05em`},children:Hu[t.priority]}),(0,B.jsx)(`span`,{style:{fontSize:11,color:`var(--color-border-strong)`},children:Uu(t.enqueuedAt)}),(0,B.jsx)(`button`,{onClick:()=>i(t.jobId),title:`Remove from queue`,style:{background:`none`,border:`none`,color:`var(--color-border-strong)`,cursor:`pointer`,padding:`2px 4px`,fontSize:14,lineHeight:1},children:`×`})]},t.jobId))})]})}typeof window<`u`&&window.document&&window.document.createElement;function Gu(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Ku(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function qu(...e){return t=>{let n=!1,r=e.map(e=>{let r=Ku(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Ku(e[t],null)}}}}function Ju(...e){return L.useCallback(qu(...e),e)}function Yu(e,t){let n=L.createContext(t),r=e=>{let{children:t,...r}=e,i=L.useMemo(()=>r,Object.values(r));return(0,B.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=L.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Xu(e,t=[]){let n=[];function r(t,r){let i=L.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=L.useMemo(()=>o,Object.values(o));return(0,B.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=L.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>L.createContext(e));return function(n){let r=n?.[e]||t;return L.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Zu(i,...t)]}function Zu(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Qu=globalThis?.document?L.useLayoutEffect:()=>{},$u=L.useId||(()=>void 0),ed=0;function td(e){let[t,n]=L.useState($u());return Qu(()=>{e||n(e=>e??String(ed++))},[e]),e||(t?`radix-${t}`:``)}var nd=L.useInsertionEffect||Qu;function rd({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=id({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=L.useRef(e!==void 0);L.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,L.useCallback(t=>{if(s){let n=ad(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function id({defaultProp:e,onChange:t}){let[n,r]=L.useState(e),i=L.useRef(n),a=L.useRef(t);return nd(()=>{a.current=t},[t]),L.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function ad(e){return typeof e==`function`}var od=a(s(),1);function sd(e){let t=cd(e),n=L.forwardRef((e,n)=>{let{children:r,...i}=e,a=L.Children.toArray(r),o=a.find(ud);if(o){let e=o.props.children,r=a.map(t=>t===o?L.Children.count(e)>1?L.Children.only(null):L.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:L.isValidElement(e)?L.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function cd(e){let t=L.forwardRef((e,t)=>{let{children:n,...r}=e;if(L.isValidElement(n)){let e=fd(n),i=dd(r,n.props);return n.type!==L.Fragment&&(i.ref=t?qu(t,e):e),L.cloneElement(n,i)}return L.Children.count(n)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ld=Symbol(`radix.slottable`);function ud(e){return L.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ld}function dd(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function fd(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=sd(`Primitive.${t}`),r=L.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function md(e,t){e&&od.flushSync(()=>e.dispatchEvent(t))}function hd(e){let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>(...e)=>t.current?.(...e),[])}function gd(e,t=globalThis?.document){let n=hd(e);L.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var _d=`DismissableLayer`,vd=`dismissableLayer.update`,yd=`dismissableLayer.pointerDownOutside`,bd=`dismissableLayer.focusOutside`,xd,Sd=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cd=L.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=L.useContext(Sd),[u,d]=L.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=L.useState({}),m=Ju(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Ed(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Dd(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return gd(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),L.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(xd=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Od(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=xd)}},[u,f,n,l]),L.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Od())},[u,l]),L.useEffect(()=>{let e=()=>p({});return document.addEventListener(vd,e),()=>document.removeEventListener(vd,e)},[]),(0,B.jsx)(pd.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:Gu(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Gu(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Gu(e.onPointerDownCapture,x.onPointerDownCapture)})});Cd.displayName=_d;var wd=`DismissableLayerBranch`,Td=L.forwardRef((e,t)=>{let n=L.useContext(Sd),r=L.useRef(null),i=Ju(t,r);return L.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,B.jsx)(pd.div,{...e,ref:i})});Td.displayName=wd;function Ed(e,t=globalThis?.document){let n=hd(e),r=L.useRef(!1),i=L.useRef(()=>{});return L.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){kd(yd,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Dd(e,t=globalThis?.document){let n=hd(e),r=L.useRef(!1);return L.useEffect(()=>{let e=e=>{e.target&&!r.current&&kd(bd,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Od(){let e=new CustomEvent(vd);document.dispatchEvent(e)}function kd(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?md(i,a):i.dispatchEvent(a)}var Ad=`focusScope.autoFocusOnMount`,jd=`focusScope.autoFocusOnUnmount`,Md={bubbles:!1,cancelable:!0},Nd=`FocusScope`,Pd=L.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=L.useState(null),l=hd(i),u=hd(a),d=L.useRef(null),f=Ju(t,e=>c(e)),p=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Vd(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Vd(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Vd(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),L.useEffect(()=>{if(s){Hd.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Ad,Md);s.addEventListener(Ad,l),s.dispatchEvent(t),t.defaultPrevented||(Fd(Gd(Ld(s)),{select:!0}),document.activeElement===e&&Vd(s))}return()=>{s.removeEventListener(Ad,l),setTimeout(()=>{let t=new CustomEvent(jd,Md);s.addEventListener(jd,u),s.dispatchEvent(t),t.defaultPrevented||Vd(e??document.body,{select:!0}),s.removeEventListener(jd,u),Hd.remove(p)},0)}}},[s,l,u,p]);let m=L.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Id(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Vd(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Vd(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,B.jsx)(pd.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Pd.displayName=Nd;function Fd(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Vd(r,{select:t}),document.activeElement!==n)return}function Id(e){let t=Ld(e);return[Rd(t,e),Rd(t.reverse(),e)]}function Ld(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Rd(e,t){for(let n of e)if(!zd(n,{upTo:t}))return n}function zd(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Bd(e){return e instanceof HTMLInputElement&&`select`in e}function Vd(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Bd(e)&&t&&e.select()}}var Hd=Ud();function Ud(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Wd(e,t),e.unshift(t)},remove(t){e=Wd(e,t),e[0]?.resume()}}}function Wd(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Gd(e){return e.filter(e=>e.tagName!==`A`)}var Kd=`Portal`,qd=L.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=L.useState(!1);Qu(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?od.createPortal((0,B.jsx)(pd.div,{...r,ref:t}),o):null});qd.displayName=Kd;function Jd(e,t){return L.useReducer((e,n)=>t[e][n]??e,e)}var Yd=e=>{let{present:t,children:n}=e,r=Xd(t),i=typeof n==`function`?n({present:r.isPresent}):L.Children.only(n),a=Ju(r.ref,Qd(i));return typeof n==`function`||r.isPresent?L.cloneElement(i,{ref:a}):null};Yd.displayName=`Presence`;function Xd(e){let[t,n]=L.useState(),r=L.useRef(null),i=L.useRef(e),a=L.useRef(`none`),[o,s]=Jd(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return L.useEffect(()=>{let e=Zd(r.current);a.current=o===`mounted`?e:`none`},[o]),Qu(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Zd(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Qu(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Zd(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Zd(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:L.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Zd(e){return e?.animationName||`none`}function Qd(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $d=0;function ef(){L.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??tf()),document.body.insertAdjacentElement(`beforeend`,e[1]??tf()),$d++,()=>{$d===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),$d--}},[])}function tf(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var nf=function(){return nf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},nf.apply(this,arguments)};function rf(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function af(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var of=`right-scroll-bar-position`,sf=`width-before-scroll-bar`,cf=`with-scroll-bars-hidden`,lf=`--removed-body-scroll-bar-size`;function uf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function df(e,t){var n=(0,L.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var ff=typeof window<`u`?L.useLayoutEffect:L.useEffect,pf=new WeakMap;function mf(e,t){var n=df(t||null,function(t){return e.forEach(function(e){return uf(e,t)})});return ff(function(){var t=pf.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||uf(e,null)}),i.forEach(function(e){r.has(e)||uf(e,a)})}pf.set(n,e)},[e]),n}function hf(e){return e}function gf(e,t){t===void 0&&(t=hf);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function _f(e){e===void 0&&(e={});var t=gf(null);return t.options=nf({async:!0,ssr:!1},e),t}var vf=function(e){var t=e.sideCar,n=rf(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return L.createElement(r,nf({},n))};vf.isSideCarExport=!0;function yf(e,t){return e.useMedium(t),vf}var bf=_f(),xf=function(){},Sf=L.forwardRef(function(e,t){var n=L.useRef(null),r=L.useState({onScrollCapture:xf,onWheelCapture:xf,onTouchMoveCapture:xf}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=rf(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=mf([n,t]),C=nf(nf({},b),i);return L.createElement(L.Fragment,null,u&&L.createElement(x,{sideCar:bf,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?L.cloneElement(L.Children.only(s),nf(nf({},C),{ref:S})):L.createElement(v,nf({},C,{className:c,ref:S}),s))});Sf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Sf.classNames={fullWidth:sf,zeroRight:of};var Cf,wf=function(){if(Cf)return Cf;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Tf(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=wf();return t&&e.setAttribute(`nonce`,t),e}function Ef(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Df(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Of=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Tf())&&(Ef(t,n),Df(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},kf=function(){var e=Of();return function(t,n){L.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Af=function(){var e=kf();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},jf={left:0,top:0,right:0,gap:0},Mf=function(e){return parseInt(e||``,10)||0},Nf=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Mf(n),Mf(r),Mf(i)]},Pf=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return jf;var t=Nf(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ff=Af(),If=`data-scroll-locked`,Lf=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
31
|
-
.${cf} {
|
|
32
|
-
overflow: hidden ${r};
|
|
33
|
-
padding-right: ${s}px ${r};
|
|
34
|
-
}
|
|
35
|
-
body[${If}] {
|
|
36
|
-
overflow: hidden ${r};
|
|
37
|
-
overscroll-behavior: contain;
|
|
38
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
39
|
-
padding-left: ${i}px;
|
|
40
|
-
padding-top: ${a}px;
|
|
41
|
-
padding-right: ${o}px;
|
|
42
|
-
margin-left:0;
|
|
43
|
-
margin-top:0;
|
|
44
|
-
margin-right: ${s}px ${r};
|
|
45
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.${of} {
|
|
49
|
-
right: ${s}px ${r};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.${sf} {
|
|
53
|
-
margin-right: ${s}px ${r};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.${of} .${of} {
|
|
57
|
-
right: 0 ${r};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.${sf} .${sf} {
|
|
61
|
-
margin-right: 0 ${r};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
body[${If}] {
|
|
65
|
-
${lf}: ${s}px;
|
|
66
|
-
}
|
|
67
|
-
`},Rf=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},zf=function(){L.useEffect(function(){return document.body.setAttribute(If,(Rf()+1).toString()),function(){var e=Rf()-1;e<=0?document.body.removeAttribute(If):document.body.setAttribute(If,e.toString())}},[])},Bf=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;zf();var a=L.useMemo(function(){return Pf(i)},[i]);return L.createElement(Ff,{styles:Lf(a,!t,i,n?``:`!important`)})},Vf=!1;if(typeof window<`u`)try{var Hf=Object.defineProperty({},`passive`,{get:function(){return Vf=!0,!0}});window.addEventListener(`test`,Hf,Hf),window.removeEventListener(`test`,Hf,Hf)}catch{Vf=!1}var Uf=Vf?{passive:!1}:!1,Wf=function(e){return e.tagName===`TEXTAREA`},Gf=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Wf(e)&&n[t]===`visible`)},Kf=function(e){return Gf(e,`overflowY`)},qf=function(e){return Gf(e,`overflowX`)},Jf=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Zf(e,r)){var i=Qf(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Yf=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Xf=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Zf=function(e,t){return e===`v`?Kf(t):qf(t)},Qf=function(e,t){return e===`v`?Yf(t):Xf(t)},$f=function(e,t){return e===`h`&&t===`rtl`?-1:1},ep=function(e,t,n,r,i){var a=$f(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Qf(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Zf(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},tp=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},np=function(e){return[e.deltaX,e.deltaY]},rp=function(e){return e&&`current`in e?e.current:e},ip=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ap=function(e){return`
|
|
68
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
69
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
70
|
-
`},op=0,sp=[];function cp(e){var t=L.useRef([]),n=L.useRef([0,0]),r=L.useRef(),i=L.useState(op++)[0],a=L.useState(Af)[0],o=L.useRef(e);L.useEffect(function(){o.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=af([e.lockRef.current],(e.shards||[]).map(rp),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=L.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=tp(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Jf(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Jf(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ep(h,t,e,h===`h`?s:c,!0)},[]),c=L.useCallback(function(e){var n=e;if(!(!sp.length||sp[sp.length-1]!==a)){var r=`deltaY`in n?np(n):tp(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ip(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(rp).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=L.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:lp(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=L.useCallback(function(e){n.current=tp(e),r.current=void 0},[]),d=L.useCallback(function(t){l(t.type,np(t),t.target,s(t,e.lockRef.current))},[]),f=L.useCallback(function(t){l(t.type,tp(t),t.target,s(t,e.lockRef.current))},[]);L.useEffect(function(){return sp.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Uf),document.addEventListener(`touchmove`,c,Uf),document.addEventListener(`touchstart`,u,Uf),function(){sp=sp.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Uf),document.removeEventListener(`touchmove`,c,Uf),document.removeEventListener(`touchstart`,u,Uf)}},[]);var p=e.removeScrollBar,m=e.inert;return L.createElement(L.Fragment,null,m?L.createElement(a,{styles:ap(i)}):null,p?L.createElement(Bf,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function lp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var up=yf(bf,cp),dp=L.forwardRef(function(e,t){return L.createElement(Sf,nf({},e,{ref:t,sideCar:up}))});dp.classNames=Sf.classNames;var fp=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},pp=new WeakMap,mp=new WeakMap,hp={},gp=0,_p=function(e){return e&&(e.host||_p(e.parentNode))},vp=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=_p(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},yp=function(e,t,n,r){var i=vp(t,Array.isArray(e)?e:[e]);hp[n]||(hp[n]=new WeakMap);var a=hp[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(pp.get(e)||0)+1,l=(a.get(e)||0)+1;pp.set(e,c),a.set(e,l),o.push(e),c===1&&i&&mp.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),gp++,function(){o.forEach(function(e){var t=pp.get(e)-1,i=a.get(e)-1;pp.set(e,t),a.set(e,i),t||(mp.has(e)||e.removeAttribute(r),mp.delete(e)),i||e.removeAttribute(n)}),gp--,gp||(pp=new WeakMap,pp=new WeakMap,mp=new WeakMap,hp={})}},bp=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||fp(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),yp(r,i,n,`aria-hidden`)):function(){return null}},xp=`Dialog`,[Sp,Cp]=Xu(xp),[wp,Tp]=Sp(xp),Ep=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=L.useRef(null),c=L.useRef(null),[l,u]=rd({prop:r,defaultProp:i??!1,onChange:a,caller:xp});return(0,B.jsx)(wp,{scope:t,triggerRef:s,contentRef:c,contentId:td(),titleId:td(),descriptionId:td(),open:l,onOpenChange:u,onOpenToggle:L.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Ep.displayName=xp;var Dp=`DialogTrigger`,Op=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Tp(Dp,n),a=Ju(t,i.triggerRef);return(0,B.jsx)(pd.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Jp(i.open),...r,ref:a,onClick:Gu(e.onClick,i.onOpenToggle)})});Op.displayName=Dp;var kp=`DialogPortal`,[Ap,jp]=Sp(kp,{forceMount:void 0}),Mp=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Tp(kp,t);return(0,B.jsx)(Ap,{scope:t,forceMount:n,children:L.Children.map(r,e=>(0,B.jsx)(Yd,{present:n||a.open,children:(0,B.jsx)(qd,{asChild:!0,container:i,children:e})}))})};Mp.displayName=kp;var Np=`DialogOverlay`,Pp=L.forwardRef((e,t)=>{let n=jp(Np,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Tp(Np,e.__scopeDialog);return a.modal?(0,B.jsx)(Yd,{present:r||a.open,children:(0,B.jsx)(Ip,{...i,ref:t})}):null});Pp.displayName=Np;var Fp=sd(`DialogOverlay.RemoveScroll`),Ip=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Tp(Np,n);return(0,B.jsx)(dp,{as:Fp,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(pd.div,{"data-state":Jp(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Lp=`DialogContent`,Rp=L.forwardRef((e,t)=>{let n=jp(Lp,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Tp(Lp,e.__scopeDialog);return(0,B.jsx)(Yd,{present:r||a.open,children:a.modal?(0,B.jsx)(zp,{...i,ref:t}):(0,B.jsx)(Bp,{...i,ref:t})})});Rp.displayName=Lp;var zp=L.forwardRef((e,t)=>{let n=Tp(Lp,e.__scopeDialog),r=L.useRef(null),i=Ju(t,n.contentRef,r);return L.useEffect(()=>{let e=r.current;if(e)return bp(e)},[]),(0,B.jsx)(Vp,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gu(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Gu(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Gu(e.onFocusOutside,e=>e.preventDefault())})}),Bp=L.forwardRef((e,t)=>{let n=Tp(Lp,e.__scopeDialog),r=L.useRef(!1),i=L.useRef(!1);return(0,B.jsx)(Vp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Vp=L.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Tp(Lp,n),c=L.useRef(null),l=Ju(t,c);return ef(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Pd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Cd,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Jp(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qp,{titleId:s.titleId}),(0,B.jsx)(em,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Hp=`DialogTitle`,Up=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Tp(Hp,n);return(0,B.jsx)(pd.h2,{id:i.titleId,...r,ref:t})});Up.displayName=Hp;var Wp=`DialogDescription`,Gp=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Tp(Wp,n);return(0,B.jsx)(pd.p,{id:i.descriptionId,...r,ref:t})});Gp.displayName=Wp;var Kp=`DialogClose`,qp=L.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Tp(Kp,n);return(0,B.jsx)(pd.button,{type:`button`,...r,ref:t,onClick:Gu(e.onClick,()=>i.onOpenChange(!1))})});qp.displayName=Kp;function Jp(e){return e?`open`:`closed`}var Yp=`DialogTitleWarning`,[Xp,Zp]=Yu(Yp,{contentName:Lp,titleName:Hp,docsSlug:`dialog`}),Qp=({titleId:e})=>{let t=Zp(Yp),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
71
|
-
|
|
72
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
73
|
-
|
|
74
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return L.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},$p=`DialogDescriptionWarning`,em=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Zp($p).contentName}}.`;return L.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},tm=Ep,nm=Op,rm=Mp,im=Pp,am=Rp,om=Up,sm=Gp,cm=qp;function lm(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var um=L.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:`bottom`,shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),dm=()=>{let e=L.useContext(um);if(!e)throw Error(`useDrawerContext must be used within a Drawer.Root`);return e};lm(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
75
|
-
[data-state=closed]
|
|
76
|
-
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function fm(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function pm(){return vm(/^Mac/)}function mm(){return vm(/^iPhone/)}function hm(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function gm(){return vm(/^iPad/)||pm()&&navigator.maxTouchPoints>1}function _m(){return mm()||gm()}function vm(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var ym=24,bm=typeof window<`u`?L.useLayoutEffect:L.useEffect;function xm(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var Sm=typeof document<`u`&&window.visualViewport;function Cm(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function wm(e){for(Cm(e)&&(e=e.parentElement);e&&!Cm(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var Tm=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),Em=0,Dm;function Om(e={}){let{isDisabled:t}=e;bm(()=>{if(!t)return Em++,Em===1&&_m()&&(Dm=km()),()=>{Em--,Em===0&&Dm?.()}},[t])}function km(){let e,t=0,n=n=>{e=wm(n.target),!(e===document.documentElement&&e===document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;Nm(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;Nm(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,Sm&&(Sm.height<window.innerHeight?requestAnimationFrame(()=>{Mm(t)}):Sm.addEventListener(`resize`,()=>Mm(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=xm(Am(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=xm(jm(document,`touchstart`,n,{passive:!1,capture:!0}),jm(document,`touchmove`,r,{passive:!1,capture:!0}),jm(document,`touchend`,i,{passive:!1,capture:!0}),jm(document,`focus`,a,!0),jm(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function Am(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function jm(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Mm(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=wm(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+ym&&(t.scrollTop+=r-n)}e=t.parentElement}}function Nm(e){return e instanceof HTMLInputElement&&!Tm.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Pm(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function Fm(...e){return t=>e.forEach(e=>Pm(e,t))}function Im(...e){return L.useCallback(Fm(...e),e)}var Lm=new WeakMap;function Rm(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&Lm.set(e,r)}function zm(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Lm.get(e);n&&(e.style[t]=n[t])}var Bm=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function Vm(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[Bm(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[Bm(t)?5:4]):null)}function Hm(e){return 8*(Math.log(e+1)-2)}function Um(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var Wm={DURATION:.5,EASE:[.32,.72,0,1]},Gm=.4,Km=.25,qm=100,Jm=8,Ym=16,Xm=26,Zm=`vaul-dragging`;function Qm(e){let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function $m({defaultProp:e,onChange:t}){let n=L.useState(e),[r]=n,i=L.useRef(r),a=Qm(t);return L.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function eh({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=$m({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=Qm(n);return[o,L.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function th({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=eh({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=L.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);L.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=L.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=L.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=L.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),Bm(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=L.useMemo(()=>h===null?null:_?.[h],[_,h]),y=L.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),Rm(r.current,{transition:`transform ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`,transform:Bm(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?Rm(i.current,{transition:`opacity ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`,opacity:`0`}):Rm(i.current,{transition:`opacity ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);L.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&Rm(i.current,{transition:`opacity ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=Bm(s)?window.innerHeight:window.innerWidth;if(r>Gm&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||Rm(r.current,{transform:Bm(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function nh(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=dm(),a=L.useRef(null),o=(0,L.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-Xm)/window.innerWidth}L.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&Um(document.body,{background:`black`}),Um(t,{transformOrigin:Bm(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${Wm.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Wm.EASE.join(`,`)})`});let n=Um(t,{borderRadius:`${Jm}px`,overflow:`hidden`,...Bm(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},Wm.DURATION*1e3)}}},[t,n,o])}var rh=null;function ih({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=L.useState(()=>typeof window<`u`?window.location.href:``),c=L.useRef(0),l=L.useCallback(()=>{if(hm()&&rh===null&&e&&!a){rh={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=L.useCallback(()=>{if(hm()&&rh!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,rh),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),rh=null}},[o]);return L.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),L.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),L.useEffect(()=>{n||!r||(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function ah({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=Km,scrollLockTimeout:l=qm,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:O=!1}){let[k=!1,A]=eh({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&ye(),setTimeout(()=>{E?.(e)},Wm.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[j,M]=L.useState(!1),[N,ee]=L.useState(!1),[P,F]=L.useState(!1),te=L.useRef(null),I=L.useRef(null),ne=L.useRef(null),re=L.useRef(null),R=L.useRef(null),z=L.useRef(!1),ie=L.useRef(null),ae=L.useRef(0),oe=L.useRef(!1),se=L.useRef(!x),B=L.useRef(0),V=L.useRef(null),ce=L.useRef(V.current?.getBoundingClientRect().height||0),le=L.useRef(V.current?.getBoundingClientRect().width||0),ue=L.useRef(0),{activeSnapPoint:de,activeSnapPointIndex:fe,setActiveSnapPoint:pe,onRelease:me,snapPointsOffset:he,onDrag:ge,shouldFade:_e,getPercentageDragged:ve}=th({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:V,fadeFromIndex:f,overlayRef:te,onSnapPointChange:L.useCallback(e=>{a&&e===he.length-1&&(I.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});Om({isDisabled:!k||N||!g||P||!j||!T||!S});let{restorePositionSetting:ye}=ih({isOpen:k,modal:g,nested:v??!1,hasBeenOpened:j,preventScrollRestoration:w,noBodyStyles:y});function be(){return(window.innerWidth-Xm)/window.innerWidth}function xe(e){!u&&!a||V.current&&!V.current.contains(e.target)||(ce.current=V.current?.getBoundingClientRect().height||0,le.current=V.current?.getBoundingClientRect().width||0,ee(!0),ne.current=new Date,_m()&&window.addEventListener(`touchend`,()=>z.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),ae.current=Bm(b)?e.pageY:e.pageX)}function Se(e,t){let n=e,r=window.getSelection()?.toString(),i=V.current?Vm(V.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(I.current&&a.getTime()-I.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(R.current&&a.getTime()-R.current.getTime()<l&&i===0||t)return R.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return R.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function Ce(e){if(V.current&&N){let t=b===`bottom`||b===`right`?1:-1,n=(ae.current-(Bm(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&fe===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?ce.current:le.current),p=ve(c,i);if(p!==null&&(d=p),s&&d>=1||!z.current&&!Se(e.target,i))return;if(V.current.classList.add(Zm),z.current=!0,Rm(V.current,{transition:`none`}),Rm(te.current,{transition:`none`}),a&&ge({draggedDistance:n}),i&&!a){let e=Hm(n),r=Math.min(e*-1,0)*t;Rm(V.current,{transform:Bm(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((_e||f&&fe===f-1)&&(r?.(e,d),Rm(te.current,{opacity:`${m}`,transition:`none`},!0)),l&&te.current&&o){let e=Math.min(be()+d*(1-be()),1),t=8-d*8,n=Math.max(0,14-d*14);Rm(l,{borderRadius:`${t}px`,transform:Bm(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;Rm(V.current,{transform:Bm(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}L.useEffect(()=>{window.requestAnimationFrame(()=>{se.current=!0})},[]),L.useEffect(()=>{var e;function t(){if(!V.current||!T)return;let e=document.activeElement;if(Nm(e)||oe.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=V.current.getBoundingClientRect().height||0,i=r>t*.8;ue.current||=r;let o=V.current.getBoundingClientRect().top;if(Math.abs(B.current-n)>60&&(oe.current=!oe.current),a&&a.length>0&&he&&fe){let e=he[fe]||0;n+=e}if(B.current=n,r>e||oe.current){let t=V.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:Xm)),h?V.current.style.height=`${t-Math.max(n,0)}px`:V.current.style.height=`${Math.max(r,e-o)}px`}else fm()||(V.current.style.height=`${ue.current}px`);a&&a.length>0&&!oe.current?V.current.style.bottom=`0px`:V.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[fe,a,he]);function we(e){Ee(),_?.(),e||A(!1),setTimeout(()=>{a&&pe(a[0])},Wm.DURATION*1e3)}function Te(){if(!V.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=Vm(V.current,b);Rm(V.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`}),Rm(te.current,{transition:`opacity ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&k&&Rm(e,{borderRadius:`${Jm}px`,overflow:`hidden`,...Bm(b)?{transform:`scale(${be()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${be()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${Wm.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Wm.EASE.join(`,`)})`},!0)}function Ee(){!N||!V.current||(V.current.classList.remove(Zm),z.current=!1,ee(!1),re.current=new Date)}function De(e){if(!N||!V.current)return;V.current.classList.remove(Zm),z.current=!1,ee(!1),re.current=new Date;let t=Vm(V.current,b);if(!e||!Se(e.target,!1)||!t||Number.isNaN(t)||ne.current===null)return;let n=re.current.getTime()-ne.current.getTime(),r=ae.current-(Bm(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(F(!0),setTimeout(()=>{F(!1)},200)),a){me({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:we,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){Te(),i?.(e,!0);return}if(o>Gm){we(),i?.(e,!1);return}let s=Math.min(V.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(V.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){we(),i?.(e,!1);return}i?.(e,!0),Te()}L.useEffect(()=>(k&&(Rm(document.documentElement,{scrollBehavior:`auto`}),I.current=new Date),()=>{zm(document.documentElement,`scrollBehavior`)}),[k]);function Oe(e){let t=e?(window.innerWidth-Ym)/window.innerWidth:1,n=e?-Ym:0;ie.current&&window.clearTimeout(ie.current),Rm(V.current,{transition:`transform ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`,transform:Bm(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&V.current&&(ie.current=setTimeout(()=>{let e=Vm(V.current,b);Rm(V.current,{transition:`none`,transform:Bm(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function ke(e,t){if(t<0)return;let n=(window.innerWidth-Ym)/window.innerWidth,r=n+t*(1-n),i=-Ym+t*Ym;Rm(V.current,{transform:Bm(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function Ae(e,t){let n=Bm(b)?window.innerHeight:window.innerWidth,r=t?(n-Ym)/n:1,i=t?-Ym:0;t&&Rm(V.current,{transition:`transform ${Wm.DURATION}s cubic-bezier(${Wm.EASE.join(`,`)})`,transform:Bm(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return L.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),L.createElement(tm,{defaultOpen:x,onOpenChange:e=>{!u&&!e||(e?M(!0):we(!0),A(e))},open:k},L.createElement(um.Provider,{value:{activeSnapPoint:de,snapPoints:a,setActiveSnapPoint:pe,drawerRef:V,overlayRef:te,onOpenChange:t,onPress:xe,onRelease:De,onDrag:Ce,dismissible:u,shouldAnimate:se,handleOnly:d,isOpen:k,isDragging:N,shouldFade:_e,closeDrawer:we,onNestedDrag:ke,onNestedOpenChange:Oe,onNestedRelease:Ae,keyboardIsOpen:oe,modal:g,snapPointsOffset:he,activeSnapPointIndex:fe,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:O}},n))}var oh=L.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=dm(),l=Im(t,n),u=r&&r.length>0;if(!s)return null;let d=L.useCallback(e=>i(e),[i]);return L.createElement(im,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});oh.displayName=`Drawer.Overlay`;var sh=L.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=dm(),[b,x]=L.useState(!1),S=Im(i,a),C=L.useRef(null),w=L.useRef(null),T=L.useRef(!1),E=h&&h.length>0;nh();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};L.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function O(e){C.current=null,T.current=!1,s(e)}return L.createElement(am,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),O(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&O(w.current)}})});sh.displayName=`Drawer.Content`;var ch=250,lh=120,uh=L.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=dm(),m=L.useRef(null),h=L.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},lh)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},ch)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return L.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},L.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});uh.displayName=`Drawer.Handle`;function dh({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=dm();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return L.createElement(ah,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function fh(e){let t=dm(),{container:n=t.container,...r}=e;return L.createElement(rm,{container:n,...r})}var ph={Root:ah,NestedRoot:dh,Content:sh,Overlay:oh,Trigger:nm,Portal:fh,Handle:uh,Close:cm,Title:om,Description:sm},mh={nav:`_nav_z2och_1`,tab:`_tab_z2och_18`,active:`_active_z2och_40`,halo:`_halo_z2och_45`,icon:`_icon_z2och_70`,label:`_label_z2och_81`,sheetOverlay:`_sheetOverlay_z2och_95`,sheet:`_sheet_z2och_95`,sheetGrip:`_sheetGrip_z2och_117`,sheetGrid:`_sheetGrid_z2och_126`,sheetItem:`_sheetItem_z2och_132`,sheetItemActive:`_sheetItemActive_z2och_158`,srOnly:`_srOnly_z2och_164`};function hh({size:e=20,strokeWidth:t=1.5,color:n,style:r,className:i,"aria-label":a,children:o}){return(0,B.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,role:a?`img`:void 0,"aria-label":a,"aria-hidden":a?void 0:!0,focusable:`false`,className:i,style:{color:n,display:`block`,...r},children:o})}function gh(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`13`,r:`7.5`}),(0,B.jsx)(`path`,{d:`M12 9.5v3.5l2.25 1.5`}),(0,B.jsx)(`path`,{d:`M9 3.25h6`}),(0,B.jsx)(`path`,{d:`M18.5 5.75l1.75 1.75`})]})}function _h(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`rect`,{x:`9`,y:`3.25`,width:`6`,height:`4.25`,rx:`1.1`}),(0,B.jsx)(`rect`,{x:`3.25`,y:`15.75`,width:`5.5`,height:`4.25`,rx:`1.1`}),(0,B.jsx)(`rect`,{x:`15.25`,y:`15.75`,width:`5.5`,height:`4.25`,rx:`1.1`}),(0,B.jsx)(`path`,{d:`M12 7.5v3.5M6 15.75V11h12v4.75`})]})}function vh(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`path`,{d:`M4 6.25a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8.5a2 2 0 0 1-2 2H11l-4 3v-3H6a2 2 0 0 1-2-2z`}),(0,B.jsx)(`circle`,{cx:`9`,cy:`10.5`,r:`0.6`,fill:`currentColor`,stroke:`none`}),(0,B.jsx)(`circle`,{cx:`12`,cy:`10.5`,r:`0.6`,fill:`currentColor`,stroke:`none`}),(0,B.jsx)(`circle`,{cx:`15`,cy:`10.5`,r:`0.6`,fill:`currentColor`,stroke:`none`})]})}function yh(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`rect`,{x:`4.5`,y:`4.5`,width:`15`,height:`15`,rx:`2.25`}),(0,B.jsx)(`path`,{d:`M8 9.25h8M8 12.5h8M8 15.75h5`})]})}function bh(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`path`,{d:`M4 19.25h16`}),(0,B.jsx)(`rect`,{x:`6`,y:`11.5`,width:`3`,height:`7.75`,rx:`0.8`}),(0,B.jsx)(`rect`,{x:`10.5`,y:`7.5`,width:`3`,height:`11.75`,rx:`0.8`}),(0,B.jsx)(`rect`,{x:`15`,y:`13.75`,width:`3`,height:`5.5`,rx:`0.8`})]})}function xh(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2.75`}),(0,B.jsx)(`path`,{d:`M12 3.25v2.5M12 18.25v2.5M3.25 12h2.5M18.25 12h2.5M5.75 5.75l1.8 1.8M16.45 16.45l1.8 1.8M5.75 18.25l1.8-1.8M16.45 7.55l1.8-1.8`})]})}function Sh(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`path`,{d:`M5 5h11l3 3v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Z`}),(0,B.jsx)(`path`,{d:`M16 5v3h3`}),(0,B.jsx)(`path`,{d:`M8 12h7M8 15h7M8 18h4`})]})}function Ch(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`path`,{d:`M12 3.25a5.75 5.75 0 0 1 3.75 10.12V15a1 1 0 0 1-1 1h-5.5a1 1 0 0 1-1-1v-1.63A5.75 5.75 0 0 1 12 3.25z`}),(0,B.jsx)(`path`,{d:`M9.75 16v.75a2.25 2.25 0 0 0 4.5 0V16`})]})}function wh(e){return(0,B.jsxs)(hh,{...e,children:[(0,B.jsx)(`circle`,{cx:`5`,cy:`6`,r:`2`}),(0,B.jsx)(`circle`,{cx:`19`,cy:`6`,r:`2`}),(0,B.jsx)(`circle`,{cx:`12`,cy:`18`,r:`2`}),(0,B.jsx)(`path`,{d:`M7 6h10M5.5 7.5L11 16.5M18.5 7.5L13 16.5`})]})}function Th({size:e=26,style:t,"aria-label":n}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 28 28`,fill:`none`,role:n?`img`:void 0,"aria-label":n,"aria-hidden":n?void 0:!0,focusable:`false`,style:{display:`block`,...t},children:[(0,B.jsx)(`path`,{d:`M9.5 9.5 L19 15.25 M9.5 9.5 L19 21.25`,stroke:C.muted,strokeWidth:1.25,strokeLinecap:`round`,opacity:.55}),(0,B.jsx)(`circle`,{cx:`19`,cy:`15.25`,r:`2.35`,fill:C.darkBg,stroke:C.muted,strokeWidth:1.4}),(0,B.jsx)(`circle`,{cx:`19`,cy:`21.25`,r:`2.35`,fill:C.darkBg,stroke:C.muted,strokeWidth:1.4}),(0,B.jsx)(`circle`,{cx:`9.5`,cy:`9.5`,r:`3.5`,fill:`var(--color-primary)`}),(0,B.jsx)(`circle`,{cx:`9.5`,cy:`9.5`,r:`3.5`,fill:`none`,stroke:`var(--color-primary)`,strokeOpacity:.5,strokeWidth:3.5})]})}function Eh({size:e=20,strokeWidth:t=1.75}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M12 4.5c-3 0-5 1.5-5 3.75 0 1 .4 1.75 1 2.25-.6.5-1 1.25-1 2.25 0 1.25.75 2.25 2 2.75 0 1.5 1 2.5 3 2.5v-13.5z`}),(0,B.jsx)(`path`,{d:`M12 4.5c3 0 5 1.5 5 3.75 0 1-.4 1.75-1 2.25.6.5 1 1.25 1 2.25 0 1.25-.75 2.25-2 2.75 0 1.5-1 2.5-3 2.5`}),(0,B.jsx)(`path`,{d:`M9.5 9.25h1M9.5 12h1M9.5 14.75h1M13.5 9.25h1M13.5 12h1M13.5 14.75h1`})]})}function Dh({size:e=20,strokeWidth:t=1.75}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M2 12a10 10 0 0 1 17-7.1`}),(0,B.jsx)(`path`,{d:`M22 12a10 10 0 0 1-17 7.1`}),(0,B.jsx)(`polyline`,{points:`19 2 22 5 19 8`}),(0,B.jsx)(`polyline`,{points:`5 22 2 19 5 16`})]})}function Oh({size:e=20,strokeWidth:t=1.75}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,B.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.6`}),(0,B.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.6`}),(0,B.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.6`})]})}var kh=[{id:`cron`,label:`Cron`,Icon:gh},{id:`chat`,label:`Chat`,Icon:vh},{id:`ideas`,label:`Ideas`,Icon:Ch}],Ah=[{id:`org`,label:`Org`,Icon:_h},{id:`memory`,label:`Memory`,Icon:Eh},{id:`briefs`,label:`Briefs`,Icon:Sh},{id:`pipelines`,label:`Pipelines`,Icon:wh},{id:`continuous-improvement`,label:`CI`,Icon:Dh},{id:`sessions`,label:`Sessions`,Icon:yh},{id:`analytics`,label:`Stats`,Icon:bh},{id:`settings`,label:`Settings`,Icon:xh}],jh=new Set(Ah.map(e=>e.id));function Mh({activePage:e,onNavigate:t}){let[n,r]=(0,L.useState)(!1),i=jh.has(e);return(0,L.useEffect)(()=>{r(!1)},[e]),(0,L.useEffect)(()=>{if(!(typeof document>`u`))return n?document.body.dataset.moreSheetOpen=`true`:delete document.body.dataset.moreSheetOpen,()=>{delete document.body.dataset.moreSheetOpen}},[n]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`nav`,{className:`bottom-nav ${mh.nav}`,children:[kh.map(n=>{let r=e===n.id,i=n.Icon;return(0,B.jsxs)(`button`,{onClick:()=>t(n.id),"aria-label":n.label,"aria-current":r?`page`:void 0,className:`tw-nav-tab ${mh.tab} ${r?mh.active:``}`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:mh.halo}),(0,B.jsx)(`span`,{className:mh.icon,children:(0,B.jsx)(i,{size:22,strokeWidth:1.75})}),(0,B.jsx)(`span`,{className:mh.label,children:n.label})]},n.id)}),(0,B.jsxs)(`button`,{onClick:()=>r(e=>!e),"aria-label":`More`,"aria-expanded":n,"aria-current":i?`page`:void 0,className:`tw-nav-tab ${mh.tab} ${i||n?mh.active:``}`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:mh.halo}),(0,B.jsx)(`span`,{className:mh.icon,children:(0,B.jsx)(Oh,{size:22,strokeWidth:1.75})}),(0,B.jsx)(`span`,{className:mh.label,children:`More`})]})]}),(0,B.jsx)(ph.Root,{open:n,onOpenChange:r,shouldScaleBackground:!1,children:(0,B.jsxs)(ph.Portal,{children:[(0,B.jsx)(ph.Overlay,{className:mh.sheetOverlay}),(0,B.jsxs)(ph.Content,{className:mh.sheet,"aria-describedby":void 0,children:[(0,B.jsx)(ph.Title,{className:mh.srOnly,children:`More navigation`}),(0,B.jsx)(ph.Handle,{className:mh.sheetGrip}),(0,B.jsx)(`div`,{className:mh.sheetGrid,children:Ah.map(n=>{let r=e===n.id,i=n.Icon;return(0,B.jsxs)(`button`,{onClick:()=>t(n.id),"aria-current":r?`page`:void 0,className:`${mh.sheetItem} ${r?mh.sheetItemActive:``}`,children:[(0,B.jsx)(i,{size:22,strokeWidth:1.75}),(0,B.jsx)(`span`,{children:n.label})]},n.id)})})]})]})})]})}function Nh({href:e,isMobile:t,position:n,handlers:r,consumeJustDragged:i}){return(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,title:`Open Slack DMs with yourself (drag to move)`,className:`slack-dm-fab`,draggable:!1,onDragStart:e=>e.preventDefault(),onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.onPointerUp,onPointerCancel:r.onPointerCancel,onClick:e=>{i()&&e.preventDefault()},style:{position:`fixed`,...t?{}:n?{left:n.x,top:n.y}:{bottom:88,right:24},zIndex:1e3,display:`flex`,alignItems:`center`,justifyContent:`center`,width:48,height:48,borderRadius:`50%`,background:`var(--color-bg-raised-alt)`,border:`1px solid #30363d`,boxShadow:`0 4px 12px rgba(0,0,0,0.4)`,textDecoration:`none`,cursor:t?`pointer`:`grab`,transition:`transform 0.15s, box-shadow 0.15s`,touchAction:`none`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.1)`,e.currentTarget.style.boxShadow=`0 6px 16px rgba(0,0,0,0.5)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`,e.currentTarget.style.boxShadow=`0 4px 12px rgba(0,0,0,0.4)`},children:(0,B.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 123 123`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,B.jsx)(`path`,{d:`M25.8 77.6a12.9 12.9 0 1 1-12.9-12.9h12.9v12.9zm6.5 0a12.9 12.9 0 1 1 25.8 0v32.3a12.9 12.9 0 1 1-25.8 0V77.6z`,fill:`#E01E5A`}),(0,B.jsx)(`path`,{d:`M45.2 25.8a12.9 12.9 0 1 1 12.9-12.9v12.9H45.2zm0 6.5a12.9 12.9 0 1 1 0 25.8H12.9a12.9 12.9 0 0 1 0-25.8h32.3z`,fill:`#36C5F0`}),(0,B.jsx)(`path`,{d:`M97 45.2a12.9 12.9 0 1 1 12.9 12.9H97V45.2zm-6.5 0a12.9 12.9 0 1 1-25.8 0V12.9a12.9 12.9 0 1 1 25.8 0v32.3z`,fill:`#2EB67D`}),(0,B.jsx)(`path`,{d:`M77.6 97a12.9 12.9 0 1 1-12.9 12.9V97h12.9zm0-6.5a12.9 12.9 0 1 1 0-25.8h32.3a12.9 12.9 0 1 1 0 25.8H77.6z`,fill:`#ECB22E`})]})})}var q={af809fa:`_af809fa_1o3aj_6`,ab164f9:`_ab164f9_1o3aj_10`,a195c6b:`_a195c6b_1o3aj_14`,a45fb7b:`_a45fb7b_1o3aj_20`,a2d6462:`_a2d6462_1o3aj_32`,a884009:`_a884009_1o3aj_38`,a1d9a86:`_a1d9a86_1o3aj_45`,ade1373:`_ade1373_1o3aj_50`,aa2a86d:`_aa2a86d_1o3aj_63`,ae665e3:`_ae665e3_1o3aj_81`,a393656:`_a393656_1o3aj_87`,af255fe:`_af255fe_1o3aj_102`,ac05d05:`_ac05d05_1o3aj_106`,af2b8de:`_af2b8de_1o3aj_112`,a48b34d:`_a48b34d_1o3aj_127`,a6205e1:`_a6205e1_1o3aj_142`,a829410:`_a829410_1o3aj_160`,a2258cf:`_a2258cf_1o3aj_175`,aa1d080:`_aa1d080_1o3aj_190`,a646636:`_a646636_1o3aj_205`,a83be98:`_a83be98_1o3aj_211`,a3fb2cd:`_a3fb2cd_1o3aj_216`,a506044:`_a506044_1o3aj_220`,a944a49:`_a944a49_1o3aj_226`,a4d5f18:`_a4d5f18_1o3aj_234`,a877086:`_a877086_1o3aj_247`,a8fbc9a:`_a8fbc9a_1o3aj_255`,aa93ed6:`_aa93ed6_1o3aj_261`,aeb1b5d:`_aeb1b5d_1o3aj_265`,ab96dcc:`_ab96dcc_1o3aj_271`,aa21b52:`_aa21b52_1o3aj_277`,a605393:`_a605393_1o3aj_282`,a15c1ca:`_a15c1ca_1o3aj_288`,a58d2af:`_a58d2af_1o3aj_293`,a349e79:`_a349e79_1o3aj_298`};function Ph({pauseState:e,jobs:t,onResumeAll:n,onResumed:r}){if(!e?.paused)return null;let i=e.stillRunning.map(e=>t.find(t=>t.id===e)?.name??e),a=e.pausedJobIds.length,o=e.stillRunning.length,s=e.until?`until ${new Date(e.until).toLocaleString()}`:e.reason===`scheduled`?`by schedule`:`indefinitely`;return(0,B.jsxs)(`div`,{role:`status`,className:q.ade1373,children:[(0,B.jsxs)(`div`,{className:q.a1d9a86,children:[(0,B.jsxs)(`div`,{className:q.a884009,children:[`Global pause active `,s]}),(0,B.jsxs)(`div`,{className:q.a2d6462,children:[a,` job`,a===1?``:`s`,` paused`,o>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,o,` still running (essential): `,i.join(`, `)]})]})]}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm ${q.a45fb7b}`,onClick:async()=>{await n()&&r()},children:`Resume all`})]})}var Fh={synced:`_synced_14p5o_1`,inSync:`_inSync_14p5o_10`,outOfSync:`_outOfSync_14p5o_19`,dot:`_dot_14p5o_25`,dotGreen:`_dotGreen_14p5o_34`,dotAmber:`_dotAmber_14p5o_35`,pulse:`_pulse_14p5o_1`};function Ih({refreshKey:e,onSync:t}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),c=(0,L.useCallback)(async()=>{try{let e=await fetch(`/api/crontab/status`);e.ok&&r(await e.json())}catch{}},[]);(0,L.useEffect)(()=>{c()},[c,e]),p(`crontab:synced`,()=>{c()});let l=async()=>{a(!0);try{await t(),s(!0),await c(),setTimeout(()=>s(!1),3e3)}finally{a(!1)}};if(!n)return(0,B.jsx)(`button`,{className:`btn btn-green`,onClick:l,disabled:i,children:`Sync Cron Jobs`});if(o&&n.inSync)return(0,B.jsx)(`button`,{className:`btn ${Fh.synced}`,disabled:!0,children:`✓ Synced`});if(n.inSync)return(0,B.jsxs)(`button`,{className:`btn ${Fh.inSync}`,onClick:l,title:`Crontab in sync — ${n.installed} job${n.installed===1?``:`s`} installed`,children:[(0,B.jsx)(`span`,{className:`${Fh.dot} ${Fh.dotGreen}`}),`Cron Synced`]});let u=n.missing.length+n.extra.length+n.scheduleMismatch.length,d=[];n.missing.length>0&&d.push(`Missing: ${n.missing.join(`, `)}`),n.extra.length>0&&d.push(`Extra: ${n.extra.join(`, `)}`);for(let e of n.scheduleMismatch)d.push(`${e.jobId}: expected "${e.expected}", got "${e.installed}"`);let f=`${u} issue${u===1?``:`s`} — click to sync\n${d.join(`
|
|
77
|
-
`)}`;return(0,B.jsxs)(`button`,{className:`btn ${Fh.outOfSync}`,onClick:l,disabled:i,title:f,children:[(0,B.jsx)(`span`,{className:`${Fh.dot} ${Fh.dotAmber}`}),i?`Syncing…`:`${u} Out of Sync`]})}function Lh({activityOpen:e,onToggleActivity:t,unreadFeedCount:n,focusOpen:r,onToggleFocus:i,focusActiveCount:a,onToggleSettings:o,onNewJob:s,onToggleGuide:c,changelogOpen:l,onToggleChangelog:u,unreadChangelogCount:d,onOpenGoalWizard:f,actionableGoalsCount:p,crontabRefreshKey:m,onSyncCrontab:h}){let[g,_]=(0,L.useState)(!1);return(0,B.jsxs)(`div`,{className:`mobile-action-bar ${q.af255fe}`,children:[(0,B.jsxs)(`div`,{className:`mobile-action-bar-row`,children:[(0,B.jsxs)(`button`,{className:`${e?`btn btn-sm btn-primary mobile-action-btn`:`btn btn-sm mobile-action-btn`} ${q.af255fe}`,onClick:t,children:[`☰ Activity`,!e&&n>0&&(0,B.jsx)(`span`,{className:`btn-badge ${q.a48b34d}`,children:n})]}),(0,B.jsxs)(`button`,{className:`${r?`btn btn-sm btn-primary mobile-action-btn`:`btn btn-sm mobile-action-btn`} ${q.af255fe}`,onClick:i,children:[`☆`,` Focus`,!r&&a>0&&(0,B.jsx)(`span`,{className:`btn-badge ${q.af2b8de}`,children:a})]}),(0,B.jsx)(`button`,{className:`btn btn-sm mobile-action-btn`,onClick:o,children:`⚙ Settings`}),(0,B.jsx)(`button`,{className:`btn btn-sm btn-primary mobile-action-btn`,onClick:s,children:`+ Add Job`})]}),(0,B.jsx)(`button`,{className:`btn btn-sm mobile-action-btn mobile-action-bar-more ${q.af255fe}`,onClick:()=>_(e=>!e),"aria-label":`More actions`,"aria-expanded":g,children:`⋯ More`}),g&&(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(`div`,{className:q.ac05d05,onClick:()=>_(!1)})}),g&&(0,B.jsxs)(`div`,{className:`mobile-more-dropdown`,children:[(0,B.jsx)(`button`,{className:`btn btn-sm mobile-more-item`,onClick:()=>{c(),_(!1)},children:`📚 Guide`}),(0,B.jsxs)(`button`,{className:`btn btn-sm mobile-more-item ${q.af255fe}`,onClick:()=>{u(),_(!1)},children:[`📝 What's New`,!l&&d>0&&(0,B.jsx)(`span`,{className:q.a393656,children:d})]}),(0,B.jsxs)(`button`,{className:`btn btn-sm mobile-more-item ${q.ae665e3}`,onClick:()=>{f(),_(!1)},children:[`✨`,` Goal`,p>0&&(0,B.jsx)(`span`,{className:q.aa2a86d,children:p})]}),(0,B.jsx)(Ih,{refreshKey:m,onSync:h})]})]})}var Rh=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],zh=Array.from({length:24},(e,t)=>({value:t,label:t===0?`12 AM`:t<12?`${t} AM`:t===12?`12 PM`:`${t-12} PM`})),Bh=[{value:0,label:`:00`},{value:15,label:`:15`},{value:30,label:`:30`},{value:45,label:`:45`}],Vh=[{value:.25,label:`Every 15m`},{value:.5,label:`Every 30m`},{value:1,label:`Every hour`},{value:2,label:`Every 2h`},{value:3,label:`Every 3h`},{value:4,label:`Every 4h`},{value:6,label:`Every 6h`},{value:8,label:`Every 8h`},{value:12,label:`Every 12h`}],Hh=[{label:`Every day`,days:[0,1,2,3,4,5,6]},{label:`Mon–Fri`,days:[1,2,3,4,5]},{label:`Sat–Sun`,days:[0,6]}];function Uh(e,t){if(e.length!==t.length)return!1;let n=new Set(e);return t.every(e=>n.has(e))}function Wh({days:e,onChange:t}){return(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[(0,B.jsx)(`div`,{style:{display:`flex`,gap:4},children:Rh.map((n,r)=>{let i=e.includes(r);return(0,B.jsx)(`button`,{type:`button`,onClick:()=>{i&&e.length===1||t(i?e.filter(e=>e!==r):[...e,r])},style:{flex:1,padding:`4px 0`,fontSize:10,fontWeight:600,border:`1px solid ${i?`rgba(188,140,255,0.5)`:C.border}`,background:i?`rgba(188,140,255,0.15)`:`var(--color-bg-raised)`,color:i?`var(--color-primary)`:C.muted,borderRadius:4,cursor:`pointer`,transition:`all 0.15s ease`},children:n},r)})}),(0,B.jsx)(`div`,{style:{display:`flex`,gap:4,flexWrap:`wrap`},children:Hh.map(n=>{let r=Uh(e,n.days);return(0,B.jsx)(`button`,{type:`button`,onClick:()=>t([...n.days]),style:{padding:`2px 8px`,fontSize:10,fontWeight:500,border:`1px solid ${r?`rgba(188,140,255,0.5)`:C.border}`,background:r?`rgba(188,140,255,0.15)`:`transparent`,color:r?`var(--color-primary)`:C.muted,borderRadius:12,cursor:`pointer`,transition:`all 0.15s ease`},children:n.label},n.label)})})]})}var Gh={background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${C.border}`,borderRadius:4,padding:`3px 8px`,fontSize:12,cursor:`pointer`,outline:`none`},Kh={...y.hint,marginBottom:3};function qh({hour:e,minute:t,onHourChange:n,onMinuteChange:r}){return(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-end`},children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:Kh,children:`Hour`}),(0,B.jsx)(`select`,{value:e,onChange:e=>n(parseInt(e.target.value)),style:Gh,children:zh.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:Kh,children:`Minute`}),(0,B.jsx)(`select`,{value:t,onChange:e=>r(parseInt(e.target.value)),style:Gh,children:Bh.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})}function Jh(e){return String(e).padStart(2,`0`)}function Yh(e,t){let n=e%12==0?12:e%12,r=e<12?`AM`:`PM`;return t===0?`${n} ${r}`:`${n}:${Jh(t)} ${r}`}function Xh(e){if(e.length===0)return`—`;if(e.length===7)return`Every day`;let t=[...e].sort((e,t)=>e-t);return t.length===5&&t.join(`,`)===`1,2,3,4,5`?`Weekdays`:t.length===2&&t[0]===0&&t[1]===6?`Weekends`:t.map(e=>Rh[e]).join(`, `)}function Zh(e){return e.length===0||e.length===7?`*`:[...e].sort((e,t)=>e-t).join(`,`)}function Qh(e,t){let{hour:n,minute:r,days:i,intervalHours:a,rangeStart:o,rangeEnd:s}=t,c=Jh(r),l=Jh(n);switch(e){case`weekdays`:return`${c} ${l} * * 1-5`;case`daily`:return`${c} ${l} * * *`;case`hourly`:{let e=Zh(i);if(a<1)return`*/${Math.round(a*60)} * * * ${e}`;let t=o===0&&s===23,n;return n=a===1?t?`*`:`${o}-${s}`:`${o}-${s}/${a}`,`0 ${n} * * ${e}`}case`weekly`:return`${c} ${l} * * ${Zh(i)}`;case`custom`:return t.customCron}}function $h(e,t){let{hour:n,minute:r,days:i,intervalHours:a,rangeStart:o,rangeEnd:s}=t,c=Yh(n,r);switch(e){case`weekdays`:return`Weekdays at ${c}`;case`daily`:return`Daily at ${c}`;case`hourly`:{let e=i.length>0&&i.length<7?`${Xh(i)}, `:``;return a<1?`${e}every ${Math.round(a*60)} minutes`:`${e}${zh[o]?.label??`${o}:00`}–${zh[s]?.label??`${s}:00`}, ${a===1?`every hour`:`every ${a}h`}`}case`weekly`:return i.length===0?`Weekly at ${c}`:`${Xh(i)} at ${c}`;case`custom`:return t.customHuman}}var eg=/^\d+$/,tg=[0,1,2,3,4,5,6];function ng(e){return eg.test(e)}function rg(e,t){return Number.isInteger(e)&&Number.isInteger(t)&&e>=0&&t<=23&&e<=t}function ig(e){if(e===`*`)return[...tg];if(e.includes(`-`)&&!e.includes(`,`)){let[t,n]=e.split(`-`).map(e=>parseInt(e,10));if(isNaN(t)||isNaN(n)||t<0||n>7||t>n)return null;let r=[];for(let e=t;e<=n;e++)r.push(e===7?0:e);return[...new Set(r)].sort((e,t)=>e-t)}let t=e.split(`,`).map(e=>parseInt(e,10));if(t.some(e=>isNaN(e)||e<0||e>7))return null;let n=t.map(e=>e===7?0:e);return[...new Set(n)].sort((e,t)=>e-t)}function ag(e,t){let n={hour:9,minute:0,days:[1,2,3,4,5],intervalHours:1,rangeStart:9,rangeEnd:17,customCron:e,customHuman:t};if(!e||e.trim()===``)return{mode:`weekdays`,state:n};let r=e.trim().split(/\s+/);if(r.length!==5)return{mode:`custom`,state:{...n,customCron:e,customHuman:t}};let[i,a,,,o]=r,s=r[2]===`*`&&r[3]===`*`;if(o===`1-5`&&s&&ng(i)&&ng(a))return{mode:`weekdays`,state:{...n,hour:parseInt(a,10),minute:parseInt(i,10)}};if(s){let e=ig(o);if(e){if(i.startsWith(`*/`)&&a===`*`){let t=parseInt(i.slice(2),10);if(!isNaN(t)&&t>0&&t<60)return{mode:`hourly`,state:{...n,intervalHours:t/60,rangeStart:0,rangeEnd:23,days:e}}}if(i===`0`&&a===`*`)return{mode:`hourly`,state:{...n,intervalHours:1,rangeStart:0,rangeEnd:23,days:e}};if(i===`0`&&a.includes(`/`)&&a.includes(`-`)){let[t,r]=a.split(`/`),[i,o]=t.split(`-`),s=parseInt(i,10),c=parseInt(o,10),l=parseInt(r,10);if(rg(s,c)&&Number.isInteger(l)&&l>0)return{mode:`hourly`,state:{...n,intervalHours:l,rangeStart:s,rangeEnd:c,days:e}}}if(i===`0`&&/^\d+-\d+$/.test(a)){let[t,r]=a.split(`-`),i=parseInt(t,10),o=parseInt(r,10);if(rg(i,o))return{mode:`hourly`,state:{...n,intervalHours:1,rangeStart:i,rangeEnd:o,days:e}}}}}if(o===`*`&&s&&ng(i)&&ng(a))return{mode:`daily`,state:{...n,hour:parseInt(a,10),minute:parseInt(i,10)}};if(s&&o!==`*`&&ng(i)&&ng(a)){let e=ig(o);if(e&&e.length>0&&e.length<7)return{mode:`weekly`,state:{...n,hour:parseInt(a,10),minute:parseInt(i,10),days:e}}}return{mode:`custom`,state:{...n,customCron:e,customHuman:t}}}var og=[{value:`weekdays`,label:`Weekdays`},{value:`daily`,label:`Daily`},{value:`hourly`,label:`Hourly`},{value:`weekly`,label:`Weekly`},{value:`custom`,label:`Custom`}];function sg({schedule:e,scheduleHuman:t,onChange:n}){let r=ag(e,t),[i,a]=(0,L.useState)(r.mode),[o,s]=(0,L.useState)(r.state),c=(0,L.useRef)({cron:e,human:t});(0,L.useEffect)(()=>{if(e===c.current.cron&&t===c.current.human)return;let n=ag(e,t);a(n.mode),s(n.state),c.current={cron:e,human:t}},[e,t]),(0,L.useEffect)(()=>{let e=Qh(i,o),t=$h(i,o);e===c.current.cron&&t===c.current.human||(c.current={cron:e,human:t},n(e,t))},[i,o]);function l(e){s(t=>({...t,...e}))}let u=Qh(i,o),d=$h(i,o);return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{display:`flex`,gap:0,marginBottom:12},children:og.map((e,t)=>{let n=i===e.value,r=t===0,o=t===og.length-1;return(0,B.jsx)(`button`,{type:`button`,onClick:()=>a(e.value),style:{flex:1,padding:`5px 0`,fontSize:12,fontWeight:500,border:`1px solid ${n?`rgba(188,140,255,0.5)`:C.border}`,background:n?`rgba(188,140,255,0.15)`:`var(--color-bg-raised)`,color:n?`var(--color-primary)`:C.muted,borderRadius:r?`4px 0 0 4px`:o?`0 4px 4px 0`:`0`,cursor:`pointer`,marginLeft:t>0?-1:0,transition:`all 0.15s ease`,position:`relative`,zIndex:+!!n},children:e.label},e.value)})}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:[(i===`weekdays`||i===`daily`)&&(0,B.jsx)(qh,{hour:o.hour,minute:o.minute,onHourChange:e=>l({hour:e}),onMinuteChange:e=>l({minute:e})}),i===`hourly`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Wh,{days:o.days,onChange:e=>l({days:e})}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`flex-end`,flexWrap:`wrap`},children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:Kh,children:`Interval`}),(0,B.jsx)(`select`,{value:o.intervalHours,onChange:e=>l({intervalHours:parseFloat(e.target.value)}),style:Gh,children:Vh.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),o.intervalHours>=1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:Kh,children:`From hour`}),(0,B.jsx)(`select`,{value:o.rangeStart,onChange:e=>l({rangeStart:parseInt(e.target.value)}),style:Gh,children:zh.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:Kh,children:`To hour`}),(0,B.jsx)(`select`,{value:o.rangeEnd,onChange:e=>l({rangeEnd:parseInt(e.target.value)}),style:Gh,children:zh.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})]}),i===`weekly`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Wh,{days:o.days,onChange:e=>l({days:e})}),(0,B.jsx)(qh,{hour:o.hour,minute:o.minute,onHourChange:e=>l({hour:e}),onMinuteChange:e=>l({minute:e})})]}),i===`custom`&&(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:Kh,children:`Cron expression`}),(0,B.jsx)(`input`,{value:o.customCron,onChange:e=>l({customCron:e.target.value}),placeholder:`0 9 * * 1-5`,style:{background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${C.border}`,borderRadius:4,padding:`4px 8px`,fontSize:12,fontFamily:`var(--font-mono)`,width:`100%`,boxSizing:`border-box`,outline:`none`}})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:Kh,children:`Display label`}),(0,B.jsx)(`input`,{value:o.customHuman,onChange:e=>l({customHuman:e.target.value}),placeholder:`Weekdays at 9 AM`,style:{background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${C.border}`,borderRadius:4,padding:`4px 8px`,fontSize:12,width:`100%`,boxSizing:`border-box`,outline:`none`}})]})]})]}),i!==`custom`&&(0,B.jsxs)(`div`,{style:{marginTop:10,display:`flex`,alignItems:`center`,gap:8,padding:`5px 8px`,background:`var(--color-bg)`,borderRadius:4,border:`1px solid ${C.border}`},children:[(0,B.jsx)(`code`,{style:{fontSize:11,color:`var(--color-text-muted)`,fontFamily:`var(--font-mono)`,flex:1},children:u}),d&&(0,B.jsx)(`span`,{style:{fontSize:11,color:`var(--color-info)`,flexShrink:0},children:d})]})]})}function cg(e){let t={},n=e.participants??[],r=e.task??``;return n.length<2&&(t.participants=n.length===0?`A team needs at least 2 members. Pick a Standard flow for a single-agent job.`:`A team needs at least 2 members. Add another, or switch to a Standard flow for a single-agent job.`),r.trim()||(t.task=`Task description is required`),t}var lg=[`id`,`name`,`description`,`schedule`,`scheduleHuman`,`timeout`,`logRetention`,`skipIfRunning`,`ignorePauses`,`retryCount`,`retryDelay`,`triggers`,`jobTriggers`,`env`,`remote`,`dependsOn`,`inputs`,`outputs`,`priority`,`tags`,`claudeAiMcp`];function ug(e,t){let n={};for(let t of lg)t in e&&(n[t]=e[t]);if(t===`seam-v1`){let t={...n};return t.flow=`seam-v1`,e.participants!==void 0&&(t.participants=e.participants),e.coordinationHint!==void 0&&(t.coordinationHint=e.coordinationHint),e.lead!==void 0&&(t.lead=e.lead),e.task!==void 0&&(t.task=e.task),t}let r={...n};return e.command!==void 0&&(r.command=e.command),e.prompt!==void 0&&(r.prompt=e.prompt),e.employee!==void 0&&(r.employee=e.employee),e.selfImprove!==void 0&&(r.selfImprove=e.selfImprove),e.engineOverrides!==void 0&&(r.engineOverrides=e.engineOverrides),r}var dg={backdrop:`_backdrop_47v97_11`,"sheet-backdrop-fade":`_sheet-backdrop-fade_47v97_1`,panel:`_panel_47v97_19`,"sheet-panel-enter":`_sheet-panel-enter_47v97_1`,"sheet-panel-slide":`_sheet-panel-slide_47v97_1`,panelWide:`_panelWide_47v97_52 _panel_47v97_19`,header:`_header_47v97_66`,headerLeft:`_headerLeft_47v97_77`,headerRight:`_headerRight_47v97_85`,title:`_title_47v97_92`,subtitle:`_subtitle_47v97_103`,titleBlock:`_titleBlock_47v97_114`,closeButton:`_closeButton_47v97_121`,body:`_body_47v97_146`,footer:`_footer_47v97_153`,footerLeft:`_footerLeft_47v97_164`,footerRight:`_footerRight_47v97_171`};function fg({open:e,onClose:t,ariaLabel:n,wide:r=!1,header:i,headerRight:a,children:o,footer:s,hideCloseButton:c=!1,closeOnEscape:l=!0}){let u=(0,L.useRef)(null),d=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(!e)return;d.current=document.activeElement??null;let n=e=>{e.key===`Escape`&&l&&(e.stopPropagation(),t())};document.addEventListener(`keydown`,n);let r=document.body.style.overflow;document.body.style.overflow=`hidden`;let i=u.current?.querySelector(`[data-autofocus="true"], [autofocus]`);return i?i.focus():u.current?.focus(),()=>{document.removeEventListener(`keydown`,n),document.body.style.overflow=r,d.current&&document.contains(d.current)&&d.current.focus()}},[e,t,l]),e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:dg.backdrop,onClick:t,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{ref:u,role:`dialog`,"aria-modal":`true`,"aria-label":n,tabIndex:-1,className:r?dg.panelWide:dg.panel,children:[(0,B.jsxs)(`div`,{className:dg.header,children:[(0,B.jsx)(`div`,{className:dg.headerLeft,children:i}),(0,B.jsxs)(`div`,{className:dg.headerRight,children:[a,!c&&(0,B.jsx)(`button`,{type:`button`,className:dg.closeButton,onClick:t,"aria-label":`Close`,children:`✕`})]})]}),(0,B.jsx)(`div`,{className:dg.body,children:o}),s&&(0,B.jsx)(`div`,{className:dg.footer,children:s})]})]}):null}var pg={title:dg.title,subtitle:dg.subtitle,titleBlock:dg.titleBlock,footerLeft:dg.footerLeft,footerRight:dg.footerRight},mg={section:`_section_6kzjq_8`,trigger:`_trigger_6kzjq_15`,title:`_title_6kzjq_30`,caret:`_caret_6kzjq_39`,caretOpen:`_caretOpen_6kzjq_49`,hint:`_hint_6kzjq_60`,body:`_body_6kzjq_68`,"collapsible-expand":`_collapsible-expand_6kzjq_1`};function hg({title:e,hint:t,children:n,defaultOpen:r=!1,open:i,onOpenChange:a,className:o}){let s=(0,L.useId)(),[c,l]=(0,L.useState)(r),u=i??c;return(0,B.jsxs)(`div`,{className:[mg.section,o].filter(Boolean).join(` `),children:[(0,B.jsxs)(`button`,{type:`button`,className:mg.trigger,onClick:()=>{let e=!u;i===void 0&&l(e),a?.(e)},"aria-expanded":u,"aria-controls":`${s}-body`,children:[(0,B.jsx)(`span`,{className:`${mg.caret} ${u?mg.caretOpen:``}`,"aria-hidden":`true`,children:`❯`}),(0,B.jsx)(`span`,{className:mg.title,children:e}),t!=null&&(0,B.jsx)(`span`,{className:mg.hint,children:t})]}),u&&(0,B.jsx)(`div`,{id:`${s}-body`,className:mg.body,children:n})]})}var gg={wrap:`_wrap_f58cw_4`,label:`_label_f58cw_8`,cardRow:`_cardRow_f58cw_18`,card:`_card_f58cw_18`,cardSelected:`_cardSelected_f58cw_49`,cardBlank:`_cardBlank_f58cw_54`,cardTemplate:`_cardTemplate_f58cw_58`,cardImport:`_cardImport_f58cw_62`,cardImportActive:`_cardImportActive_f58cw_66`,cardTitle:`_cardTitle_f58cw_72`,cardHint:`_cardHint_f58cw_79`,importPanel:`_importPanel_f58cw_90`,"import-panel-enter":`_import-panel-enter_f58cw_1`,importTextarea:`_importTextarea_f58cw_99`,importTextareaError:`_importTextareaError_f58cw_113`,importError:`_importError_f58cw_121`,importActions:`_importActions_f58cw_127`,hiddenFileInput:`_hiddenFileInput_f58cw_134`};function _g({templates:e,selectedTemplate:t,onSelectClaudeCode:n,onSelectBlank:r,onSelectTemplate:i,showImportJson:a,onToggleImportJson:o,importJsonText:s,importJsonError:c,onImportJsonChange:l,onImportJsonSubmit:u,onCancelImportJson:d,fileInputRef:f,onImportFile:p}){return(0,B.jsxs)(`div`,{className:gg.wrap,children:[(0,B.jsx)(`label`,{className:gg.label,children:`Start from`}),(0,B.jsxs)(`div`,{className:gg.cardRow,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:n,className:`${gg.card} ${t===`claude-code`?gg.cardSelected:``}`,children:[(0,B.jsx)(`div`,{className:gg.cardTitle,children:`Claude Code`}),(0,B.jsx)(`div`,{className:gg.cardHint,children:`Guided via skill`})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:r,className:`${gg.card} ${gg.cardBlank} ${t===`blank`?gg.cardSelected:``}`,children:[(0,B.jsx)(`div`,{className:gg.cardTitle,children:`Blank`}),(0,B.jsx)(`div`,{className:gg.cardHint,children:`Empty form`})]}),e.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`${gg.card} ${gg.cardTemplate} ${t===e.id?gg.cardSelected:``}`,children:[(0,B.jsx)(`div`,{className:gg.cardTitle,children:e.name}),e.description&&(0,B.jsx)(`div`,{className:gg.cardHint,children:e.description})]},e.id)),(0,B.jsxs)(`button`,{type:`button`,onClick:o,className:`${gg.card} ${gg.cardImport} ${a?gg.cardImportActive:``}`,children:[(0,B.jsx)(`div`,{className:gg.cardTitle,children:`📥 Import`}),(0,B.jsx)(`div`,{className:gg.cardHint,children:`From JSON`})]})]}),a&&(0,B.jsxs)(`div`,{className:gg.importPanel,children:[(0,B.jsx)(`textarea`,{autoFocus:!0,placeholder:`Paste .claude-job.json content here…`,value:s,onChange:e=>l(e.target.value),className:`${gg.importTextarea} ${c?gg.importTextareaError:``}`}),c&&(0,B.jsx)(`div`,{className:gg.importError,children:c}),(0,B.jsxs)(`div`,{className:gg.importActions,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:u,children:`Apply JSON`}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>f.current?.click(),children:`📂 Upload file`}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:d,children:`Cancel`})]})]}),(0,B.jsx)(`input`,{ref:f,type:`file`,accept:`.json,.claude-job.json`,className:gg.hiddenFileInput,onChange:p})]})}function vg(e,t=60,n=[]){let[r,i]=(0,L.useState)(new Set);return(0,L.useEffect)(()=>{i(new Set);let n=[];for(let r=0;r<e;r++)n.push(setTimeout(()=>{i(e=>{if(e.has(r))return e;let t=new Set(e);return t.add(r),t})},r*t));return()=>n.forEach(clearTimeout)},[e,t,...n]),(0,L.useMemo)(()=>e=>r.has(e),[r])}var yg=28,bg=32,xg=8,Sg=24;function Cg(e,t,n){let r=n+32;if(t<=1||e===`subagent`)return r;let i=t-1,a=i*(n+20)+Math.max(0,i-1)*xg;return Math.max(r,a+16)}var wg=e=>({nodes:[],edges:[],containerHeight:Cg(`auto`,0,e.nodeSize),containerKind:`fixed`}),Tg=e=>{let t=e.participants[0];if(!t)return wg(e);let n=Cg(`auto`,1,e.nodeSize),r=n/2;return{nodes:[{id:t,x:r,y:r,isLead:t===e.lead}],edges:[],containerHeight:n,containerKind:`fixed`}},Eg=e=>{let{participants:t,lead:n,nodeSize:r}=e,i=Cg(`subagent`,t.length,r),a=i/2,o=r+yg,s=t.map((e,t)=>({id:e,x:r/2+t*o,y:a,isLead:e===n})),c=[];for(let e=0;e<t.length-1;e++)c.push({from:t[e],to:t[e+1],kind:`arrow`});return{nodes:s,edges:c,containerHeight:i,containerKind:`fluid`,minWidth:t.length>0?r+(t.length-1)*o:0}},Dg=e=>{let{participants:t,lead:n,nodeSize:r}=e,i=t.filter(e=>e!==n),a=i.length,o=Cg(`team`,t.length,r),s=r+bg,c=r+20,l=a>0?a*c+(a-1)*xg:0,u=Math.max(8,(o-l)/2),d=e=>u+e*(c+xg)+r/2,f=s+Sg+r/2,p=[];return p.push({id:n,x:s/2,y:o/2,isLead:!0}),i.forEach((e,t)=>{p.push({id:e,x:f,y:d(t),isLead:!1})}),{nodes:p,edges:i.map(e=>({from:n,to:e,kind:`line`})),containerHeight:o,containerKind:`fixed`}};function Og(e,t){if(t===0)return wg;if(t===1)return Tg;switch(e){case`subagent`:return Eg;case`team`:case`auto`:return Dg;default:throw Error(`selectPositioner: unknown coordinationHint '${String(e)}'`)}}var kg={compact:36,large:52},Ag={compact:11,large:12},jg={compact:14,large:22};function Mg(e,t){return e.find(e=>e.name===t)??{name:t,emoji:`👤`,persona:``}}function Ng({hint:e,participants:t,lead:n,employees:r,size:i,showLeadBadge:a}){let o=kg[i],s=(0,L.useMemo)(()=>e===`subagent`&&t.length>1&&t.includes(n)?[n,...t.filter(e=>e!==n)]:t,[e,t,n]),c=(0,L.useMemo)(()=>Og(e,s.length),[e,s.length]),{nodes:l,edges:u,containerHeight:d,minWidth:f}=(0,L.useMemo)(()=>c({participants:s,lead:n,nodeSize:o,showLeadBadge:a}),[c,s,n,o,a]),p=vg(s.length,60,[e,[...s].sort().join(`,`),n]),m=(0,L.useMemo)(()=>{let e=new Map;for(let t of l)e.set(t.id,t);return e},[l]);return(0,B.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:d,minWidth:f},children:[(0,B.jsxs)(`svg`,{style:{position:`absolute`,inset:0,width:`100%`,height:`100%`,pointerEvents:`none`,overflow:`visible`},"aria-hidden":!0,children:[(0,B.jsx)(`defs`,{children:(0,B.jsx)(`marker`,{id:`graphlayout-arrow`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto-start-reverse`,children:(0,B.jsx)(`path`,{d:`M 0 0 L 10 5 L 0 10 z`,fill:C.border})})}),u.map(e=>(0,B.jsx)(Pg,{edge:e,nodeById:m,nodeSize:o},`${e.from}-${e.to}`))]}),l.map((e,t)=>{let n=Mg(r,e.id);return(0,B.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,transform:`translate(${e.x}px, ${e.y}px) translate(-50%, -50%)`,transition:`transform 0.3s ease-out`,willChange:`transform`},children:(0,B.jsx)(Fg,{emp:n,isLead:e.isLead,showLeadBadge:a&&e.isLead,size:i,mounted:p(t),index:t})},e.id)})]})}function Pg({edge:e,nodeById:t,nodeSize:n}){let r=t.get(e.from),i=t.get(e.to);if(!r||!i)return null;let{x:a,y:o}=r,{x:s,y:c}=i;if(e.kind===`arrow`){let e=s-a,t=c-o,r=Math.hypot(e,t);if(r>0){let i=n/2,l=n/2+4;a+=e/r*i,o+=t/r*i,s-=e/r*l,c-=t/r*l}}let l=e.kind===`dashed`?`3 3`:void 0,u=e.kind===`dashed`?.5:.7,d=e.kind===`arrow`?`url(#graphlayout-arrow)`:void 0;return(0,B.jsx)(`line`,{"data-testid":`edge-${e.from}-${e.to}`,x1:a,y1:o,x2:s,y2:c,stroke:C.border,strokeWidth:1,strokeDasharray:l,opacity:u,markerEnd:d,style:{transition:`x1 0.3s ease-out, y1 0.3s ease-out, x2 0.3s ease-out, y2 0.3s ease-out, opacity 0.3s ease-out, stroke 0.25s ease-out`}})}function Fg({emp:e,isLead:t,showLeadBadge:n,size:r,mounted:i,index:a}){let o=kg[r],s=Ag[r],c=jg[r],l=e.displayName??e.name;return(0,B.jsxs)(`div`,{"data-testid":`node-${e.name}`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:4,opacity:+!!i,transition:`opacity 0.2s ease-out`,flexShrink:0},children:[(0,B.jsxs)(`div`,{style:{width:o,height:o,borderRadius:`50%`,background:C.hover,border:t&&n?`2px solid var(--color-primary)`:`1px solid ${C.border}`,boxShadow:t&&n?`0 0 0 1px var(--color-primary)40`:void 0,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:c,transition:`border-color 0.18s ease-out, box-shadow 0.18s ease-out`,position:`relative`,flexShrink:0},children:[e.emoji??`👤`,t&&n&&(0,B.jsx)(`span`,{"data-testid":`lead-badge`,style:{position:`absolute`,bottom:-2,right:-2,width:r===`compact`?10:14,height:r===`compact`?10:14,borderRadius:`50%`,background:`var(--color-primary)`,border:`1px solid ${C.cardBg}`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:r===`compact`?6:8,color:C.darkBg,fontWeight:700},children:`★`})]}),(0,B.jsx)(`span`,{title:l,style:{fontSize:s,color:t&&n?`var(--color-primary)`:C.textSecondary,maxWidth:o+24,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,textAlign:`center`},children:l})]})}var Ig={compact:36,large:52},Lg={compact:11,large:12},Rg=200,zg=80;function Bg(e,t){return e.find(e=>e.name===t)??{name:t,emoji:`👤`,persona:``}}function Vg(e){if(!e)return``;let t=(e.split(/(?<=[.!?])\s+|\n+/)[0]??e).trim();return t.length<=zg?t:t.slice(0,zg-1).trimEnd()+`…`}function Hg(e,t,n){return e.filter(e=>e!==t).map(e=>{let t=Bg(n,e);return`- ${e}: ${Vg(t.persona)||(t.displayName??e)}`}).join(`
|
|
78
|
-
`)}function Ug({task:e}){let[t,n]=(0,L.useState)(!1),r=e.length>Rg,i=t||!r?e:e.slice(0,Rg).trimEnd()+`…`;return(0,B.jsxs)(`div`,{"data-testid":`task-card`,style:{background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:x.lg,padding:`12px 14px`},children:[(0,B.jsx)(`div`,{style:{...y.sectionTitle,marginBottom:6},children:`Task`}),(0,B.jsx)(`div`,{style:{...y.body,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:i}),r&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),style:{marginTop:6,background:`transparent`,border:`none`,color:C.blue,fontSize:12,cursor:`pointer`,padding:0},children:t?`Show less`:`Show more`})]})}function Wg({emp:e,isLead:t,showLeadBadge:n,directiveLabel:r,directive:i,mounted:a}){let[o,s]=(0,L.useState)(!1),c=(0,L.useRef)(null),l=Vg(e.persona),u=e.displayName??e.name;return(0,B.jsxs)(`div`,{"data-testid":`prompt-card-${e.name}`,style:{background:C.cardBg,border:t&&n?`1px solid var(--color-primary)`:`1px solid ${C.border}`,borderRadius:x.lg,padding:12,display:`flex`,flexDirection:`column`,gap:8,opacity:+!!a,transform:a?`translateY(0)`:`translateY(6px)`,transition:`opacity 0.22s ease-out, transform 0.22s ease-out, border-color 0.18s ease-out`,minWidth:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`span`,{style:{fontSize:18,lineHeight:1,flexShrink:0},children:e.emoji??`👤`}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,minWidth:0,flex:1},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[t&&n&&(0,B.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:10,color:`var(--color-primary)`,background:`var(--color-primary)22`,border:`1px solid var(--color-primary)55`,padding:`1px 6px`,borderRadius:x.full,fontWeight:600,flexShrink:0},children:`★ Lead`}),(0,B.jsx)(`span`,{title:u,style:{fontSize:13,fontWeight:600,color:C.text,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:u})]}),l&&(0,B.jsx)(`span`,{style:{...y.caption,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.persona,children:l})]})]}),(0,B.jsx)(`div`,{style:{borderTop:`1px solid ${C.border}`}}),(0,B.jsxs)(`button`,{"data-testid":`disclosure-${e.name}`,type:`button`,"aria-expanded":o,onClick:()=>s(e=>!e),style:{display:`flex`,alignItems:`center`,gap:4,background:`transparent`,border:`none`,color:C.textSecondary,fontSize:12,padding:0,cursor:`pointer`,textAlign:`left`},children:[(0,B.jsx)(`span`,{"aria-hidden":!0,style:{display:`inline-block`,transform:o?`rotate(90deg)`:`rotate(0deg)`,transition:`transform 0.18s ease-out`,width:10},children:`▸`}),(0,B.jsx)(`span`,{children:r})]}),(0,B.jsx)(`div`,{style:{maxHeight:o?480:0,overflow:`hidden`,transition:`max-height 0.2s ease-out`},children:(0,B.jsx)(`div`,{ref:c,"data-testid":`directive-body-${e.name}`,style:{background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:x.md,padding:10,fontFamily:g,fontSize:11,lineHeight:1.5,color:C.textSecondary,whiteSpace:`pre-wrap`,wordBreak:`break-word`,maxHeight:460,overflow:`auto`},children:i})})]})}function Gg({task:e,participants:t,lead:n,coordinationHint:r,employees:i,size:a}){let o=t.includes(n)?n:t[0]??``,s=t.filter(e=>e!==o),c=(0,L.useMemo)(()=>Hg(t,o,i),[t,o,i]),l=(0,L.useMemo)(()=>ot({task:e,lead:o,participants:t,agentDescriptions:c,hint:r}),[e,o,t,c,r]),u=Cg(r,t.length,Ig[a]),d={width:`100%`,minHeight:u,overflowX:r===`subagent`?`auto`:`hidden`,overflowY:`hidden`,display:`flex`,alignItems:`center`},f;f=t.length===0?(0,B.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:u,color:C.muted,fontSize:Lg[a],fontStyle:`italic`},children:`No participants`}):(0,B.jsx)(Ng,{hint:r,participants:t,lead:o,employees:i,size:a,showLeadBadge:!0});let p=vg(t.length===0?0:t.length,60,[r,[...t].sort().join(`,`)]);if(a===`compact`)return(0,B.jsx)(`div`,{style:d,children:f});let m=[];if(t.length===1){let e=Bg(i,o);m.push((0,B.jsx)(Wg,{emp:e,isLead:!0,showLeadBadge:!0,directiveLabel:`Solo directive`,directive:l,mounted:p(0)},e.name))}else{let e=Bg(i,o);m.push((0,B.jsx)(Wg,{emp:e,isLead:!0,showLeadBadge:!0,directiveLabel:`Orchestration directive`,directive:l,mounted:p(0)},e.name)),s.forEach((e,t)=>{let n=Bg(i,e);m.push((0,B.jsx)(Wg,{emp:n,isLead:!1,showLeadBadge:!1,directiveLabel:`Subagent persona`,directive:`Defined in .claude/agents/${n.name}.md and invoked on-demand by ${o}.`,mounted:p(t+1)},n.name))})}let h=et[r];h||console.warn(`[FlowVisualizer] unknown coordinationHint '${r}' — falling back to Auto`);let g=h??et.auto;return(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,B.jsx)(Ug,{task:e}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{style:{...y.sectionTitle,marginBottom:8,display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{children:`Prompts`}),(0,B.jsx)(`span`,{style:{color:C.muted,fontWeight:400,textTransform:`none`,letterSpacing:0},children:`· what each agent will receive`})]}),(0,B.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(220px, 1fr))`,gap:10},children:m})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{style:{...y.sectionTitle,marginBottom:8,display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{children:`Communication`}),(0,B.jsxs)(`span`,{"aria-hidden":!0,style:{color:C.muted,fontWeight:400,textTransform:`none`,letterSpacing:0},children:[`· `,g.icon,` `,g.label]})]}),(0,B.jsx)(`div`,{style:{...d,background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:x.lg,padding:`12px 16px`},children:f})]})]})}var Kg=/sonnet|opus/i;function qg(e,t){if(e.flow!==`seam-v1`)return null;let n=e.lead??e.participants?.[0];if(!n)return null;let r=t.find(e=>e.name===n),i=r?.model;if(!i||Kg.test(i))return null;let a=r?.displayName??n;return{leadName:a,model:i,reason:`weak-model`,shortLabel:`Weak lead model`,tooltip:`Lead '${a}' is configured to use '${i}'. Multi-agent coordination (subagents or teams) is most reliable with sonnet or opus. Consider switching the lead's model in the Org tab.`}}var J={adbc501:`_adbc501_1c3n7_6`,a6da330:`_a6da330_1c3n7_13`,a80e997:`_a80e997_1c3n7_17`,afa9d5c:`_afa9d5c_1c3n7_23`,ab628d3:`_ab628d3_1c3n7_29`,ab37cd8:`_ab37cd8_1c3n7_36`,a7048b8:`_a7048b8_1c3n7_40`,a820114:`_a820114_1c3n7_47`,a83be98:`_a83be98_1c3n7_55`,a66e058:`_a66e058_1c3n7_60`,a237efa:`_a237efa_1c3n7_64`,a2dd3f2:`_a2dd3f2_1c3n7_72`,ae42aa7:`_ae42aa7_1c3n7_79`,a16d874:`_a16d874_1c3n7_90`,a1825e0:`_a1825e0_1c3n7_102`,ab56952:`_ab56952_1c3n7_108`,ab35aed:`_ab35aed_1c3n7_120`,a7d372a:`_a7d372a_1c3n7_127`,a46df60:`_a46df60_1c3n7_133`,a940316:`_a940316_1c3n7_137`,abf8a20:`_abf8a20_1c3n7_145`,a1fc682:`_a1fc682_1c3n7_151`,acf40e8:`_acf40e8_1c3n7_157`,a90bab8:`_a90bab8_1c3n7_163`,a9d866e:`_a9d866e_1c3n7_169`,ac0be8a:`_ac0be8a_1c3n7_176`,abc0ff7:`_abc0ff7_1c3n7_188`,afe63fd:`_afe63fd_1c3n7_194`,a33af1b:`_a33af1b_1c3n7_199`,a5a0a31:`_a5a0a31_1c3n7_205`,ac2ba91:`_ac2ba91_1c3n7_214`,a2b87fb:`_a2b87fb_1c3n7_221`,ad12586:`_ad12586_1c3n7_229`,a8ef607:`_a8ef607_1c3n7_234`,aacc8cb:`_aacc8cb_1c3n7_241`,a038b3e:`_a038b3e_1c3n7_247`,aa0197b:`_aa0197b_1c3n7_258`,a03df8d:`_a03df8d_1c3n7_264`,a05d2a8:`_a05d2a8_1c3n7_273`,a71e920:`_a71e920_1c3n7_282`,ad33a86:`_ad33a86_1c3n7_289`,a9de02f:`_a9de02f_1c3n7_297`,ad48594:`_ad48594_1c3n7_301`,a124c11:`_a124c11_1c3n7_307`,a37ff26:`_a37ff26_1c3n7_315`,a6c2755:`_a6c2755_1c3n7_323`,a4bec9d:`_a4bec9d_1c3n7_328`,a67d2d4:`_a67d2d4_1c3n7_336`,a06abec:`_a06abec_1c3n7_342`,acd7292:`_acd7292_1c3n7_346`,aa141ab:`_aa141ab_1c3n7_352`,a79427e:`_a79427e_1c3n7_358`,a9cc22c:`_a9cc22c_1c3n7_368`,a305c03:`_a305c03_1c3n7_376`,a20f5d6:`_a20f5d6_1c3n7_382`,a021478:`_a021478_1c3n7_389`,a72493a:`_a72493a_1c3n7_396`,af87a1a:`_af87a1a_1c3n7_401`,ad872cc:`_ad872cc_1c3n7_406`,accb09d:`_accb09d_1c3n7_412`,ae8a182:`_ae8a182_1c3n7_425`,a079824:`_a079824_1c3n7_432`,af255fe:`_af255fe_1c3n7_441`,a281f9e:`_a281f9e_1c3n7_445`,a333d40:`_a333d40_1c3n7_451`,a5ca7f0:`_a5ca7f0_1c3n7_459`,a595d6e:`_a595d6e_1c3n7_466`,a1f2415:`_a1f2415_1c3n7_474`,ad6e05a:`_ad6e05a_1c3n7_478`,a6294af:`_a6294af_1c3n7_486`,aee6d23:`_aee6d23_1c3n7_490`,a2492a7:`_a2492a7_1c3n7_495`,aa47e9e:`_aa47e9e_1c3n7_509`,a1fbf6d:`_a1fbf6d_1c3n7_516`,a971667:`_a971667_1c3n7_522`,ad40728:`_ad40728_1c3n7_526`,a64fea2:`_a64fea2_1c3n7_532`,a64b521:`_a64b521_1c3n7_536`,af335f1:`_af335f1_1c3n7_541`,afa9908:`_afa9908_1c3n7_546`,a2b32d3:`_a2b32d3_1c3n7_553`,aa1977f:`_aa1977f_1c3n7_557`,a242213:`_a242213_1c3n7_563`,af12e71:`_af12e71_1c3n7_569`,aff9b74:`_aff9b74_1c3n7_575`,fadeIn:`_fadeIn_1c3n7_1`,afe5345:`_afe5345_1c3n7_580`,a53a0c3:`_a53a0c3_1c3n7_586`,adff7ae:`_adff7ae_1c3n7_596`,ab6a179:`_ab6a179_1c3n7_604`,a6af63c:`_a6af63c_1c3n7_612`,a122a45:`_a122a45_1c3n7_616`,aa13fe6:`_aa13fe6_1c3n7_621`,ab2f953:`_ab2f953_1c3n7_631`,a2fdb21:`_a2fdb21_1c3n7_636`,a560021:`_a560021_1c3n7_640`,a288249:`_a288249_1c3n7_649`,ab55def:`_ab55def_1c3n7_660`,a7a40a3:`_a7a40a3_1c3n7_671`,adf9b79:`_adf9b79_1c3n7_675`,a75f4f8:`_a75f4f8_1c3n7_681`,a31130d:`_a31130d_1c3n7_686`,a209d48:`_a209d48_1c3n7_693`};function Jg({visible:e,form:t,setForm:n,seamErrors:r,setSeamErrors:i,seamSaveTouched:a,employees:o,uniqueEmployees:s}){return(0,B.jsx)(`div`,{"data-testid":`seam-section`,style:{overflow:`hidden`,maxHeight:e?`9999px`:`0px`,opacity:+!!e,transition:`max-height 0.4s ease-out, opacity 0.18s ease-out`},children:(0,B.jsxs)(`div`,{className:J.a64fea2,children:[(0,B.jsx)(`label`,{className:J.a333d40,children:`Coordination hint`}),(0,B.jsx)(`div`,{className:J.ad40728,children:(()=>{let e=t.coordinationHint??`auto`,r=et[e]?e:`auto`;return Object.values(et).map(e=>{let t=r===e.id;return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>{n(t=>({...t,coordinationHint:e.id===`auto`?void 0:e.id}))},style:{flex:`1 1 calc(50% - 6px)`,minWidth:120,padding:`8px 10px`,borderRadius:8,fontSize:12,fontWeight:500,cursor:`pointer`,textAlign:`left`,border:`1px solid ${t?`var(--color-primary)`:C.border}`,background:t?`var(--color-primary)18`:`var(--color-bg)`,color:t?`var(--color-primary)`:`var(--color-border-strong)`,transition:`all 0.18s ease-out`},children:[(0,B.jsxs)(`div`,{className:J.a971667,children:[e.icon,` `,e.label]}),(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,marginTop:2,opacity:t?1:.65},children:e.shortDescription})]},e.id)})})()}),(0,B.jsx)(`label`,{className:J.a333d40,children:`Team members`}),o.length===0?(0,B.jsx)(`div`,{className:J.a1fbf6d,children:`No team members found. Add employees in the Org tab first.`}):(0,B.jsxs)(B.Fragment,{children:[(t.participants??[]).length>0&&(()=>{let e=(t.coordinationHint??`auto`)===`subagent`,r=t.lead&&(t.participants??[]).includes(t.lead)?t.lead:(t.participants??[])[0],s=(e,t)=>{n(n=>{let r=[...n.participants??[]];if(t<0||t>=r.length)return n;let[i]=r.splice(e,1);return r.splice(t,0,i),{...n,participants:r}})};return(0,B.jsx)(`div`,{style:{marginBottom:8,border:`1px solid ${C.border}`,borderRadius:8,overflow:`hidden`},children:(t.participants??[]).map((c,l)=>{let u=o.find(e=>e.name===c),d=c===r;return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 10px`,background:d?`var(--color-primary)10`:`var(--color-bg)`,borderTop:l>0?`1px solid ${C.border}`:`none`,transition:`background 0.18s ease-out`},children:[e&&(0,B.jsxs)(`span`,{className:J.aa47e9e,children:[l+1,`.`]}),(0,B.jsx)(`span`,{className:J.a1f2415,children:u?.emoji??`👤`}),(0,B.jsx)(`span`,{className:J.a03df8d,children:u?.displayName??c}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{n(e=>({...e,lead:c}))},"aria-label":d?`${u?.displayName??c} is the lead`:`Make ${u?.displayName??c} the lead`,"aria-pressed":d,title:d?`Lead`:`Make lead`,style:{background:`none`,border:`none`,cursor:d?`default`:`pointer`,color:d?`var(--color-primary)`:`var(--color-border-strong)`,fontSize:16,padding:0,minWidth:44,minHeight:44,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`color 0.18s ease-out, transform 0.18s ease-out`,transform:d?`scale(1.05)`:`scale(1)`},children:d?`★`:`☆`}),e&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,disabled:l===0,onClick:()=>s(l,l-1),style:{background:`none`,border:`none`,cursor:l===0?`not-allowed`:`pointer`,color:l===0?`var(--color-border)`:`var(--color-text-muted)`,fontSize:14,padding:0,minWidth:44,minHeight:44,display:`flex`,alignItems:`center`,justifyContent:`center`},"aria-label":`Move ${u?.displayName??c} up`,children:`↑`}),(0,B.jsx)(`button`,{type:`button`,disabled:l===(t.participants??[]).length-1,onClick:()=>s(l,l+1),style:{background:`none`,border:`none`,cursor:l===(t.participants??[]).length-1?`not-allowed`:`pointer`,color:l===(t.participants??[]).length-1?`var(--color-border)`:`var(--color-text-muted)`,fontSize:14,padding:0,minWidth:44,minHeight:44,display:`flex`,alignItems:`center`,justifyContent:`center`},"aria-label":`Move ${u?.displayName??c} down`,children:`↓`})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let e=(t.participants??[]).filter(e=>e!==c),r=t.lead===c?void 0:t.lead;n(t=>({...t,participants:e,lead:r})),a&&i(cg({...t,participants:e,lead:r}))},"aria-label":`Remove ${u?.displayName??c}`,title:`Remove`,className:J.a2492a7,children:`×`})]},c)})})})(),(()=>{let e=qg({flow:t.flow,lead:t.lead,participants:t.participants},o);return e?(0,B.jsxs)(`div`,{role:`status`,style:{display:`flex`,alignItems:`flex-start`,gap:8,padding:`8px 12px`,margin:`8px 0 12px`,background:`${C.warning}14`,border:`1px solid ${C.warning}40`,borderRadius:8,fontSize:12,color:C.warning,lineHeight:1.5},children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:J.aee6d23,children:`⚠`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:`Weak lead model.`}),` `,(0,B.jsx)(`code`,{className:J.a6294af,children:e.leadName}),` is configured to use`,` `,(0,B.jsx)(`code`,{className:J.a6294af,children:e.model}),`. Multi-agent coordination is most reliable with sonnet or opus — consider updating the lead's model in the Org tab.`]})]}):null})(),(0,B.jsx)(`div`,{"data-testid":`participants-list`,style:{border:`1px solid ${r.participants&&a?C.red:C.border}`,borderRadius:8,overflow:`hidden`},children:s.map((e,r)=>{let o=(t.participants??[]).includes(e.name);return(0,B.jsxs)(`div`,{onClick:()=>{let r=t.participants??[],s=o?r.filter(t=>t!==e.name):[...r,e.name],c=t.lead&&!s.includes(t.lead)?void 0:t.lead;n(e=>({...e,participants:s,lead:c})),a&&i(cg({...t,participants:s,lead:c}))},style:{display:`flex`,alignItems:`center`,gap:10,padding:`8px 12px`,minHeight:44,cursor:`pointer`,userSelect:`none`,background:o?`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.07)`:`var(--color-bg)`,borderTop:r>0?`1px solid ${C.border}`:`none`,transition:`background 0.12s`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:o,onChange:()=>{},onClick:e=>e.stopPropagation(),className:J.ad6e05a}),(0,B.jsx)(`span`,{className:J.a1f2415,children:e.emoji??`👤`}),(0,B.jsx)(`span`,{className:G.rowText,children:e.displayName??e.name})]},e.name)})})]}),r.participants&&a&&(0,B.jsx)(`div`,{className:J.a595d6e,children:r.participants}),(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Task`}),(0,B.jsxs)(`div`,{className:J.af255fe,children:[(0,B.jsx)(`textarea`,{style:{...h,resize:`vertical`,minHeight:80,maxHeight:300,borderColor:r.task&&a?C.red:C.border,transition:`border-color 0.15s ease-out`},value:t.task??``,maxLength:4096,onChange:e=>{n(t=>({...t,task:e.target.value})),a&&i(cg({...t,task:e.target.value}))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&e.ctrlKey},placeholder:`What should the team accomplish?`}),(0,B.jsxs)(`span`,{className:J.a079824,children:[(t.task??``).length,`/4096`]})]}),r.task&&a&&(0,B.jsx)(`div`,{className:J.a5ca7f0,children:r.task}),(t.participants??[]).length>0&&(0,B.jsx)(`div`,{className:G.spacerMd,children:(0,B.jsx)(Gg,{task:t.task??``,participants:t.participants??[],lead:t.lead??(t.participants??[])[0]??``,coordinationHint:t.coordinationHint??`auto`,employees:o,size:`large`})})]})})}function Yg({trigger:e,onRemove:t,onPathChange:n}){let[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(e.path),l=`${window.location.origin}${e.path}`,u=()=>{navigator.clipboard.writeText(l),i(!0),setTimeout(()=>i(!1),2e3)},d=e=>/^\/hooks\/[^\s/?#]+$/.test(e),f=()=>{let e=s.trim();d(e)&&(n(e),o(!1))};return(0,B.jsxs)(`div`,{className:J.ab55def,children:[(0,B.jsxs)(`div`,{className:G.flexRowCenter,children:[a?(0,B.jsx)(`input`,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),onKeyDown:t=>{t.key===`Enter`&&f(),t.key===`Escape`&&(c(e.path),o(!1))},onBlur:f,style:{flex:1,background:`var(--color-bg-raised)`,color:C.text,border:`1px solid ${d(s.trim())?`var(--color-border)`:`var(--color-negative)`}`,borderRadius:6,padding:`3px 8px`,fontFamily:g,fontSize:12}}):(0,B.jsx)(`code`,{onClick:()=>o(!0),title:`Click to edit path`,className:J.a288249,children:l}),e.secret&&(0,B.jsx)(`span`,{className:J.a560021,children:`HMAC`}),(0,B.jsx)(`button`,{className:`btn btn-sm ${J.a2fdb21}`,type:`button`,onClick:u,children:r?`Copied`:`Copy URL`}),(0,B.jsx)(`button`,{className:`btn btn-sm btn-danger ${J.a2fdb21}`,type:`button`,onClick:t,children:`Remove`})]}),a&&!d(s.trim())&&(0,B.jsx)(`div`,{className:J.ab2f953,children:`Path must start with /hooks/ and contain only URL-safe characters (no spaces)`})]})}function Xg({job:e,form:t,setForm:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``);return e?(0,B.jsx)(hg,{title:`Webhook triggers`,hint:`${(t.triggers??[]).length} configured`,children:(0,B.jsxs)(`div`,{className:G.spacerMd,children:[(0,B.jsx)(`label`,{className:G.blockLabelCompact,children:`Triggers`}),(t.triggers??[]).map((e,t)=>(0,B.jsx)(Yg,{trigger:e,onRemove:()=>{n(e=>({...e,triggers:(e.triggers??[]).filter((e,n)=>n!==t)}))},onPathChange:e=>{n(n=>({...n,triggers:(n.triggers??[]).map((n,r)=>r===t?{...n,path:e}:n)}))}},e.path)),(0,B.jsx)(`div`,{className:J.ab628d3,children:(()=>{let e=`/hooks/${t.id}`,s=a.trim()||e,c=(e=>/^\/hooks\/[^\s/?#]+$/.test(e))(s),l=(t.triggers??[]).some(e=>e.path===s);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:J.afa9d5c,children:[(0,B.jsxs)(`div`,{className:G.flexOne,children:[(0,B.jsx)(`label`,{className:G.microLabel,children:`Path`}),(0,B.jsx)(`input`,{style:{...h,fontFamily:g,borderColor:a&&!c?`var(--color-negative)`:`var(--color-border)`},value:a,onChange:e=>o(e.target.value),placeholder:e}),a&&!c&&(0,B.jsx)(`div`,{className:J.a80e997,children:`Must start with /hooks/ and contain only URL-safe characters (no spaces)`}),l&&(0,B.jsx)(`div`,{className:J.a80e997,children:`A trigger with this path already exists`})]}),(0,B.jsxs)(`div`,{className:G.flexOne,children:[(0,B.jsx)(`label`,{className:G.microLabel,children:`Secret (optional)`}),(0,B.jsx)(`input`,{style:{...h},value:r,onChange:e=>i(e.target.value),placeholder:`HMAC validation secret`})]})]}),(0,B.jsx)(`button`,{className:`btn btn-sm ${J.a6da330}`,type:`button`,disabled:!c||l,onClick:()=>{let e={type:`webhook`,path:s};r.trim()&&(e.secret=r.trim()),n(t=>({...t,triggers:[...t.triggers??[],e]})),i(``),o(``)},children:`+ Add Webhook`})]})})()})]})}):null}function Zg({form:e,setForm:t}){let n=e.outputs??[],r=()=>{let e={type:`slack`,channel:``,condition:`always`};t(t=>({...t,outputs:[...t.outputs??[],e]}))},i=e=>{t(t=>({...t,outputs:(t.outputs??[]).filter((t,n)=>n!==e)}))},a=(e,n)=>{t(t=>({...t,outputs:(t.outputs??[]).map((t,r)=>r===e?{...t,...n}:t)}))},o={always:`Always`,onSuccess:`On success`,onFailure:`On failure`,onActionItems:`When action items found`};return(0,B.jsxs)(`div`,{className:G.spacerMd,children:[(0,B.jsxs)(`div`,{className:J.a8ef607,children:[(0,B.jsx)(`label`,{className:J.ad12586,children:`Output Routes`}),(0,B.jsx)(`button`,{className:`btn btn-sm ${J.a46df60}`,type:`button`,onClick:r,children:`+ Add Route`})]}),(0,B.jsx)(`div`,{className:G.sectionDividerText,children:`Deliver job results to Slack after each run, based on a condition.`}),n.length===0&&(0,B.jsx)(`div`,{className:J.a7d372a,children:`No output routes configured`}),n.map((e,t)=>(0,B.jsxs)(`div`,{className:J.a2b87fb,children:[(0,B.jsxs)(`div`,{className:J.ac2ba91,children:[(0,B.jsx)(`span`,{className:J.a5a0a31,children:`Slack`}),(0,B.jsx)(`span`,{className:J.a33af1b,children:e.channel?e.channel:(0,B.jsx)(`em`,{children:`no channel set`})}),(0,B.jsx)(`button`,{className:`btn btn-sm btn-danger ${J.afe63fd}`,type:`button`,onClick:()=>i(t),children:`Remove`})]}),(0,B.jsxs)(`div`,{className:J.abc0ff7,children:[(0,B.jsxs)(`div`,{className:G.flexOne,children:[(0,B.jsx)(`label`,{className:J.a9d866e,children:`Channel / User ID`}),(0,B.jsx)(`input`,{type:`text`,value:e.channel,onChange:e=>a(t,{channel:e.target.value}),placeholder:`e.g. U07REM677ME or #general`,className:J.ac0be8a})]}),(0,B.jsxs)(`div`,{className:G.flexOne,children:[(0,B.jsx)(`label`,{className:J.a9d866e,children:`Condition`}),(0,B.jsx)(ee,{value:e.condition,onChange:e=>a(t,{condition:e.target.value}),children:Object.keys(o).map(e=>(0,B.jsx)(`option`,{value:e,children:o[e]},e))})]})]}),(0,B.jsxs)(`div`,{className:J.a90bab8,children:[`Requires `,(0,B.jsx)(`code`,{className:J.acf40e8,children:`SLACK_BOT_TOKEN`}),` in the shell environment or job env vars.`]})]},t)),n.length>0&&(0,B.jsxs)(`div`,{className:J.a1fc682,children:[n.length,` output route`,n.length===1?``:`s`,` — results will be delivered after each run`]})]})}function Qg({form:e,setForm:t,allJobs:n}){if(n.filter(t=>t.id!==e.id).length===0)return null;let r=e.jobTriggers??[],i=e=>{if(r.some(t=>t.source===e))return;let n={type:`job-complete`,source:e};t(e=>({...e,jobTriggers:[...e.jobTriggers??[],n]}))},a=e=>{t(t=>({...t,jobTriggers:(t.jobTriggers??[]).filter(t=>t.source!==e)}))},o=(e,n)=>{t(t=>({...t,jobTriggers:(t.jobTriggers??[]).map(t=>t.source===e?{...t,condition:n||void 0}:t)}))},s=n.filter(t=>t.id!==e.id&&!r.some(e=>e.source===t.id));return(0,B.jsxs)(`div`,{className:G.spacerMd,children:[(0,B.jsx)(`div`,{className:J.a8ef607,children:(0,B.jsx)(`label`,{className:J.ad12586,children:`Reactive Triggers`})}),(0,B.jsx)(`div`,{className:G.sectionDividerText,children:`Auto-fire this job when another job completes successfully, optionally only when a condition is met.`}),r.length>0&&(0,B.jsx)(`div`,{className:J.a9de02f,children:r.map(e=>{let t=n.find(t=>t.id===e.source);return(0,B.jsxs)(`div`,{className:J.ad33a86,children:[(0,B.jsxs)(`div`,{className:J.a71e920,children:[(0,B.jsx)(`span`,{className:J.a05d2a8,children:`on complete`}),(0,B.jsx)(`span`,{className:J.a03df8d,children:t?.name??e.source}),(0,B.jsx)(uc,{status:t?.lastStatus??null}),(0,B.jsx)(`button`,{className:`btn btn-sm btn-danger ${J.afe63fd}`,type:`button`,onClick:()=>a(e.source),children:`Remove`})]}),(0,B.jsxs)(`div`,{className:G.flexRowCenter,children:[(0,B.jsx)(`span`,{className:J.aa0197b,children:`condition (jq):`}),(0,B.jsx)(`input`,{type:`text`,value:e.condition??``,onChange:t=>o(e.source,t.target.value),placeholder:`e.g. .actionItems | length > 3 (blank = always fire)`,className:J.a038b3e})]})]},e.source)})}),s.length>0&&(0,B.jsx)(`div`,{className:G.flexRowCenter,children:(0,B.jsxs)(ee,{defaultValue:``,onChange:e=>{e.target.value&&(i(e.target.value),e.target.value=``)},style:{flex:1},children:[(0,B.jsx)(`option`,{value:``,disabled:!0,children:`+ Add reactive trigger from job…`}),s.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),r.length>0&&(0,B.jsxs)(`div`,{className:J.aacc8cb,children:[r.length,` reactive trigger`,r.length===1?``:`s`,` — this job will auto-fire when source jobs complete`]})]})}function $g({envRows:e,setEnvRows:t}){return(0,B.jsxs)(`div`,{className:G.spacerMd,children:[(0,B.jsxs)(`div`,{className:G.flexRowBetween,children:[(0,B.jsx)(`span`,{className:J.a940316,children:`Environment Variables`}),(0,B.jsx)(`button`,{className:`btn btn-sm ${J.a46df60}`,type:`button`,onClick:()=>t(e=>[...e,[``,``]]),children:`+ Add variable`})]}),e.length===0&&(0,B.jsx)(`div`,{className:J.a7d372a,children:`No variables set`}),e.map(([e,n],r)=>(0,B.jsxs)(`div`,{className:J.ab35aed,children:[(0,B.jsx)(`input`,{className:J.ab56952,value:e,placeholder:`KEY_NAME`,onChange:e=>{let n=e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,``);t(e=>e.map((e,t)=>t===r?[n,e[1]]:e))}}),(0,B.jsx)(`span`,{className:J.a1825e0,children:`=`}),(0,B.jsx)(`input`,{className:J.a16d874,value:n,placeholder:`value`,onChange:e=>t(t=>t.map((t,n)=>n===r?[t[0],e.target.value]:t))}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(e=>e.filter((e,t)=>t!==r)),className:J.ae42aa7,title:`Remove`,children:`×`})]},r))]})}function e_({remoteEnabled:e,setRemoteEnabled:t,remoteHost:n,setRemoteHost:r,remoteWorkdir:i,setRemoteWorkdir:a,sshTestState:o,setSshTestState:s,sshTestError:c,setSshTestError:l,onTestSsh:u}){return(0,B.jsxs)(`div`,{className:G.spacerMd,children:[(0,B.jsxs)(`div`,{onClick:()=>{t(e=>!e),s(`idle`),l(``)},style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 12px`,borderRadius:8,border:`1px solid #30363d`,background:e?`#0d1b2a`:`var(--color-bg)`,cursor:`pointer`,userSelect:`none`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>t(e.target.checked),onClick:e=>e.stopPropagation(),className:J.a2dd3f2}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:G.rowText,children:`Run on remote machine`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Execute this job on a remote host via SSH`})]})]}),e&&(0,B.jsxs)(`div`,{className:J.a237efa,children:[(0,B.jsxs)(`div`,{className:J.a66e058,children:[(0,B.jsx)(`label`,{className:J.a7048b8,children:`Host`}),(0,B.jsxs)(`div`,{className:J.a83be98,children:[(0,B.jsx)(`input`,{style:{...h,flex:1,fontFamily:`var(--font-mono)`},value:n,onChange:e=>{r(e.target.value),s(`idle`),l(``)},placeholder:`user@hostname`}),(0,B.jsx)(`button`,{className:`btn btn-sm`,type:`button`,disabled:!n.trim()||o===`testing`,onClick:u,style:{flexShrink:0,color:o===`ok`?`var(--color-positive)`:o===`error`?`var(--color-negative)`:void 0},children:o===`testing`?`Testing...`:o===`ok`?`Connected`:o===`error`?`Failed`:`Test Connection`})]}),o===`error`&&c&&(0,B.jsx)(`div`,{className:J.a820114,children:c})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`label`,{className:J.a7048b8,children:[`Working directory `,(0,B.jsx)(`span`,{className:J.ab37cd8,children:`(optional)`})]}),(0,B.jsx)(`input`,{style:{...h,fontFamily:`var(--font-mono)`},value:i,onChange:e=>a(e.target.value),placeholder:`/path/to/workdir`})]})]})]})}var t_="I want to add a new TeamworkOS job. Please use the /add-job skill in this repo (.claude/skills/add-job) to walk me through it — ask me what the job should do, when it should run, whether it's a single-agent (Standard) or multi-agent (Team / Subagent) flow, then create the JSON under ${TEAMWORK_HOME:-~/.teamwork}/jobs/ and install it.";function n_({onToast:e}){let[t,n]=(0,L.useState)(!1);return(0,B.jsxs)(`div`,{style:{marginBottom:20,padding:`12px 14px`,background:`rgba(188,140,255,0.06)`,border:`1px solid rgba(188,140,255,0.28)`,borderRadius:8},children:[(0,B.jsxs)(`div`,{className:J.ac2ba91,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,style:{display:`inline-flex`,width:6,height:6,borderRadius:`50%`,background:`var(--color-primary)`,boxShadow:`0 0 0 3px rgba(188,140,255,0.18)`}}),(0,B.jsx)(`div`,{className:J.a209d48,children:`Let Claude Code create your job`})]}),(0,B.jsxs)(`div`,{className:J.a31130d,children:[`Copy this prompt and paste it into Claude Code. It invokes the`,` `,(0,B.jsx)(`code`,{className:J.a75f4f8,children:`add-job`}),` skill, which asks the right questions (schedule, flow, participants) and writes a valid job file straight to`,` `,(0,B.jsx)(`code`,{className:J.a75f4f8,children:"${TEAMWORK_HOME:-~/.teamwork}/jobs/"}),`.`]}),(0,B.jsxs)(`div`,{style:{position:`relative`,fontFamily:g,fontSize:12,lineHeight:1.55,color:C.text,background:`var(--color-bg)`,border:`1px solid #30363d`,borderRadius:6,padding:`10px 12px`,paddingRight:72,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:[t_,(0,B.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(t_),n(!0),e?.(`Prompt copied — paste into Claude Code`),setTimeout(()=>n(!1),2e3)}catch{e?.(`Copy failed — select the text manually`)}},style:{position:`absolute`,top:8,right:8,padding:`4px 10px`,fontSize:11,fontWeight:600,fontFamily:`inherit`,background:t?`rgba(188,140,255,0.18)`:`rgba(188,140,255,0.1)`,color:`var(--color-primary)`,border:`1px solid rgba(188,140,255,0.35)`,borderRadius:5,cursor:`pointer`,transition:`background 0.15s`},children:t?`Copied`:`Copy`})]}),(0,B.jsxs)(`div`,{className:J.adf9b79,children:[`Prefer to fill it in yourself? Pick `,(0,B.jsx)(`strong`,{className:J.a7a40a3,children:`Blank`}),` or a template above.`]})]})}var r_=[{mode:`standard`,icon:`⚡`,label:`Standard`,description:`Single Claude Code session`},{mode:`seam-v1`,icon:`🤝`,label:`Team`,description:`A team of agents working together`}];function i_({flowMode:e,onChange:t}){return(0,B.jsxs)(`div`,{className:J.af335f1,children:[(0,B.jsx)(`label`,{className:G.blockLabelCompact,children:`Flow`}),(0,B.jsx)(`div`,{className:J.ad40728,children:r_.map(({mode:n,icon:r,label:i,description:a})=>{let o=e===n,s=n===`standard`?C.blue:`var(--color-primary)`;return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>t(n),style:{flex:`1 1 calc(50% - 6px)`,minWidth:120,padding:`8px 10px`,borderRadius:8,fontSize:12,fontWeight:500,cursor:`pointer`,textAlign:`left`,border:`1px solid ${o?s:C.border}`,background:o?`${s}18`:`var(--color-bg)`,color:o?s:`var(--color-border-strong)`,transition:`all 0.18s ease-out`},children:[(0,B.jsxs)(`div`,{className:J.a64b521,children:[r,` `,i]}),(0,B.jsx)(`div`,{style:{fontSize:11,color:o?s:C.muted,marginTop:2,opacity:o?1:.7},children:a})]},n)})})]})}var a_={depRow:`_depRow_1ms5i_5`,depRowChecked:`_depRowChecked_1ms5i_23`,inputRowChecked:`_inputRowChecked_1ms5i_30`};function o_({form:e,setForm:t,allJobs:n}){let r=n.filter(t=>t.id!==e.id);if(r.length===0)return null;let i=e.dependsOn??[],a=e.inputs??[],o=e=>{t(t=>{let n=t.dependsOn??[],r=n.includes(e)?n.filter(t=>t!==e):[...n,e];return{...t,dependsOn:r}})},s=e=>{t(t=>{let n=t.inputs??[],r=n.includes(e)?n.filter(t=>t!==e):[...n,e];return{...t,inputs:r}})};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(hg,{title:`Dependencies`,hint:i.length>0?`${i.length} selected`:`Skip when an upstream fails`,children:[(0,B.jsx)(`div`,{className:G.sectionDividerText,children:`This job will be skipped if any selected dependency did not last succeed.`}),(0,B.jsx)(`div`,{className:J.a67d2d4,children:r.map(e=>{let t=i.includes(e.id);return(0,B.jsxs)(`label`,{className:`${a_.depRow} ${t?a_.depRowChecked:``}`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>o(e.id),className:J.a9cc22c}),(0,B.jsxs)(`div`,{className:J.a6c2755,children:[(0,B.jsx)(`div`,{className:J.a37ff26,children:e.name}),(0,B.jsx)(`div`,{className:J.a124c11,children:e.id})]}),(0,B.jsx)(uc,{status:e.lastStatus})]},e.id)})})]}),(0,B.jsxs)(hg,{title:`Pipeline inputs`,hint:a.length>0?`${a.length} selected`:`Inject upstream outputs as context`,children:[(0,B.jsx)(`div`,{className:G.sectionDividerText,children:`Upstream job outputs injected as context before this job's prompt runs.`}),(0,B.jsx)(`div`,{className:J.a67d2d4,children:r.map(e=>{let t=a.includes(e.id);return(0,B.jsxs)(`label`,{className:`${a_.depRow} ${t?a_.inputRowChecked:``}`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:t,onChange:()=>s(e.id),className:J.a4bec9d}),(0,B.jsxs)(`div`,{className:J.a6c2755,children:[(0,B.jsx)(`div`,{className:J.a37ff26,children:e.name}),(0,B.jsx)(`div`,{className:J.a124c11,children:e.id})]}),(0,B.jsx)(uc,{status:e.lastStatus})]},e.id)})}),a.length>0&&(0,B.jsxs)(`div`,{className:J.ad48594,children:[a.length,` input`,a.length===1?``:`s`,` selected — outputs will be injected at runtime`]})]})]})}function s_(e){let[t,n]=(0,L.useState)(0);return p(A,t=>{if(e){if(typeof t==`object`&&t){let n=t.name;if(typeof n==`string`&&n!==e)return}n(e=>e+1)}}),te(e?`/api/spawn-profiles/${encodeURIComponent(e)}`:``,{refreshToken:t})}function c_(){let[e,t]=(0,L.useState)(0);return p(A,()=>t(e=>e+1)),te(`/api/spawn-profiles`,{refreshToken:e})}var Y={card:`_card_19dgd_1`,summaryRow:`_summaryRow_19dgd_9`,caret:`_caret_19dgd_17`,nameTag:`_nameTag_19dgd_23`,sourceTag:`_sourceTag_19dgd_33`,description:`_description_19dgd_43`,fields:`_fields_19dgd_49`,fieldLabel:`_fieldLabel_19dgd_57`,fieldValue:`_fieldValue_19dgd_62`,empty:`_empty_19dgd_68`,errorRow:`_errorRow_19dgd_73`,loadingRow:`_loadingRow_19dgd_78`,actions:`_actions_19dgd_84`,editor:`_editor_19dgd_92`,editorRow:`_editorRow_19dgd_100`,editorToggle:`_editorToggle_19dgd_106`,editorCheckbox:`_editorCheckbox_19dgd_118`};function l_(e,t){return e===void 0?(0,B.jsx)(`span`,{className:Y.empty,children:`inherit (no override)`}):e.length===0?(0,B.jsx)(`span`,{className:Y.empty,children:t}):e.join(`, `)}function u_(e){return e===void 0?(0,B.jsx)(`span`,{className:Y.empty,children:`inherit (default false)`}):e?`true`:`false`}function d_({name:e,defaultExpanded:t=!1}){let[n,r]=(0,L.useState)(t),[i,a]=(0,L.useState)(!1),o=s_(e);if(!e||o.status===`idle`)return null;if(o.status===`loading`)return(0,B.jsx)(`div`,{className:Y.card,children:(0,B.jsxs)(`div`,{className:Y.summaryRow,children:[(0,B.jsx)(`span`,{className:Y.caret,children:`›`}),(0,B.jsx)(`span`,{className:Y.nameTag,children:e}),(0,B.jsx)(`span`,{className:Y.loadingRow,children:`loading…`})]})});if(o.status===`error`)return(0,B.jsx)(`div`,{className:Y.card,children:(0,B.jsxs)(`div`,{className:Y.summaryRow,children:[(0,B.jsx)(`span`,{className:Y.caret,children:`›`}),(0,B.jsx)(`span`,{className:Y.nameTag,children:e}),(0,B.jsx)(`span`,{className:Y.errorRow,children:o.error})]})});let s=o.data,c=n?`⌄`:`›`;return(0,B.jsxs)(`div`,{className:Y.card,"data-testid":`spawn-profile-card-${s.name}`,children:[(0,B.jsxs)(`div`,{className:Y.summaryRow,onClick:()=>r(e=>!e),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(e=>!e))},"aria-expanded":n,"aria-label":`Toggle spawn profile ${s.name} details`,children:[(0,B.jsx)(`span`,{className:Y.caret,children:c}),(0,B.jsx)(`span`,{className:Y.nameTag,children:s.name}),(0,B.jsx)(`span`,{className:Y.sourceTag,children:s.source}),(0,B.jsx)(`span`,{className:Y.description,children:s.description??(0,B.jsx)(`span`,{className:Y.empty,children:`no description`})})]}),n&&!i&&(0,B.jsxs)(`div`,{className:Y.fields,"data-testid":`spawn-profile-fields-${s.name}`,children:[(0,B.jsx)(`div`,{className:Y.fieldLabel,children:`mcpServers`}),(0,B.jsx)(`div`,{className:Y.fieldValue,children:l_(s.mcpServers,`none (no MCP access)`)}),(0,B.jsx)(`div`,{className:Y.fieldLabel,children:`enabledPlugins`}),(0,B.jsx)(`div`,{className:Y.fieldValue,children:l_(s.enabledPlugins,`none (marketplace plugins suppressed)`)}),(0,B.jsx)(`div`,{className:Y.fieldLabel,children:`claudeAiMcp`}),(0,B.jsx)(`div`,{className:Y.fieldValue,children:u_(s.claudeAiMcp)}),(0,B.jsx)(`div`,{className:Y.fieldLabel,children:`extraPluginDirs`}),(0,B.jsx)(`div`,{className:Y.fieldValue,children:l_(s.extraPluginDirs,`none`)}),(0,B.jsx)(`div`,{className:Y.fieldLabel,children:`suppressUserSettings`}),(0,B.jsx)(`div`,{className:Y.fieldValue,children:u_(s.suppressUserSettings)})]}),n&&!i&&(0,B.jsx)(f_,{profile:s,onEdit:()=>a(!0)}),n&&i&&(0,B.jsx)(p_,{profile:s,onDone:()=>a(!1)})]})}function f_({profile:e,onEdit:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(null);async function o(){r(!0),a(null);try{let t=await fetch(`/api/spawn-profiles/${encodeURIComponent(e.name)}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}}return(0,B.jsxs)(`div`,{className:Y.actions,children:[(0,B.jsx)(F,{size:`sm`,variant:`default`,onClick:t,children:e.source===`built-in`?`Create override`:`Edit`}),e.source===`override`&&(0,B.jsx)(F,{size:`sm`,variant:`ghost`,onClick:o,disabled:n,children:n?`Restoring…`:`Restore default`}),i&&(0,B.jsx)(`span`,{className:Y.errorRow,children:i})]})}function p_({profile:e,onDone:t}){let[n,r]=(0,L.useState)((e.mcpServers??[]).join(`, `)),[i,a]=(0,L.useState)((e.enabledPlugins??[]).join(`, `)),[o,s]=(0,L.useState)((e.extraPluginDirs??[]).join(`, `)),[c,l]=(0,L.useState)(e.claudeAiMcp??!1),[u,d]=(0,L.useState)(e.suppressUserSettings??!1),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(null);function g(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}async function _(){p(!0),h(null);try{let r={name:e.name,...e.description?{description:e.description}:{},mcpServers:g(n),enabledPlugins:g(i),extraPluginDirs:g(o),claudeAiMcp:c,suppressUserSettings:u},a=await fetch(`/api/spawn-profiles/${encodeURIComponent(e.name)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error??`HTTP ${a.status}`)}t()}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}return(0,B.jsxs)(`div`,{className:Y.editor,"data-testid":`spawn-profile-editor-${e.name}`,children:[(0,B.jsxs)(`label`,{className:Y.editorRow,children:[(0,B.jsx)(`span`,{className:Y.fieldLabel,children:`mcpServers`}),(0,B.jsx)(P,{compact:!0,value:n,onChange:e=>r(e.target.value),placeholder:`comma-separated (e.g. gateway)`,"aria-label":`mcpServers (comma-separated)`})]}),(0,B.jsxs)(`label`,{className:Y.editorRow,children:[(0,B.jsx)(`span`,{className:Y.fieldLabel,children:`enabledPlugins`}),(0,B.jsx)(P,{compact:!0,value:i,onChange:e=>a(e.target.value),placeholder:`comma-separated (name@market)`,"aria-label":`enabledPlugins (comma-separated)`})]}),(0,B.jsxs)(`label`,{className:Y.editorRow,children:[(0,B.jsx)(`span`,{className:Y.fieldLabel,children:`extraPluginDirs`}),(0,B.jsx)(P,{compact:!0,value:o,onChange:e=>s(e.target.value),placeholder:`comma-separated absolute paths`,"aria-label":`extraPluginDirs (comma-separated)`})]}),(0,B.jsxs)(`label`,{className:Y.editorToggle,children:[(0,B.jsx)(P,{type:`checkbox`,className:Y.editorCheckbox,checked:c,onChange:e=>l(e.target.checked),"aria-label":`claudeAiMcp`}),(0,B.jsx)(`span`,{children:`claudeAiMcp (drops --strict-mcp-config — enables claude.ai connectors)`})]}),(0,B.jsxs)(`label`,{className:Y.editorToggle,children:[(0,B.jsx)(P,{type:`checkbox`,className:Y.editorCheckbox,checked:u,onChange:e=>d(e.target.checked),"aria-label":`suppressUserSettings`}),(0,B.jsx)(`span`,{children:`suppressUserSettings (drops ~/.claude/settings.json + ~/.claude/skills/; OAuth preserved)`})]}),(0,B.jsxs)(`div`,{className:Y.actions,children:[(0,B.jsx)(F,{size:`sm`,variant:`primary`,onClick:_,disabled:f,children:f?`Saving…`:`Save override`}),(0,B.jsx)(F,{size:`sm`,variant:`ghost`,onClick:t,disabled:f,children:`Cancel`}),m&&(0,B.jsx)(`span`,{className:Y.errorRow,children:m})]})]})}function m_({form:e,setField:t,setEngineOverride:n,uniqueEmployees:r}){let i=(0,L.useRef)(null),a=(0,L.useCallback)(()=>{let e=i.current;e&&(e.style.height=`auto`,e.style.height=Math.min(Math.max(e.scrollHeight,72),360)+`px`,e.style.overflowY=e.scrollHeight>360?`auto`:`hidden`)},[]);(0,L.useEffect)(()=>{a()},[e.prompt,a]);let[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(null);(0,L.useEffect)(()=>{let e=!1;return fetch(`/api/engines/models`).then(e=>{if(!e.ok)throw Error(e.statusText||`HTTP ${e.status}`);return e.json()}).then(t=>{e||s(Array.isArray(t.models)?t.models:[])}).catch(t=>{e||l(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[]);let u=e.engineOverrides?.pluginDirs??[],d=(e,t)=>{let r=[...u];r[e]=t,n(`pluginDirs`,r.filter(e=>e.length>0).length>0?r:void 0)},f=e=>{let t=u.filter((t,n)=>n!==e);n(`pluginDirs`,t.length>0?t:void 0)},p=()=>{n(`pluginDirs`,[...u,``])};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Initial Prompt`}),(0,B.jsxs)(`div`,{className:J.af255fe,children:[(0,B.jsx)(`textarea`,{ref:i,style:{...h,fontFamily:g,resize:`none`,minHeight:72,maxHeight:360,overflowY:`hidden`},value:e.prompt??``,onChange:e=>t(`prompt`,e.target.value),placeholder:`Prompt to send into the Claude REPL after it starts (optional)`}),(0,B.jsxs)(`span`,{className:J.a079824,children:[(e.prompt??``).length,` chars`]})]}),(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Assigned Employee`}),(0,B.jsxs)(ee,{value:e.employee??``,onChange:e=>t(`employee`,e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:`— Unassigned —`}),r.map(e=>(0,B.jsxs)(`option`,{value:e.name,children:[e.emoji??`👤`,` `,e.displayName??e.name]},e.name))]}),(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Model`}),(0,B.jsxs)(ee,{value:e.engineOverrides?.model??``,onChange:e=>n(`model`,e.target.value||void 0),disabled:!o&&!c,children:[(0,B.jsx)(`option`,{value:``,children:`(use employee / settings default)`}),(o??[]).map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.label},e.id))]}),c&&(0,B.jsxs)(`div`,{className:G.rowHint,style:{color:C.red},children:[`Could not load models: `,c]}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Per-job model override. Beats the assigned employee's model and the global engine default.`}),(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Extra plugin dirs`}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[u.length===0&&(0,B.jsx)(`div`,{className:G.rowHint,children:`None. The teamwork-jobs plugin is registered automatically for every job.`}),u.map((e,t)=>(0,B.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,B.jsx)(`input`,{type:`text`,style:{...h,fontFamily:g,flex:1},placeholder:`/absolute/path/to/plugin-dir`,value:e,onChange:e=>d(t,e.target.value)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(t),style:{padding:`4px 10px`,borderRadius:6,border:`1px solid #30363d`,background:`var(--color-bg)`,color:`var(--color-text)`,cursor:`pointer`},children:`Remove`})]},t)),(0,B.jsx)(`button`,{type:`button`,onClick:p,style:{alignSelf:`flex-start`,padding:`4px 10px`,borderRadius:6,border:`1px solid #30363d`,background:`var(--color-bg)`,color:`var(--color-text)`,cursor:`pointer`},children:`+ Add plugin dir`})]}),(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Per-session timeout (sec)`}),(0,B.jsx)(`input`,{type:`number`,min:0,max:1800,step:30,style:{...h,fontFamily:g,width:140},placeholder:`(use global default)`,value:e.engineOverrides?.noProgressTimeoutMs===void 0?``:Math.round(e.engineOverrides.noProgressTimeoutMs/1e3),onChange:e=>{let t=e.target.value;if(t===``){n(`noProgressTimeoutMs`,void 0);return}let r=Number(t);if(!Number.isFinite(r)||r<0){n(`noProgressTimeoutMs`,void 0);return}n(`noProgressTimeoutMs`,Math.trunc(r)*1e3)}}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Wall-clock budget for the Claude session. Overrides the global default (25 min). 0 disables; max 1800 (30 min).`}),(0,B.jsxs)(`div`,{onClick:()=>t(`selfImprove`,!e.selfImprove),style:{display:`flex`,alignItems:`center`,gap:10,marginTop:8,padding:`10px 12px`,borderRadius:8,border:`1px solid #30363d`,background:e.selfImprove?`#1a1a2e`:`var(--color-bg)`,cursor:`pointer`,userSelect:`none`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.selfImprove??!1,onChange:e=>t(`selfImprove`,e.target.checked),onClick:e=>e.stopPropagation(),className:J.ae8a182}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:G.rowText,children:`Self-improving prompt`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Claude retrospectively analyzes each run and can edit its own prompt to improve future runs`})]})]}),(0,B.jsx)(h_,{value:e.profile,onChange:e=>t(`profile`,e)}),(0,B.jsxs)(`div`,{onClick:()=>t(`claudeAiMcp`,!e.claudeAiMcp),style:{display:`flex`,alignItems:`center`,gap:10,marginTop:8,padding:`10px 12px`,borderRadius:8,border:`1px solid #30363d`,background:e.claudeAiMcp?`#1a1a2e`:`var(--color-bg)`,cursor:`pointer`,userSelect:`none`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.claudeAiMcp??!1,onChange:e=>t(`claudeAiMcp`,e.target.checked),onClick:e=>e.stopPropagation(),className:J.ae8a182}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:G.rowText,children:`claude.ai Connected Apps`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Lets this job reach claude.ai connectors (Gmail, Drive, Calendar, etc.). Opting in drops strict MCP gating, so the spawn also sees every other ambient MCP server. The assigned employee's setting, when set, overrides this.`})]})]})]})}function h_({value:e,onChange:t}){let n=c_(),r=n.status===`ok`?n.data:[];return(0,B.jsxs)(`div`,{style:{marginTop:12,display:`flex`,flexDirection:`column`,gap:8},children:[(0,B.jsx)(`div`,{className:G.rowText,children:`SpawnProfile`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`Named bundle of MCP servers + enabled marketplace plugins + claude.ai opt-in that the spawn inherits as a baseline. Per-job overrides on individual dials still win. Leave unset to let the assigned employee's profile (if any) apply, or the engine defaults.`}),(0,B.jsxs)(ee,{value:e??``,onChange:e=>t(e.target.value||void 0),style:{maxWidth:360},children:[(0,B.jsx)(`option`,{value:``,children:`(no profile — use employee default or engine fallback)`}),r.map(e=>(0,B.jsxs)(`option`,{value:e.name,children:[e.name,` `,e.source===`override`?`(override)`:``]},e.name))]}),e&&(0,B.jsx)(d_,{name:e})]})}var g_={critical:`var(--color-negative)`,high:`#e3b341`,normal:`var(--color-text-muted)`,low:`var(--color-border-strong)`},__=[`critical`,`high`,`normal`,`low`];function v_({value:e,onChange:t}){let n=e??`normal`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Priority`}),(0,B.jsx)(`div`,{className:J.a72493a,children:__.map(e=>{let r=n===e;return(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(e),style:{flex:1,padding:`6px 0`,borderRadius:8,fontSize:12,fontWeight:600,textTransform:`capitalize`,cursor:`pointer`,border:`1px solid ${r?g_[e]:`var(--color-border)`}`,background:r?`color-mix(in srgb, ${g_[e]} 9%, transparent)`:`var(--color-bg)`,color:r?g_[e]:`var(--color-border-strong)`,transition:`all 0.15s ease`},children:e},e)})}),(0,B.jsx)(`div`,{className:J.acd7292,children:`Higher priority jobs run first when the scheduling queue is active`})]})}function y_({form:e,setField:t,timeoutRec:n}){return(0,B.jsxs)(hg,{title:`Execution options`,hint:`Timeout, priority, skip & ignore`,children:[(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Timeout (seconds)`}),(0,B.jsxs)(`div`,{className:G.flexRowCenter,children:[(0,B.jsx)(`input`,{style:{...h,flex:1},type:`number`,value:e.timeout,onChange:e=>t(`timeout`,parseInt(e.target.value)||900)}),n&&n.shouldAdjust&&(0,B.jsxs)(`button`,{type:`button`,onClick:()=>t(`timeout`,n.recommended),title:n.reason,className:J.accb09d,onMouseEnter:e=>e.currentTarget.style.background=`rgba(227, 179, 65, 0.2)`,onMouseLeave:e=>e.currentTarget.style.background=`rgba(227, 179, 65, 0.1)`,children:[`Suggest `,n.recommended,`s`]})]}),n&&n.dataPoints>=3&&(0,B.jsxs)(`div`,{className:J.ad872cc,children:[`p75: `,n.p75,`s · p95: `,n.p95,`s · `,n.dataPoints,` runs`,n.shouldAdjust&&(0,B.jsxs)(`span`,{className:J.af87a1a,children:[`— `,n.reason]})]}),(0,B.jsx)(v_,{value:e.priority,onChange:e=>t(`priority`,e)}),(0,B.jsxs)(`div`,{onClick:()=>t(`skipIfRunning`,!e.skipIfRunning),style:{display:`flex`,alignItems:`center`,gap:10,marginTop:8,padding:`10px 12px`,borderRadius:8,border:`1px solid #30363d`,background:e.skipIfRunning?`#1a1a2e`:`var(--color-bg)`,cursor:`pointer`,userSelect:`none`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.skipIfRunning??!1,onChange:e=>t(`skipIfRunning`,e.target.checked),onClick:e=>e.stopPropagation(),className:J.a021478}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:G.rowText,children:`Skip if already running`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`If a previous run is still active, skip this scheduled run instead of starting a new session`})]})]}),(0,B.jsxs)(`div`,{onClick:()=>t(`ignorePauses`,!e.ignorePauses),style:{display:`flex`,alignItems:`center`,gap:10,marginTop:8,padding:`10px 12px`,borderRadius:8,border:`1px solid #30363d`,background:e.ignorePauses?`#1a1a2e`:`var(--color-bg)`,cursor:`pointer`,userSelect:`none`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.ignorePauses??!1,onChange:e=>t(`ignorePauses`,e.target.checked),onClick:e=>e.stopPropagation(),className:J.a20f5d6}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:G.rowText,children:`Ignore pauses`}),(0,B.jsx)(`div`,{className:G.rowHint,children:`When the global pause is active, this job will still run on its schedule. Use sparingly — only for jobs that must not be skipped (e.g. critical monitoring).`})]})]})]})}function b_(e,t){return{id:e.id,name:e.name,description:e.description,schedule:e.schedule,scheduleHuman:e.scheduleHuman,command:e.command,timeout:e.timeout,prompt:e.prompt??``,selfImprove:e.selfImprove??!1,skipIfRunning:e.skipIfRunning??!1,ignorePauses:e.ignorePauses??!1,retryCount:e.retryCount??0,retryDelay:e.retryDelay??60,triggers:t?[]:e.triggers??[],jobTriggers:e.jobTriggers??[],env:e.env??{},remote:e.remote,dependsOn:e.dependsOn??[],inputs:e.inputs??[],outputs:e.outputs??[],priority:e.priority??`normal`,employee:e.employee??``,flow:e.flow,participants:e.participants??[],coordinationHint:e.coordinationHint,lead:e.lead,task:e.task??``,engineOverrides:e.engineOverrides,claudeAiMcp:e.claudeAiMcp,profile:e.profile}}function x_(e,t){e?.host?(t.setRemoteEnabled(!0),t.setRemoteHost(e.host),t.setRemoteWorkdir(e.workdir??``)):(t.setRemoteEnabled(!1),t.setRemoteHost(``),t.setRemoteWorkdir(``))}var S_={id:``,name:``,description:``,schedule:`0 9 * * 1-5`,scheduleHuman:``,command:``,timeout:900,prompt:``,selfImprove:!1,skipIfRunning:!1,ignorePauses:!1,retryCount:1,retryDelay:900,triggers:[],jobTriggers:[],env:{},dependsOn:[],inputs:[],outputs:[],priority:`normal`,employee:``,flow:void 0,participants:[],coordinationHint:void 0,lead:void 0,task:``};function C_({job:e,duplicateFrom:t,onSave:n,onClose:r,onTestRun:i,onToast:a}){let[o,s]=(0,L.useState)(S_),[c,l]=(0,L.useState)(e?.flow===`seam-v1`?`seam-v1`:`standard`),u=c===`seam-v1`,[d,f]=(0,L.useState)({}),[p,m]=(0,L.useState)(!1),[g,_]=(0,L.useState)({}),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)([]),[S,w]=(0,L.useState)([]),T=Array.from(new Map(S.map(e=>[e.name,e])).values()),[E,D]=(0,L.useState)([]),[O,k]=(0,L.useState)(!1),[A,j]=(0,L.useState)(!1),[M,N]=(0,L.useState)(``),[P,F]=(0,L.useState)(``),[te,I]=(0,L.useState)(`idle`),[ne,re]=(0,L.useState)(``),R=(0,L.useRef)(null),[z,ie]=(0,L.useState)([]),[ae,oe]=(0,L.useState)(e||t?`blank`:`claude-code`),[se,V]=(0,L.useState)(null),[ce,le]=(0,L.useState)(!1),[ue,de]=(0,L.useState)(``),[fe,pe]=(0,L.useState)(``),me=(0,L.useRef)(!1);(0,L.useEffect)(()=>{!e?._migrated||e.flow!==`seam-v1`||me.current||(me.current=!0,a?.(`This job was migrated from the legacy topology model. Re-save to persist the new shape.`))},[e,a]),(0,L.useEffect)(()=>{e||!t||(s(b_(t,!0)),l(t.flow===`seam-v1`?`seam-v1`:`standard`),D(Object.entries(t.env??{})),x_(t.remote,{setRemoteEnabled:j,setRemoteHost:N,setRemoteWorkdir:F}),oe(null))},[e,t]),(0,L.useEffect)(()=>{e&&(s(b_(e,!1)),l(e.flow===`seam-v1`?`seam-v1`:`standard`),D(Object.entries(e.env??{})),x_(e.remote,{setRemoteEnabled:j,setRemoteHost:N,setRemoteWorkdir:F}))},[e]),(0,L.useEffect)(()=>{if(!e){V(null);return}fetch(`/api/jobs/${e.id}/timeout-recommendation`).then(e=>e.ok?e.json():null).then(e=>V(e)).catch(()=>V(null))},[e]),(0,L.useEffect)(()=>{fetch(`/api/jobs`).then(e=>e.ok?e.json():[]).then(e=>x(e)).catch(()=>x([]))},[]),(0,L.useEffect)(()=>{e||fetch(`/api/templates`).then(e=>e.ok?e.json():[]).then(e=>ie(e)).catch(()=>ie([]))},[e]),(0,L.useEffect)(()=>{fetch(`/api/org`).then(e=>e.ok?e.json():{employees:[]}).then(e=>{w(e.employees??[])}).catch(()=>w([]))},[]);let he=(0,L.useCallback)(e=>{if(!e){s(S_),D([]),oe(`blank`);return}s({...S_,name:e.name??``,description:e.description??``,schedule:e.schedule??`0 9 * * 1-5`,scheduleHuman:e.scheduleHuman??``,command:e.command??``,timeout:e.timeout??900,prompt:e.prompt??``,selfImprove:e.selfImprove??!1}),D([]),oe(e.id)},[]),ge=(0,L.useCallback)(e=>{let t=e.flow;s({id:e.id??``,name:e.name??``,description:e.description??``,schedule:e.schedule??`0 9 * * 1-5`,scheduleHuman:e.scheduleHuman??``,command:e.command??``,timeout:e.timeout??900,prompt:e.prompt??``,selfImprove:e.selfImprove??!1,skipIfRunning:e.skipIfRunning??!1,ignorePauses:e.ignorePauses??!1,retryCount:e.retryCount??0,retryDelay:e.retryDelay??60,triggers:[],jobTriggers:e.jobTriggers??[],env:e.env??{},dependsOn:e.dependsOn??[],inputs:e.inputs??[],outputs:e.outputs??[],priority:e.priority??`normal`,employee:``,flow:t,participants:e.participants??[],coordinationHint:e.coordinationHint,lead:e.lead,task:e.task??``,engineOverrides:e.engineOverrides}),l(t===`seam-v1`?`seam-v1`:`standard`),D(Object.entries(e.env??{})),x_(e.remote,{setRemoteEnabled:j,setRemoteHost:N,setRemoteWorkdir:F}),oe(null),le(!1),de(``),pe(``)},[]),_e=(0,L.useCallback)(()=>{try{ge(JSON.parse(ue))}catch{pe(`Invalid JSON — paste a valid .claude-job.json package`)}},[ue,ge]),ve=(0,L.useCallback)(e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=e=>{try{ge(JSON.parse(e.target?.result))}catch{pe(`Could not parse file — must be a valid .claude-job.json`),le(!0)}},n.readAsText(t),e.target.value=``},[ge]);(0,L.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=e.target,n=t?.tagName;n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let ye=(e,t)=>s(n=>({...n,[e]:t})),be=(e,t)=>s(n=>{let r={...n.engineOverrides??{}};return e===`model`?t===void 0||t===``?delete r.model:typeof t==`string`&&(r.model=t):e===`pluginDirs`?!Array.isArray(t)||t.length===0?delete r.pluginDirs:r.pluginDirs=t:t===void 0||t===``||typeof t!=`number`||!Number.isFinite(t)?delete r.noProgressTimeoutMs:r.noProgressTimeoutMs=t,r.model===void 0&&(!r.pluginDirs||r.pluginDirs.length===0)&&r.noProgressTimeoutMs===void 0?{...n,engineOverrides:void 0}:{...n,engineOverrides:r}}),xe=()=>{let e={};for(let[t,n]of E)t.trim()&&(e[t.trim()]=n);let t;if(A&&M.trim()&&(t={host:M.trim()},P.trim()&&(t.workdir=P.trim())),u){m(!0);let r=cg({...o,env:e,remote:t});f(r);let i={};if(o.id||(i.id=`Job ID is required.`),o.schedule||(i.schedule=`Schedule is required.`),y(!0),_(i),Object.keys(r).length>0||Object.keys(i).length>0)return;n(ug({...o,env:e,remote:t},`seam-v1`));return}let r={};o.id||(r.id=`Job ID is required.`),o.schedule||(r.schedule=`Schedule is required.`),y(!0),_(r),!(Object.keys(r).length>0)&&n(ug({...o,flow:void 0,env:e,remote:t},`legacy`))},Se=()=>{if(!o.id||!o.schedule||!i)return;let e={};for(let[t,n]of E)t.trim()&&(e[t.trim()]=n);let t;A&&M.trim()&&(t={host:M.trim()},P.trim()&&(t.workdir=P.trim())),n({...o,env:e,remote:t}),k(!0),i(o.id),setTimeout(()=>k(!1),2e3)},Ce=(0,L.useCallback)(async()=>{if(M.trim()){I(`testing`),re(``);try{let e=await(await fetch(`/api/test-ssh`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:M.trim()})})).json();e.ok?(I(`ok`),setTimeout(()=>I(`idle`),3e3)):(I(`error`),re(e.error??`Connection failed`))}catch{I(`error`),re(`Request failed`)}}},[M]),we=e?`Edit Job`:t?`Duplicate Job`:`Add Job`;return(0,B.jsx)(fg,{open:!0,wide:!0,closeOnEscape:!1,onClose:r,ariaLabel:we,header:(0,B.jsx)(`div`,{className:pg.titleBlock,children:(0,B.jsx)(`div`,{className:pg.title,children:we})}),footer:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:pg.footerLeft,children:[(0,B.jsx)(`button`,{className:`btn`,onClick:r,children:ae===`claude-code`?`Close`:`Cancel`}),e&&i&&(0,B.jsx)(`button`,{className:`btn btn-green`,onClick:Se,disabled:O,children:O?`Running...`:`▶ Test Run`})]}),(0,B.jsx)(`div`,{className:pg.footerRight,children:ae!==`claude-code`&&(0,B.jsx)(`button`,{className:`btn btn-primary`,onClick:xe,disabled:u&&p&&Object.keys(d).length>0,children:`Save`})})]}),children:(0,B.jsxs)(B.Fragment,{children:[!e&&!t&&(0,B.jsx)(_g,{templates:z,selectedTemplate:ae,onSelectClaudeCode:()=>oe(`claude-code`),onSelectBlank:()=>he(null),onSelectTemplate:he,showImportJson:ce,onToggleImportJson:()=>{le(e=>!e),pe(``)},importJsonText:ue,importJsonError:fe,onImportJsonChange:e=>{de(e),pe(``)},onImportJsonSubmit:_e,onCancelImportJson:()=>{le(!1),de(``),pe(``)},fileInputRef:R,onImportFile:ve}),ae===`claude-code`&&(0,B.jsx)(n_,{onToast:a}),ae!==`claude-code`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`label`,{className:J.afa9908,children:`Job ID`}),(0,B.jsx)(`input`,{style:{...h,opacity:e?.5:1,borderColor:v&&g.id?C.red:void 0},value:o.id,disabled:!!e,onChange:e=>{ye(`id`,e.target.value),v&&_(t=>({...t,id:e.target.value?void 0:`Job ID is required.`}))},placeholder:`my-job-id`}),v&&g.id&&(0,B.jsx)(`div`,{className:J.a281f9e,children:g.id}),(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Name`}),(0,B.jsx)(`input`,{style:h,value:o.name,onChange:e=>ye(`name`,e.target.value),placeholder:`My Job`}),(0,B.jsx)(`label`,{className:G.formFieldLabel,children:`Description`}),(0,B.jsx)(`textarea`,{style:{...h,resize:`vertical`,minHeight:60},rows:3,value:o.description,onChange:e=>ye(`description`,e.target.value),placeholder:`What does this job do?`}),(0,B.jsx)(i_,{flowMode:c,onChange:e=>{l(e),f({}),m(!1),e===`seam-v1`&&s(e=>({...e,engineOverrides:void 0}))}}),(0,B.jsx)(Jg,{visible:u,form:o,setForm:s,seamErrors:d,setSeamErrors:f,seamSaveTouched:p,employees:S,uniqueEmployees:T}),(0,B.jsx)(`label`,{className:J.a333d40,children:`Cron Schedule`}),(0,B.jsx)(sg,{schedule:o.schedule,scheduleHuman:o.scheduleHuman,onChange:(e,t)=>{s(n=>({...n,schedule:e,scheduleHuman:t})),v&&_(t=>({...t,schedule:e?void 0:`Schedule is required.`}))}}),v&&g.schedule&&(0,B.jsx)(`div`,{className:J.a281f9e,children:g.schedule}),!u&&(0,B.jsx)(m_,{form:o,setField:ye,setEngineOverride:be,coreErrors:g,setCoreErrors:_,coreSaveTouched:v,uniqueEmployees:T}),(0,B.jsx)(y_,{form:o,setField:ye,timeoutRec:se}),!u&&(0,B.jsx)(o_,{form:o,setForm:s,allJobs:b}),(0,B.jsx)(Qg,{form:o,setForm:s,allJobs:b}),(0,B.jsx)(Zg,{form:o,setForm:s}),(0,B.jsxs)(hg,{title:`Environment & retry`,hint:u?`Retry, env vars`:`Retry, env vars, remote execution`,children:[(0,B.jsxs)(`div`,{className:G.spacerMd,children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`label`,{className:G.blockLabelCompact,children:`Retry on failure`}),e?.lastStatus===`retrying`&&(0,B.jsxs)(`span`,{style:{fontSize:11,fontWeight:600,padding:`2px 7px`,borderRadius:4,background:`rgba(210,153,34,0.15)`,color:`var(--color-warning)`,border:`1px solid rgba(210,153,34,0.35)`},children:[`retry `,e.retryAttempts??0,`/`,e.retryCount??1,` pending`]})]}),(0,B.jsxs)(`div`,{className:J.abf8a20,children:[(0,B.jsxs)(`div`,{className:G.flexOne,children:[(0,B.jsx)(`label`,{className:G.microLabel,children:`Max retries`}),(0,B.jsxs)(ee,{value:o.retryCount??0,onChange:e=>ye(`retryCount`,parseInt(e.target.value)),children:[(0,B.jsx)(`option`,{value:0,children:`0 (disabled)`}),(0,B.jsx)(`option`,{value:1,children:`1`}),(0,B.jsx)(`option`,{value:2,children:`2`}),(0,B.jsx)(`option`,{value:3,children:`3`})]})]}),(o.retryCount??0)>0&&(0,B.jsxs)(`div`,{className:G.flexOne,children:[(0,B.jsx)(`label`,{className:G.microLabel,children:`Retry delay`}),(0,B.jsxs)(ee,{value:o.retryDelay??900,onChange:e=>ye(`retryDelay`,parseInt(e.target.value)),children:[(0,B.jsx)(`option`,{value:60,children:`1 minute`}),(0,B.jsx)(`option`,{value:120,children:`2 minutes`}),(0,B.jsx)(`option`,{value:300,children:`5 minutes`}),(0,B.jsx)(`option`,{value:600,children:`10 minutes`}),(0,B.jsx)(`option`,{value:900,children:`15 minutes`}),(0,B.jsx)(`option`,{value:1800,children:`30 minutes`}),(0,B.jsx)(`option`,{value:3600,children:`1 hour`})]})]})]})]}),(0,B.jsx)($g,{envRows:E,setEnvRows:D}),!u&&(0,B.jsx)(e_,{remoteEnabled:A,setRemoteEnabled:j,remoteHost:M,setRemoteHost:N,remoteWorkdir:P,setRemoteWorkdir:F,sshTestState:te,setSshTestState:I,sshTestError:ne,setSshTestError:re,onTestSsh:Ce})]}),(0,B.jsx)(Xg,{job:e,form:o,setForm:s})]})]})})}var w_=10,T_=w_*21;function E_(e){return e.replace(/\x1B\[[0-9;]*[mGKHF]/g,``).replace(/\x1B\][^\x07]*\x07/g,``)}function D_(e){return/^#{1,3}\s/m.test(e)||/\*\*[^*]+\*\*/.test(e)||/^```/m.test(e)||/^\s*[-*]\s+\S/m.test(e)}function O_({jobId:e,lastRun:t,fetchResult:n,onArtifactsLoaded:r,onActionItemsLoaded:i}){let[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(!0),[l,u]=(0,L.useState)(!1),d=(0,L.useRef)(null),f=(0,L.useRef)(n);f.current=n;let p=(0,L.useRef)(r);p.current=r;let m=(0,L.useRef)(i);if(m.current=i,(0,L.useEffect)(()=>{let n=e+(t??``);if(d.current===n)return;d.current=n;let r=!1;return c(!0),f.current(e).then(e=>{r||(o(e),c(!1),p.current?.(e?.artifacts??[]),m.current?.(e?.actionItems??[]))}),()=>{r=!0,d.current=null}},[e,t]),s)return(0,B.jsx)(`div`,{style:{color:`var(--color-text-muted)`,fontSize:13,padding:`12px 0`},children:`Loading result...`});if(!a)return(0,B.jsx)(`div`,{style:{color:`var(--color-text-muted)`,fontSize:13,padding:`12px 0`},children:`No results yet.`});let h=E_(a.content),_=D_(h),v=h.split(`
|
|
79
|
-
`),y=v.length>w_;return(0,B.jsxs)(`div`,{style:{marginBottom:16,animation:`fadeIn 0.3s ease-out`},children:[(0,B.jsxs)(`div`,{style:{color:`var(--color-text-muted)`,fontSize:12,marginBottom:6},children:[`Latest result — `,Be(a.timestamp)]}),(0,B.jsxs)(`div`,{style:{background:`var(--color-bg)`,border:`1px solid #30363d`,borderRadius:8,padding:`12px 16px`,overflow:`hidden`},children:[(0,B.jsx)(`div`,{style:{maxHeight:l||!y?void 0:T_,overflow:`hidden`,transition:`max-height 0.25s ease`},children:_?(0,B.jsx)(Ks,{components:{p:({children:e})=>(0,B.jsx)(`p`,{style:{color:C.textSecondary,fontSize:13,lineHeight:1.6,margin:`6px 0`},children:e}),h1:({children:e})=>(0,B.jsx)(`h1`,{style:{color:C.text,fontSize:16,fontWeight:600,margin:`12px 0 6px`,lineHeight:1.3},children:e}),h2:({children:e})=>(0,B.jsx)(`h2`,{style:{color:C.text,fontSize:14,fontWeight:600,margin:`10px 0 5px`,lineHeight:1.3},children:e}),h3:({children:e})=>(0,B.jsx)(`h3`,{style:{color:C.text,fontSize:13,fontWeight:600,margin:`8px 0 4px`,lineHeight:1.3},children:e}),a:({href:e,children:t})=>(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,style:{color:`var(--color-info)`,textDecoration:`none`},children:t}),code:({children:e,className:t})=>t?.startsWith(`language-`)?(0,B.jsx)(`code`,{style:{display:`block`,fontFamily:g,fontSize:12,color:C.textSecondary,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e}):(0,B.jsx)(`code`,{style:{background:`rgba(110,118,129,0.4)`,padding:`2px 6px`,borderRadius:3,fontSize:12,fontFamily:g,color:C.textSecondary},children:e}),pre:({children:e})=>(0,B.jsx)(`pre`,{style:{background:`var(--color-bg-raised)`,border:`1px solid #30363d`,borderRadius:6,padding:12,fontSize:12,overflow:`auto`,margin:`8px 0`,fontFamily:g},children:e}),ul:({children:e})=>(0,B.jsx)(`ul`,{style:{color:C.textSecondary,fontSize:13,lineHeight:1.6,margin:`6px 0`,paddingLeft:20},children:e}),ol:({children:e})=>(0,B.jsx)(`ol`,{style:{color:C.textSecondary,fontSize:13,lineHeight:1.6,margin:`6px 0`,paddingLeft:20},children:e}),li:({children:e})=>(0,B.jsx)(`li`,{style:{marginBottom:3},children:e}),table:({children:e})=>(0,B.jsx)(`div`,{style:{overflowX:`auto`,margin:`8px 0`},children:(0,B.jsx)(`table`,{style:{borderCollapse:`collapse`,width:`100%`,fontSize:13,color:C.textSecondary},children:e})}),th:({children:e})=>(0,B.jsx)(`th`,{style:{border:`1px solid #30363d`,padding:`6px 10px`,background:`var(--color-bg-raised)`,color:C.text,fontWeight:600,textAlign:`left`},children:e}),td:({children:e})=>(0,B.jsx)(`td`,{style:{border:`1px solid #30363d`,padding:`6px 10px`},children:e}),blockquote:({children:e})=>(0,B.jsx)(`blockquote`,{style:{borderLeft:`3px solid #30363d`,margin:`8px 0`,paddingLeft:12,color:`var(--color-text-muted)`,fontSize:13},children:e}),hr:()=>(0,B.jsx)(`hr`,{style:{border:`none`,borderTop:`1px solid #30363d`,margin:`12px 0`}}),strong:({children:e})=>(0,B.jsx)(`strong`,{style:{color:C.text,fontWeight:600},children:e}),em:({children:e})=>(0,B.jsx)(`em`,{style:{color:C.textSecondary},children:e})},children:h}):(0,B.jsx)(`pre`,{style:{fontFamily:g,fontSize:12,color:C.textSecondary,whiteSpace:`pre-wrap`,wordBreak:`break-word`,margin:0,lineHeight:1.5},children:h})}),y&&(0,B.jsx)(`div`,{onClick:()=>u(e=>!e),style:{color:`var(--color-info)`,fontSize:12,cursor:`pointer`,marginTop:8,userSelect:`none`},children:l?`Show less`:`Show more (${v.length-w_} more lines)`})]})]})}var k_={github:`🔗`,notion:`📄`,slack:`💬`,linear:`🎫`,other:`🌐`},A_={github:`var(--color-info)`,notion:C.text,slack:C.warning,linear:`#bc8cff`,other:`var(--color-text-muted)`};function j_({artifact:e}){let[t,n]=(0,L.useState)(!1),r=A_[e.type];return(0,B.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:`3px 10px`,borderRadius:12,background:t?`rgba(255,255,255,0.05)`:`transparent`,border:`1px solid ${r}`,fontSize:12,color:C.textSecondary,textDecoration:`none`,transition:`all 0.15s`},children:[(0,B.jsx)(`span`,{children:k_[e.type]}),(0,B.jsx)(`span`,{children:e.label})]})}function M_({artifacts:e}){return e.length===0?null:(0,B.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,marginBottom:16},children:e.map((e,t)=>(0,B.jsx)(j_,{artifact:e},`${e.url}-${t}`))})}function N_({items:e}){let[t,n]=(0,L.useState)(()=>new Set),[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(null),s=(0,L.useCallback)(e=>{n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),c=(0,L.useCallback)((e,t)=>{navigator.clipboard.writeText(e),o(t),setTimeout(()=>o(null),1500)},[]);if(e.length===0)return null;let l=e.map((e,t)=>({item:e,i:t})).filter(({i:e})=>!t.has(e)),u=e.map((e,t)=>({item:e,i:t})).filter(({i:e})=>t.has(e));return(0,B.jsxs)(`div`,{style:{marginBottom:16},children:[(0,B.jsxs)(`div`,{style:{fontSize:11,color:`var(--color-text-muted)`,textTransform:`uppercase`,letterSpacing:.5,marginBottom:6},children:[`Action Items`,l.length>0&&` (${l.length})`]}),l.length===0&&(0,B.jsx)(`div`,{style:{fontSize:13,color:`var(--color-positive)`,padding:`4px 0`},children:`All done!`}),l.map(({item:e,i:t})=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,padding:`5px 0`,transition:`all 0.2s ease`},children:[(0,B.jsx)(`button`,{onClick:()=>s(t),style:{width:18,height:18,borderRadius:4,flexShrink:0,marginTop:1,border:`1px solid #30363d`,background:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--color-text-muted)`,fontSize:10},title:`Mark done`}),(0,B.jsx)(`span`,{style:{fontSize:13,color:C.textSecondary,flex:1},children:e}),(0,B.jsx)(`button`,{className:`btn btn-sm`,style:{fontSize:11,flexShrink:0},onClick:()=>c(e,t),children:a===t?`✓`:`Copy`})]},t)),u.length>0&&(0,B.jsxs)(`div`,{style:{marginTop:8},children:[(0,B.jsxs)(`div`,{onClick:()=>i(e=>!e),style:{fontSize:12,color:`var(--color-text-muted)`,cursor:`pointer`,userSelect:`none`,display:`flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(`span`,{style:{fontSize:10},children:r?`▼`:`▶`}),u.length,` completed`]}),r&&u.map(({item:e,i:t})=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,padding:`4px 0`,opacity:.5,transition:`all 0.2s ease`},children:[(0,B.jsx)(`button`,{onClick:()=>s(t),style:{width:18,height:18,borderRadius:4,flexShrink:0,marginTop:1,border:`1px solid #3fb950`,background:`var(--color-positive-soft)`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`var(--color-positive)`,fontSize:11},title:`Mark undone`,children:`✓`}),(0,B.jsx)(`span`,{style:{fontSize:13,color:`var(--color-text-muted)`,flex:1,textDecoration:`line-through`},children:e})]},t))]})]})}var P_={card:`_card_c2sv6_4`,failureCardIn:`_failureCardIn_c2sv6_1`,kindRed:`_kindRed_c2sv6_14`,kindAmber:`_kindAmber_c2sv6_18`,header:`_header_c2sv6_22`,kindChip:`_kindChip_c2sv6_29`,kindChipRed:`_kindChipRed_c2sv6_39`,kindChipAmber:`_kindChipAmber_c2sv6_44`,metaInline:`_metaInline_c2sv6_49`,message:`_message_c2sv6_55`,tailToggle:`_tailToggle_c2sv6_64`,tail:`_tail_c2sv6_64`,tailIn:`_tailIn_c2sv6_1`,footerMeta:`_footerMeta_c2sv6_97`},F_=new Set([`timeout`]);function I_({reason:e,defaultTailOpen:t=!1}){let[n,r]=(0,L.useState)(t),i=F_.has(e.kind),a=`${P_.card} ${i?P_.kindAmber:P_.kindRed}`,o=`${P_.kindChip} ${i?P_.kindChipAmber:P_.kindChipRed}`,s=e.lastLogTail&&e.lastLogTail.trim().length>0&&e.lastLogTail.trim()!==e.message.trim();return(0,B.jsxs)(`div`,{className:a,role:`group`,"aria-label":`Failure: ${e.kind}`,children:[(0,B.jsxs)(`div`,{className:P_.header,children:[(0,B.jsx)(`span`,{className:o,children:e.kind}),(0,B.jsx)(`span`,{className:P_.metaInline,children:L_(e.occurredAt)})]}),(0,B.jsx)(`div`,{className:P_.message,children:e.message}),s&&(0,B.jsx)(F,{variant:`ghost`,size:`sm`,className:P_.tailToggle,onClick:()=>r(e=>!e),"aria-expanded":n,children:n?`Hide log tail`:`Show log tail`}),n&&s&&(0,B.jsx)(`pre`,{className:P_.tail,children:e.lastLogTail}),(0,B.jsxs)(`div`,{className:P_.footerMeta,children:[e.exitCode!==null&&(0,B.jsxs)(`span`,{children:[`exit `,(0,B.jsx)(`code`,{children:e.exitCode})]}),e.signal!==null&&(0,B.jsxs)(`span`,{children:[`signal `,(0,B.jsx)(`code`,{children:e.signal})]}),e.runId&&(0,B.jsxs)(`span`,{children:[`run `,(0,B.jsx)(`code`,{children:e.runId})]})]})]})}function L_(e){try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return e}}var X={root:`_root_129l9_5`,empty:`_empty_129l9_18`,truncatedNotice:`_truncatedNotice_129l9_24`,row:`_row_129l9_36`,role:`_role_129l9_49`,roleUser:`_roleUser_129l9_62`,roleAssistant:`_roleAssistant_129l9_67`,roleThinking:`_roleThinking_129l9_72`,roleTool:`_roleTool_129l9_78`,roleResult:`_roleResult_129l9_83`,roleError:`_roleError_129l9_88`,roleMeta:`_roleMeta_129l9_93`,content:`_content_129l9_98`,text:`_text_129l9_102`,toolName:`_toolName_129l9_110`,toggle:`_toggle_129l9_117`,toggleHidden:`_toggleHidden_129l9_139`,toggleArrow:`_toggleArrow_129l9_145`,toggleArrowOpen:`_toggleArrowOpen_129l9_153`,details:`_details_129l9_157`,detailsError:`_detailsError_129l9_171`,muted:`_muted_129l9_175`,metaSubkind:`_metaSubkind_129l9_179`,link:`_link_129l9_184`,sidechainTag:`_sidechainTag_129l9_188`},R_=200;function z_(e){if(e==null)return``;if(typeof e==`string`)return e.length>80?e.slice(0,77)+`...`:e;try{let t=JSON.stringify(e);return t.length>80?t.slice(0,77)+`...`:t}catch{return``}}function B_(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function V_({event:e}){let[t,n]=(0,L.useState)(!1),r=(0,L.useCallback)(()=>n(e=>!e),[]),i=e.sidechain?(0,B.jsx)(`span`,{className:X.sidechainTag,children:`sidechain`}):null;if(e.kind===`user-text`)return(0,B.jsxs)(`div`,{className:X.row,children:[(0,B.jsx)(`span`,{className:`${X.role} ${X.roleUser}`,children:`user`}),(0,B.jsx)(`div`,{className:X.content,children:(0,B.jsxs)(`div`,{className:X.text,children:[e.text,i]})})]});if(e.kind===`assistant-text`)return(0,B.jsxs)(`div`,{className:X.row,children:[(0,B.jsx)(`span`,{className:`${X.role} ${X.roleAssistant}`,children:`assistant`}),(0,B.jsx)(`div`,{className:X.content,children:(0,B.jsxs)(`div`,{className:X.text,children:[e.text,i]})})]});if(e.kind===`assistant-thinking`)return(0,B.jsxs)(`div`,{className:X.row,children:[(0,B.jsx)(`span`,{className:`${X.role} ${X.roleThinking}`,children:`thinking`}),(0,B.jsxs)(`div`,{className:X.content,children:[(0,B.jsxs)(F,{variant:`ghost`,size:`sm`,className:X.toggle,onClick:r,"aria-expanded":t,children:[(0,B.jsx)(`span`,{className:`${X.toggleArrow} ${t?X.toggleArrowOpen:``}`,children:`▶`}),(0,B.jsxs)(`span`,{children:[t?`Hide thinking`:`Show thinking`,i]})]}),t&&(0,B.jsx)(`div`,{className:X.details,children:e.text})]})]});if(e.kind===`assistant-tool-use`)return(0,B.jsxs)(`div`,{className:X.row,children:[(0,B.jsx)(`span`,{className:`${X.role} ${X.roleTool}`,children:`tool`}),(0,B.jsxs)(`div`,{className:X.content,children:[(0,B.jsxs)(F,{variant:`ghost`,size:`sm`,className:X.toggle,onClick:r,"aria-expanded":t,children:[(0,B.jsx)(`span`,{className:`${X.toggleArrow} ${t?X.toggleArrowOpen:``}`,children:`▶`}),(0,B.jsx)(`span`,{className:X.toolName,children:e.name}),(0,B.jsx)(`span`,{className:X.muted,children:z_(e.input)}),i]}),t&&(0,B.jsx)(`div`,{className:X.details,children:B_(e.input)})]})]});if(e.kind===`user-tool-result`){let n=e.isError?X.roleError:X.roleResult,a=e.isError?`error`:`result`,o=e.isError?`${X.details} ${X.detailsError}`:X.details,s=e.content.split(`
|
|
80
|
-
`)[0]?.slice(0,80)??``;return(0,B.jsxs)(`div`,{className:X.row,children:[(0,B.jsx)(`span`,{className:`${X.role} ${n}`,children:a}),(0,B.jsxs)(`div`,{className:X.content,children:[(0,B.jsxs)(F,{variant:`ghost`,size:`sm`,className:X.toggle,onClick:r,"aria-expanded":t,children:[(0,B.jsx)(`span`,{className:`${X.toggleArrow} ${t?X.toggleArrowOpen:``}`,children:`▶`}),(0,B.jsx)(`span`,{className:X.muted,children:s||`(empty)`}),i]}),t&&(0,B.jsx)(`div`,{className:o,children:e.content})]})]})}return(0,B.jsxs)(`div`,{className:X.row,children:[(0,B.jsx)(`span`,{className:`${X.role} ${X.roleMeta}`,children:`meta`}),(0,B.jsxs)(`div`,{className:X.content,children:[(0,B.jsx)(`span`,{className:X.metaSubkind,children:e.subkind}),i]})]})}function H_({trace:e,initialRenderLimit:t=R_}){let[n,r]=(0,L.useState)(t),i=e.events,a=(0,L.useMemo)(()=>i.length>n?i.slice(i.length-n):i,[i,n]),o=i.length-a.length;return i.length===0?(0,B.jsx)(`div`,{className:X.empty,children:`Transcript is empty.`}):(0,B.jsxs)(`div`,{className:X.root,children:[e.truncated&&(0,B.jsxs)(`div`,{className:X.truncatedNotice,children:[`Showing the most recent `,e.events.length,` of `,e.totalEvents,` events`,` `,`(`,(e.byteSize/1024).toFixed(1),` KB).`,` `,(0,B.jsx)(`a`,{href:`/api/jobs/${e.jobId}/runs/${e.runId}/trace?format=raw`,target:`_blank`,rel:`noreferrer`,className:X.link,children:`Download raw JSONL`}),`.`]}),o>0&&(0,B.jsxs)(F,{variant:`ghost`,size:`sm`,className:`${X.toggle} ${X.toggleHidden}`,onClick:()=>r(e=>e+t),children:[`Show `,Math.min(o,t),` earlier events`,` `,`(`,o,` hidden)`]}),a.map(e=>(0,B.jsx)(V_,{event:e},e.uuid))]})}function U_(e){if(e<=0)return`0s`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?n>0?`${t}h ${String(n).padStart(2,`0`)}m`:`${t}h`:n>0?r>0?`${n}m ${r}s`:`${n}m`:`${r}s`}function W_(e){let t=e.filter(e=>typeof e.durationSeconds==`number`&&e.durationSeconds>0);return t.length===0?0:t.reduce((e,t)=>e+t.durationSeconds,0)/t.length}function G_(e){if(e.length<2)return!1;let t=e[e.length-1];if(!t||typeof t.durationSeconds!=`number`||t.durationSeconds<=0)return!1;let n=W_(e.slice(0,-1));return n<=0?!1:t.durationSeconds>n*2}var K_={wrapper:`_wrapper_g96g1_9`,summaryLine:`_summaryLine_g96g1_17`,summaryValue:`_summaryValue_g96g1_28`,summarySep:`_summarySep_g96g1_33`,anomalyChip:`_anomalyChip_g96g1_37`,row:`_row_g96g1_49`,fadeInUp:`_fadeInUp_g96g1_1`,rowDivider:`_rowDivider_g96g1_57`,rowClickable:`_rowClickable_g96g1_61`,timestamp:`_timestamp_g96g1_70`,duration:`_duration_g96g1_76`,viewButton:`_viewButton_g96g1_82`,preview:`_preview_g96g1_87`,previewIn:`_previewIn_g96g1_1`,previewAmber:`_previewAmber_g96g1_99`,expanded:`_expanded_g96g1_103`,fadeIn:`_fadeIn_g96g1_1`,expandedDivider:`_expandedDivider_g96g1_108`,resultPre:`_resultPre_g96g1_112`,empty:`_empty_g96g1_127`,traceOnlyChip:`_traceOnlyChip_g96g1_137`,tabStrip:`_tabStrip_g96g1_148`,tabButton:`_tabButton_g96g1_158`,tabButtonActive:`_tabButtonActive_g96g1_167`};function q_(e){return e.resultFile?e.resultFile.replace(/\.result$/,``):e.traceRunId?e.traceRunId:null}var J_=new Set([`failed`,`timeout`,`error`,`degraded`]),Y_=new Set([`degraded`,`timeout`]);function X_({jobId:e,fetchHistory:t,fetchResult:n,latestFailureReason:r,fetchTrace:i}){let[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)(!0),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(`summary`),x=(0,L.useRef)(0);(0,L.useEffect)(()=>{let n=!1;async function r(){try{let r=await t(e);n||o(r.slice(0,20))}catch{}finally{n||c(!1)}}return r(),()=>{n=!0}},[e,t]);let S=(0,L.useCallback)(e=>{if(e.failureReason)return e.failureReason;if(r&&e.timestamp===r.occurredAt)return r},[r]),C=(0,L.useCallback)(async(t,r)=>{if(l===r){u(null),f(null),m(null);return}let a=++x.current;u(r),f(null),m(null),b(t.resultFile?`summary`:`transcript`);let o=q_(t);if(t.resultFile){g(!0);try{let r=await n(e,t.resultFile);if(x.current!==a)return;f(r?.content??`No result content available.`)}catch{if(x.current!==a)return;f(`Failed to load result.`)}finally{x.current===a&&g(!1)}}if(t.traceAvailable&&i&&o){v(!0);try{let t=await i(e,o);if(x.current!==a)return;m(t)}catch{if(x.current!==a)return;m(null)}finally{x.current===a&&v(!1)}}},[e,n,i,l]),w=(0,L.useMemo)(()=>({avgDuration:W_(a),lastDuration:a[a.length-1]?.durationSeconds??0,anomaly:G_(a)}),[a]);return s?(0,B.jsx)(`div`,{className:K_.empty,children:`Loading history...`}):a.length===0?(0,B.jsx)(`div`,{className:K_.empty,children:`No run history yet.`}):(0,B.jsxs)(`div`,{className:K_.wrapper,children:[w.avgDuration>0&&(0,B.jsxs)(`div`,{className:K_.summaryLine,children:[(0,B.jsxs)(`span`,{children:[`Avg:`,` `,(0,B.jsx)(`span`,{className:K_.summaryValue,children:U_(w.avgDuration)})]}),w.lastDuration>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:K_.summarySep,children:`|`}),(0,B.jsxs)(`span`,{children:[`Last:`,` `,(0,B.jsx)(`span`,{className:K_.summaryValue,children:U_(w.lastDuration)})]})]}),w.anomaly&&(0,B.jsx)(`span`,{className:K_.anomalyChip,children:`⚠ Anomaly`})]}),a.map((e,t)=>{let n=e.resultFile||`${e.timestamp}-${t}`,r=l===n,o=e.status&&J_.has(e.status)?S(e):void 0,s=!!(e.traceAvailable&&i),c=!!e.resultFile&&s,u=!!(o||e.resultFile||s),f=t<a.length-1&&!r,m=e.status&&Y_.has(e.status)?`${K_.preview} ${K_.previewAmber}`:K_.preview;return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:[K_.row,f?K_.rowDivider:``,u?K_.rowClickable:``].filter(Boolean).join(` `),style:{animationDelay:`${t*.04}s`},onClick:u?()=>C(e,n):void 0,role:u?`button`:void 0,tabIndex:u?0:void 0,onKeyDown:u?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),C(e,n))}:void 0,children:[(0,B.jsx)(`span`,{className:K_.timestamp,children:Be(e.timestamp)}),(0,B.jsx)(uc,{status:e.status}),(0,B.jsx)(`span`,{className:K_.duration,children:ze(e.durationSeconds)}),!e.resultFile&&e.traceAvailable&&(0,B.jsx)(`span`,{className:K_.traceOnlyChip,title:`No result file was written; the JSONL transcript is the only record of this run.`,children:`trace only`}),u&&(0,B.jsx)(F,{variant:`ghost`,size:`sm`,className:K_.viewButton,onClick:t=>{t.stopPropagation(),C(e,n)},children:r?`Hide`:`View`})]}),o&&!r&&(0,B.jsx)(`div`,{className:m,title:o.message,children:Ve(o.message,220)}),r&&(0,B.jsxs)(`div`,{className:`${K_.expanded} ${t<a.length-1?K_.expandedDivider:``}`,children:[o&&(0,B.jsx)(I_,{reason:o}),c&&(0,B.jsx)(`div`,{role:`tablist`,"aria-label":`Run view`,className:K_.tabStrip,children:[`summary`,`transcript`].map(e=>{let t=y===e;return(0,B.jsx)(F,{variant:`ghost`,size:`sm`,role:`tab`,"aria-selected":t,onClick:()=>b(e),className:`${K_.tabButton} ${t?K_.tabButtonActive:``}`,children:e},e)})}),(!c||y===`summary`)&&e.resultFile&&(h?(0,B.jsx)(`div`,{className:K_.duration,children:`Loading...`}):(0,B.jsx)(`pre`,{className:K_.resultPre,children:d})),(c?y===`transcript`:!e.resultFile)&&s&&(_?(0,B.jsx)(`div`,{className:K_.duration,children:`Loading transcript...`}):p?(0,B.jsx)(H_,{trace:p}):(0,B.jsx)(`div`,{className:K_.duration,children:`Trace failed to load.`}))]})]},n)})]})}function Z_({text:e,label:t}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.5,marginBottom:4},children:t}),(0,B.jsx)(`pre`,{style:{background:`var(--color-bg-raised)`,border:`1px solid #30363d`,borderRadius:6,padding:12,fontSize:12,fontFamily:g,overflow:`auto`,maxHeight:200,margin:0,color:C.textSecondary,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e})]})}function Q_({entry:e,index:t}){let[n,r]=(0,L.useState)(!1),i=(()=>{try{return Be(e.timestamp)}catch{return Re(e.timestamp)}})();return(0,B.jsxs)(`div`,{style:{background:`var(--color-subtle-bg)`,border:`1px solid #30363d`,borderRadius:8,padding:12,marginBottom:t===0?0:8},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:8,marginBottom:6},children:[(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,flexShrink:0},children:i}),(0,B.jsx)(`button`,{onClick:()=>r(e=>!e),style:{background:`none`,border:`none`,color:C.muted,fontSize:11,cursor:`pointer`,padding:0,flexShrink:0},children:n?`Hide previous`:`Show previous`})]}),e.reason&&(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary,lineHeight:1.5,marginBottom:n?10:0},children:e.reason}),n&&(0,B.jsx)(Z_,{text:e.previousPrompt,label:`Previous prompt`})]})}function $_({entries:e,currentPrompt:t}){let[n,r]=(0,L.useState)(!1);return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`button`,{onClick:()=>r(e=>!e),style:{background:`none`,border:`none`,cursor:`pointer`,padding:0,display:`flex`,alignItems:`center`,gap:8,width:`100%`,textAlign:`left`},children:[(0,B.jsx)(`span`,{style:{...k,fontWeight:600},children:`Prompt Evolution`}),(0,B.jsx)(`span`,{style:{fontSize:10,fontWeight:600,color:C.textSecondary,background:C.hover,border:`1px solid #30363d`,borderRadius:10,padding:`1px 7px`},children:e.length}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,marginLeft:`auto`,transition:`transform 0.2s ease`,display:`inline-block`,transform:n?`rotate(180deg)`:`rotate(0deg)`},children:`▼`})]}),n&&(0,B.jsxs)(`div`,{style:{marginTop:10},children:[(0,B.jsx)(`div`,{style:{marginBottom:12},children:(0,B.jsx)(Z_,{text:t,label:`Current version`})}),e.length===0?(0,B.jsx)(`div`,{style:{fontSize:13,color:C.muted,fontStyle:`italic`},children:`No changes recorded yet.`}):(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:6},children:`Change history`}),[...e].reverse().map((e,t)=>(0,B.jsx)(Q_,{entry:e,index:t},`${e.timestamp}-${t}`))]})]})]})}function ev({runs:e}){let[t,n]=(0,L.useState)(null),r=(0,L.useId)(),i=(0,L.useId)(),a=e.filter(e=>e.durationSeconds>0);if(a.length<2)return null;let o={top:4,bottom:4,left:0,right:0},s=360-o.left-o.right,c=64-o.top-o.bottom,l=a.map(e=>e.durationSeconds),u=Math.min(...l),d=Math.max(...l)-u||1,f=s/(a.length-1),p=a.map((e,t)=>({x:o.left+t*f,y:o.top+c-(e.durationSeconds-u)/d*c,run:e,index:t})),m=p.map(e=>`${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `),h=`${p[0].x.toFixed(1)},64 `+m+` ${p[p.length-1].x.toFixed(1)},64`,g=t===null?null:p[t];return(0,B.jsxs)(`div`,{style:{position:`relative`},children:[(0,B.jsxs)(`svg`,{width:360,height:64,style:{display:`block`,overflow:`visible`},children:[(0,B.jsxs)(`defs`,{children:[(0,B.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,B.jsx)(`stop`,{offset:`0%`,stopColor:`var(--color-primary)`,stopOpacity:.25}),(0,B.jsx)(`stop`,{offset:`100%`,stopColor:`var(--color-primary)`,stopOpacity:.02})]}),(0,B.jsx)(`clipPath`,{id:i,children:(0,B.jsx)(`rect`,{x:0,y:0,width:360,height:64})})]}),(0,B.jsx)(`polygon`,{points:h,fill:`url(#${r})`,clipPath:`url(#${i})`}),(0,B.jsx)(`polyline`,{points:m,fill:`none`,stroke:`var(--color-primary)`,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`,clipPath:`url(#${i})`,opacity:.8}),p.map((e,r)=>{let i=e.run.status===`success`,a=e.run.status===`failed`||e.run.status===`timeout`,o=i?C.green:a?C.red:C.muted,s=t===r;return(0,B.jsx)(`circle`,{cx:e.x,cy:e.y,r:s?4:2.5,fill:o,opacity:s?1:.7,style:{transition:`r 0.15s ease, opacity 0.15s ease`},onMouseEnter:()=>n(r),onMouseLeave:()=>n(null)},r)})]}),g&&(0,B.jsxs)(`div`,{style:{position:`absolute`,bottom:70,left:Math.min(Math.max(g.x,50),310),transform:`translateX(-50%)`,background:C.hover,border:`1px solid ${C.border}`,borderRadius:6,padding:`4px 8px`,fontSize:11,color:C.textSecondary,whiteSpace:`nowrap`,pointerEvents:`none`,zIndex:10,display:`flex`,gap:8,alignItems:`center`},children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:ze(g.run.durationSeconds)}),(0,B.jsx)(`span`,{style:{color:g.run.status===`success`?C.green:g.run.status===`failed`||g.run.status===`timeout`?C.red:C.muted,fontSize:10},children:g.run.status})]})]})}function tv({trend:e}){let[t,n]=(0,L.useState)(null);if(e.filter(e=>e.runs>0).length===0)return null;let r=Math.max(...e.map(e=>e.runs),1);return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:6},children:`Daily Runs (14d)`}),(0,B.jsx)(`div`,{style:{display:`flex`,gap:2,alignItems:`end`,height:32},children:e.map((e,i)=>{let a=e.runs>0?Math.max(4,e.runs/r*28):2,o=e.runs>0?e.successes/e.runs:1;return(0,B.jsx)(`div`,{onMouseEnter:()=>n(i),onMouseLeave:()=>n(null),style:{flex:1,height:a,background:e.runs===0?`var(--color-hover)`:o>=.8?C.green:o>=.5?C.warning:C.red,borderRadius:2,opacity:t===i?1:.7,transition:`opacity 0.15s ease`,cursor:`default`,position:`relative`},title:`${e.label}: ${e.runs} run${e.runs===1?``:`s`}, ${e.successes} ok${e.avgDuration>0?`, avg ${ze(e.avgDuration)}`:``}`},e.date)})}),(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:10,color:C.muted,marginTop:3},children:[(0,B.jsx)(`span`,{children:e[0]?.label}),(0,B.jsx)(`span`,{children:`Today`})]})]})}function nv({rate:e,successes:t,failures:n}){let r=Math.round(e*100),i=e>=.9?C.green:e>=.7?C.warning:C.red;return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:4},children:[(0,B.jsxs)(`span`,{style:{fontSize:20,fontWeight:600,fontVariantNumeric:`tabular-nums`,color:i},children:[r,`%`]}),(0,B.jsxs)(`span`,{style:{fontSize:11,color:C.muted},children:[t,` ok / `,n,` failed`]})]}),(0,B.jsx)(`div`,{style:{height:6,background:C.hover,borderRadius:3,overflow:`hidden`},children:(0,B.jsx)(`div`,{style:{height:`100%`,width:`${r}%`,background:i,borderRadius:3,transition:`width 0.5s ease`}})})]})}function rv({jobId:e}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(!0);return(0,L.useEffect)(()=>{let t=!1;return fetch(`/api/jobs/${e}/stats`).then(e=>e.ok?e.json():null).then(e=>{t||n(e)}).catch(()=>{}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),r?(0,B.jsx)(`div`,{style:{padding:`8px 0`,color:C.muted,fontSize:12},children:`Loading performance data...`}):!t||t.totalRuns<2?null:(0,B.jsxs)(`div`,{style:{background:`var(--color-bg)`,border:`1px solid ${C.border}`,borderRadius:10,padding:16,marginBottom:16},children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:12},children:`Performance`}),(0,B.jsx)(nv,{rate:t.successRate,successes:t.successes,failures:t.failures}),(0,B.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:12,margin:`14px 0`,padding:`10px 0`,borderTop:`1px solid ${C.border}`,borderBottom:`1px solid ${C.border}`},children:[(0,B.jsx)(iv,{label:`Total Runs`,value:String(t.totalRuns)}),(0,B.jsx)(iv,{label:`Avg Duration`,value:ze(t.avgDuration)}),(0,B.jsx)(iv,{label:`Median`,value:ze(t.medianDuration)}),(0,B.jsx)(iv,{label:`Agent Time`,value:ze(t.totalAgentTime)})]}),t.minDuration>0&&t.maxDuration>0&&(0,B.jsxs)(`div`,{style:{marginBottom:14},children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:4},children:`Duration Range`}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:11},children:[(0,B.jsx)(`span`,{style:{color:C.muted,fontFamily:`var(--font-mono)`,minWidth:36,textAlign:`right`},children:ze(t.minDuration)}),(0,B.jsx)(`div`,{style:{flex:1,height:6,background:C.hover,borderRadius:3,position:`relative`,overflow:`hidden`},children:t.p75Duration>0&&(()=>{let e=t.maxDuration-t.minDuration||1,n=(t.medianDuration-t.minDuration)/e*100,r=(t.p75Duration-t.minDuration)/e*100;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{style:{position:`absolute`,left:`${Math.max(0,n-8)}%`,width:`${Math.min(100,r-n+16)}%`,height:`100%`,background:`var(--color-primary)40`,borderRadius:3}}),(0,B.jsx)(`div`,{style:{position:`absolute`,left:`${n}%`,top:-1,width:2,height:8,background:`var(--color-primary)`,borderRadius:1}})]})})()}),(0,B.jsx)(`span`,{style:{color:C.muted,fontFamily:`var(--font-mono)`,minWidth:36},children:ze(t.maxDuration)})]})]}),t.recentRuns.length>=3&&(0,B.jsxs)(`div`,{style:{marginBottom:14},children:[(0,B.jsxs)(`div`,{style:{...k,marginBottom:6},children:[`Duration Trend (`,t.recentRuns.length,` runs)`]}),(0,B.jsx)(ev,{runs:t.recentRuns})]}),(0,B.jsx)(tv,{trend:t.dailyTrend})]})}function iv({label:e,value:t}){return(0,B.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,B.jsx)(`div`,{style:{fontSize:15,fontWeight:600,fontFamily:g,color:C.text},children:t}),(0,B.jsx)(`div`,{style:{fontSize:10,color:C.muted,marginTop:2},children:e})]})}var av={wrapper:`_wrapper_1gya1_6`,errorText:`_errorText_1gya1_10`,muted:`_muted_1gya1_14`,totalsStrip:`_totalsStrip_1gya1_18`,runRows:`_runRows_1gya1_27`,row:`_row_1gya1_37`,rowTime:`_rowTime_1gya1_51`,rowPills:`_rowPills_1gya1_55`,rowParticipants:`_rowParticipants_1gya1_61`,rowRight:`_rowRight_1gya1_68`,rowCost:`_rowCost_1gya1_72`,metricLabel:`_metricLabel_1gya1_77`,metricValue:`_metricValue_1gya1_84`,pill:`_pill_1gya1_89`,sectionHeader:`_sectionHeader_1gya1_99`},ov={sequential:{fg:`#79c0ff`,bg:`rgba(88,166,255,0.12)`,label:`Sequential`},parallel:{fg:`#c9a0ff`,bg:`rgba(188,140,255,0.14)`,label:`Parallel`},auto:{fg:`#d29922`,bg:`rgba(210,153,34,0.12)`,label:`Auto`},solo:{fg:C.muted,bg:`rgba(139,148,158,0.12)`,label:`Solo`}},sv={running:{fg:`#d29922`,bg:`rgba(210,153,34,0.12)`,label:`Running`},success:{fg:C.green,bg:`rgba(63,185,80,0.12)`,label:`Success`},failed:{fg:C.red,bg:`rgba(248,81,73,0.12)`,label:`Failed`}};function cv(e){return e==null?`—`:e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function lv(e){return e==null?`—`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function uv(e){let t=new Date(e).getTime();if(!Number.isFinite(t))return e;let n=Math.round((Date.now()-t)/1e3);if(n<60)return`${n}s ago`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);if(i<24)return`${i}h ago`;let a=Math.round(i/24);return a<14?`${a}d ago`:new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function dv({label:e,fg:t,bg:n}){return(0,B.jsx)(`span`,{className:av.pill,style:{color:t,background:n},children:e})}function fv({jobId:e,limit:t=30}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(null);(0,L.useEffect)(()=>{let n=!1;return r(null),a(null),fetch(`/api/jobs/${encodeURIComponent(e)}/seam-runs?limit=${t}`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{n||r(e.runs??[])}).catch(e=>{n||a(e instanceof Error?e.message:String(e))}),()=>{n=!0}},[e,t]);let o=(0,L.useMemo)(()=>{if(!n||n.length===0)return null;let e=0,t=0,r=0,i=0,a=0;for(let o of n)o.costUsd!=null&&(e+=o.costUsd),o.tokensIn!=null&&(t+=o.tokensIn),o.tokensOut!=null&&(r+=o.tokensOut),o.status===`success`?i++:o.status===`failed`&&a++;return{totalCost:e,totalTokensIn:t,totalTokensOut:r,successes:i,failures:a,total:n.length}},[n]);return i?(0,B.jsxs)(`div`,{className:av.wrapper,children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:8},children:`Seam Run History`}),(0,B.jsxs)(`div`,{className:av.errorText,style:{color:C.red},children:[`Failed to load: `,i]})]}):n===null?(0,B.jsxs)(`div`,{className:av.wrapper,children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:8},children:`Seam Run History`}),(0,B.jsx)(`div`,{className:av.muted,style:{color:C.muted},children:`Loading…`})]}):n.length===0?(0,B.jsxs)(`div`,{className:av.wrapper,children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:8},children:`Seam Run History`}),(0,B.jsx)(`div`,{className:av.muted,style:{color:C.muted},children:`No seam runs recorded yet. This surface populates after the job's first seam-v1 launch.`})]}):(0,B.jsxs)(`div`,{className:av.wrapper,children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:8},children:`Seam Run History`}),o&&(0,B.jsxs)(`div`,{className:av.totalsStrip,style:{background:C.subtleBg,border:`1px solid ${C.border}`},children:[(0,B.jsx)(pv,{label:`Runs`,value:String(o.total)}),(0,B.jsx)(pv,{label:`Success`,value:`${o.successes}/${o.total}`,tone:o.failures===0?`good`:`neutral`}),(0,B.jsx)(pv,{label:`Failed`,value:String(o.failures),tone:o.failures>0?`bad`:`neutral`}),(0,B.jsx)(pv,{label:`Total cost`,value:cv(o.totalCost)}),(0,B.jsx)(pv,{label:`Tokens in`,value:lv(o.totalTokensIn)}),(0,B.jsx)(pv,{label:`Tokens out`,value:lv(o.totalTokensOut)})]}),(0,B.jsx)(`div`,{className:av.runRows,style:{border:`1px solid ${C.border}`},children:n.map(e=>(0,B.jsx)(mv,{run:e},e.id))})]})}function pv({label:e,value:t,tone:n=`neutral`}){let r=n===`good`?C.green:n===`bad`?C.red:C.text;return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:av.metricLabel,style:{color:C.muted},children:e}),(0,B.jsx)(`div`,{className:av.metricValue,style:{color:r,fontFamily:g},children:t})]})}function mv({run:e}){let t=ov[e.hint]??{fg:C.muted,bg:C.mutedBg,label:e.hint},n=sv[e.status]??{fg:C.muted,bg:C.mutedBg,label:e.status},r=e.completedAt?(new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3:null;return(0,B.jsxs)(`div`,{title:`Session: ${e.leadSessionId}${e.errorMessage?`\nError: ${e.errorMessage}`:``}`,"data-status":e.status,className:av.row,children:[(0,B.jsx)(`span`,{className:av.rowTime,style:{color:C.muted,fontFamily:g},children:uv(e.startedAt)}),(0,B.jsxs)(`div`,{className:av.rowPills,children:[(0,B.jsx)(dv,{label:t.label,fg:t.fg,bg:t.bg}),(0,B.jsx)(dv,{label:n.label,fg:n.fg,bg:n.bg})]}),(0,B.jsxs)(`span`,{className:av.rowParticipants,style:{color:C.textSecondary,fontFamily:g},children:[e.leadEmployeeId??`—`,e.participants.length>0&&(0,B.jsxs)(`span`,{style:{color:C.muted},children:[` · `,e.participants.join(`, `)]})]}),(0,B.jsx)(`span`,{className:av.rowRight,style:{color:C.muted,fontFamily:g},children:r==null?`—`:ze(Math.round(r))}),(0,B.jsx)(`span`,{className:av.rowRight,style:{color:C.muted,fontFamily:g},children:e.tokensIn!=null||e.tokensOut!=null?`${lv(e.tokensIn)}/${lv(e.tokensOut)}`:`—`}),(0,B.jsx)(`span`,{className:av.rowCost,style:{color:C.text,fontFamily:g},children:cv(e.costUsd)})]})}function hv({name:e,isActive:t,onClick:n}){return(0,B.jsxs)(`button`,{onClick:n,style:{display:`inline-flex`,alignItems:`center`,gap:5,padding:`3px 10px`,borderRadius:12,border:`1px solid ${t?`var(--color-primary)60`:`var(--color-primary)30`}`,background:t?`var(--color-primary)18`:`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.03)`,color:`var(--color-primary)`,fontSize:12,fontFamily:g,cursor:`pointer`,transition:`all 0.2s ease`,whiteSpace:`nowrap`},onMouseEnter:e=>{t||(e.currentTarget.style.background=`var(--color-primary-soft)`,e.currentTarget.style.borderColor=`var(--color-primary)50`)},onMouseLeave:e=>{t||(e.currentTarget.style.background=`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.03)`,e.currentTarget.style.borderColor=`var(--color-primary)30`)},children:[(0,B.jsx)(`span`,{style:{fontSize:11},children:`/`}),e,(0,B.jsx)(`span`,{style:{fontSize:10,opacity:.6,transition:`transform 0.2s`,transform:t?`rotate(180deg)`:`rotate(0deg)`},children:`▼`})]})}function gv({skillName:e,onClose:t}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(!0),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!1),[m,h]=(0,L.useState)(`idle`),_=(0,L.useRef)(null);return(0,L.useEffect)(()=>{a(!0),s(null),fetch(`/api/skills/${e}`).then(e=>{if(!e.ok)throw Error(`Skill not found`);return e.json()}).then(e=>{r(e),d(e.content),a(!1)}).catch(e=>{s(e.message),a(!1)})},[e]),(0,L.useEffect)(()=>{if(c&&_.current){let e=_.current;e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,500)}px`}},[c,u]),(0,B.jsxs)(`div`,{style:{background:C.darkBg,border:`1px solid var(--color-primary)30`,borderRadius:8,overflow:`hidden`,animation:`fadeInUp 0.2s ease`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`8px 12px`,borderBottom:`1px solid ${C.border}`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsxs)(`span`,{style:{color:`var(--color-primary)`,fontFamily:g,fontSize:13,fontWeight:600},children:[`/`,e]}),n?.description&&(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:11,maxWidth:300,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.description})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[m===`saved`&&(0,B.jsx)(`span`,{style:{fontSize:11,color:C.green,transition:`opacity 0.3s`},children:`Saved`}),m===`error`&&(0,B.jsx)(`span`,{style:{fontSize:11,color:C.red},children:`Save failed`}),c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{n&&d(n.content),l(!1)},style:{fontSize:11,padding:`2px 8px`},children:`Cancel`}),(0,B.jsx)(`button`,{className:`btn btn-sm btn-green`,onClick:async()=>{p(!0),h(`idle`);try{let t=await fetch(`/api/skills/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:u})});if(!t.ok)throw Error(`Save failed`);r(await t.json()),h(`saved`),l(!1),setTimeout(()=>h(`idle`),2e3)}catch{h(`error`)}finally{p(!1)}},disabled:f||u===n?.content,style:{fontSize:11,padding:`2px 8px`},children:f?`Saving...`:`Save`})]}):!o&&(0,B.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>{n&&(d(n.content),l(!0),setTimeout(()=>_.current?.focus(),50))},style:{fontSize:11,padding:`2px 8px`},disabled:!n,children:`Edit`}),(0,B.jsx)(`button`,{onClick:t,"aria-label":`Close skill viewer`,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,padding:`2px 4px`,fontSize:14,lineHeight:1},children:`✕`})]})]}),(0,B.jsxs)(`div`,{style:{padding:`10px 12px`,maxHeight:500,overflowY:`auto`},children:[i&&(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,fontStyle:`italic`},children:`Loading skill...`}),o&&(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,fontStyle:`italic`},children:`External skill — installed globally via Claude Code plugin`}),!i&&!o&&n&&(c?(0,B.jsx)(`textarea`,{ref:_,value:u,onChange:e=>d(e.target.value),"aria-label":`Skill content`,style:{width:`100%`,minHeight:200,maxHeight:500,background:`transparent`,border:`1px solid ${C.border}`,borderRadius:6,color:C.textSecondary,fontFamily:`var(--font-mono)`,fontSize:12,lineHeight:1.6,padding:10,resize:`vertical`,outline:`none`},onFocus:e=>{e.currentTarget.style.borderColor=`var(--color-primary)60`},onBlur:e=>{e.currentTarget.style.borderColor=C.border}}):(0,B.jsx)(`pre`,{style:{fontFamily:`var(--font-mono)`,fontSize:12,lineHeight:1.6,color:C.textSecondary,margin:0,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:n.body.trim()}))]})]})}function _v({before:e,after:t,deltas:n}){return e===`insufficient-data`&&t===`insufficient-data`?(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,fontStyle:`italic`},children:`Insufficient data on both sides — need at least 3 runs before and 3 after this change.`}):(0,B.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(240px, 1fr))`,gap:10},children:[(0,B.jsx)(vv,{label:`Before`,stats:e}),(0,B.jsx)(vv,{label:`After`,stats:t})]})}function vv({label:e,stats:t}){return(0,B.jsxs)(`div`,{style:{background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:6,padding:10},children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:8},children:e}),t===`insufficient-data`?(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,fontStyle:`italic`},children:`Insufficient data (need ≥3 runs).`}):(0,B.jsx)(`table`,{style:{width:`100%`,fontSize:12,borderCollapse:`collapse`},children:(0,B.jsxs)(`tbody`,{children:[(0,B.jsx)(yv,{label:`Records`,value:String(t.windowN)}),(0,B.jsx)(yv,{label:`Success rate`,value:bv(t.successRate)}),(0,B.jsx)(yv,{label:`Avg duration`,value:xv(t.avgDurationSec)}),(0,B.jsx)(yv,{label:`Median duration`,value:xv(t.medianDurationSec)}),(0,B.jsx)(yv,{label:`Avg tokens in`,value:Sv(t.avgTokensIn)}),(0,B.jsx)(yv,{label:`Avg tokens out`,value:Sv(t.avgTokensOut)}),(0,B.jsx)(yv,{label:`Avg cost`,value:Cv(t.avgCostUsd)})]})})]})}function yv({label:e,value:t}){return(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{style:{padding:`3px 0`,color:C.muted,fontSize:11,verticalAlign:`top`},children:e}),(0,B.jsx)(`td`,{style:{padding:`3px 0`,fontFamily:g,color:C.text,textAlign:`right`,fontVariantNumeric:`tabular-nums`},children:t})]})}function bv(e){return`${Math.round(e*1e3)/10}%`}function xv(e){return e===void 0?`—`:ze(Math.round(e))}function Sv(e){return e===void 0?`—`:Math.round(e).toLocaleString()}function Cv(e){return e===void 0?`—`:`$${e.toFixed(4)}`}function wv({entry:e,onRevertClick:t}){let[n,r]=(0,L.useState)(!1),i=e.versionId===`v0`,a=e.status===`rolled-back`,o=e.status===`superseded`,s=e.status===`active`&&!i,c=(()=>{try{return Be(e.timestamp)}catch{return Re(e.timestamp)}})(),l=a||o;return(0,B.jsxs)(`div`,{style:{background:C.subtleBg,border:`1px solid ${C.border}`,borderRadius:8,marginBottom:8,opacity:l?.65:1,transition:`opacity 0.2s ease`},children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,style:{width:`100%`,minHeight:44,background:`none`,border:`none`,cursor:`pointer`,padding:`10px 12px`,display:`flex`,gap:10,alignItems:`center`,flexWrap:`wrap`,color:C.text,textAlign:`left`},children:[(0,B.jsx)(`span`,{title:Re(e.timestamp),style:{fontSize:11,color:C.muted,fontFamily:g,minWidth:64,flexShrink:0},children:c}),(0,B.jsx)(Tv,{target:e.target}),(0,B.jsx)(`span`,{title:e.reason,style:{fontSize:13,color:C.textSecondary,textDecoration:a?`line-through`:void 0,flex:`1 1 200px`,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i?`Baseline (v0)`:Ve(e.reason,80)}),(0,B.jsx)(Dv,{deltas:e.deltas}),(0,B.jsx)(Ev,{status:e.status}),(0,B.jsx)(`span`,{"aria-hidden":`true`,style:{fontSize:10,color:C.muted,transition:`transform 0.2s ease`,transform:n?`rotate(180deg)`:`rotate(0deg)`,flexShrink:0,marginLeft:`auto`},children:`▼`})]}),n&&(0,B.jsxs)(`div`,{style:{padding:`0 12px 12px`,borderTop:`1px solid ${C.border}`,paddingTop:12,animation:`fadeIn 0.18s ease`},children:[(0,B.jsxs)(`div`,{style:{fontSize:12,color:C.muted,marginBottom:10},children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`},children:e.versionId}),e.changesApplied>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,e.changesApplied,` change`,e.changesApplied===1?``:`s`,` applied`]}),e.changesRejected>0&&(0,B.jsxs)(B.Fragment,{children:[` · `,e.changesRejected,` rejected`]})]}),e.reason&&(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary,lineHeight:1.5,marginBottom:12,background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:6,padding:`8px 10px`},children:e.reason}),(0,B.jsx)(_v,{before:e.before,after:e.after,deltas:e.deltas}),s?(0,B.jsx)(`div`,{style:{marginTop:12,display:`flex`,gap:8,flexWrap:`wrap`},children:(0,B.jsx)(`button`,{type:`button`,onClick:t,className:`btn btn-sm btn-danger`,style:{minHeight:44},children:`↺ Revert this change`})}):i&&e.status===`active`?(0,B.jsx)(`div`,{style:{marginTop:12,fontSize:12,color:C.muted,fontStyle:`italic`},children:`Baseline cannot be reverted — it has no prior version.`}):null]})]})}function Tv({target:e}){let t=e===`prompt`?C.purple:C.blue;return(0,B.jsx)(`span`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,letterSpacing:.5,padding:`2px 7px`,borderRadius:10,background:`${t}14`,border:`1px solid ${t}33`,color:t,flexShrink:0},children:e})}function Ev({status:e}){let{color:t,label:n}={active:{color:C.green,label:`active`},"rolled-back":{color:C.red,label:`rolled back`},superseded:{color:C.muted,label:`superseded`}}[e];return(0,B.jsx)(`span`,{style:{fontSize:10,fontWeight:600,textTransform:`uppercase`,letterSpacing:.5,padding:`2px 7px`,borderRadius:10,background:`${t}14`,border:`1px solid ${t}33`,color:t,flexShrink:0},children:n})}function Dv({deltas:e}){return e===`insufficient-data`?(0,B.jsx)(`span`,{title:`Need at least 10 runs before and after (or 3 minimum) to compute deltas`,style:{fontSize:10,color:C.muted,background:C.mutedBg,border:`1px solid ${C.border}`,borderRadius:10,padding:`2px 7px`,flexShrink:0},children:`— insufficient data`}):(0,B.jsxs)(`span`,{style:{display:`inline-flex`,gap:4,flexWrap:`wrap`,flexShrink:0},children:[(0,B.jsx)(Ov,{label:`success`,value:e.successRatePct,unit:`pp`,higherIsBetter:!0}),(0,B.jsx)(Ov,{label:`dur`,value:e.durationSecPct,unit:`%`,higherIsBetter:!1}),(0,B.jsx)(Ov,{label:`cost`,value:e.costPct,unit:`%`,higherIsBetter:!1})]})}function Ov({label:e,value:t,unit:n,higherIsBetter:r}){let i=t===`inf`;if(!i&&!Number.isFinite(t))return null;let a=i?1:t,o=!i&&a===0,s=o?C.muted:(r?a>0:a<0)?C.green:(r?a<0:a>0)?C.red:C.muted,c=o?``:a>0?` ↑`:` ↓`,l=i?`∞`:o?`${a.toFixed(1)}${n}`:`${a>0?`+`:``}${a.toFixed(1)}${n}`;return(0,B.jsxs)(`span`,{title:`${e}: ${l}${c}`,style:{fontSize:10,fontFamily:g,padding:`2px 6px`,borderRadius:10,background:`${s}14`,border:`1px solid ${s}33`,color:s,whiteSpace:`nowrap`},children:[e,` `,l,c]})}function kv({onClick:e,zIndex:t=2e3,opacity:n=.6}){return(0,B.jsx)(`div`,{onClick:e,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,${n})`,zIndex:t}})}function Av({jobId:e,entry:t,onClose:n,onReverted:r}){let[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!0),f=t.versionId===`v0`;(0,L.useEffect)(()=>{let n=!1;return d(!0),fetch(`/api/jobs/${e}/prompt-changelog`).then(e=>e.ok?e.json():null).then(e=>{if(n)return;if(!Array.isArray(e)){l(null);return}let r=e.find(e=>e.versionId===t.versionId);if(!r){l(null);return}l(typeof r.previousContent==`string`?r.previousContent:typeof r.previousPrompt==`string`?r.previousPrompt:typeof r.previousSkillContent==`string`?r.previousSkillContent:null)}).catch(()=>{n||l(null)}).finally(()=>{n||d(!1)}),()=>{n=!0}},[e,t.versionId]),(0,L.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!i&&n()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n,i]);let p=async()=>{a(!0),s(null);try{let n=await fetch(`/api/jobs/${e}/self-improve-revert`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({versionId:t.versionId,reason:`manual revert via dashboard`})});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`HTTP ${n.status}: ${e||`revert failed`}`)}r()}catch(e){s(e instanceof Error?e.message:String(e)),a(!1)}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(kv,{onClick:i?()=>{}:n,zIndex:3e3}),(0,B.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Confirm revert`,style:{position:`fixed`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:560,maxWidth:`92vw`,maxHeight:`80vh`,background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:12,boxShadow:`0 16px 48px rgba(0,0,0,0.5)`,zIndex:3001,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{padding:`14px 18px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsx)(`div`,{style:{fontWeight:600,fontSize:15,color:C.text},children:f?`Revert to baseline (v0)`:`Revert this change`}),(0,B.jsx)(`button`,{onClick:n,disabled:i,"aria-label":`Close`,style:{background:`none`,border:`none`,color:C.muted,fontSize:18,cursor:i?`default`:`pointer`,padding:`4px 8px`,lineHeight:1},children:`✕`})]}),(0,B.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:`14px 18px`},children:[(0,B.jsx)(`div`,{style:{padding:10,background:`${C.warning}18`,border:`1px solid ${C.warning}40`,borderRadius:6,color:C.warning,fontSize:13,marginBottom:12},children:f?`Reverting to v0 will discard ALL subsequent self-improve changes on this job’s prompt/skill.`:`This will replace the current ${t.target} with the previous version shown below.`}),(0,B.jsxs)(`div`,{style:{...k,marginBottom:6},children:[`Previous `,t.target,` (`,t.versionId.slice(0,8),`)`]}),u?(0,B.jsx)(`div`,{style:{color:C.muted,fontSize:12},children:`Loading previous content...`}):c===null?(0,B.jsx)(`div`,{style:{color:C.muted,fontSize:12,fontStyle:`italic`},children:f?`Baseline (v0) has no "previous" content — reverting restores the job’s original prompt/skill.`:`Could not load previous content from the changelog.`}):(0,B.jsx)(`pre`,{style:{background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:6,padding:12,fontSize:12,fontFamily:g,color:C.textSecondary,maxHeight:280,overflow:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,margin:0},children:c}),o&&(0,B.jsx)(`div`,{style:{marginTop:12,padding:10,background:`rgba(248,81,73,0.1)`,border:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.25)`,borderRadius:6,color:C.red,fontSize:12},children:o})]}),(0,B.jsxs)(`div`,{style:{padding:`12px 18px`,borderTop:`1px solid ${C.border}`,display:`flex`,gap:8,justifyContent:`flex-end`},children:[(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:n,disabled:i,style:{minHeight:44},children:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-danger`,onClick:p,disabled:i,style:{minHeight:44},children:i?`Reverting...`:f?`Revert to baseline`:`Confirm revert`})]})]})]})}function jv({jobId:e}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(!0),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),d=(0,L.useCallback)(async t=>{i(!0),o(null);try{let r=await fetch(`/api/jobs/${e}/self-improve-impact`,{signal:t});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();if(!Array.isArray(i))throw Error(`Unexpected response shape`);n(i)}catch(e){if(e?.name===`AbortError`)return;o(e instanceof Error?e.message:String(e)),n(null)}finally{i(!1)}},[e]);(0,L.useEffect)(()=>{let t=new AbortController;return d(t.signal),fetch(`/api/jobs/${e}/stats`,{signal:t.signal}).then(e=>e.ok?e.json():null).then(e=>{e&&typeof e==`object`&&c(e)}).catch(()=>{}),()=>t.abort()},[e,d]);let f=(0,L.useMemo)(()=>t?t.filter(e=>e.reason.startsWith(`auto-rollback:`)).length:0,[t]),p=(0,L.useMemo)(()=>{if(!t||t.length===0)return null;let e=t.find(e=>e.status===`active`);return e?e.versionId:null},[t]),m=s?.selfImproveOverhead7d,h=m?(m.tokensIn??0)+(m.tokensOut??0)+(m.tokensCacheRead??0)+(m.tokensCacheWrite??0):void 0;if(r&&t===null)return(0,B.jsx)(`div`,{style:{padding:24,color:C.muted,fontSize:13,textAlign:`center`},children:`Loading self-improve history...`});if(a&&!t)return(0,B.jsxs)(`div`,{style:{padding:16,background:`rgba(248,81,73,0.08)`,border:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.25)`,borderRadius:8,color:C.red,fontSize:13},children:[`Failed to load self-improve data: `,a,`.`,` `,(0,B.jsx)(`button`,{onClick:()=>void d(),style:{background:`none`,border:`none`,color:C.red,textDecoration:`underline`,cursor:`pointer`,padding:0,fontSize:13},children:`Retry`})]});let g=t??[];return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(140px, 1fr))`,gap:8,padding:12,background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:8,marginBottom:12},children:[(0,B.jsx)(Mv,{label:`Total changes`,value:String(g.length)}),(0,B.jsx)(Mv,{label:`Active version`,value:p?p.slice(0,8):`—`,mono:!0}),(0,B.jsx)(Mv,{label:`Auto-rollbacks`,value:String(f)}),h!==void 0&&(0,B.jsx)(Mv,{label:`7d reviewer overhead`,value:`${h.toLocaleString()} tokens`})]}),g.length===0?(0,B.jsx)(Nv,{}):(0,B.jsx)(`div`,{children:g.map(e=>(0,B.jsx)(wv,{entry:e,onRevertClick:()=>u(e)},e.versionId))}),l&&(0,B.jsx)(Av,{jobId:e,entry:l,onClose:()=>u(null),onReverted:()=>{u(null),d()}})]})}function Mv({label:e,value:t,mono:n}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{...k,marginBottom:2},children:e}),(0,B.jsx)(`div`,{style:{fontSize:15,fontWeight:600,color:C.text,fontFamily:n?g:void 0},children:t})]})}function Nv(){return(0,B.jsxs)(`div`,{style:{padding:`32px 20px`,textAlign:`center`,background:C.subtleBg,border:`1px dashed ${C.border}`,borderRadius:8,color:C.muted,fontSize:13,lineHeight:1.5},children:[(0,B.jsx)(`div`,{style:{fontSize:24,marginBottom:8,opacity:.7},children:`⚙`}),(0,B.jsx)(`div`,{style:{color:C.textSecondary,marginBottom:4},children:`Self-improve enabled — no changes yet`}),(0,B.jsx)(`div`,{children:`The first change will appear here.`})]})}var Pv={dot:`_dot_3edp9_1`,sizeXs:`_sizeXs_3edp9_8`,sizeSm:`_sizeSm_3edp9_9`,sizeMd:`_sizeMd_3edp9_10`,success:`_success_3edp9_12`,failed:`_failed_3edp9_13`,error:`_error_3edp9_14`,degraded:`_degraded_3edp9_15`,timeout:`_timeout_3edp9_16`,cancelled:`_cancelled_3edp9_17`,skipped:`_skipped_3edp9_18`,queued:`_queued_3edp9_19`,retrying:`_retrying_3edp9_20`,running:`_running_3edp9_21`,never:`_never_3edp9_24`,pulse:`_pulse_3edp9_30`,"status-dot-pulse":`_status-dot-pulse_3edp9_1`},Fv={xs:Pv.sizeXs,sm:Pv.sizeSm,md:Pv.sizeMd},Iv={success:Pv.success,failed:Pv.failed,error:Pv.error,degraded:Pv.degraded,timeout:Pv.timeout,cancelled:Pv.cancelled,skipped:Pv.skipped,queued:Pv.queued,retrying:Pv.retrying,running:Pv.running,never:Pv.never};function Lv(e){return e??`never`}function Rv({status:e,size:t=`sm`,pulse:n,title:r,className:i}){let a=Lv(e),o=n??a===`running`;return(0,B.jsx)(`span`,{className:[Pv.dot,Fv[t],Iv[a],o?Pv.pulse:null,i].filter(Boolean).join(` `),title:r,"aria-label":r??`Status: ${a}`})}var zv={pill:`_pill_1eipl_1`,variantBlue:`_variantBlue_1eipl_13`,variantPurple:`_variantPurple_1eipl_14`,variantWarning:`_variantWarning_1eipl_15`,variantMuted:`_variantMuted_1eipl_16`},Bv={blue:zv.variantBlue,purple:zv.variantPurple,warning:zv.variantWarning,muted:zv.variantMuted};function Vv({job:e,employees:t=[],compact:n=!1}){if(e.flow===`seam-v1`){let r=e.lead??e.participants?.[0],i=(r?t.find(e=>e.name===r):void 0)?.displayName??r,a=e.participants?.length??0,o=e.coordinationHint??`auto`,s=et[o];s||console.warn(`[FlowPill] unknown coordinationHint '${o}' for job ${e.id} — falling back to Auto`);let c=s??et.auto,l=qg(e,t),u=[`Team of ${a||`?`}`];return i&&u.push(`Lead: ${i}`),u.push(c.label),l&&u.push(`⚠ ${l.tooltip}`),(0,B.jsxs)(Hv,{variant:l?`warning`:`purple`,icon:`🤝`,title:u.join(` — `),children:[(0,B.jsx)(`span`,{children:n?`Team`:i?`Team · ${i}`:`Team`}),(0,B.jsx)(`span`,{"aria-hidden":!0,className:zv.hintIcon,children:c.icon}),l&&(0,B.jsx)(`span`,{"aria-hidden":!0,className:zv.warningSuffix,children:`⚠`})]})}let r=e.employee;if(r){let e=t.find(e=>e.name===r)?.displayName??r;return(0,B.jsx)(Hv,{variant:`blue`,icon:`⚡`,title:`Solo agent: ${e}`,children:e})}return(0,B.jsx)(Hv,{variant:`muted`,icon:`⚡`,title:`Solo (no employee assigned)`,children:`Solo`})}function Hv({variant:e,icon:t,title:n,children:r}){return(0,B.jsxs)(`span`,{title:n,className:`${zv.pill} ${Bv[e]}`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,children:t}),(0,B.jsx)(`span`,{children:r})]})}var Uv={cluster:`_cluster_119qy_1`,model:`_model_119qy_18`,disabled:`_disabled_119qy_31`};function Wv({job:e,employees:t=[],showModel:n=!0,compact:r=!1,dimmed:i=!1}){let a=e.model?.trim()||null,o=a?r?He(a):a:null;return(0,B.jsxs)(`span`,{className:`${Uv.cluster} ${i?Uv.disabled:``}`,children:[(0,B.jsx)(Vv,{job:e,employees:t,compact:r}),n&&o&&(0,B.jsx)(`span`,{className:Uv.model,title:`Model: ${a}`,children:o})]})}var Gv=`var(--color-text-muted)`,Kv=`var(--color-positive)`,qv=`var(--color-negative)`,Jv=C.warning;function Yv({history:e,width:t=80,height:n=24}){let[r,i]=(0,L.useState)(null),a=(0,L.useId)(),o=e.slice(-20).filter(e=>typeof e.durationSeconds==`number`&&e.durationSeconds>0);if(o.length<2)return null;let s=o.map(e=>e.durationSeconds),c=Math.min(...s),l=Math.max(...s)-c,u=n-6;function d(e){return l===0?3+u/2:3+u-(e-c)/l*u}let f=(t-6)/(o.length-1),p=o.map((e,t)=>({x:3+t*f,y:d(e.durationSeconds),run:e})),m=p.map(e=>`${e.x.toFixed(1)},${e.y.toFixed(1)}`).join(` `),h=G_(o),g=p[p.length-1],_=o[o.length-1];function v(){return h?Jv:_.status===`success`?Kv:_.status===`failed`||_.status===`timeout`?qv:Gv}function y(e){i({x:e.x,y:e.y,label:U_(e.run.durationSeconds)})}function b(){i(null)}return(0,B.jsxs)(`div`,{style:{position:`relative`,display:`inline-block`,lineHeight:0},children:[(0,B.jsxs)(`svg`,{width:t,height:n,style:{display:`block`,overflow:`visible`},"aria-label":`Duration trend sparkline`,children:[(0,B.jsx)(`defs`,{children:(0,B.jsx)(`clipPath`,{id:a,children:(0,B.jsx)(`rect`,{x:0,y:0,width:t,height:n})})}),(0,B.jsx)(`polyline`,{points:m,fill:`none`,stroke:Gv,strokeWidth:1.5,strokeLinejoin:`round`,strokeLinecap:`round`,clipPath:`url(#${a})`,opacity:.6}),p.map((e,t)=>(0,B.jsx)(`circle`,{cx:e.x,cy:e.y,r:5,fill:`transparent`,style:{cursor:`default`},onMouseEnter:()=>y(e),onMouseLeave:b},t)),g&&(0,B.jsx)(`circle`,{cx:g.x,cy:g.y,r:3,fill:v(),onMouseEnter:()=>y(g),onMouseLeave:b})]}),r&&(0,B.jsx)(`div`,{style:{position:`absolute`,bottom:n+4,left:r.x,transform:`translateX(-50%)`,background:C.hover,border:`1px solid #30363d`,borderRadius:4,padding:`2px 6px`,fontSize:11,color:C.textSecondary,whiteSpace:`nowrap`,pointerEvents:`none`,zIndex:10},children:r.label})]})}var Xv={strip:`_strip_xunx3_1`,stripCompact:`_stripCompact_xunx3_11`,metric:`_metric_xunx3_16`,value:`_value_xunx3_23`,label:`_label_xunx3_29`,valuePositive:`_valuePositive_xunx3_45`,valueNegative:`_valueNegative_xunx3_46`,valueNeutral:`_valueNeutral_xunx3_47`,streak:`_streak_xunx3_49`,streakIcon:`_streakIcon_xunx3_58`,sparkWrap:`_sparkWrap_xunx3_64`};function Zv(e){let t=e.filter(e=>e.status===`success`||e.status===`failed`||e.status===`timeout`),n=t.filter(e=>e.status===`success`).length,r=t.length,i=r>0?n/r:null,a=r>0?W_(t):null,o=0;for(let t=e.length-1;t>=0;t--)if(e[t].status===`success`)o++;else if(e[t].status===`running`||e[t].status===`queued`||e[t].status===`retrying`)continue;else break;return{completed:r,successes:n,successRate:i,avgDurationSec:a,streak:o}}function Qv(e){return e===null?Xv.valueNeutral:e>=.9?Xv.valuePositive:e<.5?Xv.valueNegative:Xv.valueNeutral}function $v({history:e,compact:t=!1,showSparkline:n,showRatio:r,hideRate:i=!1,hideAvg:a=!1,hideStreak:o=!1,className:s}){let c=(0,L.useMemo)(()=>Zv(e),[e]),l=n??!t,u=r??!t;return(0,B.jsxs)(`span`,{className:[Xv.strip,t?Xv.stripCompact:null,s].filter(Boolean).join(` `),children:[!i&&c.successRate!==null&&(0,B.jsxs)(`span`,{className:Xv.metric,title:`${c.successes} of ${c.completed} successful`,children:[(0,B.jsxs)(`span`,{className:`${Xv.value} ${Qv(c.successRate)}`,children:[Math.round(c.successRate*100),`%`]}),u&&(0,B.jsxs)(`span`,{className:Xv.label,children:[c.successes,`/`,c.completed]})]}),!a&&c.avgDurationSec!==null&&(0,B.jsxs)(`span`,{className:Xv.metric,title:`Average duration`,children:[(0,B.jsx)(`span`,{className:Xv.value,children:U_(c.avgDurationSec)}),(0,B.jsx)(`span`,{className:Xv.label,children:`avg`})]}),!o&&c.streak>0&&(0,B.jsxs)(`span`,{className:Xv.streak,title:`${c.streak} successful run${c.streak===1?``:`s`} in a row`,children:[(0,B.jsx)(`span`,{className:Xv.streakIcon,"aria-hidden":!0,children:`🔥`}),c.streak]}),l&&e.length>=2&&(0,B.jsx)(`span`,{className:Xv.sparkWrap,children:(0,B.jsx)(Yv,{history:e,width:t?60:80,height:t?18:22})})]})}function ey(e){if(typeof window>`u`)return;let t=/^#\/?ideas(\/|$)/.test(window.location.hash);window.history.pushState({ideaDrawer:e},``,`#/ideas`),t?window.dispatchEvent(new PopStateEvent(`popstate`,{state:{ideaDrawer:e}})):window.dispatchEvent(new HashChangeEvent(`hashchange`))}var ty={row:`_row_uafor_1`,time:`_time_uafor_10`,action:`_action_uafor_16`,actionRetry:`_actionRetry_uafor_24`,actionSlack:`_actionSlack_uafor_25`,actionIdea:`_actionIdea_uafor_26`,actionResolved:`_actionResolved_uafor_27`,actionMuted:`_actionMuted_uafor_28`,jobBtn:`_jobBtn_uafor_29`,kindChip:`_kindChip_uafor_30`,detail:`_detail_uafor_37`,ideaLink:`_ideaLink_uafor_41`},ny={retry:ty.actionRetry,"slack-drafted":ty.actionSlack,"idea-filed":ty.actionIdea,"auto-unpaused":ty.actionResolved,skipped:ty.actionMuted,"no-action":ty.actionMuted},ry={retry:`retried`,"slack-drafted":`slack-drafted`,"idea-filed":`idea-filed`,"auto-unpaused":`auto-unpaused`,skipped:`skipped`,"no-action":`no-action`};function iy(e){return e.note?e.note:e.action===`retry`&&typeof e.attempt==`number`?`attempt ${e.attempt}`:e.action===`slack-drafted`&&e.slackChannel?`#${e.slackChannel}`:null}function ay({event:e,onJobClick:t,showJobName:n=!0,ideaTitles:r}){let i=iy(e),a=e.action===`idea-filed`?e.ideaId:void 0,o=a?r?.get(a)??a:null;return(0,B.jsxs)(`div`,{className:ty.row,children:[(0,B.jsx)(`div`,{className:ty.time,children:(0,B.jsx)(I,{iso:e.ts})}),(0,B.jsx)(`div`,{className:`${ty.action} ${ny[e.action]}`,children:ry[e.action]}),n&&(0,B.jsx)(F,{variant:`ghost`,onClick:()=>t?.(e.jobId),className:ty.jobBtn,children:e.jobName}),e.failureKind&&(0,B.jsx)(`span`,{className:ty.kindChip,children:e.failureKind}),a&&o&&(0,B.jsx)(F,{variant:`ghost`,className:ty.ideaLink,onClick:()=>ey(a),title:a,children:o}),i&&(0,B.jsx)(`span`,{className:ty.detail,children:i})]})}var oy=new Set([`retry`,`slack-drafted`,`idea-filed`,`auto-unpaused`,`skipped`,`no-action`]),sy=new Set([`retry`,`slack-drafted`,`idea-filed`]),cy=new Set([`slack-drafted`,`idea-filed`]),ly=500,uy=128;function dy(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.id!=`string`||t.id.length===0||typeof t.ts!=`string`||Number.isNaN(Date.parse(t.ts))||typeof t.jobId!=`string`||t.jobId.length===0||typeof t.jobName!=`string`||typeof t.action!=`string`||!oy.has(t.action)||t.ideaId!==void 0&&(typeof t.ideaId!=`string`||t.ideaId.length>uy))}function fy(e){let t={},n={},r=0,i=0;for(let a of e)a.failureKind&&(t[a.failureKind]=(t[a.failureKind]??0)+1),sy.has(a.action)&&(n[a.action]=(n[a.action]??0)+1),a.action===`auto-unpaused`&&r++,cy.has(a.action)&&i++;return{failuresByKind:t,remediationsByAction:n,autoResolved:r,escalated:i}}var py={"1d":1440*60*1e3,"7d":10080*60*1e3,"30d":720*60*60*1e3};function my(){let[e,t]=(0,L.useState)([]),[n,r]=(0,L.useState)(!0),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(`7d`),[c,l]=(0,L.useState)(null),[u,f]=(0,L.useState)(null),p=(0,L.useCallback)(e=>s(e),[]);(0,L.useEffect)(()=>{let e=!1,n=new AbortController,i=new Date(Date.now()-py[o]).toISOString(),s=`/api/supervisor/events?since=${encodeURIComponent(i)}&limit=200`;return r(!0),a(null),(async()=>{try{let r=await fetch(s,{signal:n.signal});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();if(e)return;let a=Array.isArray(i.events)?i.events:[],o=a.filter(dy);o.length!==a.length&&console.warn(`[useJobHealthData] dropped ${a.length-o.length} malformed events`),t(o.slice(0,ly))}catch(t){if(e||t instanceof Error&&t.name===`AbortError`)return;a(t instanceof Error?t.message:String(t))}finally{e||r(!1)}})(),()=>{e=!0,n.abort()}},[o]);let{subscribe:m}=d();(0,L.useEffect)(()=>m(M,e=>{try{if(!dy(e))return;t(t=>[e,...t].slice(0,ly))}catch(e){console.warn(`[useJobHealthData] supervisor.event handler threw`,e)}}),[m]);let h=(0,L.useMemo)(()=>e.filter(e=>(!c||e.action===c)&&(!u||e.jobId===u)),[e,c,u]);return{events:h,metrics:(0,L.useMemo)(()=>fy(h),[h]),loading:n,error:i,timeWindow:o,setTimeWindow:p,filterAction:c,setFilterAction:l,filterJobId:u,setFilterJobId:f}}function hy(){let[e,t]=(0,L.useState)(new Map),[n,r]=(0,L.useState)(!0);return(0,L.useEffect)(()=>{let e=!1,n=new AbortController;return(async()=>{try{let r=await fetch(`/api/ideas`,{signal:n.signal});if(!r.ok)throw Error(`HTTP ${r.status}`);let i=await r.json();if(e)return;let a=new Map;if(Array.isArray(i.ideas))for(let e of i.ideas){if(!e||typeof e!=`object`)continue;let t=e;typeof t.id==`string`&&typeof t.title==`string`&&a.set(t.id,t.title)}t(a)}catch(t){if(e||t instanceof Error&&t.name===`AbortError`)return;console.warn(`[useIdeaTitles] fetch failed`,t)}finally{e||r(!1)}})(),()=>{e=!0,n.abort()}},[]),{titles:e,loading:n}}var gy={root:`_root_1dxc2_1`,sectionLabel:`_sectionLabel_1dxc2_2`,failure:`_failure_1dxc2_9`,failureMsg:`_failureMsg_1dxc2_10`,kindChip:`_kindChip_1dxc2_11`,toggle:`_toggle_1dxc2_19`,logTail:`_logTail_1dxc2_20`,muted:`_muted_1dxc2_30`,events:`_events_1dxc2_31`,ideaChips:`_ideaChips_1dxc2_32`,ideaChip:`_ideaChip_1dxc2_32`};function _y({job:e}){let[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(!1),{titles:l}=hy();(0,L.useEffect)(()=>{let t=!1,r=new AbortController;return i(!0),o(null),(async()=>{try{let i=await fetch(`/api/supervisor/events?jobId=${encodeURIComponent(e.id)}&limit=50`,{signal:r.signal});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.json();if(t)return;n((Array.isArray(a.events)?a.events:[]).filter(dy))}catch(e){if(t||e instanceof Error&&e.name===`AbortError`)return;o(e instanceof Error?e.message:String(e)),n([])}finally{t||i(!1)}})(),()=>{t=!0,r.abort()}},[e.id]);let u=e.lastFailureReason,d=e.lastFailureReasonText,f=t.filter(e=>e.action===`idea-filed`&&e.ideaId);return(0,B.jsxs)(`div`,{className:gy.root,children:[(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`div`,{className:gy.sectionLabel,children:`Current failure reason`}),u?(0,B.jsxs)(`div`,{className:gy.failure,children:[(0,B.jsx)(`span`,{className:gy.kindChip,children:u.kind}),(0,B.jsx)(`div`,{className:gy.failureMsg,children:u.message}),(0,B.jsx)(I,{iso:u.occurredAt}),u.lastLogTail&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`ghost`,className:gy.toggle,onClick:()=>c(e=>!e),children:[s?`Hide`:`Show`,` log tail`]}),s&&(0,B.jsx)(`pre`,{className:gy.logTail,children:u.lastLogTail})]})]}):d?(0,B.jsx)(`div`,{className:gy.failureMsg,children:d}):(0,B.jsx)(`div`,{className:gy.muted,children:`No recorded failure reason.`})]}),(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`div`,{className:gy.sectionLabel,children:`Supervisor events for this job`}),r?(0,B.jsx)(`div`,{className:gy.muted,children:`Loading…`}):a?(0,B.jsxs)(`div`,{className:gy.muted,children:[`Failed to load activity: `,a]}):t.length===0?(0,B.jsx)(`div`,{className:gy.muted,children:`No supervisor activity for this job yet.`}):(0,B.jsx)(`div`,{className:gy.events,children:t.map(e=>(0,B.jsx)(ay,{event:e,showJobName:!1,ideaTitles:l},e.id))})]}),f.length>0&&(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`div`,{className:gy.sectionLabel,children:`Linked remediation ideas`}),(0,B.jsx)(`div`,{className:gy.ideaChips,children:f.map(e=>{let t=e.ideaId,n=l.get(t)??t;return(0,B.jsx)(F,{variant:`ghost`,className:gy.ideaChip,title:t,onClick:()=>ey(t),children:n},e.id)})})]})]})}var vy=(0,L.createContext)({});function yy(e){let t=(0,L.useRef)(null);return t.current===null&&(t.current=e()),t.current}var by=(0,L.createContext)(null),xy=(0,L.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`}),Sy=class extends L.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}};function Cy({children:e,isPresent:t}){let n=(0,L.useId)(),r=(0,L.useRef)(null),i=(0,L.useRef)({width:0,height:0,top:0,left:0}),{nonce:a}=(0,L.useContext)(xy);return(0,L.useInsertionEffect)(()=>{let{width:e,height:o,top:s,left:c}=i.current;if(t||!r.current||!e||!o)return;r.current.dataset.motionPopId=n;let l=document.createElement(`style`);return a&&(l.nonce=a),document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`
|
|
81
|
-
[data-motion-pop-id="${n}"] {
|
|
82
|
-
position: absolute !important;
|
|
83
|
-
width: ${e}px !important;
|
|
84
|
-
height: ${o}px !important;
|
|
85
|
-
top: ${s}px !important;
|
|
86
|
-
left: ${c}px !important;
|
|
87
|
-
}
|
|
88
|
-
`),()=>{document.head.removeChild(l)}},[t]),(0,B.jsx)(Sy,{isPresent:t,childRef:r,sizeRef:i,children:L.cloneElement(e,{ref:r})})}var wy=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o})=>{let s=yy(Ty),c=(0,L.useId)(),l=(0,L.useCallback)(e=>{s.set(e,!0);for(let e of s.values())if(!e)return;r&&r()},[s,r]),u=(0,L.useMemo)(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:l,register:e=>(s.set(e,!1),()=>s.delete(e))}),a?[Math.random(),l]:[n,l]);return(0,L.useMemo)(()=>{s.forEach((e,t)=>s.set(t,!1))},[n]),L.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),o===`popLayout`&&(e=(0,B.jsx)(Cy,{isPresent:n,children:e})),(0,B.jsx)(by.Provider,{value:u,children:e})};function Ty(){return new Map}function Ey(e=!0){let t=(0,L.useContext)(by);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,L.useId)();(0,L.useEffect)(()=>{e&&i(a)},[e]);let o=(0,L.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Dy=e=>e.key||``;function Oy(e){let t=[];return L.Children.forEach(e,e=>{(0,L.isValidElement)(e)&&t.push(e)}),t}var ky=typeof window<`u`,Ay=ky?L.useLayoutEffect:L.useEffect,jy=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1})=>{let[s,c]=Ey(o),l=(0,L.useMemo)(()=>Oy(e),[e]),u=o&&!s?[]:l.map(Dy),d=(0,L.useRef)(!0),f=(0,L.useRef)(l),p=yy(()=>new Map),[m,h]=(0,L.useState)(l),[g,_]=(0,L.useState)(l);Ay(()=>{d.current=!1,f.current=l;for(let e=0;e<g.length;e++){let t=Dy(g[e]);u.includes(t)?p.delete(t):p.get(t)!==!0&&p.set(t,!1)}},[g,u.length,u.join(`-`)]);let v=[];if(l!==m){let e=[...l];for(let t=0;t<g.length;t++){let n=g[t],r=Dy(n);u.includes(r)||(e.splice(t,0,n),v.push(n))}a===`wait`&&v.length&&(e=v),_(Oy(e)),h(l);return}let{forceRender:y}=(0,L.useContext)(vy);return(0,B.jsx)(B.Fragment,{children:g.map(e=>{let m=Dy(e),h=o&&!s?!1:l===g||u.includes(m);return(0,B.jsx)(wy,{isPresent:h,initial:!d.current||n?void 0:!1,custom:h?void 0:t,presenceAffectsLayout:i,mode:a,onExitComplete:h?void 0:()=>{if(p.has(m))p.set(m,!0);else return;let e=!0;p.forEach(t=>{t||(e=!1)}),e&&(y?.(),_(f.current),o&&c?.(),r&&r())},children:e},m)})})},My=e=>e,Ny=My,Py=My;function Fy(e){let t;return()=>(t===void 0&&(t=e()),t)}var Iy=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ly=e=>e*1e3,Ry=e=>e/1e3,zy={skipAnimations:!1,useManualTiming:!1};function By(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.has(e)||s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var Vy=[`read`,`resolveKeyframes`,`update`,`preRender`,`render`,`postRender`],Hy=40;function Uy(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Vy.reduce((e,t)=>(e[t]=By(a),e),{}),{read:s,resolveKeyframes:c,update:l,preRender:u,render:d,postRender:f}=o,p=()=>{let a=zy.useManualTiming?i.timestamp:performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,Hy),1),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,i.isProcessing||e(p)};return{schedule:Vy.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||m(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Vy.length;t++)o[Vy[t]].cancel(e)},state:i,steps:o}}var{schedule:Wy,cancel:Gy,state:Ky,steps:qy}=Uy(typeof requestAnimationFrame<`u`?requestAnimationFrame:My,!0),Jy=(0,L.createContext)({strict:!1}),Yy={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Xy={};for(let e in Yy)Xy[e]={isEnabled:t=>Yy[e].some(e=>!!t[e])};function Zy(e){for(let t in e)Xy[t]={...Xy[t],...e[t]}}var Qy=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport`.split(`.`));function $y(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Qy.has(e)}var eb=e({default:()=>tb}),tb,nb=t((()=>{throw tb={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),rb=e=>!$y(e);function ib(e){e&&(rb=t=>t.startsWith(`on`)?!$y(t):e(t))}try{ib((nb(),r(eb)).default)}catch{}function ab(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(rb(i)||n===!0&&$y(i)||!t&&!$y(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}function ob(e){if(typeof Proxy>`u`)return e;let t=new Map;return new Proxy((...t)=>e(...t),{get:(n,r)=>r===`create`?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}var sb=(0,L.createContext)({});function cb(e){return typeof e==`string`||Array.isArray(e)}function lb(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}var ub=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],db=[`initial`,...ub];function fb(e){return lb(e.animate)||db.some(t=>cb(e[t]))}function pb(e){return!!(fb(e)||e.variants)}function mb(e,t){if(fb(e)){let{initial:t,animate:n}=e;return{initial:t===!1||cb(t)?t:void 0,animate:cb(n)?n:void 0}}return e.inherit===!1?{}:t}function hb(e){let{initial:t,animate:n}=mb(e,(0,L.useContext)(sb));return(0,L.useMemo)(()=>({initial:t,animate:n}),[gb(t),gb(n)])}function gb(e){return Array.isArray(e)?e.join(` `):e}var _b=Symbol.for(`motionComponentSymbol`);function vb(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function yb(e,t,n){return(0,L.useCallback)(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n==`function`?n(r):vb(n)&&(n.current=r))},[t])}var bb=e=>e.replace(/([a-z])([A-Z])/gu,`$1-$2`).toLowerCase(),xb=`data-`+bb(`framerAppearId`),{schedule:Sb,cancel:Cb}=Uy(queueMicrotask,!1),wb=(0,L.createContext)({});function Tb(e,t,n,r,i){let{visualElement:a}=(0,L.useContext)(sb),o=(0,L.useContext)(Jy),s=(0,L.useContext)(by),c=(0,L.useContext)(xy).reducedMotion,l=(0,L.useRef)(null);r||=o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:a,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:c}));let u=l.current,d=(0,L.useContext)(wb);u&&!u.projection&&i&&(u.type===`html`||u.type===`svg`)&&Eb(l.current,n,i,d);let f=(0,L.useRef)(!1);(0,L.useInsertionEffect)(()=>{u&&f.current&&u.update(n,s)});let p=n[xb],m=(0,L.useRef)(!!p&&!window.MotionHandoffIsComplete?.call(window,p)&&window.MotionHasOptimisedAnimation?.call(window,p));return Ay(()=>{u&&(f.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),Sb.render(u.render),m.current&&u.animationState&&u.animationState.animateChanges())}),(0,L.useEffect)(()=>{u&&(!m.current&&u.animationState&&u.animationState.animateChanges(),m.current&&=(queueMicrotask(()=>{var e;(e=window.MotionHandoffMarkAsComplete)==null||e.call(window,p)}),!1))}),u}function Eb(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Db(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&vb(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,layoutScroll:c,layoutRoot:l})}function Db(e){if(e)return e.options.allowProjection===!1?Db(e.parent):e.projection}function Ob({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&Zy(e);function a(a,o){let s,c={...(0,L.useContext)(xy),...a,layoutId:kb(a)},{isStatic:l}=c,u=hb(a),d=r(a,l);if(!l&&ky){Ab(c,e);let n=jb(c);s=n.MeasureLayout,u.visualElement=Tb(i,d,c,t,n.ProjectionNode)}return(0,B.jsxs)(sb.Provider,{value:u,children:[s&&u.visualElement?(0,B.jsx)(s,{visualElement:u.visualElement,...c}):null,n(i,a,yb(d,u.visualElement,o),d,l,u.visualElement)]})}a.displayName=`motion.${typeof i==`string`?i:`create(${i.displayName??i.name??``})`}`;let o=(0,L.forwardRef)(a);return o[_b]=i,o}function kb({layoutId:e}){let t=(0,L.useContext)(vy).id;return t&&e!==void 0?t+`-`+e:e}function Ab(e,t){(0,L.useContext)(Jy).strict}function jb(e){let{drag:t,layout:n}=Xy;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}var Mb=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Nb(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Mb.indexOf(e)>-1||/[A-Z]/u.test(e))}function Pb(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Fb(e,t,n,r){if(typeof t==`function`){let[i,a]=Pb(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=Pb(r);t=t(n===void 0?e.custom:n,i,a)}return t}var Ib=e=>Array.isArray(e),Lb=e=>!!(e&&typeof e==`object`&&e.mix&&e.toValue),Rb=e=>Ib(e)?e[e.length-1]||0:e,zb=e=>!!(e&&e.getVelocity);function Bb(e){let t=zb(e)?e.get():e;return Lb(t)?t.toValue():t}function Vb({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,a){let o={latestValues:Ub(r,i,a,e),renderState:t()};return n&&(o.onMount=e=>n({props:r,current:e,...o}),o.onUpdate=e=>n(e)),o}var Hb=e=>(t,n)=>{let r=(0,L.useContext)(sb),i=(0,L.useContext)(by),a=()=>Vb(e,t,r,i);return n?a():yy(a)};function Ub(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Bb(a[e]);let{initial:o,animate:s}=e,c=fb(e),l=pb(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!lb(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=Fb(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Wb=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Gb=new Set(Wb),Kb=e=>t=>typeof t==`string`&&t.startsWith(e),qb=Kb(`--`),Jb=Kb(`var(--`),Yb=e=>Jb(e)?Xb.test(e.split(`/*`)[0].trim()):!1,Xb=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zb=(e,t)=>t&&typeof e==`number`?t.transform(e):e,Qb=(e,t,n)=>n>t?t:n<e?e:n,$b={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},ex={...$b,transform:e=>Qb(0,1,e)},tx={...$b,default:1},nx=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),rx=nx(`deg`),ix=nx(`%`),Z=nx(`px`),ax=nx(`vh`),ox=nx(`vw`),sx={...ix,parse:e=>ix.parse(e)/100,transform:e=>ix.transform(e*100)},cx={borderWidth:Z,borderTopWidth:Z,borderRightWidth:Z,borderBottomWidth:Z,borderLeftWidth:Z,borderRadius:Z,radius:Z,borderTopLeftRadius:Z,borderTopRightRadius:Z,borderBottomRightRadius:Z,borderBottomLeftRadius:Z,width:Z,maxWidth:Z,height:Z,maxHeight:Z,top:Z,right:Z,bottom:Z,left:Z,padding:Z,paddingTop:Z,paddingRight:Z,paddingBottom:Z,paddingLeft:Z,margin:Z,marginTop:Z,marginRight:Z,marginBottom:Z,marginLeft:Z,backgroundPositionX:Z,backgroundPositionY:Z},lx={rotate:rx,rotateX:rx,rotateY:rx,rotateZ:rx,scale:tx,scaleX:tx,scaleY:tx,scaleZ:tx,skew:rx,skewX:rx,skewY:rx,distance:Z,translateX:Z,translateY:Z,translateZ:Z,x:Z,y:Z,z:Z,perspective:Z,transformPerspective:Z,opacity:ex,originX:sx,originY:sx,originZ:Z},ux={...$b,transform:Math.round},dx={...cx,...lx,zIndex:ux,size:Z,fillOpacity:ex,strokeOpacity:ex,numOctaves:ux},fx={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},px=Wb.length;function mx(e,t,n){let r=``,i=!0;for(let a=0;a<px;a++){let o=Wb[a],s=e[o];if(s===void 0)continue;let c=!0;if(c=typeof s==`number`?s===+!!o.startsWith(`scale`):parseFloat(s)===0,!c||n){let e=Zb(s,dx[o]);if(!c){i=!1;let t=fx[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function hx(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Gb.has(e)){o=!0;continue}else if(qb(e)){i[e]=n;continue}else{let t=Zb(n,dx[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=mx(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var gx={offset:`stroke-dashoffset`,array:`stroke-dasharray`},_x={offset:`strokeDashoffset`,array:`strokeDasharray`};function vx(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?gx:_x;e[a.offset]=Z.transform(-r);let o=Z.transform(t),s=Z.transform(n);e[a.array]=`${o} ${s}`}function yx(e,t,n){return typeof e==`string`?e:Z.transform(t+n*e)}function bx(e,t,n){return`${yx(t,e.x,e.width)} ${yx(n,e.y,e.height)}`}function xx(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:a,pathLength:o,pathSpacing:s=1,pathOffset:c=0,...l},u,d){if(hx(e,l,d),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:f,style:p,dimensions:m}=e;f.transform&&(m&&(p.transform=f.transform),delete f.transform),m&&(i!==void 0||a!==void 0||p.transform)&&(p.transformOrigin=bx(m,i===void 0?.5:i,a===void 0?.5:a)),t!==void 0&&(f.x=t),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),o!==void 0&&vx(f,o,s,c,!1)}var Sx=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Cx=()=>({...Sx(),attrs:{}}),wx=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Tx(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(let t in n)e.style.setProperty(t,n[t])}var Ex=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]);function Dx(e,t,n,r){Tx(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Ex.has(n)?n:bb(n),t.attrs[n])}var Ox={};function kx(e){Object.assign(Ox,e)}function Ax(e,{layout:t,layoutId:n}){return Gb.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ox[e]||e===`opacity`)}function jx(e,t,n){let{style:r}=e,i={};for(let a in r)(zb(r[a])||t.style&&zb(t.style[a])||Ax(a,e)||n?.getValue(a)?.liveStyle!==void 0)&&(i[a]=r[a]);return i}function Mx(e,t,n){let r=jx(e,t,n);for(let n in e)if(zb(e[n])||zb(t[n])){let t=Wb.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}function Nx(e,t){try{t.dimensions=typeof e.getBBox==`function`?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}var Px=[`x`,`y`,`width`,`height`,`cx`,`cy`,`r`],Fx={useVisualState:Hb({scrapeMotionValuesFromProps:Mx,createRenderState:Cx,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let a=!!e.drag;if(!a){for(let e in i)if(Gb.has(e)){a=!0;break}}if(!a)return;let o=!t;if(t)for(let n=0;n<Px.length;n++){let r=Px[n];e[r]!==t[r]&&(o=!0)}o&&Wy.read(()=>{Nx(n,r),Wy.render(()=>{xx(r,i,wx(n.tagName),e.transformTemplate),Dx(n,r)})})}})},Ix={useVisualState:Hb({scrapeMotionValuesFromProps:jx,createRenderState:Sx})};function Lx(e,t,n){for(let r in t)!zb(t[r])&&!Ax(r,n)&&(e[r]=t[r])}function Rx({transformTemplate:e},t){return(0,L.useMemo)(()=>{let n=Sx();return hx(n,t,e),Object.assign({},n.vars,n.style)},[t])}function zx(e,t){let n=e.style||{},r={};return Lx(r,n,e),Object.assign(r,Rx(e,t)),r}function Bx(e,t){let n={},r=zx(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function Vx(e,t,n,r){let i=(0,L.useMemo)(()=>{let n=Cx();return xx(n,t,wx(r),e.transformTemplate),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Lx(t,e.style,e),i.style={...t,...i.style}}return i}function Hx(e=!1){return(t,n,r,{latestValues:i},a)=>{let o=(Nb(t)?Vx:Bx)(n,i,a,t),s=ab(n,typeof t==`string`,e),c=t===L.Fragment?{}:{...s,...o,ref:r},{children:l}=n,u=(0,L.useMemo)(()=>zb(l)?l.get():l,[l]);return(0,L.createElement)(t,{...c,children:u})}}function Ux(e,t){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Ob({...Nb(n)?Fx:Ix,preloadedFeatures:e,useRender:Hx(r),createVisualElement:t,Component:n})}}function Wx(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Gx(e,t,n){let r=e.getProps();return Fb(r,t,n===void 0?r.custom:n,e)}var Kx=Fy(()=>window.ScrollTimeline!==void 0),qx=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>`finished`in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e,t){let n=this.animations.map(n=>{if(Kx()&&n.attachTimeline)return n.attachTimeline(e);if(typeof t==`function`)return t(n)});return()=>{n.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get startTime(){return this.getAll(`startTime`)}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll(`flatten`)}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}},Jx=class extends qx{then(e,t){return Promise.all(this.animations).then(e).catch(t)}};function Yx(e,t){return e?e[t]||e.default||e:void 0}var Xx=2e4;function Zx(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Qx(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Zx(r),Xx);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ry(i)}}function $x(e){return typeof e==`function`}function eS(e,t){e.timeline=t,e.onfinish=null}var tS=e=>Array.isArray(e)&&typeof e[0]==`number`,nS={linearEasing:void 0};function rS(e,t){let n=Fy(e);return()=>nS[t]??n()}var iS=rS(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),aS=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=e(Iy(0,i-1,t))+`, `;return`linear(${r.substring(0,r.length-2)})`};function oS(e){return!!(typeof e==`function`&&iS()||!e||typeof e==`string`&&(e in cS||iS())||tS(e)||Array.isArray(e)&&e.every(oS))}var sS=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,cS={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:sS([0,.65,.55,1]),circOut:sS([.55,0,1,.45]),backIn:sS([.31,.01,.66,-.59]),backOut:sS([.33,1.53,.69,.99])};function lS(e,t){if(e)return typeof e==`function`&&iS()?aS(e,t):tS(e)?sS(e):Array.isArray(e)?e.map(e=>lS(e,t)||cS.easeOut):cS[e]}var uS={x:!1,y:!1};function dS(){return uS.x||uS.y}function fS(e,t,n){if(e instanceof Element)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function pS(e,t){let n=fS(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function mS(e){return t=>{t.pointerType===`touch`||dS()||e(t)}}function hS(e,t,n={}){let[r,i,a]=pS(e,n),o=mS(e=>{let{target:n}=e,r=t(e);if(typeof r!=`function`||!n)return;let a=mS(e=>{r(e),n.removeEventListener(`pointerleave`,a)});n.addEventListener(`pointerleave`,a,i)});return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var gS=(e,t)=>t?e===t?!0:gS(e,t.parentElement):!1,_S=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,vS=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function yS(e){return vS.has(e.tagName)||e.tabIndex!==-1}var bS=new WeakSet;function xS(e){return t=>{t.key===`Enter`&&e(t)}}function SS(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var CS=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=xS(()=>{if(bS.has(n))return;SS(n,`down`);let e=xS(()=>{SS(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>SS(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function wS(e){return _S(e)&&!dS()}function TS(e,t,n={}){let[r,i,a]=pS(e,n),o=e=>{let r=e.currentTarget;if(!wS(e)||bS.has(r))return;bS.add(r);let a=t(e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),!(!wS(e)||!bS.has(r))&&(bS.delete(r),typeof a==`function`&&a(e,{success:t}))},s=e=>{o(e,n.useGlobalTarget||gS(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{!yS(e)&&e.getAttribute(`tabindex`)===null&&(e.tabIndex=0),(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),e.addEventListener(`focus`,e=>CS(e,i),i)}),a}function ES(e){return e===`x`||e===`y`?uS[e]?null:(uS[e]=!0,()=>{uS[e]=!1}):uS.x||uS.y?null:(uS.x=uS.y=!0,()=>{uS.x=uS.y=!1})}var DS=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Wb]),OS;function kS(){OS=void 0}var AS={now:()=>(OS===void 0&&AS.set(Ky.isProcessing||zy.useManualTiming?Ky.timestamp:performance.now()),OS),set:e=>{OS=e,queueMicrotask(kS)}};function jS(e,t){e.indexOf(t)===-1&&e.push(t)}function MS(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var NS=class{constructor(){this.subscriptions=[]}add(e){return jS(this.subscriptions,e),()=>MS(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};function PS(e,t){return t?1e3/t*e:0}var FS=30,IS=e=>!isNaN(parseFloat(e)),LS={current:void 0},RS=class{constructor(e,t={}){this.version=`11.18.2`,this.canTrackVelocity=null,this.events={},this.updateAndNotify=(e,t=!0)=>{let n=AS.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=AS.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=IS(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new NS);let n=this.events[e].add(t);return e===`change`?()=>{n(),Wy.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return LS.current&&LS.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=AS.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>FS)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,FS);return PS(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function zS(e,t){return new RS(e,t)}function BS(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,zS(n))}function VS(e,t){let{transitionEnd:n={},transition:r={},...i}=Gx(e,t)||{};i={...i,...n};for(let t in i)BS(e,t,Rb(i[t]))}function HS(e){return!!(zb(e)&&e.add)}function US(e,t){let n=e.getValue(`willChange`);if(HS(n))return n.add(t)}function WS(e){return e.props[xb]}var GS={current:!1},KS=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,qS=1e-7,JS=12;function YS(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=KS(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>qS&&++s<JS);return o}function XS(e,t,n,r){if(e===t&&n===r)return My;let i=t=>YS(t,0,1,e,n);return e=>e===0||e===1?e:KS(i(e),t,r)}var ZS=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,QS=e=>t=>1-e(1-t),$S=XS(.33,1.53,.69,.99),eC=QS($S),tC=ZS(eC),nC=e=>(e*=2)<1?.5*eC(e):.5*(2-2**(-10*(e-1))),rC=e=>1-Math.sin(Math.acos(e)),iC=QS(rC),aC=ZS(rC),oC=e=>/^0[^.\s]+$/u.test(e);function sC(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||oC(e)}var cC=e=>Math.round(e*1e5)/1e5,lC=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function uC(e){return e==null}var dC=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,fC=(e,t)=>n=>!!(typeof n==`string`&&dC.test(n)&&n.startsWith(e)||t&&!uC(n)&&Object.prototype.hasOwnProperty.call(n,t)),pC=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(lC);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},mC=e=>Qb(0,255,e),hC={...$b,transform:e=>Math.round(mC(e))},gC={test:fC(`rgb`,`red`),parse:pC(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+hC.transform(e)+`, `+hC.transform(t)+`, `+hC.transform(n)+`, `+cC(ex.transform(r))+`)`};function _C(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var vC={test:fC(`#`),parse:_C,transform:gC.transform},yC={test:fC(`hsl`,`hue`),parse:pC(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+ix.transform(cC(t))+`, `+ix.transform(cC(n))+`, `+cC(ex.transform(r))+`)`},bC={test:e=>gC.test(e)||vC.test(e)||yC.test(e),parse:e=>gC.test(e)?gC.parse(e):yC.test(e)?yC.parse(e):vC.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?gC.transform(e):yC.transform(e)},xC=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function SC(e){return isNaN(e)&&typeof e==`string`&&(e.match(lC)?.length||0)+(e.match(xC)?.length||0)>0}var CC=`number`,wC=`color`,TC=`var`,EC=`var(`,DC="${}",OC=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function kC(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(OC,e=>(bC.test(e)?(r.color.push(a),i.push(wC),n.push(bC.parse(e))):e.startsWith(EC)?(r.var.push(a),i.push(TC),n.push(e)):(r.number.push(a),i.push(CC),n.push(parseFloat(e))),++a,DC)).split(DC),indexes:r,types:i}}function AC(e){return kC(e).values}function jC(e){let{split:t,types:n}=kC(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===CC?i+=cC(e[a]):t===wC?i+=bC.transform(e[a]):i+=e[a]}return i}}var MC=e=>typeof e==`number`?0:e;function NC(e){let t=AC(e);return jC(e)(t.map(MC))}var PC={test:SC,parse:AC,createTransformer:jC,getAnimatableNone:NC},FC=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function IC(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(lC)||[];if(!r)return e;let i=n.replace(r,``),a=+!!FC.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var LC=/\b([a-z-]*)\(.*?\)/gu,RC={...PC,getAnimatableNone:e=>{let t=e.match(LC);return t?t.map(IC).join(` `):e}},zC={...dx,color:bC,backgroundColor:bC,outlineColor:bC,fill:bC,stroke:bC,borderColor:bC,borderTopColor:bC,borderRightColor:bC,borderBottomColor:bC,borderLeftColor:bC,filter:RC,WebkitFilter:RC},BC=e=>zC[e];function VC(e,t){let n=BC(e);return n!==RC&&(n=PC),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var HC=new Set([`auto`,`none`,`0`]);function UC(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!HC.has(t)&&kC(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=VC(n,i)}var WC=e=>e===$b||e===Z,GC=(e,t)=>parseFloat(e.split(`, `)[t]),KC=(e,t)=>(n,{transform:r})=>{if(r===`none`||!r)return 0;let i=r.match(/^matrix3d\((.+)\)$/u);if(i)return GC(i[1],t);{let t=r.match(/^matrix\((.+)\)$/u);return t?GC(t[1],e):0}},qC=new Set([`x`,`y`,`z`]),JC=Wb.filter(e=>!qC.has(e));function YC(e){let t=[];return JC.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var XC={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:KC(4,13),y:KC(5,14)};XC.translateX=XC.x,XC.translateY=XC.y;var ZC=new Set,QC=!1,$C=!1;function ew(){if($C){let e=Array.from(ZC).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=YC(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{var r;(r=e.getValue(t))==null||r.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}$C=!1,QC=!1,ZC.forEach(e=>e.complete()),ZC.clear()}function tw(){ZC.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&($C=!0)})}function nw(){tw(),ew()}var rw=class{constructor(e,t,n,r,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ZC.add(this),QC||(QC=!0,Wy.read(tw),Wy.resolveKeyframes(ew))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),ZC.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,ZC.delete(this))}resume(){this.isComplete||this.scheduleResolve()}},iw=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),aw=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ow(e){let t=aw.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var sw=4;function cw(e,t,n=1){Py(n<=sw,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);let[r,i]=ow(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return iw(e)?parseFloat(e):e}return Yb(i)?cw(i,t,n+1):i}var lw=e=>t=>t.test(e),uw=[$b,Z,ix,rx,ox,ax,{test:e=>e===`auto`,parse:e=>e}],dw=e=>uw.find(lw(e)),fw=class extends rw{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Yb(r))){let i=cw(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!DS.has(n)||e.length!==2)return;let[r,i]=e,a=dw(r),o=dw(i);if(a!==o)if(WC(a)&&WC(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)sC(e[t])&&n.push(t);n.length&&UC(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=XC[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=XC[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},pw=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(PC.test(e)||e===`0`)&&!e.startsWith(`url(`));function mw(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function hw(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=pw(i,t),s=pw(a,t);return Ny(o===s,`You are trying to animate ${t} from "${i}" to "${a}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${a} via the \`style\` property.`),!o||!s?!1:mw(e)||(n===`spring`||$x(n))&&r}var gw=e=>e!==null;function _w(e,{repeat:t,repeatType:n=`loop`},r){let i=e.filter(gw),a=t&&n!==`loop`&&t%2==1?0:i.length-1;return!a||r===void 0?i[a]:r}var vw=40,yw=class{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=AS.now(),this.options={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>vw?this.resolvedAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&nw(),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=AS.now(),this.hasAttemptedResolve=!0;let{name:n,type:r,velocity:i,delay:a,onComplete:o,onUpdate:s,isGenerator:c}=this.options;if(!c&&!hw(e,n,r,i))if(GS.current||!a){s&&s(_w(e,this.options,t)),o&&o(),this.resolveFinishedPromise();return}else this.options.duration=0;let l=this.initPlayback(e,t);l!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...l},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type=`keyframes`,this.options.ease=`linear`}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}},bw=(e,t,n)=>e+(t-e)*n;function xw(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Sw({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=xw(s,r,e+1/3),a=xw(s,r,e),o=xw(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Cw(e,t){return n=>n>0?t:e}var ww=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Tw=[vC,gC,yC],Ew=e=>Tw.find(t=>t.test(e));function Dw(e){let t=Ew(e);if(Ny(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`),!t)return!1;let n=t.parse(e);return t===yC&&(n=Sw(n)),n}var Ow=(e,t)=>{let n=Dw(e),r=Dw(t);if(!n||!r)return Cw(e,t);let i={...n};return e=>(i.red=ww(n.red,r.red,e),i.green=ww(n.green,r.green,e),i.blue=ww(n.blue,r.blue,e),i.alpha=bw(n.alpha,r.alpha,e),gC.transform(i))},kw=(e,t)=>n=>t(e(n)),Aw=(...e)=>e.reduce(kw),jw=new Set([`none`,`hidden`]);function Mw(e,t){return jw.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Nw(e,t){return n=>bw(e,t,n)}function Pw(e){return typeof e==`number`?Nw:typeof e==`string`?Yb(e)?Cw:bC.test(e)?Ow:Rw:Array.isArray(e)?Fw:typeof e==`object`?bC.test(e)?Ow:Iw:Cw}function Fw(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Pw(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Iw(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Pw(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Lw(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Rw=(e,t)=>{let n=PC.createTransformer(t),r=kC(e),i=kC(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?jw.has(e)&&!i.values.length||jw.has(t)&&!r.values.length?Mw(e,t):Aw(Fw(Lw(r,i),i.values),n):(Ny(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Cw(e,t))};function zw(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?bw(e,t,n):Pw(e)(e,t)}var Bw=5;function Vw(e,t,n){let r=Math.max(t-Bw,0);return PS(n-e(r),t-r)}var Hw={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Uw=.001;function Ww({duration:e=Hw.duration,bounce:t=Hw.bounce,velocity:n=Hw.velocity,mass:r=Hw.mass}){let i,a;Ny(e<=Ly(Hw.maxDuration),`Spring duration must be 10 seconds or less`);let o=1-t;o=Qb(Hw.minDamping,Hw.maxDamping,o),e=Qb(Hw.minDuration,Hw.maxDuration,Ry(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=qw(t,o),c=Math.exp(-i);return Uw-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=qw(t**2,o);return(-i(t)+Uw>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Uw+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Kw(i,a,s);if(e=Ly(e),isNaN(c))return{stiffness:Hw.stiffness,damping:Hw.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Gw=12;function Kw(e,t,n){let r=n;for(let n=1;n<Gw;n++)r-=e(r)/t(r);return r}function qw(e,t){return e*Math.sqrt(1-t*t)}var Jw=[`duration`,`bounce`],Yw=[`stiffness`,`damping`,`mass`];function Xw(e,t){return t.some(t=>e[t]!==void 0)}function Zw(e){let t={velocity:Hw.velocity,stiffness:Hw.stiffness,damping:Hw.damping,mass:Hw.mass,isResolvedFromDuration:!1,...e};if(!Xw(e,Yw)&&Xw(e,Jw))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Qb(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Hw.mass,stiffness:i,damping:a}}else{let n=Ww(e);t={...t,...n,mass:Hw.mass},t.isResolvedFromDuration=!0}return t}function Qw(e=Hw.visualDuration,t=Hw.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Zw({...n,velocity:-Ry(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Ry(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Hw.restSpeed.granular:Hw.restSpeed.default,i||=v?Hw.restDelta.granular:Hw.restDelta.default;let y;if(h<1){let e=qw(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=0;h<1&&(n=e===0?Ly(m):Vw(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Zx(b),Xx),t=aS(t=>b.next(e*t).value,e,30);return e+`ms `+t}};return b}function $w({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Qw({keyframes:[f.value,m(f.value)],velocity:Vw(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}var eT=XS(.42,0,1,1),tT=XS(0,0,.58,1),nT=XS(.42,0,.58,1),rT=e=>Array.isArray(e)&&typeof e[0]!=`number`,iT={linear:My,easeIn:eT,easeInOut:nT,easeOut:tT,circIn:rC,circInOut:aC,circOut:iC,backIn:eC,backInOut:tC,backOut:$S,anticipate:nC},aT=e=>{if(tS(e)){Py(e.length===4,`Cubic bezier arrays must contain four numerical values.`);let[t,n,r,i]=e;return XS(t,n,r,i)}else if(typeof e==`string`)return Py(iT[e]!==void 0,`Invalid easing type '${e}'`),iT[e];return e};function oT(e,t,n){let r=[],i=n||zw,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Aw(Array.isArray(t)?t[n]||My:t,a)),r.push(a)}return r}function sT(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(Py(a===t.length,`Both input and output ranges must be the same length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=oT(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Iy(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Qb(e[0],e[a-1],t)):l}function cT(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Iy(0,t,r);e.push(bw(n,1,i))}}function lT(e){let t=[0];return cT(t,e.length-1),t}function uT(e,t){return e.map(e=>e*t)}function dT(e,t){return e.map(()=>t||nT).splice(0,e.length-1)}function fT({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=rT(r)?r.map(aT):aT(r),a={done:!1,value:t[0]},o=sT(uT(n&&n.length===t.length?n:lT(t),e),t,{ease:Array.isArray(i)?i:dT(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var pT=e=>{let t=({timestamp:t})=>e(t);return{start:()=>Wy.update(t,!0),stop:()=>Gy(t),now:()=>Ky.isProcessing?Ky.timestamp:AS.now()}},mT={decay:$w,inertia:$w,tween:fT,keyframes:fT,spring:Qw},hT=e=>e/100,gT=class extends yw{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState=`running`,this.startTime=null,this.state=`idle`,this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state===`idle`)return;this.teardown();let{onStop:e}=this.options;e&&e()};let{name:t,motionValue:n,element:r,keyframes:i}=this.options,a=r?.KeyframeResolver||rw,o=(e,t)=>this.onKeyframesResolved(e,t);this.resolver=new a(i,o,t,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){let{type:t=`keyframes`,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=this.options,o=$x(t)?t:mT[t]||fT,s,c;o!==fT&&typeof e[0]!=`number`&&(s=Aw(hT,zw(e[0],e[1])),e=[0,100]);let l=o({...this.options,keyframes:e});i===`mirror`&&(c=o({...this.options,keyframes:[...e].reverse(),velocity:-a})),l.calculatedDuration===null&&(l.calculatedDuration=Zx(l));let{calculatedDuration:u}=l,d=u+r,f=d*(n+1)-r;return{generator:l,mirroredGenerator:c,mapPercentToKeyframes:s,calculatedDuration:u,resolvedDuration:d,totalDuration:f}}onPostResolved(){let{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState===`paused`||!e?this.pause():this.state=this.pendingPlayState}tick(e,t=!1){let{resolved:n}=this;if(!n){let{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}let{finalKeyframe:r,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:s,calculatedDuration:c,totalDuration:l,resolvedDuration:u}=n;if(this.startTime===null)return i.next(0);let{delay:d,repeat:f,repeatType:p,repeatDelay:m,onUpdate:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-l/this.speed,this.startTime)),t?this.currentTime=e:this.holdTime===null?this.currentTime=Math.round(e-this.startTime)*this.speed:this.currentTime=this.holdTime;let g=this.currentTime-d*(this.speed>=0?1:-1),_=this.speed>=0?g<0:g>l;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=l);let v=this.currentTime,y=i;if(f){let e=Math.min(this.currentTime,l)/u,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,f+1),t%2&&(p===`reverse`?(n=1-n,m&&(n-=m/u)):p===`mirror`&&(y=a)),v=Qb(0,1,n)*u}let b=_?{done:!1,value:s[0]}:y.next(v);o&&(b.value=o(b.value));let{done:x}=b;!_&&c!==null&&(x=this.speed>=0?this.currentTime>=l:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&r!==void 0&&(b.value=_w(s,this.options,r)),h&&h(b.value),S&&this.finish(),b}get duration(){let{resolved:e}=this;return e?Ry(e.calculatedDuration):0}get time(){return Ry(this.currentTime)}set time(e){e=Ly(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ry(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState=`running`;return}if(this.isStopped)return;let{driver:e=pT,onPlay:t,startTime:n}=this.options;this.driver||=e(e=>this.tick(e)),t&&t();let r=this.driver.now();this.holdTime===null?this.startTime?this.state===`finished`&&(this.startTime=r):this.startTime=n??this.calcStartTime():this.startTime=r-this.holdTime,this.state===`finished`&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state=`running`,this.driver.start()}pause(){if(!this._resolved){this.pendingPlayState=`paused`;return}this.state=`paused`,this.holdTime=this.currentTime??0}complete(){this.state!==`running`&&this.play(),this.pendingPlayState=this.state=`finished`,this.holdTime=null}finish(){this.teardown(),this.state=`finished`;let{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state=`idle`,this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}},_T=new Set([`opacity`,`clipPath`,`filter`,`transform`]);function vT(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeInOut`,times:c}={}){let l={[t]:n};c&&(l.offset=c);let u=lS(s,i);return Array.isArray(u)&&(l.easing=u),e.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?`linear`:u,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`})}var yT=Fy(()=>Object.hasOwnProperty.call(Element.prototype,`animate`)),bT=10,xT=2e4;function ST(e){return $x(e.type)||e.type===`spring`||!oS(e.ease)}function CT(e,t){let n=new gT({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0}),r={done:!1,value:e[0]},i=[],a=0;for(;!r.done&&a<xT;)r=n.sample(a),i.push(r.value),a+=bT;return{times:void 0,keyframes:i,duration:a-bT,ease:`linear`}}var wT={anticipate:nC,backInOut:tC,circInOut:aC};function TT(e){return e in wT}var ET=class extends yw{constructor(e){super(e);let{name:t,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new fw(i,(e,t)=>this.onKeyframesResolved(e,t),t,n,r),this.resolver.scheduleResolve()}initPlayback(e,t){let{duration:n=300,times:r,ease:i,type:a,motionValue:o,name:s,startTime:c}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i==`string`&&iS()&&TT(i)&&(i=wT[i]),ST(this.options)){let{onComplete:t,onUpdate:o,motionValue:s,element:c,...l}=this.options,u=CT(e,l);e=u.keyframes,e.length===1&&(e[1]=e[0]),n=u.duration,r=u.times,i=u.ease,a=`keyframes`}let l=vT(o.owner.current,s,e,{...this.options,duration:n,times:r,ease:i});return l.startTime=c??this.calcStartTime(),this.pendingTimeline?(eS(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{let{onComplete:n}=this.options;o.set(_w(e,this.options,t)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:n,times:r,type:a,ease:i,keyframes:e}}get duration(){let{resolved:e}=this;if(!e)return 0;let{duration:t}=e;return Ry(t)}get time(){let{resolved:e}=this;if(!e)return 0;let{animation:t}=e;return Ry(t.currentTime||0)}set time(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.currentTime=Ly(e)}get speed(){let{resolved:e}=this;if(!e)return 1;let{animation:t}=e;return t.playbackRate}set speed(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.playbackRate=e}get state(){let{resolved:e}=this;if(!e)return`idle`;let{animation:t}=e;return t.playState}get startTime(){let{resolved:e}=this;if(!e)return null;let{animation:t}=e;return t.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{let{resolved:t}=this;if(!t)return My;let{animation:n}=t;eS(n,e)}return My}play(){if(this.isStopped)return;let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.playState===`finished`&&this.updateFinishedPromise(),t.play()}pause(){let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state===`idle`)return;this.resolveFinishedPromise(),this.updateFinishedPromise();let{resolved:e}=this;if(!e)return;let{animation:t,keyframes:n,duration:r,type:i,ease:a,times:o}=e;if(t.playState===`idle`||t.playState===`finished`)return;if(this.time){let{motionValue:e,onUpdate:t,onComplete:s,element:c,...l}=this.options,u=new gT({...l,keyframes:n,duration:r,type:i,ease:a,times:o,isGenerator:!0}),d=Ly(this.time);e.setWithVelocity(u.sample(d-bT).value,u.sample(d).value,bT)}let{onStop:s}=this.options;s&&s(),this.cancel()}complete(){let{resolved:e}=this;e&&e.animation.finish()}cancel(){let{resolved:e}=this;e&&e.animation.cancel()}static supports(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!t||!t.owner||!(t.owner.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return yT()&&n&&_T.has(n)&&!s&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}},DT={type:`spring`,stiffness:500,damping:25,restSpeed:10},OT=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),kT={type:`keyframes`,duration:.8},AT={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},jT=(e,{keyframes:t})=>t.length>2?kT:Gb.has(e)?e.startsWith(`scale`)?OT(t[1]):DT:AT;function MT({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}var NT=(e,t,n,r={},i,a)=>o=>{let s=Yx(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Ly(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};MT(s)||(u={...u,...jT(e,u)}),u.duration&&=Ly(u.duration),u.repeatDelay&&=Ly(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(d=!0)),(GS.current||zy.skipAnimations)&&(d=!0,u.duration=0,u.delay=0),d&&!a&&t.get()!==void 0){let e=_w(u.keyframes,s);if(e!==void 0)return Wy.update(()=>{u.onUpdate(e),u.onComplete()}),new Jx([])}return!a&&ET.supports(u)?new ET(u):new gT(u)};function PT({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function FT(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...s}=t;r&&(a=r);let c=[],l=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||l&&PT(l,t))continue;let o={delay:n,...Yx(a||{},t)},u=!1;if(window.MotionHandoffAnimation){let n=WS(e);if(n){let e=window.MotionHandoffAnimation(n,t,Wy);e!==null&&(o.startTime=e,u=!0)}}US(e,t),r.start(NT(t,r,i,e.shouldReduceMotion&&DS.has(t)?{type:!1}:o,e,u));let d=r.animation;d&&c.push(d)}return o&&Promise.all(c).then(()=>{Wy.update(()=>{o&&VS(e,o)})}),c}function IT(e,t,n={}){let r=Gx(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(FT(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return LT(e,t,a+r,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function LT(e,t,n=0,r=0,i=1,a){let o=[],s=(e.variantChildren.size-1)*r,c=i===1?(e=0)=>e*r:(e=0)=>s-e*r;return Array.from(e.variantChildren).sort(RT).forEach((e,r)=>{e.notify(`AnimationStart`,t),o.push(IT(e,t,{...a,delay:n+c(r)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(o)}function RT(e,t){return e.sortNodePosition(t)}function zT(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>IT(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=IT(e,t,n);else{let i=typeof t==`function`?Gx(e,t,n.custom):t;r=Promise.all(FT(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var BT=db.length;function VT(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&VT(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<BT;n++){let r=db[n],i=e.props[r];(cb(i)||i===!1)&&(t[r]=i)}return t}var HT=[...ub].reverse(),UT=ub.length;function WT(e){return t=>Promise.all(t.map(({animation:t,options:n})=>zT(e,t,n)))}function GT(e){let t=WT(e),n=JT(),r=!0,i=t=>(n,r)=>{let i=Gx(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function a(n){t=n(e)}function o(a){let{props:o}=e,s=VT(e.parent)||{},c=[],l=new Set,u={},d=1/0;for(let t=0;t<UT;t++){let f=HT[t],p=n[f],m=o[f]===void 0?s[f]:o[f],h=cb(m),g=f===a?p.isActive:null;g===!1&&(d=t);let _=m===s[f]&&m!==o[f]&&h;if(_&&r&&e.manuallyAnimateOnMount&&(_=!1),p.protectedKeys={...u},!p.isActive&&g===null||!m&&!p.prevProp||lb(m)||typeof m==`boolean`)continue;let v=KT(p.prevProp,m),y=v||f===a&&p.isActive&&!_&&h||t>d&&h,b=!1,x=Array.isArray(m)?m:[m],S=x.reduce(i(f),{});g===!1&&(S={});let{prevResolvedValues:C={}}=p,w={...C,...S},T=t=>{y=!0,l.has(t)&&(b=!0,l.delete(t)),p.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in w){let t=S[e],n=C[e];if(u.hasOwnProperty(e))continue;let r=!1;r=Ib(t)&&Ib(n)?!Wx(t,n):t!==n,r?t==null?l.add(e):T(e):t!==void 0&&l.has(e)?T(e):p.protectedKeys[e]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),r&&e.blockInitialAnimation&&(y=!1),y&&(!(_&&v)||b)&&c.push(...x.map(e=>({animation:e,options:{type:f}})))}if(l.size){let t={};l.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),c.push({animation:t})}let f=!!c.length;return r&&(o.initial===!1||o.initial===o.animate)&&!e.manuallyAnimateOnMount&&(f=!1),r=!1,f?t(c):Promise.resolve()}function s(t,r){var i;if(n[t].isActive===r)return Promise.resolve();(i=e.variantChildren)==null||i.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let a=o(t);for(let e in n)n[e].protectedKeys={};return a}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=JT(),r=!0}}}function KT(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Wx(t,e):!1}function qT(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function JT(){return{animate:qT(!0),whileInView:qT(),whileHover:qT(),whileTap:qT(),whileDrag:qT(),whileFocus:qT(),exit:qT()}}var YT=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},XT=class extends YT{constructor(e){super(e),e.animationState||=GT(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();lb(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}},ZT=0,QT={animation:{Feature:XT},exit:{Feature:class extends YT{constructor(){super(...arguments),this.id=ZT++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>t(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}};function $T(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function eE(e){return{point:{x:e.pageX,y:e.pageY}}}var tE=e=>t=>_S(t)&&e(t,eE(t));function nE(e,t,n,r){return $T(e,t,tE(n),r)}var rE=(e,t)=>Math.abs(e-t);function iE(e,t){let n=rE(e.x,t.x),r=rE(e.y,t.y);return Math.sqrt(n**2+r**2)}var aE=class{constructor(e,t,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=cE(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=iE(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=Ky;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=oE(t,this.transformPagePoint),Wy.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=cE(e.type===`pointercancel`?this.lastMoveEventInfo:oE(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!_S(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.contextWindow=r||window;let a=oE(eE(e),this.transformPagePoint),{point:o}=a,{timestamp:s}=Ky;this.history=[{...o,timestamp:s}];let{onSessionStart:c}=t;c&&c(e,cE(a,this.history)),this.removeListeners=Aw(nE(this.contextWindow,`pointermove`,this.handlePointerMove),nE(this.contextWindow,`pointerup`,this.handlePointerUp),nE(this.contextWindow,`pointercancel`,this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gy(this.updatePoint)}};function oE(e,t){return t?{point:t(e.point)}:e}function sE(e,t){return{x:e.x-t.x,y:e.y-t.y}}function cE({point:e},t){return{point:e,delta:sE(e,uE(t)),offset:sE(e,lE(t)),velocity:dE(t,.1)}}function lE(e){return e[0]}function uE(e){return e[e.length-1]}function dE(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=uE(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Ly(t)));)n--;if(!r)return{x:0,y:0};let a=Ry(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}var fE=1e-4,pE=1-fE,mE=1+fE,hE=.01,gE=0-hE,_E=0+hE;function vE(e){return e.max-e.min}function yE(e,t,n){return Math.abs(e-t)<=n}function bE(e,t,n,r=.5){e.origin=r,e.originPoint=bw(t.min,t.max,e.origin),e.scale=vE(n)/vE(t),e.translate=bw(n.min,n.max,e.origin)-e.originPoint,(e.scale>=pE&&e.scale<=mE||isNaN(e.scale))&&(e.scale=1),(e.translate>=gE&&e.translate<=_E||isNaN(e.translate))&&(e.translate=0)}function xE(e,t,n,r){bE(e.x,t.x,n.x,r?r.originX:void 0),bE(e.y,t.y,n.y,r?r.originY:void 0)}function SE(e,t,n){e.min=n.min+t.min,e.max=e.min+vE(t)}function CE(e,t,n){SE(e.x,t.x,n.x),SE(e.y,t.y,n.y)}function wE(e,t,n){e.min=t.min-n.min,e.max=e.min+vE(t)}function TE(e,t,n){wE(e.x,t.x,n.x),wE(e.y,t.y,n.y)}function EE(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?bw(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?bw(n,e,r.max):Math.min(e,n)),e}function DE(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function OE(e,{top:t,left:n,bottom:r,right:i}){return{x:DE(e.x,n,i),y:DE(e.y,t,r)}}function kE(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function AE(e,t){return{x:kE(e.x,t.x),y:kE(e.y,t.y)}}function jE(e,t){let n=.5,r=vE(e),i=vE(t);return i>r?n=Iy(t.min,t.max-r,e.min):r>i&&(n=Iy(e.min,e.max-i,t.min)),Qb(0,1,n)}function ME(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var NE=.35;function PE(e=NE){return e===!1?e=0:e===!0&&(e=NE),{x:FE(e,`left`,`right`),y:FE(e,`top`,`bottom`)}}function FE(e,t,n){return{min:IE(e,t),max:IE(e,n)}}function IE(e,t){return typeof e==`number`?e:e[t]||0}var LE=()=>({translate:0,scale:1,origin:0,originPoint:0}),RE=()=>({x:LE(),y:LE()}),zE=()=>({min:0,max:0}),BE=()=>({x:zE(),y:zE()});function VE(e){return[e(`x`),e(`y`)]}function HE({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function UE({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function WE(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function GE(e){return e===void 0||e===1}function KE({scale:e,scaleX:t,scaleY:n}){return!GE(e)||!GE(t)||!GE(n)}function qE(e){return KE(e)||JE(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function JE(e){return YE(e.x)||YE(e.y)}function YE(e){return e&&e!==`0%`}function XE(e,t,n){return n+t*(e-n)}function ZE(e,t,n,r,i){return i!==void 0&&(e=XE(e,i,r)),XE(e,n,r)+t}function QE(e,t=0,n=1,r,i){e.min=ZE(e.min,t,n,r,i),e.max=ZE(e.max,t,n,r,i)}function $E(e,{x:t,y:n}){QE(e.x,t.translate,t.scale,t.originPoint),QE(e.y,n.translate,n.scale,n.originPoint)}var eD=.999999999999,tD=1.0000000000001;function nD(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&aD(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,$E(e,o)),r&&qE(a.latestValues)&&aD(e,a.latestValues))}t.x<tD&&t.x>eD&&(t.x=1),t.y<tD&&t.y>eD&&(t.y=1)}function rD(e,t){e.min+=t,e.max+=t}function iD(e,t,n,r,i=.5){QE(e,t,n,bw(e.min,e.max,i),r)}function aD(e,t){iD(e.x,t.x,t.scaleX,t.scale,t.originX),iD(e.y,t.y,t.scaleY,t.scale,t.originY)}function oD(e,t){return HE(WE(e.getBoundingClientRect(),t))}function sD(e,t,n){let r=oD(e,n),{scroll:i}=t;return i&&(rD(r.x,i.offset.x),rD(r.y,i.offset.y)),r}var cD=({current:e})=>e?e.ownerDocument.defaultView:null,lD=new WeakMap,uD=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=BE(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){let{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;let r=e=>{let{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(eE(e).point)},i=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ES(n),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),VE(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ix.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=vE(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&Wy.postRender(()=>i(e,t)),US(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},a=(e,t)=>{let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=fD(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&a(e,t)},o=(e,t)=>this.stop(e,t),s=()=>VE(e=>this.getAnimationState(e)===`paused`&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new aE(e,{onSessionStart:r,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:s},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:cD(this.visualElement)})}stop(e,t){let n=this.isDragging;if(this.cancel(),!n)return;let{velocity:r}=t;this.startAnimation(r);let{onDragEnd:i}=this.getProps();i&&Wy.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!dD(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=EE(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&vb(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=OE(n.layoutBox,e):this.constraints=!1,this.elastic=PE(t),r!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&VE(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=ME(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!vb(e))return!1;let n=e.current;Py(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=sD(n,r.root,this.visualElement.getTransformPagePoint()),a=AE(r.layout.layoutBox,i);if(t){let e=t(UE(a));this.hasMutatedConstraints=!!e,e&&(a=HE(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=VE(o=>{if(!dD(o,t,this.currentDirection))return;let c=s&&s[o]||{};a&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return US(this.visualElement,e),n.start(NT(e,n,0,t,this.visualElement,!1))}stopAnimation(){VE(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){VE(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){VE(t=>{let{drag:n}=this.getProps();if(!dD(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t];i.set(e[t]-bw(n,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!vb(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};VE(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=jE({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),VE(t=>{if(!dD(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(bw(i,a,r[t]))})}addListeners(){if(!this.visualElement.current)return;lD.set(this.visualElement,this);let e=this.visualElement.current,t=nE(e,`pointerdown`,e=>{let{drag:t,dragListener:n=!0}=this.getProps();t&&n&&this.start(e)}),n=()=>{let{dragConstraints:e}=this.getProps();vb(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,i=r.addEventListener(`measure`,n);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),Wy.read(n);let a=$T(window,`resize`,()=>this.scalePositionWithinConstraints()),o=r.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(VE(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{a(),t(),i(),o&&o()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=NE,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function dD(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function fD(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var pD=class extends YT{constructor(e){super(e),this.removeGroupControls=My,this.removeListeners=My,this.controls=new uD(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||My}unmount(){this.removeGroupControls(),this.removeListeners()}},mD=e=>(t,n)=>{e&&Wy.postRender(()=>e(t,n))},hD=class extends YT{constructor(){super(...arguments),this.removePointerDownListener=My}onPointerDown(e){this.session=new aE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cD(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:mD(e),onStart:mD(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&Wy.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=nE(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},gD={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function _D(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var vD={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(Z.test(e))e=parseFloat(e);else return e;return`${_D(e,t.target.x)}% ${_D(e,t.target.y)}%`}},yD={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=PC.parse(e);if(i.length>5)return r;let a=PC.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=bw(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},bD=class extends L.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;kx(SD),i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),gD.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,a=n.projection;return a?(a.isPresent=i,r||e.layoutDependency!==t||t===void 0?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Wy.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Sb.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function xD(e){let[t,n]=Ey(),r=(0,L.useContext)(vy);return(0,B.jsx)(bD,{...e,layoutGroup:r,switchLayoutGroup:(0,L.useContext)(wb),isPresent:t,safeToRemove:n})}var SD={borderRadius:{...vD,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:vD,borderTopRightRadius:vD,borderBottomLeftRadius:vD,borderBottomRightRadius:vD,boxShadow:yD};function CD(e,t,n){let r=zb(e)?e:zS(e);return r.start(NT(``,r,t,n)),r.animation}function wD(e){return e instanceof SVGElement&&e.tagName!==`svg`}var TD=(e,t)=>e.depth-t.depth,ED=class{constructor(){this.children=[],this.isDirty=!1}add(e){jS(this.children,e),this.isDirty=!0}remove(e){MS(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(TD),this.isDirty=!1,this.children.forEach(e)}};function DD(e,t){let n=AS.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(Gy(r),e(a-t))};return Wy.read(r,!0),()=>Gy(r)}var OD=[`TopLeft`,`TopRight`,`BottomLeft`,`BottomRight`],kD=OD.length,AD=e=>typeof e==`string`?parseFloat(e):e,jD=e=>typeof e==`number`||Z.test(e);function MD(e,t,n,r,i,a){i?(e.opacity=bw(0,n.opacity===void 0?1:n.opacity,PD(r)),e.opacityExit=bw(t.opacity===void 0?1:t.opacity,0,FD(r))):a&&(e.opacity=bw(t.opacity===void 0?1:t.opacity,n.opacity===void 0?1:n.opacity,r));for(let i=0;i<kD;i++){let a=`border${OD[i]}Radius`,o=ND(t,a),s=ND(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||jD(o)===jD(s)?(e[a]=Math.max(bw(AD(o),AD(s),r),0),(ix.test(s)||ix.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=bw(t.rotate||0,n.rotate||0,r))}function ND(e,t){return e[t]===void 0?e.borderRadius:e[t]}var PD=ID(0,.5,iC),FD=ID(.5,.95,My);function ID(e,t,n){return r=>r<e?0:r>t?1:n(Iy(e,t,r))}function LD(e,t){e.min=t.min,e.max=t.max}function RD(e,t){LD(e.x,t.x),LD(e.y,t.y)}function zD(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function BD(e,t,n,r,i){return e-=t,e=XE(e,1/n,r),i!==void 0&&(e=XE(e,1/i,r)),e}function VD(e,t=0,n=1,r=.5,i,a=e,o=e){if(ix.test(t)&&(t=parseFloat(t),t=bw(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=bw(a.min,a.max,r);e===a&&(s-=t),e.min=BD(e.min,t,n,s,i),e.max=BD(e.max,t,n,s,i)}function HD(e,t,[n,r,i],a,o){VD(e,t[n],t[r],t[i],t.scale,a,o)}var UD=[`x`,`scaleX`,`originX`],WD=[`y`,`scaleY`,`originY`];function GD(e,t,n,r){HD(e.x,t,UD,n?n.x:void 0,r?r.x:void 0),HD(e.y,t,WD,n?n.y:void 0,r?r.y:void 0)}function KD(e){return e.translate===0&&e.scale===1}function qD(e){return KD(e.x)&&KD(e.y)}function JD(e,t){return e.min===t.min&&e.max===t.max}function YD(e,t){return JD(e.x,t.x)&&JD(e.y,t.y)}function XD(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ZD(e,t){return XD(e.x,t.x)&&XD(e.y,t.y)}function QD(e){return vE(e.x)/vE(e.y)}function $D(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var eO=class{constructor(){this.members=[]}add(e){jS(this.members,e),e.scheduleRender()}remove(e){if(MS(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t=this.members.findIndex(t=>e===t);if(t===0)return!1;let n;for(let e=t;e>=0;e--){let t=this.members[e];if(t.isPresent!==!1){n=t;break}}return n?(this.promote(n),!0):!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;r===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function tO(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var nO={type:`projectionFrame`,totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},rO=typeof window<`u`&&window.MotionDebug!==void 0,iO=[``,`X`,`Y`,`Z`],aO={visibility:`hidden`},oO=1e3,sO=0;function cO(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function lO(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=WS(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Wy,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&lO(r)}function uO({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=sO++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,rO&&(nO.totalNodes=nO.resolvedTargetDeltas=nO.recalculatedProjection=0),this.nodes.forEach(pO),this.nodes.forEach(bO),this.nodes.forEach(xO),this.nodes.forEach(mO),rO&&window.MotionDebug.record(nO)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new ED)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new NS),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,n=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=wD(t),this.instance=t;let{layoutId:r,layout:i,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(i||r)&&(this.isLayoutDirty=!0),e){let n,r=()=>this.root.updateBlockedByResize=!1;e(t,()=>{this.root.updateBlockedByResize=!0,n&&n(),n=DD(r,250),gD.hasAnimatedSinceResize&&(gD.hasAnimatedSinceResize=!1,this.nodes.forEach(yO))})}r&&this.root.registerSharedNode(r,this),this.options.animate!==!1&&a&&(r||i)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let i=this.options.transition||a.getDefaultTransition()||OO,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=a.getProps(),c=!this.targetLayout||!ZD(this.targetLayout,r)||n,l=!t&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,l);let t={...Yx(i,`layout`),onPlay:o,onComplete:s};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||yO(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gy(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(SO),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&lO(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(gO);return}this.isUpdating||this.nodes.forEach(_O),this.isUpdating=!1,this.nodes.forEach(vO),this.nodes.forEach(dO),this.nodes.forEach(fO),this.clearAllSnapshots();let e=AS.now();Ky.delta=Qb(0,1e3/60,e-Ky.timestamp),Ky.timestamp=e,Ky.isProcessing=!0,qy.update.process(Ky),qy.preRender.process(Ky),qy.render.process(Ky),Ky.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Sb.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(hO),this.sharedNodes.forEach(CO)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Wy.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Wy.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected=BE(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!qD(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&(t||qE(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),MO(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return BE();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(PO))){let{scroll:e}=this.root;e&&(rD(t.x,e.offset.x),rD(t.y,e.offset.y))}return t}removeElementScroll(e){let t=BE();if(RD(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&RD(t,e),rD(t.x,i.offset.x),rD(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let n=BE();RD(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&aD(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),qE(r.latestValues)&&aD(n,r.latestValues)}return qE(this.latestValues)&&aD(n,this.latestValues),n}removeTransform(e){let t=BE();RD(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!n.instance||!qE(n.latestValues))continue;KE(n.latestValues)&&n.updateSnapshot();let r=BE();RD(r,n.measurePageBox()),GD(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return qE(this.latestValues)&&GD(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ky.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!(!this.layout||!(r||i))){if(this.resolvedRelativeTargetAt=Ky.timestamp,!this.targetDelta&&!this.relativeTarget){let e=this.getClosestProjectingParent();e&&e.layout&&this.animationProgress!==1?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=BE(),this.relativeTargetOrigin=BE(),TE(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),RD(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=BE(),this.targetWithTransforms=BE()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),CE(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):RD(this.target,this.layout.layoutBox),$E(this.target,this.targetDelta)):RD(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;let e=this.getClosestProjectingParent();e&&!!e.resumingFrom==!!this.resumingFrom&&!e.options.layoutScroll&&e.target&&this.animationProgress!==1?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=BE(),this.relativeTargetOrigin=BE(),TE(this.relativeTargetOrigin,this.target,e.target),RD(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}rO&&nO.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||KE(this.parent.latestValues)||JE(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Ky.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;RD(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;nD(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=BE());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(zD(this.prevProjectionDelta.x,this.projectionDelta.x),zD(this.prevProjectionDelta.y,this.projectionDelta.y)),xE(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!$D(this.projectionDelta.x,this.prevProjectionDelta.x)||!$D(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),rO&&nO.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if((t=this.options.visualElement)==null||t.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=RE(),this.projectionDelta=RE(),this.projectionDeltaWithTransform=RE()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=RE();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=BE(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(DO));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;wO(a.x,e.x,n),wO(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(TE(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),EO(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&YD(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=BE(),RD(d,this.relativeTarget)),s&&(this.animationValues=i,MD(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&=(Gy(this.pendingAnimation),void 0),this.pendingAnimation=Wy.update(()=>{gD.hasAnimatedSinceResize=!0,this.currentAnimation=CD(0,oO,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(oO),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&NO(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||BE();let t=vE(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=vE(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}RD(t,n),aD(t,i),xE(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new eO),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&cO(`z`,e,r,this.animationValues);for(let t=0;t<iO.length;t++)cO(`rotate${iO[t]}`,e,r,this.animationValues),cO(`skew${iO[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}getProjectionStyles(e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return aO;let t={visibility:``},n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.opacity=``,t.pointerEvents=Bb(e?.pointerEvents)||``,t.transform=n?n(this.latestValues,``):`none`,t;let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){let t={};return this.options.layoutId&&(t.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,t.pointerEvents=Bb(e?.pointerEvents)||``),this.hasProjected&&!qE(this.latestValues)&&(t.transform=n?n({},``):`none`,this.hasProjected=!1),t}let i=r.animationValues||r.latestValues;this.applyTransformsToTarget(),t.transform=tO(this.projectionDeltaWithTransform,this.treeScale,i),n&&(t.transform=n(i,t.transform));let{x:a,y:o}=this.projectionDelta;t.transformOrigin=`${a.origin*100}% ${o.origin*100}% 0`,r.animationValues?t.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:t.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let e in Ox){if(i[e]===void 0)continue;let{correct:n,applyTo:a}=Ox[e],o=t.transform===`none`?i[e]:n(i[e],r);if(a){let e=a.length;for(let n=0;n<e;n++)t[a[n]]=o}else t[e]=o}return this.options.layoutId&&(t.pointerEvents=r===this?Bb(e?.pointerEvents)||``:`none`),t}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(gO),this.root.sharedNodes.clear()}}}function dO(e){e.updateLayout()}function fO(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;i===`size`?VE(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=vE(r);r.min=n[e].min,r.max=r.min+i}):NO(i,t.layoutBox,n)&&VE(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=vE(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=RE();xE(o,n,t.layoutBox);let s=RE();a?xE(s,e.applyTransform(r,!0),t.measuredBox):xE(s,n,t.layoutBox);let c=!qD(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=BE();TE(o,t.layoutBox,i.layoutBox);let s=BE();TE(s,n,a.layoutBox),ZD(o,s)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeTargetChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function pO(e){rO&&nO.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function mO(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function hO(e){e.clearSnapshot()}function gO(e){e.clearMeasurements()}function _O(e){e.isLayoutDirty=!1}function vO(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function yO(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function bO(e){e.resolveTargetDelta()}function xO(e){e.calcProjection()}function SO(e){e.resetSkewAndRotation()}function CO(e){e.removeLeadSnapshot()}function wO(e,t,n){e.translate=bw(t.translate,0,n),e.scale=bw(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function TO(e,t,n,r){e.min=bw(t.min,n.min,r),e.max=bw(t.max,n.max,r)}function EO(e,t,n,r){TO(e.x,t.x,n.x,r),TO(e.y,t.y,n.y,r)}function DO(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var OO={duration:.45,ease:[.4,0,.1,1]},kO=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),AO=kO(`applewebkit/`)&&!kO(`chrome/`)?Math.round:My;function jO(e){e.min=AO(e.min),e.max=AO(e.max)}function MO(e){jO(e.x),jO(e.y)}function NO(e,t,n){return e===`position`||e===`preserve-aspect`&&!yE(QD(t),QD(n),.2)}function PO(e){return e!==e.root&&e.scroll?.wasRoot}var FO=uO({attachResizeListener:(e,t)=>$T(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),IO={current:void 0},LO=uO({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!IO.current){let e=new FO({});e.mount(window),e.setOptions({layoutScroll:!0}),IO.current=e}return IO.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),RO={pan:{Feature:hD},drag:{Feature:pD,ProjectionNode:LO,MeasureLayout:xD}};function zO(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&Wy.postRender(()=>i(t,eE(t)))}var BO=class extends YT{mount(){let{current:e}=this.node;e&&(this.unmount=hS(e,e=>(zO(this.node,e,`Start`),e=>zO(this.node,e,`End`))))}unmount(){}},VO=class extends YT{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Aw($T(this.node.current,`focus`,()=>this.onFocus()),$T(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function HO(e,t,n){let{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&Wy.postRender(()=>i(t,eE(t)))}var UO=class extends YT{mount(){let{current:e}=this.node;e&&(this.unmount=TS(e,e=>(HO(this.node,e,`Start`),(e,{success:t})=>HO(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}},WO=new WeakMap,GO=new WeakMap,KO=e=>{let t=WO.get(e.target);t&&t(e)},qO=e=>{e.forEach(KO)};function JO({root:e,...t}){let n=e||document;GO.has(n)||GO.set(n,{});let r=GO.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(qO,{root:e,...t})),r[i]}function YO(e,t,n){let r=JO(t);return WO.set(e,n),r.observe(e),()=>{WO.delete(e),r.unobserve(e)}}var XO={some:0,all:1},ZO=class extends YT{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:XO[r]};return YO(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(QO(e,t))&&this.startObserver()}unmount(){}};function QO({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var $O={inView:{Feature:ZO},tap:{Feature:UO},focus:{Feature:VO},hover:{Feature:BO}},ek={layout:{ProjectionNode:LO,MeasureLayout:xD}},tk={current:null},nk={current:!1};function rk(){if(nk.current=!0,ky)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>tk.current=e.matches;e.addListener(t),t()}else tk.current=!1}var ik=[...uw,bC,PC],ak=e=>ik.find(lw(e)),ok=new WeakMap;function sk(e,t,n){for(let r in t){let i=t[r],a=n[r];if(zb(i))e.addValue(r,i);else if(zb(a))e.addValue(r,zS(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,zS(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var ck=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],lk=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=rw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=AS.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Wy.render(this.render,!1,!0))};let{latestValues:s,renderState:c,onUpdate:l}=a;this.onUpdate=l,this.latestValues=s,this.baseTarget={...s},this.initialValues=t.initial?{...s}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=fb(t),this.isVariantNode=pb(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];s[e]!==void 0&&zb(t)&&t.set(s[e],!1)}}mount(e){this.current=e,ok.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),nk.current||rk(),this.shouldReduceMotion=this.reducedMotionConfig===`never`?!1:this.reducedMotionConfig===`always`?!0:tk.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){ok.delete(this.current),this.projection&&this.projection.unmount(),Gy(this.notifyUpdate),Gy(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=Gb.has(e),r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Wy.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on(`renderRequest`,this.scheduleRender),a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i(),a&&a(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Xy){let t=Xy[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):BE()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<ck.length;t++){let n=ck[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=sk(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=zS(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(iw(n)||oC(n))?n=parseFloat(n):!ak(n)&&PC.test(t)&&(n=VC(e,t)),this.setBaseTarget(e,zb(n)?n.get():n)),zb(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=Fb(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!zb(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new NS),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}},uk=class extends lk{constructor(){super(...arguments),this.KeyframeResolver=fw}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;zb(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}};function dk(e){return window.getComputedStyle(e)}var fk=class extends uk{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Tx}readValueFromInstance(e,t){if(Gb.has(t)){let e=BC(t);return e&&e.default||0}else{let n=dk(e),r=(qb(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return oD(e,t)}build(e,t,n){hx(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return jx(e,t,n)}},pk=class extends uk{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=BE}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Gb.has(t)){let e=BC(t);return e&&e.default||0}return t=Ex.has(t)?t:bb(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Mx(e,t,n)}build(e,t,n){xx(e,t,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,n,r){Dx(e,t,n,r)}mount(e){this.isSVGTag=wx(e.tagName),super.mount(e)}},mk=(e,t)=>Nb(e)?new pk(t):new fk(t,{allowProjection:e!==L.Fragment}),hk=ob(Ux({...QT,...$O,...RO,...ek},mk)),gk=2e3,_k=5e3,vk=1024,yk=2048,bk={"preflight-env-missing":`env missing`,"preflight-file-missing":`file missing`,"preflight-dep-unreachable":`unreachable`,"preflight-budget-exceeded":`budget exceeded`};function xk(e,t,n,r,i){if(e===`env`){let e=t.trim();return e?e.length>256?`Env var name exceeds 256 chars`:null:`Env var name is required`}if(e===`file`){let e=n.trim();return e?e.length>1024?`File path exceeds ${vk} chars`:e.split(/[/\\]/).includes(`..`)?`Path must not contain ".." segments`:null:`File path is required`}let a=r.trim();if(!a)return`URL is required`;if(a.length>2048)return`URL exceeds ${yk} chars`;let o;try{o=new URL(a)}catch{return`URL is not valid`}return o.protocol!==`http:`&&o.protocol!==`https:`?`URL must use http:// or https://`:!Number.isInteger(i)||i<100||i>5e3?`Timeout must be an integer between 100 and ${_k} ms`:null}function Sk(e){return e.kind===`env`?`env:${e.name}`:e.kind===`file`?`file:${e.path}`:`http:${e.url}`}function Ck(e,t){return t?e.kind===`env`?e.name===t:e.kind===`file`?e.path===t:e.kind===`http`?e.url===t:!1:!1}var wk={root:`_root_1bxq7_2`,row:`_row_1bxq7_8`,kindChip:`_kindChip_1bxq7_17`,param:`_param_1bxq7_21`,failureBadge:`_failureBadge_1bxq7_30`,removeBtn:`_removeBtn_1bxq7_39`,addForm:`_addForm_1bxq7_47`,addFormFullWidth:`_addFormFullWidth_1bxq7_55`,emptyState:`_emptyState_1bxq7_65`,saveError:`_saveError_1bxq7_71`,hint:`_hint_1bxq7_77`,timeoutLabel:`_timeoutLabel_1bxq7_83`,timeoutValue:`_timeoutValue_1bxq7_91`};function Tk(e){return e.kind===`env`?e.name:e.kind===`file`?e.path:e.timeoutMs?`${e.url} ${e.timeoutMs}ms`:e.url}function Ek({spec:e,failed:t,failureKind:n,onRemove:r,disabled:i}){let[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(void 0);(0,L.useEffect)(()=>{if(t&&n&&n!==s.current){o(!0),s.current=n;let e=setTimeout(()=>o(!1),3e3);return()=>clearTimeout(e)}t||(s.current=void 0,o(!1))},[t,n]);let c=Tk(e),l=t?n?bk[n]:`failed`:null;return(0,B.jsxs)(`div`,{className:wk.row,"data-testid":`preflight-row`,"data-kind":e.kind,children:[(0,B.jsx)(`span`,{className:wk.kindChip,children:(0,B.jsx)(Du,{size:`sm`,children:e.kind})}),(0,B.jsx)(`span`,{className:wk.param,title:c,children:c}),l?(0,B.jsx)(hk.span,{className:wk.failureBadge,"data-testid":`preflight-failure-badge`,animate:a?{opacity:[1,.45,1,.45,1]}:{opacity:1},transition:{duration:1.5,ease:`easeInOut`},children:l}):(0,B.jsx)(`span`,{}),(0,B.jsx)(F,{variant:`ghost`,size:`sm`,className:wk.removeBtn,onClick:r,disabled:i,"aria-label":`Remove preflight check: ${c}`,title:`Remove check`,children:`×`})]})}function Dk({onAdd:e,disabled:t,existingCount:n}){let[r,i]=(0,L.useState)(`env`),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(gk),[p,m]=(0,L.useState)(null),h=n>=20,g=xk(r,a,s,l,d),_=!t&&!h&&g===null;function v(e){i(e),m(null)}function y(){let t=xk(r,a,s,l,d);if(t){m(t);return}m(null),e(r===`env`?{kind:`env`,name:a.trim()}:r===`file`?{kind:`file`,path:s.trim()}:{kind:`http`,url:l.trim(),timeoutMs:d}),o(``),c(``),u(``),f(gk)}return(0,B.jsxs)(`div`,{className:wk.addForm,"data-testid":`preflight-add-form`,children:[(0,B.jsxs)(ee,{compact:!0,value:r,onChange:e=>v(e.target.value),"aria-label":`Check kind`,children:[(0,B.jsx)(`option`,{value:`env`,children:`env`}),(0,B.jsx)(`option`,{value:`file`,children:`file`}),(0,B.jsx)(`option`,{value:`http`,children:`http`})]}),r===`env`&&(0,B.jsx)(P,{compact:!0,value:a,placeholder:`MY_VAR_NAME`,"aria-label":`Env var name`,onChange:e=>o(e.target.value)}),r===`file`&&(0,B.jsxs)(`div`,{className:wk.addFormFullWidth,children:[(0,B.jsx)(P,{compact:!0,value:s,placeholder:`relative/path or /absolute/path`,"aria-label":`File path`,onChange:e=>c(e.target.value)}),(0,B.jsx)(`div`,{className:wk.hint,children:`Relative paths resolve under $TEAMWORK_HOME; absolute paths are used as-is.`})]}),r===`http`&&(0,B.jsxs)(`div`,{className:wk.addFormFullWidth,children:[(0,B.jsx)(P,{compact:!0,value:l,type:`url`,placeholder:`https://...`,"aria-label":`URL`,onChange:e=>u(e.target.value)}),(0,B.jsxs)(`label`,{className:wk.timeoutLabel,htmlFor:`preflight-http-timeout`,children:[(0,B.jsx)(`span`,{children:`Timeout`}),(0,B.jsx)(P,{id:`preflight-http-timeout`,compact:!0,type:`range`,min:100,max:5e3,step:100,value:d,"aria-label":`HTTP timeout (milliseconds)`,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&f(Math.trunc(t))}}),(0,B.jsxs)(`span`,{className:wk.timeoutValue,children:[d,`ms`]})]})]}),(0,B.jsx)(F,{variant:`primary`,size:`sm`,onClick:y,disabled:!_,title:h?`Cannot exceed 20 preflight checks`:g??`Add this check`,children:`Add`}),p&&(0,B.jsx)(`div`,{className:wk.saveError,role:`alert`,children:p})]})}function Ok({job:e,onJobSaved:t}){let[n,r]=(0,L.useState)(e.preflight??[]),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null);(0,L.useEffect)(()=>{r(e.preflight??[])},[e.preflight]);let c=e.lastStatus===`skipped`&&e.lastSkipReason?e.lastSkipReason.unmet:null;async function l(n,i){a(!0),s(null);try{let r=await fetch(`/api/jobs/${e.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({preflight:n})});if(!r.ok){let e=r.statusText||`HTTP ${r.status}`;try{let t=await r.json();t.error&&(e=t.error)}catch{}throw Error(e)}t?.({preflight:n})}catch(e){console.warn(`[PreflightChecksSection] persist failed`,e),s(e instanceof Error?e.message:String(e)),r(i)}finally{a(!1)}}function u(e){let t=n,i=[...n,e];r(i),l(i,t)}function d(e){let t=n,i=n.filter((t,n)=>n!==e);r(i),l(i,t)}return(0,B.jsxs)(`div`,{className:wk.root,children:[o&&(0,B.jsx)(`div`,{className:wk.saveError,role:`alert`,"data-testid":`preflight-save-error`,children:o}),(0,B.jsx)(jy,{initial:!1,children:n.map((t,n)=>(0,B.jsx)(hk.div,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,height:0,marginBottom:0,overflow:`hidden`},transition:{duration:.15,delay:Math.min(n*.03,.15)},children:(0,B.jsx)(Ek,{spec:t,failed:Ck(t,c),failureKind:e.lastSkipReason?.kind,onRemove:()=>d(n),disabled:i})},Sk(t)))}),n.length===0&&(0,B.jsx)(`div`,{className:wk.emptyState,"data-testid":`preflight-empty`,children:`No preflight checks - add one to guard this job.`}),(0,B.jsx)(Dk,{onAdd:u,disabled:i,existingCount:n.length})]})}function kk({checked:e,onChange:t,disabled:n=!1}){return(0,B.jsxs)(`label`,{onClick:e=>{e.stopPropagation()},style:{position:`relative`,display:`inline-block`,width:40,height:22,cursor:n?`not-allowed`:`pointer`,opacity:n?.5:1},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e,disabled:n,onChange:e=>{n||t(e.target.checked)},style:{opacity:0,width:0,height:0,position:`absolute`}}),(0,B.jsx)(`span`,{style:{position:`absolute`,inset:0,background:e?`var(--color-primary-soft)`:`var(--color-hover)`,borderRadius:22,border:`1px solid ${e?`var(--color-primary)`:`var(--color-border)`}`,transition:`all 0.2s`},children:(0,B.jsx)(`span`,{style:{position:`absolute`,height:16,width:16,left:e?20:2,bottom:2,background:e?`var(--color-primary)`:`var(--color-text-muted)`,borderRadius:`50%`,transition:`all 0.2s`}})})]})}var Ak={stack:`_stack_q3wir_1`,directionRow:`_directionRow_q3wir_5`,directionColumn:`_directionColumn_q3wir_6`,alignStart:`_alignStart_q3wir_8`,alignCenter:`_alignCenter_q3wir_9`,alignEnd:`_alignEnd_q3wir_10`,alignStretch:`_alignStretch_q3wir_11`,justifyStart:`_justifyStart_q3wir_13`,justifyCenter:`_justifyCenter_q3wir_14`,justifyEnd:`_justifyEnd_q3wir_15`,justifyBetween:`_justifyBetween_q3wir_16`,wrap:`_wrap_q3wir_18`},jk={start:Ak.alignStart,center:Ak.alignCenter,end:Ak.alignEnd,stretch:Ak.alignStretch},Mk={start:Ak.justifyStart,center:Ak.justifyCenter,end:Ak.justifyEnd,between:Ak.justifyBetween};function Nk({direction:e=`column`,gap:t=0,align:n,justify:r,wrap:i=!1,className:a,style:o,children:s,...c}){return(0,B.jsx)(`div`,{className:[Ak.stack,e===`row`?Ak.directionRow:Ak.directionColumn,n&&jk[n],r&&Mk[r],i&&Ak.wrap,a].filter(Boolean).join(` `),style:{...t===0?{}:{gap:t},...o},...c,children:s})}var Pk={label:`_label_qx6bo_1`};function Fk({className:e,children:t,...n}){return(0,B.jsx)(`span`,{className:[Pk.label,e].filter(Boolean).join(` `),...n,children:t})}var Ik={section:`_section_dcuxj_4`,header:`_header_dcuxj_12`,chevron:`_chevron_dcuxj_38`,chevronOpen:`_chevronOpen_dcuxj_44`,label:`_label_dcuxj_48`,badge:`_badge_dcuxj_58`,body:`_body_dcuxj_69`,bodyInitial:`_bodyInitial_dcuxj_84`,bodyOpen:`_bodyOpen_dcuxj_90`,bodyContent:`_bodyContent_dcuxj_97`},Lk=`tos.collapsible.`,Rk=128;function zk(e){return typeof e==`string`&&e.length>0&&e.length<=Rk}function Bk(e,t){if(!zk(e)||typeof window>`u`)return t;try{let t=window.localStorage.getItem(Lk+e);if(t===`1`)return!0;if(t===`0`)return!1}catch{}return t}function Vk(e,t){if(!(!zk(e)||typeof window>`u`))try{window.localStorage.setItem(Lk+e,t?`1`:`0`)}catch{}}function Hk(e,t){e&&(t?e.setAttribute(`inert`,``):e.removeAttribute(`inert`))}function Uk({title:e,children:t,defaultExpanded:n=!0,persistKey:r,badge:i,className:a}){let[o,s]=(0,L.useState)(()=>Bk(r,n)),c=(0,L.useId)(),[l,u]=(0,L.useState)(!1);(0,L.useEffect)(()=>{u(!0)},[]);let d=(0,L.useCallback)(()=>{s(e=>{let t=!e;return r&&Vk(r,t),t})},[r]),f=[Ik.section,a].filter(Boolean).join(` `),p=[Ik.body,o?Ik.bodyOpen:``,l?``:Ik.bodyInitial].filter(Boolean).join(` `),m=typeof i==`string`&&i.length>0||typeof i==`number`&&Number.isFinite(i);return(0,B.jsxs)(`section`,{className:f,children:[(0,B.jsxs)(`button`,{type:`button`,className:Ik.header,"aria-expanded":o,"aria-controls":c,onClick:d,children:[(0,B.jsx)(`svg`,{className:`${Ik.chevron} ${o?Ik.chevronOpen:``}`,width:`12`,height:`12`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M4 2.5l3.5 3.5L4 9.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,B.jsx)(`span`,{className:Ik.label,children:e}),m&&(0,B.jsx)(`span`,{className:Ik.badge,children:i})]}),(0,B.jsx)(`div`,{id:c,className:p,"aria-hidden":!o,ref:e=>{Hk(e,!o)},children:(0,B.jsx)(`div`,{className:Ik.bodyContent,children:t})})]})}var Wk={chip:`_chip_1dxz4_1`,active:`_active_1dxz4_35`,label:`_label_1dxz4_42`,count:`_count_1dxz4_46`,weightXs:`_weightXs_1dxz4_70`,weightSm:`_weightSm_1dxz4_71`,weightMd:`_weightMd_1dxz4_72`,weightLg:`_weightLg_1dxz4_73`,weightXl:`_weightXl_1dxz4_74`},Gk={xs:Wk.weightXs,sm:Wk.weightSm,md:Wk.weightMd,lg:Wk.weightLg,xl:Wk.weightXl};function Kk(e,t){if(t<=0)return`sm`;let n=e/t;return n>=.66?`xl`:n>=.4?`lg`:n>=.22?`md`:n>=.1?`sm`:`xs`}function qk({topic:e,count:t,weight:n=`md`,active:r=!1,className:i,type:a=`button`,...o}){return(0,B.jsxs)(`button`,{type:a,className:[Wk.chip,Gk[n],r?Wk.active:``,i].filter(Boolean).join(` `),"aria-label":`${e}, ${t} ${t===1?`file`:`files`}`,...o,children:[(0,B.jsx)(`span`,{className:Wk.label,children:e}),(0,B.jsx)(`span`,{className:Wk.count,"aria-hidden":`true`,children:t})]})}var Jk={button:`_button_sipz3_4`,sizeSm:`_sizeSm_sipz3_67`,sizeMd:`_sizeMd_sipz3_72`};function Yk({value:e,label:t=`id`,announceLabel:n,size:r=`sm`,className:i,onCopy:a,onError:o}){let[s,c]=(0,L.useState)(!1),l=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]);let u=(0,L.useCallback)(t=>{if(t.stopPropagation(),typeof navigator>`u`||!navigator.clipboard){(o??Xk)(Error(`navigator.clipboard unavailable`));return}navigator.clipboard.writeText(e).then(()=>{c(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{c(!1),l.current=null},1200),a?.(e)},e=>{(o??Xk)(e)})},[e,a,o]),d=r===`md`?Jk.sizeMd:Jk.sizeSm,f=[Jk.button,d,i].filter(Boolean).join(` `),p=n?`Copy ${n}`:`Copy ${t} ${e}`,m=n?`Copied ${n}`:`Copied ${e}`;return(0,B.jsx)(`button`,{type:`button`,className:f,onClick:u,"data-copied":s?`true`:void 0,"aria-label":s?m:p,title:s?`Copied!`:`Copy ${t}: ${e}`,children:s?(0,B.jsx)(Qk,{}):(0,B.jsx)(Zk,{})})}function Xk(e){typeof console<`u`&&console.warn(`[CopyIdButton] clipboard write failed`,e)}function Zk(){return(0,B.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`rect`,{x:`5`,y:`5`,width:`8.5`,height:`8.5`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M3.5 10.5V3.5a1 1 0 0 1 1-1h7`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Qk(){return(0,B.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M3.5 8.5l3 3 6-6`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var $k=[`top`,`right`,`bottom`,`left`],eA=Math.min,tA=Math.max,nA=Math.round,rA=Math.floor,iA=e=>({x:e,y:e}),aA={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function oA(e,t,n){return tA(e,eA(t,n))}function sA(e,t){return typeof e==`function`?e(t):e}function cA(e){return e.split(`-`)[0]}function lA(e){return e.split(`-`)[1]}function uA(e){return e===`x`?`y`:`x`}function dA(e){return e===`y`?`height`:`width`}function fA(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function pA(e){return uA(fA(e))}function mA(e,t,n){n===void 0&&(n=!1);let r=lA(e),i=pA(e),a=dA(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=CA(o)),[o,CA(o)]}function hA(e){let t=CA(e);return[gA(e),t,gA(t)]}function gA(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var _A=[`left`,`right`],vA=[`right`,`left`],yA=[`top`,`bottom`],bA=[`bottom`,`top`];function xA(e,t,n){switch(e){case`top`:case`bottom`:return n?t?vA:_A:t?_A:vA;case`left`:case`right`:return t?yA:bA;default:return[]}}function SA(e,t,n,r){let i=lA(e),a=xA(cA(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(gA)))),a}function CA(e){let t=cA(e);return aA[t]+e.slice(t.length)}function wA(e){return{top:0,right:0,bottom:0,left:0,...e}}function TA(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:wA(e)}function EA(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function DA(e,t,n){let{reference:r,floating:i}=e,a=fA(t),o=pA(t),s=dA(o),c=cA(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(lA(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function OA(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=sA(t,e),p=TA(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=EA(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=EA(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var kA=50,AA=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:OA},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=DA(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<kA&&(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}=DA(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},jA=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:u=0}=sA(e,t)||{};if(l==null)return{};let d=TA(u),f={x:n,y:r},p=pA(i),m=dA(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=eA(d[_],T),D=eA(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=oA(O,A,k),M=!c.arrow&&lA(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),MA=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}=sA(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=cA(r),_=fA(o),v=cA(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[CA(o)]:hA(o)),x=p!==`none`;!d&&x&&b.push(...SA(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=mA(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==fA(t))||T.every(e=>fA(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.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=T.filter(e=>{if(x){let t=fA(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 NA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function PA(e){return $k.some(t=>e[t]>=0)}var FA=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=sA(e,t);switch(i){case`referenceHidden`:{let e=NA(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:PA(e)}}}case`escaped`:{let e=NA(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:PA(e)}}}default:return{}}}}},IA=new Set([`left`,`top`]);async function LA(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=cA(n),s=lA(n),c=fA(n)===`y`,l=IA.has(o)?-1:1,u=a&&c?-1:1,d=sA(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var RA=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 LA(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}}}}},zA=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}=sA(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=fA(cA(i)),p=uA(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=oA(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=oA(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}}}}}},BA=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}=sA(e,t),u={x:n,y:r},d=fA(i),f=uA(d),p=u[f],m=u[d],h=sA(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=IA.has(cA(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}}}},VA=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}=sA(e,t),u=await o.detectOverflow(t,l),d=cA(i),f=lA(i),p=fA(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=eA(h-u[g],v),x=eA(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=tA(u.left,0),t=tA(u.right,0),n=tA(u.top,0),r=tA(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:tA(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:tA(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function HA(){return typeof window<`u`}function UA(e){return KA(e)?(e.nodeName||``).toLowerCase():`#document`}function WA(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function GA(e){return((KA(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function KA(e){return HA()?e instanceof Node||e instanceof WA(e).Node:!1}function qA(e){return HA()?e instanceof Element||e instanceof WA(e).Element:!1}function JA(e){return HA()?e instanceof HTMLElement||e instanceof WA(e).HTMLElement:!1}function YA(e){return!HA()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof WA(e).ShadowRoot}function XA(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=sj(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ZA(e){return/^(table|td|th)$/.test(UA(e))}function QA(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var $A=/transform|translate|scale|rotate|perspective|filter/,ej=/paint|layout|strict|content/,tj=e=>!!e&&e!==`none`,nj;function rj(e){let t=qA(e)?sj(e):e;return tj(t.transform)||tj(t.translate)||tj(t.scale)||tj(t.rotate)||tj(t.perspective)||!aj()&&(tj(t.backdropFilter)||tj(t.filter))||$A.test(t.willChange||``)||ej.test(t.contain||``)}function ij(e){let t=lj(e);for(;JA(t)&&!oj(t);){if(rj(t))return t;if(QA(t))return null;t=lj(t)}return null}function aj(){return nj??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),nj}function oj(e){return/^(html|body|#document)$/.test(UA(e))}function sj(e){return WA(e).getComputedStyle(e)}function cj(e){return qA(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lj(e){if(UA(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||YA(e)&&e.host||GA(e);return YA(t)?t.host:t}function uj(e){let t=lj(e);return oj(t)?e.ownerDocument?e.ownerDocument.body:e.body:JA(t)&&XA(t)?t:uj(t)}function dj(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=uj(e),i=r===e.ownerDocument?.body,a=WA(r);if(i){let e=fj(a);return t.concat(a,a.visualViewport||[],XA(r)?r:[],e&&n?dj(e):[])}else return t.concat(r,dj(r,[],n))}function fj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pj(e){let t=sj(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=JA(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=nA(n)!==a||nA(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function mj(e){return qA(e)?e:e.contextElement}function hj(e){let t=mj(e);if(!JA(t))return iA(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=pj(t),o=(a?nA(n.width):n.width)/r,s=(a?nA(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var gj=iA(0);function _j(e){let t=WA(e);return!aj()||!t.visualViewport?gj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==WA(e)?!1:t}function yj(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=mj(e),o=iA(1);t&&(r?qA(r)&&(o=hj(r)):o=hj(e));let s=vj(a,n,r)?_j(a):iA(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=WA(a),t=r&&qA(r)?WA(r):r,n=e,i=fj(n);for(;i&&r&&t!==n;){let e=hj(i),t=i.getBoundingClientRect(),r=sj(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=WA(i),i=fj(n)}}return EA({width:u,height:d,x:c,y:l})}function bj(e,t){let n=cj(e).scrollLeft;return t?t.left+n:yj(GA(e)).left+n}function xj(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-bj(e,n),y:n.top+t.scrollTop}}function Sj(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=GA(r),s=t?QA(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=iA(1),u=iA(0),d=JA(r);if((d||!d&&!a)&&((UA(r)!==`body`||XA(o))&&(c=cj(r)),d)){let e=yj(r);l=hj(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?xj(o,c):iA(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 Cj(e){return Array.from(e.getClientRects())}function wj(e){let t=GA(e),n=cj(e),r=e.ownerDocument.body,i=tA(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=tA(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+bj(e),s=-n.scrollTop;return sj(r).direction===`rtl`&&(o+=tA(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Tj=25;function Ej(e,t){let n=WA(e),r=GA(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=aj();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=bj(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<=Tj&&(a-=o)}else l<=Tj&&(a+=l);return{width:a,height:o,x:s,y:c}}function Dj(e,t){let n=yj(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=JA(e)?hj(e):iA(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Oj(e,t,n){let r;if(t===`viewport`)r=Ej(e,n);else if(t===`document`)r=wj(GA(e));else if(qA(t))r=Dj(t,n);else{let n=_j(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return EA(r)}function kj(e,t){let n=lj(e);return n===t||!qA(n)||oj(n)?!1:sj(n).position===`fixed`||kj(n,t)}function Aj(e,t){let n=t.get(e);if(n)return n;let r=dj(e,[],!1).filter(e=>qA(e)&&UA(e)!==`body`),i=null,a=sj(e).position===`fixed`,o=a?lj(e):e;for(;qA(o)&&!oj(o);){let t=sj(o),n=rj(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||XA(o)&&!n&&kj(e,o))?r=r.filter(e=>e!==o):i=t,o=lj(o)}return t.set(e,r),r}function jj(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?QA(t)?[]:Aj(t,this._c):[].concat(n),r],o=Oj(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=Oj(t,a[e],i);s=tA(n.top,s),c=eA(n.right,c),l=eA(n.bottom,l),u=tA(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Mj(e){let{width:t,height:n}=pj(e);return{width:t,height:n}}function Nj(e,t,n){let r=JA(t),i=GA(t),a=n===`fixed`,o=yj(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=iA(0);function l(){c.x=bj(i)}if(r||!r&&!a)if((UA(t)!==`body`||XA(i))&&(s=cj(t)),r){let e=yj(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?xj(i,s):iA(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 Pj(e){return sj(e).position===`static`}function Fj(e,t){if(!JA(e)||sj(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return GA(e)===n&&(n=n.ownerDocument.body),n}function Ij(e,t){let n=WA(e);if(QA(e))return n;if(!JA(e)){let t=lj(e);for(;t&&!oj(t);){if(qA(t)&&!Pj(t))return t;t=lj(t)}return n}let r=Fj(e,t);for(;r&&ZA(r)&&Pj(r);)r=Fj(r,t);return r&&oj(r)&&Pj(r)&&!rj(r)?n:r||ij(e)||n}var Lj=async function(e){let t=this.getOffsetParent||Ij,n=this.getDimensions,r=await n(e.floating);return{reference:Nj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rj(e){return sj(e).direction===`rtl`}var zj={convertOffsetParentRelativeRectToViewportRelativeRect:Sj,getDocumentElement:GA,getClippingRect:jj,getOffsetParent:Ij,getElementRects:Lj,getClientRects:Cj,getDimensions:Mj,getScale:hj,isElement:qA,isRTL:Rj};function Bj(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vj(e,t){let n=null,r,i=GA(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=rA(d),h=rA(i.clientWidth-(u+f)),g=rA(i.clientHeight-(d+p)),_=rA(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:tA(0,eA(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&&!Bj(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 Hj(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=mj(e),u=i||a?[...l?dj(l):[],...t?dj(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Vj(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?yj(e):null;c&&g();function g(){let t=yj(e);h&&!Bj(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 Uj=RA,Wj=zA,Gj=MA,Kj=VA,qj=FA,Jj=jA,Yj=BA,Xj=(e,t,n)=>{let r=new Map,i={platform:zj,...n},a={...i.platform,_c:r};return AA(e,t,{...i,platform:a})},Zj=typeof document<`u`?L.useLayoutEffect:function(){};function Qj(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(!Qj(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)&&!Qj(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function $j(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function eM(e,t){let n=$j(e);return Math.round(t*n)/n}function tM(e){let t=L.useRef(e);return Zj(()=>{t.current=e}),t}function nM(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]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);Qj(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=tM(c),D=tM(i),O=tM(l),k=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Xj(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Qj(w.current,t)&&(w.current=t,od.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Zj(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=L.useRef(!1);Zj(()=>(A.current=!0,()=>{A.current=!1}),[]),Zj(()=>{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=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=L.useMemo(()=>({reference:b,floating:x}),[b,x]),N=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=eM(M.floating,u.x),r=eM(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...$j(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var rM=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Jj({element:r.current,padding:i}).fn(n):r?Jj({element:r,padding:i}).fn(n):{}}}},iM=(e,t)=>{let n=Uj(e);return{name:n.name,fn:n.fn,options:[e,t]}},aM=(e,t)=>{let n=Wj(e);return{name:n.name,fn:n.fn,options:[e,t]}},oM=(e,t)=>({fn:Yj(e).fn,options:[e,t]}),sM=(e,t)=>{let n=Gj(e);return{name:n.name,fn:n.fn,options:[e,t]}},cM=(e,t)=>{let n=Kj(e);return{name:n.name,fn:n.fn,options:[e,t]}},lM=(e,t)=>{let n=qj(e);return{name:n.name,fn:n.fn,options:[e,t]}},uM=(e,t)=>{let n=rM(e);return{name:n.name,fn:n.fn,options:[e,t]}},dM=`Arrow`,fM=L.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(pd.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});fM.displayName=dM;var pM=fM;function mM(e){let[t,n]=L.useState(void 0);return Qu(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var hM=`Popper`,[gM,_M]=Xu(hM),[vM,yM]=gM(hM),bM=e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null);return(0,B.jsx)(vM,{scope:t,anchor:r,onAnchorChange:i,children:n})};bM.displayName=hM;var xM=`PopperAnchor`,SM=L.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=yM(xM,n),o=L.useRef(null),s=Ju(t,o),c=L.useRef(null);return L.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,B.jsx)(pd.div,{...i,ref:s})});SM.displayName=xM;var CM=`PopperContent`,[wM,TM]=gM(CM),EM=L.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=yM(CM,n),[_,v]=L.useState(null),y=Ju(t,e=>v(e)),[b,x]=L.useState(null),S=mM(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(AM),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:ee}=nM({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>Hj(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[iM({mainAxis:i+w,alignmentAxis:o}),c&&aM({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?oM():void 0,...k}),c&&sM({...k}),cM({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&uM({element:b,padding:s}),jM({arrowWidth:C,arrowHeight:w}),f&&lM({strategy:`referenceHidden`,...k})]}),[P,F]=MM(M),te=hd(m);Qu(()=>{N&&te?.()},[N,te]);let I=ee.arrow?.x,ne=ee.arrow?.y,re=ee.arrow?.centerOffset!==0,[R,z]=L.useState();return Qu(()=>{_&&z(window.getComputedStyle(_).zIndex)},[_]),(0,B.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:R,"--radix-popper-transform-origin":[ee.transformOrigin?.x,ee.transformOrigin?.y].join(` `),...ee.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(wM,{scope:n,placedSide:P,onArrowChange:x,arrowX:I,arrowY:ne,shouldHideArrow:re,children:(0,B.jsx)(pd.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});EM.displayName=CM;var DM=`PopperArrow`,OM={top:`bottom`,right:`left`,bottom:`top`,left:`right`},kM=L.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=TM(DM,n),a=OM[i.placedSide];return(0,B.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,B.jsx)(pM,{...r,ref:t,style:{...r.style,display:`block`}})})});kM.displayName=DM;function AM(e){return e!==null}var jM=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=MM(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function MM(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var NM=bM,PM=SM,FM=EM,IM=kM,LM=`Popover`,[RM,zM]=Xu(LM,[_M]),BM=_M(),[VM,HM]=RM(LM),UM=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=BM(t),c=L.useRef(null),[l,u]=L.useState(!1),[d,f]=rd({prop:r,defaultProp:i??!1,onChange:a,caller:LM});return(0,B.jsx)(NM,{...s,children:(0,B.jsx)(VM,{scope:t,contentId:td(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:L.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:L.useCallback(()=>u(!0),[]),onCustomAnchorRemove:L.useCallback(()=>u(!1),[]),modal:o,children:n})})};UM.displayName=LM;var WM=`PopoverAnchor`,GM=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=HM(WM,n),a=BM(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return L.useEffect(()=>(o(),()=>s()),[o,s]),(0,B.jsx)(PM,{...a,...r,ref:t})});GM.displayName=WM;var KM=`PopoverTrigger`,qM=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=HM(KM,n),a=BM(n),o=Ju(t,i.triggerRef),s=(0,B.jsx)(pd.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":cN(i.open),...r,ref:o,onClick:Gu(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,B.jsx)(PM,{asChild:!0,...a,children:s})});qM.displayName=KM;var JM=`PopoverPortal`,[YM,XM]=RM(JM,{forceMount:void 0}),ZM=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=HM(JM,t);return(0,B.jsx)(YM,{scope:t,forceMount:n,children:(0,B.jsx)(Yd,{present:n||a.open,children:(0,B.jsx)(qd,{asChild:!0,container:i,children:r})})})};ZM.displayName=JM;var QM=`PopoverContent`,$M=L.forwardRef((e,t)=>{let n=XM(QM,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=HM(QM,e.__scopePopover);return(0,B.jsx)(Yd,{present:r||a.open,children:a.modal?(0,B.jsx)(tN,{...i,ref:t}):(0,B.jsx)(nN,{...i,ref:t})})});$M.displayName=QM;var eN=sd(`PopoverContent.RemoveScroll`),tN=L.forwardRef((e,t)=>{let n=HM(QM,e.__scopePopover),r=L.useRef(null),i=Ju(t,r),a=L.useRef(!1);return L.useEffect(()=>{let e=r.current;if(e)return bp(e)},[]),(0,B.jsx)(dp,{as:eN,allowPinchZoom:!0,children:(0,B.jsx)(rN,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gu(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Gu(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:Gu(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),nN=L.forwardRef((e,t)=>{let n=HM(QM,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,B.jsx)(rN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),rN=L.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=HM(QM,n),p=BM(n);return ef(),(0,B.jsx)(Pd,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Cd,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,B.jsx)(FM,{"data-state":cN(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),iN=`PopoverClose`,aN=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=HM(iN,n);return(0,B.jsx)(pd.button,{type:`button`,...r,ref:t,onClick:Gu(e.onClick,()=>i.onOpenChange(!1))})});aN.displayName=iN;var oN=`PopoverArrow`,sN=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=BM(n);return(0,B.jsx)(IM,{...i,...r,ref:t})});sN.displayName=oN;function cN(e){return e?`open`:`closed`}var lN=UM,uN=qM,dN=ZM,fN=$M,pN={trigger:`_trigger_pyixy_1`,triggerLabel:`_triggerLabel_pyixy_22`,panel:`_panel_pyixy_24`,panelIn:`_panelIn_pyixy_1`,panelNarrow:`_panelNarrow_pyixy_38`,panelWide:`_panelWide_pyixy_39`,segmentGroup:`_segmentGroup_pyixy_50`,segment:`_segment_pyixy_50`,segmentActive:`_segmentActive_pyixy_74`,radioList:`_radioList_pyixy_81`,radioRow:`_radioRow_pyixy_89`,radioLabel:`_radioLabel_pyixy_109`};function mN({triggerLabel:e,triggerAriaLabel:t,triggerIcon:n,triggerSuffix:r,size:i=`narrow`,align:a=`end`,children:o}){let s=`${pN.panel} ${i===`wide`?pN.panelWide:pN.panelNarrow}`;return(0,B.jsxs)(lN,{children:[(0,B.jsx)(uN,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:pN.trigger,"aria-label":t,children:[n,(0,B.jsx)(`span`,{className:pN.triggerLabel,children:e}),r]})}),(0,B.jsx)(dN,{children:(0,B.jsx)(fN,{sideOffset:6,align:a,className:s,children:o})})]})}function hN({ariaLabel:e,value:t,options:n,onChange:r}){return(0,B.jsx)(`div`,{className:pN.segmentGroup,role:`radiogroup`,"aria-label":e,children:n.map(e=>{let n=t===e.value;return(0,B.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,className:`${pN.segment} ${n?pN.segmentActive:``}`,onClick:()=>r(e.value),children:e.label},e.value)})})}function gN({label:e,active:t,onClick:n}){return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:pN.radioRow,onClick:n,children:[(0,B.jsx)(`span`,{className:pN.radioLabel,children:e}),t&&(0,B.jsx)(vN,{})]})})}function _N({children:e}){return(0,B.jsx)(`ul`,{className:pN.radioList,children:e})}function vN(){return(0,B.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2.5 6l2.5 2.5L9.5 3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var yN={card:`_card_1343m_10`,"jobcardcompact-fade":`_jobcardcompact-fade_1343m_1`,cardRunning:`_cardRunning_1343m_45`,cardDimmed:`_cardDimmed_1343m_53`,actions:`_actions_1343m_53`,cardMenuOpen:`_cardMenuOpen_1343m_59`,main:`_main_1343m_65`,nameRow:`_nameRow_1343m_73`,name:`_name_1343m_73`,selfImproveIcon:`_selfImproveIcon_1343m_92`,subline:`_subline_1343m_99`,command:`_command_1343m_110`,schedule:`_schedule_1343m_119`,tag:`_tag_1343m_121`,metrics:`_metrics_1343m_134`,lastRun:`_lastRun_1343m_141`,failureReason:`_failureReason_1343m_169`,failureKindBadge:`_failureKindBadge_1343m_181`,actionsCluster:`_actionsCluster_1343m_195`,iconBtn:`_iconBtn_1343m_202`,menu:`_menu_1343m_232`,menuItem:`_menuItem_1343m_248`,menuItemDanger:`_menuItemDanger_1343m_264`,cardComfortable:`_cardComfortable_1343m_274`};function bN(e,t){return t.filter(t=>t.jobId===e).slice().sort((e,t)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()).map(e=>({timestamp:e.timestamp,status:e.status,durationSeconds:e.durationSeconds,resultFile:``}))}function xN({job:e,feed:t,onToggleEnabled:n,onRun:r,onCancel:i,onSelectJob:a,onExport:o,onDelete:s,isGloballyPaused:c=!1,employees:l=[],density:u=`compact`}){let[d,f]=(0,L.useState)(!1),p=(0,L.useMemo)(()=>bN(e.id,t),[e.id,t]),m=(0,L.useMemo)(()=>Zv(p),[p]),h=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!d)return;let e=e=>{h.current?.contains(e.target)||f(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[d]);let g=e.lastStatus===`running`,_=c&&!e.ignorePauses,v=_||!e.enabled,y=[yN.card,u===`comfortable`?yN.cardComfortable:``,g?yN.cardRunning:``,v?yN.cardDimmed:``,d?yN.cardMenuOpen:``].filter(Boolean).join(` `),b=!!(e.command||e.tags&&e.tags.length>0);return(0,B.jsxs)(`div`,{className:y,role:`button`,tabIndex:0,"data-hover-reveal":`true`,onClick:()=>a(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),a(e.id))},"aria-label":`Open ${e.name}`,children:[(0,B.jsx)(Rv,{status:e.lastStatus,size:`sm`}),(0,B.jsxs)(`div`,{className:yN.main,children:[(0,B.jsxs)(`div`,{className:yN.nameRow,children:[(0,B.jsx)(`span`,{className:yN.name,title:e.name,children:e.name}),(0,B.jsx)(Yk,{value:e.id,label:`job id`,announceLabel:`ID for ${e.name}`}),e.selfImprove&&(0,B.jsx)(`span`,{className:yN.selfImproveIcon,title:`Self-improving`,children:`✨`}),(0,B.jsx)(Wv,{job:e,employees:l,compact:!0,dimmed:v})]}),b&&(0,B.jsxs)(`div`,{className:yN.subline,children:[(0,B.jsx)(`span`,{className:yN.schedule,children:e.scheduleHuman||e.schedule}),je(e.schedule)&&(0,B.jsx)(cu,{variant:`warning`,size:`sm`,label:`Invalid`,icon:`⚠`,title:`Schedule "${e.schedule}" is invalid. Click to open job.`,ariaLabel:`Schedule invalid. Open job.`,onClick:t=>{t.stopPropagation(),a(e.id)}}),e.command&&(0,B.jsx)(`span`,{className:yN.command,title:e.command,children:e.command}),e.tags?.slice(0,3).map(e=>(0,B.jsx)(`span`,{className:yN.tag,children:e},e))]}),(e.lastFailureReasonText??e.lastFailureReason?.message)&&(0,B.jsxs)(`span`,{className:yN.failureReason,children:[e.lastFailureReason?.kind&&e.lastFailureReason.kind!==`unknown`&&(0,B.jsx)(`span`,{className:yN.failureKindBadge,children:e.lastFailureReason.kind}),e.lastFailureReasonText??e.lastFailureReason?.message]})]}),(0,B.jsxs)(`div`,{className:yN.metrics,children:[m.completed>0&&(0,B.jsx)($v,{history:p,compact:!0,hideRate:!1,hideAvg:!0,hideStreak:!1}),(0,B.jsx)(`span`,{className:yN.lastRun,children:(0,B.jsx)(I,{iso:e.lastRun})})]}),(0,B.jsx)(`span`,{className:yN.actions,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(SN,{job:e,isRunning:g,pausedByOverride:_,onRun:r,onCancel:i,onToggleEnabled:n,onExport:o,onDelete:s,menuOpen:d,setMenuOpen:f,menuRef:h})})]})}function SN({job:e,isRunning:t,pausedByOverride:n,onRun:r,onCancel:i,onToggleEnabled:a,onExport:o,onDelete:s,menuOpen:c,setMenuOpen:l,menuRef:u}){let d=!!(o||s);return(0,B.jsxs)(`span`,{className:yN.actionsCluster,children:[(0,B.jsx)(kk,{checked:e.enabled,onChange:t=>a(e.id,t),disabled:n}),t?(0,B.jsx)(CN,{onClick:()=>i(e.id),variant:`cancel`,title:`Cancel running job`,label:`Cancel`,children:`■`}):(0,B.jsx)(CN,{onClick:()=>r(e.id),variant:`run`,reveal:!0,disabled:n,title:n?`Globally paused`:`Run now`,label:`Run now`,children:`▶`}),d&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(CN,{onClick:()=>l(!c),variant:`muted`,reveal:!0,title:`More actions`,label:`More actions`,children:`⋯`}),c&&(0,B.jsxs)(`div`,{ref:u,className:yN.menu,role:`menu`,children:[o&&(0,B.jsxs)(`button`,{type:`button`,className:yN.menuItem,role:`menuitem`,onClick:()=>{o(e.id),l(!1)},children:[`⬆`,` Export`]}),s&&(0,B.jsxs)(`button`,{type:`button`,className:`${yN.menuItem} ${yN.menuItemDanger}`,role:`menuitem`,onClick:()=>{s(e.id),l(!1)},children:[`✕`,` Delete`]})]})]})]})}function CN({children:e,onClick:t,variant:n,reveal:r,disabled:i,title:a,label:o}){return(0,B.jsx)(`button`,{type:`button`,className:yN.iconBtn,onClick:e=>{e.stopPropagation(),t()},disabled:i,title:a,"aria-label":o,"data-variant":n,"data-reveal":r?``:void 0,children:e})}var Q={titleRow:`_titleRow_zijay_4`,title:`_title_zijay_4`,subtitleRow:`_subtitleRow_zijay_23`,subtitleMono:`_subtitleMono_zijay_33`,subtitleSep:`_subtitleSep_zijay_43`,agentChipButton:`_agentChipButton_zijay_50`,description:`_description_zijay_75`,metricsRow:`_metricsRow_zijay_84`,infoGrid:`_infoGrid_zijay_94`,infoItem:`_infoItem_zijay_102`,infoLabel:`_infoLabel_zijay_109`,infoValue:`_infoValue_zijay_117`,infoValueMono:`_infoValueMono_zijay_123 _infoValue_zijay_117`,pipelineRow:`_pipelineRow_zijay_129`,pipelineChip:`_pipelineChip_zijay_136`,pipelineChipInputs:`_pipelineChipInputs_zijay_145 _pipelineChip_zijay_136`,pipelineChipDeps:`_pipelineChipDeps_zijay_152 _pipelineChip_zijay_136`,pipelineChipTriggers:`_pipelineChipTriggers_zijay_159 _pipelineChip_zijay_136`,priorityValue:`_priorityValue_zijay_166`,selfImproveChangelog:`_selfImproveChangelog_zijay_170`,skillsRow:`_skillsRow_zijay_174`,footerButton:`_footerButton_zijay_181`,headerBadgeCluster:`_headerBadgeCluster_zijay_186`,pausedBanner:`_pausedBanner_zijay_195`,pausedBannerIn:`_pausedBannerIn_zijay_1`,pausedIcon:`_pausedIcon_zijay_208`,pausedBody:`_pausedBody_zijay_221`,pausedLabel:`_pausedLabel_zijay_226`,pausedReason:`_pausedReason_zijay_192`,pausedActions:`_pausedActions_zijay_242`};function wN(e){return e.flow===`seam-v1`?e.lead??e.participants?.[0]:e.employee}function TN({job:e,feed:t=[],employees:n=[],onClose:r,onRun:i,onEdit:a,onCancel:o,onReEnable:s,onDuplicate:c,onExport:l,onDelete:u,onPromptLab:d,onSelectEmployee:f,fetchResult:p,fetchHistory:m,fetchTrace:h,fetchChangelog:g}){let[_,v]=(0,L.useState)([]),[y,b]=(0,L.useState)([]),[x,S]=(0,L.useState)([]),[C,w]=(0,L.useState)(null),T=e.lastStatus===`running`,E=!!(e.lastStatus&&e.lastStatus!==`running`&&e.lastRun),D=!!(e.inputs&&e.inputs.length>0||e.dependsOn&&e.dependsOn.length>0||e.jobTriggers&&e.jobTriggers.length>0),O=!!(e.skills&&e.skills.length>0),k=(0,L.useMemo)(()=>bN(e.id,t),[e.id,t]),A=e.preflight?.length??0,j=e.lastStatus===`skipped`,M=A>0?j?`${A} · ⚠ skip`:String(A):void 0;(0,L.useEffect)(()=>{!e.selfImprove||!g||g(e.id).then(S).catch(()=>{})},[e.id,e.selfImprove,g]);let N=(0,B.jsxs)(`div`,{className:pg.titleBlock,children:[(0,B.jsxs)(`div`,{className:Q.titleRow,children:[(0,B.jsx)(Rv,{status:e.lastStatus,size:`md`}),(0,B.jsx)(`span`,{className:Q.title,children:e.name})]}),(0,B.jsxs)(`div`,{className:Q.subtitleRow,children:[(0,B.jsx)(`span`,{className:Q.subtitleMono,title:e.schedule,children:e.scheduleHuman||e.schedule}),je(e.schedule)&&(0,B.jsx)(cu,{variant:`warning`,size:`sm`,label:`Schedule invalid`,icon:`⚠`,title:`Schedule "${e.schedule}" cannot be parsed as cron.`}),e.lastRun&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:Q.subtitleSep,children:`·`}),(0,B.jsx)(I,{iso:e.lastRun})]}),(0,B.jsx)(`span`,{className:Q.subtitleSep,children:`·`}),(()=>{let t=wN(e);return f&&t?(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(t),className:Q.agentChipButton,title:`Open ${t}`,"aria-label":`Open employee ${t}`,children:(0,B.jsx)(Wv,{job:e,employees:n,compact:!0})}):(0,B.jsx)(Wv,{job:e,employees:n,compact:!0})})()]})]}),ee=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:pg.footerLeft,children:[T?(0,B.jsx)(`button`,{className:`btn btn-sm btn-danger ${Q.footerButton}`,onClick:o,children:`■ Cancel`}):(0,B.jsx)(`button`,{className:`btn btn-sm btn-green ${Q.footerButton}`,onClick:i,children:`▶ Run Now`}),(0,B.jsx)(`button`,{className:`btn btn-sm ${Q.footerButton}`,onClick:a,children:`✎ Edit`})]}),(0,B.jsxs)(`div`,{className:pg.footerRight,children:[d&&e.prompt&&(0,B.jsx)(`button`,{className:`btn btn-sm ${Q.footerButton}`,onClick:d,title:`Test prompt variations`,children:`🧪 Prompt Lab`}),c&&(0,B.jsx)(`button`,{className:`btn btn-sm ${Q.footerButton}`,onClick:c,children:`⎘ Duplicate`}),l&&(0,B.jsx)(`button`,{className:`btn btn-sm ${Q.footerButton}`,onClick:()=>l(e.id),children:`⬆ Export`}),u&&(0,B.jsx)(`button`,{className:`btn btn-sm btn-danger ${Q.footerButton}`,onClick:u,children:`🗑 Delete`})]})]});return(0,B.jsxs)(fg,{open:!0,onClose:r,ariaLabel:`Job details: ${e.name}`,header:N,footer:ee,children:[e.pausedReason&&(0,B.jsx)(EN,{reason:e.pausedReason,onReEnable:s}),e.description&&(0,B.jsx)(`div`,{className:Q.description,children:e.description}),k.length>0&&(0,B.jsx)(`div`,{className:Q.metricsRow,children:(0,B.jsx)($v,{history:k})}),(0,B.jsxs)(`div`,{className:Q.infoGrid,children:[(0,B.jsx)(DN,{label:`Timeout`,value:`${e.timeout}s`}),e.priority&&e.priority!==`normal`&&(0,B.jsx)(DN,{label:`Priority`,value:(0,B.jsx)(`span`,{className:Q.priorityValue,children:e.priority})}),e.model&&(0,B.jsx)(DN,{label:`Model`,value:e.model,mono:!0}),e.flow&&(0,B.jsx)(DN,{label:`Flow`,value:e.flow})]}),D&&(0,B.jsxs)(`div`,{className:Q.pipelineRow,children:[e.inputs&&e.inputs.length>0&&(0,B.jsxs)(`span`,{className:Q.pipelineChipInputs,children:[e.inputs.length,` pipeline input`,e.inputs.length===1?``:`s`]}),e.dependsOn&&e.dependsOn.length>0&&(0,B.jsxs)(`span`,{className:Q.pipelineChipDeps,children:[e.dependsOn.length,` dependenc`,e.dependsOn.length===1?`y`:`ies`]}),e.jobTriggers&&e.jobTriggers.length>0&&(0,B.jsxs)(`span`,{className:Q.pipelineChipTriggers,children:[e.jobTriggers.length,` reactive trigger`,e.jobTriggers.length===1?``:`s`]})]}),(0,B.jsx)(hg,{title:`Preflight checks`,hint:M,defaultOpen:A>0||j,children:(0,B.jsx)(Ok,{job:e})}),E&&(0,B.jsxs)(hg,{title:`Latest result`,defaultOpen:!0,children:[(0,B.jsx)(O_,{jobId:e.id,lastRun:e.lastRun,fetchResult:p,onArtifactsLoaded:v,onActionItemsLoaded:b}),(0,B.jsx)(M_,{artifacts:_}),(0,B.jsx)(N_,{items:y})]}),(0,B.jsx)(hg,{title:`History`,hint:k.length>0?`${k.length} runs tracked`:void 0,defaultOpen:k.length>0,children:(0,B.jsx)(X_,{jobId:e.id,fetchHistory:m,fetchResult:p,latestFailureReason:e.lastFailureReason,fetchTrace:h})}),O&&(0,B.jsxs)(hg,{title:`Skills`,hint:`${e.skills.length}`,children:[(0,B.jsx)(`div`,{className:Q.skillsRow,children:e.skills.map(e=>(0,B.jsx)(hv,{name:e,isActive:C===e,onClick:()=>w(t=>t===e?null:e)},e))}),C&&(0,B.jsx)(gv,{skillName:C,onClose:()=>w(null)})]}),(0,B.jsx)(hg,{title:`Performance`,children:(0,B.jsx)(rv,{jobId:e.id})}),e.flow===`seam-v1`&&(0,B.jsx)(hg,{title:`Seam runs`,children:(0,B.jsx)(fv,{jobId:e.id})}),e.selfImprove&&(0,B.jsxs)(hg,{title:`Self-improve`,children:[(0,B.jsx)(jv,{jobId:e.id}),e.prompt&&(0,B.jsx)(`div`,{className:Q.selfImproveChangelog,children:(0,B.jsx)($_,{entries:x,currentPrompt:e.prompt})})]}),(0,B.jsx)(hg,{title:`Supervisor activity`,defaultOpen:!1,children:(0,B.jsx)(_y,{job:e})})]})}function EN({reason:e,onReEnable:t}){let[n,r]=(0,L.useState)(!1);return(0,B.jsxs)(`div`,{className:Q.pausedBanner,role:`status`,children:[(0,B.jsx)(`span`,{className:Q.pausedIcon,"aria-hidden":`true`,children:`⏸`}),(0,B.jsxs)(`div`,{className:Q.pausedBody,children:[(0,B.jsx)(`div`,{className:Q.pausedLabel,children:`Paused`}),(0,B.jsx)(`div`,{className:Q.pausedReason,children:e})]}),t&&(0,B.jsx)(`div`,{className:Q.pausedActions,children:(0,B.jsx)(`button`,{className:`btn btn-sm`,onClick:async()=>{if(!(!t||n)){r(!0);try{await t()}finally{r(!1)}}},disabled:n,title:`Re-enable this job and clear the pause reason`,children:n?`...`:`Re-enable`})})]})}function DN({label:e,value:t,mono:n=!1}){return(0,B.jsxs)(`div`,{className:Q.infoItem,children:[(0,B.jsx)(`span`,{className:Q.infoLabel,children:e}),(0,B.jsx)(`span`,{className:n?Q.infoValueMono:Q.infoValue,children:t})]})}var ON=`#d2a8ff`;function kN({job:e,open:t,onClose:n,onSave:r,fetchResult:i}){let[a,o]=(0,L.useState)(e.prompt||``),[s,c]=(0,L.useState)({status:`idle`,output:``,prompt:``,startedAt:null,completedAt:null,durationSeconds:null}),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,_]=(0,L.useState)(``),v=(0,L.useRef)(null),y=(0,L.useRef)(null);(0,L.useEffect)(()=>{o(e.prompt||``)},[e.id,e.prompt]),(0,L.useEffect)(()=>{t&&i(e.id).then(e=>{e&&u(e.content)}).catch(()=>{})},[t,e.id,i]);let b=(0,L.useCallback)(()=>{v.current&&clearInterval(v.current),v.current=setInterval(async()=>{try{let t=await(await fetch(`/api/jobs/${e.id}/dry-run`)).json();t.status!==`running`&&(v.current&&clearInterval(v.current),v.current=null),c({status:t.status||`idle`,output:t.output||``,prompt:t.prompt||``,startedAt:t.startedAt||null,completedAt:t.completedAt||null,durationSeconds:t.durationSeconds??null})}catch{v.current&&clearInterval(v.current),v.current=null}},2e3)},[e.id]);(0,L.useEffect)(()=>()=>{v.current&&clearInterval(v.current)},[]),(0,L.useEffect)(()=>{t&&fetch(`/api/jobs/${e.id}/dry-run`).then(e=>e.json()).then(e=>{c({status:e.status||`idle`,output:e.output||``,prompt:e.prompt||``,startedAt:e.startedAt||null,completedAt:e.completedAt||null,durationSeconds:e.durationSeconds??null}),e.status===`running`&&b()}).catch(()=>{})},[t,e.id,b]);let x=async()=>{if(s.status!==`running`){c(e=>({...e,status:`running`,output:``,startedAt:new Date().toISOString(),completedAt:null,durationSeconds:null}));try{await fetch(`/api/jobs/${e.id}/dry-run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:a})}),b()}catch{c(e=>({...e,status:`failed`,output:`Failed to start dry run`}))}}},S=async()=>{if(!(p||!E)){m(!0);try{(await fetch(`/api/jobs/${e.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:a})})).ok?(_(`Prompt saved to job`),r?.(),setTimeout(()=>_(``),3e3)):(_(`Failed to save`),setTimeout(()=>_(``),3e3))}catch{_(`Failed to save`),setTimeout(()=>_(``),3e3)}finally{m(!1)}}};(0,L.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t,n]);let w=s.status===`running`,T=s.output.length>0,E=a!==(e.prompt||``);return t?(0,B.jsx)(`div`,{onClick:e=>{e.target===e.currentTarget&&n()},style:{position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(0, 0, 0, 0.7)`,zIndex:3e3,animation:`fadeIn 0.15s ease-out`},children:(0,B.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Prompt Lab: ${e.name}`,style:{width:`90vw`,maxWidth:1200,height:`80vh`,background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:12,boxShadow:`0 24px 64px rgba(0,0,0,0.6)`,display:`flex`,flexDirection:`column`,overflow:`hidden`,animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsxs)(`div`,{style:{padding:`12px 20px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexShrink:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,B.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:28,height:28,borderRadius:6,background:`rgba(210,168,255,0.12)`,fontSize:14},children:`🧪`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{style:{fontWeight:600,fontSize:15,color:C.text},children:`Prompt Lab`}),(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:13,marginLeft:8},children:e.name})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[E&&(0,B.jsx)(`span`,{style:{fontSize:11,padding:`2px 8px`,borderRadius:8,background:`rgba(210,168,255,0.12)`,color:ON},children:`modified`}),(0,B.jsx)(`button`,{onClick:()=>o(e.prompt||``),className:`btn btn-sm`,style:{fontSize:12,visibility:E?`visible`:`hidden`},children:`Reset`}),(0,B.jsx)(`button`,{onClick:n,"aria-label":`Close prompt lab`,style:{background:`none`,border:`none`,color:C.muted,fontSize:18,cursor:`pointer`,padding:`4px 8px`,lineHeight:1},children:`✕`})]})]}),(0,B.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{flex:d?`0 0 33%`:`0 0 50%`,display:`flex`,flexDirection:`column`,borderRight:`1px solid ${C.border}`,transition:`flex 0.2s ease`},children:[(0,B.jsxs)(`div`,{style:{padding:`8px 16px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.5},children:`Prompt`}),(0,B.jsxs)(`span`,{style:{fontSize:11,color:C.muted},children:[a.length.toLocaleString(),` chars`]})]}),(0,B.jsx)(`textarea`,{ref:y,value:a,onChange:e=>o(e.target.value),spellCheck:!1,style:{flex:1,resize:`none`,background:C.darkBg,color:C.text,border:`none`,padding:16,fontSize:13,lineHeight:1.6,fontFamily:g,outline:`none`}}),(0,B.jsxs)(`div`,{style:{padding:`10px 16px`,borderTop:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`button`,{onClick:x,disabled:w||!a.trim(),className:`btn btn-sm`,style:{background:w?`rgba(210,168,255,0.1)`:`rgba(210,168,255,0.15)`,border:`1px solid ${w?`rgba(210,168,255,0.1)`:`rgba(210,168,255,0.3)`}`,color:w?C.muted:ON,cursor:w?`not-allowed`:`pointer`,fontWeight:600,fontSize:13,padding:`6px 16px`},children:w?`Running...`:`▶ Test Run`}),E&&(0,B.jsx)(`button`,{onClick:S,disabled:p,className:`btn btn-sm`,style:{background:`rgba(63,185,80,0.12)`,border:`1px solid rgba(63,185,80,0.3)`,color:C.green,cursor:p?`not-allowed`:`pointer`,fontWeight:600,fontSize:13,padding:`6px 16px`},children:p?`Saving...`:`✔ Apply to Job`}),w&&(0,B.jsx)(`span`,{style:{fontSize:12,color:ON,animation:`pulse 1.5s infinite`},children:`Claude is processing...`}),s.durationSeconds!==null&&s.status!==`running`&&(0,B.jsxs)(`span`,{style:{fontSize:12,color:C.muted},children:[s.durationSeconds,`s`]}),h&&(0,B.jsx)(`span`,{style:{fontSize:12,color:C.green,animation:`fadeIn 0.2s ease`},children:h})]})]}),(0,B.jsxs)(`div`,{style:{flex:d?`0 0 34%`:`0 0 50%`,display:`flex`,flexDirection:`column`,borderRight:d?`1px solid ${C.border}`:`none`,transition:`flex 0.2s ease`},children:[(0,B.jsxs)(`div`,{style:{padding:`8px 16px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.5},children:`Test Output`}),s.status!==`idle`&&s.status!==`running`&&(0,B.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:4,background:s.status===`success`?`var(--color-positive-soft)`:`var(--color-negative-soft)`,color:s.status===`success`?C.green:C.red},children:s.status})]}),l&&(0,B.jsx)(`button`,{onClick:()=>f(e=>!e),className:`btn btn-sm`,style:{fontSize:11,padding:`2px 8px`,color:d?ON:C.muted,background:d?`rgba(210,168,255,0.1)`:`transparent`},children:d?`Hide Compare`:`Compare`})]}),(0,B.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:16,fontSize:13,lineHeight:1.6,fontFamily:g,color:C.text,background:C.darkBg,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:w?(0,B.jsx)(`div`,{style:{color:C.muted,fontStyle:`italic`},children:`Waiting for Claude to respond...`}):T?s.output:(0,B.jsx)(`div`,{style:{color:C.muted,fontStyle:`italic`},children:`Edit the prompt on the left, then click "Test Run" to see Claude's response without affecting the job's history or status.`})})]}),d&&(0,B.jsxs)(`div`,{style:{flex:`0 0 33%`,display:`flex`,flexDirection:`column`,animation:`fadeIn 0.2s ease`},children:[(0,B.jsx)(`div`,{style:{padding:`8px 16px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`},children:(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.5},children:`Last Production Run`})}),(0,B.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:16,fontSize:13,lineHeight:1.6,fontFamily:`var(--font-mono)`,color:`var(--color-text-muted)`,background:C.darkBg,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:l||(0,B.jsx)(`span`,{style:{fontStyle:`italic`},children:`No previous run output available.`})})]})]})]})}):null}var AN=`#56d4dd`,jN=`rgba(86,212,221,0.12)`,MN=`rgba(86,212,221,0.3)`,NN=[`Keep my Linear backlog groomed — close stale tickets, update priorities weekly`,`Monitor my GitHub repos for failing CI and notify me on Slack`,`Every morning, summarize my Google Calendar and Slack threads into a daily brief`,`Review open PRs in my repos weekly and remind authors about stale ones`],PN={describe:{label:`Draft`,bg:`rgba(139,148,158,0.15)`,color:`var(--color-text-muted)`},generating:{label:`Generating…`,bg:`rgba(88,166,255,0.15)`,color:`var(--color-info)`,pulse:!0},review:{label:`Review`,bg:`rgba(188,140,255,0.15)`,color:`#bc8cff`},partial:{label:`Partial`,bg:`rgba(210,153,42,0.15)`,color:C.warning},created:{label:`Created`,bg:`var(--color-positive-soft)`,color:`var(--color-positive)`},error:{label:`Error`,bg:`var(--color-negative-soft)`,color:`var(--color-negative)`}};function FN({current:e}){let t=[{key:`describe`,label:`Describe`},{key:`generating`,label:`Generate`},{key:`review`,label:`Review`},{key:`done`,label:`Create`}],n=t.findIndex(t=>t.key===e||e===`creating`&&t.key===`done`);return(0,B.jsx)(`div`,{style:{display:`flex`,gap:4,marginLeft:12},children:t.map((e,r)=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(`div`,{style:{...S,background:r<=n?AN:C.border,transition:`background 0.3s ease`}}),(0,B.jsx)(`span`,{style:{fontSize:11,color:r<=n?AN:C.muted,transition:`color 0.3s ease`},children:e.label}),r<t.length-1&&(0,B.jsx)(`span`,{style:{fontSize:10,color:C.border,margin:`0 2px`},children:`›`})]},e.key))})}function IN({goals:e,loading:t,deleteConfirmId:n,onNewGoal:r,onResumeGoal:i,onDeleteGoal:a,onCancelDelete:o}){return(0,B.jsxs)(`div`,{style:{animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsx)(`div`,{style:{marginBottom:20},children:(0,B.jsxs)(`button`,{onClick:r,style:{width:`100%`,padding:`10px 16px`,background:jN,border:`1px solid ${MN}`,borderRadius:8,color:AN,fontSize:14,fontWeight:600,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:8,transition:`background 0.15s ease, border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(86,212,221,0.2)`},onMouseLeave:e=>{e.currentTarget.style.background=jN},children:[(0,B.jsx)(`span`,{style:{fontSize:16,lineHeight:1},children:`+`}),`New Goal`]})}),t?(0,B.jsx)(`div`,{style:{textAlign:`center`,padding:`32px 0`,color:C.muted,fontSize:13},children:`Loading goals…`}):e.length===0?(0,B.jsxs)(`div`,{style:{textAlign:`center`,padding:`32px 20px`,border:`1px dashed ${C.border}`,borderRadius:8,color:C.muted},children:[(0,B.jsx)(`p`,{style:{fontSize:14,marginBottom:6},children:`No goals yet`}),(0,B.jsx)(`p`,{style:{fontSize:12},children:`Describe what you want automated and Claude will create jobs.`})]}):(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{style:{fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.5,marginBottom:10},children:`Previous Goals`}),(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:e.map((e,t)=>(0,B.jsx)(LN,{goal:e,animationDelay:t*.04,deleteConfirmId:n,onResume:i,onDelete:a,onCancelDelete:o},e.id))})]})]})}function LN({goal:e,animationDelay:t,deleteConfirmId:n,onResume:r,onDelete:i,onCancelDelete:a}){let o=PN[e.status]??PN.describe,s=n===e.id,[c,l]=(0,L.useState)(!1),u=(()=>{try{return new Date(e.createdAt).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}catch{return``}})();return(0,B.jsxs)(`div`,{style:{border:`1px solid ${c?MN:C.border}`,borderRadius:8,background:c?`rgba(86,212,221,0.04)`:C.darkBg,padding:`12px 14px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,cursor:`pointer`,transition:`border-color 0.15s ease, background 0.15s ease`,animation:`fadeInUp 0.2s ease-out both`,animationDelay:`${t}s`},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:()=>!s&&r(e),children:[(0,B.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,B.jsx)(`p`,{style:{fontSize:13,color:C.text,fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginBottom:4},children:e.goal}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[u&&(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted},children:u}),e.jobCount!=null&&(0,B.jsxs)(`span`,{style:{fontSize:11,color:C.muted},children:[`· `,e.jobCount,` job`,e.jobCount===1?``:`s`]})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexShrink:0},children:[(0,B.jsx)(`span`,{style:{fontSize:11,padding:`2px 8px`,borderRadius:10,background:o.bg,color:o.color,fontWeight:500,transition:`background 0.2s ease, color 0.2s ease`,animation:o.pulse?`pulse-badge 1.5s ease-in-out infinite`:`none`},children:o.label}),s?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:4},onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{onClick:()=>i(e.id),style:{fontSize:11,padding:`2px 8px`,borderRadius:4,border:`none`,background:`rgba(248,81,73,0.2)`,color:`var(--color-negative)`,cursor:`pointer`,fontWeight:500},children:`Delete`}),(0,B.jsx)(`button`,{onClick:a,style:{fontSize:11,padding:`2px 8px`,borderRadius:4,border:`none`,background:`transparent`,color:C.muted,cursor:`pointer`},children:`Cancel`})]}):(0,B.jsx)(`button`,{onClick:t=>{t.stopPropagation(),i(e.id)},title:`Delete goal`,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:14,padding:`2px 4px`,opacity:+!!c,transition:`opacity 0.15s ease`},children:`✕`})]})]})}function RN({goal:e,onGoalChange:t,onSubmit:n,error:r,inputRef:i}){return(0,B.jsxs)(`div`,{style:{animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsx)(`p`,{style:{color:C.text,fontSize:14,marginBottom:16},children:`Describe what you want automated. Claude will decompose your goal into scheduled jobs with prompts, schedules, and dependencies.`}),(0,B.jsx)(`textarea`,{ref:i,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&e.metaKey&&n()},placeholder:`e.g., Keep my Linear backlog groomed — close stale tickets, update priorities weekly`,rows:4,style:{width:`100%`,padding:`12px 14px`,background:C.darkBg,border:`1px solid ${MN}`,borderRadius:8,color:C.text,fontSize:14,fontFamily:g,resize:`vertical`,outline:`none`,boxSizing:`border-box`}}),r&&(0,B.jsx)(`p`,{style:{color:C.red,fontSize:12,marginTop:8},children:r}),(0,B.jsxs)(`div`,{style:{marginTop:16},children:[(0,B.jsx)(`p`,{style:{fontSize:11,color:C.muted,marginBottom:8,textTransform:`uppercase`,letterSpacing:.5},children:`Examples`}),(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:NN.map((e,n)=>(0,B.jsx)(`button`,{onClick:()=>t(e),style:{background:jN,border:`1px solid ${C.border}`,borderRadius:6,padding:`8px 12px`,cursor:`pointer`,color:C.textSecondary,fontSize:13,textAlign:`left`,transition:`border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=MN},onMouseLeave:e=>{e.currentTarget.style.borderColor=C.border},children:e},n))})]}),(0,B.jsx)(`div`,{style:{marginTop:20,display:`flex`,justifyContent:`flex-end`,gap:8},children:(0,B.jsxs)(`button`,{onClick:n,disabled:!e.trim()||e.trim().length<10,style:{padding:`8px 20px`,borderRadius:6,border:`none`,background:e.trim().length>=10?AN:C.border,color:e.trim().length>=10?`var(--color-bg)`:C.muted,fontSize:14,fontWeight:600,cursor:e.trim().length>=10?`pointer`:`default`,transition:`all 0.15s ease`},children:[`Generate Jobs `,`⌘↵`]})})]})}function zN({goal:e}){let[t,n]=(0,L.useState)(``);return(0,L.useEffect)(()=>{let e=setInterval(()=>{n(e=>e.length>=3?``:e+`.`)},500);return()=>clearInterval(e)},[]),(0,B.jsxs)(`div`,{style:{textAlign:`center`,padding:`40px 20px`,animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsx)(`div`,{style:{width:48,height:48,margin:`0 auto 20px`,border:`3px solid ${C.border}`,borderTopColor:AN,borderRadius:`50%`,animation:`spin 1s linear infinite`}}),(0,B.jsxs)(`p`,{style:{color:C.text,fontSize:15,fontWeight:500,marginBottom:8},children:[`Analyzing your goal`,t]}),(0,B.jsx)(`p`,{style:{color:C.muted,fontSize:13,maxWidth:400,margin:`0 auto`},children:`Claude is decomposing your goal into jobs with schedules, prompts, and dependencies. This takes 15–30 seconds.`}),(0,B.jsx)(`div`,{style:{marginTop:20,padding:`10px 14px`,background:jN,borderRadius:6,display:`inline-block`},children:(0,B.jsxs)(`p`,{style:{fontSize:12,color:AN,fontFamily:g},children:[`"`,e.length>80?e.slice(0,80)+`…`:e,`"`]})})]})}function BN({jobs:e,dependencies:t,reasoning:n,expandedJob:r,onToggleExpand:i,onRemoveJob:a,onUpdateJob:o,onConfirm:s,onBack:c,error:l}){return(0,B.jsxs)(`div`,{style:{animation:`fadeIn 0.15s ease-out`},children:[n&&(0,B.jsxs)(`div`,{style:{padding:`10px 14px`,background:`rgba(86,212,221,0.12)`,borderRadius:6,marginBottom:16,border:`1px solid ${C.border}`},children:[(0,B.jsx)(`p`,{style:{fontSize:12,color:`#56d4dd`,fontWeight:500,marginBottom:4},children:`Reasoning`}),(0,B.jsx)(`p`,{style:{fontSize:13,color:C.textSecondary},children:n})]}),(0,B.jsxs)(`p`,{style:{fontSize:14,color:C.text,marginBottom:12},children:[e.length,` job`,e.length===1?``:`s`,` generated. Review and edit before creating.`]}),t.length>0&&(0,B.jsxs)(`div`,{style:{marginBottom:12,padding:`8px 12px`,background:`rgba(88,166,255,0.08)`,borderRadius:6,border:`1px solid rgba(88,166,255,0.2)`},children:[(0,B.jsx)(`p`,{style:{fontSize:11,color:C.blue,fontWeight:500,marginBottom:4},children:`Dependencies`}),t.map((e,t)=>(0,B.jsxs)(`p`,{style:{fontSize:12,color:C.textSecondary},children:[e.from,` `,`→`,` `,e.to]},t))]}),(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:e.map(e=>(0,B.jsx)(VN,{job:e,expanded:r===e.id,onToggle:()=>i(e.id),onRemove:()=>a(e.id),onUpdate:(t,n)=>o(e.id,t,n)},e.id))}),e.length===0&&(0,B.jsx)(`p`,{style:{textAlign:`center`,color:C.muted,padding:`20px 0`},children:`All jobs removed. Go back to try a different goal.`}),l&&(0,B.jsx)(`p`,{style:{color:C.red,fontSize:12,marginTop:12},children:l}),(0,B.jsxs)(`div`,{style:{marginTop:20,display:`flex`,justifyContent:`space-between`},children:[(0,B.jsxs)(`button`,{onClick:c,style:{padding:`8px 16px`,borderRadius:6,background:`transparent`,border:`1px solid ${C.border}`,color:C.muted,fontSize:13,cursor:`pointer`},children:[`←`,` Back to Goals`]}),(0,B.jsxs)(`button`,{onClick:s,disabled:e.length===0,style:{padding:`8px 20px`,borderRadius:6,border:`none`,background:e.length>0?AN:C.border,color:e.length>0?`var(--color-bg)`:C.muted,fontSize:14,fontWeight:600,cursor:e.length>0?`pointer`:`default`},children:[`Create `,e.length,` Job`,e.length===1?``:`s`]})]})]})}function VN({job:e,expanded:t,onToggle:n,onRemove:r,onUpdate:i}){return(0,B.jsxs)(`div`,{style:{border:`1px solid ${t?MN:C.border}`,borderRadius:8,background:t?jN:C.darkBg,transition:`all 0.15s ease`},children:[(0,B.jsxs)(`div`,{onClick:n,style:{padding:`12px 14px`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{flex:1},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`span`,{style:{fontSize:11,color:AN,fontFamily:g},children:e.id}),(0,B.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:4,background:`rgba(86,212,221,0.15)`,color:AN},children:e.scheduleHuman||e.schedule}),e.priority!==`normal`&&(0,B.jsx)(`span`,{style:{fontSize:10,padding:`1px 6px`,borderRadius:4,background:e.priority===`critical`?`var(--color-negative-soft)`:`rgba(227,179,65,0.15)`,color:e.priority===`critical`?C.red:`#e3b341`},children:e.priority})]}),(0,B.jsx)(`p`,{style:{fontSize:14,color:C.text,marginTop:4,fontWeight:500},children:e.name}),(0,B.jsx)(`p`,{style:{fontSize:12,color:C.muted,marginTop:2},children:e.description})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginLeft:12},children:[(0,B.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r()},title:`Remove this job`,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:14,padding:`2px 4px`},children:`✕`}),(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:12,transition:`transform 0.15s`,transform:t?`rotate(90deg)`:`none`},children:`▶`})]})]}),t&&(0,B.jsxs)(`div`,{style:{padding:`0 14px 14px`,borderTop:`1px solid ${C.border}`,display:`flex`,flexDirection:`column`,gap:10,paddingTop:12},children:[(0,B.jsx)(HN,{label:`Name`,value:e.name,onChange:e=>i(`name`,e)}),(0,B.jsx)(HN,{label:`Schedule (cron)`,value:e.schedule,onChange:e=>i(`schedule`,e)}),(0,B.jsx)(HN,{label:`Schedule (human)`,value:e.scheduleHuman,onChange:e=>i(`scheduleHuman`,e)}),(0,B.jsx)(HN,{label:`Timeout (seconds)`,value:String(e.timeout),onChange:e=>i(`timeout`,parseInt(e)||900),type:`number`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{style:{fontSize:11,color:C.muted,display:`block`,marginBottom:4},children:`Prompt`}),(0,B.jsx)(`textarea`,{value:e.prompt,onChange:e=>i(`prompt`,e.target.value),rows:8,style:{width:`100%`,padding:`8px 10px`,background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:6,color:C.text,fontSize:12,fontFamily:`var(--font-mono)`,resize:`vertical`,outline:`none`,boxSizing:`border-box`}})]}),(0,B.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8,cursor:`pointer`},children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.selfImprove,onChange:e=>i(`selfImprove`,e.target.checked),style:{accentColor:`#56d4dd`}}),(0,B.jsx)(`span`,{style:{fontSize:12,color:C.textSecondary},children:`Self-improve (refine prompt over time)`})]})]})]})}function HN({label:e,value:t,onChange:n,type:r=`text`}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{style:{fontSize:11,color:C.muted,display:`block`,marginBottom:4},children:e}),(0,B.jsx)(`input`,{type:r,value:t,onChange:e=>n(e.target.value),style:{width:`100%`,padding:`6px 10px`,background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:6,color:C.text,fontSize:13,fontFamily:g,outline:`none`,boxSizing:`border-box`}})]})}function UN(){return(0,B.jsxs)(`div`,{style:{textAlign:`center`,padding:`40px 20px`,animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsx)(`div`,{style:{width:48,height:48,margin:`0 auto 20px`,border:`3px solid ${C.border}`,borderTopColor:AN,borderRadius:`50%`,animation:`spin 1s linear infinite`}}),(0,B.jsx)(`p`,{style:{color:C.text,fontSize:15,fontWeight:500},children:`Creating jobs…`})]})}function WN({count:e,onClose:t}){return(0,B.jsxs)(`div`,{style:{textAlign:`center`,padding:`40px 20px`,animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsx)(`div`,{style:{width:56,height:56,margin:`0 auto 20px`,borderRadius:`50%`,background:`var(--color-positive-soft)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,B.jsx)(`span`,{style:{fontSize:28,color:C.green},children:`✓`})}),(0,B.jsxs)(`p`,{style:{color:C.text,fontSize:16,fontWeight:600,marginBottom:8},children:[e,` job`,e===1?``:`s`,` created!`]}),(0,B.jsx)(`p`,{style:{color:C.muted,fontSize:13,marginBottom:24},children:`Your jobs have been created, enabled, and installed to crontab. They'll run on their configured schedules.`}),(0,B.jsx)(`button`,{onClick:t,style:{padding:`8px 24px`,borderRadius:6,border:`none`,background:AN,color:`var(--color-bg)`,fontSize:14,fontWeight:600,cursor:`pointer`},children:`Done`})]})}function GN({open:e,onClose:t,onJobsCreated:n,onGoalDeleted:r}){let[i,a]=(0,L.useState)(`list`),[o,s]=(0,L.useState)([]),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(``),[g,_]=(0,L.useState)(``),[v,y]=(0,L.useState)([]),[b,x]=(0,L.useState)([]),[S,w]=(0,L.useState)(``),[T,E]=(0,L.useState)([]),[D,O]=(0,L.useState)(null),[k,A]=(0,L.useState)(0),[j,M]=(0,L.useState)(``),[N,ee]=(0,L.useState)(null),P=(0,L.useRef)(),F=(0,L.useRef)(null);(0,L.useEffect)(()=>{e&&i===`describe`&&requestAnimationFrame(()=>F.current?.focus())},[e,i]),(0,L.useEffect)(()=>()=>{P.current&&clearInterval(P.current)},[]);let te=(0,L.useCallback)(async()=>{l(!0);try{let e=await fetch(`/api/goals`);if(e.ok){let t=await e.json();s(t.goals??t??[])}}catch{}finally{l(!1)}},[]);(0,L.useEffect)(()=>{e&&(te(),a(`list`))},[e,te]);let I=(0,L.useCallback)(()=>{P.current&&=(clearInterval(P.current),void 0)},[]),ne=(0,L.useCallback)(e=>{I(),P.current=setInterval(async()=>{try{let t=await fetch(`/api/goals/${e}/status`);if(!t.ok)return;let n=await t.json();if(n.status===`done`&&n.result){I();let t=n.result;y(t.jobs??[]),x(t.dependencies??[]),w(t.reasoning??``),E([]),p(e=>e?{...e,status:`review`,result:t}:null),s(t=>t.map(t=>t.id===e?{...t,status:`review`}:t)),a(`review`)}else if(n.status===`error`){I();let t=n.error||`Generation failed`;_(t),p(e=>e?{...e,status:`error`,error:t}:null),s(t=>t.map(t=>t.id===e?{...t,status:`error`}:t)),a(`describe`)}}catch{}},2e3)},[I]),re=(0,L.useCallback)(()=>{I(),a(`list`),d(null),p(null),h(``),_(``),y([]),x([]),w(``),E([]),O(null),M(``),A(0),ee(null)},[I]),R=(0,L.useCallback)(()=>{I(),re(),t()},[I,re,t]),z=(0,L.useCallback)(()=>{d(null),p(null),h(``),_(``),a(`describe`)},[]),ie=(0,L.useCallback)(async e=>{d(e.id),_(``),M(``);try{let t=await fetch(`/api/goals/${e.id}`);if(!t.ok)return;let n=await t.json();if(p(n),h(n.goal),n.status===`describe`||n.status===`error`)_(n.error??``),a(`describe`);else if(n.status===`generating`)a(`generating`),ne(n.id);else if(n.status===`review`||n.status===`partial`||n.status===`created`){let e=n.result;if(e){let t=n.removedJobs??[];y(e.jobs.filter(e=>!t.includes(e.id))),x(e.dependencies??[]),w(e.reasoning??``),E(t)}a(`review`)}}catch{h(e.goal),a(`describe`)}},[ne]),ae=(0,L.useCallback)(async()=>{if(!m.trim()||m.trim().length<10){_(`Please describe your goal in at least 10 characters.`);return}_(``);let e=u;try{if(e)await fetch(`/api/goals/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({goal:m.trim()})});else{let t=await fetch(`/api/goals`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({goal:m.trim()})});if(!t.ok){_((await t.json()).error||`Failed to save goal`);return}let n=await t.json();e=n.id,d(e),p(n),s(e=>[{id:n.id,goal:n.goal,status:n.status,createdAt:n.createdAt},...e])}}catch{_(`Network error — could not save goal`);return}if(e)try{let t=await fetch(`/api/goals/${e}/generate`,{method:`POST`});if(!t.ok){_((await t.json()).error||`Failed to start generation`);return}p(e=>e?{...e,status:`generating`}:null),s(t=>t.map(t=>t.id===e?{...t,status:`generating`}:t)),a(`generating`),ne(e)}catch{_(`Network error — is the server running?`)}},[m,u,ne]),oe=(0,L.useCallback)(async e=>{if(!u)return;let t=[...T,e];E(t),y(t=>t.filter(t=>t.id!==e)),x(t=>t.filter(t=>t.from!==e&&t.to!==e)),fetch(`/api/goals/${u}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({removedJobs:t})}).catch(()=>{})},[u,T]),se=(0,L.useCallback)((e,t,n)=>{y(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),V=(0,L.useCallback)(async()=>{if(!(!u||v.length===0)){a(`creating`),M(``);try{let e=await fetch(`/api/goals/${u}/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jobs:v,dependencies:b})}),t=await e.json();if(!e.ok){M(t.error||`Failed to create jobs`),a(`review`);return}A(t.created),s(e=>e.map(e=>e.id===u?{...e,status:`created`,jobCount:t.created}:e)),fetch(`/api/install`,{method:`POST`}).catch(()=>{}),a(`done`),n()}catch{M(`Network error — failed to create jobs`),a(`review`)}}},[u,v,b,n]),ce=(0,L.useCallback)(async e=>{if(N!==e){ee(e);return}ee(null);try{await fetch(`/api/goals/${e}`,{method:`DELETE`}),s(t=>t.filter(t=>t.id!==e)),r?.()}catch{}},[N,r]);return e?(0,B.jsxs)(`div`,{onClick:e=>{e.target===e.currentTarget&&R()},style:{position:`fixed`,inset:0,zIndex:1e4,display:`flex`,alignItems:`flex-start`,justifyContent:`center`,paddingTop:`8vh`,background:`rgba(0,0,0,0.6)`,animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsxs)(`div`,{style:{background:C.cardBg,border:`1px solid ${MN}`,borderRadius:12,width:640,maxWidth:`92vw`,maxHeight:`80vh`,display:`flex`,flexDirection:`column`,overflow:`hidden`,boxShadow:`0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px ${MN}`,animation:`fadeIn 0.15s ease-out`},children:[(0,B.jsxs)(`div`,{style:{padding:`16px 20px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,flexShrink:0},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[i!==`list`&&(0,B.jsx)(`button`,{onClick:re,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:14,padding:`2px 4px`,display:`flex`,alignItems:`center`},title:`Back to goals list`,children:`←`}),(0,B.jsx)(`span`,{style:{fontSize:18},children:`✨`}),(0,B.jsx)(`span`,{style:{fontSize:15,fontWeight:600,color:AN},children:`Goal Wizard`}),i!==`list`&&(0,B.jsx)(FN,{current:i})]}),(0,B.jsx)(`button`,{onClick:R,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:18,padding:`2px 6px`},children:`✕`})]}),(0,B.jsxs)(`div`,{style:{flex:1,overflow:`auto`,padding:`20px`},children:[i===`list`&&(0,B.jsx)(IN,{goals:o,loading:c,deleteConfirmId:N,onNewGoal:z,onResumeGoal:ie,onDeleteGoal:ce,onCancelDelete:()=>ee(null)}),i===`describe`&&(0,B.jsx)(RN,{goal:m,onGoalChange:h,onSubmit:ae,error:g,inputRef:F}),i===`generating`&&(0,B.jsx)(zN,{goal:m}),i===`review`&&(0,B.jsx)(BN,{jobs:v,dependencies:b,reasoning:S,expandedJob:D,onToggleExpand:e=>O(t=>t===e?null:e),onRemoveJob:oe,onUpdateJob:se,onConfirm:V,onBack:re,error:j}),i===`creating`&&(0,B.jsx)(UN,{}),i===`done`&&(0,B.jsx)(WN,{count:k,onClose:R})]})]}),(0,B.jsx)(`style`,{children:`
|
|
89
|
-
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
|
|
90
|
-
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: translateY(0) } }
|
|
91
|
-
@keyframes pulse-badge { 0%, 100% { opacity: 1 } 50% { opacity: 0.5 } }
|
|
92
|
-
@keyframes spin { to { transform: rotate(360deg) } }
|
|
93
|
-
`})]}):null}function KN({open:e,onClose:t,jobs:n,onRunJob:r,onCancelJob:i,onSelectJob:a,onCopyJobId:o,onNewJob:s,onDuplicateJob:c,onRefresh:l,onSyncCron:u,onToggleActivity:d,onToggleFocus:f,onToggleSettings:p,onShowHelp:m,onPauseAll:h,onResumeAll:_,onOutputSearch:v,onPromptLab:y,onGoalWizard:b,paused:x}){let[S,w]=(0,L.useState)(``),[T,E]=(0,L.useState)(0),D=(0,L.useRef)(null),O=(0,L.useRef)(null),k=(0,L.useMemo)(()=>{let e=[];for(let t of n){let n=t.name||t.id;e.push({id:`open-${t.id}`,label:`Open ${n}`,category:`Jobs`,icon:`▶`,action:()=>a(t.id)}),t.lastStatus===`running`?e.push({id:`cancel-${t.id}`,label:`Cancel ${n}`,category:`Jobs`,icon:`■`,action:()=>i(t.id)}):e.push({id:`run-${t.id}`,label:`Run ${n}`,category:`Jobs`,icon:`▷`,action:()=>r(t.id)}),c&&e.push({id:`dup-${t.id}`,label:`Duplicate ${n}`,category:`Jobs`,icon:`⎘`,action:()=>c(t)}),o&&e.push({id:`copy-${t.id}`,label:`Copy ID: ${n}`,category:`Jobs`,icon:`📋`,action:()=>o(t)}),y&&t.prompt&&e.push({id:`lab-${t.id}`,label:`Prompt Lab: ${n}`,category:`Jobs`,icon:`🧪`,action:()=>y(t.id)})}return b&&e.push({id:`goal-wizard`,label:`Goal Wizard — generate jobs from a goal`,category:`System`,icon:`✨`,action:b}),e.push({id:`search-outputs`,label:`Search Outputs`,category:`System`,icon:`🔍`,action:v},{id:`new-job`,label:`New Job`,category:`System`,icon:`+`,action:s},{id:`refresh`,label:`Refresh`,category:`System`,icon:`↻`,action:l},{id:`sync-cron`,label:`Sync Crontab`,category:`System`,icon:`⇄`,action:u},x?{id:`resume`,label:`Resume All Jobs`,category:`System`,icon:`▶`,action:_}:{id:`pause`,label:`Pause All Jobs`,category:`System`,icon:`⏸`,action:h}),e.push({id:`nav-activity`,label:`Activity Feed`,category:`Navigate`,icon:`☰`,action:d},{id:`nav-focus`,label:`Focus Mode`,category:`Navigate`,icon:`☆`,action:f},{id:`nav-settings`,label:`Settings`,category:`Navigate`,icon:`⚙`,action:p},{id:`nav-help`,label:`Keyboard Shortcuts`,category:`Navigate`,icon:`?`,action:m}),e},[n,x,a,r,i,o,s,c,y,b,l,u,h,_,v,d,f,p,m]),A=(0,L.useMemo)(()=>{if(!S.trim())return k;let e=S.toLowerCase();return k.filter(t=>t.label.toLowerCase().includes(e))},[k,S]),j=(0,L.useMemo)(()=>{let e=new Map;for(let t of A)e.has(t.category)||e.set(t.category,[]),e.get(t.category).push(t);return[...e.entries()]},[A]);(0,L.useEffect)(()=>{e&&(w(``),E(0),requestAnimationFrame(()=>D.current?.focus()))},[e]),(0,L.useEffect)(()=>{E(e=>Math.min(e,Math.max(0,A.length-1)))},[A.length]),(0,L.useEffect)(()=>{if(!O.current)return;let e=O.current.querySelector(`[data-selected="true"]`);e&&e.scrollIntoView({block:`nearest`})},[T]);let M=(0,L.useCallback)(e=>{t(),requestAnimationFrame(()=>e.action())},[t]),N=(0,L.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),E(e=>Math.min(e+1,A.length-1))):e.key===`ArrowUp`?(e.preventDefault(),E(e=>Math.max(e-1,0))):e.key===`Enter`?(e.preventDefault(),A[T]&&M(A[T])):e.key===`Escape`&&(e.preventDefault(),t())},[A,T,M,t]);if(!e)return null;let ee=0;return(0,B.jsx)(`div`,{onClick:e=>{e.target===e.currentTarget&&t()},style:{position:`fixed`,inset:0,zIndex:1e4,display:`flex`,alignItems:`flex-start`,justifyContent:`center`,paddingTop:`15vh`,background:`rgba(0,0,0,0.6)`,animation:`fadeIn 0.1s ease-out`},children:(0,B.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,style:{background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:12,width:520,maxWidth:`90vw`,maxHeight:`60vh`,display:`flex`,flexDirection:`column`,overflow:`hidden`,boxShadow:`0 16px 48px rgba(0,0,0,0.5)`,animation:`fadeIn 0.12s ease-out`},children:[(0,B.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,gap:10},children:[(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:15,flexShrink:0},children:`›`}),(0,B.jsx)(`input`,{ref:D,value:S,onChange:e=>{w(e.target.value),E(0)},onKeyDown:N,"aria-label":`Search commands`,placeholder:`Type a command…`,style:{flex:1,background:`transparent`,border:`none`,outline:`none`,color:C.text,fontSize:15,fontFamily:g}}),(0,B.jsx)(`kbd`,{style:{fontSize:11,padding:`2px 6px`,border:`1px solid ${C.border}`,borderRadius:4,background:C.darkBg,color:C.muted,fontFamily:g},children:`esc`})]}),(0,B.jsx)(`div`,{ref:O,style:{overflowY:`auto`,padding:`8px 0`},children:A.length===0?(0,B.jsx)(`div`,{style:{padding:`24px 16px`,textAlign:`center`,color:C.muted,fontSize:13},children:`No matching commands`}):j.map(([e,t])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{padding:`6px 16px 4px`,fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.5,fontWeight:600},children:e}),t.map(e=>{let t=ee++,n=t===T;return(0,B.jsxs)(`button`,{"data-selected":n,onClick:()=>M(e),onMouseEnter:()=>E(t),style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`,padding:`8px 16px`,background:n?`rgba(88,166,255,0.1)`:`transparent`,border:`none`,cursor:`pointer`,textAlign:`left`,color:n?C.text:C.textSecondary,fontSize:14,transition:`background 0.08s ease`},children:[(0,B.jsx)(`span`,{style:{width:22,textAlign:`center`,flexShrink:0,fontSize:13,color:C.muted},children:e.icon}),(0,B.jsx)(`span`,{style:{flex:1},children:e.label}),n&&(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted},children:`↵`})]},e.id)})]},e))})]})})}function qN(e,t){if(!t)return[e];let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=0,o=r.indexOf(i);for(;o!==-1;)o>a&&n.push(e.slice(a,o)),n.push((0,B.jsx)(`mark`,{style:{background:`var(--color-primary)40`,color:C.text,borderRadius:2,padding:`0 1px`},children:e.slice(o,o+t.length)},o)),a=o+t.length,o=r.indexOf(i,a);return a<e.length&&n.push(e.slice(a)),n}function JN({open:e,onClose:t,onSelectJob:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(7),[p,m]=(0,L.useState)(0),h=(0,L.useRef)(null),_=(0,L.useRef)(),v=(0,L.useRef)(null);(0,L.useEffect)(()=>{e&&(i(``),o([]),u(!1),m(0),f(7),requestAnimationFrame(()=>h.current?.focus()))},[e]),(0,L.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]);let y=(0,L.useCallback)(async(e,t)=>{if(e.length<2){o([]),u(!1);return}c(!0);try{let n=await fetch(`/api/search?q=${encodeURIComponent(e)}&days=${t}&limit=25`);if(!n.ok)return;o((await n.json()).results),u(!0),m(0)}catch{}finally{c(!1)}},[]),b=(0,L.useCallback)(e=>{i(e),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>y(e,d),300)},[y,d]),x=(0,L.useCallback)(()=>{let e=d===7?30:90;f(e),r.length>=2&&y(r,e)},[d,r,y]),S=(0,L.useCallback)(e=>{e.key===`ArrowDown`?(e.preventDefault(),m(e=>Math.min(e+1,a.length-1))):e.key===`ArrowUp`?(e.preventDefault(),m(e=>Math.max(e-1,0))):e.key===`Enter`&&a[p]&&(e.preventDefault(),n(a[p].jobId),t())},[a,p,n,t]);if((0,L.useEffect)(()=>{let e=v.current;if(!e)return;let t=e.children[p];t&&t.scrollIntoView({block:`nearest`})},[p]),!e)return null;let w=new Map,T=[`var(--color-primary)`,C.blue,C.green,C.warning,`#f778ba`,`#ff7b72`],E=0;for(let e of a)w.has(e.jobId)||(w.set(e.jobId,T[E%T.length]),E++);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:t,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.6)`,zIndex:3e3,animation:`fadeIn 0.12s ease-out`}}),(0,B.jsxs)(`div`,{style:{position:`fixed`,top:`12%`,left:0,right:0,width:680,maxWidth:`92vw`,maxHeight:`72vh`,margin:`0 auto`,background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:14,boxShadow:`0 20px 60px rgba(0,0,0,0.5)`,zIndex:3001,display:`flex`,flexDirection:`column`,overflow:`hidden`,animation:`fadeIn 0.12s ease-out`},onKeyDown:S,children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`14px 18px`,borderBottom:`1px solid ${C.border}`},children:[(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:16,flexShrink:0},children:`🔍`}),(0,B.jsx)(`input`,{ref:h,type:`text`,value:r,onChange:e=>b(e.target.value),placeholder:`Search across all job outputs...`,style:{flex:1,background:`transparent`,border:`none`,outline:`none`,color:C.text,fontSize:15,fontFamily:`inherit`}}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexShrink:0},children:[s&&(0,B.jsx)(`span`,{style:{display:`inline-block`,width:14,height:14,border:`2px solid ${C.border}`,borderTopColor:`var(--color-primary)`,borderRadius:`50%`,animation:`spin 0.6s linear infinite`}}),(0,B.jsxs)(`span`,{style:{fontSize:11,color:C.muted,background:C.darkBg,padding:`2px 6px`,borderRadius:4,border:`1px solid ${C.border}`},children:[d,`d`]}),(0,B.jsx)(`kbd`,{style:{fontSize:10,padding:`2px 6px`,border:`1px solid ${C.border}`,borderRadius:3,color:C.muted,background:C.darkBg,fontFamily:g},children:`Esc`})]})]}),(0,B.jsxs)(`div`,{ref:v,style:{flex:1,overflowY:`auto`,padding:a.length>0?`6px 0`:`0`},children:[!l&&!s&&(0,B.jsxs)(`div`,{style:{padding:`40px 20px`,textAlign:`center`,color:C.muted,fontSize:13},children:[(0,B.jsx)(`div`,{style:{fontSize:32,marginBottom:12,opacity:.4},children:`🔎`}),(0,B.jsx)(`div`,{children:`Search across all agent outputs`}),(0,B.jsx)(`div`,{style:{fontSize:12,marginTop:6,opacity:.7},children:`Find when a job mentioned a keyword, produced a specific result, or encountered an error`})]}),l&&!s&&a.length===0&&(0,B.jsxs)(`div`,{style:{padding:`32px 20px`,textAlign:`center`,color:C.muted,fontSize:13},children:[(0,B.jsxs)(`div`,{style:{marginBottom:8},children:[`No matches in the last `,d,` days`]}),d<90&&(0,B.jsxs)(`button`,{onClick:x,style:{background:`none`,border:`1px solid ${C.border}`,borderRadius:6,color:`var(--color-primary)`,padding:`4px 12px`,fontSize:12,cursor:`pointer`,fontFamily:`inherit`,transition:`border-color 0.15s`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`var(--color-primary)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=C.border},children:[`Search last `,d===7?`30`:`90`,` days instead`]})]}),a.map((e,i)=>{let a=w.get(e.jobId)||C.muted,o=i===p;return(0,B.jsxs)(`div`,{onClick:()=>{n(e.jobId),t()},onMouseEnter:()=>m(i),style:{padding:`10px 18px`,cursor:`pointer`,background:o?`var(--color-primary)10`:`transparent`,borderLeft:o?`2px solid var(--color-primary)`:`2px solid transparent`,transition:`background 0.1s, border-color 0.1s`,animation:`fadeIn 0.15s ease-out both`,animationDelay:`${i*.02}s`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,B.jsx)(`span`,{style:{fontSize:11,fontWeight:600,color:a,background:`${a}15`,padding:`1px 8px`,borderRadius:4,flexShrink:0},children:e.jobName}),(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,fontFamily:g},children:Be(e.timestamp)}),(0,B.jsxs)(`span`,{style:{fontSize:10,color:`var(--color-text-muted)`,fontFamily:g,marginLeft:`auto`},children:[`L`,e.lineNumber]})]}),(0,B.jsx)(`pre`,{style:{margin:0,fontFamily:g,fontSize:12,lineHeight:1.5,color:C.textSecondary,whiteSpace:`pre-wrap`,wordBreak:`break-word`,maxHeight:72,overflow:`hidden`,background:C.darkBg,padding:`6px 10px`,borderRadius:6,border:`1px solid var(--color-border-strong)`},children:qN(e.snippet,r)})]},`${e.file}-${e.lineNumber}`)})]}),l&&a.length>0&&(0,B.jsxs)(`div`,{style:{padding:`8px 18px`,borderTop:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,fontSize:12,color:C.muted,flexShrink:0},children:[(0,B.jsxs)(`span`,{children:[a.length,` result`,a.length===1?``:`s`,` in last `,d,` days`]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[d<90&&(0,B.jsxs)(`button`,{onClick:x,style:{background:`none`,border:`none`,color:`var(--color-primary)`,fontSize:12,cursor:`pointer`,padding:0,fontFamily:`inherit`,opacity:.8,transition:`opacity 0.15s`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.8`},children:[`Search `,d===7?`30`:`90`,` days`]}),(0,B.jsxs)(`span`,{style:{fontSize:11,opacity:.6},children:[`↑↓`,` navigate · `,`⏎`,` open`]})]})]})]})]})}var YN=[{heading:`Navigation`,items:Se.map(e=>({key:e.display,label:e.label}))},{heading:`Actions`,items:[{key:`⌘K`,label:`Command palette`},{key:`⌘⇧F`,label:`Search outputs`},{key:`?`,label:`Toggle this help`},{key:`/`,label:`Focus search`},{key:`n`,label:`New job`},{key:`r`,label:`Refresh`},{key:`i`,label:`Sync cron jobs`},{key:`a`,label:`Toggle activity feed`},{key:`f`,label:`Toggle focus mode`},{key:`,`,label:`Toggle settings`},{key:`Esc`,label:`Close panel / modal`}]},{heading:`Chat Input Modes`,items:[{key:`Esc`,label:`Normal ↔ Scroll mode (in chat input)`},{key:`⌘⇧P`,label:`Normal ↔ Passthrough mode`},{key:`⌘↵`,label:`Send from any mode`}]}];function XN({open:e,onClose:t}){let n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(!e)return;let r=e=>{e.target===n.current&&t()};return document.addEventListener(`mousedown`,r),()=>document.removeEventListener(`mousedown`,r)},[e,t]),e?(0,B.jsx)(`div`,{ref:n,style:{position:`fixed`,inset:0,zIndex:9999,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(0,0,0,0.6)`,animation:`fadeIn 0.15s ease-out`},children:(0,B.jsxs)(`div`,{style:{background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:12,padding:`24px 28px`,width:340,maxWidth:`90vw`,maxHeight:`calc(100vh - 80px)`,overflowY:`auto`,animation:`fadeInUp 0.2s ease-out`},children:[(0,B.jsxs)(`div`,{style:{position:`sticky`,top:0,background:C.cardBg,display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:16,paddingBottom:8,zIndex:1},children:[(0,B.jsx)(`h3`,{style:{fontSize:15,fontWeight:600,color:C.text,margin:0},children:`Keyboard Shortcuts`}),(0,B.jsx)(`button`,{onClick:t,className:`btn btn-sm`,style:{fontSize:12,padding:`2px 8px`},children:`Esc`})]}),YN.map((e,t)=>(0,B.jsxs)(`div`,{style:{marginTop:t>0?16:0},children:[(0,B.jsx)(Fk,{style:{marginBottom:4},children:e.heading}),(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:e.items.map(({key:e,label:t})=>(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`6px 0`},children:[(0,B.jsx)(`span`,{style:{fontSize:13,color:C.muted},children:t}),(0,B.jsx)(`kbd`,{style:{display:`inline-block`,padding:`2px 8px`,fontSize:12,fontFamily:g,color:C.text,background:C.darkBg,border:`1px solid ${C.border}`,borderRadius:4,minWidth:24,textAlign:`center`},children:e})]},e))})]},e.heading))]})}):null}async function ZN(e){try{let t=await fetch(`/api/ollama/models?host=${encodeURIComponent(e)}`),n=await t.json().catch(()=>({}));return t.ok?{ok:!0,models:(n.models??[]).map(e=>e.name)}:{ok:!1,error:n.error??`HTTP ${t.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:`network error`}}}var QN=[{value:`claude-opus-4-7`,label:`Opus 4.7`},{value:`claude-sonnet-4-6`,label:`Sonnet 4.6`},{value:`claude-haiku-4-5-20251001`,label:`Haiku 4.5`}];function $N(e){return QN.some(t=>t.value===e)}var eP=[{value:``,label:`inherit from job (default)`},{value:`true`,label:`always enabled`},{value:`false`,label:`always disabled`}];function tP(e){return e===!0?`true`:e===!1?`false`:``}function nP(e){return e===`true`?!0:e===`false`?!1:null}function rP(e){return e===`true`||e===`false`?e:``}var iP=[`executive`,`manager`,`senior`,`employee`],aP=[`low`,`medium`,`high`,`xhigh`,`max`],oP={executive:C.warning,manager:`var(--color-info)`,senior:`var(--color-text-muted)`,employee:C.textSecondary},sP={...w,color:C.textSecondary},cP={..._,color:C.textSecondary},lP={...k,marginBottom:4,display:`block`};function uP({title:e,children:t}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:.5,color:C.muted,marginBottom:8},children:e}),t]})}function dP({label:e,children:t}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`label`,{style:lP,children:e}),t]})}function fP(e){return{displayName:e.displayName||``,emoji:e.emoji||``,rank:e.rank,department:e.department,reportsTo:e.reportsTo||``,persona:e.persona||``,model:e.model||``,engine:e.engine||``,maxCostUsd:e.maxCostUsd==null?``:String(e.maxCostUsd),effortLevel:e.effortLevel||``,claudeAiMcp:tP(e.claudeAiMcp),profile:e.profile||``,mcpServers:Array.isArray(e.mcpServers)?[...e.mcpServers]:[]}}function pP(){return te(`/api/mcp/catalog`)}var mP={combo:`_combo_gxacp_1`,comboTrigger:`_comboTrigger_gxacp_9`,comboCaret:`_comboCaret_gxacp_33`,comboChips:`_comboChips_gxacp_39`,comboChip:`_comboChip_gxacp_39`,comboChipX:`_comboChipX_gxacp_63`,comboDropdown:`_comboDropdown_gxacp_68`,comboSearch:`_comboSearch_gxacp_86`,comboList:`_comboList_gxacp_102`,comboOption:`_comboOption_gxacp_113`,comboCheck:`_comboCheck_gxacp_137`,comboGlyph:`_comboGlyph_gxacp_156`,comboOptionName:`_comboOptionName_gxacp_163`,comboOptionCount:`_comboOptionCount_gxacp_171`,comboMessage:`_comboMessage_gxacp_177`,comboClear:`_comboClear_gxacp_184`};function hP({options:e,selected:t,onChange:n,emptyLabel:r=`Any`,searchPlaceholder:i=`Filter…`,loading:a,renderGlyph:o}){let[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(``),d=(0,L.useRef)(null),f=(0,L.useRef)(null),p=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!s)return;let e=e=>{d.current&&!d.current.contains(e.target)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]),(0,L.useEffect)(()=>{s&&f.current?.focus()},[s]),(0,L.useEffect)(()=>{p.current=null},[l]);let m=t=>e.find(e=>e.value===t)?.label??t,h=(0,L.useMemo)(()=>{let t=l.trim().toLowerCase();return t?e.filter(e=>(e.label??e.value).toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):e},[e,l]),g=e=>{t.includes(e)?n(t.filter(t=>t!==e)):n([...t,e])},_=(e,r)=>{let i=h[r];if(!i)return;let a=p.current;if(e.shiftKey&&a!==null&&a!==r){let[e,i]=a<r?[a,r]:[r,a],o=h.slice(e,i+1).map(e=>e.value);n(Array.from(new Set([...t,...o]))),p.current=r;return}g(i.value),p.current=r},v=t.length===0?r:t.length===1?m(t[0]):`${t.length} selected`;return(0,B.jsxs)(`div`,{ref:d,className:mP.combo,children:[(0,B.jsxs)(`button`,{type:`button`,className:mP.comboTrigger,onClick:()=>c(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":s,children:[(0,B.jsx)(`span`,{children:v}),(0,B.jsx)(`span`,{className:mP.comboCaret,"aria-hidden":!0,children:`▾`})]}),!s&&t.length>0?(0,B.jsx)(`div`,{className:mP.comboChips,children:t.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:mP.comboChip,onClick:()=>g(e),title:`Remove ${m(e)}`,children:[m(e),(0,B.jsx)(`span`,{className:mP.comboChipX,"aria-hidden":!0,children:`✕`})]},e))}):null,s?(0,B.jsxs)(`div`,{className:mP.comboDropdown,children:[(0,B.jsx)(`input`,{ref:f,type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:i,className:mP.comboSearch,"aria-label":i}),a?(0,B.jsx)(`div`,{className:mP.comboMessage,children:`Loading…`}):h.length===0?(0,B.jsx)(`div`,{className:mP.comboMessage,children:l?`No matches for "${l}"`:`No options`}):(0,B.jsx)(`ul`,{role:`listbox`,"aria-multiselectable":`true`,className:mP.comboList,children:h.map((e,n)=>{let r=t.includes(e.value);return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,className:mP.comboOption,onClick:e=>_(e,n),children:[(0,B.jsx)(`span`,{className:mP.comboCheck,"aria-hidden":`true`,children:r?(0,B.jsx)(gP,{}):null}),o?(0,B.jsx)(`span`,{className:mP.comboGlyph,"aria-hidden":`true`,children:o(e)}):null,(0,B.jsx)(`span`,{className:mP.comboOptionName,children:e.label??e.value}),typeof e.count==`number`?(0,B.jsx)(`span`,{className:mP.comboOptionCount,children:e.count}):null]})},e.value)})}),t.length>0?(0,B.jsxs)(`button`,{type:`button`,className:mP.comboClear,onClick:()=>n([]),children:[`Clear all (`,t.length,`)`]}):null]}):null]})}function gP(){return(0,B.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M2.5 6.25l2.4 2.4L9.5 3.6`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function _P({value:e,onChange:t}){let n=pP(),[r,i]=(0,L.useState)(``),a=(0,L.useMemo)(()=>{let t=n.status===`ok`?n.data.servers.map(e=>({value:e.name,label:e.name})):[],r=new Set(t.map(e=>e.value)),i=e.filter(e=>!r.has(e)).map(e=>({value:e,label:`${e} (custom)`}));return[...t,...i]},[n,e]),o=()=>{let n=r.trim();if(n){if(e.includes(n)){i(``);return}t([...e,n]),i(``)}};return(0,B.jsxs)(dP,{label:`MCP Servers`,children:[(0,B.jsx)(hP,{options:a,selected:e,onChange:t,emptyLabel:`None (defaults to gateway)`,searchPlaceholder:`Filter MCP servers…`,loading:n.status===`loading`}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:8},children:[(0,B.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},placeholder:`Add custom name (e.g. plugin:my-plugin:server)`,style:{...sP,flex:1,fontSize:12}}),(0,B.jsx)(`button`,{type:`button`,onClick:o,disabled:!r.trim(),style:{padding:`4px 10px`,fontSize:12,background:r.trim()?`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.15)`:`transparent`,color:r.trim()?`var(--color-primary)`:C.muted,border:`1px solid ${r.trim()?`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.4)`:C.border}`,borderRadius:6,cursor:r.trim()?`pointer`:`default`},children:`Add`})]}),(0,B.jsxs)(`div`,{style:{fontSize:11,color:C.muted,marginTop:6,lineHeight:1.4},children:[`Servers this employee’s spawns can declare. Pick from enabled plugins + user-scope MCPs, or type a custom name. Leave empty to inherit from the SpawnProfile (or fall through to `,(0,B.jsx)(`code`,{children:`gateway`}),`).`]}),n.status===`error`&&(0,B.jsxs)(`div`,{style:{fontSize:11,color:C.red,marginTop:6},children:[`Could not load MCP catalog: `,n.error]})]})}function vP({value:e,onChange:t}){let n=c_(),r=n.status===`ok`?n.data:[];return(0,B.jsxs)(dP,{label:`SpawnProfile`,children:[(0,B.jsxs)(`select`,{value:e,onChange:e=>t(e.target.value),style:cP,children:[(0,B.jsx)(`option`,{value:``,children:`— (no profile)`}),r.map(e=>(0,B.jsxs)(`option`,{value:e.name,children:[e.name,` `,e.source===`override`?`(override)`:``]},e.name))]}),(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,marginTop:6,lineHeight:1.4},children:`Named baseline of MCP servers + enabled marketplace plugins + claude.ai opt-in. Per-employee explicit fields still override individual dials.`})]})}function yP({employee:e,allEmployees:t,departments:n,ollamaModels:r,ollamaHost:i,editFields:a,onFieldChange:o,saving:s,saveError:c,onSave:l,confirmDelete:u,setConfirmDelete:d,deleting:f,deleteError:p,setDeleteError:m,onDelete:h}){return(0,B.jsx)(uP,{title:`Edit Employee`,children:(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsx)(dP,{label:`Display Name`,children:(0,B.jsx)(`input`,{type:`text`,value:a.displayName,onChange:e=>o(`displayName`,e.target.value),style:sP,placeholder:e.name})}),(0,B.jsx)(dP,{label:`Emoji`,children:(0,B.jsx)(`input`,{type:`text`,value:a.emoji,onChange:e=>o(`emoji`,e.target.value),style:{...sP,maxWidth:80},placeholder:`\\u{1F464}`})}),(0,B.jsx)(dP,{label:`Rank`,children:(0,B.jsx)(`select`,{value:a.rank,onChange:e=>o(`rank`,e.target.value),style:cP,children:iP.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})}),(0,B.jsx)(dP,{label:`Department`,children:(0,B.jsxs)(`select`,{value:a.department,onChange:e=>o(`department`,e.target.value),style:cP,children:[n.length===0&&a.department&&(0,B.jsx)(`option`,{value:a.department,children:a.department}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})}),(0,B.jsx)(dP,{label:`Reports To`,children:(0,B.jsxs)(`select`,{value:a.reportsTo,onChange:e=>o(`reportsTo`,e.target.value),style:cP,children:[(0,B.jsx)(`option`,{value:``,children:`(None — root)`}),t.filter(t=>t.name!==e.name).map(e=>(0,B.jsxs)(`option`,{value:e.name,children:[e.emoji||`👤`,` `,e.displayName||e.name,` (`,e.rank,`, `,e.department,`)`]},e.name))]})}),(0,B.jsx)(dP,{label:`Persona`,children:(0,B.jsx)(`textarea`,{value:a.persona,onChange:e=>o(`persona`,e.target.value),style:{...sP,minHeight:100,resize:`vertical`}})}),(0,B.jsx)(dP,{label:`Engine`,children:(0,B.jsxs)(`select`,{value:a.engine,onChange:e=>{o(`engine`,e.target.value),o(`model`,``)},style:cP,children:[(0,B.jsx)(`option`,{value:``,children:`claude (default)`}),i&&(0,B.jsx)(`option`,{value:`ollama`,children:`ollama`})]})}),(0,B.jsx)(dP,{label:`Model`,children:a.engine===`ollama`&&r.length>0?(0,B.jsxs)(`select`,{value:a.model,onChange:e=>o(`model`,e.target.value),style:cP,children:[(0,B.jsx)(`option`,{value:``,children:`— use engine default —`}),!r.includes(a.model)&&a.model&&(0,B.jsxs)(`option`,{value:a.model,children:[a.model,` (not found)`]}),r.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}):a.engine===`ollama`&&!i?(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,padding:`6px 0`},children:`Configure Ollama host in Settings first`}):a.engine===``||a.engine===`claude`?(0,B.jsxs)(`select`,{value:a.model,onChange:e=>o(`model`,e.target.value),style:cP,children:[(0,B.jsx)(`option`,{value:``,children:`— use engine default —`}),a.model&&!$N(a.model)&&(0,B.jsxs)(`option`,{value:a.model,children:[a.model,` (custom)`]}),QN.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))]}):(0,B.jsx)(`input`,{type:`text`,value:a.model,onChange:e=>o(`model`,e.target.value),style:sP,placeholder:`model name`})}),(0,B.jsx)(dP,{label:`Max Cost (USD)`,children:(0,B.jsx)(`input`,{type:`number`,value:a.maxCostUsd,onChange:e=>o(`maxCostUsd`,e.target.value),style:{...sP,maxWidth:120},step:`0.01`,min:`0`})}),(0,B.jsx)(dP,{label:`Effort Level`,children:(0,B.jsxs)(`select`,{value:a.effortLevel,onChange:e=>o(`effortLevel`,e.target.value),style:cP,children:[(0,B.jsx)(`option`,{value:``,children:`—`}),aP.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})}),(0,B.jsx)(_P,{value:a.mcpServers,onChange:e=>o(`mcpServers`,e)}),(0,B.jsxs)(dP,{label:`claude.ai MCP`,children:[(0,B.jsx)(`select`,{value:a.claudeAiMcp,onChange:e=>o(`claudeAiMcp`,rP(e.target.value)),style:cP,children:eP.map(e=>(0,B.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,marginTop:6,lineHeight:1.4},children:`When enabled, spawns can reach claude.ai connectors (Gmail, Drive, Calendar, etc.) and ALSO see every other ambient MCP server (strict MCP gating drops). This employee setting wins over the job’s value.`})]}),(0,B.jsx)(vP,{value:a.profile,onChange:e=>o(`profile`,e)}),a.profile&&(0,B.jsx)(d_,{name:a.profile}),c&&(0,B.jsx)(`div`,{style:{fontSize:12,color:C.red,padding:`6px 10px`,background:`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.07)`,border:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.2)`,borderRadius:6},children:c}),(0,B.jsx)(`button`,{onClick:l,disabled:s,style:{width:`100%`,padding:`10px 16px`,background:s?`hsl(var(--positive-h) var(--positive-s) var(--positive-l) / 0.07)`:`hsl(var(--positive-h) var(--positive-s) var(--positive-l) / 0.13)`,color:C.green,border:`1px solid hsl(var(--positive-h) var(--positive-s) var(--positive-l) / 0.27)`,borderRadius:8,cursor:s?`default`:`pointer`,fontSize:14,fontWeight:500,opacity:s?.6:1,transition:`background 0.15s, opacity 0.15s`},onMouseEnter:e=>{s||(e.currentTarget.style.background=`hsl(var(--positive-h) var(--positive-s) var(--positive-l) / 0.2)`)},onMouseLeave:e=>{s||(e.currentTarget.style.background=`hsl(var(--positive-h) var(--positive-s) var(--positive-l) / 0.13)`)},children:s?`Saving...`:`Save Changes`}),(0,B.jsxs)(`div`,{style:{marginTop:8,paddingTop:16,borderTop:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.13)`},children:[p&&(0,B.jsx)(`div`,{style:{fontSize:12,color:C.red,padding:`6px 10px`,marginBottom:8,background:`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.07)`,border:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.2)`,borderRadius:6},children:p}),u?(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,B.jsxs)(`div`,{style:{fontSize:12,color:C.red,textAlign:`center`},children:[`Delete `,(0,B.jsx)(`strong`,{children:e.displayName||e.name}),`? This cannot be undone.`]}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(`button`,{onClick:()=>{d(!1),m(null)},disabled:f,style:{flex:1,padding:`10px 16px`,background:`var(--color-border)`,color:C.textSecondary,border:`1px solid ${C.border}`,borderRadius:8,cursor:`pointer`,fontSize:14,fontWeight:500},children:`Cancel`}),(0,B.jsx)(`button`,{onClick:h,disabled:f,style:{flex:1,padding:`10px 16px`,background:f?`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.07)`:`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.13)`,color:C.red,border:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.27)`,borderRadius:8,cursor:f?`default`:`pointer`,fontSize:14,fontWeight:500,opacity:f?.6:1,transition:`background 0.15s, opacity 0.15s`},onMouseEnter:e=>{f||(e.currentTarget.style.background=`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.2)`)},onMouseLeave:e=>{f||(e.currentTarget.style.background=`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.13)`)},children:f?`Deleting...`:`Confirm Delete`})]})]}):(0,B.jsx)(`button`,{onClick:()=>d(!0),style:{width:`100%`,padding:`10px 16px`,background:`transparent`,color:C.red,border:`1px solid hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.2)`,borderRadius:8,cursor:`pointer`,fontSize:14,fontWeight:500,transition:`background 0.15s`},onMouseEnter:e=>{e.currentTarget.style.background=`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.07)`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:`Delete Employee`})]})]})})}function bP(){let[e,t]=(0,L.useState)({}),[n,r]=(0,L.useState)(!0),i=(0,L.useCallback)(async()=>{try{let e=await fetch(`/api/org/metrics`);if(!e.ok)return;t(await e.json())}catch{}finally{r(!1)}},[]);return(0,L.useEffect)(()=>{i()},[i]),p(`session:completed`,i),p(`session:error`,i),p(`ws:reconnected`,i),{metrics:e,loading:n}}function xP(e){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(!0),a=(0,L.useCallback)(async()=>{try{let t=await fetch(`/api/org/employees/${encodeURIComponent(e)}/metrics`);if(!t.ok)return;n(await t.json())}catch{}finally{i(!1)}},[e]);return(0,L.useEffect)(()=>{a()},[a]),p(`session:completed`,a),p(`session:error`,a),p(`ws:reconnected`,a),{metrics:t,loading:r}}function SP({employeeName:e}){let{metrics:t,loading:n}=xP(e);if(n)return(0,B.jsx)(uP,{title:`Performance`,children:(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted},children:`Loading...`})});if(!t||t.totalSessions===0)return(0,B.jsx)(uP,{title:`Performance`,children:(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted},children:`No session data yet`})});let r=t.successRate===null?null:Math.round(t.successRate*100),i=r===null?C.muted:r>=80?C.green:r>=50?C.warning:C.red;return(0,B.jsxs)(uP,{title:`Performance`,children:[(0,B.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8},children:[(0,B.jsx)(CP,{label:`Sessions`,value:String(t.totalSessions)}),(0,B.jsx)(CP,{label:`Success Rate`,value:r===null?`N/A`:`${r}%`,color:i}),(0,B.jsx)(CP,{label:`Total Cost`,value:`$${t.totalCostUsd.toFixed(2)}`}),(0,B.jsx)(CP,{label:`Avg Duration`,value:wP(t.avgDurationMs)})]}),t.totalSessions>0&&(0,B.jsxs)(`div`,{style:{marginTop:10},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:11,color:C.muted,marginBottom:4},children:[(0,B.jsxs)(`span`,{children:[t.completedSessions,` completed`]}),(0,B.jsxs)(`span`,{children:[t.errorSessions,` errors`]})]}),(0,B.jsxs)(`div`,{style:{height:6,borderRadius:3,overflow:`hidden`,background:C.cardBg,display:`flex`},children:[t.completedSessions>0&&(0,B.jsx)(`div`,{style:{width:`${t.completedSessions/t.totalSessions*100}%`,background:C.green,borderRadius:3}}),t.errorSessions>0&&(0,B.jsx)(`div`,{style:{width:`${t.errorSessions/t.totalSessions*100}%`,background:C.red,borderRadius:3}})]})]}),t.lastActiveAt&&(0,B.jsxs)(`div`,{style:{fontSize:11,color:C.muted,marginTop:8},children:[`Last active: `,new Date(t.lastActiveAt).toLocaleString()]})]})}function CP({label:e,value:t,color:n}){return(0,B.jsxs)(`div`,{style:{background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:6,padding:`8px 10px`},children:[(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,marginBottom:2},children:e}),(0,B.jsx)(`div`,{style:{fontSize:15,fontWeight:600,color:n||C.textSecondary},children:t})]})}function wP(e){if(e===0)return`N/A`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<60?`${t.toFixed(1)}s`:`${Math.floor(t/60)}m ${Math.round(t%60)}s`}function TP({employee:e,chain:t,reportEmployees:n,assignedJobs:r,jobsLoading:i,sessions:a,sessionsLoading:o,onSelectEmployee:s,onOpenJob:c,onViewBoard:l,onStartSession:u}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(uP,{title:`Configuration`,children:(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[e.model&&(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,B.jsx)(`span`,{style:{fontSize:12,color:C.muted},children:`Model`}),(0,B.jsx)(`span`,{style:{fontSize:12,color:C.textSecondary,fontFamily:`var(--font-mono)`},children:e.model})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,B.jsx)(`span`,{style:{fontSize:12,color:C.muted},children:`Engine`}),e.engine&&e.engine!==`claude`?(0,B.jsx)(`span`,{style:{fontSize:11,fontWeight:600,padding:`2px 8px`,borderRadius:4,background:`rgba(86,212,221,0.15)`,color:`#56d4dd`,letterSpacing:.3},children:e.engine.toUpperCase()}):(0,B.jsx)(`span`,{style:{fontSize:12,color:C.muted},children:`claude (default)`})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,B.jsx)(`span`,{style:{fontSize:12,color:C.muted},children:`claude.ai MCP`}),e.claudeAiMcp===!0?(0,B.jsx)(cu,{label:`ENABLED`,size:`md`,color:C.green,bg:`hsl(var(--positive-h) var(--positive-s) var(--positive-l) / 0.15)`}):e.claudeAiMcp===!1?(0,B.jsx)(cu,{label:`DISABLED`,size:`md`,color:C.red,bg:`hsl(var(--negative-h) var(--negative-s) var(--negative-l) / 0.15)`}):(0,B.jsx)(`span`,{style:{fontSize:12,color:C.muted},children:`inherit from job`})]}),e.profile&&(0,B.jsxs)(`div`,{style:{marginTop:4},children:[(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted,marginBottom:6},children:`SpawnProfile`}),(0,B.jsx)(d_,{name:e.profile})]})]})}),(0,B.jsx)(uP,{title:`MCP Servers`,children:e.mcpServers&&e.mcpServers.length>0?(0,B.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:e.mcpServers.map(e=>(0,B.jsx)(Du,{size:`sm`,children:e},e))}):(0,B.jsxs)(`div`,{style:{fontSize:12,color:C.muted,lineHeight:1.4},children:[`None declared `,e.profile?`— inherits from spawn profile`:`— defaults to `,!e.profile&&(0,B.jsx)(Du,{size:`sm`,children:`gateway`})]})}),e.persona&&(0,B.jsx)(uP,{title:`Persona`,children:(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary,lineHeight:1.5,whiteSpace:`pre-wrap`},children:e.persona})}),t.length>0&&(0,B.jsx)(uP,{title:`Reporting Chain`,children:(0,B.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4,flexWrap:`wrap`},children:t.map((n,r)=>(0,B.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(`button`,{onClick:()=>s(n),style:{background:n===e.name?`var(--color-primary)22`:`none`,border:n===e.name?`1px solid var(--color-primary)44`:`none`,color:n===e.name?`var(--color-primary)`:C.blue,cursor:`pointer`,fontSize:12,padding:`2px 6px`,borderRadius:4,textDecoration:`none`},children:n}),r<t.length-1&&(0,B.jsx)(`span`,{style:{color:C.muted,fontSize:10},children:`›`})]},n))})}),n.length>0&&(0,B.jsx)(uP,{title:`Direct Reports (${n.length})`,children:(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:n.map(e=>(0,B.jsxs)(`button`,{onClick:()=>s(e.name),style:{display:`flex`,alignItems:`center`,gap:8,background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:6,padding:`8px 12px`,cursor:`pointer`,textAlign:`left`,width:`100%`},children:[(0,B.jsx)(`span`,{style:{fontSize:18},children:e.emoji||`👤`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary},children:e.displayName||e.name}),(0,B.jsxs)(`div`,{style:{fontSize:11,color:C.muted},children:[e.rank,` · `,e.department]})]})]},e.name))})}),e.provides&&e.provides.length>0&&(0,B.jsx)(uP,{title:`Services (${e.provides.length})`,children:(0,B.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6},children:e.provides.map(e=>(0,B.jsx)(`span`,{title:e.description,style:{fontSize:12,padding:`4px 10px`,borderRadius:12,background:`var(--color-primary-soft)`,color:`var(--color-primary)`,border:`1px solid var(--color-primary)33`},children:e.name},e.name))})}),(0,B.jsx)(SP,{employeeName:e.name}),(0,B.jsx)(uP,{title:r.length>0?`Assigned Jobs (${r.length})`:`Assigned Jobs`,children:i?(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted},children:`Loading...`}):r.length===0?(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted},children:`No jobs assigned`}):(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:r.map(e=>(0,B.jsxs)(`div`,{onClick:()=>c(e.id),style:{background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:6,padding:`8px 12px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,cursor:`pointer`,transition:`border-color 0.15s, background 0.15s`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`var(--color-primary)`,e.currentTarget.style.background=`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.03)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=C.border,e.currentTarget.style.background=C.cardBg},children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary},children:e.name}),(0,B.jsx)(`div`,{style:{fontSize:11,color:C.muted,fontFamily:g},children:e.id})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,B.jsx)(`span`,{title:e.enabled?`enabled`:`disabled`,style:{...S,background:e.enabled?C.green:C.muted}}),e.lastStatus&&(0,B.jsx)(`span`,{style:{fontSize:11,color:e.lastStatus===`success`?C.green:e.lastStatus===`degraded`?C.warning:[`failed`,`timeout`].includes(e.lastStatus)?C.red:C.muted},children:e.lastStatus})]})]},e.id))})}),(0,B.jsx)(uP,{title:`Recent Sessions`,children:o?(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted},children:`Loading...`}):a.length===0?(0,B.jsx)(`div`,{style:{fontSize:12,color:C.muted},children:`No sessions yet`}):(0,B.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:a.map(e=>(0,B.jsxs)(`div`,{style:{background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:6,padding:`8px 12px`},children:[(0,B.jsx)(`div`,{style:{fontSize:13,color:C.textSecondary,marginBottom:4},children:e.title}),(0,B.jsxs)(`div`,{style:{display:`flex`,gap:12,fontSize:11,color:C.muted},children:[(0,B.jsx)(`span`,{children:e.status}),(0,B.jsxs)(`span`,{children:[`$`,e.costUsd.toFixed(4)]}),(0,B.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()})]})]},e.id))})}),l&&(0,B.jsxs)(`button`,{onClick:()=>l(e.department),style:{width:`100%`,padding:`10px 16px`,background:`${C.blue}15`,color:C.blue,border:`1px solid ${C.blue}33`,borderRadius:8,cursor:`pointer`,fontSize:14,fontWeight:500,transition:`background 0.15s`,textTransform:`capitalize`},onMouseEnter:e=>{e.currentTarget.style.background=`${C.blue}25`},onMouseLeave:e=>{e.currentTarget.style.background=`${C.blue}15`},children:[`View `,e.department,` Board`]}),(0,B.jsx)(`button`,{onClick:u,style:{width:`100%`,padding:`10px 16px`,background:`var(--color-primary)22`,color:`var(--color-primary)`,border:`1px solid var(--color-primary)44`,borderRadius:8,cursor:`pointer`,fontSize:14,fontWeight:500,transition:`background 0.15s`},onMouseEnter:e=>{e.currentTarget.style.background=`var(--color-primary)33`},onMouseLeave:e=>{e.currentTarget.style.background=`var(--color-primary)22`},children:`Start Session`})]})}function EP({employee:e,node:t,allEmployees:n,onClose:r,onSelectEmployee:i,onViewBoard:a,onEmployeeUpdated:o,onStartSession:s,onDelete:c,returnTo:l,zIndexBase:u=200}){let[d,f]=(0,L.useState)([]),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)([]),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(null),[w,T]=(0,L.useState)(!1),[E,D]=(0,L.useState)(!1),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(()=>fP(e)),M=(0,L.useRef)(fP(e)),[N,ee]=(0,L.useState)([]),[P,F]=(0,L.useState)([]),[te,I]=(0,L.useState)(``),[ne,re]=(0,L.useState)(!1),[R,z]=(0,L.useState)(!1),[ie,ae]=(0,L.useState)(null);(0,L.useEffect)(()=>{fetch(`/api/org/departments`).then(e=>e.json()).then(e=>ee(e.departments)).catch(()=>{}),fetch(`/api/settings`).then(e=>e.json()).then(async e=>{let t=e.engine?.ollama?.host??``;if(I(t),t){let e=await ZN(t);e.ok&&F(e.models)}}).catch(()=>{})},[]),(0,L.useEffect)(()=>{let t=fP(e);j(t),M.current=t,T(!1),k(null),re(!1),ae(null)},[e.name]),(0,L.useEffect)(()=>{let t=!1;return m(!0),fetch(`/api/sessions?employee=${encodeURIComponent(e.name)}`).then(e=>e.ok?e.json():Promise.resolve({sessions:[]})).then(e=>{t||f((Array.isArray(e)?e:e.sessions??[]).slice(0,5))}).catch(()=>{t||f([])}).finally(()=>{t||m(!1)}),()=>{t=!0}},[e.name]),(0,L.useEffect)(()=>{let t=!1;return v(!0),fetch(`/api/org/employees/${encodeURIComponent(e.name)}/jobs`).then(e=>e.ok?e.json():Promise.resolve([])).then(e=>{t||g(e)}).catch(()=>{t||g([])}).finally(()=>{t||v(!1)}),()=>{t=!0}},[e.name]),(0,L.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let oe=(0,L.useCallback)(async()=>{try{let t=await fetch(`/api/sessions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:``,employee:e.name})});if(t.ok){let n=await t.json();s?s(n.sessionId,e.name):f(e=>[n.session,...e].slice(0,5))}}catch{}},[e.name,s]),se=(0,L.useCallback)(()=>{w&&(j(M.current),k(null)),T(e=>!e)},[w]),V=(0,L.useCallback)((e,t)=>{j(n=>({...n,[e]:t}))},[]),ce=(0,L.useCallback)(async()=>{D(!0),k(null);let t=M.current,n={};if(A.displayName!==t.displayName&&(n.displayName=A.displayName||void 0),A.emoji!==t.emoji&&(n.emoji=A.emoji||void 0),A.rank!==t.rank&&(n.rank=A.rank),A.department!==t.department&&(n.department=A.department),A.reportsTo!==t.reportsTo&&(n.reportsTo=A.reportsTo||null),A.persona!==t.persona&&(n.persona=A.persona),A.model!==t.model&&(n.model=A.model||void 0),A.engine!==t.engine&&(n.engine=A.engine||void 0),A.effortLevel!==t.effortLevel&&(n.effortLevel=A.effortLevel||void 0),A.maxCostUsd!==t.maxCostUsd){let e=parseFloat(A.maxCostUsd);n.maxCostUsd=isNaN(e)?void 0:e}if(A.claudeAiMcp!==t.claudeAiMcp&&(n.claudeAiMcp=nP(A.claudeAiMcp)),A.profile!==t.profile&&(n.profile=A.profile||void 0),JSON.stringify(A.mcpServers)!==JSON.stringify(t.mcpServers)&&(n.mcpServers=A.mcpServers.length===0?null:A.mcpServers),Object.keys(n).length===0){T(!1),D(!1);return}try{let t=await fetch(`/api/org/employees/${encodeURIComponent(e.name)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!t.ok){k((await t.json().catch(()=>({error:`Save failed`}))).error||`HTTP ${t.status}`),D(!1);return}M.current={...A},T(!1),o?.()}catch(e){k(e instanceof Error?e.message:`Network error`)}finally{D(!1)}},[A,e.name,o]),le=(0,L.useCallback)(async()=>{z(!0),ae(null);try{let t=await fetch(`/api/org/employees/${encodeURIComponent(e.name)}`,{method:`DELETE`});if(!t.ok){ae((await t.json().catch(()=>({error:`Delete failed`}))).error||`HTTP ${t.status}`),z(!1);return}c?.()}catch(e){ae(e instanceof Error?e.message:`Network error`),z(!1)}},[e.name,c]),ue=oP[w?A.rank:e.rank]||oP.employee,de=t?.chain||[],fe=(t?.directReports||[]).map(e=>n.find(t=>t.name===e)).filter(e=>!!e);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{onClick:r,style:{position:`fixed`,inset:0,zIndex:u,background:`rgba(0,0,0,0.5)`}}),(0,B.jsxs)(`div`,{style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:400,maxWidth:`100vw`,zIndex:u+1,background:C.darkBg,borderLeft:`1px solid ${C.border}`,overflowY:`auto`,animation:`slideInRight 0.2s ease-out`},children:[l&&(0,B.jsxs)(`button`,{onClick:l.onBack,style:{width:`100%`,textAlign:`left`,padding:`10px 24px`,background:`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.06)`,border:`none`,borderBottom:`1px solid ${C.border}`,color:`var(--color-primary)`,fontSize:13,fontWeight:500,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:8,transition:`background 0.15s`},onMouseEnter:e=>{e.currentTarget.style.background=`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.12)`},onMouseLeave:e=>{e.currentTarget.style.background=`hsl(var(--primary-h) var(--primary-s) var(--primary-l) / 0.06)`},title:`Back to ${l.label}`,children:[(0,B.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:14},children:`←`}),(0,B.jsxs)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[`Back to `,l.label]})]}),(0,B.jsxs)(`div`,{style:{padding:`20px 24px`,borderBottom:`1px solid ${C.border}`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,B.jsx)(`span`,{style:{fontSize:32},children:w?A.emoji||`👤`:e.emoji||`👤`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{style:{fontSize:16,fontWeight:600},children:w?A.displayName||e.name:e.displayName||e.name}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:4},children:[(0,B.jsx)(`span`,{style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,padding:`2px 8px`,borderRadius:4,background:`${ue}22`,color:ue,letterSpacing:.5},children:w?A.rank:e.rank}),(0,B.jsx)(`span`,{style:{fontSize:12,color:C.muted},children:w?A.department:e.department})]})]})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,B.jsx)(`button`,{onClick:se,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:12,padding:`4px 8px`,borderRadius:4,transition:`color 0.15s`},onMouseEnter:e=>{e.currentTarget.style.color=C.textSecondary},onMouseLeave:e=>{e.currentTarget.style.color=C.muted},children:w?`Cancel`:`Edit`}),(0,B.jsx)(`button`,{onClick:r,style:{background:`none`,border:`none`,color:C.muted,cursor:`pointer`,fontSize:20,padding:4},children:`✕`})]})]}),(0,B.jsx)(`div`,{style:{padding:`16px 24px`,display:`flex`,flexDirection:`column`,gap:20},children:w?(0,B.jsx)(yP,{employee:e,allEmployees:n,departments:N,ollamaModels:P,ollamaHost:te,editFields:A,onFieldChange:V,saving:E,saveError:O,onSave:ce,confirmDelete:ne,setConfirmDelete:re,deleting:R,deleteError:ie,setDeleteError:ae,onDelete:le}):(0,B.jsx)(TP,{employee:e,chain:de,reportEmployees:fe,assignedJobs:h,jobsLoading:_,sessions:d,sessionsLoading:p,onSelectEmployee:i,onOpenJob:e=>b(e),onViewBoard:a,onStartSession:oe})})]}),y&&(()=>{let e=h.find(e=>e.id===y);return e?(0,B.jsx)(TN,{job:e,onClose:()=>b(null),onRun:()=>{fetch(`/api/jobs/${e.id}/run`,{method:`POST`}),b(null)},onEdit:()=>{S(e),b(null)},onCancel:()=>fetch(`/api/jobs/${e.id}/cancel`,{method:`POST`}),fetchResult:async(e,t)=>{try{let n=t?`?file=${encodeURIComponent(t)}`:``,r=await fetch(`/api/jobs/${e}/result${n}`);return r.ok?await r.json():null}catch{return null}},fetchHistory:async e=>{try{let t=await fetch(`/api/jobs/${e}/history`);return t.ok?await t.json():[]}catch{return[]}},fetchTrace:async(e,t)=>{try{let n=await fetch(`/api/jobs/${e}/runs/${t}/trace`);return n.ok?await n.json():null}catch{return null}},fetchChangelog:async e=>{try{let t=await fetch(`/api/jobs/${e}/prompt-changelog`);return t.ok?await t.json():[]}catch{return[]}}}):null})(),x&&(0,B.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:300},children:(0,B.jsx)(C_,{job:x,onSave:async t=>{await fetch(`/api/jobs/${x.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});let n=await fetch(`/api/org/employees/${encodeURIComponent(e.name)}/jobs`);n.ok&&g(await n.json()),S(null)},onClose:()=>S(null)})})]})}function DP(){let[e,t]=(0,L.useState)([]),[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)([]),[o,s]=(0,L.useState)(!0),[c,l]=(0,L.useState)(null),u=(0,L.useCallback)(async()=>{try{let e=await fetch(`/api/org`);if(!e.ok)throw Error(`HTTP ${e.status}`);let n=await e.json();t(n.employees),r(n.hierarchy),a(n.warnings),l(null)}catch(e){l(e instanceof Error?e.message:`Failed to fetch org`)}finally{s(!1)}},[]);return(0,L.useEffect)(()=>{u()},[u]),p(`org:changed`,u),p(`ws:reconnected`,u),{employees:e,hierarchy:n,warnings:i,loading:o,error:c,refresh:u}}function OP(e){let{jobs:t,feed:n,employees:r,paused:i,modal:a,setModal:o,handleSave:s,runJob:c,setToast:l,detailJobId:u,setDetailJobId:d,handleRun:f,handleCancel:p,toggleEnabled:m,handleDuplicate:h,handleExport:g,handleDelete:_,snoozeJob:v,fetchResult:y,fetchHistory:b,fetchTrace:x,fetchChangelog:S,promptLabJobId:C,setPromptLabJobId:w,refresh:T,goalWizardOpen:E,setGoalWizardOpen:D,commandPaletteOpen:O,setCommandPaletteOpen:k,handleInstall:A,toggleActivity:j,toggleFocus:M,navigateToSettings:N,showHelp:ee,pauseAll:P,resumeAll:F,onPausedAll:te,onResumedAll:I,setOutputSearchOpen:ne,outputSearchOpen:re,handleSelectJob:R,helpOpen:z,setHelpOpen:ie}=e,[ae,oe]=(0,L.useState)(null),{hierarchy:se,refresh:V}=DP(),ce=(0,L.useRef)([]),le=(0,L.useRef)(u),ue=(0,L.useCallback)(()=>{ce.current.length>0&&window.history.back()},[]);(0,L.useEffect)(()=>{le.current===null&&u!==null&&(ce.current.push(`jobDetail`),window.history.pushState({tos:`jobDetail`},``)),le.current=u},[u]),(0,L.useEffect)(()=>{let e=()=>{let e=ce.current.pop();e&&(e===`employeeFromJob`?oe(null):e===`jobDetail`&&(oe(null),d(null)))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[d]);let de=(0,L.useCallback)(e=>{oe(e),ce.current.push(`employeeFromJob`),window.history.pushState({tos:`employeeFromJob`},``)},[]);return(0,B.jsxs)(B.Fragment,{children:[a&&(0,B.jsx)(C_,{job:a.job,duplicateFrom:a.duplicateFrom,onSave:s,onClose:()=>o(null),onTestRun:c,onToast:l}),u&&(()=>{let e=t.find(e=>e.id===u);return e?(0,B.jsx)(TN,{job:e,feed:n,employees:r,onClose:ue,onRun:()=>{f(e.id),ue()},onCancel:()=>{p(e.id)},onReEnable:async()=>{await m(e.id,!0)},onEdit:()=>{o({mode:`edit`,job:e}),ue()},onDuplicate:()=>{h(e),ue()},onExport:g,onDelete:()=>{_(e.id),ue()},onPromptLab:()=>{w(e.id),ue()},onSelectEmployee:t=>de({name:t,returnToJobId:e.id,returnToJobName:e.name}),snoozeJob:v,fetchResult:y,fetchHistory:b,fetchTrace:x,fetchChangelog:S}):null})(),ae&&(()=>{let e=(r??[]).find(e=>e.name===ae.name);return e?(0,B.jsx)(EP,{employee:e,node:se?.nodes[ae.name]??null,allEmployees:r??[],onClose:ue,onSelectEmployee:e=>oe(t=>t?{...t,name:e}:null),onEmployeeUpdated:V,returnTo:{label:ae.returnToJobName,onBack:ue},zIndexBase:3e3}):null})(),C&&(()=>{let e=t.find(e=>e.id===C);return e?(0,B.jsx)(kN,{job:e,open:!0,onClose:()=>w(null),onSave:T,fetchResult:y}):null})(),(0,B.jsx)(GN,{open:E,onClose:()=>D(!1),onJobsCreated:T,onGoalDeleted:T}),(0,B.jsx)(KN,{open:O,onClose:()=>k(!1),jobs:t,onRunJob:f,onCancelJob:p,onSelectJob:R,onCopyJobId:e=>{if(typeof navigator>`u`||!navigator.clipboard){l(`Clipboard unavailable`);return}navigator.clipboard.writeText(e.id).then(()=>l(`Copied ${e.id}`),()=>l(`Copy failed`))},onNewJob:()=>o({mode:`create`,job:null}),onRefresh:T,onSyncCron:A,onToggleActivity:j,onToggleFocus:M,onToggleSettings:N,onShowHelp:ee,onDuplicateJob:h,onPauseAll:async()=>{await P()&&te()},onResumeAll:async()=>{await F()&&I()},onOutputSearch:()=>{k(!1),ne(!0)},onPromptLab:e=>{k(!1),w(e)},onGoalWizard:()=>{k(!1),D(!0)},paused:i}),(0,B.jsx)(JN,{open:re,onClose:()=>ne(!1),onSelectJob:R}),(0,B.jsx)(XN,{open:z,onClose:()=>ie(!1)})]})}var kP={root:`_root_1vhva_1`,pill:`_pill_1vhva_8`,live:`_live_1vhva_17`,connecting:`_connecting_1vhva_18`,reconnecting:`_reconnecting_1vhva_19`,disconnected:`_disconnected_1vhva_20`,dot:`_dot_1vhva_22`,dotLive:`_dotLive_1vhva_30`,dotWarn:`_dotWarn_1vhva_31`,pulse:`_pulse_1vhva_1`,dotDisconnected:`_dotDisconnected_1vhva_32`};function AP(e){if(e<1e3)return`just now`;let t=Math.floor(e/1e3);if(t<60)return`${t}s ago`;let n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ago`}var jP={connected:kP.live,connecting:kP.connecting,reconnecting:kP.reconnecting,disconnected:kP.disconnected},MP={connected:kP.dotLive,connecting:kP.dotWarn,reconnecting:kP.dotWarn,disconnected:kP.dotDisconnected},NP={connected:`Live`,connecting:`Connecting`,reconnecting:`Reconnecting`,disconnected:`Disconnected`};function PP({wsStatus:e,lastRefresh:t}){let[n,r]=(0,L.useState)(Date.now());(0,L.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]);let i=t===null?0:n-t,a=t===null?``:e===`connected`?` — updated ${AP(i)}`:` — last data ${AP(i)}`;return(0,B.jsx)(`span`,{className:kP.root,children:(0,B.jsxs)(`span`,{className:`${kP.pill} ${jP[e]}`,children:[(0,B.jsx)(`span`,{className:`${kP.dot} ${MP[e]}`}),NP[e],a]})})}function FP(e){let{pauseState:t,wsStatus:n,lastRefresh:r,activityOpen:i,focusOpen:a,guideOpen:o,changelogOpen:s,unreadFeedCount:c,focusActiveCount:l,unreadChangelogCount:u,actionableGoalsCount:d,onShowHelp:f,onToggleActivity:p,onToggleFocus:m,onToggleGuide:h,onToggleChangelog:_,onToggleCronSettings:v,onOpenGoalWizard:y,onNewJob:b,crontabRefreshKey:x,onSyncCrontab:S}=e;return(0,B.jsxs)(`header`,{className:`responsive-header ${q.a4d5f18}`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`h1`,{className:q.a944a49,children:[(0,B.jsx)(`span`,{style:{display:`inline-block`,width:8,height:8,borderRadius:`50%`,background:t?.paused?`var(--color-warning)`:`var(--color-positive)`,animation:t?.paused?`none`:`pulse 2s infinite`,transition:`background 0.3s ease`}}),`Cron`]}),(0,B.jsx)(`div`,{className:`responsive-header-subtitle ${q.a506044}`,children:t?.paused?(0,B.jsxs)(`span`,{className:q.a3fb2cd,children:[t.reason===`scheduled`?`Scheduled pause active`:`Global pause active`,t.until&&(0,B.jsxs)(B.Fragment,{children:[` — until `,new Date(t.until).toLocaleString()]})]}):(0,B.jsx)(PP,{wsStatus:n,lastRefresh:r})})]}),(0,B.jsxs)(`div`,{className:`responsive-header-buttons ${q.a83be98}`,children:[(0,B.jsx)(`button`,{className:`btn btn-sm ${q.a646636}`,onClick:f,title:`Keyboard shortcuts (?)`,children:(0,B.jsx)(`kbd`,{style:{fontSize:11,padding:`1px 5px`,border:`1px solid ${C.border}`,borderRadius:3,background:C.darkBg,fontFamily:g},children:`?`})}),(0,B.jsxs)(`button`,{className:`${i?`btn btn-primary`:`btn`} ${q.af255fe}`,onClick:p,children:[`☰ Activity`,!i&&c>0&&(0,B.jsx)(`span`,{className:`btn-badge ${q.aa1d080}`,children:c})]}),(0,B.jsxs)(`button`,{className:`${a?`btn btn-primary`:`btn`} ${q.af255fe}`,onClick:m,children:[`☆`,` Focus`,!a&&l>0&&(0,B.jsx)(`span`,{className:`btn-badge ${q.a2258cf}`,children:l})]}),(0,B.jsx)(`button`,{className:o?`btn btn-primary`:`btn`,onClick:h,children:`📚 Guide`}),(0,B.jsxs)(`button`,{className:`${s?`btn btn-primary`:`btn`} ${q.af255fe}`,onClick:_,children:[`📝 What's New`,!s&&u>0&&(0,B.jsx)(`span`,{className:q.a829410,children:u})]}),(0,B.jsx)(`button`,{className:`btn`,onClick:v,children:`⚙ Settings`}),(0,B.jsx)(Ih,{refreshKey:x,onSync:S}),(0,B.jsxs)(`button`,{className:`btn ${q.ae665e3}`,onClick:y,children:[`✨`,` Goal`,d>0&&(0,B.jsx)(`span`,{className:q.a6205e1,children:d})]}),(0,B.jsx)(`button`,{className:`btn btn-primary`,onClick:b,children:`+ Add Job`})]})]})}var IP=[{key:`all`,label:`All`,color:`var(--color-primary)`},{key:`active`,label:`Active`,color:C.green},{key:`running`,label:`Running`,color:C.blue},{key:`failed`,label:`Failed`,color:C.red},{key:`disabled`,label:`Disabled`,color:C.muted}],LP=[{key:`all`,label:`All`,icon:null,color:`var(--color-primary)`},{key:`team`,label:`Team`,icon:`🤝`,color:`var(--color-primary)`},{key:`solo`,label:`Agent`,icon:`⚡`,color:C.blue},{key:`unassigned`,label:`Unassigned`,icon:`⚡`,color:C.muted}];function RP({employeeFilter:e,employees:t,tagFilter:n,searchTerm:r,runsByFilter:i,onEmployeeFilterChange:a,onTagFilterChange:o,onSearchChange:s,onRunsByFilterChange:c}){let l=LP.find(e=>e.key===i);if(!(e||n.length>0||r||i!==`all`))return null;let u=e?t.find(t=>t.name===e):null;return(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,flexWrap:`wrap`,marginTop:8,paddingTop:8,borderTop:`1px dashed ${C.border}`},children:[(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,letterSpacing:.3,textTransform:`uppercase`,marginRight:2},children:`Filters`}),r&&(0,B.jsx)(zP,{accent:C.blue,label:`“${r}”`,onRemove:()=>s(``)}),i!==`all`&&l&&(0,B.jsx)(zP,{accent:l.color,icon:l.icon??void 0,label:l.label,onRemove:()=>c?.(`all`)}),u&&(0,B.jsx)(zP,{accent:`var(--color-primary)`,icon:u.emoji??`👤`,label:u.displayName??u.name,onRemove:()=>a?.(``)}),n.map(e=>(0,B.jsx)(zP,{accent:`var(--color-primary)`,label:`#${e}`,mono:!0,onRemove:()=>o?.(n.filter(t=>t!==e))},e)),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{a?.(``),o?.([]),s(``),c?.(`all`)},style:{marginLeft:`auto`,padding:`2px 8px`,background:`transparent`,border:`none`,color:C.muted,fontSize:11,cursor:`pointer`,textDecoration:`underline dotted`,textUnderlineOffset:3},onMouseEnter:e=>e.currentTarget.style.color=C.text,onMouseLeave:e=>e.currentTarget.style.color=C.muted,children:`Clear all`})]})}function zP({label:e,icon:t,accent:n,onRemove:r,mono:i}){return(0,B.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:`2px 4px 2px 8px`,borderRadius:999,border:`1px solid ${n}44`,background:`${n}12`,color:n,fontSize:11,fontFamily:i?g:`inherit`,lineHeight:1.4},children:[t&&(0,B.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:10},children:t}),(0,B.jsx)(`span`,{children:e}),(0,B.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Remove ${e}`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:14,height:14,borderRadius:`50%`,border:`none`,background:`transparent`,color:n,fontSize:10,cursor:`pointer`,opacity:.7,transition:`opacity 0.15s, background 0.15s`},onMouseEnter:e=>{let t=e.currentTarget;t.style.opacity=`1`,t.style.background=`${n}33`},onMouseLeave:e=>{let t=e.currentTarget;t.style.opacity=`0.7`,t.style.background=`transparent`},children:`×`})]})}function BP({label:e,hint:t,icon:n,selected:r,onClick:i,"data-value":a}){return(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,"data-value":a,onClick:i,style:{display:`flex`,alignItems:`center`,width:`100%`,gap:8,padding:`6px 8px`,border:`none`,borderRadius:6,background:r?`var(--color-primary)18`:`transparent`,color:r?`var(--color-primary)`:C.text,fontSize:13,cursor:`pointer`,textAlign:`left`,transition:`background 0.12s, color 0.12s`},onMouseEnter:e=>{r||(e.currentTarget.style.background=C.hover)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:[n&&(0,B.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:14,width:18,textAlign:`center`},children:n}),(0,B.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e}),t&&(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:10,color:C.muted,opacity:.8},children:t}),r&&(0,B.jsx)(`span`,{"aria-hidden":!0,style:{color:`var(--color-primary)`,fontSize:11},children:`✓`})]})}function VP({employees:e,value:t,onChange:n,close:r}){let[i,a]=(0,L.useState)(``),o=(0,L.useMemo)(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||(e.displayName?.toLowerCase().includes(t)??!1))},[e,i]),s=e=>{n(e),r()};return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`input`,{"aria-label":`Search agents`,autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Find an agent…`,style:{width:`100%`,padding:`6px 10px`,borderRadius:6,border:`1px solid ${C.border}`,background:C.darkBg,color:C.text,fontSize:12,fontFamily:`inherit`,outline:`none`,marginBottom:6,boxSizing:`border-box`}}),(0,B.jsxs)(`div`,{role:`listbox`,"aria-label":`Agents`,style:{maxHeight:260,overflowY:`auto`,margin:`0 -4px`},children:[(0,B.jsx)(BP,{selected:t===``,label:`All agents`,hint:`no filter`,onClick:()=>s(``)}),o.length===0&&(0,B.jsx)(`div`,{style:{padding:`10px 6px`,color:C.muted,fontSize:12,textAlign:`center`},children:`No matches`}),o.map(e=>(0,B.jsx)(BP,{"data-value":e.name,selected:t===e.name,icon:e.emoji??`👤`,label:e.displayName??e.name,hint:e.displayName?e.name:void 0,onClick:()=>s(e.name)},e.name))]})]})}function HP(e,t,n){(0,L.useEffect)(()=>{if(!n)return;let r=n=>{let r=e.current;r&&(n.target instanceof Node&&r.contains(n.target)||t())},i=e=>{e.key===`Escape`&&t()};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e,t,n])}function UP({label:e,icon:t,activeCount:n,accent:r=`var(--color-primary)`,width:i=240,disabled:a,children:o,onClear:s,ariaLabel:c}){let[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),p=(0,L.useRef)(null),m=(0,L.useRef)(null);HP(p,()=>u(!1),l),(0,L.useLayoutEffect)(()=>{if(!l)return;let e=m.current;e&&f(e.getBoundingClientRect().left+i>window.innerWidth-12)},[l,i]),(0,L.useEffect)(()=>{if(!l)return;let e=()=>u(!1);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=n>0,g=h?`${r}16`:C.hover,_=h?`${r}55`:C.border,v=h?r:C.text;return(0,B.jsxs)(`div`,{ref:p,style:{position:`relative`,display:`inline-flex`},children:[(0,B.jsxs)(`button`,{ref:m,type:`button`,disabled:a,"aria-label":c??e,"aria-haspopup":`dialog`,"aria-expanded":l,onClick:()=>u(e=>!e),style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`5px 10px`,borderRadius:8,border:`1px solid ${_}`,background:g,color:v,fontSize:12,fontWeight:500,cursor:a?`not-allowed`:`pointer`,opacity:a?.5:1,whiteSpace:`nowrap`,transition:`background 0.15s, border-color 0.15s, color 0.15s`},children:[t&&(0,B.jsx)(`span`,{"aria-hidden":!0,children:t}),(0,B.jsx)(`span`,{children:e}),h&&(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:10,padding:`0 5px`,borderRadius:5,background:`${r}33`,color:r,fontVariantNumeric:`tabular-nums`},children:n}),(0,B.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:9,opacity:.6,marginLeft:2},children:`▾`})]}),l&&(0,B.jsxs)(`div`,{role:`dialog`,"aria-label":c??e,style:{position:`absolute`,top:`calc(100% + 6px)`,left:d?`auto`:0,right:d?0:`auto`,width:i,maxWidth:`min(92vw, 360px)`,zIndex:40,background:C.cardBg,border:`1px solid ${C.border}`,borderRadius:12,boxShadow:`0 12px 32px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.25)`,padding:10,animation:`filterMenuIn 0.14s ease-out`},children:[o(()=>u(!1)),s&&h&&(0,B.jsx)(`div`,{style:{borderTop:`1px solid ${C.border}`,marginTop:8,paddingTop:8},children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{s(),u(!1)},style:{width:`100%`,padding:`6px 8px`,borderRadius:6,border:`none`,background:`transparent`,color:C.muted,fontSize:12,cursor:`pointer`,textAlign:`left`},onMouseEnter:e=>e.currentTarget.style.color=C.text,onMouseLeave:e=>e.currentTarget.style.color=C.muted,children:[`Clear `,e.toLowerCase()]})})]})]})}function WP({searchTerm:e,onSearchChange:t,searchRef:n,isNarrow:r}){return(0,B.jsxs)(`div`,{style:{position:`relative`,flex:r?`1 1 100%`:`1 1 220px`,minWidth:180,maxWidth:r?`none`:320},children:[(0,B.jsx)(`span`,{"aria-hidden":!0,style:{position:`absolute`,left:10,top:`50%`,transform:`translateY(-50%)`,fontSize:13,color:C.muted,pointerEvents:`none`},children:`⌕`}),(0,B.jsx)(`input`,{ref:n,className:`search-input`,value:e,onChange:e=>t(e.target.value),placeholder:`Search jobs…`,"aria-label":`Search jobs`,style:{width:`100%`,padding:`7px 54px 7px 30px`,borderRadius:8,border:`1px solid ${e?`${C.blue}66`:C.border}`,background:C.darkBg,color:C.text,fontSize:13,fontFamily:`inherit`,outline:`none`,boxSizing:`border-box`,transition:`border-color 0.15s`}}),e?(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(``),"aria-label":`Clear search`,style:{position:`absolute`,right:6,top:`50%`,transform:`translateY(-50%)`,background:`transparent`,border:`none`,color:C.muted,fontSize:12,cursor:`pointer`,padding:`2px 6px`,borderRadius:4},children:`×`}):(0,B.jsx)(`span`,{"aria-hidden":!0,style:{position:`absolute`,right:8,top:`50%`,transform:`translateY(-50%)`,fontFamily:g,fontSize:10,color:C.muted,padding:`1px 5px`,borderRadius:4,border:`1px solid ${C.border}`,background:C.hover,letterSpacing:.3,opacity:.7},children:`/`})]})}function GP({segments:e,value:t,onChange:n,counts:r,ariaLabel:i,testId:a}){return(0,B.jsx)(`div`,{role:`tablist`,"aria-label":i,"data-testid":a,className:`filter-segmented`,style:{display:`flex`,flexWrap:`wrap`,padding:3,borderRadius:10,background:C.darkBg,border:`1px solid ${C.border}`,gap:2,minWidth:0,maxWidth:`100%`},children:e.map(e=>{let i=e.key===t,a=r?.[e.key];return(0,B.jsxs)(`button`,{role:`tab`,"aria-selected":i,onClick:()=>n(e.key),style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`4px 10px`,borderRadius:7,border:`none`,background:i?`${e.color}22`:`transparent`,color:i?e.color:C.muted,fontSize:12,fontWeight:i?600:500,cursor:`pointer`,whiteSpace:`nowrap`,transition:`background 0.15s, color 0.15s`,boxShadow:i?`inset 0 0 0 1px ${e.color}3a`:`none`,lineHeight:1.4},onMouseEnter:e=>{i||(e.currentTarget.style.color=C.text)},onMouseLeave:e=>{i||(e.currentTarget.style.color=C.muted)},children:[e.icon&&(0,B.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:11},children:e.icon}),(0,B.jsx)(`span`,{children:e.label}),typeof a==`number`&&(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:10,padding:`0 5px`,borderRadius:5,background:i?`${e.color}33`:C.hover,color:i?e.color:C.muted,fontVariantNumeric:`tabular-nums`},children:a})]},e.key)})})}function KP({allTags:e,selected:t,onChange:n}){let[r,i]=(0,L.useState)(``),a=(0,L.useMemo)(()=>{if(!r)return e;let t=r.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,r]),o=e=>{n(t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`input`,{"aria-label":`Search tags`,autoFocus:!0,value:r,onChange:e=>i(e.target.value),placeholder:`Find a tag…`,style:{width:`100%`,padding:`6px 10px`,borderRadius:6,border:`1px solid ${C.border}`,background:C.darkBg,color:C.text,fontSize:12,fontFamily:`inherit`,outline:`none`,marginBottom:8,boxSizing:`border-box`}}),(0,B.jsxs)(`div`,{role:`group`,"aria-label":`Tags`,style:{display:`flex`,flexWrap:`wrap`,gap:4,maxHeight:220,overflowY:`auto`},children:[a.length===0&&(0,B.jsx)(`div`,{style:{width:`100%`,padding:`10px 6px`,color:C.muted,fontSize:12,textAlign:`center`},children:`No matches`}),a.map(e=>{let n=t.includes(e);return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>o(e),"aria-pressed":n,style:{padding:`3px 9px`,borderRadius:999,border:`1px solid ${n?`var(--color-primary)`:C.border}`,background:n?`var(--color-primary)22`:`transparent`,color:n?`var(--color-primary)`:C.muted,fontSize:11,cursor:`pointer`,whiteSpace:`nowrap`,transition:`all 0.15s`,fontFamily:g},children:[`#`,e]},e)})]})]})}function qP({searchTerm:e,onSearchChange:t,activeFilter:n,onFilterChange:r,filterCounts:i,searchRef:a,employeeFilter:o=``,onEmployeeFilterChange:s,employees:c=[],tagFilter:l=[],onTagFilterChange:u,allTags:d=[],runsByFilter:f=`all`,onRunsByFilterChange:p,runsByCounts:m}){let h=(0,L.useMemo)(()=>Array.from(new Map(c.map(e=>[e.name,e])).values()),[c]),[g,_]=(0,L.useState)(!1);(0,L.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(max-width: 720px)`),t=()=>_(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let v=+!!o,y=o?h.find(e=>e.name===o)?.displayName??o:`Agent`,b={display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`,width:`100%`};return(0,B.jsxs)(`div`,{className:`job-filter-bar`,style:{marginBottom:16,padding:10,borderRadius:12,background:C.subtleBg,border:`1px solid ${C.border}`},children:[(0,B.jsx)(`style`,{children:`@keyframes filterMenuIn { from { opacity: 0; transform: translateY(-2px) } to { opacity: 1; transform: translateY(0) } }`}),(0,B.jsxs)(`div`,{style:b,children:[(0,B.jsx)(WP,{searchTerm:e,onSearchChange:t,searchRef:a,isNarrow:g}),(0,B.jsx)(GP,{segments:IP,value:n,onChange:r,counts:i,ariaLabel:`Filter by state`,testId:`filter-state`}),(0,B.jsxs)(`div`,{style:{display:`inline-flex`,gap:6,marginLeft:g?0:`auto`,flexWrap:`wrap`},children:[h.length>0&&(0,B.jsx)(UP,{label:y,icon:`👤`,activeCount:v,accent:C.blue,width:260,ariaLabel:`Filter by employee`,onClear:()=>s?.(``),children:e=>(0,B.jsx)(VP,{employees:h,value:o,onChange:e=>s?.(e),close:e})}),d.length>0&&(0,B.jsx)(UP,{label:`Tags`,icon:`#`,activeCount:l.length,accent:`var(--color-primary)`,width:280,ariaLabel:`Filter by tag`,onClear:()=>u?.([]),children:()=>(0,B.jsx)(KP,{allTags:d,selected:l,onChange:e=>u?.(e)})})]})]}),p&&m&&(0,B.jsxs)(`div`,{style:{...b,marginTop:8},children:[(0,B.jsx)(`span`,{style:{fontSize:11,color:C.muted,textTransform:`uppercase`,letterSpacing:.4,fontWeight:600},children:`Runs by`}),(0,B.jsx)(GP,{segments:LP,value:f,onChange:p,counts:m,ariaLabel:`Filter by who runs the job`,testId:`filter-runs-by`})]}),(0,B.jsx)(RP,{employeeFilter:o,employees:h,tagFilter:l,searchTerm:e,runsByFilter:f,onEmployeeFilterChange:s,onTagFilterChange:u,onSearchChange:t,onRunsByFilterChange:p})]})}var JP={shell:`_shell_150e0_5`,group:`_group_150e0_11`,"jobgrouped-fade":`_jobgrouped-fade_150e0_1`,header:`_header_150e0_26`,caret:`_caret_150e0_48`,caretOpen:`_caretOpen_150e0_56`,label:`_label_150e0_58`,count:`_count_150e0_66`,variantAttention:`_variantAttention_150e0_74`,variantRunning:`_variantRunning_150e0_75`,variantHealthy:`_variantHealthy_150e0_76`,variantDisabled:`_variantDisabled_150e0_77`,variantOther:`_variantOther_150e0_78`,body:`_body_150e0_80`,bodyOpen:`_bodyOpen_150e0_90`},YP={attention:JP.variantAttention,running:JP.variantRunning,healthy:JP.variantHealthy,disabled:JP.variantDisabled,other:JP.variantOther};function XP({groups:e,feed:t,onToggleEnabled:n,onRun:r,onCancel:i,onSelectJob:a,onEdit:o,onDuplicate:s,onExport:c,onDelete:l,isGloballyPaused:u=!1,employees:d=[],density:f=`compact`}){let p=(0,L.useRef)(!1),[m,h]=(0,L.useState)(()=>{let t=new Set;for(let n of e)n.defaultExpanded&&t.add(n.key);return t});if(!p.current&&e.length>0){p.current=!0;let t=new Set;for(let n of e)n.defaultExpanded&&t.add(n.key);(t.size!==m.size||[...t].some(e=>!m.has(e)))&&h(t)}let g=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,B.jsx)(`div`,{className:JP.shell,children:e.map(e=>{let p=m.has(e.key),h=YP[e.key]??JP.variantOther;return(0,B.jsxs)(`div`,{className:JP.group,children:[(0,B.jsxs)(`button`,{type:`button`,className:JP.header,onClick:()=>g(e.key),"aria-expanded":p,children:[(0,B.jsx)(`span`,{className:`${JP.caret} ${p?JP.caretOpen:``}`,"aria-hidden":!0,children:`▸`}),(0,B.jsx)(`span`,{className:JP.label,children:e.label}),(0,B.jsx)(`span`,{className:`${JP.count} ${h}`,children:e.jobs.length})]}),(0,B.jsx)(`div`,{className:`${JP.body} ${p?JP.bodyOpen:``}`,"aria-hidden":!p,children:e.jobs.map(e=>(0,B.jsx)(xN,{job:e,feed:t,density:f,onToggleEnabled:n,onRun:r,onCancel:i,onSelectJob:a,onEdit:o,onDuplicate:s,onExport:c,onDelete:l,isGloballyPaused:u,employees:d},e.id))})]},e.key)})})}var $={shell:`_shell_12fq6_8`,"jobtable-fade":`_jobtable-fade_12fq6_1`,scroll:`_scroll_12fq6_25`,table:`_table_12fq6_29`,th:`_th_12fq6_38`,thSortable:`_thSortable_12fq6_55`,thRight:`_thRight_12fq6_63`,thCenter:`_thCenter_12fq6_64`,sortIcon:`_sortIcon_12fq6_66`,sortIconActive:`_sortIconActive_12fq6_72`,row:`_row_12fq6_78`,rowSelected:`_rowSelected_12fq6_91`,rowDisabled:`_rowDisabled_12fq6_99`,rowRunning:`_rowRunning_12fq6_103`,td:`_td_12fq6_109`,tdCenter:`_tdCenter_12fq6_114`,tdRight:`_tdRight_12fq6_115`,tdCheck:`_tdCheck_12fq6_117`,tdToggle:`_tdToggle_12fq6_118`,tdStatus:`_tdStatus_12fq6_119`,tdName:`_tdName_12fq6_126`,name:`_name_12fq6_133`,nameRow:`_nameRow_12fq6_147`,subline:`_subline_12fq6_154`,command:`_command_12fq6_164`,tag:`_tag_12fq6_173`,selfImproveIcon:`_selfImproveIcon_12fq6_184`,tdAgent:`_tdAgent_12fq6_190`,tdSchedule:`_tdSchedule_12fq6_197`,tdLastRun:`_tdLastRun_12fq6_198`,scheduleCell:`_scheduleCell_12fq6_210`,rowActionsCluster:`_rowActionsCluster_12fq6_217`,menuAnchorRight:`_menuAnchorRight_12fq6_224`,tdRate:`_tdRate_12fq6_229`,ratePill:`_ratePill_12fq6_236`,rateStrong:`_rateStrong_12fq6_244`,rateWeak:`_rateWeak_12fq6_245`,rateNeutral:`_rateNeutral_12fq6_246`,tdAvg:`_tdAvg_12fq6_248`,tdActions:`_tdActions_12fq6_257`,rowActionBtn:`_rowActionBtn_12fq6_266`,rowActionRun:`_rowActionRun_12fq6_298`,rowActionStop:`_rowActionStop_12fq6_305`,rowReveal:`_rowReveal_12fq6_264`,emptyCell:`_emptyCell_12fq6_328`,checkbox:`_checkbox_12fq6_333`,bulkBar:`_bulkBar_12fq6_340`,bulkCount:`_bulkCount_12fq6_353`,bulkActions:`_bulkActions_12fq6_364`,bulkClear:`_bulkClear_12fq6_370`,bulkBtn:`_bulkBtn_12fq6_386`,bulkBtnEnable:`_bulkBtnEnable_12fq6_400`,bulkBtnDisable:`_bulkBtnDisable_12fq6_401`,bulkBtnRun:`_bulkBtnRun_12fq6_402`,bulkBtnDelete:`_bulkBtnDelete_12fq6_403`,bulkBtnConfirm:`_bulkBtnConfirm_12fq6_404`,bulkConfirm:`_bulkConfirm_12fq6_410`,footer:`_footer_12fq6_420`,footerRunning:`_footerRunning_12fq6_430`,footerHint:`_footerHint_12fq6_432`,menu:`_menu_12fq6_224`,menuItem:`_menuItem_12fq6_453`,menuItemDanger:`_menuItemDanger_12fq6_470`,menuDivider:`_menuDivider_12fq6_473`},ZP={running:0,queued:1,failed:2,timeout:3,degraded:4,cancelled:5,retrying:6,success:7,skipped:8};function QP({active:e,dir:t}){return(0,B.jsx)(`span`,{className:e?`${$.sortIcon} ${$.sortIconActive}`:$.sortIcon,children:e?t===`asc`?`↑`:`↓`:`↕`})}function $P(e){return e==null?$.rateNeutral:e>=.9?$.rateStrong:e<.7?$.rateWeak:$.rateNeutral}function eF(e){return e?e.charAt(0).toUpperCase()+e.slice(1):`Never run`}function tF({jobs:e,feed:t,onToggleEnabled:n,onRun:r,onCancel:i,onSelectJob:a,onExport:o,onDelete:s,isGloballyPaused:c=!1,employees:l=[]}){let{prefs:u,setPref:d,loaded:f}=he(),[{key:p,dir:m},h]=(0,L.useState)({key:`name`,dir:`asc`}),[g,_]=(0,L.useState)(new Set),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(!1),[S,C]=(0,L.useState)(null),w=(0,L.useRef)(null),T=(0,L.useRef)(!1);(0,L.useEffect)(()=>{!f||T.current||(T.current=!0,u.jobTableSort&&h({key:u.jobTableSort.key,dir:u.jobTableSort.dir}))},[f,u.jobTableSort]),(0,L.useEffect)(()=>{if(!S)return;let e=()=>C(null);return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[S]);let E=e=>{h(t=>{let n=t.key===e&&t.dir===`asc`?`desc`:`asc`;return d(`jobTableSort`,{key:e,dir:n}),{key:e,dir:n}})},D=(0,L.useMemo)(()=>{let e=new Map,n=new Map;for(let e of t)n.has(e.jobId)||n.set(e.jobId,[]),n.get(e.jobId).push(e);for(let[t,r]of n){let n=r.filter(e=>e.status===`success`||e.status===`failed`||e.status===`timeout`),i=n.filter(e=>e.status===`success`).length,a=n.filter(e=>e.durationSeconds>0).map(e=>e.durationSeconds);e.set(t,{successRate:n.length>0?i/n.length:null,avgDuration:a.length>0?a.reduce((e,t)=>e+t,0)/a.length:null,totalRuns:n.length})}return e},[t]),O=(0,L.useMemo)(()=>{let t=[...e],n=m===`asc`?1:-1;return t.sort((e,t)=>{let r=D.get(e.id),i=D.get(t.id);switch(p){case`name`:return n*e.name.localeCompare(t.name);case`status`:return n*((ZP[e.lastStatus??``]??99)-(ZP[t.lastStatus??``]??99));case`schedule`:return n*(e.schedule??``).localeCompare(t.schedule??``);case`lastRun`:return n*((e.lastRun?new Date(e.lastRun).getTime():0)-(t.lastRun?new Date(t.lastRun).getTime():0));case`successRate`:return n*((r?.successRate??-1)-(i?.successRate??-1));case`avgDuration`:return n*((r?.avgDuration??-1)-(i?.avgDuration??-1));default:return 0}}),t},[e,p,m,D]),k=(0,L.useMemo)(()=>e.map(e=>e.id).sort().join(`,`),[e]),A=(0,L.useRef)(k);if(A.current!==k){A.current=k;let t=new Set(e.map(e=>e.id)),n=new Set;for(let e of g)t.has(e)&&n.add(e);n.size!==g.size&&_(n)}let j=O.length>0&&O.every(e=>g.has(e.id)),M=g.size>0,N=(0,L.useCallback)((e,t)=>{_(n=>{let r=new Set(n);if(t&&w.current){let t=O.map(e=>e.id),n=t.indexOf(w.current),i=t.indexOf(e);if(n!==-1&&i!==-1){let[e,a]=n<i?[n,i]:[i,n];for(let n=e;n<=a;n++)r.add(t[n]);return r}}return r.has(e)?r.delete(e):r.add(e),w.current=e,r})},[O]),ee=(0,L.useCallback)(()=>{_(j?new Set:new Set(O.map(e=>e.id)))},[j,O]),P=(0,L.useCallback)(()=>{_(new Set),x(!1)},[]),F=(0,L.useMemo)(()=>e.filter(e=>g.has(e.id)),[e,g]),te=(0,L.useCallback)(async e=>{y(!0);try{await Promise.allSettled(F.map(t=>n(t.id,e)))}finally{y(!1),P()}},[F,n,P]),ne=(0,L.useCallback)(async()=>{y(!0);try{await Promise.allSettled(F.filter(e=>e.lastStatus!==`running`).map(e=>r(e.id)))}finally{y(!1),P()}},[F,r,P]),re=(0,L.useCallback)(async()=>{if(s){y(!0);try{await Promise.allSettled(F.map(e=>s(e.id)))}finally{y(!1),P()}}},[F,s,P]),R=(e=!0,t)=>[$.th,e?$.thSortable:``,t].filter(Boolean).join(` `);return(0,B.jsxs)(`div`,{className:$.shell,children:[(0,B.jsx)(`div`,{className:$.scroll,children:(0,B.jsxs)(`table`,{className:$.table,children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{className:`${$.th} ${$.tdCheck}`,children:(0,B.jsx)(`input`,{type:`checkbox`,className:$.checkbox,checked:j,onChange:ee,title:j?`Deselect all`:`Select all`})}),(0,B.jsx)(`th`,{className:`${$.th} ${$.tdToggle}`}),(0,B.jsx)(`th`,{className:R(!0,$.tdStatus),onClick:()=>E(`status`),title:`Sort by status`,children:(0,B.jsx)(QP,{active:p===`status`,dir:m})}),(0,B.jsxs)(`th`,{className:R(),onClick:()=>E(`name`),children:[`Name`,(0,B.jsx)(QP,{active:p===`name`,dir:m})]}),(0,B.jsx)(`th`,{className:$.th,children:`Agent`}),(0,B.jsxs)(`th`,{className:R(),onClick:()=>E(`schedule`),children:[`Schedule`,(0,B.jsx)(QP,{active:p===`schedule`,dir:m})]}),(0,B.jsxs)(`th`,{className:R(),onClick:()=>E(`lastRun`),children:[`Last Run`,(0,B.jsx)(QP,{active:p===`lastRun`,dir:m})]}),(0,B.jsxs)(`th`,{className:R(!0,$.thRight),onClick:()=>E(`successRate`),children:[`Rate`,(0,B.jsx)(QP,{active:p===`successRate`,dir:m})]}),(0,B.jsxs)(`th`,{className:R(!0,$.thRight),onClick:()=>E(`avgDuration`),children:[`Avg`,(0,B.jsx)(QP,{active:p===`avgDuration`,dir:m})]}),(0,B.jsx)(`th`,{className:`${$.th} ${$.tdActions}`})]})}),(0,B.jsx)(`tbody`,{children:O.map(e=>{let t=D.get(e.id),u=e.lastStatus===`running`,d=g.has(e.id),f=c&&!e.ignorePauses,p=f||!e.enabled,m=t?.successRate;return(0,B.jsxs)(`tr`,{className:[$.row,d?$.rowSelected:``,p?$.rowDisabled:``,u?$.rowRunning:``].filter(Boolean).join(` `),"data-hover-reveal":`true`,children:[(0,B.jsx)(`td`,{className:$.tdCheck,children:(0,B.jsx)(`input`,{type:`checkbox`,className:$.checkbox,checked:d,onChange:()=>{},onClick:t=>{t.stopPropagation(),N(e.id,t.shiftKey)}})}),(0,B.jsx)(`td`,{className:$.tdToggle,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(kk,{checked:e.enabled,onChange:t=>n(e.id,t),disabled:f})}),(0,B.jsx)(`td`,{className:$.tdStatus,title:eF(e.lastStatus),children:(0,B.jsx)(Rv,{status:e.lastStatus,size:`sm`})}),(0,B.jsxs)(`td`,{className:$.tdName,onClick:()=>a(e.id),children:[(0,B.jsxs)(`div`,{className:$.nameRow,children:[(0,B.jsx)(`span`,{className:$.name,title:e.name,children:e.name}),(0,B.jsx)(Yk,{value:e.id,label:`job id`,announceLabel:`ID for ${e.name}`}),e.selfImprove&&(0,B.jsx)(`span`,{className:$.selfImproveIcon,title:`Self-improving`,children:`✨`})]}),(e.command||e.tags&&e.tags.length>0)&&(0,B.jsxs)(`div`,{className:$.subline,children:[e.command&&(0,B.jsx)(`span`,{className:$.command,title:e.command,children:e.command}),e.tags?.slice(0,3).map(e=>(0,B.jsx)(`span`,{className:$.tag,children:e},e))]})]}),(0,B.jsx)(`td`,{className:$.tdAgent,children:(0,B.jsx)(Wv,{job:e,employees:l,compact:!0,dimmed:p})}),(0,B.jsx)(`td`,{className:$.tdSchedule,title:e.scheduleHuman||e.schedule,children:(0,B.jsxs)(`span`,{className:$.scheduleCell,children:[(0,B.jsx)(`span`,{children:e.scheduleHuman||e.schedule}),je(e.schedule)&&(0,B.jsx)(cu,{variant:`warning`,size:`sm`,label:`Invalid`,icon:`⚠`,title:`Schedule "${e.schedule}" is invalid. Click to open job.`,ariaLabel:`Schedule invalid. Open job.`,onClick:t=>{t.stopPropagation(),a(e.id)}})]})}),(0,B.jsx)(`td`,{className:$.tdLastRun,children:(0,B.jsx)(I,{iso:e.lastRun})}),(0,B.jsx)(`td`,{className:$.tdRate,children:m==null?(0,B.jsx)(`span`,{className:$.emptyCell,children:`—`}):(0,B.jsxs)(`span`,{className:`${$.ratePill} ${$P(m)}`,children:[Math.round(m*100),`%`]})}),(0,B.jsx)(`td`,{className:$.tdAvg,children:t?.avgDuration==null?`—`:ze(Math.round(t.avgDuration))}),(0,B.jsx)(`td`,{className:$.tdActions,onClick:e=>e.stopPropagation(),children:(0,B.jsx)(nF,{job:e,isRunning:u,isGloballyPaused:c,onRun:r,onCancel:i,onExport:o,onDelete:s,menuOpen:S===e.id,onOpenMenu:()=>C(S===e.id?null:e.id)})})]},e.id)})})]})}),M&&(0,B.jsxs)(`div`,{className:$.bulkBar,children:[(0,B.jsxs)(`span`,{className:$.bulkCount,children:[g.size,` selected`]}),(0,B.jsxs)(`div`,{className:$.bulkActions,children:[(0,B.jsx)(`button`,{className:`${$.bulkBtn} ${$.bulkBtnEnable}`,disabled:v,onClick:()=>te(!0),children:`Enable`}),(0,B.jsx)(`button`,{className:`${$.bulkBtn} ${$.bulkBtnDisable}`,disabled:v,onClick:()=>te(!1),children:`Disable`}),(0,B.jsxs)(`button`,{className:`${$.bulkBtn} ${$.bulkBtnRun}`,disabled:v,onClick:ne,children:[`▶`,` Run All`]}),o&&(0,B.jsxs)(`button`,{className:$.bulkBtn,disabled:v,onClick:()=>F.forEach(e=>o(e.id)),children:[`⬆`,` Export`]}),s&&(b?(0,B.jsxs)(`span`,{className:$.bulkConfirm,children:[(0,B.jsxs)(`span`,{children:[`Delete `,g.size,`?`]}),(0,B.jsx)(`button`,{className:`${$.bulkBtn} ${$.bulkBtnConfirm}`,disabled:v,onClick:re,children:`Confirm`}),(0,B.jsx)(`button`,{className:$.bulkBtn,onClick:()=>x(!1),children:`Cancel`})]}):(0,B.jsx)(`button`,{className:`${$.bulkBtn} ${$.bulkBtnDelete}`,disabled:v,onClick:()=>x(!0),children:`Delete`}))]}),(0,B.jsxs)(`button`,{className:$.bulkClear,onClick:P,children:[`✕`,` Clear`]})]}),(0,B.jsxs)(`div`,{className:$.footer,children:[(0,B.jsxs)(`span`,{children:[e.length,` jobs · `,e.filter(e=>e.enabled).length,` enabled`,e.some(e=>e.lastStatus===`running`)&&(0,B.jsxs)(B.Fragment,{children:[` `,`·`,` `,(0,B.jsxs)(`span`,{className:$.footerRunning,children:[e.filter(e=>e.lastStatus===`running`).length,` running`]})]})]}),(0,B.jsx)(`span`,{className:$.footerHint,children:M?`Shift+click for range select`:`Click column headers to sort`})]})]})}function nF({job:e,isRunning:t,isGloballyPaused:n,onRun:r,onCancel:i,onExport:a,onDelete:o,menuOpen:s,onOpenMenu:c}){let l=n&&!e.ignorePauses,u=!!(a||o);return(0,B.jsxs)(`div`,{className:$.rowActionsCluster,onClick:e=>e.stopPropagation(),children:[t?(0,B.jsx)(`button`,{type:`button`,className:`${$.rowActionBtn} ${$.rowActionStop}`,onClick:()=>i(e.id),title:`Cancel running job`,"aria-label":`Cancel`,children:`■`}):(0,B.jsx)(`button`,{type:`button`,className:`${$.rowActionBtn} ${$.rowActionRun} ${$.rowReveal}`,onClick:()=>r(e.id),disabled:l,title:l?`Globally paused`:`Run now`,"aria-label":`Run now`,children:`▶`}),u&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`${$.rowActionBtn} ${$.rowReveal}`,onClick:e=>{e.stopPropagation(),c()},title:`More actions`,"aria-label":`More actions`,"aria-haspopup":`menu`,"aria-expanded":s,children:`⋯`}),s&&(0,B.jsxs)(`div`,{className:`${$.menu} ${$.menuAnchorRight}`,role:`menu`,onClick:e=>e.stopPropagation(),children:[a&&(0,B.jsxs)(`button`,{type:`button`,className:$.menuItem,role:`menuitem`,onClick:()=>{a(e.id),c()},children:[`⬆`,` Export`]}),a&&o&&(0,B.jsx)(`div`,{className:$.menuDivider}),o&&(0,B.jsxs)(`button`,{type:`button`,className:`${$.menuItem} ${$.menuItemDanger}`,role:`menuitem`,onClick:()=>{o(e.id),c()},children:[`✕`,` Delete`]})]})]})]})}var rF={root:`_root_u2j1w_3`,group:`_group_u2j1w_9`,btn:`_btn_u2j1w_18`,btnActive:`_btnActive_u2j1w_41`,btnFirst:`_btnFirst_u2j1w_52`,btnLast:`_btnLast_u2j1w_56`,btnOnly:`_btnOnly_u2j1w_60`,btnMiddle:`_btnMiddle_u2j1w_64`,btnDensity:`_btnDensity_u2j1w_70`},iF=[{value:`list`,label:`List`},{value:`grouped`,label:`Grouped`},{value:`table`,label:`Table`,mobileHide:!0}],aF=[{value:`compact`,icon:`⎕`,title:`Compact rows`},{value:`comfortable`,icon:`☰`,title:`Comfortable rows`}];function oF(e,t){return t===1?rF.btnOnly:e===0?rF.btnFirst:e===t-1?rF.btnLast:rF.btnMiddle}function sF({viewMode:e,onViewModeChange:t,density:n,onDensityChange:r}){return(0,B.jsxs)(`div`,{className:rF.root,children:[e!==`table`&&(0,B.jsx)(`div`,{className:rF.group,role:`group`,"aria-label":`Card density`,children:aF.map((e,t,i)=>{let a=n===e.value;return(0,B.jsx)(`button`,{type:`button`,onClick:()=>r(e.value),title:e.title,"aria-label":e.title,"aria-pressed":a,className:[rF.btn,rF.btnDensity,oF(t,i.length),a?rF.btnActive:``].filter(Boolean).join(` `),children:e.icon},e.value)})}),(0,B.jsx)(`div`,{className:rF.group,role:`group`,"aria-label":`View mode`,children:iF.map((n,r,i)=>{let a=e===n.value;return(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(n.value),"aria-pressed":a,className:[rF.btn,oF(r,i.length),a?rF.btnActive:``,n.mobileHide?`job-table-mobile-hide`:``].filter(Boolean).join(` `),children:n.label},n.value)})})]})}function cF(e){let{jobs:t,feed:n,filteredJobs:r,groupedJobs:i,employees:a,allTags:o,filterCounts:s,runsByCounts:c,isGloballyPaused:l,searchRef:u,viewMode:d,setViewMode:f,jobsDensity:p,setJobsDensity:m,searchTerm:h,setSearchTerm:g,activeFilter:_,setActiveFilter:v,employeeFilter:y,setEmployeeFilter:b,tagFilter:x,setTagFilter:S,runsByFilter:C,setRunsByFilter:w,onOpenSidebar:T,onEdit:E,handleToggleEnabled:D,handleRun:O,handleCancel:k,handleSelectJob:A,handleDuplicate:j,handleExport:M,handleDelete:N}=e;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:q.a349e79,children:[(0,B.jsxs)(`div`,{className:q.a605393,children:[(0,B.jsx)(`h2`,{className:`jobs-section-heading ${q.a58d2af}`,children:`Jobs`}),(0,B.jsx)(`button`,{className:`btn btn-sm ${q.a15c1ca}`,onClick:T,title:`Job navigator`,children:`☰`})]}),(0,B.jsx)(sF,{viewMode:d,onViewModeChange:f,density:p,onDensityChange:m})]}),t.length>0&&(0,B.jsx)(qP,{searchTerm:h,onSearchChange:g,activeFilter:_,onFilterChange:v,filterCounts:s,searchRef:u,employeeFilter:y,onEmployeeFilterChange:b,employees:a,tagFilter:x,onTagFilterChange:S,allTags:o,runsByFilter:C,onRunsByFilterChange:w,runsByCounts:c}),t.length===0?(0,B.jsxs)(`div`,{className:G.emptyState,children:[(0,B.jsx)(`div`,{className:q.ab96dcc,children:`⏱`}),(0,B.jsx)(`p`,{className:q.aa93ed6,children:`No jobs yet. Open this project in Claude Code and ask it to help you create your first job.`})]}):r.length===0?(0,B.jsx)(`div`,{className:q.aeb1b5d,children:(0,B.jsx)(`p`,{className:q.aa93ed6,children:`No jobs match your search or filter.`})}):d===`table`?(0,B.jsx)(tF,{jobs:r,feed:n,onToggleEnabled:D,onRun:O,onCancel:k,onSelectJob:A,onExport:M,onDelete:N,isGloballyPaused:l,employees:a}):d===`list`?(0,B.jsx)(`div`,{className:q.a8fbc9a,children:r.map(e=>(0,B.jsx)(xN,{job:e,feed:n,density:p,onToggleEnabled:D,onRun:O,onCancel:k,onSelectJob:A,onEdit:E,onDuplicate:j,onExport:M,onDelete:N,isGloballyPaused:l,employees:a},e.id))}):(0,B.jsx)(XP,{groups:i,feed:n,density:p,onToggleEnabled:D,onRun:O,onCancel:k,onSelectJob:A,onEdit:E,onDuplicate:j,onExport:M,onDelete:N,isGloballyPaused:l,employees:a})]})}var lF=`modulepreload`,uF=function(e){return`/`+e},dF={},fF=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=uF(t,n),t in dF)return;dF[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:lF,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},pF=(0,L.lazy)(()=>fF(()=>import(`./ChatPanel-BUNJ-rXp.js`).then(e=>({default:e.ChatPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),mF=(0,L.lazy)(()=>fF(()=>import(`./OrgPage-DP2-hcbf.js`).then(e=>({default:e.OrgPage})),__vite__mapDeps([9,1,10,11,12,13,4,5,14]))),hF=(0,L.lazy)(()=>fF(()=>import(`./SessionHistory-DwX-i9Io.js`).then(e=>({default:e.SessionHistory})),__vite__mapDeps([15,1,16,17,5,4]))),gF=(0,L.lazy)(()=>fF(()=>import(`./AnalyticsPage-BoafbdRY.js`).then(e=>({default:e.AnalyticsPage})),__vite__mapDeps([18,1,19,5]))),_F=(0,L.lazy)(()=>fF(()=>import(`./SettingsPage-C6Xq22uB.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([20,1,3,21,17,5,4,22,23,24,25,6,7]))),vF=(0,L.lazy)(()=>fF(()=>import(`./ScheduleOptimizerPage-Cmje0CoX.js`).then(e=>({default:e.ScheduleOptimizerPage})),__vite__mapDeps([26,1,5]))),yF=(0,L.lazy)(()=>fF(()=>import(`./MemoryPage-DS6LWMdS.js`).then(e=>({default:e.MemoryPage})),__vite__mapDeps([27,1,28]))),bF=(0,L.lazy)(()=>fF(()=>import(`./BriefsPage-BsBjNIJT.js`).then(e=>({default:e.BriefsPage})),__vite__mapDeps([29,1,12,4,30]))),xF=(0,L.lazy)(()=>fF(()=>import(`./IdeasContainer-DDhsyl1f.js`).then(e=>({default:e.IdeasContainer})),__vite__mapDeps([31,1,2,32,11,12,3,21,33,16,17,5,4,22,23,6,7,34]))),SF=(0,L.lazy)(()=>fF(()=>import(`./PipelinesPage-BzYkkX-n.js`).then(e=>({default:e.PipelinesPage})),__vite__mapDeps([35,1,10,11,12,13,36]))),CF=(0,L.lazy)(()=>fF(()=>import(`./UsagePage-Cm8NsPw7.js`).then(e=>({default:e.UsagePage})),__vite__mapDeps([37,1,32,11,12,3,19,5,4,22,23,6,7,38]))),wF=(0,L.lazy)(()=>fF(()=>import(`./HeartbeatPanel-q7mW5VDk.js`).then(e=>({default:e.HeartbeatPanel})),__vite__mapDeps([39,1,3,4,22,23,24,25,6,7,40]))),TF=(0,L.lazy)(()=>fF(()=>import(`./ContinuousImprovementPage-F6fizSUr.js`).then(e=>({default:e.ContinuousImprovementPage})),__vite__mapDeps([41,1,3,4,22,23,24,25,6,7,42]))),EF=(0,L.lazy)(()=>fF(()=>import(`./SupervisorDashboardPage-CrsOGBZ8.js`).then(e=>({default:e.SupervisorDashboardPage})),__vite__mapDeps([43,1,22,23,24,25,6,7,44])));function DF(e){let{activePage:t,settings:n,integrations:r,runtimeConfig:i,applySettingsPatch:a,verifying:o,setVerifying:s,setIntegrations:c,fetchIntegrations:l,onNavigate:u}=e,d=t===`chat`,[f,p]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{d&&p(!0)},[d]),(0,B.jsxs)(L.Suspense,{fallback:(0,B.jsx)(`div`,{className:q.a195c6b,children:`Loading...`}),children:[t===`org`&&(0,B.jsx)(`div`,{className:`page-content-frame ${q.ab164f9}`,children:(0,B.jsx)(mF,{})}),f&&(0,B.jsxs)(`div`,{style:{display:d?void 0:`none`},className:`page-content-frame page-content-frame--flush tw-chat-page ${G.pageContainer}`,children:[(0,B.jsx)(`h1`,{className:G.pageH1,children:`Chat`}),(0,B.jsx)(`div`,{className:`tw-chat-shell ${q.af809fa}`,children:(0,B.jsx)(pF,{})})]}),t===`sessions`&&(0,B.jsxs)(`div`,{className:`page-content-frame ${G.pageContainer}`,children:[(0,B.jsx)(`h1`,{className:G.pageH1,children:`Sessions`}),(0,B.jsx)(hF,{})]}),t===`analytics`&&(0,B.jsx)(gF,{}),t===`schedule-optimizer`&&(0,B.jsx)(vF,{}),t===`memory`&&(0,B.jsx)(yF,{}),t===`briefs`&&(0,B.jsx)(bF,{}),t===`ideas`&&(0,B.jsx)(`div`,{className:`page-content-frame`,children:(0,B.jsx)(xF,{settings:n,onUpdateSettings:a,onOpenUsage:()=>u(`usage`)})}),t===`usage`&&(0,B.jsx)(CF,{onIdeaClick:()=>u(`ideas`)}),t===`pipelines`&&(0,B.jsx)(`div`,{className:`page-content-frame ${G.pageContainer}`,children:(0,B.jsx)(SF,{})}),t===`heartbeat`&&(0,B.jsx)(wF,{}),t===`continuous-improvement`&&(0,B.jsx)(TF,{}),t===`supervisor`&&(0,B.jsx)(EF,{}),t===`settings`&&(0,B.jsx)(_F,{settings:n,integrations:r,runtimeConfig:i,onUpdateSettings:a,onVerify:async()=>{s(!0);try{let e=await l();e&&c(e)}finally{s(!1)}},verifying:o})]})}function OF(e){let{open:t,title:n,body:r,confirmLabel:i=`Confirm`,cancelLabel:a=`Cancel`,destructive:o=!0,onConfirm:s,onCancel:c}=e,l=(0,L.useRef)(null),u=(0,L.useRef)(null);if((0,L.useEffect)(()=>{if(t)return u.current=document.activeElement,l.current?.focus(),()=>{let e=u.current;e&&typeof e.focus==`function`&&e.focus()}},[t]),(0,L.useEffect)(()=>{if(!t)return;function e(e){e.key===`Escape`&&c()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,c]),!t)return null;let d=`confirm-dialog-title`,f=`confirm-dialog-body`;return(0,B.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":d,"aria-describedby":f,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:16,zIndex:9999},onClick:e=>{e.target===e.currentTarget&&c()},children:(0,B.jsxs)(`div`,{style:{width:`100%`,maxWidth:420,background:`var(--color-bg-raised)`,border:`1px solid ${C.border}`,borderRadius:12,padding:20,boxShadow:`0 20px 40px rgba(0, 0, 0, 0.4)`},children:[(0,B.jsx)(`h2`,{id:d,style:{fontSize:16,fontWeight:700,margin:`0 0 6px`,color:C.text},children:n}),(0,B.jsx)(`p`,{id:f,style:{fontSize:13,color:C.muted,margin:`0 0 16px`,lineHeight:1.5},children:r}),(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8},children:[(0,B.jsx)(`button`,{type:`button`,onClick:c,style:{minHeight:44,padding:`0 14px`,background:`transparent`,border:`1px solid ${C.border}`,borderRadius:8,color:C.text,fontSize:13,cursor:`pointer`,fontFamily:`inherit`},children:a}),(0,B.jsx)(`button`,{ref:l,type:`button`,onClick:s,style:{minHeight:44,padding:`0 16px`,background:o?`var(--color-danger, #ff6b6b)`:`var(--color-primary)`,border:`1px solid ${o?`var(--color-danger, #ff6b6b)`:`var(--color-primary)`}`,borderRadius:8,color:`#fff`,fontSize:13,fontWeight:600,cursor:`pointer`,fontFamily:`inherit`},children:i})]})]})})}var kF={shortcutHint:`_shortcutHint_yuik4_1`};function AF({size:e=18,strokeWidth:t=1.75}){return(0,B.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M12 4.5c-3 0-5 1.5-5 3.75 0 1 .4 1.75 1 2.25-.6.5-1 1.25-1 2.25 0 1.25.75 2.25 2 2.75 0 1.5 1 2.5 3 2.5v-13.5z`}),(0,B.jsx)(`path`,{d:`M12 4.5c3 0 5 1.5 5 3.75 0 1-.4 1.75-1 2.25.6.5 1 1.25 1 2.25 0 1.25-.75 2.25-2 2.75 0 1.5-1 2.5-3 2.5`}),(0,B.jsx)(`path`,{d:`M9.5 9.25h1M9.5 12h1M9.5 14.75h1M13.5 9.25h1M13.5 12h1M13.5 14.75h1`})]})}function jF({size:e=18,strokeWidth:t=1.75}){return(0,B.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,B.jsx)(`path`,{d:`M3 12h4l2.5-6 5 12 2.5-6h4`})})}var MF=[{id:`cron`,label:`Scheduled`,Icon:gh},{id:`supervisor`,label:`Job Health`,Icon:jF},{id:`org`,label:`Organization`,Icon:_h},{id:`chat`,label:`Chat`,Icon:vh},{id:`memory`,label:`Memory`,Icon:AF},{id:`ideas`,label:`Ideas`,Icon:Ch},{id:`briefs`,label:`Briefs`,Icon:Sh},{id:`sessions`,label:`Sessions`,Icon:yh},{id:`analytics`,label:`Analytics`,Icon:bh},{id:`settings`,label:`Settings`,Icon:xh}],NF=Object.fromEntries(Se.map(e=>[e.page,e.display]));function PF({activePage:e,onNavigate:t}){let[n,r]=(0,L.useState)(!1);async function i(){r(!1),await m(),window.location.reload()}return(0,B.jsxs)(`aside`,{className:`app-sidebar`,style:{position:`fixed`,top:0,left:0,bottom:0,width:220,zIndex:60,display:`flex`,flexDirection:`column`,background:`var(--color-bg-raised)`,borderRight:`1px solid ${C.border}`,overflow:`hidden`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`16px 14px 12px`,borderBottom:`1px solid ${C.border}`,minHeight:56,flexShrink:0},children:[(0,B.jsx)(`span`,{style:{width:28,flexShrink:0,display:`flex`,justifyContent:`center`},children:(0,B.jsx)(Th,{size:24,"aria-label":`TeamworkOS`})}),(0,B.jsx)(`span`,{style:{whiteSpace:`nowrap`,fontSize:14,fontWeight:600,letterSpacing:.1,color:C.text},children:`TeamworkOS`})]}),(0,B.jsx)(`nav`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:2,padding:`8px 8px`,overflowY:`auto`,overflowX:`hidden`},children:MF.map(n=>{let r=e===n.id,i=n.Icon;return(0,B.jsxs)(`button`,{onClick:()=>t(n.id),"aria-label":n.label,"aria-current":r?`page`:void 0,style:{display:`flex`,alignItems:`center`,gap:10,height:40,padding:r?`0 12px 0 10px`:`0 12px`,borderRadius:8,border:`none`,borderLeft:r?`2px solid var(--color-primary)`:`2px solid transparent`,background:r?`rgba(188,140,255,0.12)`:`transparent`,color:r?`var(--color-primary)`:C.muted,fontSize:13,fontWeight:r?600:400,cursor:`pointer`,whiteSpace:`nowrap`,transition:`background 0.15s, color 0.15s`,textAlign:`left`,fontFamily:`inherit`},onMouseEnter:e=>{r||(e.currentTarget.style.background=`rgba(139,148,158,0.08)`,e.currentTarget.style.color=C.text)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`,e.currentTarget.style.color=C.muted)},children:[(0,B.jsx)(`span`,{style:{width:28,flexShrink:0,display:`flex`,justifyContent:`center`,alignItems:`center`},children:(0,B.jsx)(i,{size:18})}),(0,B.jsx)(`span`,{children:n.label}),NF[n.id]&&(0,B.jsx)(`kbd`,{className:kF.shortcutHint,"aria-hidden":`true`,children:NF[n.id]})]},n.id)})}),(0,B.jsx)(`div`,{style:{padding:`8px`,borderTop:`1px solid ${C.border}`,flexShrink:0},children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),"aria-label":`Sign out`,style:{display:`flex`,alignItems:`center`,gap:10,width:`100%`,minHeight:44,padding:`0 12px`,borderRadius:8,border:`none`,borderLeft:`2px solid transparent`,background:`transparent`,color:C.muted,fontSize:13,fontWeight:400,cursor:`pointer`,whiteSpace:`nowrap`,transition:`background 0.15s, color 0.15s, border-color 0.15s`,textAlign:`left`,fontFamily:`inherit`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255, 107, 107, 0.08)`,e.currentTarget.style.color=`var(--color-danger, #ff6b6b)`,e.currentTarget.style.borderLeftColor=`var(--color-danger, #ff6b6b)`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`,e.currentTarget.style.color=C.muted,e.currentTarget.style.borderLeftColor=`transparent`},onFocus:e=>{e.currentTarget.style.outline=`2px solid var(--color-primary)`,e.currentTarget.style.outlineOffset=`-2px`},onBlur:e=>{e.currentTarget.style.outline=`none`},children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,style:{width:28,flexShrink:0,display:`flex`,justifyContent:`center`,alignItems:`center`,fontSize:16,lineHeight:1},children:`⏻`}),(0,B.jsx)(`span`,{children:`Sign out`})]})}),(0,B.jsx)(OF,{open:n,title:`Sign out?`,body:`You'll need your AUTH_TOKEN to sign back in. This only signs out this browser — other devices stay signed in.`,confirmLabel:`Sign out`,onConfirm:i,onCancel:()=>r(!1)})]})}function FF({activePage:e,onNavigate:t,children:n}){return(0,B.jsxs)(`div`,{style:{display:`flex`,minHeight:`100dvh`,background:`var(--color-bg)`},children:[(0,B.jsx)(PF,{activePage:e,onNavigate:t}),(0,B.jsx)(`main`,{className:`page-layout-main`,style:{flex:1,marginLeft:220,minWidth:0},children:n})]})}var IF=new Set([`cron`,`org`,`chat`,`memory`,`briefs`,`sessions`,`analytics`,`settings`,`schedule-optimizer`,`ideas`,`pipelines`,`usage`,`heartbeat`,`continuous-improvement`,`supervisor`]),LF=new Set([`overview`,`explore`,`injections`,`hygiene`,`wiki`]),RF=`injections`,zF={organization:`org`,orgs:`org`,"schedule-optimiser":`schedule-optimizer`,pipeline:`pipelines`},BF=`cron`;function VF(){let[e,...t]=window.location.hash.replace(/^#\/?/,``).split(`/`);if(e===`memory`){let e=t[0];return e&&LF.has(e)?{page:`memory`,subView:e}:{page:`memory`,subView:null}}if(IF.has(e))return{page:e,subView:null};let n=zF[e];return n===void 0?{page:BF,subView:null}:{page:n,subView:null}}function HF(){let[e,t]=(0,L.useState)(VF);(0,L.useEffect)(()=>{function e(){t(VF())}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,L.useEffect)(()=>{(!window.location.hash||window.location.hash===`#`||window.location.hash===`#/`)&&(window.location.hash=`#/${BF}`)},[]);let n=(0,L.useCallback)(e=>{window.location.hash=`#/${e}`},[]),r=(0,L.useCallback)(e=>{window.location.hash=`#/memory/${e}`},[]);return{page:e.page,subView:e.subView,navigate:n,navigateMemory:r}}function UF(){let{permission:e,requestPermission:t,notify:n}=se(),{jobs:r,healthAlerts:i,dismissedAlertKeys:a,dismissAlert:o,focusDismissedKeys:s,dismissFocusItem:c,feed:l,globalPauseState:u,progress:d,missedRuns:f,dismissMissedRun:p,dismissAllMissedRuns:m,actionableGoalsCount:h,lastRefresh:g,wsStatus:_,refresh:v,createJob:y,updateJob:b,deleteJob:x,toggleEnabled:S,runJob:C,cancelJob:w,installCron:T,fetchResult:E,fetchHistory:D,fetchTrace:O,fetchChangelog:k,snoozeJob:A,fetchFocus:j,fetchIntegrations:M,fetchSettings:N,updateSettings:ee,pauseAll:P,resumeAll:F,exportJob:te,importJob:I}=ae(n),[ne,re]=(0,L.useState)(null),[R,z]=(0,L.useState)(``),[ie,oe]=(0,L.useState)(!1),[V,ce]=(0,L.useState)(0),[le,ue]=(0,L.useState)(!1),[de,fe]=(0,L.useState)(!1),[pe,me]=(0,L.useState)(0),[ge,_e]=(0,L.useState)(!1),[ve,ye]=(0,L.useState)(!1),[be,Se]=(0,L.useState)(!1),{showOnboarding:Ce,setShowOnboarding:Oe}=Te(),{prefs:ke,setPref:Ae}=he(),[je,Me]=(0,L.useState)(null),[Ne,Pe]=(0,L.useState)(!1),[Fe,Re]=(0,L.useState)(!1),{page:ze,navigate:Be}=HF(),[Ve,He]=(0,L.useState)(null),{runtimeConfig:Ue,integrations:We,setIntegrations:Ge,settings:Ke,setSettings:qe,verifying:Je,setVerifying:Xe,applySettingsPatch:Ze,verifyIntegrationsWithPolling:Qe}=De(M,N,ee),$e=Ue?.slackSelfDmUrl??``,{position:et,isMobile:tt,handlers:nt,consumeJustDragged:rt}=tc(`fab:slackDm`,48),[it,at]=(0,L.useState)(!1),{focusData:ot,focusLoading:st,focusActiveCount:ct,setFocusActiveCount:ut,loadFocus:dt}=Ee(j),ft=(0,L.useRef)(null),{helpOpen:pt,setHelpOpen:mt}=we((0,L.useMemo)(()=>({onRefresh:v,onNewJob:()=>re({mode:`create`,job:null}),onToggleActivity:()=>oe(e=>!e),onToggleFocus:()=>at(e=>!e),onToggleSettings:()=>Be(`settings`),onFocusSearch:()=>ft.current?.focus(),onEscape:()=>{if(Ne){Pe(!1);return}if(je){Me(null);return}if(ve){ye(!1);return}if(ge){_e(!1);return}if(Ce){Oe(!1);return}if(be){Se(!1);return}if(ne){re(null);return}if(Ve){He(null);return}if(ie){oe(!1);return}if(it){at(!1);return}if(Fe){Re(!1);return}if(de){fe(!1);return}if(le){ue(!1);return}},onSyncCron:()=>{wt()},onCommandPalette:()=>_e(e=>!e),onOutputSearch:()=>ye(e=>!e),onNavigate:Be}),[v,ne,Ve,ie,it,ze,Be,le,ve,ge,be,Ce,je,Ne,de])),{sections:ht,setOrder:gt,toggleVisibility:_t,resetToDefaults:vt}=nu(),yt=async(e,t)=>{await S(e,t),z(t?`Enabled`:`Disabled`)},bt=async e=>{await C(e),z(`Job triggered — check back in a moment`)},xt=async e=>{await w(e),z(`Job cancelled`)},St=async e=>{await x(e),z(`Deleted`)},Ct=async e=>{try{ne?.mode===`edit`?(await b(e.id,e),z(`Updated`)):(await y(e),z(`Created`)),re(null)}catch(e){z(`Save failed: ${e instanceof Error?e.message:String(e)}`)}},wt=async()=>{let e=await T();z(e.ok?`Crontab installed`:`Error: ${e.error}`)},H=(0,L.useCallback)(e=>{let t=new Set(r.map(e=>e.id)),n=`${e.id}-copy`,i=2;for(;t.has(n);)n=`${e.id}-copy-${i}`,i++;re({mode:`create`,job:null,duplicateFrom:{...e,id:n,name:`${e.name} (Copy)`}})},[r]),Tt=(0,L.useCallback)(async e=>{let t=await te(e);if(!t){z(`Export failed`);return}try{await navigator.clipboard.writeText(JSON.stringify(t,null,2)),z(`Job JSON copied to clipboard`)}catch{z(`Export failed — clipboard unavailable`)}},[te]),Et=(0,L.useCallback)(async e=>{let t=await I(e);z(t?`Imported: ${t.name}`:`Import failed`)},[I]),U=(0,L.useMemo)(()=>r.map(e=>`${e.id}:${e.enabled}:${e.schedule}`).join(`|`),[r]),{searchTerm:Dt,setSearchTerm:Ot,activeFilter:kt,setActiveFilter:At,viewMode:jt,setViewMode:Mt,jobsDensity:Nt,setJobsDensity:Pt,employeeFilter:Ft,setEmployeeFilter:It,tagFilter:Lt,setTagFilter:Rt,runsByFilter:zt,setRunsByFilter:Bt,allTags:Vt,filteredJobs:Ht,groupedJobs:Ut,filterCounts:Wt,runsByCounts:Gt}=xe(r),{employees:Kt}=DP(),qt=(0,L.useCallback)(e=>{He(e)},[]);function Jt(e){switch(e){case`overview`:return(0,B.jsx)(Ie,{jobs:r,alertCount:i.length,feed:l});case`trends`:return(0,B.jsx)(Il,{});case`insights`:return(0,B.jsx)(ou,{onSelectJob:qt});case`schedule`:return(0,B.jsx)(Dl,{jobs:r,onSelectJob:qt});case`health`:return(0,B.jsx)(Nl,{feed:l,jobs:r,onSelectJob:qt});case`attention`:return(0,B.jsx)(Hl,{feed:l,jobs:r,onSelectJob:qt,onRetry:bt});case`jobs`:return(0,B.jsx)(cF,{jobs:r,feed:l,filteredJobs:Ht,groupedJobs:Ut,employees:Kt,allTags:Vt,filterCounts:Wt,runsByCounts:Gt,isGloballyPaused:!!u?.paused,searchRef:ft,viewMode:jt,setViewMode:Mt,jobsDensity:Nt,setJobsDensity:Pt,searchTerm:Dt,setSearchTerm:Ot,activeFilter:kt,setActiveFilter:At,employeeFilter:Ft,setEmployeeFilter:It,tagFilter:Lt,setTagFilter:Rt,runsByFilter:zt,setRunsByFilter:Bt,onOpenSidebar:()=>ue(!0),onEdit:e=>re({mode:`edit`,job:e}),handleToggleEnabled:yt,handleRun:bt,handleCancel:xt,handleSelectJob:qt,handleDuplicate:H,handleExport:Tt,handleDelete:St});default:return null}}return(0,B.jsxs)(FF,{activePage:ze,onNavigate:Be,children:[(0,B.jsx)(`div`,{style:{display:ze===`cron`?`block`:`none`},children:(0,B.jsxs)(`div`,{className:`responsive-root ${q.a877086}`,children:[(0,B.jsx)(FP,{pauseState:u,wsStatus:_,lastRefresh:g,activityOpen:ie,focusOpen:it,guideOpen:be,changelogOpen:de,unreadFeedCount:V,focusActiveCount:ct,unreadChangelogCount:pe,actionableGoalsCount:h,onShowHelp:()=>mt(!0),onToggleActivity:()=>oe(e=>!e),onToggleFocus:()=>at(e=>!e),onToggleGuide:()=>Se(e=>!e),onToggleChangelog:()=>fe(e=>!e),onToggleCronSettings:()=>Re(e=>!e),onOpenGoalWizard:()=>Pe(!0),onNewJob:()=>re({mode:`create`,job:null}),crontabRefreshKey:U,onSyncCrontab:wt}),(0,B.jsx)(Lh,{activityOpen:ie,onToggleActivity:()=>oe(e=>!e),unreadFeedCount:V,focusOpen:it,onToggleFocus:()=>at(e=>!e),focusActiveCount:ct,onToggleSettings:()=>Re(e=>!e),onNewJob:()=>re({mode:`create`,job:null}),onToggleGuide:()=>Se(e=>!e),changelogOpen:de,onToggleChangelog:()=>fe(e=>!e),unreadChangelogCount:pe,onOpenGoalWizard:()=>Pe(!0),actionableGoalsCount:h,crontabRefreshKey:U,onSyncCrontab:wt}),(0,B.jsx)(Ph,{pauseState:u,jobs:r,onResumeAll:F,onResumed:()=>{z(`Global pause cleared`),N().then(qe)}}),(0,B.jsx)(lt,{}),(0,B.jsx)(Ye,{missedRuns:f,onDismiss:p,onDismissAll:m,onSelectJob:qt}),(0,B.jsx)(Le,{alerts:i,dismissedKeys:a,onDismiss:o}),(0,B.jsx)(Kl,{feed:l}),(0,B.jsx)(Bu,{jobs:r,feed:l,progress:d,onSelectJob:qt,onCancel:xt}),(0,B.jsx)(Wu,{onOpenJob:qt}),(0,B.jsx)(Hc,{data:ot,loading:st,open:it,onClose:()=>at(!1),onRefresh:dt,onActiveCountChange:ut,dismissedKeys:s,onDismiss:c}),(0,B.jsx)(gc,{feed:l,open:ie,onClose:()=>oe(!1),onSelectJob:qt,onUnreadCountChange:ce}),(0,B.jsx)(fu,{open:de,onClose:()=>fe(!1),onUnreadCountChange:me}),(0,B.jsx)(Tu,{open:be,onClose:()=>Se(!1),onStartOnboarding:()=>Oe(!0)}),(0,B.jsx)(yu,{open:Ce,onClose:()=>Oe(!1),onCreateJob:()=>re({mode:`create`,job:null})}),ht.map(e=>e.visible?(0,B.jsx)(`div`,{id:`nav-${e.id}`,children:Jt(e.id)},e.id):(0,B.jsx)(`div`,{id:`nav-${e.id}`},e.id)),(0,B.jsx)(xl,{jobs:r,open:le,onClose:()=>ue(!1),onSelectJob:qt}),(0,B.jsx)(OP,{jobs:r,feed:l,employees:Kt,paused:!!u?.paused,modal:ne,setModal:re,handleSave:Ct,runJob:C,setToast:z,detailJobId:Ve,setDetailJobId:He,handleRun:bt,handleCancel:xt,toggleEnabled:S,handleDuplicate:H,handleExport:Tt,handleDelete:St,snoozeJob:A,fetchResult:E,fetchHistory:D,fetchTrace:O,fetchChangelog:k,promptLabJobId:je,setPromptLabJobId:Me,refresh:v,goalWizardOpen:Ne,setGoalWizardOpen:Pe,commandPaletteOpen:ge,setCommandPaletteOpen:_e,handleInstall:wt,toggleActivity:()=>oe(e=>!e),toggleFocus:()=>at(e=>!e),navigateToSettings:()=>Be(`settings`),showHelp:()=>mt(!0),pauseAll:P,resumeAll:F,onPausedAll:()=>z(`All jobs paused`),onResumedAll:()=>{z(`All jobs resumed`),N().then(qe)},setOutputSearchOpen:ye,outputSearchOpen:ve,handleSelectJob:qt,helpOpen:pt,setHelpOpen:mt}),(0,B.jsx)(Ql,{sections:ht,onReorder:gt,onToggleVisibility:_t,onReset:vt}),(0,B.jsx)(oc,{}),(0,B.jsx)(vl,{open:Fe,onClose:()=>Re(!1),settings:Ke,integrations:We,onUpdateSettings:Ze,verifying:Je,notificationPermission:e,onRequestNotifications:t,onVerify:Qe,onImportFromSync:Et,sectionLayout:ht,onSectionReorder:gt,onSectionToggleVisibility:_t,onSectionReset:vt})]})}),(0,B.jsx)(DF,{activePage:ze,settings:Ke,integrations:We,runtimeConfig:Ue,applySettingsPatch:Ze,verifying:Je,setVerifying:Xe,setIntegrations:Ge,fetchIntegrations:M,onNavigate:Be}),(0,B.jsx)(Mh,{activePage:ze,onNavigate:Be}),R&&(0,B.jsx)(sc,{message:R,onDone:()=>z(``)}),$e&&ze===`cron`&&(0,B.jsx)(Nh,{href:$e,isMobile:tt,position:et,handlers:nt,consumeJustDragged:rt}),!1]})}var WF=[{name:`Teamwork Dark`,light:!1,backgroundColor:`215 28 7`,primaryColor:`265 100 81`,positiveColor:`127 49 49`,negativeColor:`3 92 63`,contrastMultiplier:1,textSaturationMultiplier:1,customCSS:``},{name:`Teamwork Light`,light:!0,backgroundColor:`220 15 97`,primaryColor:`265 70 50`,positiveColor:`127 49 40`,negativeColor:`3 70 50`,contrastMultiplier:1,textSaturationMultiplier:1,customCSS:``},{name:`Catppuccin Mocha`,light:!1,backgroundColor:`240 21 15`,primaryColor:`267 84 81`,positiveColor:`115 54 76`,negativeColor:`343 81 75`,contrastMultiplier:1,textSaturationMultiplier:1,customCSS:``},{name:`Gruvbox Dark`,light:!1,backgroundColor:`0 0 16`,primaryColor:`42 95 59`,positiveColor:`100 34 62`,negativeColor:`6 97 60`,contrastMultiplier:1.1,textSaturationMultiplier:1,customCSS:``},{name:`Dracula`,light:!1,backgroundColor:`231 15 18`,primaryColor:`265 89 78`,positiveColor:`135 94 65`,negativeColor:`0 100 67`,contrastMultiplier:1,textSaturationMultiplier:1,customCSS:``},{name:`Rose Pine`,light:!1,backgroundColor:`249 22 12`,primaryColor:`267 57 78`,positiveColor:`189 43 73`,negativeColor:`343 76 68`,contrastMultiplier:1,textSaturationMultiplier:1,customCSS:``},{name:`Nord`,light:!1,backgroundColor:`220 16 22`,primaryColor:`193 43 67`,positiveColor:`92 28 65`,negativeColor:`354 42 56`,contrastMultiplier:1.05,textSaturationMultiplier:1,customCSS:``},{name:`Tokyo Night`,light:!1,backgroundColor:`231 15 13`,primaryColor:`220 87 73`,positiveColor:`96 55 64`,negativeColor:`349 89 72`,contrastMultiplier:1,textSaturationMultiplier:1,customCSS:``},{name:`One Dark`,light:!1,backgroundColor:`220 13 18`,primaryColor:`207 82 66`,positiveColor:`95 38 62`,negativeColor:`355 65 65`,contrastMultiplier:1,textSaturationMultiplier:1,customCSS:``},{name:`Solarized Dark`,light:!1,backgroundColor:`192 81 14`,primaryColor:`205 69 49`,positiveColor:`68 100 30`,negativeColor:`1 71 52`,contrastMultiplier:1.1,textSaturationMultiplier:1,customCSS:``}],GF=WF[0],KF=WF[1];function qF(e){let t=document.documentElement;YF(t,`bg`,e.backgroundColor),YF(t,`primary`,e.primaryColor),YF(t,`positive`,e.positiveColor),YF(t,`negative`,e.negativeColor),t.style.setProperty(`--contrast-multiplier`,String(e.contrastMultiplier)),t.style.setProperty(`--text-saturation-multiplier`,String(e.textSaturationMultiplier)),t.classList.toggle(`light`,e.light),ZF(e.customCSS),JF(e.light)}function JF(e){let t=window.__hljsThemes;if(!t)return;let n=document.getElementById(`hljs-theme`);if(!n)return;let r=e?t.light:t.dark;n.textContent!==r&&(n.textContent=r)}function YF(e,t,n){let r=n.trim().split(/\s+/);if(r.length!==3)return;let[i,a,o]=r;e.style.setProperty(`--${t}-h`,i),e.style.setProperty(`--${t}-s`,`${a}%`),e.style.setProperty(`--${t}-l`,`${o}%`)}var XF=`theme-custom-css`;function ZF(e){let t=document.getElementById(XF);if(e.length===0){t?.remove();return}t||(t=document.createElement(`style`),t.id=XF,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}var QF=`teamwork:theme-changed`;function $F(e){window.dispatchEvent(new CustomEvent(QF,{detail:e}))}var eI=`teamwork.theme.autodetected.v1`;async function tI(e){if(localStorage.getItem(eI)===`1`||(localStorage.setItem(eI,`1`),e.name!==GF.name)||!window.matchMedia(`(prefers-color-scheme: light)`).matches)return e;try{if((await fetch(`/api/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({appearance:KF})})).ok)return KF}catch{}return e}function nI({children:e}){let[t,n]=(0,L.useState)(null);return(0,L.useEffect)(()=>{let e=!1;async function t(){try{let t=await fetch(`/api/settings`,{headers:{"Content-Type":`application/json`}});if(!t.ok)return;let r=(await t.json())?.appearance;if(!r)return;let i=await tI(r);e||n(i)}catch{}}t();function r(e){let t=e.detail;t&&n(t)}return window.addEventListener(QF,r),()=>{e=!0,window.removeEventListener(QF,r)}},[]),(0,L.useLayoutEffect)(()=>{t&&qF(t)},[t]),(0,B.jsx)(B.Fragment,{children:e})}var rI=null,iI=null;function aI(e=null,t={}){let n=t.allowCancel??!0;return new Promise(t=>{rI={resolver:t,errorMessage:e,allowCancel:n},iI&&iI(rI)})}function oI(e){let t=rI;rI=null,t&&t.resolver(e)}function sI(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(``),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(!0),c=(0,L.useRef)(null);(0,L.useEffect)(()=>(iI=e=>{r(``),a(e.errorMessage),s(e.allowCancel),t(!0)},rI&&iI(rI),()=>{iI=null,oI(null)}),[]),(0,L.useEffect)(()=>{e&&c.current?.focus()},[e]),(0,L.useEffect)(()=>{if(!e||!o)return;function t(e){e.key===`Escape`&&u()}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,o]);function l(){let e=n.trim();e.length!==0&&(t(!1),a(null),oI(e))}function u(){o&&(t(!1),a(null),oI(null))}return e?(0,B.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`authgate-title`,style:{position:`fixed`,inset:0,background:`rgba(0, 0, 0, 0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:16,zIndex:9999},onClick:e=>{o&&e.target===e.currentTarget&&u()},children:(0,B.jsxs)(`div`,{style:{width:`100%`,maxWidth:420,background:`var(--color-bg-raised)`,border:`1px solid ${C.border}`,borderRadius:12,padding:20,boxShadow:`0 20px 40px rgba(0, 0, 0, 0.4)`},children:[(0,B.jsx)(`h2`,{id:`authgate-title`,style:{fontSize:16,fontWeight:700,margin:`0 0 6px`,color:C.text},children:`Sign in to TeamworkOS`}),(0,B.jsxs)(`p`,{style:{fontSize:13,color:C.muted,margin:`0 0 14px`,lineHeight:1.5},children:[`This gateway has `,(0,B.jsx)(`code`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12},children:`AUTH_TOKEN`}),` set. Paste the token from your server’s `,(0,B.jsx)(`code`,{style:{fontFamily:`ui-monospace, monospace`,fontSize:12},children:`.env`}),` to continue. Sessions are stored in an httpOnly cookie that expires after 30 days.`]}),i&&(0,B.jsx)(`div`,{role:`alert`,style:{fontSize:12,color:`var(--color-danger, #ff6b6b)`,background:`var(--color-danger-bg, rgba(255, 107, 107, 0.12))`,border:`1px solid var(--color-danger, #ff6b6b)`,borderRadius:8,padding:`8px 10px`,margin:`0 0 12px`},children:i}),(0,B.jsx)(`input`,{ref:c,type:`password`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},placeholder:`Bearer token`,autoComplete:`current-password`,"aria-label":`AUTH_TOKEN`,"aria-invalid":i!==null,style:{width:`100%`,padding:`10px 12px`,background:`var(--color-bg)`,color:C.text,border:`1px solid ${i?`var(--color-danger, #ff6b6b)`:C.border}`,borderRadius:8,fontSize:14,fontFamily:`ui-monospace, monospace`,boxSizing:`border-box`}}),(0,B.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,marginTop:14},children:[o&&(0,B.jsx)(`button`,{type:`button`,onClick:u,style:{minHeight:44,padding:`0 14px`,background:`transparent`,border:`1px solid ${C.border}`,borderRadius:8,color:C.text,fontSize:13,cursor:`pointer`},children:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,onClick:l,disabled:n.trim().length===0,style:{minHeight:44,padding:`0 16px`,background:n.trim().length===0?`var(--color-subtle-bg)`:`var(--color-primary)`,border:`1px solid ${n.trim().length===0?C.border:`var(--color-primary)`}`,borderRadius:8,color:n.trim().length===0?C.muted:`#fff`,fontSize:13,fontWeight:600,cursor:n.trim().length===0?`not-allowed`:`pointer`},children:`Sign in`})]})]})}):null}function cI(){return(0,L.useSyncExternalStore)(u,c,()=>`unknown`)}var lI=`pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#79c0ff}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-comment,.hljs-code,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}`,uI=`pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}`;if(f({promptForToken:(e,t)=>aI(e,t)}),typeof document<`u`){let e=document.createElement(`style`);e.id=`hljs-theme`,e.textContent=lI,document.head.appendChild(e),window.__hljsThemes={dark:lI,light:uI}}function dI(){return cI()===`authenticated`?(0,B.jsx)(me,{children:(0,B.jsx)(UF,{})}):null}ne.createRoot(document.getElementById(`root`)).render((0,B.jsx)(L.StrictMode,{children:(0,B.jsxs)(nI,{children:[(0,B.jsx)(dI,{}),(0,B.jsx)(sI,{})]})}));export{fS as $,ut as $t,Kk as A,G as At,wD as B,_r as Bt,sM as C,rm as Ct,Hj as D,qu as Dt,nM as E,td as Et,hk as F,Ko as Ft,cT as G,dr as Gt,BE as H,ar as Ht,pk as I,Lo as It,Qw as J,mr as Jt,sT as K,fr as Kt,fk as L,Mr as Lt,Fk as M,sc as Mt,Nk as N,Ks as Nt,Yk as O,Du as Ot,kk as P,Jo as Pt,MS as Q,Wn as Qt,lk as R,Tr as Rt,uN as S,im as St,aM as T,pd as Tt,FT as U,sr as Ut,CD as V,ir as Vt,lT as W,W as Wt,LS as X,$n as Xt,bw as Y,rr as Yt,zS as Z,Xn as Zt,gN as _,U_ as _t,HF as a,Wy as at,dN as b,xh as bt,DP as c,Py as ct,hP as d,xy as dt,he as en,$x as et,QN as f,yy as ft,_N as g,kv as gt,mN as h,ay as ht,RF as i,Gy as it,Uk as j,Uc as jt,qk as k,cu as kt,EP as l,jy as lt,ZN as m,my as mt,GF as n,Jx as nt,OF as o,Ly as ot,$N as p,hy as pt,rT as q,pr as qt,WF as r,zb as rt,fF as s,Iy as st,$F as t,Qx as tt,bP as u,Ay as ut,hN as v,d_ as vt,iM as w,tm as wt,lN as x,am as xt,fN as y,c_ as yt,ok as z,wr as zt};
|