fifony 0.1.22 → 0.1.23
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 +33 -9
- package/app/dist/assets/KeyboardShortcutsHelp-BB5jLK_E.js +1 -0
- package/app/dist/assets/OnboardingWizard-xyM3Okjv.js +1 -0
- package/app/dist/assets/analytics.lazy-CfJXsh6r.js +1 -0
- package/app/dist/assets/index-C1QEwHZG.js +43 -0
- package/app/dist/assets/index-DjmUHXd1.css +1 -0
- package/app/dist/dinofffaur.png +0 -0
- package/app/dist/index.html +2 -2
- package/app/dist/service-worker.js +1 -1
- package/app/public/dinofffaur.png +0 -0
- package/dist/agent/cli-wrapper.js +1 -1
- package/dist/agent/cli-wrapper.js.map +1 -1
- package/dist/agent/run-local.js +163 -33
- package/dist/agent/run-local.js.map +1 -1
- package/dist/{chunk-O665NS5E.js → chunk-DD5BE2W6.js} +40 -43
- package/dist/chunk-DD5BE2W6.js.map +1 -0
- package/dist/chunk-DVU3CXWA.js +75 -0
- package/dist/chunk-DVU3CXWA.js.map +1 -0
- package/dist/chunk-G6CQK2WH.js +2137 -0
- package/dist/chunk-G6CQK2WH.js.map +1 -0
- package/dist/{chunk-VP6TGOMT.js → chunk-KT5V7N5H.js} +5219 -7032
- package/dist/chunk-KT5V7N5H.js.map +1 -0
- package/dist/chunk-NLIVWBNV.js +91 -0
- package/dist/chunk-NLIVWBNV.js.map +1 -0
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/issue-runner-6VFNHYJL.js +13 -0
- package/dist/issue-state-machine-NSDN4MV4.js +39 -0
- package/dist/mcp/server.js +6 -13
- package/dist/mcp/server.js.map +1 -1
- package/dist/{queue-workers-LAYOT4E5.js → queue-workers-VHYQYYLG.js} +3 -4
- package/dist/queue-workers-VHYQYYLG.js.map +1 -0
- package/dist/store-FH7L6KR2.js +56 -0
- package/dist/store-FH7L6KR2.js.map +1 -0
- package/package.json +1 -1
- package/FIFONY.md +0 -173
- package/app/dist/assets/KeyboardShortcutsHelp-DFstgyXD.js +0 -1
- package/app/dist/assets/OnboardingWizard-Daehu2Uj.js +0 -1
- package/app/dist/assets/analytics.lazy-C1-iSRM_.js +0 -1
- package/app/dist/assets/index-DbIrs0MK.css +0 -1
- package/app/dist/assets/index-O_FDwkw6.js +0 -43
- package/dist/chunk-F6JEQIP2.js +0 -449
- package/dist/chunk-F6JEQIP2.js.map +0 -1
- package/dist/chunk-O665NS5E.js.map +0 -1
- package/dist/chunk-VP6TGOMT.js.map +0 -1
- package/dist/issue-runner-MDCJ4G26.js +0 -11
- package/src/fixtures/agent-catalog.json +0 -208
- package/src/fixtures/skill-catalog.json +0 -67
- /package/dist/{issue-runner-MDCJ4G26.js.map → issue-runner-6VFNHYJL.js.map} +0 -0
- /package/dist/{queue-workers-LAYOT4E5.js.map → issue-state-machine-NSDN4MV4.js.map} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KeyboardShortcutsHelp-BB5jLK_E.js","assets/rolldown-runtime-DF2fYuay.js","assets/vendor-BTlTWMUF.js","assets/createLucideIcon-BWC-guQt.js","assets/OnboardingWizard-xyM3Okjv.js","assets/analytics.lazy-CfJXsh6r.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,C as n,D as r,E as i,F as a,I as o,M as s,N as c,O as l,P as u,S as d,T as f,_ as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,j as x,k as S,l as C,m as w,n as T,o as E,p as D,r as O,s as k,t as A,u as j,v as M,w as ee,x as te,y as N}from"./vendor-BTlTWMUF.js";import{t as P}from"./createLucideIcon-BWC-guQt.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)}})();function ne(e){return{onFetch:(t,r)=>{let i=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let r=!1,u=e=>{m(e,()=>t.signal,()=>r=!0)},f=n(t.options,t.fetchOptions),p=async(e,n,i)=>{if(r)return Promise.reject();if(n==null&&e.pages.length)return Promise.resolve(e);let a=await f((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})()),{maxPages:o}=t.options,s=i?d:te;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,n,o)}};if(a&&o.length){let e=a===`backward`,t=e?ie:re,n={pages:o,pageParams:s};c=await p(n,t(i,n),e)}else{let t=e??o.length;do{let e=l===0?s[0]??i.initialPageParam:re(i,c);if(l>0&&e==null)break;c=await p(c,e),l++}while(l<t)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function re(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ie(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ae=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new v({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=oe(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=oe(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=oe(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=oe(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){N.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>r(t,e))}findAll(e={}){return this.getAll().filter(t=>r(e,t))}notify(e){N.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return N.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function oe(e){return e.options.scope?.id}var se=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,a=t.queryHash??i(r,t),o=this.get(a);return o||(o=new p({client:e,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){N.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>l(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>l(e,t)):t}notify(e){N.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){N.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){N.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},F=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new se,this.#t=e.mutationCache||new ae,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=c.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=M.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(x(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return N.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;N.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return N.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=N.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(S).catch(S)}invalidateQueries(e,t={}){return N.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=N.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(S)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(S)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(x(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}fetchInfiniteQuery(e){return e.behavior=ne(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e.behavior=ne(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return M.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(f(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let n=[...this.#r.values()],r={};return n.forEach(n=>{t(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(f(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let n=[...this.#i.values()],r={};return n.forEach(n=>{t(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=i(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===s&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},I=a(),L=e(o(),1);function ce(e){try{return JSON.parse(e)}catch{return null}}var le=Intl.DateTimeFormat().resolvedOptions().timeZone,ue=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZone:le}),de=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`,style:`long`});function fe(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:ue.format(t)}function R(e){if(!e)return`-`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`-`;let n=t.getTime()-Date.now(),r=Math.abs(n);return r<5e3?`just now`:r<6e4?de.format(Math.round(n/1e3),`second`):r<36e5?de.format(Math.round(n/6e4),`minute`):r<864e5?de.format(Math.round(n/36e5),`hour`):r<2592e6?de.format(Math.round(n/864e5),`day`):de.format(Math.round(n/2592e6),`month`)}function z(e){return!e&&e!==0?`-`:e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`:`${Math.floor(e/36e5)}h ${Math.floor(e%36e5/6e4)}m`}function pe(e,t=14){let n=new Map((e||[]).filter(e=>e.date).map(e=>[e.date,e])),r=[];for(let e=t-1;e>=0;e--){let t=new Date;t.setDate(t.getDate()-e);let i=t.toISOString().slice(0,10);r.push(n.get(i)??{date:i,totalTokens:0,inputTokens:0,outputTokens:0,events:0})}return r}var me=[`Planning`,`Planned`,`Queued`,`Running`,`Reviewing`,`Reviewed`,`Blocked`,`Done`,`Cancelled`],he={Planning:[`Planned`,`Cancelled`],Planned:[`Queued`,`Planning`,`Cancelled`],Queued:[`Running`],Running:[`Reviewing`,`Queued`,`Blocked`],Reviewing:[`Reviewed`,`Queued`,`Blocked`],Reviewed:[`Done`,`Queued`,`Planning`,`Cancelled`],Blocked:[`Queued`,`Planning`,`Cancelled`],Done:[`Planning`],Cancelled:[`Planning`]};function B(e){return Array.isArray(he[e])?[e,...he[e].filter(t=>t!==e)]:me}function ge(e,t){if(!e)return`HTTP ${t}`;let n=e.error;return typeof n==`string`?n:n&&typeof n==`object`?n.message||n.code||JSON.stringify(n):e.message||`HTTP ${t}`}var V={async get(e){let t=await fetch(`/api${e}`,{headers:{Accept:`application/json`}}),n=await t.text(),r=n?ce(n):null;if(!t.ok)throw Error(ge(r,t.status));return r||{ok:!0}},async post(e,t){let n=await fetch(`/api${e}`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.text(),i=r?ce(r):null;if(!n.ok)throw Error(ge(i,n.status));return i||{ok:!0}}};function _e(e,t=[],n=[]){let r=new Map(e.map(e=>[e.id,e]));for(let e of n)r.delete(e);for(let e of t)e?.id&&r.set(e.id,e);return[...r.values()]}function ve(e,t){let n=e&&typeof e==`object`?{...e}:{},r={...n,...t};return Array.isArray(t.issues)?r.issues=t.issues:Array.isArray(t.issuesDelta)&&(r.issues=_e(Array.isArray(n.issues)?n.issues:[],t.issuesDelta,t.issuesRemoved||[])),Array.isArray(t.events)&&(r.events=t.events),r}function ye(e){let[t,n]=(0,L.useState)(`disconnected`),r=w();return(0,L.useEffect)(()=>{let t=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/ws`,i=null,a=null,o=!0,s=2e3,c=3e4,l=()=>{try{i=new WebSocket(t)}catch{n(`error`),a=setTimeout(l,s),s=Math.min(s*2,c);return}n(`connecting`),i.onopen=()=>{n(`connected`),s=2e3},i.onmessage=t=>{let n=ce(t.data);n&&(r.setQueriesData({queryKey:[`runtime-state`]},e=>ve(e||{},n)),e&&e(n))},i.onclose=()=>{n(`disconnected`),o&&(a=setTimeout(l,s),s=Math.min(s*2,c))},i.onerror=()=>{n(`error`)}};return l(),()=>{o=!1,clearTimeout(a),i?.close()}},[r,e]),t}function be({pollInterval:e=3e3,showAll:t=!1}={}){return _({queryKey:[`runtime-state`,t],queryFn:()=>V.get(t?`/state?all=1`:`/state`),refetchInterval:e})}function xe(e,t,n=2500){let r=new URLSearchParams;return e&&e!==`all`&&r.set(`kind`,e),t&&t!==`all`&&r.set(`issueId`,t),_({queryKey:[`runtime-events`,e,t],queryFn:()=>V.get(`/events/feed${r.size?`?${r}`:``}`),refetchInterval:n})}function Se(){return _({queryKey:[`providers`],queryFn:()=>V.get(`/providers`),refetchInterval:15e3})}function Ce(){return _({queryKey:[`parallelism`],queryFn:()=>V.get(`/parallelism`),refetchInterval:15e3})}function we(){return _({queryKey:[`providers-usage`],queryFn:()=>V.get(`/providers/usage`),refetchInterval:3e4})}var Te=[`auto`,`light`,`dark`],Ee=`cupcake.bumblebee.emerald.corporate.synthwave.retro.cyberpunk.valentine.halloween.garden.forest.aqua.lofi.pastel.fantasy.wireframe.black.luxury.dracula.cmyk.autumn.business.acid.lemonade.night.coffee.winter.dim.nord.sunset.caramellatte.abyss.silk`.split(`.`),De=[...Te,...Ee],H=[`settings`],Oe=`ui.theme`,ke=`ui.notifications.enabled`,Ae=`ui.issues.stateFilter`,je=`ui.issues.categoryFilter`,Me=`ui.issues.completionFilter`,Ne=`ui.events.kind`,Pe=`ui.events.issueId`,Fe=window.matchMedia(`(prefers-color-scheme: dark)`);function Ie(e){return e===`auto`?Fe.matches?`dark`:`light`:e}function Le(e){return De.includes(e)?e:`auto`}function Re(e,t=!1){return typeof e==`boolean`?e:t}function ze(e){return Array.isArray(e?.settings)?e.settings:[]}function Be(e,t,n){return(Array.isArray(e)?e.find(e=>e?.id===t):null)?.value??n}function Ve(e,t){let n=e&&typeof e==`object`?e:{},r=ze(n).filter(e=>e?.id!==t.id);return{...n,settings:[...r,t]}}async function He(e,t){return V.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:t,source:`user`})}function Ue(){return _({queryKey:H,queryFn:()=>V.get(`/settings`),staleTime:3e4})}function We(e,t,n={}){let r=w(),i=Ue(),a=typeof n.normalize==`function`?n.normalize:e=>e,o=a(Be(ze(i.data),e,t)),[s,c]=(0,L.useState)(o),l=(0,L.useCallback)(t=>{let n=a(t);c(n);let i={id:e,scope:`ui`,value:n,source:`user`,updatedAt:new Date().toISOString()};r.cancelQueries({queryKey:H}),r.setQueryData(H,e=>Ve(e,i)),V.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:n,source:`user`}).then(e=>{e?.setting&&r.setQueryData(H,t=>Ve(t,e.setting))}).catch(()=>{r.invalidateQueries({queryKey:H})})},[a,r,e]);return(0,L.useEffect)(()=>{c(e=>Object.is(e,o)?e:o)},[o]),[s,l]}function Ge(){let e=w(),t=Le(Be(ze(Ue().data),Oe,`auto`)),[n,r]=(0,L.useState)(t),i=(0,L.useCallback)(t=>{let n=Le(t);r(n);let i={id:Oe,scope:`ui`,value:n,source:`user`,updatedAt:new Date().toISOString()};e.cancelQueries({queryKey:H}),e.setQueryData(H,e=>Ve(e,i)),V.post(`/settings/${encodeURIComponent(Oe)}`,{scope:`ui`,value:n,source:`user`}).then(t=>{t?.setting&&e.setQueryData(H,e=>Ve(e,t.setting))}).catch(()=>{e.invalidateQueries({queryKey:H})})},[e]);return(0,L.useEffect)(()=>{r(e=>e===t?e:t)},[t]),(0,L.useEffect)(()=>{let e=()=>{let e=document.documentElement;return e.classList.add(`theme-transitioning`),e.setAttribute(`data-theme`,Ie(n)),setTimeout(()=>e.classList.remove(`theme-transitioning`),350)},t=e();if(n===`auto`){let n=()=>e();return Fe.addEventListener(`change`,n),()=>{clearTimeout(t),Fe.removeEventListener(`change`,n)}}return()=>clearTimeout(t)},[n]),[n,i]}function Ke(){return We(ke,!1,{normalize:e=>Re(e,!1)})}function qe(){return _({queryKey:[`token-analytics`],queryFn:()=>V.get(`/analytics/tokens`),refetchInterval:1e4})}function Je({pollInterval:e=3e4}={}){return _({queryKey:[`analytics-lines`],queryFn:()=>V.get(`/analytics/lines`),refetchInterval:e})}function Ye({pollInterval:e=3e4}={}){return _({queryKey:[`analytics-kpis`],queryFn:()=>V.get(`/analytics/kpis`),refetchInterval:e})}function Xe(){let[e,t]=(0,L.useState)(()=>navigator.onLine),[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(()=>window.matchMedia(`(display-mode: standalone)`).matches||window.navigator.standalone===!0);(0,L.useEffect)(()=>{let e=()=>t(!0),n=()=>t(!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,n),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,n)}},[]),(0,L.useEffect)(()=>{let e=window.matchMedia(`(display-mode: standalone)`),t=e=>{e.preventDefault(),r(e),a(!0)},n=()=>{r(null),a(!1),l(!0)},i=()=>{l(e.matches||window.navigator.standalone===!0)};return window.__fifonyInstallPrompt&&(r(window.__fifonyInstallPrompt),a(!0),window.__fifonyInstallPrompt=null),window.addEventListener(`beforeinstallprompt`,t),window.addEventListener(`appinstalled`,n),e.addEventListener(`change`,i),()=>{window.removeEventListener(`beforeinstallprompt`,t),window.removeEventListener(`appinstalled`,n),e.removeEventListener(`change`,i)}},[]),(0,L.useEffect)(()=>{if(!(`serviceWorker`in navigator))return;let e=!1,t=e=>{e&&(e.waiting&&navigator.serviceWorker.controller&&s(!0),e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&navigator.serviceWorker.controller&&s(!0)})}))},n=()=>{e||(e=!0,window.location.reload())};return navigator.serviceWorker.addEventListener(`controllerchange`,n),navigator.serviceWorker.getRegistration().then(t).catch(()=>{}),()=>{navigator.serviceWorker.removeEventListener(`controllerchange`,n)}},[]);let u=(0,L.useCallback)(async()=>!n||(await n.prompt(),(await n.userChoice)?.outcome!==`accepted`)?!1:(r(null),a(!1),!0),[n]),d=(0,L.useCallback)(async()=>{if(!(`serviceWorker`in navigator))return!1;let e=await navigator.serviceWorker.getRegistration();return e?.waiting?(e.waiting.postMessage({type:`SKIP_WAITING`}),!0):!1},[]);return{isOnline:e,canInstall:i&&!c,isInstalled:c,updateAvailable:o,serviceWorkerSupported:`serviceWorker`in navigator,installApp:u,applyUpdate:d}}var Ze=`ui.notifications.events.`,Qe=[1e4,5e4,1e5,5e5,1e6],$e=[{id:`running`,state:`Running`,label:`Agent started`,description:`When an agent begins executing an issue.`,icon:`play`,sound:!1,defaultEnabled:!0,group:`execution`},{id:`queued`,state:`Queued`,label:`Issue queued`,description:`When an issue enters the execution queue.`,icon:`clock`,sound:!1,defaultEnabled:!1,group:`execution`},{id:`reviewing`,state:`Reviewing`,label:`Review started`,description:`When an agent begins reviewing changes.`,icon:`eye`,sound:!1,defaultEnabled:!0,group:`review`},{id:`reviewed`,state:`Reviewed`,label:`Review complete`,description:`When the review step finishes.`,icon:`eye`,sound:!1,defaultEnabled:!0,group:`review`},{id:`done`,state:`Done`,label:`Issue completed`,description:`When an issue is fully done.`,icon:`check`,sound:!0,defaultEnabled:!0,group:`lifecycle`},{id:`blocked`,state:`Blocked`,label:`Issue blocked`,description:`When an agent gets stuck and needs attention.`,icon:`alert`,sound:!0,defaultEnabled:!0,group:`lifecycle`},{id:`cancelled`,state:`Cancelled`,label:`Issue cancelled`,description:`When an issue is cancelled after failures.`,icon:`x`,sound:!1,defaultEnabled:!0,group:`lifecycle`},{id:`token-milestone`,state:`token-milestone`,label:`Token milestone`,description:`When token usage crosses 10K, 50K, 100K, 500K, or 1M.`,icon:`zap`,sound:!1,defaultEnabled:!0,group:`usage`}],et=[{id:`execution`,label:`Execution`},{id:`review`,label:`Review`},{id:`lifecycle`,label:`Lifecycle`},{id:`usage`,label:`Usage`}],tt=new Map($e.map(e=>[e.state,e]));function nt(e){return tt.get(e)??null}function rt(e){return`${Ze}${e}`}function it(e,t){let n=tt.get(t);if(!n)return!1;let r=rt(n.id);return(Array.isArray(e)?e.find(e=>e?.id===r):null)?.value??n.defaultEnabled}function at(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function ot(){return`Notification`in window?Notification.permission:`unsupported`}function st(e,t,n){if(ot()===`granted`)try{new Notification(e,{body:t,tag:`fifony-${n}`,icon:`/icon.svg`,badge:`/icon.svg`,silent:!1})}catch{}}var ct=null;function lt(){if(!ct)try{ct=new(window.AudioContext||window.webkitAudioContext)}catch{return null}return ct}var ut=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;function dt(e){if(!e||ut)return;let t=lt();if(!t)return;let n=t.currentTime,r=.08,i=t.createOscillator(),a=t.createGain();i.type=`sine`,i.frequency.value=880,a.gain.setValueAtTime(r,n),a.gain.exponentialRampToValueAtTime(.001,n+.06),i.connect(a),a.connect(t.destination),i.start(n),i.stop(n+.06);let o=t.createOscillator(),s=t.createGain();o.type=`sine`,o.frequency.value=1100,s.gain.setValueAtTime(0,n),s.gain.setValueAtTime(r,n+.07),s.gain.exponentialRampToValueAtTime(.001,n+.15),o.connect(s),s.connect(t.destination),o.start(n+.07),o.stop(n+.15)}var ft=0;function pt(){let[e,t]=(0,L.useState)([]),[n,r]=(0,L.useState)(0),i=(0,L.useCallback)(e=>{let n=++ft,i={id:n,...e,timestamp:Date.now(),read:!1};return t(e=>[i,...e].slice(0,30)),r(e=>e+1),n},[]),a=(0,L.useCallback)(e=>{t(t=>{let n=t.find(t=>t.id===e);return n&&!n.read&&r(e=>Math.max(0,e-1)),t.filter(t=>t.id!==e)})},[]),o=(0,L.useCallback)(()=>{t(e=>e.map(e=>e.read?e:{...e,read:!0})),r(0)},[]);return(0,L.useEffect)(()=>{let e=setInterval(()=>{let e=Date.now()-300*1e3;t(t=>t.filter(t=>!t.read||t.timestamp>e))},3e4);return()=>clearInterval(e)},[]),{notifications:e,unreadCount:n,addNotification:i,dismissNotification:a,markAllRead:o}}function mt(e){let[t,n]=Ke(),[r,i]=(0,L.useState)(ot),a=(0,L.useRef)(new Map),o=(0,L.useRef)(new Map),s=pt(),c=ze(Ue().data),l=w(),u=(0,L.useCallback)(e=>{n(e)},[n]),d=(0,L.useCallback)(async()=>{if(!(`Notification`in window))return`unsupported`;let e=await Notification.requestPermission();return i(e),e===`granted`&&u(!0),e},[u]),f=$e.map(e=>({...e,enabled:it(c,e.state),settingId:rt(e.id)})),p=(0,L.useCallback)(async(e,t)=>{await He(rt(e),t),l.invalidateQueries({queryKey:[`settings`]})},[l]);return(0,L.useEffect)(()=>{if(!t||r!==`granted`||!Array.isArray(e))return;let n=a.current,i=new Map;for(let r of e){i.set(r.id,r.state);let e=n.get(r.id);if(e&&e!==r.state){let e=nt(r.state);if(e&&it(c,r.state)){let n=`${e.label}: ${r.identifier}`,i=r.title;st(n,i,`${e.id}-${r.id}`),s.addNotification({title:n,body:i,state:r.state,icon:e.icon,issueId:r.id}),e.sound&&dt(t)}}let a=r.tokenUsage?.totalTokens;if(typeof a==`number`&&a>0){o.current.has(r.id)||o.current.set(r.id,new Set);let e=o.current.get(r.id);for(let t of Qe)if(a>=t&&!e.has(t)&&(e.add(t),n.size>0&&nt(`token-milestone`)&&it(c,`token-milestone`))){let e=at(t),n=`Token milestone: ${e}`,i=`${r.identifier} has used ${e} tokens`;st(n,i,`tokens-${t}-${r.id}`),s.addNotification({title:n,body:i,state:`token-milestone`,icon:`zap`,issueId:r.id})}}}a.current=i},[e,t,r,c,s.addNotification]),{enabled:t,setEnabled:u,permission:r,supported:`Notification`in window,requestPermission:d,eventSettings:f,setEventEnabled:p,...s}}var ht=`system.projectName`,gt=[`runtime.projectName`,`ui.projectName`,`projectName`,`project.name`];function _t(e){return typeof e==`string`?e.trim().replace(/\s+/g,` `):``}function vt(e){let t=typeof e==`string`?e.trim().replace(/[\\/]+$/,``):``;return t?_t(t.split(/[\\/]+/).filter(Boolean).at(-1)||``):``}function yt(e){let t=[ht,...gt],n=Array.isArray(e)?e:[];for(let e of t){let t=_t(n.find(t=>t?.id===e)?.value);if(t)return t}return``}function bt(e){let t=_t(e);return t?`fifony: ${t}`:`fifony`}function xt({savedProjectName:e=``,detectedProjectName:t=``}={}){let n=_t(e),r=_t(t),i=n||r;return{projectName:i,detectedProjectName:r,source:n?`saved`:r?`detected`:`missing`,requiresManualEntry:!i}}function St(e,t={}){let n=yt(e),r=_t(t?.detectedProjectName)||vt(t?.sourceRepoUrl||t?.config?.sourceRepo||``),i=_t(t?.projectName),a=t?.projectNameSource,o=xt({savedProjectName:n,detectedProjectName:r}),s=o.projectName||i,c=o.source===`missing`?a===`saved`||a===`detected`?a:s?`detected`:`missing`:o.source;return{projectName:s,detectedProjectName:o.detectedProjectName,source:c,queueTitle:bt(s)}}var U=y(),Ct=(0,L.createContext)(null),wt=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],Tt=new Set([`recent`,`all`]);function Et(){let e=(0,L.useContext)(Ct);if(!e)throw Error(`useDashboard must be used within DashboardProvider`);return e}function Dt({children:e}){let t=Ue(),[n,r]=Ge(),[i,a]=We(Ae,`all`,{normalize:e=>e===`all`||me.includes(e)?e:`all`}),[o,s]=We(je,`all`,{normalize:e=>typeof e==`string`&&e.trim()?e:`all`}),[c,l]=We(Me,`recent`,{normalize:e=>Tt.has(e)?e:`recent`}),[u,d]=(0,L.useState)(``),[f,p]=We(Ne,`all`,{normalize:e=>wt.includes(e)?e:`all`}),[m,h]=We(Pe,`all`,{normalize:e=>typeof e==`string`&&e.trim()?e:`all`}),[_,v]=(0,L.useState)(`3`),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(!1),[C,T]=(0,L.useState)(null),[E,D]=(0,L.useState)(!1),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(!1),[M,ee]=(0,L.useState)([]),te=Xe(),N=w(),P=ye((0,L.useCallback)(e=>{Array.isArray(e?.events)&&ee(e.events)},[])),ne=P===`connected`,re=be({pollInterval:3e3,showAll:c===`all`}),ie=xe(f,m,ne?3e3:2500),ae=Se(),oe=Ce(),se=we(),F=re.data||{},I=Array.isArray(F.issues)?F.issues:[],ce=F.metrics||{},le=(0,L.useMemo)(()=>St(ze(t.data),F),[t.data,F]),ue=ne||F.config?`ok`:`offline`,de=ne?M:ie.data?.events||[],fe=(0,L.useMemo)(()=>O&&I.find(e=>e.id===O)||null,[O,I]),R=(0,L.useCallback)(e=>{k(e?.id||null)},[]),z=(0,L.useMemo)(()=>{let e=u.toLowerCase();return I.filter(t=>!(i!==`all`&&t.state!==i||o!==`all`&&(t.capabilityCategory||`default`)!==o||e&&!`${t.identifier} ${t.title} ${t.description||``}`.toLowerCase().includes(e)))},[I,i,o,u]),pe=(0,L.useMemo)(()=>[`all`,...[...new Set(I.map(e=>e.capabilityCategory).filter(Boolean))].sort()],[I]),he=(0,L.useMemo)(()=>[...new Set(I.map(e=>e.id))].sort(),[I]);(0,L.useEffect)(()=>{o!==`all`&&!pe.includes(o)&&s(`all`)},[o,pe,s]),(0,L.useEffect)(()=>{m!==`all`&&!he.includes(m)&&h(`all`)},[m,he,h]);let B=(0,L.useCallback)((e,t=`info`)=>{S(!1),b({message:typeof e==`string`?e:String(e),type:t}),setTimeout(()=>{S(!0),setTimeout(()=>{b(null),S(!1)},250)},3e3)},[]),ge=(0,L.useCallback)((e,t,n)=>{T({x:e??window.innerWidth/2,y:t??window.innerHeight/3,count:n??24})},[]),_e=(0,L.useCallback)(()=>T(null),[]),ve=g({mutationFn:e=>V.post(`/issues/create`,e),onSuccess:e=>{e?.issue&&N.setQueriesData({queryKey:[`runtime-state`]},t=>{if(!t)return t;let n=Array.isArray(t.issues)?t.issues:[];return n.some(t=>t.id===e.issue.id)?t:{...t,issues:[...n,e.issue]}}),N.invalidateQueries({queryKey:[`runtime-state`]}),D(!1),B(`Issue created`,`success`),ge()},onError:e=>B(e.message,`error`)}),Te=g({mutationFn:({id:e,state:t})=>V.post(`/issues/${encodeURIComponent(e)}/state`,{state:t}),onSuccess:()=>{N.invalidateQueries({queryKey:[`runtime-state`]}),B(`State updated`,`success`)},onError:e=>B(e.message,`error`)}),Ee=g({mutationFn:e=>V.post(`/issues/${encodeURIComponent(e)}/retry`),onSuccess:()=>N.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>B(e.message)}),De=g({mutationFn:e=>V.post(`/issues/${encodeURIComponent(e)}/cancel`),onSuccess:()=>N.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>B(e.message)}),H=g({mutationFn:()=>V.post(`/refresh`,{}),onSuccess:()=>N.invalidateQueries(),onError:e=>B(e.message)}),Oe=g({mutationFn:()=>V.post(`/config/concurrency`,{concurrency:parseInt(_,10)}),onSuccess:()=>{N.invalidateQueries({queryKey:[`runtime-state`]}),B(`Concurrency updated`,`success`)},onError:e=>B(e.message,`error`)});(0,L.useEffect)(()=>{F.config?.workerConcurrency&&v(String(F.config.workerConcurrency))},[F.config?.workerConcurrency]);let ke=(0,L.useCallback)(()=>j(e=>!e),[]),Fe=mt(I),Ie=(0,L.useRef)(new Map);(0,L.useEffect)(()=>{let e=Ie.current;for(let t of I){let n=e.get(t.id);if(n&&n!==`Done`&&t.state===`Done`){let e=document.querySelector(`[data-issue-id="${t.id}"]`);if(e){let t=e.getBoundingClientRect();ge(t.left+t.width/2,t.top+t.height/2,12)}else ge(void 0,void 0,12)}}let t=new Map;for(let e of I)t.set(e.id,e.state);Ie.current=t},[I,ge]);let Le=(0,L.useMemo)(()=>({theme:n,setTheme:r,status:ue,wsStatus:P,liveMode:ne,data:F,issues:I,filtered:z,metrics:ce,eventsData:de,providers:ae,parallelism:oe,providersUsage:se,projectName:le.projectName,queueTitle:le.queueTitle,categoryOptions:pe,issueOptions:he,runtime:re,query:u,setQuery:d,stateFilter:i,setStateFilter:a,categoryFilter:o,setCategoryFilter:s,completionFilter:c,setCompletionFilter:l,isEventsOpen:A,toggleEvents:ke,setIsEventsOpen:j,eventKind:f,setEventKind:p,eventIssueId:m,setEventIssueId:h,isCreateOpen:E,setIsCreateOpen:D,createIssue:ve,selectedIssue:fe,setSelectedIssue:R,updateState:(e,t)=>Te.mutate({id:e,state:t}),retryIssue:e=>Ee.mutate(e),cancelIssue:e=>De.mutate(e),refresh:()=>H.mutate(),concurrency:_,setConcurrency:v,saveConcurrency:()=>Oe.mutate(),saveConcPending:Oe.isPending,pwa:te,notifications:Fe,toast:y,toastExiting:x,showToast:B,confetti:C,showConfetti:ge,clearConfetti:_e}),[n,ue,P,ne,F,I,z,ce,de,ae,oe,se,pe,he,re,le,u,i,o,c,A,f,m,E,fe,_,y,x,C,te,Fe,r,d,a,s,l,ke,j,p,h,D,R,v,B,ge,_e,ve,Te,Ee,De,H,Oe]);return(0,U.jsx)(Ct.Provider,{value:Le,children:e})}var Ot=P(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),kt=P(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),At=P(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),jt=P(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Mt=P(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Nt=P(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Pt=P(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),Ft=P(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),It=P(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Lt=P(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Rt=P(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),zt=P(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Bt=P(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Vt=P(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ht=P(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ut=P(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Wt=P(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Gt=P(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Kt=P(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),qt=P(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Jt=P(`circle-user`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`path`,{d:`M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662`,key:`154egf`}]]),Yt=P(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Xt=P(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Zt=P(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),Qt=P(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),$t=P(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),en=P(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),tn=P(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),nn=P(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),rn=P(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),W=P(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),an=P(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),on=P(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),sn=P(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),cn=P(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),ln=P(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),un=P(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),dn=P(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),fn=P(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),G=P(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),pn=P(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),mn=P(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),hn=P(`github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),gn=P(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),_n=P(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),vn=P(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),yn=P(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),bn=P(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),xn=P(`kanban`,[[`path`,{d:`M5 3v14`,key:`9nsxs2`}],[`path`,{d:`M12 3v8`,key:`1h2ygw`}],[`path`,{d:`M19 3v18`,key:`1sk56x`}]]),Sn=P(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),K=P(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Cn=P(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),wn=P(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Tn=P(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),En=P(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),q=P(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Dn=P(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),On=P(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),kn=P(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),An=P(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),jn=P(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Mn=P(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Nn=P(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Pn=P(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Fn=P(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),J=P(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),In=P(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),Ln=P(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Rn=P(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),zn=P(`sliders-vertical`,[[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M12 21v-9`,key:`17s77i`}],[`path`,{d:`M12 8V3`,key:`13r4qs`}],[`path`,{d:`M17 16h4`,key:`h1uq16`}],[`path`,{d:`M19 12V3`,key:`o1uvq1`}],[`path`,{d:`M19 21v-5`,key:`qua636`}],[`path`,{d:`M3 14h4`,key:`bcjad9`}],[`path`,{d:`M5 10V3`,key:`cb8scm`}],[`path`,{d:`M5 21v-7`,key:`1w1uti`}]]),Bn=P(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Vn=P(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Hn=P(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Un=P(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Wn=P(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Gn=P(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Kn=P(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),qn=P(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),Jn=P(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),Yn=P(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),Xn=P(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),Y=P(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Zn=P(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Qn=P(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),$n=P(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),er=P(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),tr=P(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),nr=P(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),rr=P(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),X=P(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Z=P(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),ir={Running:Mn,Queued:Qt,Reviewing:W,Reviewed:W,Done:Wt,Blocked:Y,Cancelled:Yt,"token-milestone":Z},ar={Running:`text-info`,Queued:`text-warning`,Reviewing:`text-accent`,Reviewed:`text-success`,Done:`text-success`,Blocked:`text-error`,Cancelled:`text-base-content/40`,"token-milestone":`text-secondary`},or={Running:`bg-info/8`,Queued:`bg-warning/8`,Reviewing:`bg-accent/8`,Reviewed:`bg-success/8`,Done:`bg-success/8`,Blocked:`bg-error/8`,Cancelled:`bg-base-200`,"token-milestone":`bg-secondary/8`};function sr(){let[e,t]=(0,L.useState)(()=>window.innerWidth<768);return(0,L.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function cr({notif:e,onDismiss:t}){let n=ir[e.state]||Ft,r=ar[e.state]||`text-base-content`,i=e.read?``:or[e.state]||``,a=e.title?.match(/(.*?):\s*(#\S+|[A-Z]+-\d+)$/),o=a?a[1]:e.title,s=a?a[2]:null;return(0,U.jsxs)(`li`,{className:`group relative px-3 py-2.5 transition-colors
|
|
3
|
+
${e.read?`opacity-50`:``}
|
|
4
|
+
${i}
|
|
5
|
+
hover:bg-base-200/60`,role:`menuitem`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 ${r}`,children:(0,U.jsx)(n,{className:`size-4`})}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[s&&(0,U.jsx)(`span`,{className:`font-mono text-[11px] font-semibold opacity-70 shrink-0`,children:s}),(0,U.jsx)(`p`,{className:`text-xs font-medium leading-snug line-clamp-2`,children:o})]}),e.body&&(0,U.jsx)(`p`,{className:`text-xs opacity-50 leading-snug mt-0.5 line-clamp-1`,children:e.body}),(0,U.jsx)(`p`,{className:`text-[10px] opacity-30 mt-1`,children:R(e.timestamp)})]}),!e.read&&(0,U.jsx)(`span`,{className:`size-1.5 rounded-full shrink-0 mt-1.5 ${r.replace(`text-`,`bg-`)}`})]}),(0,U.jsx)(`button`,{className:`absolute top-1.5 right-1.5 btn btn-ghost btn-xs btn-circle
|
|
6
|
+
opacity-0 group-hover:opacity-60 group-focus-within:opacity-60
|
|
7
|
+
hover:!opacity-100 transition-opacity`,onClick:n=>{n.stopPropagation(),t(e.id)},"aria-label":`Dismiss notification`,children:(0,U.jsx)(X,{className:`size-3`})})]})}function lr({notifications:e,onDismiss:t}){return e.length===0?(0,U.jsxs)(`div`,{className:`py-10 text-center`,children:[(0,U.jsx)(Ft,{className:`size-8 mx-auto opacity-10 mb-2`}),(0,U.jsx)(`p`,{className:`text-sm opacity-40`,children:`No notifications yet`}),(0,U.jsx)(`p`,{className:`text-xs opacity-25 mt-0.5`,children:`State changes and milestones will appear here`})]}):(0,U.jsx)(`div`,{className:`max-h-80 overflow-y-auto overscroll-contain max-md:max-h-[60vh]`,children:(0,U.jsx)(`ul`,{children:e.map((e,n)=>(0,U.jsx)(cr,{notif:e,onDismiss:t},e.id))})})}function ur({count:e,onMarkAllRead:t,onClose:n}){return(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-base-300`,children:[(0,U.jsx)(`span`,{className:`text-sm font-semibold`,children:`Notifications`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e>0&&(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,onClick:t,"aria-label":`Mark all as read`,children:[(0,U.jsx)(Bt,{className:`size-3`}),`Mark all read`]}),n&&(0,U.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-circle`,onClick:n,children:(0,U.jsx)(X,{className:`size-4`})})]})]})}function dr({open:e,onClose:t,notifications:n,onDismiss:r,onMarkAllRead:i}){let[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null),c=(0,L.useCallback)(()=>{o(!0),setTimeout(()=>{o(!1),t()},250)},[t]),l=(0,L.useCallback)(e=>{s.current=e.touches[0].clientY},[]),u=(0,L.useCallback)(e=>{s.current!==null&&(e.changedTouches[0].clientY-s.current>80&&c(),s.current=null)},[c]);return!e&&!a?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50
|
|
8
|
+
${a?`animate-toast-out`:`animate-fade-in`}`,onClick:c}),(0,U.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50
|
|
9
|
+
bg-base-100 rounded-t-2xl shadow-2xl
|
|
10
|
+
${a?`animate-slide-down-sheet`:`animate-slide-up-sheet`}`,style:{maxHeight:`70vh`,paddingBottom:`env(safe-area-inset-bottom)`},onClick:e=>e.stopPropagation(),onTouchStart:l,onTouchEnd:u,children:[(0,U.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,U.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,U.jsx)(ur,{count:n.length,onMarkAllRead:i,onClose:c}),(0,U.jsx)(lr,{notifications:n,onDismiss:r})]})]})}function fr({notifications:e,unreadCount:t,onDismiss:n,onMarkAllRead:r}){let[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s=sr(),c=(0,L.useCallback)(()=>a(e=>!e),[]);return(0,L.useEffect)(()=>{if(!i||s)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i,s]),(0,L.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),(0,U.jsxs)(`div`,{className:`relative`,ref:o,children:[(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-sm btn-circle relative`,onClick:c,"aria-label":t>0?`Notifications (${t} unread)`:`Notifications`,"aria-expanded":i,"aria-haspopup":`true`,children:[(0,U.jsx)(Ft,{className:`size-4`}),t>0&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-primary absolute -top-0.5 -right-0.5 animate-count-bump`,children:t>99?`99+`:t})]}),s&&(0,U.jsx)(dr,{open:i,onClose:()=>a(!1),notifications:e,onDismiss:n,onMarkAllRead:r}),!s&&i&&(0,U.jsxs)(`div`,{className:`absolute right-0 top-full mt-2 w-80
|
|
11
|
+
max-w-[calc(100vw-2rem)] bg-base-100 rounded-box
|
|
12
|
+
shadow-xl border border-base-300 z-50 animate-fade-in-scale`,role:`menu`,"aria-label":`Notification center`,children:[(0,U.jsx)(ur,{count:e.length,onMarkAllRead:r}),(0,U.jsx)(lr,{notifications:e,onDismiss:n})]})]})}var pr=[{to:`/kanban`,label:`Kanban`,icon:xn},{to:`/issues`,label:`Issues`,icon:Tn},{to:`/agents`,label:`Agents`,icon:Lt},{to:`/analytics`,label:`Analytics`,icon:Xn},{to:`/settings`,label:`Settings`,icon:zn}];function mr({count:e}){let t=(0,L.useRef)(e),[n,r]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(t.current!==e){t.current=e,r(!0);let n=setTimeout(()=>r(!1),300);return()=>clearTimeout(n)}},[e]),(0,U.jsx)(`span`,{className:`badge badge-xs badge-primary ${n?`animate-count-bump`:``}`,children:e})}function hr({status:e}){return e===`connected`?(0,U.jsxs)(`span`,{className:`relative flex size-2`,children:[(0,U.jsx)(`span`,{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-success opacity-50`}),(0,U.jsx)(`span`,{className:`relative inline-flex rounded-full size-2 bg-success`})]}):e===`connecting`?(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5 dot-pulse-group`,children:[(0,U.jsx)(`span`,{className:`size-1 rounded-full bg-info`}),(0,U.jsx)(`span`,{className:`size-1 rounded-full bg-info`}),(0,U.jsx)(`span`,{className:`size-1 rounded-full bg-info`})]}):(0,U.jsx)(`span`,{className:`size-2 rounded-full bg-warning animate-pulse-soft`})}function gr({navRef:e,currentPath:t}){let[n,r]=(0,L.useState)({left:0,width:0,opacity:0}),i=(0,L.useCallback)(()=>{if(!e.current)return;let t=e.current.querySelector(`a.active`);if(!t){r(e=>({...e,opacity:0}));return}let n=e.current.getBoundingClientRect(),i=t.getBoundingClientRect();r({left:i.left-n.left,width:i.width,opacity:1})},[e]);return(0,L.useLayoutEffect)(i,[t,i]),(0,L.useEffect)(()=>(window.addEventListener(`resize`,i),()=>window.removeEventListener(`resize`,i)),[i]),(0,U.jsx)(`div`,{className:`nav-indicator`,style:n})}function _r(e){if(!e)return null;let t=e.replace(/\/+$/,``).split(`/`).pop();return!t||t===e?e:t}function vr({issueCount:e,sourceRepo:t,queueTitle:n,updatedAt:r,onToggleEvents:i,eventsOpen:a,wsStatus:o,notifications:s,issues:c}){let l=C().location.pathname,u=(0,L.useRef)(null),d=_r(t),f=n||`fifony`,p=d&&f!==bt(d)?d:null;return(0,U.jsxs)(`div`,{className:`navbar bg-base-100 shadow-sm px-4`,children:[(0,U.jsx)(`div`,{className:`flex-1 min-w-0 gap-2`,children:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(k,{to:`/`,className:`btn btn-ghost px-2 text-lg sm:text-xl font-bold tracking-tight max-w-full`,title:f,style:{fontFamily:`'Space Grotesk', system-ui, sans-serif`,letterSpacing:`-0.02em`,fontWeight:800},children:(0,U.jsx)(`span`,{className:`truncate`,children:f})}),p&&(0,U.jsx)(`div`,{className:`text-xs opacity-40 hidden lg:block truncate px-2`,children:p})]})}),(0,U.jsx)(`div`,{className:`flex-none hidden md:flex`,children:(0,U.jsxs)(`div`,{className:`relative`,ref:u,children:[(0,U.jsx)(`ul`,{className:`menu menu-horizontal px-1 gap-1`,children:pr.map(({to:t,label:n,icon:r})=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(k,{to:t,className:`nav-link ${l.startsWith(t)?`active nav-link-active`:``}`,children:[(0,U.jsx)(r,{className:`size-4`}),n,t===`/issues`&&e>0&&(0,U.jsx)(mr,{count:e})]})},t))}),(0,U.jsx)(gr,{navRef:u,currentPath:l})]})}),(0,U.jsx)(`div`,{className:`flex-none`,children:(0,U.jsxs)(`ul`,{className:`menu menu-horizontal px-1 items-center gap-0`,children:[s&&(0,U.jsx)(`li`,{children:(0,U.jsx)(`span`,{className:`py-1 px-2`,children:(0,U.jsx)(fr,{notifications:s.notifications,unreadCount:s.unreadCount,onDismiss:s.dismissNotification,onMarkAllRead:s.markAllRead})})}),(0,U.jsx)(`li`,{children:(0,U.jsx)(`button`,{className:`tooltip tooltip-bottom py-1 px-2 hidden md:flex ${a?`active`:``}`,"data-tip":`Events`,onClick:i,children:(0,U.jsx)(Ot,{className:`size-4`})})}),(0,U.jsx)(`li`,{className:`hidden md:flex`,children:(0,U.jsxs)(`span`,{className:`text-xs opacity-40 py-1 px-2 flex items-center gap-1.5`,children:[(0,U.jsx)(hr,{status:o}),R(r)]})})]})})]})}function yr({onClick:e}){let[t,n]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{let e=setTimeout(()=>n(!0),300);return()=>clearTimeout(e)},[]),(0,U.jsxs)(`button`,{className:`fixed right-6 z-30 btn btn-circle btn-lg btn-primary shadow-lg hover:scale-110 hover:rotate-90 active:scale-95 active:rotate-0 transition-all duration-300 group ${t?`animate-fab-breathe`:`animate-bounce-in`}`,style:{bottom:`calc(env(safe-area-inset-bottom, 0px) + 6rem)`},onClick:e,"aria-label":`Create new issue`,children:[(0,U.jsx)(Nn,{className:`size-6 transition-transform duration-300 group-hover:rotate-90`}),(0,U.jsx)(`span`,{className:`absolute -top-8 right-0 text-xs bg-base-300 text-base-content px-2 py-1 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap shadow-md`,children:`New Issue`})]})}function br({onToggleEvents:e,eventsOpen:t}){let n=C().location.pathname;return(0,U.jsxs)(`div`,{className:`dock md:hidden`,children:[pr.map(({to:e,label:t,icon:r})=>{let i=n.startsWith(e);return(0,U.jsxs)(k,{to:e,className:i?`dock-active`:void 0,children:[(0,U.jsx)(r,{className:`size-[1.2em] transition-transform duration-200 ${i?`scale-110`:``}`}),(0,U.jsx)(`span`,{className:`dock-label`,children:t})]},e)}),(0,U.jsxs)(`button`,{className:t?`dock-active`:void 0,onClick:e,children:[(0,U.jsx)(Ot,{className:`size-[1.2em] transition-transform duration-200 ${t?`scale-110`:``}`}),(0,U.jsx)(`span`,{className:`dock-label`,children:`Events`})]})]})}var xr=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;function Sr({onDismiss:e,direction:t=`right`,threshold:n=80}){let r=(0,L.useRef)(null),i=(0,L.useRef)(null),a=(0,L.useRef)(!1),o=t===`right`||t===`left`,s=t===`right`||t===`down`?1:-1;return{ref:r,handlers:{onTouchStart:(0,L.useCallback)(e=>{if(e.touches.length!==1)return;let n=r.current;if(n&&t===`right`&&n.scrollLeft>0||n&&t===`down`&&n.scrollTop>0)return;let o=e.touches[0];i.current={x:o.clientX,y:o.clientY},a.current=!1},[t]),onTouchMove:(0,L.useCallback)(e=>{if(!i.current)return;let t=e.touches[0],n=t.clientX-i.current.x,c=t.clientY-i.current.y,l=o?n*s:c*s,u=Math.abs(o?c:n);if(!a.current&&u>Math.abs(o?n:c)){i.current=null;return}if(!a.current){if(l<10)return;a.current=!0}let d=Math.max(0,l),f=r.current;if(!f||xr)return;let p=o?`translateX`:`translateY`;f.style.transform=`${p}(${d}px)`,f.style.opacity=String(Math.max(.3,1-d/300)),f.style.transition=`none`},[o,s]),onTouchEnd:(0,L.useCallback)(()=>{if(!i.current)return;let t=r.current;if(i.current=null,!t){a.current=!1;return}let s=t.style.transform.match(/([-\d.]+)px/);if((s?parseFloat(s[1]):0)>n){let n=o?`translateX`:`translateY`;t.style.transition=`transform 0.2s ease-out, opacity 0.2s ease-out`,t.style.transform=`${n}(100%)`,t.style.opacity=`0`,setTimeout(()=>e(),200)}else t.style.transition=`transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.3s ease`,t.style.transform=``,t.style.opacity=``;a.current=!1},[n,o,e])}}}var Cr=[{id:`blank`,label:`Blank`,icon:on,activeColor:`border-base-content/30 bg-base-content/5 text-base-content`,title:``,description:``},{id:`bug`,label:`Bug Fix`,icon:Rt,activeColor:`border-error/50 bg-error/8 text-error`,title:`fix: `,description:`## Problem
|
|
13
|
+
|
|
14
|
+
## Expected Behavior
|
|
15
|
+
|
|
16
|
+
## Steps to Reproduce
|
|
17
|
+
|
|
18
|
+
`},{id:`feature`,label:`Feature`,icon:Vn,activeColor:`border-primary/50 bg-primary/8 text-primary`,title:`feat: `,description:`## Goal
|
|
19
|
+
|
|
20
|
+
## Acceptance Criteria
|
|
21
|
+
|
|
22
|
+
## Notes
|
|
23
|
+
|
|
24
|
+
`},{id:`refactor`,label:`Refactor`,icon:Fn,activeColor:`border-warning/50 bg-warning/8 text-warning`,title:`refactor: `,description:`## Current State
|
|
25
|
+
|
|
26
|
+
## Desired State
|
|
27
|
+
|
|
28
|
+
## Scope
|
|
29
|
+
|
|
30
|
+
`},{id:`docs`,label:`Docs`,icon:It,activeColor:`border-info/50 bg-info/8 text-info`,title:`docs: `,description:`## What to Document
|
|
31
|
+
|
|
32
|
+
## Target Audience
|
|
33
|
+
|
|
34
|
+
`},{id:`chore`,label:`Chore`,icon:rr,activeColor:`border-secondary/50 bg-secondary/8 text-secondary`,title:`chore: `,description:`## Task
|
|
35
|
+
|
|
36
|
+
## Why Now
|
|
37
|
+
|
|
38
|
+
`}];function wr({open:e,onClose:t,onSubmit:n,isLoading:r,onToast:i}){let[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(`blank`),[d,f]=(0,L.useState)({title:!1,description:!1}),[p,m]=(0,L.useState)([]),[h,g]=(0,L.useState)(!1),_=(0,L.useRef)(null),v=(0,L.useRef)(null),y=(0,L.useRef)(null),b=(0,L.useCallback)(e=>{let t=Cr.find(t=>t.id===e);t&&(u(e),o(t.title),c(t.description),setTimeout(()=>_.current?.focus(),50))},[]),{ref:x,handlers:S}=Sr({onDismiss:(0,L.useCallback)(()=>t(),[t]),direction:`right`});(0,L.useEffect)(()=>{e&&(o(``),c(``),u(`blank`),m([]),setTimeout(()=>_.current?.focus(),100))},[e]),(0,L.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let C=(0,L.useCallback)(async e=>{if(e.length){g(!0);try{let t=await Promise.all(e.map(e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t({name:e.name,data:r.result.split(`,`)[1],type:e.type,preview:r.result}),r.onerror=n,r.readAsDataURL(e)}))),n=await V.post(`/attachments/upload`,{files:t.map(({name:e,data:t,type:n})=>({name:e,data:t,type:n}))});if(n.ok&&n.paths){let r=n.paths.map((n,r)=>({name:e[r]?.name??n,preview:t[r]?.preview,path:n}));m(e=>[...e,...r])}else i?.(n.error||`Upload failed`,`error`)}catch{i?.(`Upload failed`,`error`)}finally{g(!1),y.current&&(y.current.value=``)}}},[i]);(0,L.useEffect)(()=>{if(!e)return;let t=e=>{let t=Array.from(e.clipboardData?.items??[]).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(Boolean);t.length&&C(t)};return window.addEventListener(`paste`,t),()=>window.removeEventListener(`paste`,t)},[e,C]);let w=e=>C(Array.from(e.target.files??[])),T=e=>{e.preventDefault(),a.trim()&&n({title:a.trim(),description:s.trim(),issueType:l===`blank`?void 0:l,images:p.map(e=>e.path)})},E=async e=>{if(!(!a.trim()&&e===`description`)){f(t=>({...t,[e]:!0}));try{let t=await V.post(`/issues/enhance`,{field:e,title:a.trim(),description:s.trim(),issueType:l,images:p.map(e=>e.path)});if(t.ok&&typeof t.value==`string`&&t.value.trim())e===`title`?o(t.value.trim()):c(t.value.trim()),i?.(`Enhanced ${e}`,`success`);else throw Error(t.error||`No enhanced value returned.`)}catch(e){i?.(e instanceof Error?e.message:`Enhance failed`,`error`)}finally{f(t=>({...t,[e]:!1}))}}};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-40 transition-opacity duration-200 ${e?`opacity-100`:`opacity-0 pointer-events-none`}`,onClick:t}),(0,U.jsx)(`div`,{ref:x,className:`fixed top-0 right-0 h-full z-50 bg-base-100 shadow-2xl transition-transform duration-300 ease-out
|
|
39
|
+
w-full md:w-[480px] ${e?`translate-x-0`:`translate-x-full`}`,...S,children:(0,U.jsxs)(`form`,{onSubmit:T,className:`flex flex-col h-full`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-base-300`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(K,{className:`size-5 opacity-60`}),(0,U.jsx)(`h2`,{className:`text-lg font-bold`,children:`New Issue`})]}),(0,U.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,U.jsx)(X,{className:`size-4`})})]}),(0,U.jsxs)(`div`,{ref:v,className:`flex-1 overflow-y-auto px-6 py-6 flex flex-col gap-4 drawer-safe-bottom ${e?`stagger-children`:``}`,children:[(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-1.5`,children:Cr.map(e=>{let t=e.icon;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>b(e.id),className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-left transition-all duration-150 text-sm font-medium ${l===e.id?e.activeColor:`border-base-300 text-base-content/50 hover:border-base-content/20 hover:text-base-content/70 hover:bg-base-200/50`}`,children:[(0,U.jsx)(t,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id)})}),(0,U.jsxs)(`div`,{className:`form-control`,children:[(0,U.jsxs)(`label`,{className:`label justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`label-text font-medium`,children:`What needs to be done?`}),(0,U.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-secondary gap-1`,onClick:()=>E(`title`),disabled:d.title||r||!a.trim(),children:[d.title?(0,U.jsx)(En,{className:`size-3 animate-spin`}):(0,U.jsx)(Vn,{className:`size-3`}),`Enhance`]})]}),(0,U.jsx)(`input`,{ref:_,className:`input input-bordered w-full`,placeholder:`Fix the login redirect bug`,value:a,onChange:e=>o(e.target.value),required:!0})]}),(0,U.jsxs)(`div`,{className:`form-control flex-1 flex flex-col min-h-0`,children:[(0,U.jsxs)(`label`,{className:`label justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`label-text font-medium`,children:`Context & details`}),(0,U.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-secondary gap-1`,onClick:()=>E(`description`),disabled:d.description||r||!a.trim(),children:[d.description?(0,U.jsx)(En,{className:`size-3 animate-spin`}):(0,U.jsx)(Vn,{className:`size-3`}),`Enhance`]})]}),(0,U.jsx)(`textarea`,{className:`textarea textarea-bordered w-full flex-1 min-h-40 resize-none`,placeholder:`Describe the problem, expected behavior, acceptance criteria...`,value:s,onChange:e=>c(e.target.value)})]}),(0,U.jsxs)(`div`,{className:`form-control`,children:[(0,U.jsxs)(`label`,{className:`label justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`label-text font-medium`,children:`Screenshots & Evidence`}),(0,U.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-ghost gap-1`,onClick:()=>y.current?.click(),disabled:h,children:[h?(0,U.jsx)(En,{className:`size-3 animate-spin`}):(0,U.jsx)(jn,{className:`size-3`}),`Attach`]})]}),(0,U.jsx)(`input`,{ref:y,type:`file`,multiple:!0,accept:`image/*`,className:`hidden`,onChange:w}),p.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-1`,children:p.map((e,t)=>(0,U.jsxs)(`div`,{className:`relative group`,children:[e.preview?(0,U.jsx)(`img`,{src:e.preview,alt:e.name,className:`size-16 object-cover rounded-lg border border-base-300`}):(0,U.jsx)(`div`,{className:`size-16 rounded-lg border border-base-300 bg-base-200 flex items-center justify-center`,children:(0,U.jsx)(vn,{className:`size-5 opacity-40`})}),(0,U.jsx)(`button`,{type:`button`,className:`absolute -top-1.5 -right-1.5 size-4 rounded-full bg-error text-error-content flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity`,onClick:()=>m(e=>e.filter((e,n)=>n!==t)),children:(0,U.jsx)(X,{className:`size-2.5`})})]},t))})]}),(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 text-xs opacity-60 space-y-1`,children:[(0,U.jsxs)(`p`,{children:[`The issue will be created in `,(0,U.jsx)(`strong`,{children:`Planning`}),` state.`]}),(0,U.jsx)(`p`,{children:`Open it to generate an AI plan, review it, then approve to start execution.`})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-6 py-4 border-t border-base-300 max-sm:flex-col-reverse`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 1rem)`},children:[(0,U.jsx)(`button`,{type:`button`,className:`btn btn-ghost max-sm:w-full`,onClick:t,children:`Cancel`}),(0,U.jsxs)(`button`,{type:`submit`,className:`btn btn-primary gap-1.5 max-sm:w-full`,disabled:r||!a.trim(),children:[r?(0,U.jsx)(En,{className:`size-4 animate-spin`}):(0,U.jsx)(K,{className:`size-4`}),r?`Creating...`:`Create Issue`]})]})]})})]})}var Tr={added:`badge-success`,removed:`badge-error`,modified:`badge-info`};function Er({text:e}){let[t,n]=(0,L.useState)(!1);return(0,U.jsx)(`button`,{className:`btn btn-xs btn-ghost shrink-0`,onClick:(0,L.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},[e]),title:`Copy to clipboard`,children:t?(0,U.jsx)(Vt,{className:`size-3 text-success`}):(0,U.jsx)(tn,{className:`size-3`})})}function Dr({cmd:e}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-1 bg-base-300 rounded px-2 py-1`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs flex-1 select-all`,children:e}),(0,U.jsx)(Er,{text:e})]})}function Or({issue:e,onClose:t}){let n=w(),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!0),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(!1),y=(0,L.useCallback)(async()=>{o(!0),c(null);try{i(await V.get(`/diff/${encodeURIComponent(e.id)}`))}catch(e){c(e.message)}finally{o(!1)}},[e.id]);(0,L.useEffect)(()=>{y()},[y]);let b=(0,L.useCallback)(async()=>{m(!0),g(null);try{await V.post(`/issues/${encodeURIComponent(e.id)}/try`),u(!0)}catch(e){g(e.message)}finally{m(!1)}},[e.id]),x=(0,L.useCallback)(async()=>{m(!0),g(null);try{await V.post(`/issues/${encodeURIComponent(e.id)}/revert-try`),u(!1)}catch(e){g(e.message)}finally{m(!1)}},[e.id]),S=(0,L.useCallback)(async()=>{m(!0),g(null);try{await V.post(`/issues/${encodeURIComponent(e.id)}/merge`),n.invalidateQueries({queryKey:[`runtime-state`]}),t()}catch(e){g(e.message),m(!1)}},[e.id,n,t]),C=(0,L.useCallback)(async()=>{m(!0),g(null);try{await V.post(`/issues/${encodeURIComponent(e.id)}/rollback`),n.invalidateQueries({queryKey:[`runtime-state`]}),t()}catch(e){g(e.message),m(!1)}},[e.id,n,t]),T=e.worktreePath??e.workspacePath??``,E=e.branchName??`fifony/${e.id}`,D=e.baseBranch??`main`,{files:O=[],totalAdditions:k=0,totalDeletions:A=0,message:j}=r??{},M=`git merge --squash ${E}`,ee=`git commit -m "feat: merge ${E}"`,te=`git diff ${D}...${E}`;return(0,U.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/50`,onClick:t,children:(0,U.jsxs)(`div`,{className:`bg-base-100 rounded-box shadow-2xl w-full max-w-lg mx-4 flex flex-col max-h-[90vh]`,onClick:e=>e.stopPropagation(),children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-300 shrink-0`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-40 font-mono`,children:e.identifier}),(0,U.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,U.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-circle shrink-0 ml-3`,onClick:t,"aria-label":`Close`,children:(0,U.jsx)(X,{className:`size-4`})})]}),(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4 min-h-0`,children:[T&&(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box px-3 py-2 flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs opacity-50 shrink-0`,children:`Worktree`}),(0,U.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:T}),(0,U.jsx)(Er,{text:T})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs bg-base-200 px-2 py-0.5 rounded`,children:E}),(0,U.jsx)(G,{className:`size-3.5 opacity-40 shrink-0`}),(0,U.jsx)(`span`,{className:`font-mono text-xs bg-base-200 px-2 py-0.5 rounded`,children:D})]}),l&&(0,U.jsxs)(`div`,{className:`alert alert-info text-xs py-2 gap-1.5`,children:[(0,U.jsx)(sn,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:`Squash test applied to your workspace — your server rebuilt with the changes. Review then accept or revert it.`})]}),a&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-6 justify-center`,children:[(0,U.jsx)(`span`,{className:`loading loading-spinner loading-sm`}),` Loading changes...`]}),s&&!a&&(0,U.jsx)(`div`,{className:`text-sm text-error`,children:s}),r&&!a&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,U.jsxs)(`span`,{className:`opacity-60`,children:[O.length,` file`,O.length===1?``:`s`,` changed`]}),(0,U.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,k]}),(0,U.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,A]})]}),O.length>0?(0,U.jsx)(`div`,{className:`space-y-0.5 max-h-[22vh] overflow-y-auto rounded-box border border-base-300 p-1`,children:O.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded hover:bg-base-200 transition-colors`,children:[(0,U.jsx)(`span`,{className:`badge badge-xs shrink-0 ${Tr[e.status]||`badge-ghost`}`,children:e.status}),(0,U.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:e.path}),(0,U.jsxs)(`span`,{className:`text-xs text-success shrink-0`,children:[`+`,e.additions]}),(0,U.jsxs)(`span`,{className:`text-xs text-error shrink-0`,children:[`-`,e.deletions]})]},e.path))}):(0,U.jsx)(`div`,{className:`text-sm opacity-40 text-center py-4`,children:j||`No changes detected.`})]}),(0,U.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,U.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 text-left text-xs opacity-60 hover:opacity-100 hover:bg-base-200 transition-colors`,onClick:()=>v(e=>!e),children:[(0,U.jsx)(Kn,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1`,children:`Comandos manuais`}),(0,U.jsx)(`span`,{className:`text-[10px] opacity-50`,children:_?`▲`:`▼`})]}),_&&(0,U.jsxs)(`div`,{className:`px-3 pb-3 space-y-2 border-t border-base-300 pt-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Inspect only`}),(0,U.jsx)(Dr,{cmd:te})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Test with hot reload (no commit)`}),(0,U.jsx)(Dr,{cmd:M})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Revert test`}),(0,U.jsx)(Dr,{cmd:`git reset --hard HEAD && git clean -fd`})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Accept manually`}),(0,U.jsx)(Dr,{cmd:ee})]})]})]}),h&&(0,U.jsxs)(`div`,{className:`alert alert-error text-xs py-2 gap-1.5`,children:[(0,U.jsx)(Y,{className:`size-3.5 shrink-0`}),` `,h]}),d&&(0,U.jsxs)(`div`,{className:`border border-base-300 rounded-box p-4 space-y-3 bg-base-200`,children:[d===`merge`?(0,U.jsxs)(`p`,{className:`text-sm`,children:[`You are about to merge into`,` `,(0,U.jsx)(`span`,{className:`font-mono font-semibold`,children:D}),`. The worktree and branch will be removed after merge.`]}):(0,U.jsx)(`p`,{className:`text-sm`,children:`You are about to discard all changes from this issue. The worktree and branch will be removed permanently.`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`button`,{className:`btn btn-sm btn-ghost flex-1`,onClick:()=>f(null),disabled:p,children:`Cancel`}),(0,U.jsx)(`button`,{className:`btn btn-sm flex-1 ${d===`merge`?`btn-success`:`btn-error`}`,onClick:d===`merge`?S:C,disabled:p,children:p?(0,U.jsx)(q,{className:`size-4 animate-spin`}):d===`merge`?`Confirm merge`:`Confirm rollback`})]})]})]}),!d&&(0,U.jsxs)(`div`,{className:`px-5 py-4 border-t border-base-300 shrink-0 space-y-2`,children:[l?(0,U.jsxs)(`button`,{className:`btn btn-sm btn-warning btn-soft gap-1.5 w-full`,onClick:x,disabled:p,title:`git reset --hard HEAD && git clean -fd`,children:[p?(0,U.jsx)(q,{className:`size-3.5 animate-spin`}):(0,U.jsx)(Zn,{className:`size-3.5`}),`Revert Test`]}):(0,U.jsxs)(`button`,{className:`btn btn-sm btn-info btn-soft gap-1.5 w-full`,onClick:b,disabled:p||!e.branchName,title:`Run git merge --squash on your workspace to test with hot reload without committing`,children:[p?(0,U.jsx)(q,{className:`size-3.5 animate-spin`}):(0,U.jsx)(sn,{className:`size-3.5`}),`Test Live`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`button`,{className:`btn btn-sm btn-error btn-soft gap-1.5 flex-1`,onClick:()=>{f(`rollback`),g(null)},disabled:p,children:[(0,U.jsx)(J,{className:`size-3.5`}),` Reject & Rollback`]}),(0,U.jsxs)(`button`,{className:`btn btn-sm btn-success gap-1.5 flex-1`,onClick:()=>{f(`merge`),g(null)},disabled:p,children:[(0,U.jsx)(G,{className:`size-3.5`}),` Approve & Merge`]})]})]})]})})}var kr=`runtime.workflowConfig`;function Ar(e){return!!e&&typeof e==`object`&&typeof e.provider==`string`&&typeof e.model==`string`&&typeof e.effort==`string`}function jr(e){let t=Be(ze(e),kr,null);return!t||typeof t!=`object`?null:Ar(t.plan)&&Ar(t.execute)&&Ar(t.review)?t:null}function Mr(){let e=jr(Ue().data),t=_({queryKey:[`workflow-config`],queryFn:()=>V.get(`/config/workflow`),enabled:!e,staleTime:6e4});return{...t,data:e?{ok:!0,workflow:e,isDefault:!1}:t.data}}var Nr={Planning:K,Planned:Xt,Queued:wn,Running:qt,Reviewing:W,Reviewed:Gt,Blocked:Y,Done:Gt,Cancelled:Yt},Pr={Planning:`text-info`,Planned:`text-warning`,Queued:`text-info`,Running:`text-primary`,Reviewing:`text-secondary`,Reviewed:`text-success`,Blocked:`text-error`,Done:`text-success`,Cancelled:`text-neutral`},Fr={Planning:`btn-info`,Planned:`btn-warning`,Queued:`btn-info`,Running:`btn-primary`,Reviewing:`btn-secondary`,Reviewed:`btn-success`,Blocked:`btn-error`,Done:`btn-success`,Cancelled:`btn-neutral`},Ir={Planning:`bg-info/10 border-info/30`,Planned:`bg-warning/10 border-warning/30`,Queued:`bg-info/10 border-info/30`,Running:`bg-primary/10 border-primary/30`,Reviewing:`bg-secondary/10 border-secondary/30`,Reviewed:`bg-success/10 border-success/30`,Blocked:`bg-error/10 border-error/30`,Done:`bg-success/10 border-success/30`,Cancelled:`bg-neutral/10 border-neutral/30`},Lr={bug:`badge-error`,feature:`badge-primary`,refactor:`badge-warning`,docs:`badge-info`,chore:`badge-secondary`},Rr=[{id:`overview`,label:`Overview`,icon:bn},{id:`execution`,label:`Execution`,icon:Kn},{id:`diff`,label:`Diff`,icon:$t},{id:`routing`,label:`Routing`,icon:In},{id:`history`,label:`Events`,icon:Ot}],zr={id:`planning`,label:`Plan`,icon:K},Br={id:`review`,label:`Review`,icon:Zt};function Vr(e){return e===`Planning`?[zr,...Rr]:e===`Reviewing`||e===`Reviewed`||e===`Done`||e===`Blocked`?[Rr[0],Br,...Rr.slice(1)]:[Rr[0],zr,...Rr.slice(1)]}function Hr(e){return{Planned:0,Queued:1,Running:2,Reviewing:2,Reviewed:3,Blocked:3,Done:4,Cancelled:4}[e]??0}var Ur=[{key:`plan`,label:`Plan`,icon:K,states:[`Planning`]},{key:`execute`,label:`Execute`,icon:qt,states:[`Planned`,`Queued`,`Running`]},{key:`review`,label:`Review`,icon:W,states:[`Reviewing`,`Reviewed`]},{key:`done`,label:`Approved`,icon:Gt,states:[`Done`]},{key:`merge`,label:`Merge`,icon:G,states:[]}];function Wr(e){return e.state===`Cancelled`?-1:e.mergedAt||e.state===`Done`?4:e.state===`Reviewing`||e.state===`Reviewed`?2:[`Running`,`Queued`,`Planned`].includes(e.state)?1:e.state===`Blocked`?e.tokensByPhase?.reviewer?.totalTokens>0?2:1:(e.state,0)}function Gr({issue:e}){let t=Wr(e),n=!!e.mergedAt;if(e.state===`Cancelled`)return null;let r=Ur[t],i=n?`Merged`:r?.label;return(0,U.jsxs)(`div`,{className:`flex items-center gap-3 py-1.5`,children:[i&&(0,U.jsx)(`span`,{className:`text-[10px] shrink-0 font-medium ${n||e.state===`Done`?`text-success`:`text-primary opacity-70`}`,children:i}),(0,U.jsx)(`div`,{className:`flex items-center flex-1 gap-0`,children:Ur.map((r,i)=>{let a=i<t||i===t&&e.state===`Done`,o=r.key===`merge`,s=o&&n,c=i===t&&e.state!==`Done`||o&&e.state===`Done`&&!n,l=a||s;return(0,U.jsxs)(L.Fragment,{children:[i>0&&(0,U.jsx)(`div`,{className:`flex-1 h-px transition-colors duration-300 ${l?`bg-success`:c?`bg-primary/30`:`bg-base-300`}`}),(0,U.jsx)(`div`,{title:r.label,className:[`size-2 rounded-full transition-all duration-300 shrink-0`,l?`bg-success`:``,c?`bg-primary ring-2 ring-primary/25 scale-[1.4]`:``,!l&&!c?`bg-base-300`:``].filter(Boolean).join(` `)})]},r.key)})})]})}function Q({title:e,icon:t,children:n,badge:r}){return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[t&&(0,U.jsx)(t,{className:`size-4 opacity-50`}),e,r!=null&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:r})]}),(0,U.jsx)(`div`,{children:n})]})}function $({label:e,value:t,mono:n}){return t==null||t===``?null:(0,U.jsxs)(`div`,{className:`flex justify-between items-baseline gap-4 py-0.5`,children:[(0,U.jsx)(`span`,{className:`text-xs opacity-50 shrink-0`,children:e}),(0,U.jsx)(`span`,{className:`text-sm text-right truncate ${n?`font-mono text-xs`:``}`,children:t})]})}function Kr({text:e}){let[t,n]=(0,L.useState)(!1),r=(0,L.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return(0,U.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1 ${t?`text-success`:``}`,onClick:r,title:`Copy to clipboard`,children:[t?(0,U.jsx)(Vt,{className:`size-3 animate-bounce-in`}):(0,U.jsx)(tn,{className:`size-3`}),t?(0,U.jsx)(`span`,{className:`animate-fade-in`,children:`Copied`}):`Copy`]})}function qr({config:e}){if(!e)return null;let{provider:t,model:n,effort:r}=e;return!t&&!n&&!r?null:(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[t&&(0,U.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,U.jsx)(Kn,{className:`size-2.5`}),t]}),n&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:n}),r&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:r})]})}var Jr={planner:`Plan`,executor:`Execute`,reviewer:`Review`},Yr={planner:`text-info`,executor:`text-primary`,reviewer:`text-secondary`};function Xr({tokensByPhase:e,tokensByModel:t}){let n=e?Object.entries(e).filter(([,e])=>e?.totalTokens>0):[],r=t?Object.entries(t).filter(([,e])=>e?.totalTokens>0):[];if(n.length===0&&r.length===0)return null;let i=e=>(e??0).toLocaleString();return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[n.length>0&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[n.map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`w-14 shrink-0 font-medium ${Yr[e]||`text-base-content`}`,children:Jr[e]||e}),(0,U.jsxs)(`span`,{className:`opacity-50`,children:[i(t.totalTokens),` total`]}),(0,U.jsxs)(`span`,{className:`opacity-30 text-[10px]`,children:[i(t.inputTokens),`↑ `,i(t.outputTokens),`↓`]}),t.model&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono ml-auto`,children:t.model})]},e)),n.length>1&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs border-t border-base-300 pt-1 mt-1`,children:[(0,U.jsx)(`span`,{className:`w-14 shrink-0 font-semibold opacity-60`,children:`Total`}),(0,U.jsx)(`span`,{className:`font-semibold`,children:i(n.reduce((e,[,t])=>e+(t.totalTokens??0),0))})]})]}),r.length>0&&(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-40 mb-1`,children:`by model`}),r.map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`font-mono opacity-70 truncate flex-1`,children:e}),(0,U.jsx)(`span`,{className:`opacity-50 shrink-0`,children:i(t.totalTokens)})]},e))]})]})}function Zr({issue:e,onStateChange:t,onRetry:n,onCancel:r}){let i=Array.isArray(e.labels)?e.labels:[],a=Array.isArray(e.blockedBy)?e.blockedBy:[],o=B(e.state).filter(t=>t!==e.state);return(0,U.jsxs)(`div`,{className:`space-y-5`,children:[e.mergedReason&&(0,U.jsxs)(`div`,{className:`flex items-start gap-2 bg-success/10 border border-success/20 rounded-box px-3 py-2.5`,children:[(0,U.jsx)(G,{className:`size-3.5 text-success shrink-0 mt-0.5`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-success/70 mb-0.5`,children:`Merged`}),(0,U.jsx)(`div`,{className:`text-xs text-success/90`,children:e.mergedReason})]})]}),e.cancelledReason&&(0,U.jsxs)(`div`,{className:`flex items-start gap-2 bg-error/10 border border-error/20 rounded-box px-3 py-2.5`,children:[(0,U.jsx)(kn,{className:`size-3.5 text-error shrink-0 mt-0.5`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-error/70 mb-0.5`,children:`Cancelled`}),(0,U.jsx)(`div`,{className:`text-xs text-error/90`,children:e.cancelledReason})]})]}),(0,U.jsx)(Q,{title:`Details`,icon:Sn,children:(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)($,{label:`Priority`,value:`P${e.priority}`}),(0,U.jsx)($,{label:`Attempts`,value:`${e.attempts??0} / ${e.maxAttempts??0}`}),e.branchName&&(0,U.jsx)($,{label:`Branch`,value:e.branchName,mono:!0}),e.baseBranch&&(0,U.jsx)($,{label:`Base branch`,value:e.baseBranch,mono:!0}),e.worktreePath&&(0,U.jsx)($,{label:`Code worktree`,value:e.worktreePath,mono:!0}),e.url&&(0,U.jsx)($,{label:`URL`,value:e.url,mono:!0}),(0,U.jsx)($,{label:`Created`,value:fe(e.createdAt)}),e.startedAt&&(0,U.jsx)($,{label:`Started`,value:fe(e.startedAt)}),e.completedAt&&(0,U.jsx)($,{label:`Completed`,value:fe(e.completedAt)}),e.nextRetryAt&&(0,U.jsx)($,{label:`Next retry`,value:fe(e.nextRetryAt)}),(0,U.jsx)($,{label:`Duration`,value:z(e.durationMs)}),e.tokenUsage?.totalTokens>0&&(0,U.jsx)($,{label:`Tokens`,value:`${e.tokenUsage.totalTokens.toLocaleString()}${e.tokenUsage.costUsd?` ($${e.tokenUsage.costUsd.toFixed(4)})`:``}`})]})}),i.length>0&&(0,U.jsx)(Q,{title:`Labels`,icon:Gn,badge:i.length,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,U.jsx)(`span`,{className:`badge badge-sm badge-outline`,children:e},e))})}),a.length>0&&(0,U.jsx)(Q,{title:`Dependencies`,icon:Nt,badge:a.length,children:(0,U.jsx)(`div`,{className:`space-y-0.5`,children:a.map(e=>(0,U.jsx)(`div`,{className:`font-mono text-xs`,children:e},e))})}),(0,U.jsx)(Q,{title:`Actions`,icon:rr,children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50 mb-1.5`,children:`Move to`}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1.5 max-sm:flex-col`,children:o.map(n=>{let r=Nr[n]||Xt;return(0,U.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1.5 max-sm:w-full ${Fr[n]||``}`,onClick:()=>t?.(e.id,n),children:[(0,U.jsx)(r,{className:`size-3.5`}),n]},n)})})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 max-sm:flex-col`,children:[(0,U.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1 max-sm:w-full`,onClick:()=>n?.(e.id),disabled:e.state===`Running`||e.state===`Reviewing`,children:[(0,U.jsx)(J,{className:`size-3`}),` Retry`]}),(0,U.jsxs)(`button`,{className:`btn btn-sm btn-error btn-soft gap-1 max-sm:w-full`,onClick:()=>r?.(e.id),disabled:e.state===`Done`||e.state===`Cancelled`,children:[(0,U.jsx)(Yt,{className:`size-3`}),` Cancel`]})]})]})})]})}function Qr({issueId:e,running:t,startedAt:n}){let[r,i]=(0,L.useState)(null),a=(0,L.useCallback)(async()=>{try{i(await V.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);if((0,L.useEffect)(()=>{if(!t){i(null);return}a();let e=setInterval(a,3e3);return()=>clearInterval(e)},[t,a]),!t||!r)return null;let o=Number.isFinite(Number(r.elapsed))?Number(r.elapsed):n?Math.max(Date.now()-new Date(n).getTime(),0):0,s=Math.floor(o/6e4),c=Math.floor(o%6e4/1e3),l=r.logSize?(r.logSize/1024).toFixed(1):`0`;return(0,U.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`loading loading-spinner loading-xs text-primary`}),(0,U.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`Agent running`}),(0,U.jsxs)(`span`,{className:`text-xs opacity-50 ml-auto`,children:[s,`m `,c,`s elapsed`]})]}),(0,U.jsxs)(`div`,{className:`flex gap-3 text-xs opacity-60`,children:[(0,U.jsxs)(`span`,{children:[`Log: `,l,` KB`]}),r.agentPid&&(0,U.jsxs)(`span`,{children:[`PID: `,r.agentPid]}),r.agentAlive===!1&&r.agentPid&&(0,U.jsx)(`span`,{className:`text-error`,children:`process dead`})]}),r.logTail&&(0,U.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-2 overflow-x-auto whitespace-pre-wrap max-h-48 overflow-y-auto font-mono opacity-80`,children:r.logTail})]})}function $r({issue:e,workflowConfig:t}){let n=e.state===`Running`||e.state===`Reviewing`,r=t?.workflow?.execute;return(0,U.jsxs)(`div`,{className:`space-y-5`,children:[(0,U.jsx)(Qr,{issueId:e.id,running:n,startedAt:e.startedAt}),r&&(0,U.jsx)(Q,{title:`Execution Config`,icon:Rn,children:(0,U.jsx)(qr,{config:r})}),(0,U.jsx)(Q,{title:`Run Info`,icon:Kn,children:(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)($,{label:`Exit code`,value:e.commandExitCode??`-`,mono:!0}),(0,U.jsx)($,{label:`Duration`,value:z(e.durationMs)}),e.workspacePath&&(0,U.jsx)($,{label:`Issue workspace root`,value:e.workspacePath,mono:!0}),e.worktreePath&&(0,U.jsx)($,{label:`Issue code checkout`,value:e.worktreePath,mono:!0}),e.workspacePreparedAt&&(0,U.jsx)($,{label:`Workspace prepared at`,value:fe(e.workspacePreparedAt)})]})}),e.lastError&&(0,U.jsx)(Q,{title:`Last Error`,icon:Y,children:(0,U.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-72 overflow-y-auto`,children:e.lastError})}),e.commandOutputTail&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,U.jsx)(Kn,{className:`size-4 opacity-50`}),` Command Output`]}),(0,U.jsx)(Kr,{text:e.commandOutputTail})]}),(0,U.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-[50vh] overflow-y-auto`,children:e.commandOutputTail})]}),(e.tokensByPhase||e.tokensByModel)&&(0,U.jsx)(Q,{title:`Token Usage`,icon:Z,children:(0,U.jsx)(Xr,{tokensByPhase:e.tokensByPhase,tokensByModel:e.tokensByModel})}),!e.lastError&&!e.commandOutputTail&&!e.tokensByPhase&&!e.tokensByModel&&(0,U.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No execution data yet.`})]})}var ei={added:`badge-success`,removed:`badge-error`,modified:`badge-info`};function ti({file:e,isOpen:t,onToggle:n}){return(0,U.jsx)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:(0,U.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-base-200 transition-colors`,onClick:n,children:[(0,U.jsx)(`span`,{className:`text-xs opacity-40 transition-transform`,style:{transform:t?`rotate(90deg)`:``},children:`▶`}),(0,U.jsx)(`span`,{className:`badge badge-xs ${ei[e.status]||`badge-ghost`}`,children:e.status}),(0,U.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:e.path}),(0,U.jsxs)(`span`,{className:`text-xs text-success`,children:[`+`,e.additions]}),(0,U.jsxs)(`span`,{className:`text-xs text-error`,children:[`-`,e.deletions]})]})})}function ni({lines:e}){return!e||e.length===0?null:(0,U.jsx)(`pre`,{className:`text-xs rounded-box p-3 overflow-x-auto max-h-[55vh] overflow-y-auto leading-relaxed bg-base-200 font-mono`,children:e.map((e,t)=>{let n=``;return e.startsWith(`+`)&&!e.startsWith(`+++`)?n=`text-success bg-success/10`:e.startsWith(`-`)&&!e.startsWith(`---`)?n=`text-error bg-error/10`:e.startsWith(`@@`)?n=`text-info opacity-60 text-[10px]`:e.startsWith(`diff `)&&(n=`font-bold opacity-70 border-t border-base-300 pt-2 mt-2`),(0,U.jsx)(`div`,{className:n,children:e||`\xA0`},t)})})}function ri({issueId:e}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(async()=>{i(!0),o(null);try{n(await V.get(`/diff/${encodeURIComponent(e)}`))}catch(e){o(e.message)}finally{i(!1)}},[e]);if((0,L.useEffect)(()=>{n(null),o(null),c(null)},[e]),(0,L.useEffect)(()=>{l()},[l]),r)return(0,U.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm opacity-50 py-12`,children:[(0,U.jsx)(`span`,{className:`loading loading-spinner loading-sm`}),` Loading changes...`]});if(a)return(0,U.jsx)(`div`,{className:`text-sm text-error py-4`,children:a});if(!t)return null;let{files:u=[],diff:d=``,message:f,totalAdditions:p=0,totalDeletions:m=0}=t;if(u.length===0)return(0,U.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:f||`No changes detected.`});let h={};if(d){let e=d.split(/(?=^diff --git )/m);for(let t of e){let e=t.match(/^diff --git a\/(.+?) b\//);e&&(h[e[1]]=t.split(`
|
|
40
|
+
`))}}return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,U.jsxs)(`span`,{className:`opacity-60`,children:[u.length,` file`,u.length===1?``:`s`,` changed`]}),(0,U.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,p]}),(0,U.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,m]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(Kr,{text:d}),(0,U.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1`,onClick:l,children:[(0,U.jsx)(J,{className:`size-3`}),` Refresh`]})]})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>(0,U.jsx)(ti,{file:e,isOpen:s===e.path,onToggle:()=>c(s===e.path?null:e.path)},e.path))}),s&&h[s]&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:s}),(0,U.jsx)(ni,{lines:h[s]})]}),!s&&(0,U.jsxs)(`details`,{className:`group`,children:[(0,U.jsxs)(`summary`,{className:`text-xs opacity-50 cursor-pointer select-none list-none flex items-center gap-1`,children:[(0,U.jsx)(`span`,{className:`transition-transform group-open:rotate-90`,children:`▶`}),`Show full diff`]}),(0,U.jsx)(`div`,{className:`mt-2`,children:(0,U.jsx)(ni,{lines:d.split(`
|
|
41
|
+
`)})})]})]})}var ii=/^(\.fifony|fifony[-_]|WORKFLOW\.local)/;function ai(e){return(Array.isArray(e)?e:[]).filter(e=>!ii.test(e))}function oi({issue:e}){let t=ai(e.paths),n=new Set(t),r=ai(e.inferredPaths).filter(e=>!n.has(e)),i=Array.isArray(e.capabilityOverlays)?e.capabilityOverlays:[],a=Array.isArray(e.capabilityRationale)?e.capabilityRationale:[];return(0,U.jsxs)(`div`,{className:`space-y-5`,children:[(0,U.jsx)(Q,{title:`State Machine`,icon:fn,children:(0,U.jsx)(`div`,{className:`space-y-1`,children:me.map(t=>{let n=t===e.state,r=Nr[t]||Xt,i=he[t]||[],a=Hr(t)<Hr(e.state);return(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg px-2 py-1.5 border text-sm ${n?Ir[t]+` font-semibold`:a?`border-transparent opacity-40`:`border-transparent opacity-60`}`,children:[(0,U.jsx)(r,{className:`size-4 mt-0.5 shrink-0 ${n?Pr[t]:``}`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{children:t}),n&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`current`})]}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:i.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-xs opacity-50`,children:[(0,U.jsx)(jt,{className:`size-2.5`}),e]},e))})]})]},t)})})}),(0,U.jsx)(Q,{title:`Capability Routing`,icon:dn,children:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)($,{label:`Category`,value:e.capabilityCategory||`default`}),i.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Overlays`}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,U.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))})]}),a.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Rationale`}),(0,U.jsx)(`ul`,{className:`text-xs opacity-70 list-disc ml-4 space-y-0.5`,children:a.map((e,t)=>(0,U.jsx)(`li`,{children:e},t))})]})]})}),(t.length>0||r.length>0)&&(0,U.jsxs)(Q,{title:`Paths`,icon:ln,badge:t.length+r.length,children:[t.length>0&&(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Explicit`}),(0,U.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>(0,U.jsx)(`div`,{className:`font-mono text-xs truncate`,children:e},e))})]}),r.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Inferred`}),(0,U.jsx)(`div`,{className:`space-y-0.5`,children:r.map(e=>(0,U.jsx)(`div`,{className:`font-mono text-xs truncate opacity-60`,children:e},e))})]})]})]})}var si=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],ci={error:`badge-error`,state:`badge-primary`,progress:`badge-info`,manual:`badge-warning`,runner:`badge-accent`,info:`badge-ghost`},li={Planning:`border-l-info`,Planned:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Reviewing:`border-l-secondary`,Reviewed:`border-l-success`,Blocked:`border-l-error`,Done:`border-l-success`,Cancelled:`border-l-neutral`},ui=/([\d,]+)\s+tokens/gi,di=100;function fi(e,t){if(!e)return``;if(!t)return e;let n=[],r=0,i,a=new RegExp(ui.source,`gi`);for(;(i=a.exec(e))!==null;)i.index>r&&n.push(e.slice(r,i.index)),n.push((0,U.jsx)(`strong`,{className:`font-semibold`,children:i[0]},i.index)),r=i.index+i[0].length;return r<e.length&&n.push(e.slice(r)),n.length>0?n:e}function pi(e){if(!e)return null;for(let t of Object.keys(li))if(e.includes(t))return t;return null}function mi({value:e}){let[,t]=(0,L.useState)(0);return(0,L.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),5e3);return()=>clearInterval(e)},[]),(0,U.jsx)(`span`,{title:fe(e),children:R(e)})}function hi({ev:e}){let t=typeof e.message==`string`&&/tokens/i.test(e.message),n=e.kind===`state`,r=n?pi(e.message):null,i=r?li[r]:``;return(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box px-3 py-2 ${n?`border-l-[3px] ${i}`:``}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`span`,{className:`opacity-50`,children:(0,U.jsx)(mi,{value:e.at})}),(0,U.jsx)(`span`,{className:`badge badge-xs ${ci[e.kind]||`badge-ghost`}`,children:e.kind||`info`}),n&&(0,U.jsx)(jt,{className:`size-3 opacity-50`}),t&&(0,U.jsx)(Z,{className:`size-3 text-warning`})]}),(0,U.jsx)(`div`,{className:`text-sm mt-0.5`,children:fi(e.message,t)})]})}function gi({issueId:e,events:t}){let[n,r]=(0,L.useState)(`all`),i=(0,L.useRef)(null),[a,o]=(0,L.useState)(!0),[s,c]=(0,L.useState)(!1),l=(0,L.useRef)(0),u=(0,L.useMemo)(()=>Array.isArray(t)?t.filter(t=>t.issueId===e&&(n===`all`||t.kind===n)).slice(0,200):[],[t,e,n]),d=(0,L.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<di;o(t),t&&c(!1)},[]);(0,L.useEffect)(()=>{u.length>l.current&&u.length>0&&(a&&i.current?requestAnimationFrame(()=>{i.current?.scrollTo({top:i.current.scrollHeight,behavior:`smooth`})}):l.current>0&&c(!0)),l.current=u.length},[u.length,a]);let f=(0,L.useCallback)(()=>{i.current?.scrollTo({top:i.current.scrollHeight,behavior:`smooth`}),c(!1)},[]);return(0,U.jsxs)(`div`,{className:`flex flex-col h-full -mx-6 -my-4`,children:[(0,U.jsxs)(`div`,{className:`px-5 py-2.5 border-b border-base-300 flex items-center gap-2 shrink-0`,children:[(0,U.jsx)(Rn,{className:`size-3.5 opacity-50`}),(0,U.jsx)(`select`,{className:`select select-bordered select-xs`,value:n,onChange:e=>r(e.target.value),"aria-label":`Filter by event kind`,children:si.map(e=>(0,U.jsx)(`option`,{value:e,children:e===`all`?`All kinds`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),u.length>0&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-neutral ml-auto`,children:u.length})]}),(0,U.jsx)(`div`,{ref:i,className:`flex-1 overflow-y-auto px-5 py-3 relative`,onScroll:d,children:u.length===0?(0,U.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No events for this issue yet.`}):(0,U.jsx)(`div`,{className:`space-y-2`,children:u.map((e,t)=>(0,U.jsx)(hi,{ev:e},`${e.at}-${t}`))})}),s&&(0,U.jsx)(`div`,{className:`absolute bottom-16 left-1/2 -translate-x-1/2 z-10`,children:(0,U.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-primary rounded-full shadow-lg animate-fade-in-up gap-1`,onClick:f,children:[(0,U.jsx)(Ht,{className:`size-3`}),` New events`]})})]})}function _i({issue:e}){let[t,n]=(0,L.useState)([]),[r,i]=(0,L.useState)(!0),a=(0,L.useRef)(null);if((0,L.useEffect)(()=>{let t=!0,r=async()=>{try{let r=await V.get(`/events/feed?issueId=${encodeURIComponent(e.id)}`);t&&Array.isArray(r?.events)&&n([...r.events].reverse())}catch{}t&&i(!1)};r();let a=setInterval(r,3e3);return()=>{t=!1,clearInterval(a)}},[e.id]),r&&t.length===0)return(0,U.jsxs)(`div`,{className:`flex items-center justify-center py-8 gap-2 opacity-40`,children:[(0,U.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Loading events...`})]});if(t.length===0)return(0,U.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No events for this issue yet.`});let o={info:{color:`text-info`,icon:bn},error:{color:`text-error`,icon:Y},progress:{color:`text-primary`,icon:Ot},state:{color:`text-secondary`,icon:fn},manual:{color:`text-warning`,icon:Jt},runner:{color:`text-accent`,icon:Kn},merge:{color:`text-success`,icon:G}};return(0,U.jsx)(`div`,{ref:a,className:`space-y-2 -mx-6 -my-4 px-6 py-4 h-full overflow-y-auto`,children:t.map((e,t)=>{let n=o[e.kind]||o.info,r=n.icon;return(0,U.jsxs)(`div`,{className:`flex gap-2.5 items-start py-1.5`,children:[(0,U.jsx)(r,{className:`size-3.5 mt-0.5 shrink-0 ${n.color}`}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs leading-relaxed`,children:e.message}),(0,U.jsxs)(`div`,{className:`text-[10px] font-mono opacity-30 mt-0.5`,children:[e.at?R(e.at):``,e.kind&&(0,U.jsx)(`span`,{className:`ml-2 opacity-60`,children:e.kind})]})]})]},`${e.id||e.at}-${t}`)})})}var vi={trivial:`badge-ghost`,low:`badge-success`,medium:`badge-warning`,high:`badge-error`};function yi({issue:e,onStateChange:t,workflowConfig:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(0),[y,b]=(0,L.useState)(!1),x=(0,L.useRef)(null),S=e.plan,C=e.state===`Planning`,w=S?.refinements?.length||0,T=Array.isArray(e.planHistory)?e.planHistory:[],E=e.planVersion??0,D=2e3,O=a||e.planningError,k=e.planningStatus===`planning`,A=k||s&&!S,j=k&&l||l,M=A||j,ee=C&&!S&&!O&&!A;(0,L.useEffect)(()=>{e.planningError&&o(null)},[e.planningError]),(0,L.useEffect)(()=>{s&&(S||e.planningError)&&c(!1)},[s,S,e.planningError]),(0,L.useEffect)(()=>{l&&(e.planningStatus!==`planning`||e.planningError)&&u(!1)},[l,e.planningStatus,e.planningError]),(0,L.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{c(!1),o(`Plan generation timed out. The plan may still be generating in the background — check back soon.`)},300*1e3);return()=>clearTimeout(e)},[s]),(0,L.useEffect)(()=>{if(!M){v(0);return}let t=e.planningStartedAt?new Date(e.planningStartedAt).getTime():Date.now(),n=()=>v(Math.floor((Date.now()-t)/1e3));n();let r=setInterval(n,1e3);return()=>clearInterval(r)},[M,e.planningStartedAt]),(0,L.useEffect)(()=>{if(S&&C&&x.current){let e=setTimeout(()=>x.current?.focus(),300);return()=>clearTimeout(e)}},[S,C]);let te=async(t=!1)=>{o(null),c(!0);try{let n=await V.post(`/issues/${encodeURIComponent(e.id)}/plan`,{fast:t});if(!n.ok)throw Error(n.error||`Plan generation failed.`)}catch(e){o(e instanceof Error?e.message:String(e)),c(!1)}},N=async()=>{f(!0);try{await V.post(`/issues/${encodeURIComponent(e.id)}/approve`)}catch(e){o(e instanceof Error?e.message:String(e)),f(!1)}},P=async()=>{if(r.trim()){o(null),u(!0);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/plan/refine`,{feedback:r.trim()});if(!t.ok)throw Error(t.error||`Refinement failed.`);i(``)}catch(e){o(e instanceof Error?e.message:String(e)),u(!1)}}},ne=async()=>{o(null),m(!0);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/replan`);if(!t.ok)throw Error(t.error||`Replan failed.`)}catch(e){o(e instanceof Error?e.message:String(e))}finally{m(!1)}};if(!S&&!A)return C?(0,U.jsxs)(`div`,{className:`space-y-4 py-4`,children:[ee&&(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-10`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`loading loading-dots loading-sm text-info`}),(0,U.jsx)(`span`,{className:`text-sm opacity-60`,children:`Queued — waiting for the planner worker...`})]}),(0,U.jsx)(`div`,{className:`text-xs opacity-30`,children:`The plan will be generated automatically shortly.`}),(0,U.jsx)(`div`,{className:`flex items-center gap-2 mt-2`,children:(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1 opacity-50 hover:opacity-100`,onClick:()=>te(!1),children:[(0,U.jsx)(Z,{className:`size-3`}),` Generate now`]})})]}),O&&(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`alert alert-error text-sm flex-col items-start gap-1`,children:[(0,U.jsxs)(`div`,{className:`font-medium flex items-center gap-1.5`,children:[(0,U.jsx)(Y,{className:`size-4`}),` Plan generation failed`]}),(0,U.jsx)(`div`,{className:`text-xs opacity-80`,children:O})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,U.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1.5`,onClick:()=>te(!1),children:[(0,U.jsx)(J,{className:`size-3.5`}),` Try again`]}),(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1`,onClick:()=>te(!0),children:[(0,U.jsx)(Z,{className:`size-3.5`}),` Fast`]})]})]})]}):(0,U.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium opacity-70`,children:`No plan yet`}),(0,U.jsx)(`p`,{className:`text-xs opacity-40`,children:`Generate an AI plan to break this issue into actionable steps.`})]}),O&&(0,U.jsx)(`div`,{className:`alert alert-error text-sm`,children:O})]});if(A&&!S){let e=_>0?z(_*1e3):``;return(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-12`,children:[(0,U.jsx)(q,{className:`size-8 animate-spin text-primary`}),(0,U.jsx)(`div`,{className:`text-sm opacity-60`,children:`Generating execution plan...`}),(0,U.jsx)(`div`,{className:`text-xs opacity-30`,children:`This may take a few minutes`}),e&&(0,U.jsxs)(`div`,{className:`text-xs font-mono opacity-40`,children:[e,` elapsed`]})]})}return(0,U.jsxs)(`div`,{className:`space-y-5`,children:[M&&(0,U.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 flex items-center gap-3`,children:[(0,U.jsx)(q,{className:`size-4 animate-spin text-primary shrink-0`}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsx)(`span`,{className:`text-sm text-primary font-medium`,children:A?`Re-generating plan...`:`Refining to v${w+2}...`}),_>0&&(0,U.jsx)(`span`,{className:`text-xs text-primary/60 ml-2 font-mono`,children:z(_*1e3)})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,U.jsxs)(`span`,{className:`badge badge-sm ${vi[S.estimatedComplexity]||`badge-ghost`}`,children:[S.estimatedComplexity,` complexity`]}),E>0&&(0,U.jsxs)(`span`,{className:`badge badge-sm badge-info badge-soft font-mono`,children:[`Plan v`,E]}),w>0&&(0,U.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,U.jsx)(J,{className:`size-2.5`}),` Refined ×`,w]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[n?.workflow?.plan&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs opacity-60`,children:[(0,U.jsx)(Rn,{className:`size-3 shrink-0`}),(0,U.jsx)(qr,{config:n.workflow.plan})]}),e.tokensByPhase?.planner?.totalTokens>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs opacity-50`,children:[(0,U.jsx)(Z,{className:`size-3`}),(0,U.jsxs)(`span`,{children:[e.tokensByPhase.planner.totalTokens.toLocaleString(),` tokens`]})]})]}),w>0&&(0,U.jsxs)(`div`,{className:`rounded-box border-l-4 border-secondary bg-secondary/5 px-4 py-3 animate-fade-in`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider opacity-40 mb-1`,children:`Last refinement feedback`}),(0,U.jsxs)(`p`,{className:`text-sm leading-relaxed italic opacity-80`,children:[`“`,S.refinements[w-1].feedback,`”`]}),(0,U.jsxs)(`span`,{className:`text-[10px] opacity-30 mt-1 block`,children:[`v`,S.refinements[w-1].version||w+1,` · `,R(S.refinements[w-1].at)]})]}),(0,U.jsxs)(`div`,{className:`space-y-5 animate-fade-in`,children:[(0,U.jsx)(Q,{title:`Summary`,icon:bn,children:(0,U.jsx)(`p`,{className:`text-sm leading-relaxed`,children:S.summary})}),S.phases?.length>0&&(0,U.jsx)(Q,{title:`Phases (${S.phases.length})`,icon:Sn,children:(0,U.jsx)(`div`,{className:`space-y-3`,children:S.phases.map((e,t)=>(0,U.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,U.jsxs)(`div`,{className:`bg-base-200 px-3 py-2 flex items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`flex items-center justify-center size-5 rounded-full bg-primary/15 text-primary text-[10px] font-bold shrink-0`,children:t+1}),(0,U.jsx)(`span`,{className:`text-sm font-semibold`,children:e.phaseName}),e.tasks?.length>0&&(0,U.jsxs)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:[e.tasks.length,` tasks`]})]}),e.goal&&(0,U.jsx)(`div`,{className:`px-3 pt-2 text-xs opacity-60`,children:e.goal}),e.tasks?.length>0&&(0,U.jsx)(`div`,{className:`px-3 pb-2 pt-1.5 space-y-1.5`,children:e.tasks.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,U.jsxs)(`span`,{className:`opacity-30 shrink-0 font-mono w-4`,children:[e.step,`.`]}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.action}),e.details&&(0,U.jsxs)(`span`,{className:`opacity-50 ml-1`,children:[`— `,e.details]})]})]},t))}),e.outputs?.length>0&&(0,U.jsx)(`div`,{className:`px-3 pb-2 flex flex-wrap gap-1`,children:e.outputs.map(e=>(0,U.jsx)(`span`,{className:`badge badge-xs badge-outline opacity-60`,children:e},e))})]},t))})}),(0,U.jsx)(Q,{title:`Steps (${S.steps.length})`,icon:wn,children:(0,U.jsx)(`div`,{className:`space-y-2`,children:S.steps.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex gap-3 p-3 bg-base-200 rounded-box`,children:[(0,U.jsx)(`div`,{className:`flex items-center justify-center size-6 rounded-full bg-primary/10 text-primary text-xs font-bold shrink-0`,children:e.step}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:e.action}),e.details&&(0,U.jsx)(`div`,{className:`text-xs opacity-50 mt-0.5`,children:e.details}),e.files?.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.files.map(e=>(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:e},e))})]})]},t))})})]},`plan-content-${w}`),S.suggestedPaths?.length>0&&(0,U.jsx)(Q,{title:`Suggested Paths`,icon:ln,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:S.suggestedPaths.map(e=>(0,U.jsx)(`span`,{className:`badge badge-sm badge-ghost font-mono`,children:e},e))})}),S.suggestedLabels?.length>0&&(0,U.jsx)(Q,{title:`Suggested Labels`,icon:Gn,children:(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:S.suggestedLabels.map(e=>(0,U.jsx)(`span`,{className:`badge badge-sm badge-outline`,children:e},e))})}),w>0&&(0,U.jsx)(Q,{title:`Refinements (${w})`,icon:Dn,children:(0,U.jsx)(`div`,{className:`space-y-2`,children:(()=>{let e=S.refinements,t=!y&&e.length>2,n=t?e.slice(-2):e;return(0,U.jsxs)(U.Fragment,{children:[t&&(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>b(!0),children:[(0,U.jsx)(Ht,{className:`size-3`}),` Show `,e.length-2,` earlier refinement`,e.length-2>1?`s`:``]}),n.map((n,r)=>{let i=t?e.length-2+r:r;return(0,U.jsxs)(`div`,{className:`flex gap-3 p-2.5 bg-base-200 rounded-box text-sm animate-fade-in`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-center size-6 rounded-full bg-secondary/10 text-secondary text-xs font-bold shrink-0`,children:[`v`,n.version||i+2]}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed`,children:n.feedback}),(0,U.jsx)(`span`,{className:`text-[10px] opacity-40 mt-1 block`,children:R(n.at)})]})]},i)}),y&&e.length>2&&(0,U.jsx)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>b(!1),children:`Show less`})]})})()})}),T.length>0&&(0,U.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,U.jsxs)(`button`,{className:`w-full flex items-center justify-between px-3 py-2 bg-base-200 text-sm font-medium hover:bg-base-300 transition-colors`,onClick:()=>g(e=>!e),children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(J,{className:`size-3.5 opacity-60`}),`Plan History (`,T.length,` previous)`]}),(0,U.jsx)(Ht,{className:`size-3.5 opacity-60 transition-transform ${h?`rotate-180`:``}`})]}),h&&(0,U.jsx)(`div`,{className:`divide-y divide-base-300`,children:T.map((e,t)=>(0,U.jsxs)(`div`,{className:`px-3 py-2.5 space-y-1 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 opacity-60`,children:[(0,U.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`v`,t+1]}),(0,U.jsxs)(`span`,{children:[e.steps?.length??0,` steps`]}),(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.estimatedComplexity}),(0,U.jsx)(`span`,{className:`ml-auto`,children:R(e.createdAt)})]}),(0,U.jsx)(`p`,{className:`opacity-70 leading-relaxed line-clamp-2`,children:e.summary})]},t))})]}),C&&S&&(0,U.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-2`,children:[(0,U.jsxs)(`div`,{className:`text-xs font-semibold flex items-center gap-1.5 opacity-70`,children:[(0,U.jsx)(Dn,{className:`size-3.5`}),`Refine Plan`]}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`textarea`,{ref:x,className:`textarea textarea-bordered w-full text-sm pr-16`,rows:2,placeholder:`Give feedback to refine the plan... e.g. 'Use React instead of Vue for step 3'`,value:r,maxLength:D,onChange:e=>i(e.target.value),disabled:M,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&r.trim()&&(e.preventDefault(),P())}}),(0,U.jsxs)(`span`,{className:`absolute bottom-2 right-3 text-[10px] pointer-events-none ${r.length>D*.9?`text-error`:`opacity-30`}`,children:[r.length,`/`,D]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`button`,{className:`btn btn-secondary btn-sm gap-1.5`,onClick:P,disabled:M||!r.trim(),children:j?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(q,{className:`size-3.5 animate-spin`}),` Generating v`,w+2,`...`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(J,{className:`size-3.5`}),` Refine Plan`]})}),(0,U.jsx)(`span`,{className:`text-[10px] opacity-30`,children:`Ctrl+Enter to send`})]})]}),O&&(0,U.jsx)(`div`,{className:`alert alert-error text-sm`,children:O}),C&&!M&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 pt-3 border-t border-base-300 max-sm:flex-col`,children:[(0,U.jsx)(`button`,{className:`btn btn-primary gap-1.5 max-sm:w-full`,onClick:N,disabled:d||!S,children:d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(q,{className:`size-4 animate-spin`}),` Starting...`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Gt,{className:`size-4`}),` Approve & Start`]})}),S&&(0,U.jsx)(`button`,{className:`btn btn-ghost btn-sm gap-1 max-sm:w-full`,onClick:ne,disabled:p||M,title:`Archive current plan and generate a new one`,children:p?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(q,{className:`size-3 animate-spin`}),` Replanning...`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(J,{className:`size-3`}),` Replan`]})})]})]})}function bi({issue:e,issueId:t,onStateChange:n}){let[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(e.images??[]),[h,g]=(0,L.useState)(!1),_=(0,L.useRef)(null),v=(0,L.useCallback)(async()=>{o(!0);try{i(await V.get(`/diff/${encodeURIComponent(t)}`))}catch{i(null)}finally{o(!1)}},[t]);(0,L.useEffect)(()=>{i(null),u(null),c(``),f(null),m(e.images??[])},[t]),(0,L.useEffect)(()=>{v()},[v]);let y=(0,L.useCallback)(async e=>{if(e.length){g(!0);try{let n=await Promise.all(e.map(e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t({name:e.name,data:r.result.split(`,`)[1],type:e.type}),r.onerror=n,r.readAsDataURL(e)}))),r=await V.post(`/issues/${encodeURIComponent(t)}/images`,{files:n});r.ok&&r.paths&&m(e=>[...e,...r.paths])}catch{}finally{g(!1),_.current&&(_.current.value=``)}}},[t]),b=e.state===`Reviewing`||e.state===`Reviewed`,x=e.state===`Done`;(0,L.useEffect)(()=>{if(!b)return;let e=e=>{let t=Array.from(e.clipboardData?.items??[]).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(Boolean);t.length&&y(t)};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[b,y]);let S=r?.files||[],C=r?.diff||``,w={};if(C)for(let e of C.split(/(?=^diff --git )/m)){let t=e.match(/^diff --git a\/(.+?) b\//);t&&(w[t[1]]=e.split(`
|
|
42
|
+
`))}let T=()=>{u(`approved`),n?.(e.id,`Done`)},E=()=>{u(`rework`),n?.(e.id,`Queued`)},D=()=>{u(`rejected`),n?.(e.id,`Blocked`)},O=e.mergeResult,k=!!e.mergedAt;return(0,U.jsxs)(`div`,{className:`space-y-5`,children:[k&&(0,U.jsxs)(`div`,{className:`alert border text-sm ${O?.conflicts>0?`border-warning/30 bg-warning/5`:`border-success/30 bg-success/5`}`,children:[(0,U.jsx)(G,{className:`size-4 shrink-0 ${O?.conflicts>0?`text-warning`:`text-success`}`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Code merged to project root`}),O&&(0,U.jsxs)(`span`,{className:`opacity-70`,children:[` — `,O.copied,` file`,O.copied===1?``:`s`,` copied`,O.deleted>0?`, ${O.deleted} deleted`:``]}),O?.conflicts>0&&(0,U.jsxs)(`p`,{className:`text-xs text-warning font-medium mt-0.5`,children:[O.conflicts,` file`,O.conflicts===1?``:`s`,` conflicted with another worker and were skipped.`]}),(0,U.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`The approved branch has been integrated into the current project branch.`})]})]}),!k&&x&&(0,U.jsxs)(`div`,{className:`alert border border-info/30 bg-info/5 text-sm`,children:[(0,U.jsx)(fn,{className:`size-4 shrink-0 text-info`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Review approved, merge still pending`}),(0,U.jsxs)(`p`,{className:`text-xs opacity-70 mt-0.5`,children:[`The code is still isolated on `,e.branchName?(0,U.jsx)(`span`,{className:`font-mono`,children:e.branchName}):`the issue branch`,` and in the worktree until you run Merge.`]})]})]}),x&&(0,U.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,U.jsx)(Gt,{className:`size-4`}),` This issue has been approved.`]}),e.state===`Blocked`&&(0,U.jsxs)(`div`,{className:`alert alert-error text-sm`,children:[(0,U.jsx)(Y,{className:`size-4`}),` Review failed. Check execution output.`]}),l===`approved`&&b&&(0,U.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,U.jsx)(Jn,{className:`size-4`}),` Approved! Moving to Done.`]}),l===`rework`&&(0,U.jsxs)(`div`,{className:`alert alert-warning text-sm`,children:[(0,U.jsx)(J,{className:`size-4`}),` Sent back for rework.`]}),b&&!l&&(0,U.jsx)(Q,{title:`Review Checklist`,icon:Zt,children:(0,U.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,U.jsx)(`p`,{className:`opacity-60`,children:`Before deciding, consider:`}),(0,U.jsxs)(`ul`,{className:`list-disc ml-5 space-y-1 opacity-80`,children:[(0,U.jsx)(`li`,{children:`Does the diff address the issue title and description?`}),(0,U.jsx)(`li`,{children:`Are there unintended side effects or regressions?`}),(0,U.jsx)(`li`,{children:`Is the scope appropriate — no unnecessary changes?`}),(0,U.jsx)(`li`,{children:`Are there files that shouldn't have been modified?`})]})]})}),(0,U.jsx)(Q,{title:`Changes`,icon:$t,children:a?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-4`,children:[(0,U.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),` Loading changes...`]}):S.length>0?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,U.jsxs)(`span`,{className:`opacity-60`,children:[S.length,` file`,S.length===1?``:`s`]}),(0,U.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,r?.totalAdditions||0]}),(0,U.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,r?.totalDeletions||0]})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:S.map(e=>(0,U.jsx)(ti,{file:e,isOpen:d===e.path,onToggle:()=>f(d===e.path?null:e.path)},e.path))}),d&&w[d]&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:d}),(0,U.jsx)(ni,{lines:w[d]})]})]}):(0,U.jsx)(`div`,{className:`text-sm opacity-40 py-4`,children:`No changes detected.`})}),(e.lastError||e.commandOutputTail)&&(0,U.jsxs)(Q,{title:`Agent Output`,icon:Kn,children:[e.lastError&&(0,U.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-2`,children:e.lastError}),e.commandOutputTail&&!e.lastError&&(0,U.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto`,children:e.commandOutputTail})]}),(b||x)&&(0,U.jsxs)(Q,{title:`Evidence`,icon:vn,children:[(0,U.jsx)(`input`,{ref:_,type:`file`,multiple:!0,accept:`image/*`,className:`hidden`,onChange:e=>y(Array.from(e.target.files??[]))}),p.length>0?(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.map((e,n)=>{let r=e.split(`/`).pop(),i=`/api/issues/${encodeURIComponent(t)}/images/${encodeURIComponent(r)}`;return(0,U.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`block`,children:(0,U.jsx)(`img`,{src:i,alt:r,className:`size-20 object-cover rounded-lg border border-base-300 hover:opacity-80 transition-opacity`})},n)})}):(0,U.jsx)(`p`,{className:`text-xs opacity-40`,children:`No screenshots attached yet.`}),b&&(0,U.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-ghost gap-1 mt-2`,onClick:()=>_.current?.click(),disabled:h,children:[h?(0,U.jsx)(q,{className:`size-3 animate-spin`}):(0,U.jsx)(jn,{className:`size-3`}),`Attach Screenshot`]})]}),b&&!l&&(0,U.jsx)(Q,{title:`Review Note`,icon:Kn,children:(0,U.jsx)(`textarea`,{className:`textarea textarea-bordered w-full text-sm`,rows:3,placeholder:`Optional: leave a note about your decision...`,value:s,onChange:e=>c(e.target.value)})}),b&&!l&&(0,U.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-3`,children:[(0,U.jsx)(`div`,{className:`text-sm font-semibold`,children:`Verdict`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:T,children:[(0,U.jsx)(Jn,{className:`size-4`}),` Approve`]}),(0,U.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:E,children:[(0,U.jsx)(J,{className:`size-4`}),` Request Rework`]}),(0,U.jsxs)(`button`,{className:`btn btn-error btn-sm gap-1.5 flex-1`,onClick:D,children:[(0,U.jsx)(qn,{className:`size-4`}),` Reject`]})]}),(0,U.jsxs)(`p`,{className:`text-xs opacity-40`,children:[(0,U.jsx)(`strong`,{children:`Approve`}),` moves to Done. `,(0,U.jsx)(`strong`,{children:`Rework`}),` sends back to executor. `,(0,U.jsx)(`strong`,{children:`Reject`}),` blocks the issue.`]})]})]})}function xi({issue:e,onStateChange:t,onMerge:n,onPush:r,mergeBusy:i,mergeError:a,mergeNotice:o,mergeMode:s}){let c={paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.75rem)`},[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(!1),h=(0,L.useCallback)(async()=>{u(!0),f(null);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/execute`);if(!t.ok)throw Error(t.error||`Execute failed.`)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}},[e.id]),g=e.state===`Planning`,_=e.state===`Planned`,v=e.state===`Running`||e.state===`Queued`,y=e.state===`Reviewing`||e.state===`Reviewed`,b=e.state===`Done`,x=!!e.mergedAt;return g?null:_?(0,U.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-1.5`,style:c,children:[d&&(0,U.jsxs)(`div`,{className:`alert alert-error text-xs py-1.5`,children:[(0,U.jsx)(Y,{className:`size-3.5`}),` `,d]}),(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,U.jsx)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1`,onClick:h,disabled:l,children:l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(q,{className:`size-4 animate-spin`}),` Starting...`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(qt,{className:`size-4`}),` Execute`]})})})]}):v?(0,U.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center justify-center gap-2`,style:c,children:[(0,U.jsx)(`span`,{className:`issue-phase-dot`}),(0,U.jsx)(`span`,{className:`text-sm opacity-50`,children:`Watching...`})]}):y?(0,U.jsxs)(U.Fragment,{children:[p&&(0,U.jsx)(Or,{issue:e,onClose:()=>m(!1)}),(0,U.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-1.5`,style:c,children:[(0,U.jsxs)(`button`,{className:`btn btn-primary btn-sm btn-soft gap-1.5 w-full`,onClick:()=>m(!0),children:[(0,U.jsx)(W,{className:`size-3.5`}),` Preview Changes`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Done`),children:[(0,U.jsx)(Jn,{className:`size-4`}),` Approve`]}),(0,U.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Queued`),children:[(0,U.jsx)(J,{className:`size-4`}),` Rework`]})]})]})]}):b&&!x?(0,U.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-2`,style:c,children:[a&&(0,U.jsxs)(`div`,{className:`alert alert-error text-sm py-2`,children:[(0,U.jsx)(Y,{className:`size-4`}),` `,a]}),o&&!a&&(0,U.jsxs)(`div`,{className:`alert alert-success text-sm py-2`,children:[(0,U.jsx)(`span`,{className:`size-4`}),` `,o]}),(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:s===`push-pr`?(0,U.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1 ${i?`btn-disabled`:``}`,onClick:()=>r?.(e.id),disabled:i,children:[i?(0,U.jsx)(q,{className:`size-4 animate-spin`}):(0,U.jsx)(mn,{className:`size-4`}),i?`Pushing...`:e.baseBranch?(0,U.jsxs)(U.Fragment,{children:[`Push PR → `,(0,U.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Push & Open PR`]}):(0,U.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1 ${i?`btn-disabled`:``}`,onClick:()=>n?.(e.id),disabled:i,children:[i?(0,U.jsx)(q,{className:`size-4 animate-spin`}):(0,U.jsx)(G,{className:`size-4`}),i?`Merging...`:e.baseBranch?(0,U.jsxs)(U.Fragment,{children:[`Merge → `,(0,U.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Merge to Project`]})})]}):null}function Si({issue:e,onClose:t,onStateChange:n,onRetry:r,onCancel:i,events:a,mergeMode:o}){let[s,c]=(0,L.useState)(`overview`),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(null),C=(0,L.useRef)(null),{data:w}=Mr(),T=(0,L.useCallback)(async()=>{if(!(!e?.id||y)){b(!0),S(null);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/replan`);if(!t.ok)throw Error(t.error||`Replan failed.`);c(`planning`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}},[e?.id,y]),E=(0,L.useCallback)(()=>{f(!0),setTimeout(()=>{u(!1),f(!1),t()},250)},[t]),{ref:D,handlers:O}=Sr({onDismiss:E,direction:`right`});(0,L.useEffect)(()=>{c(e?.state===`Planning`||e?.state===`Planned`?`planning`:e?.state===`Reviewing`||e?.state===`Reviewed`?`review`:`overview`),m(!1),g(null),v(null),e&&(u(!0),f(!1))},[e?.id,e?.state]);let k=(0,L.useCallback)(async()=>{if(!(!e?.id||p)){m(!0),g(null),v(null);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/merge`),n=typeof t?.copied?.length==`number`?t.copied.length:0,r=typeof t?.conflicts?.length==`number`?t.conflicts.length:0;v(r>0?`Merge completed with ${r} conflict${r===1?``:`s`}.`:`Merged ${n} file${n===1?``:`s`} into the project.`)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},[e?.id,p]),A=(0,L.useCallback)(async()=>{if(!(!e?.id||p)){m(!0),g(null),v(null);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/push`);if(!t.ok)throw Error(t.error||`Push failed.`);t.prUrl?(v(`Branch pushed. PR: ${t.prUrl}`),window.open(t.prUrl,`_blank`,`noopener`)):v(`Branch pushed to origin.`)}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},[e?.id,p]);if((0,L.useEffect)(()=>{if(!e||!l)return;let t=e=>{e.key===`Escape`&&E()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e?.id,l,E]),(0,L.useEffect)(()=>{C.current&&C.current.querySelector(`.tab-active`)?.scrollIntoView({behavior:`smooth`,inline:`center`,block:`nearest`})},[s]),!e&&!l)return null;let j=e?.state===`Planning`&&!e?.plan&&!e?.planningError&&e?.planningStatus!==`planning`;return(0,U.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/35 ${d?`animate-fade-out`:`animate-fade-in`}`,onClick:E,children:(0,U.jsxs)(`div`,{ref:D,className:`fixed top-0 right-0 z-50 h-full w-full md:w-[520px] lg:w-[600px] bg-base-100 shadow-2xl flex flex-col ${d?`animate-slide-out-right`:`animate-slide-in-right`}`,onClick:e=>e.stopPropagation(),...O,children:[(0,U.jsxs)(`div`,{className:`px-6 pt-4 pb-0 shrink-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs opacity-40 shrink-0`,children:e.identifier}),e.baseBranch&&(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[10px] font-mono opacity-40 shrink-0 border border-base-300 rounded px-1 py-0.5`,children:[(0,U.jsx)(G,{className:`size-2.5`}),e.baseBranch]}),e.state!==`Planning`&&e.plan&&![`Running`,`Reviewing`,`Queued`].includes(e.state)&&(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1 opacity-50 hover:opacity-100`,onClick:T,disabled:y||e.planningStatus===`planning`,title:`Archive current plan and request a new one`,children:[y?(0,U.jsx)(q,{className:`size-3 animate-spin`}):(0,U.jsx)(J,{className:`size-3`}),`Replan`]}),x&&(0,U.jsx)(`span`,{className:`text-xs text-error truncate`,children:x})]}),(0,U.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle shrink-0`,onClick:E,"aria-label":`Close`,children:(0,U.jsx)(X,{className:`size-4`})})]}),(0,U.jsxs)(`div`,{className:`flex items-start gap-2 mb-1`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-bold leading-tight flex-1`,children:e.title||`-`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 mt-0.5 flex-wrap justify-end`,children:[e.issueType&&Lr[e.issueType]&&(0,U.jsx)(`span`,{className:`badge badge-sm ${Lr[e.issueType]} badge-soft`,children:e.issueType}),(e.planVersion??0)>0&&(0,U.jsxs)(`span`,{className:`badge badge-sm badge-info badge-soft font-mono`,children:[`Plan v`,e.planVersion]}),(e.executeAttempt??0)>0&&(0,U.jsxs)(`span`,{className:`badge badge-sm badge-ghost font-mono opacity-60`,children:[`exec v`,e.planVersion??1,`a`,e.executeAttempt]})]})]}),e.description&&(0,U.jsx)(`p`,{className:`text-xs opacity-45 leading-relaxed mb-1 line-clamp-2`,children:e.description}),(0,U.jsx)(Gr,{issue:e}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`div`,{ref:C,role:`tablist`,className:`tabs tabs-lift overflow-x-auto -webkit-overflow-scrolling-touch scrollbar-none`,style:{scrollbarWidth:`none`},children:Vr(e.state).map(({id:t,label:n,icon:r})=>(0,U.jsxs)(`a`,{role:`tab`,className:`tab gap-1 text-xs whitespace-nowrap ${s===t?`tab-active`:``} ${t===`review`?`text-secondary font-semibold`:``}`,onClick:()=>c(t),children:[(0,U.jsx)(r,{className:`size-3`}),n,t===`review`&&(e.state===`Reviewing`||e.state===`Reviewed`)&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-secondary`,children:`!`}),t===`planning`&&e.planningStatus===`planning`&&(0,U.jsx)(`span`,{className:`loading loading-spinner loading-xs text-info`}),t===`planning`&&j&&(0,U.jsx)(`span`,{className:`loading loading-dots loading-xs text-info opacity-50`})]},t))}),(0,U.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-base-100 to-transparent pointer-events-none md:hidden`})]})]}),(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4 min-h-0 drawer-safe-bottom`,children:(0,U.jsxs)(`div`,{className:`animate-fade-in`,children:[s===`overview`&&(0,U.jsx)(Zr,{issue:e,onStateChange:n,onRetry:r,onCancel:i}),s===`planning`&&(0,U.jsx)(yi,{issue:e,onStateChange:n,workflowConfig:w}),s===`review`&&(0,U.jsx)(bi,{issue:e,issueId:e.id,onStateChange:n}),s===`execution`&&(0,U.jsx)($r,{issue:e,workflowConfig:w}),s===`diff`&&(0,U.jsx)(ri,{issueId:e.id}),s===`routing`&&(0,U.jsx)(oi,{issue:e}),s===`history`&&(0,U.jsx)(_i,{issue:e}),s===`events`&&(0,U.jsx)(gi,{issueId:e.id,events:a})]},s)}),(0,U.jsx)(xi,{issue:e,onStateChange:n,onMerge:k,onPush:A,mergeBusy:p,mergeError:h,mergeNotice:_,mergeMode:o})]})})}function Ci({pwa:e}){return e?e.updateAvailable?(0,U.jsxs)(`div`,{className:`alert alert-info rounded-none border-x-0`,children:[(0,U.jsx)(Fn,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`A fresh dashboard build is ready.`}),(0,U.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>e.applyUpdate(),children:`Reload app`})]}):e.isOnline?null:(0,U.jsxs)(`div`,{className:`alert alert-warning rounded-none border-x-0`,children:[(0,U.jsx)(tr,{className:`size-4`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`You are offline. The app shell is available, but live runtime data may be stale.`})]}):null}var wi=[`oklch(0.8 0.18 145)`,`oklch(0.8 0.18 250)`,`oklch(0.85 0.16 85)`,`oklch(0.75 0.18 330)`,`oklch(0.8 0.16 200)`];function Ti(e,t){return Math.random()*(t-e)+e}function Ei({color:e,style:t}){return(0,U.jsx)(`div`,{className:`absolute rounded-full pointer-events-none`,style:{width:t.size,height:t.size,backgroundColor:e,left:t.x,top:t.y,animation:`confetti-fly ${t.duration}ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards`,"--tx":t.tx,"--ty":t.ty,"--r":t.r,opacity:.9}})}function Di({x:e=`50%`,y:t=`50%`,active:n,onDone:r,count:i=24}){let[a,o]=(0,L.useState)([]),s=(0,L.useRef)(r);(0,L.useEffect)(()=>{s.current=r},[r]);let c=(0,L.useCallback)(()=>{let e=Array.from({length:i},(e,t)=>{let n=Math.PI*2*t/i+Ti(-.3,.3),r=Ti(40,120),a=Ti(4,8);return{id:t,color:wi[t%wi.length],size:a,x:0,y:0,tx:`${Math.cos(n)*r}px`,ty:`${Math.sin(n)*r-Ti(20,60)}px`,r:`${Ti(-180,180)}deg`,duration:Ti(600,1e3)}});o(e);let t=Math.max(...e.map(e=>e.duration));setTimeout(()=>{o([]),s.current?.()},t+50)},[i]);return(0,L.useEffect)(()=>{n&&c()},[n,c]),a.length===0?null:(0,U.jsx)(`div`,{className:`fixed pointer-events-none z-[100]`,style:{left:e,top:t,transform:`translate(-50%, -50%)`},children:a.map(e=>(0,U.jsx)(Ei,{color:e.color,style:e},e.id))})}function Oi(e){let t=(0,L.useRef)(e);t.current=e,(0,L.useEffect)(()=>{function e(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let n=e.target?.tagName;if((n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||e.target?.isContentEditable)&&e.key!==`Escape`)return;let r=t.current[e.key];r&&(e.preventDefault(),r())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}var ki=`modulepreload`,Ai=function(e){return`/assets/`+e},ji={},Mi=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=Ai(t,n),t in ji)return;ji[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`:ki,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)})},Ni=(0,L.lazy)(()=>Mi(()=>import(`./KeyboardShortcutsHelp-BB5jLK_E.js`),__vite__mapDeps([0,1,2,3])));function Pi({children:e}){let t=C().location.pathname,n=(0,L.useRef)(null),r=(0,L.useRef)(t);return(0,L.useEffect)(()=>{if(r.current===t)return;r.current=t;let e=n.current;if(e){if(document.startViewTransition){document.startViewTransition(()=>{e.style.opacity=`1`});return}e.style.opacity=`0`,e.style.transform=`translateY(4px)`,requestAnimationFrame(()=>{e.style.transition=`opacity 0.15s ease-out, transform 0.15s ease-out`,e.style.opacity=`1`,e.style.transform=`translateY(0)`,e.addEventListener(`transitionend`,()=>{e.style.transition=``},{once:!0})})}},[t]),(0,U.jsx)(`div`,{ref:n,className:`flex-1 flex flex-col min-h-0`,children:e})}function Fi(){let e=Et(),t=h(),[n,r]=(0,L.useState)(!1);(0,L.useEffect)(()=>{document.title=e.queueTitle||`fifony`},[e.queueTitle]);let i=(0,L.useCallback)(()=>{e.setIsCreateOpen(!1),e.setSelectedIssue(null),r(!1)},[e]);Oi((0,L.useMemo)(()=>({n:()=>e.setIsCreateOpen(!0),Escape:i,"?":()=>r(e=>!e),k:()=>t({to:`/kanban`}),i:()=>t({to:`/issues`}),a:()=>t({to:`/agents`}),t:()=>t({to:`/analytics`}),s:()=>t({to:`/settings`}),1:()=>{},2:()=>{},3:()=>{},4:()=>{},5:()=>{},6:()=>{}}),[e,t,i]));let[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(!1),l=(0,L.useRef)(null),u=e.runtime.isLoading&&!e.runtime.data&&!e.runtime.isError;if((0,L.useEffect)(()=>(!a&&!l.current&&(l.current=setTimeout(()=>{c(!0),setTimeout(()=>o(!0),400)},1e3)),()=>{}),[a]),!a&&u)return(0,U.jsx)(Ii,{});if(!a&&s)return(0,U.jsx)(Ii,{fadeOut:!0});if(!a&&!u)return(0,U.jsx)(Ii,{});let d=e.toast?.type||`info`,f=typeof e.toast==`string`?e.toast:e.toast?.message;return(0,U.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[e.toast&&(0,U.jsx)(`div`,{className:`toast toast-end toast-top z-50`,children:(0,U.jsxs)(`div`,{className:`alert text-sm shadow-lg ${d===`success`?`alert-success`:d===`error`?`alert-error`:`alert-info`} ${e.toastExiting?`animate-toast-out`:`animate-toast-in`}`,children:[d===`success`?(0,U.jsx)(Wt,{className:`size-4`}):d===`error`?(0,U.jsx)(Y,{className:`size-4`}):(0,U.jsx)(bn,{className:`size-4`}),(0,U.jsx)(`span`,{children:f}),(0,U.jsx)(`div`,{className:`toast-progress`})]})}),e.confetti&&(0,U.jsx)(Di,{x:e.confetti.x,y:e.confetti.y,count:e.confetti.count,active:!0,onDone:()=>e.clearConfetti?.()}),(0,U.jsx)(vr,{issueCount:e.issues.length,queueTitle:e.queueTitle,sourceRepo:e.data.sourceRepoUrl,updatedAt:e.data.updatedAt,wsStatus:e.wsStatus,notifications:e.notifications,issues:e.issues}),(0,U.jsx)(Ci,{pwa:e.pwa}),(0,U.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0`,children:[(0,U.jsx)(Pi,{children:(0,U.jsx)(O,{})}),e.runtime.isError&&(0,U.jsx)(`div`,{className:`px-4 pb-4`,children:(0,U.jsx)(`div`,{className:`alert alert-error`,children:String(e.runtime.error?.message||`Runtime unavailable`)})})]}),(0,U.jsx)(yr,{onClick:()=>e.setIsCreateOpen(!0)}),(0,U.jsx)(br,{}),(0,U.jsx)(wr,{open:e.isCreateOpen,onClose:()=>e.setIsCreateOpen(!1),onSubmit:t=>e.createIssue.mutate(t),isLoading:e.createIssue.isPending,onToast:e.showToast}),(0,U.jsx)(Si,{issue:e.selectedIssue,onClose:()=>e.setSelectedIssue(null),onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,mergeMode:e.data?.config?.mergeMode??`local`}),n&&(0,U.jsx)(L.Suspense,{fallback:null,children:(0,U.jsx)(Ni,{open:n,onClose:()=>r(!1)})})]})}function Ii({fadeOut:e=!1}){return(0,U.jsx)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col items-center justify-center overflow-hidden`,style:{opacity:e?0:1,transition:`opacity 0.4s ease-out`},children:(0,U.jsxs)(`div`,{className:`relative z-10 flex flex-col items-center gap-5`,children:[(0,U.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,U.jsx)(`img`,{src:`/dinofffaur.png`,alt:``,className:`h-20 sm:h-28 object-contain select-none pointer-events-none`,style:{filter:`drop-shadow(0 6px 20px rgba(128, 0, 255, 0.25))`,animation:`splash-dino 0.6s cubic-bezier(0.22, 1, 0.36, 1) both`}}),(0,U.jsx)(`h1`,{className:`text-4xl sm:text-5xl font-bold tracking-tight leading-none pb-1`,style:{fontFamily:`'Space Grotesk', system-ui, sans-serif`,animation:`splash-title 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both`},children:(0,U.jsx)(`span`,{className:`text-primary`,children:`fifony`})})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-base-content/40`,style:{animation:`splash-subtitle 0.4s ease-out 0.4s both`},children:[(0,U.jsx)(`span`,{className:`loading loading-dots loading-sm`}),(0,U.jsx)(`span`,{className:`text-sm`,children:`Warming up the orchestra...`})]})]})})}function Li({children:e}){let t=Ue(),n=Be(ze(t.data),`ui.onboarding.completed`,null);return t.isLoading&&!t.data?(0,U.jsx)(Ii,{}):t.isError||n===!0?e:(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(Ii,{}),children:(0,U.jsx)(Ri,{})})}function Ri(){let e=h(),t=(0,L.useRef)(!1);return(0,L.useEffect)(()=>{t.current||(t.current=!0,e({to:`/onboarding`,replace:!0}))},[e]),(0,U.jsx)(Ii,{})}function zi(){return C().location.pathname===`/onboarding`?(0,U.jsx)(O,{}):(0,U.jsx)(Li,{children:(0,U.jsx)(Dt,{children:(0,U.jsx)(Fi,{})})})}function Bi(e){return e?e.split(`
|
|
43
|
+
`).slice(1).map(e=>e.trim()).filter(e=>e.startsWith(`at `)).map(e=>{let t=e.match(/^at (.+?) \((.+):(\d+):(\d+)\)$/),n=e.match(/^at (.+):(\d+):(\d+)$/);return t?{fn:t[1],file:t[2],line:t[3],col:t[4]}:n?{fn:null,file:n[1],line:n[2],col:n[3]}:{fn:null,file:e,line:null,col:null}}):[]}function Vi(e){if(!e)return e;try{let t=new URL(e);return t.pathname+(t.searchParams.toString()?`?`+t.searchParams:``)}catch{return e}}function Hi({text:e}){let[t,n]=(0,L.useState)(!1);return(0,U.jsx)(`button`,{className:`btn btn-xs btn-ghost gap-1 font-mono ${t?`text-success`:`opacity-50 hover:opacity-100`}`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},children:t?`✓ copied`:`copy`})}function Ui({error:e,reset:t}){let[n,r]=(0,L.useState)(!0),[i,a]=(0,L.useState)(!1),o=e?.name||`Error`,s=e?.message||String(e)||`An unexpected error occurred.`,c=e?.stack||``,l=Bi(c),u=window.location.pathname,d=new Date().toLocaleTimeString(),f=navigator.userAgent,p=`${o}: ${s}\n\nRoute: ${u}\nTime: ${new Date().toISOString()}\n\n${c}`,m=l.filter(e=>e.file&&!e.file.includes(`node_modules`)&&!e.file.includes(`chunk-`)&&!e.file.includes(`vendor-`))[0]||l[0];return(0,U.jsxs)(`div`,{className:`min-h-screen bg-base-200 flex flex-col`,children:[(0,U.jsxs)(`div`,{className:`bg-error text-error-content px-4 py-2.5 flex items-center gap-3 shrink-0`,children:[(0,U.jsx)(Y,{className:`size-4 shrink-0`}),(0,U.jsxs)(`span`,{className:`font-mono text-sm font-semibold flex-1 truncate`,children:[o,`: `,s]}),(0,U.jsx)(`span`,{className:`text-xs opacity-60 shrink-0`,children:d})]}),(0,U.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row gap-0 min-h-0 overflow-auto`,children:[(0,U.jsxs)(`div`,{className:`flex-1 p-6 space-y-5 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,U.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Error`}),(0,U.jsx)(Hi,{text:p})]}),(0,U.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`badge badge-error badge-sm mt-0.5 shrink-0 font-mono`,children:o}),(0,U.jsx)(`p`,{className:`font-mono text-sm text-error leading-relaxed break-all`,children:s})]}),m&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-base-content/50`,children:[(0,U.jsx)(`span`,{className:`opacity-40`,children:`at`}),(0,U.jsx)(`span`,{className:`font-mono font-semibold text-base-content/70`,children:m.fn||`<anonymous>`}),(0,U.jsx)(`span`,{className:`opacity-30`,children:`—`}),(0,U.jsx)(`span`,{className:`font-mono`,children:Vi(m.file)}),m.line&&(0,U.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`:`,m.line,`:`,m.col]})]})]})]}),(0,U.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,U.jsx)(`div`,{className:`px-5 py-3 border-b border-base-300`,children:(0,U.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Context`})}),(0,U.jsx)(`div`,{className:`divide-y divide-base-200`,children:[{label:`Route`,value:u},{label:`Time`,value:new Date().toISOString()},{label:`User Agent`,value:f}].map(({label:e,value:t})=>(0,U.jsxs)(`div`,{className:`px-5 py-2.5 flex items-start gap-4`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold opacity-40 w-24 shrink-0 pt-0.5`,children:e}),(0,U.jsx)(`span`,{className:`font-mono text-xs break-all text-base-content/70`,children:t})]},e))})]}),l.length>0&&(0,U.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,U.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`button`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-40 hover:opacity-70 transition-opacity`,onClick:()=>r(e=>!e),children:[(0,U.jsx)(Ht,{className:`size-3.5 transition-transform ${n?`rotate-180`:``}`}),`Stack trace`,(0,U.jsxs)(`span`,{className:`badge badge-xs badge-ghost normal-case tracking-normal font-mono`,children:[l.length,` frames`]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-50 hover:opacity-100 ${i?`btn-active`:``}`,onClick:()=>a(e=>!e),children:`raw`}),(0,U.jsx)(Hi,{text:c})]})]}),n&&(i?(0,U.jsx)(`pre`,{className:`px-5 py-4 text-[11px] font-mono leading-relaxed text-base-content/60 overflow-x-auto whitespace-pre-wrap`,children:c}):(0,U.jsx)(`div`,{className:`divide-y divide-base-200`,children:l.map((e,t)=>{let n=e.file&&!e.file.includes(`node_modules`)&&!e.file.includes(`chunk-`)&&!e.file.includes(`vendor-`),r=Vi(e.file);return(0,U.jsxs)(`div`,{className:`px-5 py-2 flex items-start gap-3 ${n?`bg-warning/5`:`opacity-40`}`,children:[(0,U.jsx)(`span`,{className:`font-mono text-[10px] opacity-30 w-5 shrink-0 text-right pt-0.5`,children:t}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[e.fn&&(0,U.jsx)(`span`,{className:`font-mono text-xs font-semibold ${n?`text-warning`:`text-base-content/60`}`,children:e.fn}),n&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-warning badge-soft`,children:`app`})]}),(0,U.jsxs)(`div`,{className:`font-mono text-[10px] text-base-content/40 truncate`,children:[r,e.line&&(0,U.jsxs)(`span`,{className:`text-base-content/60 ml-0.5`,children:[`:`,e.line,`:`,e.col]})]})]})]},t)})}))]})]}),(0,U.jsxs)(`div`,{className:`lg:w-64 p-6 space-y-4 shrink-0`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`button`,{className:`btn btn-primary w-full gap-2`,onClick:()=>window.location.reload(),children:[(0,U.jsx)(J,{className:`size-4`}),` Reload page`]}),t&&(0,U.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:t,children:`Try to recover`}),(0,U.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:()=>{window.location.href=`/`},children:`Go home`})]}),(0,U.jsx)(`div`,{className:`divider text-xs opacity-30`,children:`about`}),(0,U.jsxs)(`div`,{className:`space-y-1 text-xs text-base-content/40`,children:[(0,U.jsx)(`p`,{children:`This error was caught by the app's error boundary. The details above will help you identify the root cause.`}),(0,U.jsxs)(`p`,{className:`mt-2`,children:[`App frames are `,(0,U.jsx)(`span`,{className:`text-warning font-semibold`,children:`highlighted`}),`.`]})]})]})]})]})}var Wi=E({component:zi,errorComponent:Ui}),Gi=[{to:`/settings/general`,label:`General`,icon:An},{to:`/settings/workflow`,label:`Workflow`,icon:fn},{to:`/settings/notifications`,label:`Notifications`,icon:Ft},{to:`/settings/providers`,label:`Providers`,icon:nn}],Ki=b(`/settings`)({component:qi});function qi(){let e=C().location.pathname;return(0,U.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,U.jsxs)(`div`,{className:`max-w-5xl w-full mx-auto flex-1 flex flex-col min-h-0 gap-5`,children:[(0,U.jsx)(`div`,{role:`tablist`,className:`tabs tabs-lift`,children:Gi.map(({to:t,label:n,icon:r})=>(0,U.jsxs)(k,{to:t,role:`tab`,className:`tab gap-1.5 ${e.startsWith(t)?`tab-active`:``}`,children:[(0,U.jsx)(r,{className:`size-3.5`}),n]},t))}),(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,U.jsx)(O,{})})]})})}var Ji=(0,L.lazy)(()=>Mi(()=>import(`./OnboardingWizard-xyM3Okjv.js`),__vite__mapDeps([4,1,2,3])));function Yi(){let e=h(),t=w();return(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,U.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,U.jsx)(Ji,{onComplete:()=>{t.invalidateQueries({queryKey:H}),e({to:`/`})}})})}var Xi=b(`/onboarding`)({component:Yi});function Zi(e){let[t,n]=(0,L.useState)(()=>Qi(e)),r=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(!e){n(null);return}let t=()=>n(Qi(e));t();let i=new Date(e).getTime(),a=()=>Date.now()-i<12e4?1e3:5e3,o=()=>{t(),clearInterval(r.current),r.current=setInterval(o,a())};return r.current=setInterval(o,a()),()=>clearInterval(r.current)},[e]),t}function Qi(e){if(!e)return null;let t=new Date(e).getTime();if(Number.isNaN(t))return null;let n=Math.max(0,Date.now()-t);return n<1e3?`0s`:n<6e4?`${Math.floor(n/1e3)}s`:n<36e5?`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`:`${Math.floor(n/36e5)}h ${Math.floor(n%36e5/6e4)}m`}var $i={bug:`badge-error`,feature:`badge-primary`,refactor:`badge-warning`,docs:`badge-info`,chore:`badge-secondary`},ea={Planning:`border-l-info`,Planned:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Reviewing:`border-l-secondary`,Reviewed:`border-l-success/60`,Blocked:`border-l-error`,Done:`border-l-success`,Cancelled:`border-l-neutral`};function ta(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function na(e){if(!e)return null;let t=e.match(/\d+$/);return t?t[0]:null}function ra(e){if(!e)return null;let t=e.match(/claude-(\w+)-(\d+)-(\d+)/);return t?`${t[1].charAt(0).toUpperCase()+t[1].slice(1)} ${t[2]}.${t[3]}`:e.length<=14?e:e.slice(0,14)}function ia(e,t){let n=[{key:`planner`,short:`plan`},{key:`executor`,short:`exec`},{key:`reviewer`,short:`rev`}].filter(t=>(e?.[t.key]?.totalTokens||0)>0).map(n=>({label:n.short,model:ra(e[n.key]?.model||null),effort:t?.[n.key]||t?.default||null})).filter(e=>e.model);return n.length===0?[]:n.every(e=>e.model===n[0].model&&e.effort===n[0].effort)?[{label:null,model:n[0].model,effort:n[0].effort}]:n}function aa(e){return e?e.reviewer?.totalTokens>0?`reviewing`:e.executor?.totalTokens>0?`executing`:e.planner?.totalTokens>0?`planning`:null:null}function oa(e){if(e<=0)return`<1m`;let t=Math.floor(e/6e4),n=Math.floor(t/60),r=Math.floor(n/24);return r>0?`${r}d${n%24}h`:n>0?`${n}h${t%60}m`:`${t}m`}function sa(e){return e.state===`Reviewing`?e.updatedAt:e.state===`Reviewed`?e.completedAt||e.updatedAt:e.state===`Blocked`?e.updatedAt:null}function ca(e){let{state:t,planningStatus:n,assignedToWorker:r,startedAt:i,tokenUsage:a,tokensByPhase:o}=e;switch(t){case`Planning`:return n===`planning`?{label:`Writing plan…`,Icon:q,spin:!0,pulse:!1,color:`text-info`}:e.plan?{label:`Plan ready`,Icon:K,spin:!1,pulse:!1,color:`text-info/60`}:e.planningError?{label:`Plan failed`,Icon:Y,spin:!1,pulse:!1,color:`text-error`}:{label:`Aguardando…`,Icon:Qt,spin:!1,pulse:!0,color:`text-info/50`};case`Planned`:return null;case`Queued`:return r?{label:`Starting…`,Icon:Mn,spin:!1,pulse:!0,color:`text-primary/80`}:{label:`In queue`,Icon:wn,spin:!1,pulse:!1,color:`text-base-content/40`};case`Running`:{let e=aa(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning…`,Icon:q,spin:!0,pulse:!1,color:`text-primary`}:t?e===`reviewing`?{label:`Reviewing…`,Icon:W,spin:!1,pulse:!0,color:`text-secondary`}:e===`planning`?{label:`Planning…`,Icon:K,spin:!1,pulse:!0,color:`text-info`}:{label:`Working…`,Icon:Mn,spin:!1,pulse:!0,color:`text-primary`}:{label:`Starting…`,Icon:q,spin:!0,pulse:!1,color:`text-primary`}}case`Reviewing`:case`Reviewed`:case`Blocked`:return`stall`;default:return null}}function la(e){let[t,n]=(0,L.useState)(()=>e?Math.max(0,Date.now()-new Date(e).getTime()):0);return(0,L.useEffect)(()=>{if(!e)return;let t=new Date(e).getTime(),r=()=>n(Math.max(0,Date.now()-t));r();let i=()=>Date.now()-t<36e5?3e4:12e4,a=setInterval(()=>{r(),clearInterval(a),a=setInterval(r,i())},i());return()=>clearInterval(a)},[e]),t}function ua({issue:e}){let t=ca(e),n=sa(e),r=la(t===`stall`?n:null),i=Zi(t&&t!==`stall`&&e.state===`Running`?e.startedAt:null);if(!t)return null;if(t===`stall`){if(!n)return null;let t=e.state===`Blocked`?`text-error/70`:e.state===`Reviewed`?`text-success/70`:`text-secondary/70`,i=e.state===`Blocked`?`blocked`:e.state===`Reviewed`?`review complete`:`reviewing`;return(0,U.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] font-medium ${t}`,children:[(0,U.jsx)(Qt,{size:10,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`tabular-nums font-mono`,children:oa(r)}),(0,U.jsxs)(`span`,{className:`opacity-60 font-normal`,children:[`· `,i]})]})}let{label:a,Icon:o,spin:s,pulse:c,color:l}=t;return(0,U.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] ${l}`,children:[o&&(0,U.jsx)(o,{size:10,className:[s?`animate-spin`:``,c?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,U.jsx)(`span`,{className:`font-medium truncate`,children:a}),i&&(0,U.jsx)(`span`,{className:`font-mono opacity-50 tabular-nums shrink-0 ml-0.5`,children:i})]})}function da({issue:e,onSelect:t,dragHandlers:n,isDragging:r,isSelected:i,onToggleSelect:a,hasSelection:o}){let s=e.state===`Running`,c=e.state===`Planning`,l=e.state===`Done`,u=e.state===`Cancelled`,d=e.state===`Blocked`,f=e.planningStatus===`planning`,p=!!e.mergedAt,m=e.mergeResult?.conflicts>0,h=!p&&!m&&!!e.branchName&&(l||e.state===`Reviewed`),g=(0,L.useRef)(e.tokenUsage?.totalTokens),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(!1),x=(0,L.useRef)(e.state);(0,L.useEffect)(()=>{let t=e.tokenUsage?.totalTokens;if(t!=null&&t!==g.current){v(!0);let e=setTimeout(()=>v(!1),300);return g.current=t,()=>clearTimeout(e)}},[e.tokenUsage?.totalTokens]),(0,L.useEffect)(()=>{if(x.current!==`Done`&&e.state===`Done`){b(!0);let t=setTimeout(()=>b(!1),800);return x.current=e.state,()=>clearTimeout(t)}x.current=e.state},[e.state]);let S=na(e.identifier),C=ta(e.tokenUsage?.totalTokens||0),w=e.history?.length||0,T=ia(e.tokensByPhase,e.effort),E=n=>{if(n.shiftKey){n.preventDefault(),a?.(e.id);return}if(o){n.preventDefault(),a?.(e.id);return}t?.(e)},D=n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),n.shiftKey||o?a?.(e.id):t?.(e))};return(0,U.jsxs)(`div`,{"data-issue-id":e.id,className:[`card card-compact bg-base-100 border border-l-[3px] relative`,i?`border-primary ring-2 ring-primary/30 border-base-300`:`border-base-300`,ea[e.state]||``,c?`animate-pulse-soft-border`:``,s?`animate-pulse-border`:``,l?`opacity-70`:``,u?`opacity-45`:``,d?`issue-card-blocked`:``,!l&&!u?`card-interactive`:``,`cursor-pointer`,r?`kanban-card-source-opacity`:``,y?`issue-card-done-flash`:``].filter(Boolean).join(` `),style:{overflow:`hidden`},role:`button`,tabIndex:0,onClick:E,onKeyDown:D,"aria-label":`${i?`Deselect`:`Open`} issue ${e.identifier}`,"aria-selected":i,...n||{},children:[S&&(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`absolute right-0 bottom-0 select-none pointer-events-none font-black leading-none`,style:{fontSize:S.length<=2?`5rem`:S.length<=4?`3.75rem`:`2.75rem`,opacity:u?.12:l?.09:.055,lineHeight:.82,paddingRight:`2px`},children:S}),(i||o)&&(0,U.jsx)(`div`,{className:`absolute top-1.5 left-1.5 z-10`,children:(0,U.jsx)(`div`,{className:`size-5 rounded flex items-center justify-center transition-all ${i?`bg-primary text-primary-content`:`bg-base-300/60 border border-base-content/20`}`,children:i&&(0,U.jsx)(Hn,{size:14})})}),(0,U.jsxs)(`div`,{className:`card-body gap-1 p-3 relative`,children:[(0,U.jsx)(`div`,{className:o?`pl-5`:``,children:(0,U.jsx)(ua,{issue:e})}),(0,U.jsx)(`h3`,{className:[`font-semibold text-sm leading-snug`,u?`line-through opacity-40`:``].filter(Boolean).join(` `),children:e.title}),T.length>0&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-35 truncate`,children:T.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 shrink-0`,children:[e.label&&(0,U.jsx)(`span`,{className:`opacity-50 uppercase tracking-wide`,style:{fontSize:`8px`},children:e.label}),(0,U.jsx)(`span`,{children:e.model}),e.effort&&(0,U.jsxs)(`span`,{className:`opacity-60`,children:[`·`,e.effort]})]},e.label??`single`))}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-40 mt-0.5`,children:[e.issueType&&$i[e.issueType]&&(0,U.jsx)(`span`,{className:`badge badge-xs ${$i[e.issueType]} badge-soft shrink-0`,children:e.issueType}),e.planVersion>1&&(0,U.jsxs)(`span`,{className:`badge badge-xs badge-info badge-soft shrink-0 font-mono`,children:[`v`,e.planVersion]}),C&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 ${_?`animate-count-bump`:``}`,children:[(0,U.jsx)(Z,{size:9}),C]}),w>0&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,U.jsx)(Ot,{size:9}),w]}),(0,U.jsx)(`span`,{className:`shrink-0`,children:R(e.createdAt)}),m&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-error font-semibold ml-auto shrink-0 opacity-100`,children:[(0,U.jsx)(Yt,{size:10}),`merge failed`]}),h&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-semibold ml-auto shrink-0 opacity-100 animate-pulse`,children:[(0,U.jsx)(pn,{size:10}),`ready to merge`]}),p&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-success font-semibold ml-auto shrink-0 opacity-100`,children:[(0,U.jsx)(G,{size:10}),`merged`]})]})]}),s&&(0,U.jsx)(`div`,{className:`issue-heartbeat-bar animate-pulse-soft`}),f&&(0,U.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-info animate-pulse-soft`}),c&&!f&&!e.plan&&!e.planningError&&(0,U.jsx)(`div`,{className:`h-[2px] rounded-b-[var(--rounded-box,1rem)] bg-info/20 animate-pulse`}),m&&(0,U.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-error animate-pulse`}),h&&(0,U.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-warning animate-pulse-soft`}),p&&(0,U.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-success`})]})}function fa({icon:e=yn,title:t=`Nothing here`,description:n=``,action:r,actionLabel:i=`Action`}){return(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 opacity-60 animate-fade-in-up`,children:[(0,U.jsx)(e,{className:`size-12 mb-4 opacity-40`}),(0,U.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:t}),n&&(0,U.jsx)(`p`,{className:`text-sm opacity-70 text-center max-w-xs`,children:n}),r&&(0,U.jsx)(`button`,{className:`btn btn-sm btn-primary mt-4`,onClick:r,children:i})]})}var pa={Planning:[`Planning`,`Planned`],"In Progress":[`Queued`,`Running`],Reviewing:[`Reviewing`,`Reviewed`],Blocked:[`Blocked`],Done:[`Done`],Cancelled:[`Cancelled`]},ma=new Set([`Planning`,`Planned`]),ha=new Set([`Queued`,`Running`]),ga=new Set([`Reviewing`,`Reviewed`]);function _a(e){return ma.has(e)?`Planning`:ha.has(e)?`In Progress`:ga.has(e)?`Reviewing`:e}function va(e){let t=he[e];if(!t)return new Set;let n=new Set(t.map(e=>_a(e)));return n.delete(_a(e)),n}var ya=300,ba=5;function xa({onStateChange:e}){let[t,n]=(0,L.useState)(null),r=(0,L.useRef)(null),i=(0,L.useRef)({pointerId:null,startX:0,startY:0,isDragging:!1,longPressTimer:null,longPressReady:!1,pointerType:null,issue:null,sourceColumn:null,didDrag:!1}),a=(0,L.useRef)(null),o=(0,L.useRef)(new Map);(0,L.useEffect)(()=>()=>{clearTimeout(i.current.longPressTimer)},[]);let s=(0,L.useCallback)((e,t)=>{let n=r.current;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)},[]),c=(0,L.useCallback)((e,t)=>{for(let[n,r]of o.current.entries()){let i=r.getBoundingClientRect();if(e>=i.left&&e<=i.right&&t>=i.top&&t<=i.bottom)return n}return null},[]),l=(0,L.useCallback)((e,t,r,a)=>{let o=va(e.state);i.current.isDragging=!0,n({issueId:e.id,issue:e,sourceColumn:t,validColumns:o,overColumn:null}),s(r,a)},[s]),u=(0,L.useCallback)(()=>{let e=i.current.isDragging;clearTimeout(i.current.longPressTimer),i.current.isDragging=!1,i.current.longPressReady=!1,i.current.pointerId=null,i.current.issue=null,i.current.didDrag=e,e&&requestAnimationFrame(()=>{i.current.didDrag=!1}),n(null)},[]),d=(0,L.useCallback)(n=>{if(t){if(t.validColumns.has(n)){let r=he[t.issue.state]||[],i=new Set(pa[n]||[]),a=r.find(e=>i.has(e));a&&e(t.issueId,a)}u()}},[t,e,u]),f=(0,L.useCallback)((e,t)=>{t?o.current.set(e,t):o.current.delete(e)},[]);return{dragState:t,ghostRef:r,boardRef:a,getCardHandlers:(0,L.useCallback)((e,t)=>({onPointerDown:n=>{n.button===0&&(n.target.closest(`a, button`)||(i.current.pointerId=n.pointerId,i.current.startX=n.clientX,i.current.startY=n.clientY,i.current.pointerType=n.pointerType,i.current.issue=e,i.current.sourceColumn=t,i.current.longPressReady=!1,n.pointerType===`touch`&&(i.current.longPressTimer=setTimeout(()=>{i.current.longPressReady=!0,navigator.vibrate&&navigator.vibrate(30),l(e,t,n.clientX,n.clientY)},ya))))}}),[l]),registerColumn:f,onBoardPointerMove:(0,L.useCallback)(e=>{let t=i.current;if(t.pointerId==null||e.pointerId!==t.pointerId)return;let r=e.clientX-t.startX,a=e.clientY-t.startY,o=Math.sqrt(r*r+a*a);if(!t.isDragging)if(t.pointerType===`touch`){if(o>ba&&!t.longPressReady){clearTimeout(t.longPressTimer),t.pointerId=null;return}if(!t.longPressReady)return}else{if(o<ba)return;l(t.issue,t.sourceColumn,e.clientX,e.clientY)}e.preventDefault(),s(e.clientX,e.clientY);let u=c(e.clientX,e.clientY);n(e=>!e||e.overColumn===u?e:{...e,overColumn:u})},[l,s,c]),onBoardPointerUp:(0,L.useCallback)(e=>{let t=i.current;if(t.pointerId==null||e.pointerId!==t.pointerId)return;if(clearTimeout(t.longPressTimer),!t.isDragging){t.pointerId=null;return}let n=c(e.clientX,e.clientY);n?d(n):u()},[c,d,u]),onBoardPointerCancel:(0,L.useCallback)(()=>{u()},[u]),cancelDrag:u,shouldSuppressClick:(0,L.useCallback)(()=>i.current.didDrag||i.current.isDragging,[])}}function Sa({count:e,className:t}){let n=(0,L.useRef)(e),[r,i]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(n.current!==e){n.current=e,i(!0);let t=setTimeout(()=>i(!1),300);return()=>clearTimeout(t)}},[e]),e===0?null:(0,U.jsx)(`span`,{className:`badge badge-xs ${t} ${r?`animate-count-bump`:``}`,children:e})}var Ca=[`Planning`,`In Progress`,`Reviewing`,`Blocked`,`Done`,`Cancelled`],wa=new Set([`Planning`,`Planned`]),Ta=new Set([`Queued`,`Running`]),Ea=new Set([`Reviewing`,`Reviewed`]),Da={Planning:`badge-info`,"In Progress":`badge-primary`,Reviewing:`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},Oa={Planning:{borderTopColor:`color-mix(in oklab, var(--color-info) 40%, transparent)`},"In Progress":{borderTopColor:`color-mix(in oklab, var(--color-primary) 50%, transparent)`},Reviewing:{borderTopColor:`color-mix(in oklab, var(--color-secondary) 40%, transparent)`},Blocked:{borderTopColor:`color-mix(in oklab, var(--color-error) 40%, transparent)`},Done:{borderTopColor:`color-mix(in oklab, var(--color-success) 40%, transparent)`},Cancelled:{borderTopColor:`color-mix(in oklab, var(--color-base-content) 15%, transparent)`}},ka={Planning:`var(--color-info)`,"In Progress":`var(--color-primary)`,Reviewing:`var(--color-secondary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`,Cancelled:void 0},Aa={Planning:`var(--color-info)`,"In Progress":`var(--color-primary)`,Reviewing:`var(--color-secondary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`,Cancelled:`color-mix(in oklab, var(--color-base-content) 30%, transparent)`},ja={Planning:{icon:K,desc:`Create an issue to start planning`},"In Progress":{icon:Mn,desc:`Issues move here when agents start`},Reviewing:{icon:W,desc:`Awaiting review`},Blocked:{icon:Y,desc:`Needs attention`},Done:{icon:Wt,desc:`Completed`},Cancelled:{icon:Yt,desc:`Cancelled`}};function Ma({delay:e=0}){return(0,U.jsx)(`div`,{className:`skeleton-card h-20 w-full rounded-lg`,style:{animationDelay:`${e}ms`}})}function Na({dragState:e,ghostRef:t}){if(!e)return null;let{issue:n}=e;return(0,U.jsx)(`div`,{ref:t,className:`drag-ghost`,"aria-hidden":`true`,children:(0,U.jsxs)(`div`,{className:`card card-compact bg-base-100 border border-primary border-l-[3px] shadow-2xl p-3 w-56`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:n.identifier}),(0,U.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:n.title})]})})}function Pa({onCreateIssue:e}){return(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 px-3 animate-fade-in-up`,children:[(0,U.jsx)(`div`,{className:`bg-primary/10 rounded-full p-4 mb-3 animate-pulse-soft`,children:(0,U.jsx)(K,{className:`size-8 text-primary`})}),(0,U.jsx)(`h3`,{className:`text-sm font-semibold mb-1`,children:`Start here`}),(0,U.jsx)(`p`,{className:`text-xs opacity-50 text-center mb-3`,children:`Create your first issue to begin`}),e&&(0,U.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:e,children:[(0,U.jsx)(Nn,{className:`size-3.5`}),`New Issue`]})]})}function Fa({issue:e,onClose:t,onStateChange:n,onSelect:r}){let i=B(e.state).filter(t=>t!==e.state);return(0,L.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50 animate-fade-in`,onClick:t}),(0,U.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50 bg-base-100 rounded-t-2xl shadow-2xl animate-slide-up-sheet`,style:{paddingBottom:`env(safe-area-inset-bottom)`},onClick:e=>e.stopPropagation(),children:[(0,U.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,U.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,U.jsxs)(`div`,{className:`px-4 py-2 border-b border-base-300`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,U.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,U.jsxs)(`div`,{className:`p-3 space-y-1`,children:[(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{r(e),t()},children:[(0,U.jsx)(W,{className:`size-4`}),` View Details`]}),i.length>0&&(0,U.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide opacity-40 px-3 pt-2`,children:`Move to`}),i.map(r=>(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{n(e.id,r),t()},children:[(0,U.jsx)(jt,{className:`size-4`}),` `,r]},r))]}),(0,U.jsx)(`div`,{className:`p-3 pt-0`,children:(0,U.jsx)(`button`,{className:`btn btn-ghost btn-sm w-full`,onClick:t,children:`Cancel`})})]})]})}function Ia({columns:e,activeIndex:t}){return(0,U.jsx)(`div`,{className:`kanban-dots md:hidden`,children:e.map((e,n)=>(0,U.jsx)(`div`,{className:`kanban-dot ${n===t?`active`:``}`,style:{backgroundColor:Aa[e]}},e))})}var La={Done:20,Cancelled:12};function Ra({col:e,issues:t,empty:n,badgeClass:r,dragState:i,registerColumn:a,getCardHandlers:o,onSelect:s,onCreateIssue:c,lastDroppedId:l,hasRunningAgents:u,totalIssues:d,onLongPress:f,selectedIds:p,onToggleSelect:m,hasSelection:h}){let g=(0,L.useRef)(null),[_,v]=(0,L.useState)(!1);(0,L.useEffect)(()=>(a(e,g.current),()=>a(e,null)),[e,a]);let y=i!=null,b=i?.overColumn===e,x=i?.sourceColumn===e,S=i?.validColumns?.has(e)??!1,C=y&&!S&&!x,w=t.length===0,T=w&&e!==`Planning`&&d===0,E=La[e],D=E!=null&&t.length>E,O=D&&!_?t.slice(0,E):t,k=t.length-O.length,A=`kanban-column bg-base-200 rounded-box p-3 flex flex-col min-h-0 overflow-hidden`;T&&(A+=` kanban-column-collapsed`),y&&(b&&S?A+=` kanban-column-drop-valid`:b&&!S?A+=` kanban-column-drop-invalid`:C&&(A+=` kanban-column-dimmed`));let j={borderTop:`3px solid transparent`,...Oa[e]||{},...T?{alignSelf:`start`}:{}};return(0,U.jsxs)(`div`,{ref:g,className:A,style:j,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,U.jsxs)(`h3`,{className:`text-xs font-semibold tracking-wide flex items-center gap-1.5`,style:{color:ka[e],fontFamily:`'Space Grotesk', system-ui, sans-serif`},children:[e,e===`In Progress`&&u&&(0,U.jsx)(`span`,{className:`issue-phase-dot`,title:`Agents working`})]}),(0,U.jsx)(Sa,{count:t.length,className:r})]}),!T&&(0,U.jsx)(`div`,{className:`space-y-2 flex-1 overflow-y-auto kanban-card-list`,children:w?b&&S?(0,U.jsx)(`div`,{className:`kanban-drop-placeholder`}):e===`Planning`&&d===0?(0,U.jsx)(Pa,{onCreateIssue:c}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center py-6 opacity-30`,children:[(0,U.jsx)(n.icon,{className:`size-5 mb-1`}),(0,U.jsx)(`span`,{className:`text-[10px]`,children:n.desc})]}):(0,U.jsxs)(`div`,{className:`stagger-children space-y-2`,children:[O.map(t=>{let n=i?.issueId===t.id,r=l===t.id;return(0,U.jsx)(`div`,{className:`${n?`kanban-card-dragging-source`:``} ${r?`animate-pop`:``}`,onContextMenu:e=>{`ontouchstart`in window&&(e.preventDefault(),f?.(t))},children:(0,U.jsx)(da,{issue:t,onSelect:s,dragHandlers:o(t,e),isDragging:n,isSelected:p?.has(t.id),onToggleSelect:m,hasSelection:h})},t.id)}),D&&(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50 hover:opacity-80`,onClick:e=>{e.stopPropagation(),v(!_)},children:[(0,U.jsx)(Ht,{className:`size-3 transition-transform ${_?`rotate-180`:``}`}),_?`Show less`:`+${k} more`]}),b&&S&&(0,U.jsx)(`div`,{className:`kanban-drop-placeholder`})]})})]},e)}function za(e,t){let n=t.filter(t=>e.has(t.id));if(n.length===0)return[];let r=n.map(e=>{let t=he[e.state]||[];return new Set(t.filter(t=>t!==e.state))});return[...r[0]].filter(e=>r.every(t=>t.has(e)))}function Ba({count:e,transitions:t,onBulkAction:n,onClear:r}){return(0,U.jsxs)(`div`,{className:`fixed bottom-4 left-1/2 -translate-x-1/2 z-40 bg-base-100 border border-base-300 rounded-box shadow-2xl px-4 py-2.5 flex items-center gap-3 animate-slide-up-sheet`,role:`toolbar`,"aria-label":`Bulk actions`,children:[(0,U.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:t.map(e=>(0,U.jsxs)(`button`,{className:`btn btn-sm btn-outline gap-1`,onClick:()=>n(e),children:[(0,U.jsx)(jt,{className:`size-3`}),e]},e))}),(0,U.jsx)(`div`,{className:`divider divider-horizontal mx-0`}),(0,U.jsxs)(`span`,{className:`text-sm font-medium whitespace-nowrap opacity-70`,children:[e,` selected`]}),(0,U.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:r,"aria-label":`Clear selection`,children:(0,U.jsx)(X,{className:`size-4`})})]})}function Va({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,onCreateIssue:a,isLoading:o}){let[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(0),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(()=>new Set),h=(0,L.useRef)(null),g=p.size>0,_=(0,L.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,L.useCallback)(()=>{m(new Set)},[]);(0,L.useEffect)(()=>{if(!g)return;let e=e=>{e.key===`Escape`&&v()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g,v]),(0,L.useEffect)(()=>{if(!g)return;let t=new Set(e.map(e=>e.id));m(e=>{let n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[e,g]);let y=(0,L.useMemo)(()=>za(p,e),[p,e]),b=(0,L.useCallback)(e=>{for(let n of p)t(n,e);v()},[p,t,v]),x=(0,L.useMemo)(()=>{let t=Object.fromEntries(Ca.map(e=>[e,[]]));for(let n of e){let e;e=wa.has(n.state)?`Planning`:Ta.has(n.state)?`In Progress`:Ea.has(n.state)?`Reviewing`:t[n.state]?n.state:`Planning`,t[e].push(n)}for(let e of Ca)t[e].sort((e,t)=>e.priority-t.priority);return t},[e]),S=(0,L.useMemo)(()=>e.some(e=>e.state===`Running`),[e]),C=(0,L.useCallback)((e,n)=>{c(e);let r=setTimeout(()=>c(null),400);return t(e,n),()=>clearTimeout(r)},[t]),{dragState:w,ghostRef:T,getCardHandlers:E,registerColumn:D,onBoardPointerMove:O,onBoardPointerUp:k,onBoardPointerCancel:A,shouldSuppressClick:j}=xa({onStateChange:C}),M=(0,L.useCallback)(e=>{j()||i?.(e)},[i,j]);(0,L.useEffect)(()=>{let e=h.current;if(!e)return;let t=e.querySelector(`.grid, [class*='grid']`);if(!t)return;let n=()=>{let n=t.children;if(!n.length)return;let r=e.scrollLeft,i=e.clientWidth,a=0,o=1/0;for(let e=0;e<n.length;e++){let t=n[e],s=t.offsetLeft+t.offsetWidth/2,c=r+i/2,l=Math.abs(s-c);l<o&&(o=l,a=e)}u(a)};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[]),(0,L.useRef)(null);let ee=(0,L.useCallback)(e=>{f(e)},[]);return o?(0,U.jsx)(`div`,{className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,children:(0,U.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children`,style:{gridTemplateColumns:`repeat(${Ca.length}, minmax(0, 1fr))`,minWidth:`${Ca.length*200}px`},children:Ca.map((e,t)=>(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex flex-col gap-2`,children:[(0,U.jsx)(`div`,{className:`skeleton-line h-4 w-20 mb-2`}),(0,U.jsx)(Ma,{delay:t*80}),(0,U.jsx)(Ma,{delay:t*80+120}),t<2&&(0,U.jsx)(Ma,{delay:t*80+240})]},e))})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{ref:h,className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,onPointerMove:O,onPointerUp:k,onPointerCancel:A,style:{touchAction:w?`none`:void 0},children:[(0,U.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children ${w?`kanban-dragging`:``}`,style:{gridTemplateColumns:`repeat(${Ca.length}, minmax(0, 1fr))`,minWidth:`${Ca.length*200}px`},children:Ca.map(t=>(0,U.jsx)(Ra,{col:t,issues:x[t],empty:ja[t],badgeClass:Da[t],dragState:w,registerColumn:D,getCardHandlers:E,onSelect:M,onCreateIssue:a,lastDroppedId:s,hasRunningAgents:S,totalIssues:e.length,onLongPress:ee,selectedIds:p,onToggleSelect:_,hasSelection:g},t))}),(0,U.jsx)(Na,{dragState:w,ghostRef:T})]}),(0,U.jsx)(Ia,{columns:Ca,activeIndex:l}),d&&(0,U.jsx)(Fa,{issue:d,onClose:()=>f(null),onStateChange:C,onSelect:M}),g&&(0,U.jsx)(Ba,{count:p.size,transitions:y,onBulkAction:b,onClear:v})]})}function Ha(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ua({value:e,format:t=Ha,className:n=``}){let[r,i]=(0,L.useState)(()=>t(e)),a=(0,L.useRef)(e),o=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let n=a.current||0,r=e||0;if(a.current=r,n===r){i(t(r));return}let s=performance.now(),c=e=>{let a=e-s,l=Math.min(a/600,1),u=1-(1-l)**3;i(t(Math.round(n+(r-n)*u))),l<1&&(o.current=requestAnimationFrame(c))};return cancelAnimationFrame(o.current),o.current=requestAnimationFrame(c),()=>cancelAnimationFrame(o.current)},[e,t]),(0,U.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}function Wa({data:e,height:t=28,cols:n=14,valueKey:r=`totalTokens`,colorClass:i=`text-primary`,showValue:a=!1,className:o=``}){if(!e||e.length===0)return null;let s=e.slice(-n),c=new Date().toISOString().slice(0,10),l=Math.max(...s.map(e=>e[r]||0),1),u=s.length,d=1.5,f=Math.max(2,(100-d*(u-1))/u);return(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 ${o}`,children:[(0,U.jsx)(`svg`,{viewBox:`0 0 100 ${t}`,className:`flex-1`,style:{height:t},preserveAspectRatio:`none`,children:s.map((e,n)=>{let a=e[r]||0,o=Math.max(1.5,a/l*(t-1)),s=n*(f+d),u=e.date===c,p=e.date?new Date(e.date+`T12:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}):`Day ${n+1}`;return(0,U.jsx)(`rect`,{x:s,y:t-o,width:f,height:o,rx:`0.5`,fill:`currentColor`,className:i,opacity:u?.85:a>0?.4:.12,children:(0,U.jsx)(`title`,{children:`${p}: ${a>999?Ha(a):a}`})},e.date||n)})}),a&&(0,U.jsxs)(`span`,{className:`text-[9px] font-mono opacity-50 shrink-0`,children:[Ha(s[s.length-1]?.[r]||0),`/d`]})]})}function Ga({data:e,height:t=28,cols:n=14,className:r=``}){if(!e||e.length===0)return null;let i=e.slice(-n),a=new Date().toISOString().slice(0,10),o=Math.max(...i.map(e=>(e.linesAdded||0)+(e.linesRemoved||0)),1),s=i.length,c=1.5,l=Math.max(2,(100-c*(s-1))/s);return(0,U.jsx)(`div`,{className:`flex items-center gap-1.5 ${r}`,children:(0,U.jsx)(`svg`,{viewBox:`0 0 100 ${t}`,className:`flex-1`,style:{height:t},preserveAspectRatio:`none`,children:i.map((e,n)=>{let r=e.linesAdded||0,i=e.linesRemoved||0,s=r+i,u=Math.max(s>0?1.5:0,s/o*(t-1)),d=s>0?r/s*u:0,f=u-d,p=n*(l+c),m=e.date===a?.85:s>0?.5:.12,h=e.date?new Date(e.date+`T12:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}):`Day ${n+1}`;return(0,U.jsxs)(`g`,{children:[f>0&&(0,U.jsx)(`rect`,{x:p,y:t-f,width:l,height:f,rx:`0.5`,className:`fill-error`,opacity:m,children:(0,U.jsx)(`title`,{children:`${h}: +${r} / -${i}`})}),d>0&&(0,U.jsx)(`rect`,{x:p,y:t-u,width:l,height:d,rx:`0.5`,className:`fill-success`,opacity:m,children:(0,U.jsx)(`title`,{children:`${h}: +${r} / -${i}`})})]},e.date||n)})})})}function Ka(){let[e,t]=(0,L.useState)(()=>window.innerWidth<768);return(0,L.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function qa({monthlyTokens:e,monthlyEvents:t,dailyData:n,hasDailyData:r,hasEventData:i,linesDaily:a,hasChurnData:o}){let[s,c]=(0,L.useState)(!1);return(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box animate-fade-in overflow-hidden`,children:[(0,U.jsxs)(`button`,{className:`flex items-center justify-between w-full px-4 py-2.5 text-left`,onClick:()=>c(!s),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,U.jsx)(Z,{className:`size-3.5 text-primary`}),(0,U.jsx)(Ua,{value:e}),(0,U.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 font-normal ml-1`,children:`this month`})]}),t>0&&(0,U.jsxs)(`span`,{className:`flex items-center gap-1 text-xs opacity-50`,children:[(0,U.jsx)(Ot,{className:`size-3`}),t]})]}),(0,U.jsx)(Ht,{className:`size-4 opacity-40 transition-transform ${s?`rotate-180`:``}`})]}),s&&(0,U.jsxs)(`div`,{className:`px-4 pb-3 space-y-3 animate-fade-in border-t border-base-300 pt-3`,children:[r&&(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,U.jsx)(Xn,{className:`size-2.5`}),` Tokens / day`]}),(0,U.jsx)(Wa,{data:n,height:32,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`,className:`w-full`})]}),i&&(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,U.jsx)(Ot,{className:`size-2.5`}),` Events / day`]}),(0,U.jsx)(Wa,{data:n,height:24,cols:14,valueKey:`events`,colorClass:`text-secondary`,className:`w-full`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,U.jsx)(G,{className:`size-2.5`}),` Lines / day`]}),(0,U.jsx)(Ga,{data:a,height:24,cols:14,className:`w-full`})]})]})]})}function Ja({issues:e=[],defaultBranch:t}){let{data:n}=qe(),{data:r}=Je({pollInterval:6e4}),i=Ka(),a=pe(n?.daily,14),o=new Date().toISOString().slice(0,7),s=a.filter(e=>e.date?.startsWith(o)).reduce((e,t)=>e+(t.totalTokens||0),0),c=a.filter(e=>e.date?.startsWith(o)).reduce((e,t)=>e+(t.events||0),0),l=(()=>{let e=new Map((r?.lines||[]).filter(e=>e.date).map(e=>[e.date,e])),t=[];for(let n=13;n>=0;n--){let r=new Date;r.setDate(r.getDate()-n);let i=r.toISOString().slice(0,10);t.push(e.get(i)??{date:i,linesAdded:0,linesRemoved:0,filesChanged:0})}return t})(),u=a.some(e=>(e.totalTokens||0)>0),d=a.some(e=>(e.events||0)>0),f=l.some(e=>(e.linesAdded||0)>0||(e.linesRemoved||0)>0),p=s>0||u||d,m=(0,L.useRef)(p),[h,g]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{!m.current&&p&&(m.current=!0,g(!0))},[p]),p?i?(0,U.jsx)(qa,{monthlyTokens:s,monthlyEvents:c,dailyData:a,hasDailyData:u,hasEventData:d,linesDaily:l,hasChurnData:f}):(0,U.jsxs)(`div`,{className:`flex items-stretch gap-0 bg-base-200 rounded-box overflow-hidden ${h?`animate-fade-in-up`:`animate-fade-in`}`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col justify-center px-4 py-2.5`,children:[(0,U.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Tokens / month`}),(0,U.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5 mt-0.5`,children:[(0,U.jsx)(Z,{className:`size-3.5 text-primary shrink-0`}),(0,U.jsx)(Ua,{value:s})]})]}),u&&(0,U.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,U.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,U.jsx)(Xn,{className:`size-2.5`}),` Tokens / day`]}),(0,U.jsx)(Wa,{data:a,height:28,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`})]}),d&&(0,U.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,U.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,U.jsx)(Ot,{className:`size-2.5`}),` Events / day`]}),(0,U.jsx)(Wa,{data:a,height:28,cols:14,valueKey:`events`,colorClass:`text-secondary`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,U.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,U.jsx)(G,{className:`size-2.5`}),` Lines / day`]}),(0,U.jsx)(Ga,{data:l,height:28,cols:14})]}),t&&(0,U.jsxs)(`div`,{className:`flex flex-col justify-center px-3 border-l border-base-300`,children:[(0,U.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Branch`}),(0,U.jsxs)(`span`,{className:`text-xs font-mono font-medium flex items-center gap-1 mt-0.5`,children:[(0,U.jsx)(fn,{className:`size-3 text-primary shrink-0`}),t]})]})]}):null}var Ya=b(`/kanban`)({component:Xa});function Xa(){let e=Et(),{data:t}=qe();return(0,U.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-3 pb-2 gap-2`,children:[((t?.overall?.totalTokens||0)>0||e.issues.length>0)&&(0,U.jsx)(Ja,{metrics:e.metrics,total:e.issues.length,issues:e.issues,compact:!0,defaultBranch:e.data?.config?.defaultBranch}),(0,U.jsx)(Va,{issues:e.filtered,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,onCreateIssue:()=>e.setIsCreateOpen(!0)})]})}function Za(e){let{state:t,planningStatus:n,assignedToWorker:r,startedAt:i,tokenUsage:a,tokensByPhase:o}=e;switch(t){case`Planning`:return n===`planning`?{label:`Generating plan...`,icon:q,color:`text-info`,spin:!0}:e.plan?{label:`Plan ready`,icon:K,color:`text-info`,spin:!1}:e.planningError?{label:`Plan failed`,icon:Y,color:`text-error`,spin:!1}:{label:`Aguardando scheduler…`,icon:Qt,color:`text-info/60`,spin:!1};case`Planned`:return{label:`Ready to queue`,icon:wn,color:`text-warning/70`,spin:!1};case`Queued`:return r?{label:`Worker assigned, starting...`,icon:Mn,color:`text-primary`,spin:!1,pulse:!0}:{label:`Waiting for worker slot...`,icon:Qt,color:`text-info/70`,spin:!1};case`Running`:{let e=Qa(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning agent...`,icon:q,color:`text-primary`,spin:!0}:t?e===`Reviewing`?{label:`Agent reviewing...`,icon:W,color:`text-secondary`,spin:!1,pulse:!0}:e===`Planning`?{label:`Agent planning...`,icon:K,color:`text-info`,spin:!1,pulse:!0}:{label:`Agent working...`,icon:Mn,color:`text-primary`,spin:!1,pulse:!0}:{label:`Starting agent...`,icon:q,color:`text-primary`,spin:!0}}case`Reviewing`:return Qa(o)===`Reviewing`?{label:`Review in progress...`,icon:W,color:`text-secondary`,spin:!1,pulse:!0}:{label:`Reviewing`,icon:W,color:`text-secondary/70`,spin:!1};case`Reviewed`:return{label:`Review complete`,icon:W,color:`text-success/70`,spin:!1};case`Blocked`:return{label:e.lastError?`Blocked: error`:e.blockedBy?.length?`Blocked by dependency`:`Needs attention`,icon:Y,color:`text-error`,spin:!1};case`Done`:return{label:`Completed`,icon:Gt,color:`text-success`,spin:!1};case`Cancelled`:return{label:`Cancelled`,icon:Yt,color:`text-neutral`,spin:!1};default:return{label:t,icon:null,color:`opacity-50`,spin:!1}}}function Qa(e){return e?e.reviewer?.totalTokens>0?`Reviewing`:e.executor?.totalTokens>0?`Executing`:e.planner?.totalTokens>0?`Planning`:null:null}function $a({issue:e,showElapsed:t=!0,compact:n=!1}){let r=Za(e),i=r.icon,a=Zi([`Running`,`Queued`,`Planning`,`Reviewing`].includes(e.state)&&t?e.startedAt:null);return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs ${r.color} ${n?``:`font-medium`}`,children:[i&&(0,U.jsx)(i,{size:n?10:12,className:[r.spin?`animate-spin`:``,r.pulse?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,U.jsx)(`span`,{className:n?`truncate max-w-[120px]`:`truncate`,children:r.label}),a&&(0,U.jsx)(`span`,{className:`font-mono opacity-60 tabular-nums shrink-0`,children:a})]})}var eo={Planning:`badge-info`,Planned:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Reviewing:`badge-secondary`,Reviewed:`badge-success`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},to={Planning:`border-l-info`,Planned:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Reviewing:`border-l-secondary`,Reviewed:`border-l-success`,Blocked:`border-l-error`,Done:`border-l-success`,Cancelled:`border-l-neutral`};function no(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function ro({icon:e,label:t,value:n,color:r=``}){return!n&&n!==0?null:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[10px]`,title:t,children:[(0,U.jsx)(e,{className:`size-2.5 ${r||`opacity-40`}`}),(0,U.jsx)(`span`,{className:`font-mono opacity-70`,children:n})]})}function io(e){let t=e.createdAt?new Date(e.createdAt).getTime():0,n=e.startedAt?new Date(e.startedAt).getTime():0,r=e.completedAt?new Date(e.completedAt).getTime():0,i=Date.now();return{leadTimeMs:r?r-t:n?i-t:0,cycleTimeMs:r&&n?r-n:n?i-n:0,waitTimeMs:n?n-t:t?i-t:0}}function ao({issue:e,onSelect:t}){let n=e.state===`Running`,r=no(e.tokenUsage?.totalTokens),i=e.description||``,a=(e.labels||[]).filter(e=>!e.startsWith(`capability:`)&&!e.startsWith(`overlay:`)),{leadTimeMs:o,cycleTimeMs:s,waitTimeMs:c}=io(e);return e.state===`Done`||e.state,(0,U.jsx)(`div`,{className:`card bg-base-100 border border-base-300 border-l-[3px] ${to[e.state]||``} card-interactive cursor-pointer hover:shadow-lg transition-all ${n?`animate-pulse-border`:``}`,role:`button`,tabIndex:0,onClick:()=>t?.(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t?.(e))},children:(0,U.jsxs)(`div`,{className:`card-body gap-3 p-4 justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,U.jsx)(`span`,{className:`badge badge-xs ${eo[e.state]||`badge-ghost`}`,children:e.state}),(0,U.jsxs)(`span`,{className:`text-[10px] opacity-30`,children:[`P`,e.priority]})]}),(0,U.jsx)(`span`,{className:`text-xs opacity-40 shrink-0`,children:R(e.updatedAt)})]}),(0,U.jsx)(`h3`,{className:`font-semibold text-sm leading-snug line-clamp-2`,children:e.title}),i&&(0,U.jsx)(`p`,{className:`text-xs opacity-50 leading-relaxed line-clamp-2 mt-1`,children:i})]}),(a.length>0||e.capabilityCategory)&&(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.capabilityCategory&&(0,U.jsxs)(`span`,{className:`badge badge-xs badge-outline`,children:[(0,U.jsx)(Sn,{className:`size-2.5 mr-0.5`}),e.capabilityCategory]}),a.slice(0,3).map(e=>(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e},e)),a.length>3&&(0,U.jsxs)(`span`,{className:`badge badge-xs badge-ghost opacity-40`,children:[`+`,a.length-3]})]}),[`Planning`,`Planned`,`Queued`,`Running`,`Reviewing`,`Reviewed`,`Blocked`].includes(e.state)&&(0,U.jsx)(`div`,{className:`pt-1`,children:(0,U.jsx)($a,{issue:e,showElapsed:!0})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-2 border-t border-base-200`,children:[(0,U.jsx)(ro,{icon:_n,label:`Wait`,value:c>0?z(c):null}),(0,U.jsx)(ro,{icon:Yn,label:`Cycle`,value:s>0?z(s):null,color:`text-primary`}),(0,U.jsx)(ro,{icon:Qt,label:`Lead`,value:o>0?z(o):null}),(0,U.jsx)(ro,{icon:Z,label:`Tokens`,value:r,color:`text-warning`}),(0,U.jsx)(ro,{icon:en,label:`Cost`,value:e.tokenUsage?.costUsd?`$${e.tokenUsage.costUsd.toFixed(2)}`:null,color:`text-secondary`}),(0,U.jsx)(ro,{icon:J,label:`Attempts`,value:e.attempts>0?`${e.attempts}/${e.maxAttempts}`:null}),(0,U.jsx)(ro,{icon:an,label:`Files`,value:e.filesChanged||null,color:`text-info`}),e.linesAdded?(0,U.jsxs)(`span`,{className:`text-[10px] font-mono text-success`,children:[`+`,e.linesAdded]}):null,e.linesRemoved?(0,U.jsxs)(`span`,{className:`text-[10px] font-mono text-error`,children:[`-`,e.linesRemoved]}):null]})]})})}function oo({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,expanded:a=!1}){return e.length===0?(0,U.jsx)(fa,{icon:Cn,title:`No issues found`,description:`Try adjusting your search or filters, or create your first issue to get started.`}):a?(0,U.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 stagger-children`,children:e.map(e=>(0,U.jsx)(ao,{issue:e,onSelect:i},e.id))}):(0,U.jsx)(`div`,{className:`space-y-2 stagger-children`,children:e.map(e=>(0,U.jsx)(da,{issue:e,onSelect:i},e.id))})}var so=[`Planning`,`Planned`,`Queued`,`Running`,`Reviewing`,`Reviewed`,`Blocked`,`Done`,`Cancelled`],co={Planning:`badge-info`,Planned:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Reviewing:`badge-secondary`,Reviewed:`badge-success`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},lo=[{value:`recent`,label:`Active + recent`},{value:`all`,label:`All issues`}],uo=b(`/issues`)({component:fo});function fo(){let e=Et(),[t,n]=(0,L.useState)(!1),r=e.stateFilter!==`all`||e.categoryFilter!==`all`||e.completionFilter!==`recent`,i=(e.data._totalIssues??0)-(e.issues.length??0),a=(e.stateFilter===`all`?0:1)+(e.categoryFilter===`all`?0:1)+(e.completionFilter===`recent`?0:1),o={};for(let t of e.issues)o[t.state]=(o[t.state]||0)+1;let s=(0,L.useMemo)(()=>[...e.filtered].sort((e,t)=>{let n=e.updatedAt||e.createdAt||``;return(t.updatedAt||t.createdAt||``).localeCompare(n)}),[e.filtered]),c=()=>{e.setQuery(``),e.setStateFilter(`all`),e.setCategoryFilter(`all`),e.setCompletionFilter(`recent`)};return(0,U.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:[(0,U.jsxs)(`div`,{className:`sticky top-0 z-10 bg-base-100 pt-3 pb-3 border-b border-base-300 space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1`,children:[(0,U.jsx)(Ln,{className:`size-4 opacity-40`}),(0,U.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Search by title, ID, or description...`,value:e.query,onChange:t=>e.setQuery(t.target.value)}),e.query&&(0,U.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-circle`,onClick:()=>e.setQuery(``),children:(0,U.jsx)(X,{className:`size-3`})})]}),(0,U.jsx)(`button`,{className:`btn btn-sm btn-square ${t?`btn-primary`:`btn-ghost`}`,onClick:()=>n(!t),title:`Toggle filters`,children:(0,U.jsx)(Rn,{className:`size-4`})}),a>0&&(0,U.jsx)(`span`,{className:`badge badge-sm badge-primary`,children:a}),(0,U.jsxs)(k,{to:`/discover`,className:`btn btn-sm btn-ghost gap-1`,title:`Discover issues from codebase`,children:[(0,U.jsx)(W,{className:`size-4`}),(0,U.jsx)(`span`,{className:`hidden sm:inline`,children:`Discover`})]}),(0,U.jsxs)(`div`,{className:`text-xs opacity-40 shrink-0`,children:[e.filtered.length,` result`,e.filtered.length===1?``:`s`,i>0&&e.completionFilter===`recent`&&(0,U.jsxs)(`span`,{children:[` · `,i,` older hidden`]})]})]}),t&&(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 space-y-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`State`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,U.jsx)(`button`,{className:`badge badge-sm cursor-pointer ${e.stateFilter===`all`?`badge-primary`:`badge-ghost opacity-60 hover:opacity-100`}`,onClick:()=>e.setStateFilter(`all`),children:`All`}),so.map(t=>{let n=o[t]||0,r=e.stateFilter===t;return(0,U.jsxs)(`button`,{className:`badge badge-sm gap-1 cursor-pointer transition-all ${r?co[t]:`badge-outline opacity-60 hover:opacity-100`}`,onClick:()=>e.setStateFilter(r?`all`:t),children:[t,n>0&&(0,U.jsx)(`span`,{className:`font-mono text-[10px]`,children:n})]},t)})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[e.categoryOptions.length>2&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Capability`}),(0,U.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.categoryFilter,onChange:t=>e.setCategoryFilter(t.target.value),children:e.categoryOptions.map(e=>(0,U.jsx)(`option`,{value:e,children:e===`all`?`All capabilities`:e},e))})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Show`}),(0,U.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.completionFilter,onChange:t=>e.setCompletionFilter(t.target.value),children:lo.map(e=>(0,U.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),r&&(0,U.jsx)(`div`,{className:`flex items-end`,children:(0,U.jsxs)(`button`,{className:`btn btn-sm btn-ghost gap-1`,onClick:c,children:[(0,U.jsx)(X,{className:`size-3`}),`Clear all`]})})]})]}),!t&&r&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,U.jsx)(un,{className:`size-3 opacity-40`}),e.stateFilter!==`all`&&(0,U.jsxs)(`span`,{className:`badge badge-sm gap-1 ${co[e.stateFilter]}`,children:[e.stateFilter,(0,U.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setStateFilter(`all`),children:(0,U.jsx)(X,{className:`size-2.5`})})]}),e.categoryFilter!==`all`&&(0,U.jsxs)(`span`,{className:`badge badge-sm badge-outline gap-1`,children:[e.categoryFilter,(0,U.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCategoryFilter(`all`),children:(0,U.jsx)(X,{className:`size-2.5`})})]}),e.completionFilter!==`recent`&&(0,U.jsxs)(`span`,{className:`badge badge-sm badge-ghost gap-1`,children:[`All issues`,(0,U.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCompletionFilter(`recent`),children:(0,U.jsx)(X,{className:`size-2.5`})})]}),(0,U.jsx)(`button`,{className:`text-xs opacity-40 hover:opacity-100 underline`,onClick:c,children:`clear all`})]})]}),(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3`,children:(0,U.jsx)(oo,{issues:s,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,expanded:!0})})]})}var po=[{id:`all`,label:`TODOs & FIXMEs`,icon:an},{id:`github`,label:`GitHub Issues`,icon:hn}],mo={todo:{label:`TODO`,class:`badge-info`},fixme:{label:`FIXME`,class:`badge-error`},hack:{label:`HACK`,class:`badge-warning`},github:{label:`GitHub`,class:`badge-neutral`}};function ho({item:e,selected:t,onToggle:n,onCreateSingle:r,creating:i}){let a=mo[e.source]||mo.todo;return(0,U.jsx)(`div`,{className:`card card-compact bg-base-200/50 border transition-all duration-150 ${t?`border-primary/40 bg-primary/5`:`border-base-300/50 hover:border-base-content/20`}`,children:(0,U.jsx)(`div`,{className:`card-body gap-2`,children:(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`button`,{className:`mt-0.5 shrink-0 opacity-60 hover:opacity-100 transition-opacity`,onClick:()=>n(e),children:t?(0,U.jsx)(Hn,{className:`size-5 text-primary`}):(0,U.jsx)(Un,{className:`size-5`})}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,U.jsx)(`span`,{className:`badge badge-xs ${a.class}`,children:a.label}),e.category&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.category})]}),(0,U.jsx)(`p`,{className:`text-sm font-medium mt-1 leading-snug`,children:e.title}),e.file&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5 text-xs text-base-content/50`,children:[(0,U.jsx)(cn,{className:`size-3`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.file}),e.line>0&&(0,U.jsxs)(`span`,{children:[`:`,e.line]})]}),e.suggestedLabels?.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1 mt-1.5 flex-wrap`,children:[(0,U.jsx)(Gn,{className:`size-3 text-base-content/40`}),e.suggestedLabels.slice(0,4).map(e=>(0,U.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))]})]}),(0,U.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-square shrink-0`,onClick:()=>r(e),disabled:i,title:`Create issue`,children:(0,U.jsx)(Nn,{className:`size-3.5`})})]})})})}function go({embedded:e=!1,onBack:t}){let[n,r]=(0,L.useState)(`all`),[i,a]=(0,L.useState)([]),[o,s]=(0,L.useState)([]),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(new Set),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(0),[v,y]=(0,L.useState)(``),b=e?null:Et(),x=n===`all`?i:o,S=v.trim()?x.filter(e=>e.title.toLowerCase().includes(v.toLowerCase())||e.file?.toLowerCase().includes(v.toLowerCase())||e.category?.toLowerCase().includes(v.toLowerCase())):x,C=(0,L.useCallback)(async e=>{l(!0),d(null);try{let t=e===`all`?`/scan/issues`:`/scan/github-issues`,n=(await V.get(t)).issues||[];e===`all`?a(n):s(n)}catch(e){d(e.message||`Failed to scan`)}finally{l(!1)}},[]);(0,L.useEffect)(()=>{(n===`all`?i:o).length===0&&C(n)},[n]);let w=(0,L.useCallback)(e=>{let t=`${e.source}:${e.file}:${e.line}:${e.title}`;p(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),T=e=>`${e.source}:${e.file}:${e.line}:${e.title}`,E=(0,L.useCallback)(()=>{p(new Set(S.map(T)))},[S]),D=(0,L.useCallback)(()=>{p(new Set)},[]),O=(0,L.useCallback)(async e=>{let t={title:e.title,description:e.context||e.title,labels:e.suggestedLabels||[e.source],paths:e.suggestedPaths||(e.file?[e.file]:[])};await V.post(`/issues/create`,t)},[]),k=(0,L.useCallback)(async e=>{h(!0);try{await O(e),_(e=>e+1);let t=T(e);p(e=>{let n=new Set(e);return n.delete(t),n}),n===`all`?a(e=>e.filter(e=>T(e)!==t)):s(e=>e.filter(e=>T(e)!==t)),b?.showToast?.(`Issue created`,`success`)}catch(e){b?.showToast?.(e.message||`Failed to create issue`,`error`)}finally{h(!1)}},[n,b,O]),A=(0,L.useCallback)(async()=>{if(f.size===0)return;h(!0);let e=0,t=S.filter(e=>f.has(T(e)));for(let n of t)try{await O(n),e++}catch{}_(t=>t+e);let r=new Set(t.map(T));n===`all`?a(e=>e.filter(e=>!r.has(T(e)))):s(e=>e.filter(e=>!r.has(T(e)))),p(new Set),h(!1),b?.showToast?.(`${e} issue(s) created`,`success`)},[f,S,n,b,O]);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 ${e?``:`p-4 max-w-4xl mx-auto w-full`}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t&&(0,U.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square`,onClick:t,children:(0,U.jsx)(At,{className:`size-4`})}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(`h2`,{className:`font-bold ${e?`text-xl`:`text-2xl`}`,children:e?`Discover Issues`:`Discover Issues in Codebase`}),!e&&(0,U.jsx)(`p`,{className:`text-sm text-base-content/60 mt-0.5`,children:`Scan your code for TODOs, FIXMEs, and import GitHub issues`})]}),g>0&&(0,U.jsxs)(`div`,{className:`badge badge-success gap-1`,children:[(0,U.jsx)(Nn,{className:`size-3`}),` `,g,` created`]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`div`,{role:`tablist`,className:`tabs tabs-boxed tabs-sm flex-1`,children:po.map(e=>{let t=e.icon,a=e.id===`all`?i.length:o.length;return(0,U.jsxs)(`button`,{role:`tab`,className:`tab gap-1.5 ${n===e.id?`tab-active`:``}`,onClick:()=>r(e.id),children:[(0,U.jsx)(t,{className:`size-3.5`}),e.label,a>0&&(0,U.jsx)(`span`,{className:`badge badge-xs`,children:a})]},e.id)})}),(0,U.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square`,onClick:()=>C(n),disabled:c,title:`Refresh`,children:(0,U.jsx)(Fn,{className:`size-4 ${c?`animate-spin`:``}`})})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`label`,{className:`input input-sm input-bordered flex items-center gap-2 flex-1`,children:[(0,U.jsx)(Ln,{className:`size-3.5 opacity-50`}),(0,U.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Filter by title, file, or category...`,value:v,onChange:e=>y(e.target.value)})]}),S.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:E,children:`All`}),(0,U.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:D,children:`None`})]}),f.size>0&&(0,U.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:A,disabled:m,children:[m?(0,U.jsx)(En,{className:`size-3.5 animate-spin`}):(0,U.jsx)(Nn,{className:`size-3.5`}),`Create `,f.size,` issue`,f.size===1?``:`s`]})]}),c&&x.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3`,children:[(0,U.jsx)(En,{className:`size-8 animate-spin text-primary`}),(0,U.jsx)(`p`,{className:`text-sm text-base-content/50`,children:n===`all`?`Scanning codebase for TODOs...`:`Fetching GitHub issues...`})]}):u?(0,U.jsxs)(`div`,{className:`alert alert-warning`,children:[(0,U.jsx)(Y,{className:`size-4`}),(0,U.jsx)(`span`,{children:u}),(0,U.jsx)(`button`,{className:`btn btn-sm btn-ghost`,onClick:()=>C(n),children:`Retry`})]}):S.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-2 opacity-50`,children:[n===`all`?(0,U.jsx)(an,{className:`size-10`}):(0,U.jsx)(hn,{className:`size-10`}),(0,U.jsx)(`p`,{className:`text-sm`,children:x.length===0?n===`all`?`No TODOs or FIXMEs found in your codebase`:`No open GitHub issues found`:`No items match your search`})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`p`,{className:`text-xs text-base-content/40`,children:[S.length,` item`,S.length===1?``:`s`,` found`,f.size>0&&` \u00b7 ${f.size} selected`]}),S.map((e,t)=>(0,U.jsx)(ho,{item:e,selected:f.has(T(e)),onToggle:w,onCreateSingle:k,creating:m},`${e.source}-${e.file}-${e.line}-${t}`))]})]})}var _o=b(`/discover`)({component:vo});function vo(){let e=h();return(0,U.jsx)(go,{onBack:()=>e({to:`/issues`})})}var yo=b(`/analytics`)({}),bo={Queued:`badge-info`,Running:`badge-primary`,Reviewing:`badge-secondary`,Reviewed:`badge-success`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`,Planning:`badge-info`},xo={Queued:wn,Running:Xt,Reviewing:W,Reviewed:W,Blocked:Y,Done:Gt,Cancelled:Yt};function So(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Co(e){if(!e)return null;let t=e.match(/claude-(\w+)-(\d+)-(\d+)/);return t?`${t[1].charAt(0).toUpperCase()+t[1].slice(1)} ${t[2]}.${t[3]}`:e.length<=16?e:e.slice(0,16)}function wo({issueId:e,issueState:t}){let[n,r]=(0,L.useState)(null),[i,a]=(0,L.useState)(!0),o=(0,L.useRef)(null),s=(0,L.useCallback)(async()=>{try{r(await V.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);(0,L.useEffect)(()=>{s();let e=setInterval(s,2e3);return()=>clearInterval(e)},[s]),(0,L.useEffect)(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n?.logTail]);let c=n&&Number.isFinite(Number(n.elapsed))?Number(n.elapsed):n?.startedAt?Math.max(Date.now()-new Date(n.startedAt).getTime(),0):0,l=n?.logSize?(n.logSize/1024).toFixed(1):`0`;return(0,U.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs opacity-60`,children:[n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(Qt,{className:`size-3`}),z(c)]}),(0,U.jsxs)(`span`,{children:[`Log: `,l,` KB`]}),n.agentPid&&(0,U.jsxs)(`span`,{children:[`PID `,n.agentPid]}),n.agentAlive===!1&&n.agentPid&&(0,U.jsx)(`span`,{className:`text-error`,children:`dead`})]}),(0,U.jsxs)(`button`,{className:`ml-auto flex items-center gap-0.5 opacity-50 hover:opacity-100 transition-opacity`,onClick:()=>a(e=>!e),title:i?`Collapse output`:`Expand output`,children:[i?(0,U.jsx)(Ut,{className:`size-3`}):(0,U.jsx)(Ht,{className:`size-3`}),(0,U.jsx)(`span`,{className:`text-[10px]`,children:i?`hide`:`output`})]})]}),i&&(0,U.jsx)(`pre`,{ref:o,className:`text-[11px] bg-base-300 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-72 overflow-y-auto font-mono opacity-80 leading-relaxed break-all w-full max-w-full`,children:n?.logTail||(0,U.jsx)(`span`,{className:`opacity-30`,children:`Waiting for output…`})})]})}function To({index:e,issue:t,total:n,workflow:r}){if(!t)return(0,U.jsx)(`div`,{className:`slot-idle rounded-box p-6 flex items-center justify-center opacity-30 transition-opacity duration-300 hover:opacity-40 border-2 border-dashed border-base-300`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(Xt,{className:`size-5 animate-pulse-soft`}),`Slot `,e+1,` -- idle`]})});let i=t.state===`Running`,a=t.state===`Planning`,o=t.state===`Reviewing`||t.state===`Reviewed`?`border-secondary bg-secondary/5`:a?`border-info bg-info/5`:`border-primary bg-primary/5`,s=a?`plan`:t.state===`Reviewing`||t.state===`Reviewed`?`review`:`execute`,c=r?.[s],l=a?`planner`:t.state===`Reviewing`||t.state===`Reviewed`?`reviewer`:`executor`,u=t.tokensByPhase?.[l]?.model,d=Co(u||c?.model),f=c?.provider,p=t.effort?.[l]||t.effort?.default||c?.effort;return(0,U.jsxs)(`div`,{className:`border-2 rounded-box p-5 space-y-2 animate-fade-in-scale overflow-hidden min-w-0 ${o} ${i?`slot-active`:``}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[a?(0,U.jsx)(q,{className:`size-4 animate-spin text-info shrink-0`}):(0,U.jsx)(`span`,{className:`loading loading-spinner loading-sm text-primary shrink-0`}),(0,U.jsx)(`span`,{className:`font-mono text-base font-bold truncate`,children:t.identifier}),(0,U.jsx)(`span`,{className:`badge badge-sm ${bo[t.state]||`badge-ghost`} shrink-0`,children:t.state})]}),(0,U.jsxs)(`span`,{className:`text-xs font-mono opacity-50 shrink-0 bg-base-200 px-2 py-0.5 rounded`,children:[`Slot `,e+1,`/`,n]})]}),(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:t.title}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs opacity-60`,children:[t.capabilityCategory&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:t.capabilityCategory}),(0,U.jsxs)(`span`,{children:[`P`,t.priority]}),(0,U.jsxs)(`span`,{children:[`Attempt `,(t.attempts||0)+1,`/`,t.maxAttempts]}),t.startedAt&&(0,U.jsxs)(`span`,{children:[`started `,R(t.startedAt)]})]}),(f||d||p)&&(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[f&&(0,U.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,U.jsx)(Kn,{className:`size-2.5`}),f]}),d&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:d}),p&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:p})]}),(0,U.jsx)(wo,{issueId:t.id,issueState:t.state})]})}function Eo({issue:e}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,U.jsx)(xo[e.state]||Xt,{className:`size-3 opacity-40 shrink-0`}),(0,U.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,U.jsx)(`span`,{className:`truncate flex-1`,children:e.title}),(0,U.jsx)(`span`,{className:`badge badge-xs ${bo[e.state]||`badge-ghost`}`,children:e.state}),e.state===`Blocked`&&e.nextRetryAt&&(0,U.jsxs)(`span`,{className:`opacity-40 shrink-0`,children:[`retry `,R(e.nextRetryAt)]})]})}function Do({issue:e}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,U.jsx)(e.state===`Done`?Gt:Yt,{className:`size-3 shrink-0 ${e.state===`Done`?`text-success`:`text-neutral`}`}),(0,U.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,U.jsx)(`span`,{className:`truncate flex-1 opacity-70`,children:e.title}),e.durationMs&&(0,U.jsx)(`span`,{className:`opacity-40 shrink-0`,children:z(e.durationMs)}),e.completedAt&&(0,U.jsx)(`span`,{className:`opacity-40 shrink-0`,children:R(e.completedAt)})]})}function Oo({running:e,queued:t,concurrency:n,totalTokensToday:r}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-3`,children:[(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`bg-primary/10 rounded-btn p-2`,children:(0,U.jsx)(Qn,{className:`size-5 text-primary`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`text-2xl font-bold font-mono`,children:[e.length,(0,U.jsxs)(`span`,{className:`text-sm opacity-50`,children:[`/`,n]})]}),(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Active agents`})]})]}),(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`bg-info/10 rounded-btn p-2`,children:(0,U.jsx)(wn,{className:`size-5 text-info`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:t.length}),(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Queued`})]})]}),(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`bg-accent/10 rounded-btn p-2`,children:(0,U.jsx)(Z,{className:`size-5 text-accent`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:So(r)}),(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Tokens today`})]})]}),(0,U.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`bg-secondary/10 rounded-btn p-2`,children:(0,U.jsx)(dn,{className:`size-5 text-secondary`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:n}),(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Max parallelism`})]})]})]})}function ko({state:e,providers:t,parallelism:n,onRefresh:r,issues:i=[]}){let a=Array.isArray(e.issues)?e.issues:[],o=Number(e.config?.workerConcurrency)||3,{data:s}=Mr(),c=s?.workflow||null,l=a.filter(e=>e.state===`Planning`&&e.planningStatus===`planning`),u=[...a.filter(e=>e.state===`Running`||e.state===`Reviewing`),...l],d=a.filter(e=>e.state===`Planned`||e.state===`Queued`||e.state===`Blocked`&&e.nextRetryAt||e.state===`Planning`&&e.planningStatus!==`planning`),f=a.filter(e=>e.state===`Done`||e.state===`Cancelled`).sort((e,t)=>(t.completedAt||``).localeCompare(e.completedAt||``)).slice(0,10),p=(0,L.useMemo)(()=>{let e=new Date().toISOString().slice(0,10),t=0;for(let n of i)n.tokenUsage?.totalTokens&&(n.completedAt||n.updatedAt||``).slice(0,10)===e&&(t+=n.tokenUsage.totalTokens);return t},[i]),m=[];for(let e=0;e<o;e++)m.push(u[e]||null);return(0,U.jsxs)(`div`,{className:`space-y-5 min-w-0 overflow-hidden flex-1`,children:[(0,U.jsx)(Oo,{running:u,queued:d,concurrency:o,totalTokensToday:p}),(0,U.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,U.jsx)(nn,{className:`size-4 opacity-50`}),`Active Agents`]}),(0,U.jsxs)(`span`,{className:`text-xs opacity-50`,children:[u.length,`/`,o,` slots`]})]}),(0,U.jsx)(`div`,{className:`grid gap-3 min-w-0`,style:{gridTemplateColumns:`repeat(${Math.min(o,3)}, 1fr)`},children:m.map((e,t)=>(0,U.jsx)(To,{index:t,issue:e,total:o,workflow:c},t))})]}),d.length>0&&(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,U.jsx)(wn,{className:`size-4 opacity-50`}),`Queue`,(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:d.length})]}),(0,U.jsxs)(`div`,{className:`space-y-1 stagger-children`,children:[d.slice(0,12).map(e=>(0,U.jsx)(Eo,{issue:e},e.id)),d.length>12&&(0,U.jsxs)(`div`,{className:`text-xs opacity-40 pl-3`,children:[`+`,d.length-12,` more`]})]})]}),f.length>0&&(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,U.jsx)(Gt,{className:`size-4 opacity-50`}),`Recently Completed`,(0,U.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:f.length})]}),(0,U.jsx)(`div`,{className:`space-y-1 stagger-children`,children:f.map(e=>(0,U.jsx)(Do,{issue:e},e.id))})]}),u.length===0&&d.length===0&&f.length===0&&(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 animate-fade-in-up`,children:[(0,U.jsx)(`div`,{className:`bg-primary/10 rounded-full p-5 mb-4`,children:(0,U.jsx)(nn,{className:`size-10 text-primary opacity-60`})}),(0,U.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:`No agents running`}),(0,U.jsx)(`p`,{className:`text-sm opacity-50 text-center max-w-xs`,children:`Approve a plan on an issue to start an agent, or create a new issue from the Kanban board.`})]})]})}var Ao=b(`/agents`)({component:jo});function jo(){let e=Et();return(0,U.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:(0,U.jsx)(ko,{state:e.data,providers:e.providers.data||{},parallelism:e.parallelism.data||{},onRefresh:e.refresh,issues:e.issues})})}var Mo=b(`/`)({beforeLoad:()=>{throw j({to:`/kanban`})}}),No=b(`/settings/`)({beforeLoad:()=>{throw j({to:`/settings/general`})}}),Po=[{key:`plan`,label:`Plan`,icon:K,description:`Generate the execution plan`,accent:`info`},{key:`execute`,label:`Execute`,icon:Mn,description:`Implement the changes`,accent:`primary`},{key:`review`,label:`Review`,icon:W,description:`Review the implementation`,accent:`secondary`}],Fo=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`extra-high`,label:`Extra High`}],Io={info:{border:`border-info/30`,bg:`bg-info/10`,text:`text-info`,step:`step-info`,badge:`badge-info`},primary:{border:`border-primary/30`,bg:`bg-primary/10`,text:`text-primary`,step:`step-primary`,badge:`badge-primary`},secondary:{border:`border-secondary/30`,bg:`bg-secondary/10`,text:`text-secondary`,step:`step-secondary`,badge:`badge-secondary`}};function Lo({stage:e,config:t,providers:n,modelsByProvider:r,onChange:i,isLast:a,saving:o}){let s=e.icon,c=r[t.provider]||[],l=(n||[]).filter(e=>e.available),u=Io[e.accent];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`card bg-base-200 border-l-4 ${u.border} animate-fade-in`,children:(0,U.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-lg ${u.bg}`,children:(0,U.jsx)(s,{className:`size-4.5 ${u.text}`})}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,U.jsx)(`span`,{className:`badge badge-xs ${u.badge} badge-outline`,children:t.provider}),o===e.key&&(0,U.jsxs)(`span`,{className:`text-xs text-success flex items-center gap-1 animate-fade-in`,children:[(0,U.jsx)(Vt,{className:`size-3`}),` saved`]})]}),(0,U.jsx)(`p`,{className:`text-xs opacity-50`,children:e.description})]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2`,children:[(0,U.jsxs)(`label`,{className:`form-control`,children:[(0,U.jsx)(`div`,{className:`label py-0.5`,children:(0,U.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Provider`})}),(0,U.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.provider,onChange:e=>{let n=e.target.value,a=r[n]||[],o=n!==`codex`&&t.effort===`extra-high`?`high`:t.effort;i({...t,provider:n,model:a[0]?.id||``,effort:o})},children:l.map(e=>(0,U.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),(0,U.jsxs)(`label`,{className:`form-control`,children:[(0,U.jsx)(`div`,{className:`label py-0.5`,children:(0,U.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Model`})}),(0,U.jsxs)(`select`,{className:`select select-bordered select-sm w-full`,value:t.model,onChange:e=>i({...t,model:e.target.value}),children:[c.length===0&&(0,U.jsx)(`option`,{value:t.model,children:t.model||`(detecting...)`}),c.map(e=>(0,U.jsxs)(`option`,{value:e.id,children:[e.label,e.tier?` — ${e.tier}`:``]},e.id))]})]}),(0,U.jsxs)(`label`,{className:`form-control`,children:[(0,U.jsx)(`div`,{className:`label py-0.5`,children:(0,U.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Effort`})}),(0,U.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.effort,onChange:e=>i({...t,effort:e.target.value}),children:Fo.filter(e=>t.provider===`codex`||e.value!==`extra-high`).map(e=>(0,U.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})}),!a&&(0,U.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,U.jsx)(kt,{className:`size-4 opacity-20`})})]})}var Ro=b(`/settings/workflow`)({component:zo});function zo(){let e=w(),[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)([]),[a,o]=(0,L.useState)({}),[s,c]=(0,L.useState)(!0),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),p=(0,L.useRef)(null),m=(0,L.useCallback)(t=>{e.setQueryData(H,e=>Ve(e,{id:`runtime.workflowConfig`,scope:`runtime`,value:t,source:`user`,updatedAt:new Date().toISOString()})),e.setQueryData([`workflow-config`],{ok:!0,workflow:t,isDefault:!1})},[e]),h=(0,L.useCallback)(async()=>{c(!0);try{let e=await V.get(`/config/workflow?details=1`);n(e.workflow),i(e.providers||[]),o(e.models||{})}catch{}c(!1)},[]);(0,L.useEffect)(()=>{h()},[h]);let g=(0,L.useCallback)((e,t)=>{p.current&&clearTimeout(p.current),p.current=setTimeout(async()=>{try{await V.post(`/config/workflow`,{workflow:e}),m(e),u(t),setTimeout(()=>u(null),1500)}catch{}},600)},[m]),_=(0,L.useCallback)((e,t)=>{n(n=>{let r={...n,[e]:t};return g(r,e),r})},[g]),v=(0,L.useCallback)(async()=>{f(!0);try{let e=await V.get(`/config/workflow?details=1`),t=e.providers||[],r=e.models||{};i(t),o(r);let a=t.filter(e=>e.available),s=a.some(e=>e.name===`claude`),c=a.some(e=>e.name===`codex`),l=r.claude?.[0]?.id||``,d=r.codex?.[0]?.id||``,f={plan:{provider:s?`claude`:`codex`,model:s?l:d,effort:`high`},execute:{provider:c?`codex`:`claude`,model:c?d:l,effort:`medium`},review:{provider:s?`claude`:`codex`,model:s?l:d,effort:`medium`}};n(f),await V.post(`/config/workflow`,{workflow:f}),m(f),u(`all`),setTimeout(()=>u(null),1500)}catch{}f(!1)},[m]);return(0,L.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),s||!t?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,U.jsx)(En,{className:`size-6 animate-spin opacity-30`})}):(0,U.jsxs)(`div`,{className:`space-y-4 stagger-children`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Pipeline Workflow`}),(0,U.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`Changes are saved automatically.`})]}),(0,U.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 shrink-0`,onClick:v,disabled:d,children:[d?(0,U.jsx)(En,{className:`size-3 animate-spin`}):(0,U.jsx)(J,{className:`size-3`}),`Restore defaults`]})]}),(0,U.jsx)(`ul`,{className:`steps steps-horizontal w-full text-xs`,children:Po.map(e=>{let t=Io[e.accent];return(0,U.jsx)(`li`,{className:`step ${t.step}`,children:e.label},e.key)})}),(0,U.jsx)(`div`,{className:`flex flex-col`,children:Po.map((e,n)=>(0,U.jsx)(Lo,{stage:e,config:t[e.key],providers:r,modelsByProvider:a,onChange:t=>_(e.key,t),isLast:n===Po.length-1,saving:l===e.key||l===`all`?e.key:null},e.key))})]})}function Bo(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Vo(e){if(!e)return``;let t=new Date(e),n=new Date,r=t.getTime()-n.getTime();if(r<=0)return`now`;let i=Math.floor(r/(1e3*60*60)),a=Math.floor(i/24);if(a>0)return`${a}d ${i%24}h`;let o=Math.floor(r/(1e3*60)%60);return i>0?`${i}h ${o}m`:`${o}m`}function Ho({label:e,period:t,icon:n}){let r=t.inputTokens>0&&t.outputTokens>0;return(0,U.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-base-100`,children:[(0,U.jsx)(`div`,{className:`p-2 rounded-lg bg-base-300`,children:(0,U.jsx)(n,{className:`size-4 opacity-70`})}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-60`,children:e}),(0,U.jsxs)(`div`,{className:`font-mono font-semibold text-sm`,children:[Bo(t.tokensUsed),` tokens`]}),r&&(0,U.jsxs)(`div`,{className:`flex gap-3 mt-0.5`,children:[(0,U.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,U.jsx)(kt,{className:`size-2.5`}),` `,Bo(t.inputTokens)]}),(0,U.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,U.jsx)(Mt,{className:`size-2.5`}),` `,Bo(t.outputTokens)]})]})]}),(0,U.jsxs)(`div`,{className:`text-right`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-60`,children:`sessions`}),(0,U.jsx)(`div`,{className:`font-mono text-sm`,children:t.sessions})]})]})}function Uo({percentUsed:e,weeklyLimit:t,weeklyUsed:n}){if(e==null)return null;let r=e>=90?`progress-error`:e>=70?`progress-warning`:`progress-primary`,i=Math.max(0,100-e);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,U.jsx)(`span`,{className:`opacity-60`,children:`Weekly quota`}),(0,U.jsxs)(`span`,{className:`font-mono`,children:[Bo(n),` / `,Bo(t)]})]}),(0,U.jsx)(`progress`,{className:`progress ${r} w-full progress-animated`,value:e,max:100}),(0,U.jsxs)(`div`,{className:`flex justify-between text-[10px] mt-1`,children:[(0,U.jsxs)(`span`,{className:`opacity-50`,children:[e,`% used`]}),(0,U.jsxs)(`span`,{className:`font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[i,`% available`]})]})]})}function Wo({nextResetAt:e,resetInfo:t}){let n=Vo(e),r=e?new Date(e):null,i=r?r.toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`}):``;return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,U.jsx)(zt,{className:`size-3.5 opacity-50 shrink-0`}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsx)(`div`,{className:`opacity-50`,children:t}),e&&(0,U.jsxs)(`div`,{className:`font-mono font-medium mt-0.5`,children:[`Resets in `,(0,U.jsx)(`span`,{className:`text-primary`,children:n}),(0,U.jsxs)(`span`,{className:`opacity-40`,children:[` — `,i]})]})]})]})}function Go({models:e,currentModel:t}){let[n,r]=(0,L.useState)(!1);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`space-y-1`,children:(n?e:e.slice(0,4)).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${e.slug===t?`bg-primary/10 border border-primary/30`:`bg-base-100`}`,children:[(0,U.jsx)(Kt,{className:`size-3 ${e.slug===t?`text-primary`:`opacity-30`}`}),(0,U.jsx)(`span`,{className:`font-mono text-xs flex-1 truncate`,children:e.displayName||e.slug}),e.slug===t&&(0,U.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`active`})]},e.slug))}),e.length>4&&(0,U.jsxs)(`button`,{className:`btn btn-xs btn-ghost mt-1 w-full gap-1`,onClick:()=>r(!n),children:[n?(0,U.jsx)(Ut,{className:`size-3`}):(0,U.jsx)(Ht,{className:`size-3`}),n?`Show less`:`+${e.length-4} more`]})]})}function Ko({provider:e}){let{name:t,available:n,models:r,currentModel:i,usage:a,resetInfo:o,nextResetAt:s,weeklyLimitEstimate:c,percentUsed:l}=e;return(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(nn,{className:`size-5 ${t===`claude`?`text-warning`:`text-info`}`}),(0,U.jsx)(`h3`,{className:`card-title text-sm`,children:t===`claude`?`Claude Code`:t===`codex`?`Codex CLI`:t})]}),(0,U.jsx)(`span`,{className:`badge badge-sm ${n?`badge-success`:`badge-error`}`,children:n?`available`:`not found`})]}),i&&(0,U.jsxs)(`div`,{className:`text-xs opacity-60`,children:[`Active model: `,(0,U.jsx)(`span`,{className:`font-mono font-medium opacity-100`,children:i})]}),(0,U.jsx)(Uo,{percentUsed:l,weeklyLimit:c,weeklyUsed:a.thisWeek.tokensUsed}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50`,children:`Token usage`}),(0,U.jsx)(Ho,{label:`Today`,period:a.today,icon:Z}),(0,U.jsx)(Ho,{label:`This week`,period:a.thisWeek,icon:gn}),(0,U.jsx)(Ho,{label:`All time`,period:a.allTime,icon:Qt})]}),(0,U.jsx)(Wo,{nextResetAt:s,resetInfo:o}),r.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:[`Available Models (`,r.length,`)`]}),(0,U.jsx)(Go,{models:r,currentModel:i})]})]})})}function qo({providersUsage:e}){let t=e?.data,n=t?.providers||[];return e?.isLoading&&!t?(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[...[,,]].map((e,t)=>(0,U.jsx)(`div`,{className:`skeleton-card h-72`,style:{animationDelay:`${t*100}ms`}},t))}):n.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 opacity-50 animate-fade-in-up`,children:[(0,U.jsx)(nn,{className:`size-8`}),(0,U.jsx)(`p`,{className:`text-sm`,children:`No providers detected`})]}):(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 stagger-children`,children:n.map(e=>(0,U.jsx)(Ko,{provider:e},e.name))}),t?.collectedAt&&(0,U.jsxs)(`p`,{className:`text-xs opacity-40 text-center`,children:[`Last collected: `,new Date(t.collectedAt).toLocaleTimeString()]})]})}var Jo=b(`/settings/providers`)({component:Yo});function Yo(){return(0,U.jsx)(qo,{providersUsage:Et().providersUsage})}var Xo=(0,L.lazy)(()=>Mi(()=>import(`./OnboardingWizard-xyM3Okjv.js`),__vite__mapDeps([4,1,2,3]))),Zo=[`auto`,`light`,`dark`],Qo=`cupcake.bumblebee.emerald.corporate.synthwave.retro.cyberpunk.valentine.halloween.garden.forest.aqua.lofi.pastel.fantasy.wireframe.black.luxury.dracula.cmyk.autumn.business.acid.lemonade.night.coffee.winter.dim.nord.sunset.caramellatte.abyss.silk`.split(`.`),$o=[...Zo,...Qo];function es(e){return e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function ts({theme:e,onThemeChange:t}){let n=es(e),r=[`dark`,`night`,`sunset`,`black`,`synthwave`,`halloween`,`forest`,`luxury`,`dracula`,`business`,`coffee`,`dim`,`abyss`].includes(n);return(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(An,{className:`size-4 opacity-50`}),`Theme`]}),(0,U.jsxs)(`p`,{className:`text-xs opacity-50`,children:[`Current: `,(0,U.jsx)(`span`,{className:`font-semibold`,children:e}),e===`auto`&&(0,U.jsxs)(`span`,{children:[` (resolved to `,n,`)`]}),r?(0,U.jsx)(On,{className:`inline size-3 ml-1`}):(0,U.jsx)(Wn,{className:`inline size-3 ml-1`})]}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:$o.map(n=>(0,U.jsx)(`button`,{className:`btn btn-sm ${e===n?`btn-primary`:`btn-soft`}`,onClick:()=>t(n),children:n.charAt(0).toUpperCase()+n.slice(1)},n))})]})})}function ns({concurrency:e,setConcurrency:t,saveConcurrency:n,savePending:r}){return(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(nn,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,U.jsx)(`p`,{className:`text-xs opacity-50`,children:`Number of parallel workers executing issues simultaneously (1–10).`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{className:`input input-bordered input-sm w-20`,type:`number`,min:1,max:10,value:e,onChange:e=>t(e.target.value)}),(0,U.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,disabled:r,children:r?(0,U.jsx)(`span`,{className:`loading loading-spinner loading-xs`}):`Save`})]})]})})}function rs({status:e,wsStatus:t}){let n=e===`ok`,r=t===`connected`,i=n?`text-success`:`text-warning`,a=n?`Connected`:e===`offline`?`Offline`:`Degraded`,o={connected:`text-success`,connecting:`text-info`,disconnected:`text-warning`,error:`text-error`}[t]||`text-warning`,s=t.charAt(0).toUpperCase()+t.slice(1);return(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(Pn,{className:`size-4 opacity-50`}),`Connection Status`]}),(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,U.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[n&&(0,U.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),(0,U.jsx)(Kt,{className:`size-5 ${i} relative`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:`API`}),(0,U.jsx)(`div`,{className:`text-xs ${i}`,children:a})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,U.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[r&&(0,U.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),r?(0,U.jsx)(nr,{className:`size-5 ${o} relative`}):(0,U.jsx)(tr,{className:`size-5 ${o} relative`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:`WebSocket`}),(0,U.jsx)(`div`,{className:`text-xs ${o}`,children:s})]})]})]})]})})}function is({pwa:e}){let t=e?.isInstalled?`Installed`:e?.canInstall?`Installable`:`Browser-managed`;return(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(Bn,{className:`size-4 opacity-50`}),`Progressive Web App`]}),(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Service worker`}),(0,U.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:e?.serviceWorkerSupported?`Supported`:`Unavailable`})]}),(0,U.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Install status`}),(0,U.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:t})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:()=>e.installApp(),disabled:!e?.canInstall,children:[(0,U.jsx)(rn,{className:`size-3.5`}),` Install`]}),(0,U.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1`,onClick:()=>e.applyUpdate(),disabled:!e?.updateAvailable,children:[(0,U.jsx)(Fn,{className:`size-3.5`}),` Apply update`]})]})]})})}function as({notifications:e}){if(!e?.supported)return(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(Pt,{className:`size-4 opacity-50`}),`Notifications`]}),(0,U.jsx)(`p`,{className:`text-xs opacity-50`,children:`Desktop notifications are not supported in this browser.`})]})});let t=e.permission===`denied`,n=e.permission===`granted`,r=e.eventSettings||[];return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(Ft,{className:`size-4 opacity-50`}),`Desktop Notifications`]}),(0,U.jsx)(`p`,{className:`text-xs opacity-50`,children:`Get notified when issues change state — reviews needed, agents blocked, work completed.`}),(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Permission`}),(0,U.jsx)(`div`,{className:`text-sm font-medium mt-1 ${n?`text-success`:t?`text-error`:`text-warning`}`,children:e.permission===`default`?`Not asked yet`:e.permission})]}),(0,U.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,U.jsx)(`div`,{className:`text-xs opacity-50`,children:`Status`}),(0,U.jsx)(`div`,{className:`text-sm font-medium mt-1 ${e.enabled?`text-success`:``}`,children:e.enabled?`Enabled`:`Disabled`})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&!t&&(0,U.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:e.requestPermission,children:[(0,U.jsx)(Ft,{className:`size-3.5`}),` Enable notifications`]}),n&&(0,U.jsxs)(`label`,{className:`label cursor-pointer gap-2`,children:[(0,U.jsx)(`span`,{className:`text-sm`,children:`Notify on state changes`}),(0,U.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e.enabled,onChange:t=>e.setEnabled(t.target.checked)})]}),t&&(0,U.jsx)(`p`,{className:`text-xs text-error`,children:`Notifications were denied. Reset permission in your browser settings to re-enable.`}),n&&e.enabled&&(0,U.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:()=>new Notification(`fifony`,{body:`Notifications are working!`,icon:`/icon.svg`}),children:`Send test`})]})]})}),n&&e.enabled&&r.length>0&&(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(er,{className:`size-4 opacity-50`}),`Event Types`]}),(0,U.jsx)(`p`,{className:`text-xs opacity-50`,children:`Choose which events trigger notifications.`}),et.map(t=>{let n=r.filter(e=>e.group===t.id);return n.length===0?null:(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold opacity-40 uppercase tracking-wider`,children:t.label}),n.map(t=>(0,U.jsxs)(`label`,{className:`flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-base-300 transition-colors cursor-pointer`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-xs toggle-primary`,checked:t.enabled,onChange:n=>e.setEventEnabled(t.id,n.target.checked)}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`text-sm font-medium flex items-center gap-2`,children:[t.label,t.sound&&(0,U.jsx)($n,{className:`size-3 opacity-30`,title:`Plays sound`})]}),(0,U.jsx)(`div`,{className:`text-xs opacity-40`,children:t.description})]})]},t.id))]},t.id)})]})})]})}function os(){let[e,t]=(0,L.useState)(!1),n=w();return e?(0,U.jsx)(L.Suspense,{fallback:(0,U.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,U.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,U.jsx)(Xo,{onComplete:()=>{t(!1),n.invalidateQueries({queryKey:H})}})}):(0,U.jsx)(`div`,{className:`card bg-base-200`,children:(0,U.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,U.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,U.jsx)(er,{className:`size-4 opacity-50`}),`Setup Wizard`]}),(0,U.jsx)(`p`,{className:`text-xs opacity-50`,children:`Re-run the initial setup wizard to reconfigure providers, effort level, concurrency, and theme.`}),(0,U.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1 w-fit`,onClick:async()=>{try{await V.post(`/settings/ui.onboarding.completed`,{scope:`ui`,value:!1,source:`user`}),n.setQueryData(H,e=>Ve(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!1,source:`user`,updatedAt:new Date().toISOString()}))}catch{}t(!0)},children:[(0,U.jsx)(er,{className:`size-3.5`}),` Re-run Setup Wizard`]})]})})}var ss=b(`/settings/notifications`)({component:cs});function cs(){return(0,U.jsx)(`div`,{className:`space-y-5`,children:(0,U.jsx)(as,{notifications:Et().notifications})})}var ls=b(`/settings/general`)({component:us});function us(){let e=Et();return(0,U.jsxs)(`div`,{className:`space-y-5`,children:[(0,U.jsx)(rs,{status:e.status,wsStatus:e.wsStatus}),(0,U.jsx)(ns,{concurrency:e.concurrency,setConcurrency:e.setConcurrency,saveConcurrency:e.saveConcurrency,savePending:e.saveConcPending}),(0,U.jsx)(is,{pwa:e.pwa}),(0,U.jsx)(os,{}),(0,U.jsx)(ts,{theme:e.theme,onThemeChange:e.setTheme})]})}var ds=Ki.update({id:`/settings`,path:`/settings`,getParentRoute:()=>Wi}),fs=Xi.update({id:`/onboarding`,path:`/onboarding`,getParentRoute:()=>Wi}),ps=Ya.update({id:`/kanban`,path:`/kanban`,getParentRoute:()=>Wi}),ms=uo.update({id:`/issues`,path:`/issues`,getParentRoute:()=>Wi}),hs=_o.update({id:`/discover`,path:`/discover`,getParentRoute:()=>Wi}),gs=yo.update({id:`/analytics`,path:`/analytics`,getParentRoute:()=>Wi}).lazy(()=>Mi(()=>import(`./analytics.lazy-CfJXsh6r.js`).then(e=>e.Route),__vite__mapDeps([5,1,2]))),_s=Ao.update({id:`/agents`,path:`/agents`,getParentRoute:()=>Wi}),vs=Mo.update({id:`/`,path:`/`,getParentRoute:()=>Wi}),ys=No.update({id:`/`,path:`/`,getParentRoute:()=>ds}),bs=Ro.update({id:`/workflow`,path:`/workflow`,getParentRoute:()=>ds}),xs=Jo.update({id:`/providers`,path:`/providers`,getParentRoute:()=>ds}),Ss=ss.update({id:`/notifications`,path:`/notifications`,getParentRoute:()=>ds}),Cs={SettingsGeneralRoute:ls.update({id:`/general`,path:`/general`,getParentRoute:()=>ds}),SettingsNotificationsRoute:Ss,SettingsProvidersRoute:xs,SettingsWorkflowRoute:bs,SettingsIndexRoute:ys},ws={IndexRoute:vs,AgentsRoute:_s,AnalyticsRoute:gs,DiscoverRoute:hs,IssuesRoute:ms,KanbanRoute:ps,OnboardingRoute:fs,SettingsRoute:ds._addFileChildren(Cs)},Ts=Wi._addFileChildren(ws)._addFileTypes();window.__fifonyInstallPrompt=null,window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),window.__fifonyInstallPrompt=e});var Es=new F({defaultOptions:{queries:{staleTime:2e3,retry:1,refetchOnWindowFocus:!1}}}),Ds=T({routeTree:Ts,basepath:`/`,defaultPreload:`intent`});(0,I.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(L.StrictMode,{children:(0,U.jsx)(D,{client:Es,children:(0,U.jsx)(A,{router:Ds})})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/service-worker.js`,{scope:`/`}).catch(()=>{})});export{_t as A,V as B,Wt as C,Ot as D,kt as E,Ve as F,Je as I,Ye as L,H as M,Be as N,ht as O,ze as P,Ue as R,Gt as S,Lt as T,pe as V,fn as _,Y as a,Qt as b,Vn as c,An as d,q as f,G as g,pn as h,Qn as i,St as j,bt as k,Ln as l,Sn as m,Z as n,Xn as o,En as p,X as r,Yn as s,Di as t,Fn as u,dn as v,Vt as w,Yt as x,nn as y,qe as z};
|