fifony 0.1.36 → 0.1.38
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/app/dist/assets/{CommandPalette-CyyF04a2.js → CommandPalette-Ct6qhS6N.js} +1 -1
- package/app/dist/assets/{KeyboardShortcutsHelp-D71YmyfF.js → KeyboardShortcutsHelp-CuBWBOeU.js} +1 -1
- package/app/dist/assets/OnboardingWizard-9qzUVfYb.js +1 -0
- package/app/dist/assets/{analytics.lazy-D8vsSFxh.js → analytics.lazy-C25zZ3JA.js} +1 -1
- package/app/dist/assets/createLucideIcon-R47sXufx.js +1 -0
- package/app/dist/assets/index-BWB0OQnx.css +1 -0
- package/app/dist/assets/index-LC--nUBy.js +54 -0
- package/app/dist/index.html +3 -3
- package/app/dist/service-worker.js +1 -1
- package/dist/agent/run-local.js +6 -6
- package/dist/{agent-5AEC4SL7.js → agent-YAUMQQUS.js} +7 -7
- package/dist/{chunk-OONOOWNC.js → chunk-37N5OFHM.js} +4 -2
- package/dist/{chunk-GYVLPWYB.js → chunk-DYOLZYEC.js} +12 -12
- package/dist/{chunk-QBAR5JLY.js → chunk-FDR47R6J.js} +43 -8
- package/dist/{chunk-O5AEQXUV.js → chunk-T2YJOZ6N.js} +2 -2
- package/dist/{chunk-LUIPCPRO.js → chunk-VOA5UMXD.js} +44 -12
- package/dist/{chunk-A7BVAGPW.js → chunk-YBMQIQ2X.js} +604 -944
- package/dist/cli.js +6 -6
- package/dist/issue-runner-VVZVUMRF.js +15 -0
- package/dist/{issue-state-machine-JCGSR5QP.js → issue-state-machine-A6NMZG5W.js} +5 -5
- package/dist/{issues-2ENRFJHC.js → issues-2X2H3SBN.js} +7 -9
- package/dist/mcp/server.js +2 -2
- package/dist/{queue-workers-BQLDNMFQ.js → queue-workers-6MZWSPBW.js} +3 -3
- package/dist/{scheduler-5XTHGLCA.js → scheduler-OZRHGZIU.js} +7 -7
- package/dist/{store-44KLJAXC.js → store-O3UNJU26.js} +13 -7
- package/dist/{workspace-U43FRPEB.js → workspace-E26GGQES.js} +4 -4
- package/package.json +8 -8
- package/app/dist/assets/OnboardingWizard-TLlzqU2A.js +0 -1
- package/app/dist/assets/createLucideIcon-CBw-4t9s.js +0 -1
- package/app/dist/assets/index-Ccu8chEN.js +0 -49
- package/app/dist/assets/index-rLcPCr9E.css +0 -1
- package/dist/issue-runner-VOW7MZEK.js +0 -15
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KeyboardShortcutsHelp-CuBWBOeU.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/vendor-DkWeBvNl.js","assets/CommandPalette-Ct6qhS6N.js","assets/createLucideIcon-R47sXufx.js","assets/api-ChEctgc5.js","assets/OnboardingWizard-9qzUVfYb.js","assets/analytics.lazy-C25zZ3JA.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.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,a as m,b as h,c as g,d as _,f as v,g as y,h as b,i as x,j as S,k as C,l as w,m as T,n as E,p as D,r as O,s as k,t as A,u as j,v as M,w as N,x as P,y as F}from"./vendor-DkWeBvNl.js";import{a as I,c as ee,i as te,l as L,o as R,r as z,s as B,t as V,u as H}from"./api-ChEctgc5.js";import{t as U}from"./createLucideIcon-R47sXufx.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=>{h(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:P;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 y({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(){F.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){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(C))))}};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(){F.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){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ce=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(S(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=N(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.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;F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return F.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(C).catch(C)}invalidateQueries(e,t={}){return F.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=F.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(C)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(C)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(S(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(C).catch(C)}fetchInfiniteQuery(e){return e.behavior=ne(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(C).catch(C)}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()}},le=a(),W=e(o(),1),ue=`/assets/dinofffaur.webp`;function de(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 fe(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=de(Array.isArray(n.issues)?n.issues:[],t.issuesDelta,t.issuesRemoved||[])),Array.isArray(t.events)&&(r.events=t.events),r}function pe(e){let[t,n]=(0,W.useState)(`disconnected`),r=T();return(0,W.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=L(t.data);n&&(r.setQueriesData({queryKey:[`runtime-state`]},e=>fe(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 me({pollInterval:e=3e3,showAll:t=!1}={}){return v({queryKey:[`runtime-state`,t],queryFn:()=>V.get(t?`/state?all=1`:`/state`),refetchInterval:e})}function he(e,t,n=2500){let r=new URLSearchParams;return e&&e!==`all`&&r.set(`kind`,e),t&&t!==`all`&&r.set(`issueId`,t),v({queryKey:[`runtime-events`,e,t],queryFn:()=>V.get(`/events/feed${r.size?`?${r}`:``}`),refetchInterval:n})}function ge(){return v({queryKey:[`providers`],queryFn:()=>V.get(`/providers`),refetchInterval:15e3})}function _e(){return v({queryKey:[`parallelism`],queryFn:()=>V.get(`/parallelism`),refetchInterval:15e3})}var ve=[`claude`,`codex`,`gemini`];function ye(e){if(!e||typeof e!=`object`||!Array.isArray(e.providers))return null;let t=typeof e.collectedAt==`string`?e.collectedAt:null;return{providers:e.providers,collectedAt:t}}function be(){return v({queryKey:[`providers-usage`],queryFn:async()=>{let e=await Promise.allSettled(ve.map(e=>V.get(`/providers/${e}/usage`))),t=[],n=[];for(let r of e){if(r.status!==`fulfilled`)continue;let e=ye(r.value);e&&(t.push(...e.providers),e.collectedAt&&n.push(e.collectedAt))}if(t.length>0){let e=n.map(e=>new Date(e).getTime()).filter(e=>Number.isFinite(e)).reduce((e,t)=>Math.max(e,t),0);return{providers:t,collectedAt:e?new Date(e).toISOString():new Date().toISOString()}}try{let e=ye(await V.get(`/providers/usage`));e&&(t=e.providers,e.collectedAt&&n.push(e.collectedAt))}catch{}let r=n.map(e=>new Date(e).getTime()).filter(e=>Number.isFinite(e)).reduce((e,t)=>Math.max(e,t),0);return{providers:t,collectedAt:r?new Date(r).toISOString():new Date().toISOString()}},refetchInterval:3e4})}var xe=[`auto`,`light`,`dark`],Se=`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(`.`),Ce=[...xe,...Se],G=[`settings`],we=`ui.theme`,Te=`ui.notifications.enabled`,Ee=`ui.issues.stateFilter`,De=`ui.issues.completionFilter`,Oe=`ui.events.kind`,ke=`ui.events.issueId`,Ae=window.matchMedia(`(prefers-color-scheme: dark)`);function je(e){return e===`auto`?Ae.matches?`dark`:`light`:e}function Me(e){return Ce.includes(e)?e:`auto`}function Ne(e,t=!1){return typeof e==`boolean`?e:t}function Pe(e){return Array.isArray(e?.settings)?e.settings:[]}function Fe(e,t,n){return(Array.isArray(e)?e.find(e=>e?.id===t):null)?.value??n}function Ie(e,t){let n=e&&typeof e==`object`?e:{},r=Pe(n).filter(e=>e?.id!==t.id);return{...n,settings:[...r,t]}}async function Le(e,t){return V.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:t,source:`user`})}function Re(){return v({queryKey:G,queryFn:()=>V.get(`/settings`),staleTime:3e4})}function ze(e,t,n={}){let r=T(),i=Re(),a=typeof n.normalize==`function`?n.normalize:e=>e,o=a(Fe(Pe(i.data),e,t)),[s,c]=(0,W.useState)(o),l=(0,W.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:G}),r.setQueryData(G,e=>Ie(e,i)),V.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:n,source:`user`}).then(e=>{e?.setting&&r.setQueryData(G,t=>Ie(t,e.setting))}).catch(()=>{r.invalidateQueries({queryKey:G})})},[a,r,e]);return(0,W.useEffect)(()=>{c(e=>Object.is(e,o)?e:o)},[o]),[s,l]}function Be(){let e=T(),t=Me(Fe(Pe(Re().data),we,`auto`)),[n,r]=(0,W.useState)(t),i=(0,W.useCallback)(t=>{let n=Me(t);r(n);let i={id:we,scope:`ui`,value:n,source:`user`,updatedAt:new Date().toISOString()};e.cancelQueries({queryKey:G}),e.setQueryData(G,e=>Ie(e,i)),V.post(`/settings/${encodeURIComponent(we)}`,{scope:`ui`,value:n,source:`user`}).then(t=>{t?.setting&&e.setQueryData(G,e=>Ie(e,t.setting))}).catch(()=>{e.invalidateQueries({queryKey:G})})},[e]);return(0,W.useEffect)(()=>{r(e=>e===t?e:t)},[t]),(0,W.useEffect)(()=>{let e=()=>{let e=document.documentElement;return e.classList.add(`theme-transitioning`),e.setAttribute(`data-theme`,je(n)),setTimeout(()=>e.classList.remove(`theme-transitioning`),350)},t=e();if(n===`auto`){let n=()=>e();return Ae.addEventListener(`change`,n),()=>{clearTimeout(t),Ae.removeEventListener(`change`,n)}}return()=>clearTimeout(t)},[n]),[n,i]}function Ve(){return ze(Te,!1,{normalize:e=>Ne(e,!1)})}function He(){return v({queryKey:[`token-analytics`],queryFn:()=>V.get(`/analytics/tokens`),refetchInterval:1e4})}function Ue({pollInterval:e=3e4}={}){return v({queryKey:[`analytics-lines`],queryFn:()=>V.get(`/analytics/lines`),refetchInterval:e})}function We({pollInterval:e=3e4}={}){return v({queryKey:[`analytics-kpis`],queryFn:()=>V.get(`/analytics/kpis`),refetchInterval:e})}function Ge(){let[e,t]=(0,W.useState)(()=>navigator.onLine),[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(()=>window.matchMedia(`(display-mode: standalone)`).matches||window.navigator.standalone===!0);(0,W.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,W.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,W.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,W.useCallback)(async()=>!n||(await n.prompt(),(await n.userChoice)?.outcome!==`accepted`)?!1:(r(null),a(!1),!0),[n]),d=(0,W.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 Ke=`ui.notifications.events.`,qe=[1e4,5e4,1e5,5e5,1e6],Je=[{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:`PendingDecision`,label:`Review complete`,description:`When the review step finishes.`,icon:`eye`,sound:!1,defaultEnabled:!0,group:`review`},{id:`done`,state:`Approved`,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`}],Ye=[{id:`execution`,label:`Execution`},{id:`review`,label:`Review`},{id:`lifecycle`,label:`Lifecycle`},{id:`usage`,label:`Usage`}],Xe=new Map(Je.map(e=>[e.state,e]));function Ze(e){return Xe.get(e)??null}function Qe(e){return`${Ke}${e}`}function $e(e,t){let n=Xe.get(t);if(!n)return!1;let r=Qe(n.id);return(Array.isArray(e)?e.find(e=>e?.id===r):null)?.value??n.defaultEnabled}function et(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function tt(){return`Notification`in window?Notification.permission:`unsupported`}function nt(e,t,n){if(tt()===`granted`)try{new Notification(e,{body:t,tag:`fifony-${n}`,icon:`/icon.svg`,badge:`/icon.svg`,silent:!1})}catch{}}var rt=null;function it(){if(!rt)try{rt=new(window.AudioContext||window.webkitAudioContext)}catch{return null}return rt}var at=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;function ot(e){if(!e||at)return;let t=it();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 st=0;function ct(){let[e,t]=(0,W.useState)([]),[n,r]=(0,W.useState)(0),i=(0,W.useCallback)(e=>{let n=++st,i={id:n,...e,timestamp:Date.now(),read:!1};return t(e=>[i,...e].slice(0,30)),r(e=>e+1),n},[]),a=(0,W.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,W.useCallback)(()=>{t(e=>e.map(e=>e.read?e:{...e,read:!0})),r(0)},[]);return(0,W.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 lt(e){let[t,n]=Ve(),[r,i]=(0,W.useState)(tt),a=(0,W.useRef)(new Map),o=(0,W.useRef)(new Map),s=ct(),c=Pe(Re().data),l=T(),u=(0,W.useCallback)(e=>{n(e)},[n]),d=(0,W.useCallback)(async()=>{if(!(`Notification`in window))return`unsupported`;let e=await Notification.requestPermission();return i(e),e===`granted`&&u(!0),e},[u]),f=Je.map(e=>({...e,enabled:$e(c,e.state),settingId:Qe(e.id)})),p=(0,W.useCallback)(async(e,t)=>{await Le(Qe(e),t),l.invalidateQueries({queryKey:[`settings`]})},[l]);return(0,W.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=Ze(r.state);if(e&&$e(c,r.state)){let n=`${e.label}: ${r.identifier}`,i=r.title;nt(n,i,`${e.id}-${r.id}`),s.addNotification({title:n,body:i,state:r.state,icon:e.icon,issueId:r.id}),e.sound&&ot(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&&Ze(`token-milestone`)&&$e(c,`token-milestone`))){let e=et(t),n=`Token milestone: ${e}`,i=`${r.identifier} has used ${e} tokens`;nt(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 ut=`system.projectName`;function dt(e){return typeof e==`string`?e.trim().replace(/\s+/g,` `):``}function ft(e){let t=typeof e==`string`?e.trim().replace(/[\\/]+$/,``):``;return t?dt(t.split(/[\\/]+/).filter(Boolean).at(-1)||``):``}function pt(e){return dt((Array.isArray(e)?e:[]).find(e=>e?.id===ut)?.value)}function mt(e){let t=dt(e);return t?`fifony: ${t}`:`fifony`}function ht({savedProjectName:e=``,detectedProjectName:t=``}={}){let n=dt(e),r=dt(t),i=n||r;return{projectName:i,detectedProjectName:r,source:n?`saved`:r?`detected`:`missing`,requiresManualEntry:!i}}function gt(e,t={}){let n=pt(e),r=dt(t?.detectedProjectName)||ft(t?.sourceRepoUrl||t?.config?.sourceRepo||``),i=dt(t?.projectName),a=t?.projectNameSource,o=ht({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:mt(s)}}var K=b(),_t=(0,W.createContext)(null),vt=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],yt=new Set([`recent`,`all`]);function bt(){let e=(0,W.useContext)(_t);if(!e)throw Error(`useDashboard must be used within DashboardProvider`);return e}function xt({children:e}){let t=Re(),[n,r]=Be(),[i,a]=ze(Ee,`all`,{normalize:e=>e===`all`||te.includes(e)?e:`all`}),o=()=>{},[s,c]=ze(De,`recent`,{normalize:e=>yt.has(e)?e:`recent`}),[l,u]=(0,W.useState)(``),[d,f]=ze(Oe,`all`,{normalize:e=>vt.includes(e)?e:`all`}),[p,m]=ze(ke,`all`,{normalize:e=>typeof e==`string`&&e.trim()?e:`all`}),[h,g]=(0,W.useState)(`3`),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(null),[w,E]=(0,W.useState)(!1),[D,O]=(0,W.useState)(null),[k,A]=(0,W.useState)(!1),[j,M]=(0,W.useState)([]),N=Ge(),P=T(),F=pe((0,W.useCallback)(e=>{Array.isArray(e?.events)&&M(e.events)},[])),I=F===`connected`,ee=me({pollInterval:3e3,showAll:s===`all`}),L=he(d,p,I?3e3:2500),R=ge(),z=_e(),B=ee.data||{},H=Array.isArray(B.issues)?B.issues:[],U=B.metrics||{},ne=(0,W.useMemo)(()=>gt(Pe(t.data),B),[t.data,B]),re=I||B.config?`ok`:`offline`,ie=I?j:L.data?.events||[],ae=(0,W.useMemo)(()=>D&&H.find(e=>e.id===D)||null,[D,H]),oe=(0,W.useCallback)(e=>{O(e?.id||null)},[]),se=(0,W.useMemo)(()=>{let e=l.toLowerCase();return H.filter(t=>!(i!==`all`&&t.state!==i||e&&!`${t.identifier} ${t.title} ${t.description||``}`.toLowerCase().includes(e)))},[H,i,l]),ce=(0,W.useMemo)(()=>[`all`],[]),le=(0,W.useMemo)(()=>[...new Set(H.map(e=>e.id))].sort(),[H]);(0,W.useEffect)(()=>{p!==`all`&&!le.includes(p)&&m(`all`)},[p,le,m]);let ue=(0,W.useCallback)((e,t=`info`)=>{x(!1),y({message:typeof e==`string`?e:String(e),type:t}),setTimeout(()=>{x(!0),setTimeout(()=>{y(null),x(!1)},250)},3e3)},[]),de=(0,W.useCallback)((e,t,n)=>{C({x:e??window.innerWidth/2,y:t??window.innerHeight/3,count:n??24})},[]),fe=(0,W.useCallback)(()=>C(null),[]),ve=_({mutationFn:e=>V.post(`/issues/create`,e),onSuccess:e=>{e?.issue&&P.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]}}),P.invalidateQueries({queryKey:[`runtime-state`]}),E(!1),ue(`Issue created`,`success`),de()},onError:e=>ue(e.message,`error`)}),ye=_({mutationFn:({id:e,state:t})=>V.post(`/issues/${encodeURIComponent(e)}/state`,{state:t}),onSuccess:()=>{P.invalidateQueries({queryKey:[`runtime-state`]}),ue(`State updated`,`success`)},onError:e=>ue(e.message,`error`)}),be=_({mutationFn:({id:e,feedback:t})=>V.post(`/issues/${encodeURIComponent(e)}/retry`,t?{feedback:t}:void 0),onSuccess:()=>P.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>ue(e.message)}),xe=_({mutationFn:e=>V.post(`/issues/${encodeURIComponent(e)}/cancel`),onSuccess:()=>P.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>ue(e.message)}),Se=_({mutationFn:()=>V.post(`/refresh`,{}),onSuccess:()=>P.invalidateQueries(),onError:e=>ue(e.message)}),Ce=_({mutationFn:()=>V.post(`/config/concurrency`,{concurrency:parseInt(h,10)}),onSuccess:()=>{P.invalidateQueries({queryKey:[`runtime-state`]}),ue(`Concurrency updated`,`success`)},onError:e=>ue(e.message,`error`)});(0,W.useEffect)(()=>{B.config?.workerConcurrency&&g(String(B.config.workerConcurrency))},[B.config?.workerConcurrency]);let G=(0,W.useCallback)(()=>A(e=>!e),[]),we=lt(H),Te=(0,W.useRef)(new Map);(0,W.useEffect)(()=>{let e=Te.current;for(let t of H){let n=e.get(t.id);if(n&&n!==`Merged`&&t.state===`Merged`){let e=document.querySelector(`[data-issue-id="${t.id}"]`);if(e){let t=e.getBoundingClientRect();de(t.left+t.width/2,t.top+t.height/2,12)}else de(void 0,void 0,12)}}let t=new Map;for(let e of H)t.set(e.id,e.state);Te.current=t},[H,de]);let Ae=(0,W.useMemo)(()=>({theme:n,setTheme:r,status:re,wsStatus:F,liveMode:I,data:B,issues:H,filtered:se,metrics:U,eventsData:ie,providers:R,parallelism:z,projectName:ne.projectName,queueTitle:ne.queueTitle,categoryOptions:ce,issueOptions:le,runtime:ee,query:l,setQuery:u,stateFilter:i,setStateFilter:a,categoryFilter:`all`,setCategoryFilter:o,completionFilter:s,setCompletionFilter:c,isEventsOpen:k,toggleEvents:G,setIsEventsOpen:A,eventKind:d,setEventKind:f,eventIssueId:p,setEventIssueId:m,isCreateOpen:w,setIsCreateOpen:E,createIssue:ve,selectedIssue:ae,setSelectedIssue:oe,updateState:(e,t)=>ye.mutate({id:e,state:t}),retryIssue:(e,t)=>be.mutate({id:e,feedback:t}),cancelIssue:e=>xe.mutate(e),refresh:()=>Se.mutate(),concurrency:h,setConcurrency:g,saveConcurrency:()=>Ce.mutate(),saveConcPending:Ce.isPending,pwa:N,notifications:we,toast:v,toastExiting:b,showToast:ue,confetti:S,showConfetti:de,clearConfetti:fe}),[n,re,F,I,B,H,se,U,ie,R,z,ce,le,ee,ne,l,i,`all`,s,k,d,p,w,ae,h,v,b,S,N,we,r,u,a,o,c,G,A,f,m,E,oe,g,ue,de,fe,ve,ye,be,xe,Se,Ce]);return(0,K.jsx)(_t.Provider,{value:Ae,children:e})}var St=U(`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`}]]),Ct=U(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),wt=U(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Tt=U(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Et=U(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Dt=U(`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`}]]),Ot=U(`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`}]]),kt=U(`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`}]]),At=U(`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`}]]),jt=U(`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`}]]),Mt=U(`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`}]]),Nt=U(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Pt=U(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ft=U(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),It=U(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Lt=U(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Rt=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),zt=U(`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`}]]),Bt=U(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Vt=U(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ht=U(`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`}]]),Ut=U(`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`}]]),Wt=U(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Gt=U(`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`}]]),Kt=U(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),qt=U(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Jt=U(`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`}]]),Yt=U(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Xt=U(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Zt=U(`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`}]]),Qt=U(`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`}]]),$t=U(`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`}]]),en=U(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),tn=U(`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`}]]),nn=U(`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`}]]),rn=U(`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`}]]),an=U(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),on=U(`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`}]]),sn=U(`folder-root`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}],[`path`,{d:`M12 15v5`,key:`11xva1`}]]),cn=U(`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`}]]),ln=U(`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`}]]),un=U(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),dn=U(`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`}]]),q=U(`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`}]]),fn=U(`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`}]]),pn=U(`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`}]]),mn=U(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),hn=U(`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`}]]),gn=U(`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`}]]),_n=U(`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`}]]),vn=U(`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`}]]),yn=U(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),bn=U(`kanban`,[[`path`,{d:`M5 3v14`,key:`9nsxs2`}],[`path`,{d:`M12 3v8`,key:`1h2ygw`}],[`path`,{d:`M19 3v18`,key:`1sk56x`}]]),xn=U(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Sn=U(`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`}]]),Cn=U(`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`}]]),wn=U(`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`}]]),Tn=U(`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`}]]),En=U(`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`}]]),Dn=U(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),J=U(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Y=U(`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`}]]),On=U(`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`}]]),kn=U(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),An=U(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),jn=U(`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`}]]),Mn=U(`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`}]]),Nn=U(`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`}]]),Pn=U(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Fn=U(`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`}]]),In=U(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Ln=U(`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`}]]),Rn=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),zn=U(`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`}]]),Bn=U(`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`}]]),Vn=U(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Hn=U(`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`}]]),Un=U(`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`}]]),Wn=U(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Gn=U(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Kn=U(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qn=U(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Jn=U(`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`}]]),Yn=U(`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`}]]),Xn=U(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Zn=U(`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`}]]),Qn=U(`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`}]]),$n=U(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),er=U(`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`}]]),tr=U(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),nr=U(`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`}]]),rr=U(`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`}]]),ir=U(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),X=U(`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`}]]),ar=U(`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`}]]),or=U(`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`}]]),sr=U(`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`}]]),cr=U(`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`}]]),lr=U(`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`}]]),ur=U(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),dr=U(`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`}]]),fr=U(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),pr=U(`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`}]]),mr={Running:Ln,Queued:Kt,Reviewing:tn,PendingDecision:tn,Approved:zt,Blocked:X,Cancelled:Ut,"token-milestone":pr},hr={Running:`text-info`,Queued:`text-warning`,Reviewing:`text-accent`,PendingDecision:`text-success`,Approved:`text-success`,Blocked:`text-error`,Cancelled:`text-base-content/40`,"token-milestone":`text-secondary`},gr={Running:`bg-info/8`,Queued:`bg-warning/8`,Reviewing:`bg-accent/8`,PendingDecision:`bg-success/8`,Approved:`bg-success/8`,Blocked:`bg-error/8`,Cancelled:`bg-base-200`,"token-milestone":`bg-secondary/8`};function _r(){let[e,t]=(0,W.useState)(()=>window.innerWidth<768);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function vr({notif:e,onDismiss:t}){let n=mr[e.state]||Ot,r=hr[e.state]||`text-base-content`,i=e.read?``:gr[e.state]||``,a=e.title?.match(/(.*?):\s*(#\S+|[A-Z]+-\d+)$/),o=a?a[1]:e.title,s=a?a[2]:null;return(0,K.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,K.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0 ${r}`,children:(0,K.jsx)(n,{className:`size-4`})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[s&&(0,K.jsx)(`span`,{className:`font-mono text-[11px] font-semibold opacity-70 shrink-0`,children:s}),(0,K.jsx)(`p`,{className:`text-xs font-medium leading-snug line-clamp-2`,children:o})]}),e.body&&(0,K.jsx)(`p`,{className:`text-xs opacity-50 leading-snug mt-0.5 line-clamp-1`,children:e.body}),(0,K.jsx)(`p`,{className:`text-[10px] opacity-30 mt-1`,children:H(e.timestamp)})]}),!e.read&&(0,K.jsx)(`span`,{className:`size-1.5 rounded-full shrink-0 mt-1.5 ${r.replace(`text-`,`bg-`)}`})]}),(0,K.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,K.jsx)(fr,{className:`size-3`})})]})}function yr({notifications:e,onDismiss:t}){return e.length===0?(0,K.jsxs)(`div`,{className:`py-10 text-center`,children:[(0,K.jsx)(Ot,{className:`size-8 mx-auto opacity-10 mb-2`}),(0,K.jsx)(`p`,{className:`text-sm opacity-40`,children:`No notifications yet`}),(0,K.jsx)(`p`,{className:`text-xs opacity-25 mt-0.5`,children:`State changes and milestones will appear here`})]}):(0,K.jsx)(`div`,{className:`max-h-80 overflow-y-auto overscroll-contain max-md:max-h-[60vh]`,children:(0,K.jsx)(`ul`,{children:e.map((e,n)=>(0,K.jsx)(vr,{notif:e,onDismiss:t},e.id))})})}function br({count:e,onMarkAllRead:t,onClose:n}){return(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-base-300`,children:[(0,K.jsx)(`span`,{className:`text-sm font-semibold`,children:`Notifications`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e>0&&(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,onClick:t,"aria-label":`Mark all as read`,children:[(0,K.jsx)(Nt,{className:`size-3`}),`Mark all read`]}),n&&(0,K.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-circle`,onClick:n,children:(0,K.jsx)(fr,{className:`size-4`})})]})]})}function xr({open:e,onClose:t,notifications:n,onDismiss:r,onMarkAllRead:i}){let[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(null),c=(0,W.useCallback)(()=>{o(!0),setTimeout(()=>{o(!1),t()},250)},[t]),l=(0,W.useCallback)(e=>{s.current=e.touches[0].clientY},[]),u=(0,W.useCallback)(e=>{s.current!==null&&(e.changedTouches[0].clientY-s.current>80&&c(),s.current=null)},[c]);return!e&&!a?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50
|
|
8
|
+
${a?`animate-toast-out`:`animate-fade-in`}`,onClick:c}),(0,K.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,K.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,K.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,K.jsx)(br,{count:n.length,onMarkAllRead:i,onClose:c}),(0,K.jsx)(yr,{notifications:n,onDismiss:r})]})]})}function Sr({notifications:e,unreadCount:t,onDismiss:n,onMarkAllRead:r}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null),s=_r(),c=(0,W.useCallback)(()=>a(e=>!e),[]);return(0,W.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,W.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),(0,K.jsxs)(`div`,{className:`relative`,ref:o,children:[(0,K.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,K.jsx)(Ot,{className:`size-4`}),t>0&&(0,K.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,K.jsx)(xr,{open:i,onClose:()=>a(!1),notifications:e,onDismiss:n,onMarkAllRead:r}),!s&&i&&(0,K.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,K.jsx)(br,{count:e.length,onMarkAllRead:r}),(0,K.jsx)(yr,{notifications:e,onDismiss:n})]})]})}var Cr=[{to:`/kanban`,label:`Kanban`,icon:bn},{to:`/issues`,label:`Issues`,icon:En},{to:`/agents`,label:`Agents`,icon:At},{to:`/analytics`,label:`Analytics`,icon:ir},{to:`/settings`,label:`Settings`,icon:Yn}];function wr({count:e}){let t=(0,W.useRef)(e),[n,r]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{if(t.current!==e){t.current=e,r(!0);let n=setTimeout(()=>r(!1),300);return()=>clearTimeout(n)}},[e]),(0,K.jsx)(`span`,{className:`badge badge-xs badge-primary ${n?`animate-count-bump`:``}`,children:e})}function Tr({status:e}){return e===`connected`?(0,K.jsxs)(`span`,{className:`relative flex size-2`,children:[(0,K.jsx)(`span`,{className:`animate-ping absolute inline-flex h-full w-full rounded-full bg-success opacity-50`}),(0,K.jsx)(`span`,{className:`relative inline-flex rounded-full size-2 bg-success`})]}):e===`connecting`?(0,K.jsxs)(`span`,{className:`flex items-center gap-0.5 dot-pulse-group`,children:[(0,K.jsx)(`span`,{className:`size-1 rounded-full bg-info`}),(0,K.jsx)(`span`,{className:`size-1 rounded-full bg-info`}),(0,K.jsx)(`span`,{className:`size-1 rounded-full bg-info`})]}):(0,K.jsx)(`span`,{className:`size-2 rounded-full bg-warning animate-pulse-soft`})}function Er({navRef:e,currentPath:t}){let[n,r]=(0,W.useState)({left:0,width:0,opacity:0}),i=(0,W.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,W.useLayoutEffect)(i,[t,i]),(0,W.useEffect)(()=>(window.addEventListener(`resize`,i),()=>window.removeEventListener(`resize`,i)),[i]),(0,K.jsx)(`div`,{className:`nav-indicator`,style:n})}function Dr(e){if(!e)return null;let t=e.replace(/\/+$/,``).split(`/`).pop();return!t||t===e?e:t}function Or({issueCount:e,sourceRepo:t,queueTitle:n,updatedAt:r,onToggleEvents:i,eventsOpen:a,wsStatus:o,notifications:s,issues:c}){let l=A().location.pathname,u=(0,W.useRef)(null),d=Dr(t),f=n||`fifony`,p=d&&f!==mt(d)?d:null;return(0,K.jsxs)(`div`,{className:`navbar bg-base-100 shadow-sm px-4`,children:[(0,K.jsx)(`div`,{className:`flex-1 min-w-0 gap-2`,children:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(g,{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,K.jsx)(`span`,{className:`truncate`,children:f})}),p&&(0,K.jsx)(`div`,{className:`text-xs opacity-40 hidden lg:block truncate px-2`,children:p})]})}),(0,K.jsx)(`div`,{className:`flex-none hidden md:flex`,children:(0,K.jsxs)(`div`,{className:`relative`,ref:u,children:[(0,K.jsx)(`ul`,{className:`menu menu-horizontal px-1 gap-1`,children:Cr.map(({to:t,label:n,icon:r})=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(g,{to:t,className:`nav-link ${l.startsWith(t)?`active nav-link-active`:``}`,children:[(0,K.jsx)(r,{className:`size-4`}),n,t===`/issues`&&e>0&&(0,K.jsx)(wr,{count:e})]})},t))}),(0,K.jsx)(Er,{navRef:u,currentPath:l})]})}),(0,K.jsx)(`div`,{className:`flex-none`,children:(0,K.jsxs)(`ul`,{className:`menu menu-horizontal px-1 items-center gap-0`,children:[s&&(0,K.jsx)(`li`,{children:(0,K.jsx)(`span`,{className:`py-1 px-2`,children:(0,K.jsx)(Sr,{notifications:s.notifications,unreadCount:s.unreadCount,onDismiss:s.dismissNotification,onMarkAllRead:s.markAllRead})})}),(0,K.jsx)(`li`,{children:(0,K.jsx)(`button`,{className:`tooltip tooltip-bottom py-1 px-2 hidden md:flex ${a?`active`:``}`,"data-tip":`Events`,onClick:i,children:(0,K.jsx)(St,{className:`size-4`})})}),(0,K.jsx)(`li`,{className:`hidden md:flex`,children:(0,K.jsxs)(`span`,{className:`text-xs opacity-40 py-1 px-2 flex items-center gap-1.5`,children:[(0,K.jsx)(Tr,{status:o}),H(r)]})})]})})]})}function kr({onClick:e}){let[t,n]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{let e=setTimeout(()=>n(!0),300);return()=>clearTimeout(e)},[]),(0,K.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,K.jsx)(Rn,{className:`size-6 transition-transform duration-300 group-hover:rotate-90`}),(0,K.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 Ar(){let e=A().location.pathname;return(0,K.jsx)(`div`,{className:`dock md:hidden`,children:Cr.map(({to:t,label:n,icon:r})=>{let i=e.startsWith(t);return(0,K.jsxs)(g,{to:t,className:i?`dock-active`:void 0,children:[(0,K.jsx)(r,{className:`size-[1.2em] transition-transform duration-200 ${i?`scale-110`:``}`}),(0,K.jsx)(`span`,{className:`dock-label`,children:n})]},t)})})}var jr=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;function Mr({onDismiss:e,direction:t=`right`,threshold:n=80}){let r=(0,W.useRef)(null),i=(0,W.useRef)(null),a=(0,W.useRef)(!1),o=t===`right`||t===`left`,s=t===`right`||t===`down`?1:-1;return{ref:r,handlers:{onTouchStart:(0,W.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,W.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||jr)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,W.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 Nr=typeof window<`u`?window.SpeechRecognition||window.webkitSpeechRecognition:null;function Pr({language:e=`pt-BR`}={}){let[t,n]=(0,W.useState)(!1),[r,i]=(0,W.useState)(``),a=(0,W.useRef)(null),o=(0,W.useRef)(!1),s=(0,W.useRef)(``),c=!!Nr&&typeof window<`u`&&window.isSecureContext,l=(0,W.useCallback)(()=>{let e=a.current;if(e){e.onresult=null,e.onend=null,e.onerror=null,e.onstart=null;try{e.abort()}catch{}a.current=null}},[]),u=(0,W.useCallback)(()=>{if(!Nr)return;l(),o.current=!0,s.current=``,i(``),n(!0);function t(){if(!o.current)return;let r=new Nr;r.lang=e,r.interimResults=!0,r.continuous=!1,r.maxAlternatives=1,a.current=r,r.onresult=e=>{let t=``,n=``;for(let r=0;r<e.results.length;r++){let i=e.results[r];i.isFinal?n+=i[0].transcript:t+=i[0].transcript}let r=s.current;i((r+(r&&(n||t)?` `:``)+n+(t?(n?` `:``)+t:``)).trimStart())},r.onerror=e=>{e.error===`no-speech`||e.error===`aborted`||(e.error===`not-allowed`||e.error===`service-not-allowed`)&&(o.current=!1,n(!1))},r.onend=()=>{if(a.current=null,!o.current){n(!1);return}i(e=>(s.current=e,e)),setTimeout(t,300)};try{r.start()}catch{o.current&&setTimeout(t,500)}}t()},[l,e]),d=(0,W.useCallback)(()=>{o.current=!1,l(),n(!1)},[l]);return(0,W.useEffect)(()=>()=>{o.current=!1,l()},[l]),{supported:c,listening:t,transcript:r,start:u,stop:d}}var Fr=24;function Ir(e){let[t,n]=(0,W.useState)(()=>Array(Fr).fill(0)),[r,i]=(0,W.useState)(0),a=(0,W.useRef)(null),o=(0,W.useRef)(null),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(!1),d=(0,W.useCallback)(()=>{s.current&&cancelAnimationFrame(s.current),l.current&&clearInterval(l.current),o.current&&=(o.current.getTracks().forEach(e=>e.stop()),null),a.current&&a.current.state!==`closed`&&(a.current.close().catch(()=>{}),a.current=null),s.current=null,l.current=null,c.current=null,u.current=!1,n(Array(Fr).fill(0)),i(0)},[]);return(0,W.useEffect)(()=>{if(!e){d();return}let t=!1;return c.current=Date.now(),l.current=setInterval(()=>{c.current&&i(Math.floor((Date.now()-c.current)/1e3))},1e3),(async()=>{let e=!0;try{if(navigator.mediaDevices?.getUserMedia){let r=await navigator.mediaDevices.getUserMedia({audio:!0});if(t){r.getTracks().forEach(e=>e.stop());return}o.current=r;let i=new(window.AudioContext||window.webkitAudioContext);a.current=i,i.state===`suspended`&&await i.resume();let c=i.createMediaStreamSource(r),l=i.createAnalyser();l.fftSize=64,l.smoothingTimeConstant=.7,c.connect(l);let u=new Uint8Array(l.frequencyBinCount);e=!1;function d(){if(t)return;l.getByteFrequencyData(u);let e=u.length,r=Math.max(1,Math.floor(e/Fr)),i=[];for(let t=0;t<Fr;t++)i.push(u[Math.min(t*r,e-1)]/255);n(i),s.current=requestAnimationFrame(d)}s.current=requestAnimationFrame(d)}}catch{}if(e&&!t){u.current=!0;let e=Array.from({length:Fr},()=>Math.random()*Math.PI*2),r=Array.from({length:Fr},()=>2+Math.random()*4),i=Array.from({length:Fr},(e,t)=>{let n=Fr/2,r=Math.abs(t-n)/n;return .3+.5*(1-r*r)});function a(){if(t)return;let o=Date.now()/1e3;n(e.map((e,t)=>{let n=Math.sin(o*r[t]+e)*.3+.5,a=Math.sin(o*13.7+t*2.1)*.1;return Math.max(.05,Math.min(1,i[t]*n+a))})),s.current=requestAnimationFrame(a)}s.current=requestAnimationFrame(a)}})(),()=>{t=!0,d()}},[e,d]),{bars:t,elapsed:r}}function Lr(e){let t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,`0`)}`}function Rr({active:e,onStop:t}){let{bars:n,elapsed:r}=Ir(e);return e?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-error/8 border border-error/20 animate-fade-in`,children:[(0,K.jsx)(`div`,{className:`size-2 rounded-full bg-error animate-pulse shrink-0`}),(0,K.jsx)(`span`,{className:`font-mono text-xs text-error tabular-nums w-8 shrink-0`,children:Lr(r)}),(0,K.jsx)(`div`,{className:`flex items-center gap-px flex-1 h-6`,children:n.map((e,t)=>(0,K.jsx)(`div`,{className:`flex-1 rounded-full bg-error/60 transition-[height] duration-75`,style:{height:`${Math.max(8,e*100)}%`,minWidth:2,maxWidth:4}},t))}),(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-error btn-soft gap-1 shrink-0`,onClick:t,children:[(0,K.jsx)($n,{className:`size-2.5 fill-current`}),`Stop`]})]}):null}var zr=[{id:`blank`,label:`Blank`,icon:rn,activeColor:`border-base-content/30 bg-base-content/5 text-base-content`,title:``,description:``},{id:`bug`,label:`Bug Fix`,icon:jt,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:Zn,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:Bn,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:kt,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:dr,activeColor:`border-secondary/50 bg-secondary/8 text-secondary`,title:`chore: `,description:`## Task
|
|
35
|
+
|
|
36
|
+
## Why Now
|
|
37
|
+
|
|
38
|
+
`}];function Br({open:e,onClose:t,onSubmit:n,isLoading:r,onToast:i}){let[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(`blank`),[d,f]=(0,W.useState)({title:!1,description:!1}),[p,m]=(0,W.useState)([]),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(null),y=(0,W.useRef)(null),b=(0,W.useRef)(null),x=(0,W.useRef)(null),S=(0,W.useRef)(null),C=Pr({language:`pt-BR`}),w=C.supported,T=(0,W.useRef)({before:``,after:``}),E=(0,W.useCallback)(e=>{if(C.listening&&_===e){C.stop(),v(null);return}C.listening&&C.stop();let t=e===`title`?y.current:b.current,n=e===`title`?a:s,r=t?.selectionStart??n.length;T.current={before:n.slice(0,r),after:n.slice(r)},v(e),C.start()},[C,_,a,s]);(0,W.useEffect)(()=>{if(!_||!C.transcript)return;let{before:e,after:t}=T.current,n=`${e}${e.length>0&&!e.endsWith(` `)&&!e.endsWith(`
|
|
39
|
+
`)?` `:``}${C.transcript}${t?(t.startsWith(` `)||t.startsWith(`
|
|
40
|
+
`)?``:` `)+t:``}`;_===`title`?o(n):c(n)},[C.transcript,_]),(0,W.useEffect)(()=>{!e&&C.listening&&(C.stop(),v(null))},[e,C]);let D=(0,W.useCallback)(e=>{let t=zr.find(t=>t.id===e);t&&(u(e),o(t.title),c(t.description),setTimeout(()=>y.current?.focus(),50))},[]),{ref:O,handlers:k}=Mr({onDismiss:(0,W.useCallback)(()=>t(),[t]),direction:`right`});(0,W.useEffect)(()=>{e&&(o(``),c(``),u(`blank`),m([]),setTimeout(()=>y.current?.focus(),100))},[e]),(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let A=(0,W.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),S.current&&(S.current.value=``)}}},[i]);(0,W.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&&A(t)};return window.addEventListener(`paste`,t),()=>window.removeEventListener(`paste`,t)},[e,A]);let j=e=>A(Array.from(e.target.files??[])),M=e=>{e.preventDefault(),a.trim()&&n({title:a.trim(),description:s.trim(),issueType:l===`blank`?void 0:l,images:p.map(e=>e.path)})},N=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,K.jsxs)(K.Fragment,{children:[(0,K.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,K.jsx)(`div`,{ref:O,className:`fixed top-0 right-0 h-full z-50 bg-base-100 shadow-2xl transition-transform duration-300 ease-out
|
|
41
|
+
w-full md:w-[480px] ${e?`translate-x-0`:`translate-x-full`}`,...k,children:(0,K.jsxs)(`form`,{onSubmit:M,className:`flex flex-col h-full`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b border-base-300 shrink-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Cn,{className:`size-5 opacity-60`}),(0,K.jsx)(`h2`,{className:`text-lg font-bold`,children:`New Issue`})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,K.jsx)(fr,{className:`size-4`})})]}),(0,K.jsxs)(`div`,{ref:x,className:`flex-1 overflow-y-auto px-4 sm:px-6 py-4 sm:py-6 flex flex-col gap-4 drawer-safe-bottom ${e?`stagger-children`:``}`,children:[(0,K.jsx)(`div`,{className:`flex flex-wrap sm:grid sm:grid-cols-3 gap-1.5`,children:zr.map(e=>{let t=e.icon;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>D(e.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 sm:py-2 rounded-lg border text-left transition-all duration-150 text-xs sm: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,K.jsx)(t,{className:`size-3 sm:size-3.5 shrink-0`}),e.label]},e.id)})}),(0,K.jsxs)(`div`,{className:`form-control`,children:[(0,K.jsx)(`label`,{className:`label pb-1`,children:(0,K.jsx)(`span`,{className:`label-text font-medium`,children:`What needs to be done?`})}),(0,K.jsx)(`input`,{ref:y,className:`input input-bordered w-full ${C.listening&&_===`title`?`border-error/50 bg-error/5`:``}`,placeholder:C.listening&&_===`title`?`Listening... speak now`:`Fix the login redirect bug`,value:a,onChange:e=>o(e.target.value),required:!0}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 mt-1.5`,children:[w&&(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs gap-1 ${C.listening&&_===`title`?`btn-error`:`btn-ghost opacity-50 hover:opacity-100`}`,onClick:()=>E(`title`),children:[C.listening&&_===`title`?(0,K.jsx)(An,{className:`size-3`}):(0,K.jsx)(kn,{className:`size-3`}),C.listening&&_===`title`?`Stop`:`Dictate`]}),(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-secondary gap-1`,onClick:()=>N(`title`),disabled:d.title||r||!a.trim(),children:[d.title?(0,K.jsx)(J,{className:`size-3 animate-spin`}):(0,K.jsx)(Zn,{className:`size-3`}),`Enhance`]})]}),(0,K.jsx)(Rr,{active:C.listening&&_===`title`,onStop:()=>E(`title`)})]}),(0,K.jsxs)(`div`,{className:`form-control`,children:[(0,K.jsx)(`label`,{className:`label pb-1`,children:(0,K.jsx)(`span`,{className:`label-text font-medium`,children:`Context & details`})}),(0,K.jsx)(`textarea`,{ref:b,className:`textarea textarea-bordered w-full min-h-32 sm:min-h-40 resize-none ${C.listening&&_===`description`?`border-error/50 bg-error/5`:``}`,placeholder:C.listening&&_===`description`?`Listening... speak now`:`Describe the problem, expected behavior, acceptance criteria...`,value:s,onChange:e=>c(e.target.value)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1 mt-1.5`,children:[w&&(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs gap-1 ${C.listening&&_===`description`?`btn-error`:`btn-ghost opacity-50 hover:opacity-100`}`,onClick:()=>E(`description`),children:[C.listening&&_===`description`?(0,K.jsx)(An,{className:`size-3`}):(0,K.jsx)(kn,{className:`size-3`}),C.listening&&_===`description`?`Stop`:`Dictate`]}),(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-secondary gap-1`,onClick:()=>N(`description`),disabled:d.description||r||!a.trim(),children:[d.description?(0,K.jsx)(J,{className:`size-3 animate-spin`}):(0,K.jsx)(Zn,{className:`size-3`}),`Enhance`]})]}),(0,K.jsx)(Rr,{active:C.listening&&_===`description`,onStop:()=>E(`description`)})]}),(0,K.jsxs)(`div`,{className:`form-control`,children:[(0,K.jsxs)(`label`,{className:`label justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`label-text font-medium`,children:`Screenshots & Evidence`}),(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-ghost gap-1`,onClick:()=>S.current?.click(),disabled:h,children:[h?(0,K.jsx)(J,{className:`size-3 animate-spin`}):(0,K.jsx)(Fn,{className:`size-3`}),`Attach`]})]}),(0,K.jsx)(`input`,{ref:S,type:`file`,multiple:!0,accept:`image/*`,className:`hidden`,onChange:j}),p.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-1`,children:p.map((e,t)=>(0,K.jsxs)(`div`,{className:`relative group`,children:[e.preview?(0,K.jsx)(`img`,{src:e.preview,alt:e.name,className:`size-16 object-cover rounded-lg border border-base-300`}):(0,K.jsx)(`div`,{className:`size-16 rounded-lg border border-base-300 bg-base-200 flex items-center justify-center`,children:(0,K.jsx)(_n,{className:`size-5 opacity-40`})}),(0,K.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,K.jsx)(fr,{className:`size-2.5`})})]},t))})]}),(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 text-xs opacity-60 space-y-1`,children:[(0,K.jsxs)(`p`,{children:[`The issue will be created in `,(0,K.jsx)(`strong`,{children:`Planning`}),` state.`]}),(0,K.jsx)(`p`,{children:`Open it to generate an AI plan, review it, then approve to start execution.`})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 sm:px-6 py-3 sm:py-4 border-t border-base-300 shrink-0 max-sm:flex-col-reverse`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.75rem)`},children:[(0,K.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm sm:btn-md max-sm:w-full`,onClick:t,children:`Cancel`}),(0,K.jsxs)(`button`,{type:`submit`,className:`btn btn-primary btn-sm sm:btn-md gap-1.5 max-sm:w-full`,disabled:r||!a.trim(),children:[r?(0,K.jsx)(J,{className:`size-4 animate-spin`}):(0,K.jsx)(Cn,{className:`size-4`}),r?`Creating...`:`Create Issue`]})]})]})})]})}var Vr=`runtime.workflowConfig`;function Hr(e){return!!e&&typeof e==`object`&&typeof e.provider==`string`&&typeof e.model==`string`&&typeof e.effort==`string`}function Ur(e){let t=Fe(Pe(e),Vr,null);return!t||typeof t!=`object`?null:Hr(t.plan)&&Hr(t.execute)&&Hr(t.review)?t:null}function Wr(){let e=Ur(Re().data),t=v({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 Gr={Planning:Cn,PendingApproval:Wt,Queued:Tn,Running:Ht,Reviewing:tn,PendingDecision:Bt,Blocked:X,Approved:Bt,Merged:q,Cancelled:Ut,Archived:Ut},Kr={Planning:`text-info`,PendingApproval:`text-warning`,Queued:`text-info`,Running:`text-primary`,Reviewing:`text-secondary`,PendingDecision:`text-success`,Blocked:`text-error`,Approved:`text-success`,Merged:`text-success`,Cancelled:`text-neutral`,Archived:`text-neutral`},qr={Planning:`btn-info`,PendingApproval:`btn-warning`,Queued:`btn-info`,Running:`btn-primary`,Reviewing:`btn-secondary`,PendingDecision:`btn-success`,Blocked:`btn-error`,Approved:`btn-success`,Merged:`btn-success`,Cancelled:`btn-neutral`,Archived:`btn-neutral`},Jr={Planning:`bg-info/10 border-info/30`,PendingApproval:`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`,PendingDecision:`bg-success/10 border-success/30`,Blocked:`bg-error/10 border-error/30`,Approved:`bg-success/10 border-success/30`,Merged:`bg-success/10 border-success/30`,Cancelled:`bg-neutral/10 border-neutral/30`,Archived:`bg-neutral/10 border-neutral/30`},Yr={bug:`badge-error`,feature:`badge-primary`,refactor:`badge-warning`,docs:`badge-info`,chore:`badge-secondary`},Xr=[{id:`overview`,label:`Overview`,icon:yn,color:`text-info`,activeColor:`tab-active text-info`},{id:`planning`,label:`Plan`,icon:Cn,color:`text-primary`,activeColor:`tab-active text-primary`},{id:`execution`,label:`Execution`,icon:tr,color:`text-secondary`,activeColor:`tab-active text-secondary`},{id:`review`,label:`Review`,icon:Gt,color:`text-success`,activeColor:`tab-active text-success`},{id:`diff`,label:`Diff`,icon:qt,color:`text-warning`,activeColor:`tab-active text-warning`},{id:`routing`,label:`Routing`,icon:Un,color:`text-accent`,activeColor:`tab-active text-accent`},{id:`events`,label:`Events`,icon:St,color:`text-error`,activeColor:`tab-active text-error`}];function Zr(e){return e===`Planning`||e===`PendingApproval`?`planning`:e===`Reviewing`||e===`PendingDecision`?`review`:`overview`}function Qr(e){return{PendingApproval:0,Queued:1,Running:2,Reviewing:2,PendingDecision:3,Blocked:3,Approved:4,Merged:5,Cancelled:4}[e]??0}var $r=[{key:`plan`,label:`Plan`,icon:Cn,states:[`Planning`]},{key:`execute`,label:`Execute`,icon:Ht,states:[`PendingApproval`,`Queued`,`Running`]},{key:`review`,label:`Review`,icon:tn,states:[`Reviewing`,`PendingDecision`]},{key:`ship`,label:`Ship`,icon:q,states:[`Approved`,`Merged`]}];function ei(e){return e.state===`Cancelled`?-1:e.state===`Merged`||e.state===`Approved`?3:e.state===`Reviewing`||e.state===`PendingDecision`?2:[`Running`,`Queued`,`PendingApproval`].includes(e.state)?1:e.state===`Blocked`?e.tokensByPhase?.reviewer?.totalTokens>0?2:1:(e.state,0)}function ti({issue:e}){let t=ei(e),n=!!e.mergedAt||e.state===`Merged`;if(e.state===`Cancelled`)return null;let r=$r[t],i=n?`Shipped`:r?.label;return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 py-1.5`,children:[i&&(0,K.jsx)(`span`,{className:`text-[10px] shrink-0 font-medium ${n?`text-success`:`text-primary opacity-70`}`,children:i}),(0,K.jsx)(`div`,{className:`flex items-center flex-1 gap-0`,children:$r.map((e,r)=>{let i=r<t||r===t&&n,a=r===t&&!n;return(0,K.jsxs)(W.Fragment,{children:[r>0&&(0,K.jsx)(`div`,{className:`flex-1 h-px transition-colors duration-300 ${i?`bg-success`:a?`bg-primary/30`:`bg-base-300`}`}),(0,K.jsx)(`div`,{title:e.label,className:[`size-2 rounded-full transition-all duration-300 shrink-0`,i?`bg-success`:``,a?`bg-primary ring-2 ring-primary/25 scale-[1.4]`:``,!i&&!a?`bg-base-300`:``].filter(Boolean).join(` `)})]},e.key)})})]})}function Z({title:e,icon:t,children:n,badge:r}){return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[t&&(0,K.jsx)(t,{className:`size-4 opacity-50`}),e,r!=null&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:r})]}),(0,K.jsx)(`div`,{children:n})]})}function Q({label:e,value:t,mono:n}){return t==null||t===``?null:(0,K.jsxs)(`div`,{className:`flex justify-between items-baseline gap-4 py-0.5`,children:[(0,K.jsx)(`span`,{className:`text-xs opacity-50 shrink-0`,children:e}),(0,K.jsx)(`span`,{className:`text-sm text-right truncate ${n?`font-mono text-xs`:``}`,children:t})]})}function ni({text:e}){let[t,n]=(0,W.useState)(!1),r=(0,W.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return(0,K.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1 ${t?`text-success`:``}`,onClick:r,title:`Copy to clipboard`,children:[t?(0,K.jsx)(Pt,{className:`size-3 animate-bounce-in`}):(0,K.jsx)(Zt,{className:`size-3`}),t?(0,K.jsx)(`span`,{className:`animate-fade-in`,children:`Copied`}):`Copy`]})}function ri({config:e}){if(!e)return null;let{provider:t,model:n,effort:r}=e;return!t&&!n&&!r?null:(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[t&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,K.jsx)(tr,{className:`size-2.5`}),t]}),n&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:n}),r&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:r})]})}var ii={planner:`Plan`,executor:`Execute`,reviewer:`Review`},ai={planner:`text-info`,executor:`text-primary`,reviewer:`text-secondary`};function oi({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,K.jsxs)(`div`,{className:`space-y-3`,children:[n.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1`,children:[n.map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`w-14 shrink-0 font-medium ${ai[e]||`text-base-content`}`,children:ii[e]||e}),(0,K.jsxs)(`span`,{className:`opacity-50`,children:[i(t.totalTokens),` total`]}),(0,K.jsxs)(`span`,{className:`opacity-30 text-[10px]`,children:[i(t.inputTokens),`↑ `,i(t.outputTokens),`↓`]}),t.model&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono ml-auto`,children:t.model})]},e)),n.length>1&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs border-t border-base-300 pt-1 mt-1`,children:[(0,K.jsx)(`span`,{className:`w-14 shrink-0 font-semibold opacity-60`,children:`Total`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:i(n.reduce((e,[,t])=>e+(t.totalTokens??0),0))})]})]}),r.length>0&&(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-40 mb-1`,children:`by model`}),r.map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`font-mono opacity-70 truncate flex-1`,children:e}),(0,K.jsx)(`span`,{className:`opacity-50 shrink-0`,children:i(t.totalTokens)})]},e))]})]})}function si({issue:e,onStateChange:t,onRetry:n,onCancel:r}){let i=Array.isArray(e.blockedBy)?e.blockedBy:[],a=ee(e.state).filter(t=>t!==e.state);return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[e.mergedReason&&(0,K.jsxs)(`div`,{className:`flex items-start gap-2 bg-success/10 border border-success/20 rounded-box px-3 py-2.5`,children:[(0,K.jsx)(q,{className:`size-3.5 text-success shrink-0 mt-0.5`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-success/70 mb-0.5`,children:`Merged`}),(0,K.jsx)(`div`,{className:`text-xs text-success/90`,children:e.mergedReason})]})]}),e.cancelledReason&&(0,K.jsxs)(`div`,{className:`flex items-start gap-2 bg-error/10 border border-error/20 rounded-box px-3 py-2.5`,children:[(0,K.jsx)(Mn,{className:`size-3.5 text-error shrink-0 mt-0.5`}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-error/70 mb-0.5`,children:`Cancelled`}),(0,K.jsx)(`div`,{className:`text-xs text-error/90`,children:e.cancelledReason})]})]}),(0,K.jsx)(Z,{title:`Details`,icon:Sn,children:(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Q,{label:`Attempts`,value:`${e.attempts??0} / ${e.maxAttempts??0}`}),e.branchName&&(0,K.jsx)(Q,{label:`Branch`,value:e.branchName,mono:!0}),e.baseBranch&&(0,K.jsx)(Q,{label:`Base branch`,value:e.baseBranch,mono:!0}),e.worktreePath&&(0,K.jsx)(Q,{label:`Code worktree`,value:e.worktreePath,mono:!0}),e.url&&(0,K.jsx)(Q,{label:`URL`,value:e.url,mono:!0}),(0,K.jsx)(Q,{label:`Created`,value:R(e.createdAt)}),e.startedAt&&(0,K.jsx)(Q,{label:`Started`,value:R(e.startedAt)}),e.completedAt&&(0,K.jsx)(Q,{label:`Completed`,value:R(e.completedAt)}),e.nextRetryAt&&(0,K.jsx)(Q,{label:`Next retry`,value:R(e.nextRetryAt)}),(0,K.jsx)(Q,{label:`Duration`,value:B(e.durationMs)}),e.tokenUsage?.totalTokens>0&&(0,K.jsx)(Q,{label:`Tokens`,value:`${e.tokenUsage.totalTokens.toLocaleString()}${e.tokenUsage.costUsd?` ($${e.tokenUsage.costUsd.toFixed(4)})`:``}`})]})}),i.length>0&&(0,K.jsx)(Z,{title:`Dependencies`,icon:Et,badge:i.length,children:(0,K.jsx)(`div`,{className:`space-y-0.5`,children:i.map(e=>(0,K.jsx)(`div`,{className:`font-mono text-xs`,children:e},e))})}),(0,K.jsx)(Z,{title:`Actions`,icon:dr,children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs opacity-50 mb-1.5`,children:`Move to`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5 max-sm:flex-col`,children:a.map(n=>{let r=Gr[n]||Wt;return(0,K.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1.5 max-sm:w-full ${qr[n]||``}`,onClick:()=>t?.(e.id,n),children:[(0,K.jsx)(r,{className:`size-3.5`}),n]},n)})})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 max-sm:flex-col`,children:[(0,K.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,K.jsx)(Hn,{className:`size-3`}),` Retry`]}),(0,K.jsxs)(`button`,{className:`btn btn-sm btn-error btn-soft gap-1 max-sm:w-full`,onClick:()=>r?.(e.id),disabled:e.state===`Approved`||e.state===`Cancelled`,children:[(0,K.jsx)(Ut,{className:`size-3`}),` Cancel`]})]})]})})]})}function ci({issueId:e,running:t,startedAt:n,onOutput:r}){let[i,a]=(0,W.useState)(null),o=(0,W.useCallback)(async()=>{try{let t=await V.get(`/live/${encodeURIComponent(e)}`);a(t),r?.(t?.logTail||``)}catch{}},[e]);if((0,W.useEffect)(()=>{if(!t){a(null),r?.(null);return}o();let e=setInterval(o,3e3);return()=>clearInterval(e)},[t,o,r]),!t||!i)return null;let s=Number.isFinite(Number(i.elapsed))?Number(i.elapsed):n?Math.max(Date.now()-new Date(n).getTime(),0):0,c=Math.floor(s/6e4),l=Math.floor(s%6e4/1e3),u=i.logSize?(i.logSize/1024).toFixed(1):`0`;return(0,K.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`loading loading-spinner loading-xs text-primary`}),(0,K.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`Agent running`}),(0,K.jsxs)(`span`,{className:`text-xs opacity-50 ml-auto`,children:[c,`m `,l,`s elapsed`]})]}),(0,K.jsxs)(`div`,{className:`flex gap-3 text-xs opacity-60`,children:[(0,K.jsxs)(`span`,{children:[`Log: `,u,` KB`]}),i.agentPid&&(0,K.jsxs)(`span`,{children:[`PID: `,i.agentPid]}),i.agentAlive===!1&&i.agentPid&&(0,K.jsx)(`span`,{className:`text-error`,children:`process dead`})]})]})}function li({issue:e,workflowConfig:t}){let n=e.state===`Running`||e.state===`Reviewing`,r=t?.workflow?.execute,[i,a]=(0,W.useState)(``),o=(0,W.useCallback)(e=>a(e||``),[]),[s,c]=(0,W.useState)(!0),l=(0,W.useRef)(null),u=n?i||e.commandOutputTail||``:e.commandOutputTail||``,d=!!u;return(0,W.useEffect)(()=>{s&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[u,s]),(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(ci,{issueId:e.id,running:n,startedAt:e.startedAt,onOutput:o}),r&&(0,K.jsx)(Z,{title:`Execution Config`,icon:Jn,children:(0,K.jsx)(ri,{config:r})}),(0,K.jsx)(Z,{title:`Run Info`,icon:tr,children:(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Q,{label:`Exit code`,value:e.commandExitCode??`-`,mono:!0}),(0,K.jsx)(Q,{label:`Duration`,value:B(e.durationMs)}),e.workspacePath&&(0,K.jsx)(Q,{label:`Issue workspace root`,value:e.workspacePath,mono:!0}),e.worktreePath&&(0,K.jsx)(Q,{label:`Issue code checkout`,value:e.worktreePath,mono:!0}),e.workspacePreparedAt&&(0,K.jsx)(Q,{label:`Workspace prepared at`,value:R(e.workspacePreparedAt)})]})}),e.lastError&&(0,K.jsx)(Z,{title:`Last Error`,icon:X,children:(0,K.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})}),d?(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(tr,{className:`size-4 opacity-50`}),` CLI Output`]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-1.5 cursor-pointer`,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-xs checkbox-primary`,checked:s,onChange:e=>c(e.target.checked)}),(0,K.jsx)(`span`,{className:`text-xs opacity-50`,children:`Auto-scroll`})]}),(0,K.jsx)(ni,{text:u})]})]}),(0,K.jsx)(`pre`,{ref:l,className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-[50vh] overflow-y-auto`,children:u})]}):(0,K.jsx)(`div`,{className:`text-sm opacity-40 text-center py-4`,children:`No command output yet.`}),(e.tokensByPhase||e.tokensByModel)&&(0,K.jsx)(Z,{title:`Token Usage`,icon:pr,children:(0,K.jsx)(oi,{tokensByPhase:e.tokensByPhase,tokensByModel:e.tokensByModel})}),!e.lastError&&!d&&!e.tokensByPhase&&!e.tokensByModel&&(0,K.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No execution data yet.`})]})}var ui={added:`badge-success`,removed:`badge-error`,modified:`badge-info`};function di({file:e,isOpen:t,onToggle:n}){return(0,K.jsx)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:(0,K.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,K.jsx)(`span`,{className:`text-xs opacity-40 transition-transform`,style:{transform:t?`rotate(90deg)`:``},children:`▶`}),(0,K.jsx)(`span`,{className:`badge badge-xs ${ui[e.status]||`badge-ghost`}`,children:e.status}),(0,K.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:e.path}),(0,K.jsxs)(`span`,{className:`text-xs text-success`,children:[`+`,e.additions]}),(0,K.jsxs)(`span`,{className:`text-xs text-error`,children:[`-`,e.deletions]})]})})}function fi({lines:e}){return!e||e.length===0?null:(0,K.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,K.jsx)(`div`,{className:n,children:e||`\xA0`},t)})})}function pi({issueId:e}){let[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(null),l=(0,W.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,W.useEffect)(()=>{n(null),o(null),c(null)},[e]),(0,W.useEffect)(()=>{l()},[l]),r)return(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm opacity-50 py-12`,children:[(0,K.jsx)(`span`,{className:`loading loading-spinner loading-sm`}),` Loading changes...`]});if(a)return(0,K.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,K.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(`
|
|
42
|
+
`))}}return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,K.jsxs)(`span`,{className:`opacity-60`,children:[u.length,` file`,u.length===1?``:`s`,` changed`]}),(0,K.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,p]}),(0,K.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,m]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(ni,{text:d}),(0,K.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1`,onClick:l,children:[(0,K.jsx)(Hn,{className:`size-3`}),` Refresh`]})]})]}),(0,K.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>(0,K.jsx)(di,{file:e,isOpen:s===e.path,onToggle:()=>c(s===e.path?null:e.path)},e.path))}),s&&h[s]&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:s}),(0,K.jsx)(fi,{lines:h[s]})]}),!s&&(0,K.jsxs)(`details`,{className:`group`,children:[(0,K.jsxs)(`summary`,{className:`text-xs opacity-50 cursor-pointer select-none list-none flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`transition-transform group-open:rotate-90`,children:`▶`}),`Show full diff`]}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(fi,{lines:d.split(`
|
|
43
|
+
`)})})]})]})}var mi=/^(\.fifony|fifony[-_]|WORKFLOW\.local)/;function hi(e){return(Array.isArray(e)?e:[]).filter(e=>!mi.test(e))}function gi({issue:e}){let t=hi(e.paths);return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(Z,{title:`State Machine`,icon:dn,children:(0,K.jsx)(`div`,{className:`space-y-1`,children:te.map(t=>{let n=t===e.state,r=Gr[t]||Wt,i=z[t]||[],a=Qr(t)<Qr(e.state);return(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg px-2 py-1.5 border text-sm ${n?Jr[t]+` font-semibold`:a?`border-transparent opacity-40`:`border-transparent opacity-60`}`,children:[(0,K.jsx)(r,{className:`size-4 mt-0.5 shrink-0 ${n?Kr[t]:``}`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{children:t}),n&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`current`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:i.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-xs opacity-50`,children:[(0,K.jsx)(wt,{className:`size-2.5`}),e]},e))})]})]},t)})})}),t.length>0&&(0,K.jsx)(Z,{title:`Paths`,icon:cn,badge:t.length,children:(0,K.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>(0,K.jsx)(`div`,{className:`font-mono text-xs truncate`,children:e},e))})})]})}var _i=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],vi={error:`badge-error`,state:`badge-primary`,progress:`badge-info`,manual:`badge-warning`,runner:`badge-accent`,info:`badge-ghost`},yi={Planning:`border-l-info`,PendingApproval:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Reviewing:`border-l-secondary`,PendingDecision:`border-l-success`,Blocked:`border-l-error`,Approved:`border-l-success`,Cancelled:`border-l-neutral`},bi=/([\d,]+)\s+tokens/gi,xi=100;function Si(e,t){if(!e)return``;if(!t)return e;let n=[],r=0,i,a=new RegExp(bi.source,`gi`);for(;(i=a.exec(e))!==null;)i.index>r&&n.push(e.slice(r,i.index)),n.push((0,K.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 Ci(e){if(!e)return null;for(let t of Object.keys(yi))if(e.includes(t))return t;return null}function wi({value:e}){let[,t]=(0,W.useState)(0);return(0,W.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),5e3);return()=>clearInterval(e)},[]),(0,K.jsx)(`span`,{title:R(e),children:H(e)})}function Ti({ev:e}){let t=typeof e.message==`string`&&/tokens/i.test(e.message),n=e.kind===`state`,r=n?Ci(e.message):null,i=r?yi[r]:``;return(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box px-3 py-2 ${n?`border-l-[3px] ${i}`:``}`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`opacity-50`,children:(0,K.jsx)(wi,{value:e.at})}),(0,K.jsx)(`span`,{className:`badge badge-xs ${vi[e.kind]||`badge-ghost`}`,children:e.kind||`info`}),n&&(0,K.jsx)(wt,{className:`size-3 opacity-50`}),t&&(0,K.jsx)(pr,{className:`size-3 text-warning`})]}),(0,K.jsx)(`div`,{className:`text-sm mt-0.5`,children:Si(e.message,t)})]})}function Ei({issueId:e,events:t}){let[n,r]=(0,W.useState)(`all`),i=(0,W.useRef)(null),[a,o]=(0,W.useState)(!0),[s,c]=(0,W.useState)(!1),l=(0,W.useRef)(0),u=(0,W.useMemo)(()=>Array.isArray(t)?t.filter(t=>t.issueId===e&&(n===`all`||t.kind===n)).slice(0,200):[],[t,e,n]),d=(0,W.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<xi;o(t),t&&c(!1)},[]);(0,W.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,W.useCallback)(()=>{i.current?.scrollTo({top:i.current.scrollHeight,behavior:`smooth`}),c(!1)},[]);return(0,K.jsxs)(`div`,{className:`flex flex-col h-full -mx-6 -my-4`,children:[(0,K.jsxs)(`div`,{className:`px-5 py-2.5 border-b border-base-300 flex items-center gap-2 shrink-0`,children:[(0,K.jsx)(Jn,{className:`size-3.5 opacity-50`}),(0,K.jsx)(`select`,{className:`select select-bordered select-xs`,value:n,onChange:e=>r(e.target.value),"aria-label":`Filter by event kind`,children:_i.map(e=>(0,K.jsx)(`option`,{value:e,children:e===`all`?`All kinds`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),u.length>0&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-neutral ml-auto`,children:u.length})]}),(0,K.jsx)(`div`,{ref:i,className:`flex-1 overflow-y-auto px-5 py-3 relative`,onScroll:d,children:u.length===0?(0,K.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No events for this issue yet.`}):(0,K.jsx)(`div`,{className:`space-y-2`,children:u.map((e,t)=>(0,K.jsx)(Ti,{ev:e},`${e.at}-${t}`))})}),s&&(0,K.jsx)(`div`,{className:`absolute bottom-16 left-1/2 -translate-x-1/2 z-10`,children:(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-primary rounded-full shadow-lg animate-fade-in-up gap-1`,onClick:f,children:[(0,K.jsx)(Ft,{className:`size-3`}),` New events`]})})]})}var Di={trivial:`badge-ghost`,low:`badge-success`,medium:`badge-warning`,high:`badge-error`};function Oi({issue:e,onStateChange:t,workflowConfig:n}){let[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(0),[y,b]=(0,W.useState)(!1),x=(0,W.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,N=C&&!S&&!O&&!A;(0,W.useEffect)(()=>{e.planningError&&o(null)},[e.planningError]),(0,W.useEffect)(()=>{s&&(S||e.planningError)&&c(!1)},[s,S,e.planningError]),(0,W.useEffect)(()=>{l&&(e.planningStatus!==`planning`||e.planningError)&&u(!1)},[l,e.planningStatus,e.planningError]),(0,W.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,W.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,W.useEffect)(()=>{if(S&&C&&x.current){let e=setTimeout(()=>x.current?.focus(),300);return()=>clearTimeout(e)}},[S,C]);let P=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)}},F=async()=>{f(!0);try{await V.post(`/issues/${encodeURIComponent(e.id)}/approve`)}catch(e){o(e instanceof Error?e.message:String(e)),f(!1)}},I=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)}}},ee=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,K.jsxs)(`div`,{className:`space-y-4 py-4`,children:[N&&(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-10`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`loading loading-dots loading-sm text-info`}),(0,K.jsx)(`span`,{className:`text-sm opacity-60`,children:`Queued — waiting for the planner worker...`})]}),(0,K.jsx)(`div`,{className:`text-xs opacity-30`,children:`The plan will be generated automatically shortly.`}),(0,K.jsx)(`div`,{className:`flex items-center gap-2 mt-2`,children:(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1 opacity-50 hover:opacity-100`,onClick:()=>P(!1),children:[(0,K.jsx)(pr,{className:`size-3`}),` Generate now`]})})]}),O&&(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`alert alert-error text-sm flex-col items-start gap-1`,children:[(0,K.jsxs)(`div`,{className:`font-medium flex items-center gap-1.5`,children:[(0,K.jsx)(X,{className:`size-4`}),` Plan generation failed`]}),(0,K.jsx)(`div`,{className:`text-xs opacity-80`,children:O})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,K.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1.5`,onClick:()=>P(!1),children:[(0,K.jsx)(Hn,{className:`size-3.5`}),` Try again`]}),(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1`,onClick:()=>P(!0),children:[(0,K.jsx)(pr,{className:`size-3.5`}),` Fast`]})]})]})]}):(0,K.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium opacity-70`,children:`No plan yet`}),(0,K.jsx)(`p`,{className:`text-xs opacity-40`,children:`Generate an AI plan to break this issue into actionable steps.`})]}),O&&(0,K.jsx)(`div`,{className:`alert alert-error text-sm`,children:O})]});if(A&&!S){let e=_>0?B(_*1e3):``;return(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-12`,children:[(0,K.jsx)(Y,{className:`size-8 animate-spin text-primary`}),(0,K.jsx)(`div`,{className:`text-sm opacity-60`,children:`Generating execution plan...`}),(0,K.jsx)(`div`,{className:`text-xs opacity-30`,children:`This may take a few minutes`}),e&&(0,K.jsxs)(`div`,{className:`text-xs font-mono opacity-40`,children:[e,` elapsed`]})]})}return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[M&&(0,K.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 flex items-center gap-3`,children:[(0,K.jsx)(Y,{className:`size-4 animate-spin text-primary shrink-0`}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`span`,{className:`text-sm text-primary font-medium`,children:A?`Re-generating plan...`:`Refining to v${w+2}...`}),_>0&&(0,K.jsx)(`span`,{className:`text-xs text-primary/60 ml-2 font-mono`,children:B(_*1e3)})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,K.jsxs)(`span`,{className:`badge badge-sm ${Di[S.estimatedComplexity]||`badge-ghost`}`,children:[S.estimatedComplexity,` complexity`]}),E>0&&(0,K.jsxs)(`span`,{className:`badge badge-sm badge-info badge-soft font-mono`,children:[`Plan v`,E]}),w>0&&(0,K.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,K.jsx)(Hn,{className:`size-2.5`}),` Refined ×`,w]})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[n?.workflow?.plan&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs opacity-60`,children:[(0,K.jsx)(Jn,{className:`size-3 shrink-0`}),(0,K.jsx)(ri,{config:n.workflow.plan})]}),e.tokensByPhase?.planner?.totalTokens>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs opacity-50`,children:[(0,K.jsx)(pr,{className:`size-3`}),(0,K.jsxs)(`span`,{children:[e.tokensByPhase.planner.totalTokens.toLocaleString(),` tokens`]})]})]}),w>0&&(0,K.jsxs)(`div`,{className:`rounded-box border-l-4 border-secondary bg-secondary/5 px-4 py-3 animate-fade-in`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider opacity-40 mb-1`,children:`Last refinement feedback`}),(0,K.jsxs)(`p`,{className:`text-sm leading-relaxed italic opacity-80`,children:[`“`,S.refinements[w-1].feedback,`”`]}),(0,K.jsxs)(`span`,{className:`text-[10px] opacity-30 mt-1 block`,children:[`v`,S.refinements[w-1].version||w+1,` · `,H(S.refinements[w-1].at)]})]}),(0,K.jsxs)(`div`,{className:`space-y-5 animate-fade-in`,children:[(0,K.jsx)(Z,{title:`Summary`,icon:yn,children:(0,K.jsx)(`p`,{className:`text-sm leading-relaxed`,children:S.summary})}),S.phases?.length>0&&(0,K.jsx)(Z,{title:`Phases (${S.phases.length})`,icon:Sn,children:(0,K.jsx)(`div`,{className:`space-y-3`,children:S.phases.map((e,t)=>(0,K.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`bg-base-200 px-3 py-2 flex items-center gap-2`,children:[(0,K.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,K.jsx)(`span`,{className:`text-sm font-semibold`,children:e.phaseName}),e.tasks?.length>0&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:[e.tasks.length,` tasks`]})]}),e.goal&&(0,K.jsx)(`div`,{className:`px-3 pt-2 text-xs opacity-60`,children:e.goal}),e.tasks?.length>0&&(0,K.jsx)(`div`,{className:`px-3 pb-2 pt-1.5 space-y-1.5`,children:e.tasks.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,K.jsxs)(`span`,{className:`opacity-30 shrink-0 font-mono w-4`,children:[e.step,`.`]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.action}),e.details&&(0,K.jsxs)(`span`,{className:`opacity-50 ml-1`,children:[`— `,e.details]})]})]},t))}),e.outputs?.length>0&&(0,K.jsx)(`div`,{className:`px-3 pb-2 flex flex-wrap gap-1`,children:e.outputs.map(e=>(0,K.jsx)(`span`,{className:`badge badge-xs badge-outline opacity-60`,children:e},e))})]},t))})}),(0,K.jsx)(Z,{title:`Steps (${S.steps.length})`,icon:Tn,children:(0,K.jsx)(`div`,{className:`space-y-2`,children:S.steps.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex gap-3 p-3 bg-base-200 rounded-box`,children:[(0,K.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,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium`,children:e.action}),e.details&&(0,K.jsx)(`div`,{className:`text-xs opacity-50 mt-0.5`,children:e.details}),e.files?.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.files.map(e=>(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:e},e))})]})]},t))})})]},`plan-content-${w}`),S.suggestedPaths?.length>0&&(0,K.jsx)(Z,{title:`Suggested Paths`,icon:cn,children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:S.suggestedPaths.map(e=>(0,K.jsx)(`span`,{className:`badge badge-sm badge-ghost font-mono`,children:e},e))})}),w>0&&(0,K.jsx)(Z,{title:`Refinements (${w})`,icon:On,children:(0,K.jsx)(`div`,{className:`space-y-2`,children:(()=>{let e=S.refinements,t=!y&&e.length>2,n=t?e.slice(-2):e;return(0,K.jsxs)(K.Fragment,{children:[t&&(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>b(!0),children:[(0,K.jsx)(Ft,{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,K.jsxs)(`div`,{className:`flex gap-3 p-2.5 bg-base-200 rounded-box text-sm animate-fade-in`,children:[(0,K.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,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed`,children:n.feedback}),(0,K.jsx)(`span`,{className:`text-[10px] opacity-40 mt-1 block`,children:H(n.at)})]})]},i)}),y&&e.length>2&&(0,K.jsx)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>b(!1),children:`Show less`})]})})()})}),T.length>0&&(0,K.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,K.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,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Hn,{className:`size-3.5 opacity-60`}),`Plan History (`,T.length,` previous)`]}),(0,K.jsx)(Ft,{className:`size-3.5 opacity-60 transition-transform ${h?`rotate-180`:``}`})]}),h&&(0,K.jsx)(`div`,{className:`divide-y divide-base-300`,children:T.map((e,t)=>(0,K.jsxs)(`div`,{className:`px-3 py-2.5 space-y-1 text-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 opacity-60`,children:[(0,K.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`v`,t+1]}),(0,K.jsxs)(`span`,{children:[e.steps?.length??0,` steps`]}),(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.estimatedComplexity}),(0,K.jsx)(`span`,{className:`ml-auto`,children:H(e.createdAt)})]}),(0,K.jsx)(`p`,{className:`opacity-70 leading-relaxed line-clamp-2`,children:e.summary})]},t))})]}),C&&S&&(0,K.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-2`,children:[(0,K.jsxs)(`div`,{className:`text-xs font-semibold flex items-center gap-1.5 opacity-70`,children:[(0,K.jsx)(On,{className:`size-3.5`}),`Refine Plan`]}),(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.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(),I())}}),(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{className:`btn btn-secondary btn-sm gap-1.5`,onClick:I,disabled:M||!r.trim(),children:j?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Y,{className:`size-3.5 animate-spin`}),` Generating v`,w+2,`...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Hn,{className:`size-3.5`}),` Refine Plan`]})}),(0,K.jsx)(`span`,{className:`text-[10px] opacity-30`,children:`Ctrl+Enter to send`})]})]}),O&&(0,K.jsx)(`div`,{className:`alert alert-error text-sm`,children:O}),C&&!M&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 pt-3 border-t border-base-300 max-sm:flex-col`,children:[(0,K.jsx)(`button`,{className:`btn btn-primary gap-1.5 max-sm:w-full`,onClick:F,disabled:d||!S,children:d?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Y,{className:`size-4 animate-spin`}),` Starting...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Bt,{className:`size-4`}),` Approve & Start`]})}),S&&(0,K.jsx)(`button`,{className:`btn btn-ghost btn-sm gap-1 max-sm:w-full`,onClick:ee,disabled:p||M,title:`Archive current plan and generate a new one`,children:p?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Y,{className:`size-3 animate-spin`}),` Replanning...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Hn,{className:`size-3`}),` Replan`]})})]})]})}function ki({issue:e,issueId:t,onStateChange:n,onRetry:r}){let i=T(),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(!1),[y,b]=(0,W.useState)(null),[x,S]=(0,W.useState)(e.images??[]),[C,w]=(0,W.useState)(!1),E=(0,W.useRef)(null),[D,O]=(0,W.useState)(!1),[k,A]=(0,W.useState)(``),[j,M]=(0,W.useState)(!1),[N,P]=(0,W.useState)(null),[F,I]=(0,W.useState)(!1),ee=e.state===`Reviewing`||e.state===`PendingDecision`,te=e.state===`Approved`,L=e.state===`Merged`,R=!!e.mergedAt||L,z=e.mergeResult,B=(0,W.useCallback)(async()=>{c(!0);try{o(await V.get(`/diff/${encodeURIComponent(t)}`))}catch{o(null)}finally{c(!1)}},[t]),H=(0,W.useCallback)(async()=>{try{f(await V.get(`/issues/${encodeURIComponent(t)}/merge-preview`))}catch{f(null)}},[t]);(0,W.useEffect)(()=>{g(!!e.testApplied),o(null),u(null),f(null),m(null),b(null),O(!1),A(``),P(null),S(e.images??[])},[t,e.testApplied]),(0,W.useEffect)(()=>{B()},[B]),(0,W.useEffect)(()=>{H()},[H]),(0,W.useEffect)(()=>{V.get(`/git/status`).then(e=>m(e.isClean!==!1)).catch(()=>m(null))},[t]);let U=(0,W.useCallback)(async e=>{if(e.length){w(!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&&S(e=>[...e,...r.paths])}catch{}finally{w(!1),E.current&&(E.current.value=``)}}},[t]);(0,W.useEffect)(()=>{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&&U(t)};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[U]);let ne=a?.files||[],re=a?.diff||``,ie={};if(re)for(let e of re.split(/(?=^diff --git )/m)){let t=e.match(/^diff --git a\/(.+?) b\//);t&&(ie[t[1]]=e.split(`
|
|
44
|
+
`))}let ae=(0,W.useCallback)(async()=>{v(!0),b(null);try{await V.post(`/issues/${encodeURIComponent(e.id)}/try`),g(!0)}catch(e){b(e.message)}finally{v(!1)}},[e.id]),oe=(0,W.useCallback)(async()=>{v(!0),b(null);try{await V.post(`/issues/${encodeURIComponent(e.id)}/revert-try`),g(!1)}catch(e){b(e.message)}finally{v(!1)}},[e.id]),se=(0,W.useCallback)(async()=>{M(!0),P(null);try{await V.post(`/issues/${encodeURIComponent(e.id)}/approve-and-merge`),i.invalidateQueries({queryKey:[`runtime-state`]})}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},[e.id,i]),ce=(0,W.useCallback)(async()=>{n?.(e.id,`Approved`)},[e.id,n]),le=(0,W.useCallback)(async()=>{r?.(e.id,k||void 0),O(!1),A(``)},[e.id,k,r]),ue=(0,W.useCallback)(async()=>{I(!0);try{await V.post(`/issues/${encodeURIComponent(e.id)}/cancel`),i.invalidateQueries({queryKey:[`runtime-state`]})}catch{}finally{I(!1)}},[e.id,i]);return(0,K.jsxs)(`div`,{className:`space-y-6`,children:[te&&!R&&(!z||z.conflicts===0)&&(0,K.jsxs)(`div`,{className:`alert border border-success/30 bg-success/5 text-sm`,children:[(0,K.jsx)(Bt,{className:`size-4 shrink-0 text-success`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:`Approved — ready to merge`})]}),R&&(0,K.jsxs)(`div`,{className:`alert border text-sm ${z?.conflicts>0?`border-warning/30 bg-warning/5`:`border-success/30 bg-success/5`}`,children:[(0,K.jsx)(q,{className:`size-4 shrink-0 ${z?.conflicts>0?`text-warning`:`text-success`}`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`font-semibold`,children:`Merged`}),z&&(0,K.jsxs)(`span`,{className:`opacity-70`,children:[` — `,z.copied,` file`,z.copied===1?``:`s`,` copied`,z.deleted>0?`, ${z.deleted} deleted`:``]}),z?.conflicts>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`text-xs text-warning font-medium mt-0.5`,children:[`Merge aborted — `,z.conflicts,` file`,z.conflicts===1?``:`s`,` had conflicts.`]}),z.conflictFiles?.length>0&&(0,K.jsx)(`ul`,{className:`text-xs text-warning/80 mt-1 ml-4 list-disc space-y-0.5`,children:z.conflictFiles.map(e=>(0,K.jsx)(`li`,{className:`font-mono`,children:e},e))})]}),(!z?.conflicts||z.conflicts===0)&&(0,K.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`The approved branch has been integrated into the current project branch.`})]})]}),!R&&te&&z?.conflicts>0&&(0,K.jsxs)(`div`,{className:`alert border border-warning/30 bg-warning/5 text-sm`,children:[(0,K.jsx)(X,{className:`size-4 shrink-0 text-warning`}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`span`,{className:`font-semibold`,children:`Merge failed due to conflicts`}),(0,K.jsxs)(`p`,{className:`text-xs opacity-70 mt-0.5`,children:[`The branch `,e.branchName?(0,K.jsx)(`span`,{className:`font-mono`,children:e.branchName}):``,` could not be merged — `,z.conflicts,` file`,z.conflicts===1?``:`s`,` diverged.`]}),z.conflictFiles?.length>0&&(0,K.jsx)(`ul`,{className:`text-xs opacity-60 mt-1 ml-4 list-disc space-y-0.5`,children:z.conflictFiles.map(e=>(0,K.jsx)(`li`,{className:`font-mono`,children:e},e))}),(0,K.jsxs)(`button`,{className:`btn btn-xs btn-warning gap-1 mt-2`,onClick:()=>r?.(e.id),children:[(0,K.jsx)(Hn,{className:`size-3`}),` Requeue for Rework`]})]})]}),e.prUrl&&(0,K.jsxs)(`div`,{className:`alert border border-primary/30 bg-primary/5 text-sm`,children:[(0,K.jsx)(en,{className:`size-4 shrink-0 text-primary`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`font-semibold`,children:`Pull request created`}),(0,K.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noreferrer`,className:`block text-xs text-primary hover:underline mt-0.5 font-mono break-all`,children:e.prUrl})]})]}),(0,K.jsxs)(Z,{title:`Review Changes`,icon:qt,children:[s?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-4`,children:[(0,K.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),` Loading changes...`]}):ne.length>0?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,K.jsxs)(`span`,{className:`opacity-60`,children:[ne.length,` file`,ne.length===1?``:`s`,` changed`]}),(0,K.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,a?.totalAdditions||0]}),(0,K.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,a?.totalDeletions||0]})]}),(0,K.jsx)(`div`,{className:`space-y-1`,children:ne.map(e=>(0,K.jsx)(di,{file:e,isOpen:l===e.path,onToggle:()=>u(l===e.path?null:e.path)},e.path))}),l&&ie[l]&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:l}),(0,K.jsx)(fi,{lines:ie[l]})]}),d?.willConflict&&(0,K.jsxs)(`div`,{className:`alert alert-warning text-xs py-2 gap-1.5`,children:[(0,K.jsx)(X,{className:`size-3.5 shrink-0`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`font-semibold`,children:`Merge will conflict`}),(0,K.jsxs)(`span`,{className:`opacity-70`,children:[` — `,d.conflictFiles.length,` file`,d.conflictFiles.length===1?``:`s`]}),d.conflictFiles.length>0&&(0,K.jsx)(`ul`,{className:`mt-1 ml-4 list-disc space-y-0.5 font-mono opacity-80`,children:d.conflictFiles.map(e=>(0,K.jsx)(`li`,{children:e},e))})]})]}),d&&!d.willConflict&&(0,K.jsxs)(`div`,{className:`alert alert-success text-xs py-2 gap-1.5`,children:[(0,K.jsx)(Bt,{className:`size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:`Merge is clean — no conflicts detected.`})]})]}):(0,K.jsx)(`div`,{className:`text-sm opacity-40 py-4`,children:`No changes detected.`}),p===!1&&(0,K.jsxs)(`div`,{className:`alert alert-warning text-xs py-2 gap-1.5 mt-3`,children:[(0,K.jsx)(X,{className:`size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:`Project has uncommitted changes — merge and test will fail. Commit or stash them first.`})]}),e.lastError&&(0,K.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mt-3`,children:e.lastError}),e.commandOutputTail&&!e.lastError&&(0,K.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mt-3`,children:e.commandOutputTail})]}),ee&&(0,K.jsxs)(`div`,{className:`collapse collapse-arrow border border-base-300 rounded-box bg-base-100`,children:[(0,K.jsx)(`input`,{type:`checkbox`}),(0,K.jsxs)(`div`,{className:`collapse-title text-sm font-semibold flex items-center gap-1.5 py-3 min-h-0`,children:[(0,K.jsx)(on,{className:`size-4 opacity-50`}),`Optional: Test in your workspace`]}),(0,K.jsxs)(`div`,{className:`collapse-content space-y-4`,children:[y&&(0,K.jsxs)(`div`,{className:`alert alert-error text-xs py-2 gap-1.5`,children:[(0,K.jsx)(X,{className:`size-3.5 shrink-0`}),` `,y]}),h?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`alert alert-info text-xs py-2 gap-1.5`,children:[(0,K.jsx)(on,{className:`size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:`Changes applied to your dev server. Test them, then decide below.`})]}),(0,K.jsxs)(`button`,{className:`btn btn-warning btn-sm btn-soft gap-1.5 w-full`,onClick:oe,disabled:_,children:[_?(0,K.jsx)(Y,{className:`size-3.5 animate-spin`}):(0,K.jsx)(Hn,{className:`size-3.5`}),`Revert Changes`]})]}):(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-xs opacity-60`,children:`Apply the branch changes to your workspace to test with hot reload before deciding.`}),(0,K.jsxs)(`button`,{className:`btn btn-info btn-sm btn-soft gap-1.5 w-full`,onClick:ae,disabled:_||p===!1,title:p===!1?`Cannot test — working tree has uncommitted changes`:`Apply changes to workspace for testing`,children:[_?(0,K.jsx)(Y,{className:`size-3.5 animate-spin`}):(0,K.jsx)(on,{className:`size-3.5`}),`Apply Changes`]})]}),(0,K.jsx)(`div`,{className:`h-0`}),` `]})]}),(0,K.jsxs)(Z,{title:`Evidence`,icon:_n,children:[(0,K.jsx)(`input`,{ref:E,type:`file`,multiple:!0,accept:`image/*`,className:`hidden`,onChange:e=>U(Array.from(e.target.files??[]))}),x.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:x.map((e,n)=>{let r=e.split(`/`).pop(),i=`/api/issues/${encodeURIComponent(t)}/images/${encodeURIComponent(r)}`;return(0,K.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`block`,children:(0,K.jsx)(`img`,{src:i,alt:r,className:`size-20 object-cover rounded-lg border border-base-300 hover:opacity-80 transition-opacity`})},n)})}),x.length===0&&(0,K.jsx)(`p`,{className:`text-xs opacity-40`,children:`No screenshots attached. Paste or upload images as evidence.`}),(0,K.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-ghost gap-1 mt-2`,onClick:()=>E.current?.click(),disabled:C,children:[C?(0,K.jsx)(Y,{className:`size-3 animate-spin`}):(0,K.jsx)(Fn,{className:`size-3`}),`Attach Screenshot`]})]}),ee&&(0,K.jsx)(Z,{title:`Decision`,icon:nr,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[N&&(0,K.jsxs)(`div`,{className:`alert alert-error text-xs py-2 gap-1.5`,children:[(0,K.jsx)(X,{className:`size-3.5 shrink-0`}),` `,N]}),(0,K.jsxs)(`button`,{className:`btn btn-success w-full gap-1.5`,onClick:se,disabled:j,children:[j?(0,K.jsx)(Y,{className:`size-4 animate-spin`}):h?(0,K.jsx)(Vn,{className:`size-4`}):(0,K.jsx)(q,{className:`size-4`}),j?`Merging...`:h?`Ship It`:`Approve & Merge`]}),(0,K.jsxs)(`button`,{className:`btn btn-success btn-outline btn-sm w-full gap-1.5`,onClick:ce,children:[(0,K.jsx)(nr,{className:`size-3.5`}),`Approve Only`]}),D?(0,K.jsxs)(`div`,{className:`border border-warning/30 rounded-box p-3 space-y-3 bg-warning/5`,children:[(0,K.jsx)(`textarea`,{className:`textarea textarea-bordered w-full text-sm`,rows:3,placeholder:`Describe what needs to change (sent to the agent)...`,value:k,onChange:e=>A(e.target.value),autoFocus:!0}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{className:`btn btn-ghost btn-sm flex-1`,onClick:()=>{O(!1),A(``)},children:`Cancel`}),(0,K.jsxs)(`button`,{className:`btn btn-warning btn-sm flex-1 gap-1.5`,onClick:le,children:[(0,K.jsx)(Hn,{className:`size-3.5`}),`Send Rework`]})]})]}):(0,K.jsxs)(`button`,{className:`btn btn-warning btn-outline btn-sm w-full gap-1.5`,onClick:()=>O(!0),children:[(0,K.jsx)(Hn,{className:`size-3.5`}),`Request Rework`]}),(0,K.jsx)(`div`,{className:`pt-2 border-t border-base-300`,children:(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-sm text-error w-full gap-1.5`,onClick:ue,disabled:F,children:[F?(0,K.jsx)(Y,{className:`size-3.5 animate-spin`}):(0,K.jsx)(Ut,{className:`size-3.5`}),`Cancel Issue`]})})]})})]})}function Ai({issue:e,onStateChange:t,onRetry:n,onMerge:r,onPush:i,mergeBusy:a,mergeError:o,mergeNotice:s,mergeMode:c}){let l={paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.75rem)`},[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),m=(0,W.useCallback)(async()=>{d(!0),p(null);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/execute`);if(!t.ok)throw Error(t.error||`Execute failed.`)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}},[e.id]),h=e.state===`Planning`,g=e.state===`PendingApproval`,_=e.state===`Running`||e.state===`Queued`,v=e.state===`Reviewing`||e.state===`PendingDecision`,y=e.state===`Approved`,b=e.state===`Merged`,x=!!e.mergedAt||b,[S,C]=(0,W.useState)(null);return(0,W.useEffect)(()=>{!y||x||V.get(`/git/status`).then(e=>C(e.isClean!==!1)).catch(()=>C(null))},[y,x]),h?null:g?(0,K.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-1.5`,style:l,children:[f&&(0,K.jsxs)(`div`,{className:`alert alert-error text-xs py-1.5`,children:[(0,K.jsx)(X,{className:`size-3.5`}),` `,f]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,K.jsx)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1`,onClick:m,disabled:u,children:u?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Y,{className:`size-4 animate-spin`}),` Starting...`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ht,{className:`size-4`}),` Execute`]})})})]}):_?(0,K.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center justify-center gap-2`,style:l,children:[(0,K.jsx)(`span`,{className:`issue-phase-dot`}),(0,K.jsx)(`span`,{className:`text-sm opacity-50`,children:`Watching...`})]}):v?null:y&&!x?(0,K.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-2`,style:l,children:[S===!1&&(0,K.jsxs)(`div`,{className:`alert alert-warning text-xs py-1.5`,children:[(0,K.jsx)(X,{className:`size-3.5`}),(0,K.jsx)(`span`,{children:`Project has uncommitted changes — merge will fail. Commit or stash them first.`})]}),o&&(0,K.jsxs)(`div`,{className:`alert alert-error text-sm py-2`,children:[(0,K.jsx)(X,{className:`size-4`}),` `,o]}),s&&!o&&(0,K.jsxs)(`div`,{className:`alert alert-success text-sm py-2`,children:[(0,K.jsx)(`span`,{className:`size-4`}),` `,s]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:c===`push-pr`?(0,K.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1 ${a?`btn-disabled`:``}`,onClick:()=>i?.(e.id),disabled:a,children:[a?(0,K.jsx)(Y,{className:`size-4 animate-spin`}):(0,K.jsx)(pn,{className:`size-4`}),a?`Pushing...`:e.baseBranch?(0,K.jsxs)(K.Fragment,{children:[`Push PR → `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Push & Open PR`]}):(0,K.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1 ${a?`btn-disabled`:``}`,onClick:()=>r?.(e.id),disabled:a,children:[a?(0,K.jsx)(Y,{className:`size-4 animate-spin`}):(0,K.jsx)(q,{className:`size-4`}),a?`Merging...`:e.baseBranch?(0,K.jsxs)(K.Fragment,{children:[`Merge → `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Merge to Project`]})})]}):null}function ji({issue:e,onClose:t,onStateChange:n,onRetry:r,onCancel:i,events:a,mergeMode:o,tabRef:s}){let[c,l]=(0,W.useState)(`overview`),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(null),w=(0,W.useRef)(null),{data:T}=Wr(),E=(0,W.useCallback)(async()=>{if(!(!e?.id||b)){x(!0),C(null);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/replan`);if(!t.ok)throw Error(t.error||`Replan failed.`);l(`planning`)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}}},[e?.id,b]),D=(0,W.useCallback)(()=>{p(!0),setTimeout(()=>{d(!1),p(!1),t()},250)},[t]),{ref:O,handlers:k}=Mr({onDismiss:D,direction:`right`});(0,W.useEffect)(()=>{e&&l(Zr(e.state))},[e?.id]),(0,W.useEffect)(()=>{s&&(s.current={get:()=>c,set:e=>l(e)})},[s,c]),(0,W.useEffect)(()=>{h(!1),_(null),y(null),e&&(d(!0),p(!1))},[e?.id,e?.state]);let A=(0,W.useCallback)(async()=>{if(!(!e?.id||m)){h(!0),_(null),y(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,i=Array.isArray(t?.conflicts)?t.conflicts:[];r>0?_(`Merge aborted — ${r} conflict${r===1?``:`s`}: ${i.join(`, `)}`):y(`Merged ${n} file${n===1?``:`s`} into the project.`)}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}},[e?.id,m]),j=(0,W.useCallback)(async()=>{if(!(!e?.id||m)){h(!0),_(null),y(null);try{let t=await V.post(`/issues/${encodeURIComponent(e.id)}/push`);if(!t.ok)throw Error(t.error||`Push failed.`);t.prUrl?(y(`Branch pushed. PR: ${t.prUrl}`),window.open(t.prUrl,`_blank`,`noopener`)):y(`Branch pushed to origin.`)}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}}},[e?.id,m]);if((0,W.useEffect)(()=>{w.current&&w.current.querySelector(`.tab-active`)?.scrollIntoView({behavior:`smooth`,inline:`center`,block:`nearest`})},[c]),!e&&!u)return null;let M=e?.state===`Planning`&&!e?.plan&&!e?.planningError&&e?.planningStatus!==`planning`;return(0,K.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/35 ${f?`animate-fade-out`:`animate-fade-in`}`,onClick:D,children:(0,K.jsxs)(`div`,{ref:O,className:`fixed top-0 right-0 z-50 h-full w-full md:w-[40vw] md:min-w-[520px] lg:min-w-[600px] bg-base-100 shadow-2xl flex flex-col ${f?`animate-slide-out-right`:`animate-slide-in-right`}`,onClick:e=>e.stopPropagation(),...k,children:[(0,K.jsxs)(`div`,{className:`px-6 pt-4 pb-0 shrink-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,K.jsx)(`span`,{className:`font-mono text-xs opacity-40 shrink-0`,children:e.identifier}),e.baseBranch&&(0,K.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,K.jsx)(q,{className:`size-2.5`}),e.baseBranch]}),e.state!==`Planning`&&e.plan&&![`Running`,`Reviewing`,`Queued`].includes(e.state)&&(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1 opacity-50 hover:opacity-100`,onClick:E,disabled:b||e.planningStatus===`planning`,title:`Archive current plan and request a new one`,children:[b?(0,K.jsx)(Y,{className:`size-3 animate-spin`}):(0,K.jsx)(Hn,{className:`size-3`}),`Replan`]}),S&&(0,K.jsx)(`span`,{className:`text-xs text-error truncate`,children:S})]}),(0,K.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle shrink-0`,onClick:D,"aria-label":`Close`,children:(0,K.jsx)(fr,{className:`size-4`})})]}),(0,K.jsxs)(`div`,{className:`flex items-start gap-2 mb-1`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-bold leading-tight flex-1`,children:e.title||`-`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 mt-0.5 flex-wrap justify-end`,children:[e.issueType&&Yr[e.issueType]&&(0,K.jsx)(`span`,{className:`badge badge-sm ${Yr[e.issueType]} badge-soft`,children:e.issueType}),(e.planVersion??0)>0&&(0,K.jsxs)(`span`,{className:`badge badge-sm badge-info badge-soft font-mono`,children:[`Plan v`,e.planVersion]}),(e.executeAttempt??0)>0&&(0,K.jsxs)(`span`,{className:`badge badge-sm badge-ghost font-mono opacity-60`,children:[`exec v`,e.planVersion??1,`a`,e.executeAttempt]})]})]}),e.description&&(0,K.jsx)(`p`,{className:`text-xs opacity-45 leading-relaxed mb-1 line-clamp-2`,children:e.description}),(0,K.jsx)(ti,{issue:e}),(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`div`,{ref:w,role:`tablist`,className:`tabs tabs-lift overflow-x-auto flex-nowrap -webkit-overflow-scrolling-touch scrollbar-none`,style:{scrollbarWidth:`none`},children:Xr.map(({id:t,label:n,icon:r,color:i,activeColor:a})=>{let o=c===t,s=o?a.replace(`tab-active `,``):i;return(0,K.jsxs)(`a`,{role:`tab`,className:`tab gap-1 text-xs whitespace-nowrap ${o?a:i} ${o?`font-semibold`:``}`,onClick:()=>l(t),children:[(0,K.jsx)(r,{className:`size-3 ${s}`}),n,t===`review`&&(e.state===`Reviewing`||e.state===`PendingDecision`)&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-secondary`,children:`!`}),t===`planning`&&e.planningStatus===`planning`&&(0,K.jsx)(`span`,{className:`loading loading-spinner loading-xs text-info`}),t===`planning`&&M&&(0,K.jsx)(`span`,{className:`loading loading-dots loading-xs text-info opacity-50`})]},t)})}),(0,K.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,K.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4 min-h-0 drawer-safe-bottom`,children:(0,K.jsxs)(`div`,{className:`animate-fade-in`,children:[c===`overview`&&(0,K.jsx)(si,{issue:e,onStateChange:n,onRetry:r,onCancel:i}),c===`planning`&&(0,K.jsx)(Oi,{issue:e,onStateChange:n,workflowConfig:T}),c===`review`&&(0,K.jsx)(ki,{issue:e,issueId:e.id,onStateChange:n,onRetry:r}),c===`execution`&&(0,K.jsx)(li,{issue:e,workflowConfig:T}),c===`diff`&&(0,K.jsx)(pi,{issueId:e.id}),c===`routing`&&(0,K.jsx)(gi,{issue:e}),c===`events`&&(0,K.jsx)(Ei,{issueId:e.id,events:a})]},c)}),(0,K.jsx)(Ai,{issue:e,onStateChange:n,onRetry:r,onMerge:A,onPush:j,mergeBusy:m,mergeError:g,mergeNotice:v,mergeMode:o})]})})}function Mi({pwa:e}){return e?e.updateAvailable?(0,K.jsxs)(`div`,{className:`alert alert-info rounded-none border-x-0`,children:[(0,K.jsx)(Bn,{className:`size-4`}),(0,K.jsx)(`span`,{className:`text-sm`,children:`A fresh dashboard build is ready.`}),(0,K.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>e.applyUpdate(),children:`Reload app`})]}):e.isOnline?null:(0,K.jsxs)(`div`,{className:`alert alert-warning rounded-none border-x-0`,children:[(0,K.jsx)(cr,{className:`size-4`}),(0,K.jsx)(`span`,{className:`text-sm`,children:`You are offline. The app shell is available, but live runtime data may be stale.`})]}):null}var Ni=[`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 Pi(e,t){return Math.random()*(t-e)+e}function Fi({color:e,style:t}){return(0,K.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 Ii({x:e=`50%`,y:t=`50%`,active:n,onDone:r,count:i=24}){let[a,o]=(0,W.useState)([]),s=(0,W.useRef)(r);(0,W.useEffect)(()=>{s.current=r},[r]);let c=(0,W.useCallback)(()=>{let e=Array.from({length:i},(e,t)=>{let n=Math.PI*2*t/i+Pi(-.3,.3),r=Pi(40,120),a=Pi(4,8);return{id:t,color:Ni[t%Ni.length],size:a,x:0,y:0,tx:`${Math.cos(n)*r}px`,ty:`${Math.sin(n)*r-Pi(20,60)}px`,r:`${Pi(-180,180)}deg`,duration:Pi(600,1e3)}});o(e);let t=Math.max(...e.map(e=>e.duration));setTimeout(()=>{o([]),s.current?.()},t+50)},[i]);return(0,W.useEffect)(()=>{n&&c()},[n,c]),a.length===0?null:(0,K.jsx)(`div`,{className:`fixed pointer-events-none z-[100]`,style:{left:e,top:t,transform:`translate(-50%, -50%)`},children:a.map(e=>(0,K.jsx)(Fi,{color:e.color,style:e},e.id))})}var Li=[`shift`,`alt`,`meta`,`mod`,`ctrl`,`control`],Ri={esc:`escape`,return:`enter`,left:`arrowleft`,right:`arrowright`,up:`arrowup`,down:`arrowdown`,ShiftLeft:`shift`,ShiftRight:`shift`,AltLeft:`alt`,AltRight:`alt`,MetaLeft:`meta`,MetaRight:`meta`,OSLeft:`meta`,OSRight:`meta`,ControlLeft:`ctrl`,ControlRight:`ctrl`};function zi(e){return(Ri[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,``)}function Bi(e){return Li.includes(e)}function Vi(e,t=`,`){return e.toLowerCase().split(t)}function Hi(e,t=`+`,n=`>`,r=!1,i,a){let o=[],s=!1;e=e.trim(),e.includes(n)?(s=!0,o=e.toLocaleLowerCase().split(n).map(e=>zi(e))):o=e.toLocaleLowerCase().split(t).map(e=>zi(e));let c={alt:o.includes(`alt`),ctrl:o.includes(`ctrl`)||o.includes(`control`),shift:o.includes(`shift`),meta:o.includes(`meta`),mod:o.includes(`mod`),useKey:r},l=o.filter(e=>!Li.includes(e));return{...c,keys:l,description:i,isSequence:s,hotkey:e,metadata:a}}typeof document<`u`&&(document.addEventListener(`keydown`,e=>{e.code!==void 0&&Ki([zi(e.code)])}),document.addEventListener(`keyup`,e=>{e.code!==void 0&&qi([zi(e.code)])})),typeof window<`u`&&(window.addEventListener(`blur`,()=>{Ui.clear()}),window.addEventListener(`contextmenu`,()=>{setTimeout(()=>{Ui.clear()},0)}));var Ui=new Set;function Wi(e){return Array.isArray(e)}function Gi(e,t=`,`){return(Wi(e)?e:e.split(t)).every(e=>Ui.has(e.trim().toLowerCase()))}function Ki(e){let t=Array.isArray(e)?e:[e];Ui.has(`meta`)&&Ui.forEach(e=>{Bi(e)||Ui.delete(e.toLowerCase())}),t.forEach(e=>{Ui.add(e.toLowerCase())})}function qi(e){e===`meta`?Ui.clear():(Array.isArray(e)?e:[e]).forEach(e=>{Ui.delete(e.toLowerCase())})}function Ji(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function Yi(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}var Xi=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`];function Zi(e){return Qi(e,Xi)}function Qi(e,t=!1){let{target:n,composed:r}=e,i,a;return $i(n)&&r?(i=e.composedPath()[0]&&e.composedPath()[0].tagName,a=e.composedPath()[0]&&e.composedPath()[0].role):(i=n&&n.tagName,a=n&&n.role),Wi(t)?!!(i&&t&&t.some(e=>e.toLowerCase()===i.toLowerCase()||e===a)):!!(i&&t&&t)}function $i(e){return!!e.tagName&&!e.tagName.startsWith(`-`)&&e.tagName.includes(`-`)}function ea(e,t){return e.length===0&&t?!1:t?e.some(e=>t.includes(e))||e.includes(`*`):!0}var ta=(e,t,n=!1)=>{let{alt:r,meta:i,mod:a,shift:o,ctrl:s,keys:c,useKey:l}=t,{code:u,key:d,ctrlKey:f,metaKey:p,shiftKey:m,altKey:h}=e,g=zi(u);if(l&&c?.length===1&&c.includes(d.toLowerCase()))return!0;if(!c?.includes(g)&&![`ctrl`,`control`,`unknown`,`meta`,`alt`,`shift`,`os`].includes(g))return!1;if(!n){if(r!==h&&g!==`alt`||o!==m&&g!==`shift`)return!1;if(a){if(!p&&!f)return!1}else if(i!==p&&g!==`meta`&&g!==`os`||s!==f&&g!==`ctrl`&&g!==`control`)return!1}return c&&c.length===1&&c.includes(g)?!0:c&&c.length>0?c.includes(g)?Gi(c):!1:!c||c.length===0},na=(0,W.createContext)(void 0),ra=()=>(0,W.useContext)(na);function ia({addHotkey:e,removeHotkey:t,children:n}){return(0,K.jsx)(na.Provider,{value:{addHotkey:e,removeHotkey:t},children:n})}function aa(e,t){return e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((n,r)=>n&&aa(e[r],t[r]),!0):e===t}var oa=(0,W.createContext)({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),sa=()=>(0,W.useContext)(oa),ca=({initiallyActiveScopes:e=[`*`],children:t})=>{let[n,r]=(0,W.useState)(e),[i,a]=(0,W.useState)([]),o=(0,W.useCallback)(e=>{r(t=>t.includes(`*`)?[e]:Array.from(new Set([...t,e])))},[]),s=(0,W.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]),c=(0,W.useCallback)(e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):t.includes(`*`)?[e]:Array.from(new Set([...t,e])))},[]),l=(0,W.useCallback)(e=>{a(t=>[...t,e])},[]),u=(0,W.useCallback)(e=>{a(t=>t.filter(t=>!aa(t,e)))},[]);return(0,K.jsx)(oa.Provider,{value:{activeScopes:n,hotkeys:i,enableScope:o,disableScope:s,toggleScope:c},children:(0,K.jsx)(ia,{addHotkey:l,removeHotkey:u,children:t})})};function la(e){let t=(0,W.useRef)(void 0);return aa(t.current,e)||(t.current=e),t.current}var ua=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},da=typeof window<`u`?W.useLayoutEffect:W.useEffect;function $(e,t,n,r){let i=(0,W.useRef)(null),a=(0,W.useRef)(!1),o=Array.isArray(n)?Array.isArray(r)?void 0:r:n,s=Wi(e)?e.join(o?.delimiter):e,c=Array.isArray(n)?n:Array.isArray(r)?r:void 0,l=(0,W.useCallback)(t,c??[]),u=(0,W.useRef)(l);c?u.current=l:u.current=t;let d=la(o),{activeScopes:f}=sa(),p=ra();return da(()=>{if(d?.enabled===!1||!ea(f,d?.scopes))return;let e=[],t,n=(n,r=!1)=>{if(!(Zi(n)&&!Qi(n,d?.enableOnFormTags))){if(i.current!==null){let e=i.current.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&e.activeElement!==i.current&&!i.current.contains(e.activeElement)){ua(n);return}}n.target?.isContentEditable&&!d?.enableOnContentEditable||Vi(s,d?.delimiter).forEach(i=>{if(i.includes(d?.splitKey??`+`)&&i.includes(d?.sequenceSplitKey??`>`)){console.warn(`Hotkey ${i} contains both ${d?.splitKey??`+`} and ${d?.sequenceSplitKey??`>`} which is not supported.`);return}let o=Hi(i,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description,d?.metadata);if(o.isSequence){t=setTimeout(()=>{e=[]},d?.sequenceTimeoutMs??1e3);let r=o.useKey?n.key:zi(n.code);if(Bi(r.toLowerCase()))return;if(e.push(r),r!==o.keys?.[e.length-1]){e=[],t&&clearTimeout(t);return}e.length===o.keys?.length&&(u.current(n,o),t&&clearTimeout(t),e=[])}else if(ta(n,o,d?.ignoreModifiers)||o.keys?.includes(`*`)){if(d?.ignoreEventWhen?.(n)||r&&a.current)return;if(Ji(n,o,d?.preventDefault),!Yi(n,o,d?.enabled)){ua(n);return}u.current(n,o),r||(a.current=!0)}})}},r=e=>{e.code!==void 0&&(Ki(zi(e.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&n(e))},c=e=>{e.code!==void 0&&(qi(zi(e.code)),a.current=!1,d?.keyup&&n(e,!0))},l=i.current||o?.document||document;return l.addEventListener(`keyup`,c,o?.eventListenerOptions),l.addEventListener(`keydown`,r,o?.eventListenerOptions),p&&Vi(s,d?.delimiter).forEach(e=>{p.addHotkey(Hi(e,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description,d?.metadata))}),()=>{l.removeEventListener(`keyup`,c,o?.eventListenerOptions),l.removeEventListener(`keydown`,r,o?.eventListenerOptions),p&&Vi(s,d?.delimiter).forEach(e=>{p.removeHotkey(Hi(e,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description,d?.metadata))}),e=[],t&&clearTimeout(t)}},[s,d,f]),i}var fa=`modulepreload`,pa=function(e){return`/assets/`+e},ma={},ha=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=pa(t,n),t in ma)return;ma[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`:fa,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)})},ga=(0,W.lazy)(()=>ha(()=>import(`./KeyboardShortcutsHelp-CuBWBOeU.js`),__vite__mapDeps([0,1,2]))),_a=(0,W.lazy)(()=>ha(()=>import(`./CommandPalette-Ct6qhS6N.js`),__vite__mapDeps([3,1,2,4])));function va({children:e}){let t=A().location.pathname,n=(0,W.useRef)(null),r=(0,W.useRef)(t);return(0,W.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,K.jsx)(`div`,{ref:n,className:`flex-1 flex flex-col min-h-0`,children:e})}function ya(){let e=bt(),t=w(),n=A().location.pathname,[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(null),[,c]=(0,W.useState)(0);(0,W.useEffect)(()=>{document.title=e.queueTitle||`fifony`},[e.queueTitle]);let l=!!e.selectedIssue,u=e.isCreateOpen,d=a,f=r,p=(0,W.useCallback)(()=>{if(d){o(!1);return}if(f){i(!1);return}if(u){e.setIsCreateOpen(!1);return}if(l){e.setSelectedIssue(null);return}},[d,f,u,l,e]),m=(0,W.useCallback)(t=>{if(!e.selectedIssue)return;let n=e.issues,r=n.findIndex(t=>t.id===e.selectedIssue.id);if(r<0)return;let i=r+t;i>=0&&i<n.length&&e.setSelectedIssue(n[i])},[e]),h=(0,W.useCallback)(e=>{if(!s.current)return;let t=Xr.map(e=>e.id),n=t.indexOf(s.current.get());if(n<0)return;let r=n+e;r>=0&&r<t.length&&(s.current.set(t[r]),c(e=>e+1))},[]),g=(0,W.useCallback)(()=>{let t=e.selectedIssue;if(!t)return;let n=t.state;n===`PendingApproval`?ha(async()=>{let{api:e}=await import(`./api-ChEctgc5.js`).then(e=>e.n);return{api:e}},__vite__mapDeps([5,1])).then(({api:e})=>e.post(`/issues/${encodeURIComponent(t.id)}/execute`)):n===`Reviewing`||n===`PendingDecision`?ha(async()=>{let{api:e}=await import(`./api-ChEctgc5.js`).then(e=>e.n);return{api:e}},__vite__mapDeps([5,1])).then(({api:e})=>e.post(`/issues/${encodeURIComponent(t.id)}/approve-and-merge`)):n===`Approved`&&!t.mergedAt&&ha(async()=>{let{api:e}=await import(`./api-ChEctgc5.js`).then(e=>e.n);return{api:e}},__vite__mapDeps([5,1])).then(({api:e})=>e.post(`/issues/${encodeURIComponent(t.id)}/merge`))},[e]),_=!l,v=e.selectedIssue?.state,y=v===`PendingDecision`,b=v===`Reviewing`||v===`PendingDecision`,S=v===`Approved`&&!e.selectedIssue?.mergedAt,C=!!e.selectedIssue?.plan&&![`Running`,`Reviewing`,`Queued`,`Planning`].includes(v);$(`escape`,p,{description:`Close drawer / modal`,metadata:{group:`global`}},[p]),$(`shift+/`,()=>i(e=>!e),{description:`Keyboard shortcuts help`,metadata:{group:`global`}}),$(`mod+k`,()=>o(e=>!e),{preventDefault:!0,enableOnFormTags:!0,description:`Command palette`,metadata:{group:`palette`}}),$(`r`,()=>e.refresh(),{enabled:_,description:`Refresh`,metadata:{group:`global`}},[e,_]),$(`e`,()=>e.toggleEvents(),{enabled:_,description:`Toggle events`,metadata:{group:`global`}},[e,_]),$(`n`,()=>e.setIsCreateOpen(!0),{enabled:_,description:`New issue`,metadata:{group:`navigation`}},[e,_]),$(`k`,()=>t({to:`/kanban`}),{enabled:_&&n!==`/kanban`,description:`Go to Kanban`,metadata:{group:`navigation`}},[t,_,n]),$(`i`,()=>t({to:`/issues`}),{enabled:_&&n!==`/issues`,description:`Go to Issues`,metadata:{group:`navigation`}},[t,_,n]),$(`a`,()=>t({to:`/agents`}),{enabled:_,description:`Go to Agents`,metadata:{group:`navigation`}},[t,_]),$(`t`,()=>t({to:`/analytics`}),{enabled:_,description:`Go to Analytics`,metadata:{group:`navigation`}},[t,_]),$(`s`,()=>t({to:`/settings`}),{enabled:_,description:`Go to Settings`,metadata:{group:`navigation`}},[t,_]),$(`]`,()=>h(1),{enabled:l,description:`Next tab`,metadata:{group:`drawer`}},[h,l]),$(`[`,()=>h(-1),{enabled:l,description:`Previous tab`,metadata:{group:`drawer`}},[h,l]),$(`j`,()=>m(1),{enabled:l,description:`Next issue`,metadata:{group:`drawer`}},[m,l]),$(`k`,()=>m(-1),{enabled:l,description:`Previous issue`,metadata:{group:`drawer`}},[m,l]),$(`mod+enter`,g,{enabled:l,enableOnFormTags:!0,preventDefault:!0,description:`Primary action (Execute / Approve / Merge)`,metadata:{group:`drawer`}},[g,l]),$(`mod+a`,()=>e.updateState(e.selectedIssue.id,`Approved`),{enabled:y,enableOnFormTags:!0,preventDefault:!0,description:`Approve issue`,metadata:{group:`drawer`}},[e,y]),$(`mod+m`,()=>ha(async()=>{let{api:e}=await import(`./api-ChEctgc5.js`).then(e=>e.n);return{api:e}},__vite__mapDeps([5,1])).then(({api:t})=>t.post(`/issues/${encodeURIComponent(e.selectedIssue.id)}/merge`)),{enabled:S,enableOnFormTags:!0,preventDefault:!0,description:`Merge issue`,metadata:{group:`drawer`}},[e,S]),$(`mod+w`,()=>e.retryIssue(e.selectedIssue.id),{enabled:b,enableOnFormTags:!0,preventDefault:!0,description:`Rework issue`,metadata:{group:`drawer`}},[e,b]),$(`mod+p`,()=>ha(async()=>{let{api:e}=await import(`./api-ChEctgc5.js`).then(e=>e.n);return{api:e}},__vite__mapDeps([5,1])).then(({api:t})=>t.post(`/issues/${encodeURIComponent(e.selectedIssue.id)}/replan`)),{enabled:C,enableOnFormTags:!0,preventDefault:!0,description:`Replan issue`,metadata:{group:`drawer`}},[e,C]);let[T,E]=(0,W.useState)(!1),[D,O]=(0,W.useState)(!1),k=(0,W.useRef)(null),j=e.runtime.isLoading&&!e.runtime.data&&!e.runtime.isError;if((0,W.useEffect)(()=>(!T&&!k.current&&(k.current=setTimeout(()=>{O(!0),setTimeout(()=>E(!0),400)},1e3)),()=>{}),[T]),!T&&j)return(0,K.jsx)(ba,{});if(!T&&D)return(0,K.jsx)(ba,{fadeOut:!0});if(!T&&!j)return(0,K.jsx)(ba,{});let M=e.toast?.type||`info`,N=typeof e.toast==`string`?e.toast:e.toast?.message;return(0,K.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[e.toast&&(0,K.jsx)(`div`,{className:`toast toast-end toast-top z-50`,children:(0,K.jsxs)(`div`,{className:`alert text-sm shadow-lg ${M===`success`?`alert-success`:M===`error`?`alert-error`:`alert-info`} ${e.toastExiting?`animate-toast-out`:`animate-toast-in`}`,children:[M===`success`?(0,K.jsx)(zt,{className:`size-4`}):M===`error`?(0,K.jsx)(X,{className:`size-4`}):(0,K.jsx)(yn,{className:`size-4`}),(0,K.jsx)(`span`,{children:N}),(0,K.jsx)(`div`,{className:`toast-progress`})]})}),e.confetti&&(0,K.jsx)(Ii,{x:e.confetti.x,y:e.confetti.y,count:e.confetti.count,active:!0,onDone:()=>e.clearConfetti?.()}),(0,K.jsx)(Or,{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,K.jsx)(Mi,{pwa:e.pwa}),(0,K.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0`,children:[(0,K.jsx)(va,{children:(0,K.jsx)(x,{})}),e.runtime.isError&&(0,K.jsx)(`div`,{className:`px-4 pb-4`,children:(0,K.jsx)(`div`,{className:`alert alert-error`,children:String(e.runtime.error?.message||`Runtime unavailable`)})})]}),(0,K.jsx)(kr,{onClick:()=>e.setIsCreateOpen(!0)}),(0,K.jsx)(Ar,{}),(0,K.jsx)(Br,{open:e.isCreateOpen,onClose:()=>e.setIsCreateOpen(!1),onSubmit:t=>e.createIssue.mutate(t),isLoading:e.createIssue.isPending,onToast:e.showToast}),(0,K.jsx)(ji,{issue:e.selectedIssue,onClose:()=>e.setSelectedIssue(null),onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,events:e.eventsData,mergeMode:e.data?.config?.mergeMode??`local`,tabRef:s}),r&&(0,K.jsx)(W.Suspense,{fallback:null,children:(0,K.jsx)(ga,{open:r,onClose:()=>i(!1)})}),a&&(0,K.jsx)(W.Suspense,{fallback:null,children:(0,K.jsx)(_a,{issues:e.issues,onSelect:t=>{e.setSelectedIssue(t),o(!1)},onNavigate:e=>{t({to:e}),o(!1)},onAction:e=>{e(),o(!1)},onClose:()=>o(!1)})})]})}function ba({fadeOut:e=!1}){return(0,K.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,K.jsxs)(`div`,{className:`relative z-10 flex flex-col items-center gap-5`,children:[(0,K.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,K.jsx)(`img`,{src:ue,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,K.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,K.jsx)(`span`,{className:`text-primary`,children:`fifony`})})]}),(0,K.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,K.jsx)(`span`,{className:`loading loading-dots loading-sm`}),(0,K.jsx)(`span`,{className:`text-sm`,children:`Warming up the orchestra...`})]})]})})}function xa({children:e}){let t=Re(),n=Fe(Pe(t.data),`ui.onboarding.completed`,null);return t.isLoading&&!t.data?(0,K.jsx)(ba,{}):t.isError||n===!0?e:(0,K.jsx)(W.Suspense,{fallback:(0,K.jsx)(ba,{}),children:(0,K.jsx)(Sa,{})})}function Sa(){let e=w(),t=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{t.current||(t.current=!0,e({to:`/onboarding`,replace:!0}))},[e]),(0,K.jsx)(ba,{})}function Ca(){return A().location.pathname===`/onboarding`?(0,K.jsx)(x,{}):(0,K.jsx)(ca,{children:(0,K.jsx)(xa,{children:(0,K.jsx)(xt,{children:(0,K.jsx)(ya,{})})})})}function wa(e){return e?e.split(`
|
|
45
|
+
`).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 Ta(e){if(!e)return e;try{let t=new URL(e);return t.pathname+(t.searchParams.toString()?`?`+t.searchParams:``)}catch{return e}}function Ea({text:e}){let[t,n]=(0,W.useState)(!1);return(0,K.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 Da({error:e,reset:t}){let[n,r]=(0,W.useState)(!0),[i,a]=(0,W.useState)(!1),o=e?.name||`Error`,s=e?.message||String(e)||`An unexpected error occurred.`,c=e?.stack||``,l=wa(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,K.jsxs)(`div`,{className:`min-h-screen bg-base-200 flex flex-col`,children:[(0,K.jsxs)(`div`,{className:`bg-error text-error-content px-4 py-2.5 flex items-center gap-3 shrink-0`,children:[(0,K.jsx)(X,{className:`size-4 shrink-0`}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-semibold flex-1 truncate`,children:[o,`: `,s]}),(0,K.jsx)(`span`,{className:`text-xs opacity-60 shrink-0`,children:d})]}),(0,K.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row gap-0 min-h-0 overflow-auto`,children:[(0,K.jsxs)(`div`,{className:`flex-1 p-6 space-y-5 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Error`}),(0,K.jsx)(Ea,{text:p})]}),(0,K.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(`span`,{className:`badge badge-error badge-sm mt-0.5 shrink-0 font-mono`,children:o}),(0,K.jsx)(`p`,{className:`font-mono text-sm text-error leading-relaxed break-all`,children:s})]}),m&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-base-content/50`,children:[(0,K.jsx)(`span`,{className:`opacity-40`,children:`at`}),(0,K.jsx)(`span`,{className:`font-mono font-semibold text-base-content/70`,children:m.fn||`<anonymous>`}),(0,K.jsx)(`span`,{className:`opacity-30`,children:`—`}),(0,K.jsx)(`span`,{className:`font-mono`,children:Ta(m.file)}),m.line&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`:`,m.line,`:`,m.col]})]})]})]}),(0,K.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`px-5 py-3 border-b border-base-300`,children:(0,K.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Context`})}),(0,K.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,K.jsxs)(`div`,{className:`px-5 py-2.5 flex items-start gap-4`,children:[(0,K.jsx)(`span`,{className:`text-xs font-semibold opacity-40 w-24 shrink-0 pt-0.5`,children:e}),(0,K.jsx)(`span`,{className:`font-mono text-xs break-all text-base-content/70`,children:t})]},e))})]}),l.length>0&&(0,K.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,K.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,K.jsx)(Ft,{className:`size-3.5 transition-transform ${n?`rotate-180`:``}`}),`Stack trace`,(0,K.jsxs)(`span`,{className:`badge badge-xs badge-ghost normal-case tracking-normal font-mono`,children:[l.length,` frames`]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-50 hover:opacity-100 ${i?`btn-active`:``}`,onClick:()=>a(e=>!e),children:`raw`}),(0,K.jsx)(Ea,{text:c})]})]}),n&&(i?(0,K.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,K.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=Ta(e.file);return(0,K.jsxs)(`div`,{className:`px-5 py-2 flex items-start gap-3 ${n?`bg-warning/5`:`opacity-40`}`,children:[(0,K.jsx)(`span`,{className:`font-mono text-[10px] opacity-30 w-5 shrink-0 text-right pt-0.5`,children:t}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[e.fn&&(0,K.jsx)(`span`,{className:`font-mono text-xs font-semibold ${n?`text-warning`:`text-base-content/60`}`,children:e.fn}),n&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-warning badge-soft`,children:`app`})]}),(0,K.jsxs)(`div`,{className:`font-mono text-[10px] text-base-content/40 truncate`,children:[r,e.line&&(0,K.jsxs)(`span`,{className:`text-base-content/60 ml-0.5`,children:[`:`,e.line,`:`,e.col]})]})]})]},t)})}))]})]}),(0,K.jsxs)(`div`,{className:`lg:w-64 p-6 space-y-4 shrink-0`,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`button`,{className:`btn btn-primary w-full gap-2`,onClick:()=>window.location.reload(),children:[(0,K.jsx)(Hn,{className:`size-4`}),` Reload page`]}),t&&(0,K.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:t,children:`Try to recover`}),(0,K.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:()=>{window.location.href=`/`},children:`Go home`})]}),(0,K.jsx)(`div`,{className:`divider text-xs opacity-30`,children:`about`}),(0,K.jsxs)(`div`,{className:`space-y-1 text-xs text-base-content/40`,children:[(0,K.jsx)(`p`,{children:`This error was caught by the app's error boundary. The details above will help you identify the root cause.`}),(0,K.jsxs)(`p`,{className:`mt-2`,children:[`App frames are `,(0,K.jsx)(`span`,{className:`text-warning font-semibold`,children:`highlighted`}),`.`]})]})]})]})]})}var Oa=k({component:Ca,errorComponent:Da}),ka=[{to:`/settings/project`,label:`Project`,icon:sn},{to:`/settings/workflow`,label:`Execution`,icon:ur},{to:`/settings/agents`,label:`Agents`,icon:ar},{to:`/settings/general`,label:`System`,icon:Gn},{to:`/settings/notifications`,label:`Notifications`,icon:Ot},{to:`/settings/providers`,label:`Providers`,icon:Jn},{to:`/settings/hotkeys`,label:`Hotkeys`,icon:xn}],Aa=m(`/settings`)({component:ja});function ja(){let e=A().location.pathname;return(0,K.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,K.jsxs)(`div`,{className:`max-w-5xl w-full mx-auto flex-1 flex flex-col min-h-0 gap-5`,children:[(0,K.jsx)(`div`,{role:`tablist`,className:`tabs tabs-lift overflow-x-auto flex-nowrap scrollbar-none`,style:{scrollbarWidth:`none`},children:ka.map(({to:t,label:n,icon:r})=>(0,K.jsxs)(g,{to:t,role:`tab`,className:`tab gap-1.5 whitespace-nowrap ${e.startsWith(t)?`tab-active`:``}`,children:[(0,K.jsx)(r,{className:`size-3.5`}),n]},t))}),(0,K.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,K.jsx)(x,{})})]})})}var Ma=(0,W.lazy)(()=>ha(()=>import(`./OnboardingWizard-9qzUVfYb.js`),__vite__mapDeps([6,1,5,2,4])));function Na(){let e=w(),t=T();return(0,K.jsx)(W.Suspense,{fallback:(0,K.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,K.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,K.jsx)(Ma,{onComplete:()=>{t.invalidateQueries({queryKey:G}),e({to:`/`})}})})}var Pa=m(`/onboarding`)({component:Na});function Fa(e){let[t,n]=(0,W.useState)(()=>Ia(e)),r=(0,W.useRef)(null);return(0,W.useEffect)(()=>{if(!e){n(null);return}let t=()=>n(Ia(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 Ia(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 La={bug:`badge-error`,feature:`badge-primary`,refactor:`badge-warning`,docs:`badge-info`,chore:`badge-secondary`},Ra={Planning:`border-l-info`,PendingApproval:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Reviewing:`border-l-secondary`,PendingDecision:`border-l-success/60`,Blocked:`border-l-error`,Approved:`border-l-success`,Merged:`border-l-success`,Cancelled:`border-l-neutral`};function za(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ba(e){if(!e)return null;let t=e.match(/\d+$/);return t?t[0]:null}function Va(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 Ha(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:Va(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 Ua(e){return e?e.reviewer?.totalTokens>0?`reviewing`:e.executor?.totalTokens>0?`executing`:e.planner?.totalTokens>0?`planning`:null:null}function Wa(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 Ga(e){return e.state===`Reviewing`?e.updatedAt:e.state===`PendingDecision`?e.completedAt||e.updatedAt:e.state===`Blocked`?e.updatedAt:null}function Ka(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:Y,spin:!0,pulse:!1,color:`text-info`}:e.plan?{label:`Plan ready`,Icon:Cn,spin:!1,pulse:!1,color:`text-info/60`}:e.planningError?{label:`Plan failed`,Icon:X,spin:!1,pulse:!1,color:`text-error`}:{label:`Aguardando…`,Icon:Kt,spin:!1,pulse:!0,color:`text-info/50`};case`PendingApproval`:return null;case`Queued`:return r?{label:`Starting…`,Icon:Ln,spin:!1,pulse:!0,color:`text-primary/80`}:{label:`In queue`,Icon:Tn,spin:!1,pulse:!1,color:`text-base-content/40`};case`Running`:{let e=Ua(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning…`,Icon:Y,spin:!0,pulse:!1,color:`text-primary`}:t?e===`reviewing`?{label:`Reviewing…`,Icon:tn,spin:!1,pulse:!0,color:`text-secondary`}:e===`planning`?{label:`Planning…`,Icon:Cn,spin:!1,pulse:!0,color:`text-info`}:{label:`Working…`,Icon:Ln,spin:!1,pulse:!0,color:`text-primary`}:{label:`Starting…`,Icon:Y,spin:!0,pulse:!1,color:`text-primary`}}case`Reviewing`:case`PendingDecision`:case`Blocked`:return`stall`;default:return null}}function qa(e){let[t,n]=(0,W.useState)(()=>e?Math.max(0,Date.now()-new Date(e).getTime()):0);return(0,W.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 Ja({issue:e}){let t=Ka(e),n=Ga(e),r=qa(t===`stall`?n:null),i=Fa(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===`PendingDecision`?`text-success/70`:`text-secondary/70`,i=e.state===`Blocked`?`blocked`:e.state===`PendingDecision`?`review complete`:`reviewing`;return(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] font-medium ${t}`,children:[(0,K.jsx)(Kt,{size:10,className:`shrink-0`}),(0,K.jsx)(`span`,{className:`tabular-nums font-mono`,children:Wa(r)}),(0,K.jsxs)(`span`,{className:`opacity-60 font-normal`,children:[`· `,i]})]})}let{label:a,Icon:o,spin:s,pulse:c,color:l}=t;return(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] ${l}`,children:[o&&(0,K.jsx)(o,{size:10,className:[s?`animate-spin`:``,c?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,K.jsx)(`span`,{className:`font-medium truncate`,children:a}),i&&(0,K.jsx)(`span`,{className:`font-mono opacity-50 tabular-nums shrink-0 ml-0.5`,children:i})]})}function Ya({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===`Approved`||e.state===`Merged`,u=e.state===`Merged`,d=e.state===`Cancelled`,f=e.state===`Blocked`,p=e.planningStatus===`planning`,m=!!e.mergedAt,h=e.mergeResult?.conflicts>0,g=!m&&!u&&!h&&!!e.branchName&&e.state===`Approved`,_=(0,W.useRef)(e.tokenUsage?.totalTokens),[v,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(!1),S=(0,W.useRef)(e.state);(0,W.useEffect)(()=>{let t=e.tokenUsage?.totalTokens;if(t!=null&&t!==_.current){y(!0);let e=setTimeout(()=>y(!1),300);return _.current=t,()=>clearTimeout(e)}},[e.tokenUsage?.totalTokens]),(0,W.useEffect)(()=>{if(S.current!==`Merged`&&e.state===`Merged`||S.current!==`Approved`&&e.state===`Approved`){x(!0);let t=setTimeout(()=>x(!1),800);return S.current=e.state,()=>clearTimeout(t)}S.current=e.state},[e.state]);let C=Ba(e.identifier),w=za(e.tokenUsage?.totalTokens||0),T=e.history?.length||0,E=Ha(e.tokensByPhase,e.effort),D=n=>{if(n.shiftKey){n.preventDefault(),a?.(e.id);return}if(o){n.preventDefault(),a?.(e.id);return}t?.(e)},O=n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),n.shiftKey||o?a?.(e.id):t?.(e))};return(0,K.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`,Ra[e.state]||``,c?`animate-pulse-soft-border`:``,s?`animate-pulse-border`:``,l?`opacity-70`:``,d?`opacity-45`:``,f?`issue-card-blocked`:``,!l&&!d?`card-interactive`:``,`cursor-pointer`,r?`kanban-card-source-opacity`:``,b?`issue-card-done-flash`:``].filter(Boolean).join(` `),style:{overflow:`hidden`},role:`button`,tabIndex:0,onClick:D,onKeyDown:O,"aria-label":`${i?`Deselect`:`Open`} issue ${e.identifier}`,"aria-selected":i,...n||{},children:[C&&(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`absolute right-0 bottom-0 select-none pointer-events-none font-black leading-none`,style:{fontSize:C.length<=2?`5rem`:C.length<=4?`3.75rem`:`2.75rem`,opacity:d?.12:l?.09:.055,lineHeight:.82,paddingRight:`2px`},children:C}),(i||o)&&(0,K.jsx)(`div`,{className:`absolute top-1.5 left-1.5 z-10`,children:(0,K.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,K.jsx)(Qn,{size:14})})}),(0,K.jsxs)(`div`,{className:`card-body gap-1 p-3 relative`,children:[(0,K.jsx)(`div`,{className:o?`pl-5`:``,children:(0,K.jsx)(Ja,{issue:e})}),(0,K.jsx)(`h3`,{className:[`font-semibold text-sm leading-snug`,d?`line-through opacity-40`:``].filter(Boolean).join(` `),children:e.title}),E.length>0&&(0,K.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-35 truncate`,children:E.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 shrink-0`,children:[e.label&&(0,K.jsx)(`span`,{className:`opacity-50 uppercase tracking-wide`,style:{fontSize:`8px`},children:e.label}),(0,K.jsx)(`span`,{children:e.model}),e.effort&&(0,K.jsxs)(`span`,{className:`opacity-60`,children:[`·`,e.effort]})]},e.label??`single`))}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-40 mt-0.5`,children:[e.issueType&&La[e.issueType]&&(0,K.jsx)(`span`,{className:`badge badge-xs ${La[e.issueType]} badge-soft shrink-0`,children:e.issueType}),e.planVersion>1&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-info badge-soft shrink-0 font-mono`,children:[`v`,e.planVersion]}),w&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 ${v?`animate-count-bump`:``}`,children:[(0,K.jsx)(pr,{size:9}),w]}),T>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,K.jsx)(St,{size:9}),T]}),(0,K.jsx)(`span`,{className:`shrink-0`,children:H(e.createdAt)}),h&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-error font-semibold ml-auto shrink-0 opacity-100`,children:[(0,K.jsx)(Ut,{size:10}),`merge failed`]}),g&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-semibold ml-auto shrink-0 opacity-100 animate-pulse`,children:[(0,K.jsx)(fn,{size:10}),`ready to merge`]}),m&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-success font-semibold ml-auto shrink-0 opacity-100`,children:[(0,K.jsx)(q,{size:10}),`merged`]})]})]}),s&&(0,K.jsx)(`div`,{className:`issue-heartbeat-bar animate-pulse-soft`}),p&&(0,K.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-info animate-pulse-soft`}),c&&!p&&!e.plan&&!e.planningError&&(0,K.jsx)(`div`,{className:`h-[2px] rounded-b-[var(--rounded-box,1rem)] bg-info/20 animate-pulse`}),h&&(0,K.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-error animate-pulse`}),g&&(0,K.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-warning animate-pulse-soft`}),m&&(0,K.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-success`})]})}function Xa({icon:e=vn,title:t=`Nothing here`,description:n=``,action:r,actionLabel:i=`Action`}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 opacity-60 animate-fade-in-up`,children:[(0,K.jsx)(e,{className:`size-12 mb-4 opacity-40`}),(0,K.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:t}),n&&(0,K.jsx)(`p`,{className:`text-sm opacity-70 text-center max-w-xs`,children:n}),r&&(0,K.jsx)(`button`,{className:`btn btn-sm btn-primary mt-4`,onClick:r,children:i})]})}var Za={Planning:[`Planning`],"Needs Approval":[`PendingApproval`,`PendingDecision`],"In Progress":[`Queued`,`Running`,`Reviewing`],Blocked:[`Blocked`],Done:[`Approved`,`Merged`,`Cancelled`]},Qa=new Set([`Planning`]),$a=new Set([`PendingApproval`,`PendingDecision`]),eo=new Set([`Queued`,`Running`,`Reviewing`]),to=new Set([`Approved`,`Merged`,`Cancelled`]);function no(e){return Qa.has(e)?`Planning`:$a.has(e)?`Needs Approval`:eo.has(e)?`In Progress`:to.has(e)?`Done`:e}function ro(e){let t=z[e];if(!t)return new Set;let n=new Set(t.map(e=>no(e)));return n.delete(no(e)),n}var io=300,ao=5;function oo({onStateChange:e}){let[t,n]=(0,W.useState)(null),r=(0,W.useRef)(null),i=(0,W.useRef)({pointerId:null,startX:0,startY:0,isDragging:!1,longPressTimer:null,longPressReady:!1,pointerType:null,issue:null,sourceColumn:null,didDrag:!1}),a=(0,W.useRef)(null),o=(0,W.useRef)(new Map);(0,W.useEffect)(()=>()=>{clearTimeout(i.current.longPressTimer)},[]);let s=(0,W.useCallback)((e,t)=>{let n=r.current;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)},[]),c=(0,W.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,W.useCallback)((e,t,r,a)=>{let o=ro(e.state);i.current.isDragging=!0,n({issueId:e.id,issue:e,sourceColumn:t,validColumns:o,overColumn:null}),s(r,a)},[s]),u=(0,W.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,W.useCallback)(n=>{if(t){if(t.validColumns.has(n)){let r=z[t.issue.state]||[],i=new Set(Za[n]||[]),a=r.find(e=>i.has(e));a&&e(t.issueId,a)}u()}},[t,e,u]),f=(0,W.useCallback)((e,t)=>{t?o.current.set(e,t):o.current.delete(e)},[]);return{dragState:t,ghostRef:r,boardRef:a,getCardHandlers:(0,W.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)},io))))}}),[l]),registerColumn:f,onBoardPointerMove:(0,W.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>ao&&!t.longPressReady){clearTimeout(t.longPressTimer),t.pointerId=null;return}if(!t.longPressReady)return}else{if(o<ao)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,W.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,W.useCallback)(()=>{u()},[u]),cancelDrag:u,shouldSuppressClick:(0,W.useCallback)(()=>i.current.didDrag||i.current.isDragging,[])}}function so({count:e,className:t}){let n=(0,W.useRef)(e),[r,i]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{if(n.current!==e){n.current=e,i(!0);let t=setTimeout(()=>i(!1),300);return()=>clearTimeout(t)}},[e]),e===0?null:(0,K.jsx)(`span`,{className:`badge badge-xs ${t} ${r?`animate-count-bump`:``}`,children:e})}var co=[`Planning`,`In Progress`,`Needs Approval`,`Blocked`,`Done`],lo=new Set([`Planning`]),uo=new Set([`PendingApproval`,`PendingDecision`]),fo=new Set([`Queued`,`Running`,`Reviewing`]),po=new Set([`Archived`]),mo={Planning:`badge-info`,"Needs Approval":`badge-warning`,"In Progress":`badge-primary`,Blocked:`badge-error`,Done:`badge-success`},ho={Planning:{borderTopColor:`color-mix(in oklab, var(--color-info) 40%, transparent)`},"Needs Approval":{borderTopColor:`color-mix(in oklab, var(--color-warning) 40%, transparent)`},"In Progress":{borderTopColor:`color-mix(in oklab, var(--color-primary) 50%, transparent)`},Blocked:{borderTopColor:`color-mix(in oklab, var(--color-error) 40%, transparent)`},Done:{borderTopColor:`color-mix(in oklab, var(--color-success) 40%, transparent)`}},go={Planning:`var(--color-info)`,"Needs Approval":`var(--color-warning)`,"In Progress":`var(--color-primary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`},_o={Planning:`var(--color-info)`,"Needs Approval":`var(--color-warning)`,"In Progress":`var(--color-primary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`},vo={Planning:{icon:Cn,desc:`Create an issue to start planning`},"Needs Approval":{icon:tn,desc:`Issues waiting for your approval`},"In Progress":{icon:Ln,desc:`Issues move here when agents start`},Blocked:{icon:X,desc:`Needs attention`},Done:{icon:zt,desc:`Completed`}},yo={Planning:`AI is generating the execution plan.
|
|
46
|
+
States: Planning`,"Needs Approval":`Waiting for your decision — approve, rework, or replan.
|
|
47
|
+
States: PendingApproval, PendingDecision`,"In Progress":`AI agents are working — executing or reviewing code.
|
|
48
|
+
States: Queued, Running, Reviewing`,Blocked:`Failed or stale — needs retry or manual intervention.
|
|
49
|
+
States: Blocked`,Done:`Completed — ready to merge or already merged.
|
|
50
|
+
States: Approved, Merged, Cancelled`};function bo({delay:e=0}){return(0,K.jsx)(`div`,{className:`skeleton-card h-20 w-full rounded-lg`,style:{animationDelay:`${e}ms`}})}function xo({dragState:e,ghostRef:t}){if(!e)return null;let{issue:n}=e;return(0,K.jsx)(`div`,{ref:t,className:`drag-ghost`,"aria-hidden":`true`,children:(0,K.jsxs)(`div`,{className:`card card-compact bg-base-100 border border-primary border-l-[3px] shadow-2xl p-3 w-56`,children:[(0,K.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:n.identifier}),(0,K.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:n.title})]})})}function So({onCreateIssue:e}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 px-3 animate-fade-in-up`,children:[(0,K.jsx)(`div`,{className:`bg-primary/10 rounded-full p-4 mb-3 animate-pulse-soft`,children:(0,K.jsx)(Cn,{className:`size-8 text-primary`})}),(0,K.jsx)(`h3`,{className:`text-sm font-semibold mb-1`,children:`Start here`}),(0,K.jsx)(`p`,{className:`text-xs opacity-50 text-center mb-3`,children:`Create your first issue to begin`}),e&&(0,K.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:e,children:[(0,K.jsx)(Rn,{className:`size-3.5`}),`New Issue`]})]})}function Co({issue:e,onClose:t,onStateChange:n,onSelect:r}){let i=ee(e.state).filter(t=>t!==e.state);return(0,W.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50 animate-fade-in`,onClick:t}),(0,K.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,K.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,K.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,K.jsxs)(`div`,{className:`px-4 py-2 border-b border-base-300`,children:[(0,K.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,K.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,K.jsxs)(`div`,{className:`p-3 space-y-1`,children:[(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{r(e),t()},children:[(0,K.jsx)(tn,{className:`size-4`}),` View Details`]}),i.length>0&&(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide opacity-40 px-3 pt-2`,children:`Move to`}),i.map(r=>(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{n(e.id,r),t()},children:[(0,K.jsx)(wt,{className:`size-4`}),` `,r]},r))]}),(0,K.jsx)(`div`,{className:`p-3 pt-0`,children:(0,K.jsx)(`button`,{className:`btn btn-ghost btn-sm w-full`,onClick:t,children:`Cancel`})})]})]})}function wo({columns:e,activeIndex:t}){return(0,K.jsx)(`div`,{className:`kanban-dots md:hidden`,children:e.map((e,n)=>(0,K.jsx)(`div`,{className:`kanban-dot ${n===t?`active`:``}`,style:{backgroundColor:_o[e]}},e))})}function To({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,focusedIssueId:g}){let _=(0,W.useRef)(null);(0,W.useEffect)(()=>(a(e,_.current),()=>a(e,null)),[e,a]);let v=i!=null,y=i?.overColumn===e,b=i?.sourceColumn===e,x=i?.validColumns?.has(e)??!1,S=v&&!x&&!b,C=t.length===0,w=C&&e!==`Planning`&&d===0,T=t,E=`kanban-column bg-base-200 rounded-box p-3 flex flex-col min-h-0 overflow-hidden`;w&&(E+=` kanban-column-collapsed`),v&&(y&&x?E+=` kanban-column-drop-valid`:y&&!x?E+=` kanban-column-drop-invalid`:S&&(E+=` kanban-column-dimmed`));let D={borderTop:`3px solid transparent`,...ho[e]||{},...w?{alignSelf:`start`}:{}};return(0,K.jsxs)(`div`,{ref:_,className:E,style:D,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,K.jsxs)(`h3`,{className:`text-xs font-semibold tracking-wide flex items-center gap-1.5`,style:{color:go[e],fontFamily:`'Space Grotesk', system-ui, sans-serif`},children:[e,e===`In Progress`&&u&&(0,K.jsx)(`span`,{className:`issue-phase-dot`,title:`Agents working`}),yo[e]&&(0,K.jsx)(`div`,{className:`lg:tooltip lg:tooltip-bottom`,"data-tip":yo[e],children:(0,K.jsx)(yn,{className:`size-3 opacity-30 hover:opacity-60 transition-opacity cursor-help`})})]}),(0,K.jsx)(so,{count:t.length,className:r})]}),!w&&(0,K.jsx)(`div`,{className:`space-y-2 flex-1 overflow-y-auto kanban-card-list`,children:C?y&&x?(0,K.jsx)(`div`,{className:`kanban-drop-placeholder`}):e===`Planning`&&d===0?(0,K.jsx)(So,{onCreateIssue:c}):(0,K.jsxs)(`div`,{className:`flex flex-col items-center py-6 opacity-30`,children:[(0,K.jsx)(n.icon,{className:`size-5 mb-1`}),(0,K.jsx)(`span`,{className:`text-[10px]`,children:n.desc})]}):(0,K.jsxs)(`div`,{className:`stagger-children space-y-2`,children:[e===`Done`?(0,K.jsx)(K.Fragment,{children:(()=>{let t=T.filter(e=>e.state===`Approved`),n=T.filter(e=>e.state===`Merged`),r=T.filter(e=>e.state===`Cancelled`),a=t=>{let n=i?.issueId===t.id,r=l===t.id,a=g===t.id;return(0,K.jsx)(`div`,{"data-issue-id":t.id,className:`${n?`kanban-card-dragging-source`:``} ${r?`animate-pop`:``} ${a?`ring-2 ring-primary/50 rounded-lg`:``}`,onContextMenu:e=>{`ontouchstart`in window&&(e.preventDefault(),f?.(t))},children:(0,K.jsx)(Ya,{issue:t,onSelect:s,dragHandlers:o(t,e),isDragging:n,isSelected:p?.has(t.id),onToggleSelect:m,hasSelection:h})},t.id)};return(0,K.jsxs)(K.Fragment,{children:[t.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-40 font-semibold px-1`,children:`Ready to Ship`}),t.map(a)]}),n.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-40 font-semibold px-1 mt-2`,children:`Shipped`}),n.map(e=>(0,K.jsx)(`div`,{className:`opacity-60`,children:a(e)},e.id))]}),r.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-40 font-semibold px-1 mt-2`,children:`Cancelled`}),r.map(e=>(0,K.jsx)(`div`,{className:`opacity-40`,children:a(e)},e.id))]})]})})()}):T.map(t=>{let n=i?.issueId===t.id,r=l===t.id,a=g===t.id;return(0,K.jsx)(`div`,{"data-issue-id":t.id,className:`${n?`kanban-card-dragging-source`:``} ${r?`animate-pop`:``} ${a?`ring-2 ring-primary/50 rounded-lg`:``}`,onContextMenu:e=>{`ontouchstart`in window&&(e.preventDefault(),f?.(t))},children:(0,K.jsx)(Ya,{issue:t,onSelect:s,dragHandlers:o(t,e),isDragging:n,isSelected:p?.has(t.id),onToggleSelect:m,hasSelection:h})},t.id)}),y&&x&&(0,K.jsx)(`div`,{className:`kanban-drop-placeholder`})]})})]},e)}function Eo(e,t){let n=t.filter(t=>e.has(t.id));if(n.length===0)return[];let r=n.map(e=>{let t=ee(e.state);return new Set(t.filter(t=>t!==e.state))});return[...r[0]].filter(e=>r.every(t=>t.has(e)))}function Do({count:e,transitions:t,onBulkAction:n,onClear:r}){return(0,K.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,K.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:t.map(e=>(0,K.jsxs)(`button`,{className:`btn btn-sm btn-outline gap-1`,onClick:()=>n(e),children:[(0,K.jsx)(wt,{className:`size-3`}),e]},e))}),(0,K.jsx)(`div`,{className:`divider divider-horizontal mx-0`}),(0,K.jsxs)(`span`,{className:`text-sm font-medium whitespace-nowrap opacity-70`,children:[e,` selected`]}),(0,K.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:r,"aria-label":`Clear selection`,children:(0,K.jsx)(fr,{className:`size-4`})})]})}function Oo({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,onCreateIssue:a,isLoading:o}){let[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(0),[d,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(()=>new Set),h=(0,W.useRef)(null),[g,_]=(0,W.useState)(-1),[v,y]=(0,W.useState)(-1),b=p.size>0,x=(0,W.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,W.useCallback)(()=>{m(new Set)},[]);(0,W.useEffect)(()=>{if(!b)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,b]);let C=(0,W.useMemo)(()=>Eo(p,e),[p,e]),w=(0,W.useCallback)(e=>{for(let n of p)t(n,e);S()},[p,t,S]),T=(0,W.useMemo)(()=>{let t=Object.fromEntries(co.map(e=>[e,[]]));for(let n of e){if(po.has(n.state))continue;let e;e=lo.has(n.state)?`Planning`:uo.has(n.state)?`Needs Approval`:fo.has(n.state)?`In Progress`:n.state===`Blocked`?`Blocked`:`Done`,t[e].push(n)}for(let e of co)t[e].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime());for(let e of co)t[e].sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt));return t},[e]),E=(0,W.useMemo)(()=>e.some(e=>e.state===`Running`),[e]),D=(0,W.useCallback)((e,n)=>{c(e);let r=setTimeout(()=>c(null),400);return t(e,n),()=>clearTimeout(r)},[t]),{dragState:O,ghostRef:k,getCardHandlers:A,registerColumn:j,onBoardPointerMove:M,onBoardPointerUp:N,onBoardPointerCancel:P,shouldSuppressClick:F}=oo({onStateChange:D}),I=(0,W.useCallback)(e=>{F()||i?.(e)},[i,F]);(0,W.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,W.useRef)(null);let ee=(0,W.useCallback)(e=>{f(e)},[]),{selectedIssue:te}=bt(),L=!te,R=(0,W.useRef)(T);R.current=T;let z=(0,W.useCallback)(e=>{_(e),y(0);let t=h.current;t&&(t.querySelector(`[class*='grid']`)?.children[e])?.scrollIntoView({behavior:`smooth`,inline:`center`,block:`nearest`})},[]),B=(0,W.useCallback)(e=>{if(g<0){_(0),y(0);return}let t=co[g],n=R.current[t]||[];y(t=>Math.max(0,Math.min(t+e,n.length-1)))},[g]),V=(0,W.useCallback)(()=>{if(g<0||v<0)return;let e=R.current[co[g]]||[];e[v]&&i?.(e[v])},[g,v,i]);return $(`1`,()=>z(0),{enabled:L,description:`Planning column`,metadata:{group:`kanban`}},[z,L]),$(`2`,()=>z(1),{enabled:L,description:`In Progress column`,metadata:{group:`kanban`}},[z,L]),$(`3`,()=>z(2),{enabled:L,description:`Needs Approval column`,metadata:{group:`kanban`}},[z,L]),$(`4`,()=>z(3),{enabled:L,description:`Blocked column`,metadata:{group:`kanban`}},[z,L]),$(`5`,()=>z(4),{enabled:L,description:`Done column`,metadata:{group:`kanban`}},[z,L]),$(`j`,()=>B(1),{enabled:L,description:`Next card`,metadata:{group:`kanban`}},[B,L]),$(`k`,()=>B(-1),{enabled:L,description:`Previous card`,metadata:{group:`kanban`}},[B,L]),$(`enter`,V,{enabled:L&&v>=0,description:`Open card`,metadata:{group:`kanban`}},[V,L,v]),$(`escape`,()=>{b?S():(_(-1),y(-1))},{enabled:(b||g>=0)&&L,description:`Clear selection / focus`,metadata:{group:`kanban`}},[b,S,g,L]),(0,W.useEffect)(()=>{if(g<0||v<0)return;let e=h.current;e&&(e.querySelector(`[class*='grid']`)?.children[g]?.querySelectorAll(`[data-issue-id]`))?.[v]?.scrollIntoView({behavior:`smooth`,block:`nearest`})},[g,v]),o?(0,K.jsx)(`div`,{className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,children:(0,K.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children`,style:{gridTemplateColumns:`repeat(${co.length}, minmax(0, 1fr))`,minWidth:`${co.length*200}px`},children:co.map((e,t)=>(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex flex-col gap-2`,children:[(0,K.jsx)(`div`,{className:`skeleton-line h-4 w-20 mb-2`}),(0,K.jsx)(bo,{delay:t*80}),(0,K.jsx)(bo,{delay:t*80+120}),t<2&&(0,K.jsx)(bo,{delay:t*80+240})]},e))})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{ref:h,className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,onPointerMove:M,onPointerUp:N,onPointerCancel:P,style:{touchAction:O?`none`:void 0},children:[(0,K.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children ${O?`kanban-dragging`:``}`,style:{gridTemplateColumns:`repeat(${co.length}, minmax(0, 1fr))`,minWidth:`${co.length*200}px`},children:co.map((t,n)=>{let r=T[t],i=g===n&&v>=0&&v<r.length?r[v]?.id:null;return(0,K.jsx)(To,{col:t,issues:r,empty:vo[t],badgeClass:mo[t],dragState:O,registerColumn:j,getCardHandlers:A,onSelect:I,onCreateIssue:a,lastDroppedId:s,hasRunningAgents:E,totalIssues:e.length,onLongPress:ee,selectedIds:p,onToggleSelect:x,hasSelection:b,focusedIssueId:i},t)})}),(0,K.jsx)(xo,{dragState:O,ghostRef:k})]}),(0,K.jsx)(wo,{columns:co,activeIndex:l}),d&&(0,K.jsx)(Co,{issue:d,onClose:()=>f(null),onStateChange:D,onSelect:I}),b&&(0,K.jsx)(Do,{count:p.size,transitions:C,onBulkAction:w,onClear:S})]})}function ko(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ao({value:e,format:t=ko,className:n=``}){let[r,i]=(0,W.useState)(()=>t(e)),a=(0,W.useRef)(e),o=(0,W.useRef)(null);return(0,W.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,K.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}function jo({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,K.jsxs)(`div`,{className:`flex items-center gap-1.5 ${o}`,children:[(0,K.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,K.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,K.jsx)(`title`,{children:`${p}: ${a>999?ko(a):a}`})},e.date||n)})}),a&&(0,K.jsxs)(`span`,{className:`text-[9px] font-mono opacity-50 shrink-0`,children:[ko(s[s.length-1]?.[r]||0),`/d`]})]})}function Mo({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,K.jsx)(`div`,{className:`flex items-center gap-1.5 ${r}`,children:(0,K.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,K.jsxs)(`g`,{children:[f>0&&(0,K.jsx)(`rect`,{x:p,y:t-f,width:l,height:f,rx:`0.5`,className:`fill-error`,opacity:m,children:(0,K.jsx)(`title`,{children:`${h}: +${r} / -${i}`})}),d>0&&(0,K.jsx)(`rect`,{x:p,y:t-u,width:l,height:d,rx:`0.5`,className:`fill-success`,opacity:m,children:(0,K.jsx)(`title`,{children:`${h}: +${r} / -${i}`})})]},e.date||n)})})})}function No(){let[e,t]=(0,W.useState)(()=>window.innerWidth<768);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Po({monthlyTokens:e,monthlyEvents:t,dailyData:n,hasDailyData:r,hasEventData:i,linesDaily:a,hasChurnData:o}){let[s,c]=(0,W.useState)(!1);return(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box animate-fade-in overflow-hidden`,children:[(0,K.jsxs)(`button`,{className:`flex items-center justify-between w-full px-4 py-2.5 text-left`,onClick:()=>c(!s),children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,K.jsx)(pr,{className:`size-3.5 text-primary`}),(0,K.jsx)(Ao,{value:e}),(0,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 font-normal ml-1`,children:`this month`})]}),t>0&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-xs opacity-50`,children:[(0,K.jsx)(St,{className:`size-3`}),t]})]}),(0,K.jsx)(Ft,{className:`size-4 opacity-40 transition-transform ${s?`rotate-180`:``}`})]}),s&&(0,K.jsxs)(`div`,{className:`px-4 pb-3 space-y-3 animate-fade-in border-t border-base-300 pt-3`,children:[r&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,K.jsx)(ir,{className:`size-2.5`}),` Tokens / day`]}),(0,K.jsx)(jo,{data:n,height:32,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`,className:`w-full`})]}),i&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,K.jsx)(St,{className:`size-2.5`}),` Events / day`]}),(0,K.jsx)(jo,{data:n,height:24,cols:14,valueKey:`events`,colorClass:`text-secondary`,className:`w-full`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,K.jsx)(q,{className:`size-2.5`}),` Lines / day`]}),(0,K.jsx)(Mo,{data:a,height:24,cols:14,className:`w-full`})]})]})]})}function Fo({issues:e=[],defaultBranch:t}){let{data:n}=He(),{data:r}=Ue({pollInterval:6e4}),i=No(),a=I(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,W.useRef)(p),[h,g]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{!m.current&&p&&(m.current=!0,g(!0))},[p]),p?i?(0,K.jsx)(Po,{monthlyTokens:s,monthlyEvents:c,dailyData:a,hasDailyData:u,hasEventData:d,linesDaily:l,hasChurnData:f}):(0,K.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,K.jsxs)(`div`,{className:`flex flex-col justify-center px-4 py-2.5`,children:[(0,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Tokens / month`}),(0,K.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5 mt-0.5`,children:[(0,K.jsx)(pr,{className:`size-3.5 text-primary shrink-0`}),(0,K.jsx)(Ao,{value:s})]})]}),u&&(0,K.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,K.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,K.jsx)(ir,{className:`size-2.5`}),` Tokens / day`]}),(0,K.jsx)(jo,{data:a,height:28,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`})]}),d&&(0,K.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,K.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,K.jsx)(St,{className:`size-2.5`}),` Events / day`]}),(0,K.jsx)(jo,{data:a,height:28,cols:14,valueKey:`events`,colorClass:`text-secondary`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,K.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,K.jsx)(q,{className:`size-2.5`}),` Lines / day`]}),(0,K.jsx)(Mo,{data:l,height:28,cols:14})]}),t&&(0,K.jsxs)(`div`,{className:`flex flex-col justify-center px-3 border-l border-base-300`,children:[(0,K.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Branch`}),(0,K.jsxs)(`span`,{className:`text-xs font-mono font-medium flex items-center gap-1 mt-0.5`,children:[(0,K.jsx)(dn,{className:`size-3 text-primary shrink-0`}),t]})]})]}):null}var Io=m(`/kanban`)({component:Lo});function Lo(){let e=bt(),{data:t}=He();return(0,K.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,K.jsx)(Fo,{metrics:e.metrics,total:e.issues.length,issues:e.issues,compact:!0,defaultBranch:e.data?.config?.defaultBranch}),(0,K.jsx)(Oo,{issues:e.filtered,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,onCreateIssue:()=>e.setIsCreateOpen(!0)})]})}function Ro(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:Y,color:`text-info`,spin:!0}:e.plan?{label:`Plan ready`,icon:Cn,color:`text-info`,spin:!1}:e.planningError?{label:`Plan failed`,icon:X,color:`text-error`,spin:!1}:{label:`Aguardando scheduler…`,icon:Kt,color:`text-info/60`,spin:!1};case`PendingApproval`:return{label:`Ready to queue`,icon:Tn,color:`text-warning/70`,spin:!1};case`Queued`:return r?{label:`Worker assigned, starting...`,icon:Ln,color:`text-primary`,spin:!1,pulse:!0}:{label:`Waiting for worker slot...`,icon:Kt,color:`text-info/70`,spin:!1};case`Running`:{let e=zo(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning agent...`,icon:Y,color:`text-primary`,spin:!0}:t?e===`Reviewing`?{label:`Agent reviewing...`,icon:tn,color:`text-secondary`,spin:!1,pulse:!0}:e===`Planning`?{label:`Agent planning...`,icon:Cn,color:`text-info`,spin:!1,pulse:!0}:{label:`Agent working...`,icon:Ln,color:`text-primary`,spin:!1,pulse:!0}:{label:`Starting agent...`,icon:Y,color:`text-primary`,spin:!0}}case`Reviewing`:return zo(o)===`Reviewing`?{label:`Review in progress...`,icon:tn,color:`text-secondary`,spin:!1,pulse:!0}:{label:`Reviewing`,icon:tn,color:`text-secondary/70`,spin:!1};case`PendingDecision`:return{label:`Review complete`,icon:tn,color:`text-success/70`,spin:!1};case`Blocked`:return{label:e.lastError?`Blocked: error`:e.blockedBy?.length?`Blocked by dependency`:`Needs attention`,icon:X,color:`text-error`,spin:!1};case`Approved`:return{label:`Approved`,icon:Bt,color:`text-success`,spin:!1};case`Merged`:return{label:`Merged`,icon:q,color:`text-success`,spin:!1};case`Cancelled`:return{label:`Cancelled`,icon:Ut,color:`text-neutral`,spin:!1};default:return{label:t,icon:null,color:`opacity-50`,spin:!1}}}function zo(e){return e?e.reviewer?.totalTokens>0?`Reviewing`:e.executor?.totalTokens>0?`Executing`:e.planner?.totalTokens>0?`Planning`:null:null}function Bo({issue:e,showElapsed:t=!0,compact:n=!1}){let r=Ro(e),i=r.icon,a=Fa([`Running`,`Queued`,`Planning`,`Reviewing`].includes(e.state)&&t?e.startedAt:null);return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs ${r.color} ${n?``:`font-medium`}`,children:[i&&(0,K.jsx)(i,{size:n?10:12,className:[r.spin?`animate-spin`:``,r.pulse?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,K.jsx)(`span`,{className:n?`truncate max-w-[120px]`:`truncate`,children:r.label}),a&&(0,K.jsx)(`span`,{className:`font-mono opacity-60 tabular-nums shrink-0`,children:a})]})}var Vo={Planning:`badge-info`,PendingApproval:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Reviewing:`badge-secondary`,PendingDecision:`badge-success`,Blocked:`badge-error`,Approved:`badge-success`,Merged:`badge-success`,Cancelled:`badge-neutral`},Ho={Planning:`border-l-info`,PendingApproval:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Reviewing:`border-l-secondary`,PendingDecision:`border-l-success`,Blocked:`border-l-error`,Approved:`border-l-success`,Merged:`border-l-success`,Cancelled:`border-l-neutral`};function Uo(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Wo({icon:e,label:t,value:n,color:r=``}){return!n&&n!==0?null:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[10px]`,title:t,children:[(0,K.jsx)(e,{className:`size-2.5 ${r||`opacity-40`}`}),(0,K.jsx)(`span`,{className:`font-mono opacity-70`,children:n})]})}function Go(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 Ko({issue:e,onSelect:t}){let n=e.state===`Running`,r=Uo(e.tokenUsage?.totalTokens),i=e.description||``,{leadTimeMs:a,cycleTimeMs:o,waitTimeMs:s}=Go(e);return e.state===`Approved`||e.state,(0,K.jsx)(`div`,{className:`card bg-base-100 border border-base-300 border-l-[3px] ${Ho[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,K.jsxs)(`div`,{className:`card-body gap-3 p-4 justify-between`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,K.jsx)(`span`,{className:`badge badge-xs ${Vo[e.state]||`badge-ghost`}`,children:e.state})]}),(0,K.jsx)(`span`,{className:`text-xs opacity-40 shrink-0`,children:H(e.updatedAt)})]}),(0,K.jsx)(`h3`,{className:`font-semibold text-sm leading-snug line-clamp-2`,children:e.title}),i&&(0,K.jsx)(`p`,{className:`text-xs opacity-50 leading-relaxed line-clamp-2 mt-1`,children:i})]}),[`Planning`,`PendingApproval`,`Queued`,`Running`,`Reviewing`,`PendingDecision`,`Blocked`].includes(e.state)&&(0,K.jsx)(`div`,{className:`pt-1`,children:(0,K.jsx)(Bo,{issue:e,showElapsed:!0})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-2 border-t border-base-200`,children:[(0,K.jsx)(Wo,{icon:gn,label:`Wait`,value:s>0?B(s):null}),(0,K.jsx)(Wo,{icon:rr,label:`Cycle`,value:o>0?B(o):null,color:`text-primary`}),(0,K.jsx)(Wo,{icon:Kt,label:`Lead`,value:a>0?B(a):null}),(0,K.jsx)(Wo,{icon:pr,label:`Tokens`,value:r,color:`text-warning`}),(0,K.jsx)(Wo,{icon:Jt,label:`Cost`,value:e.tokenUsage?.costUsd?`$${e.tokenUsage.costUsd.toFixed(2)}`:null,color:`text-secondary`}),(0,K.jsx)(Wo,{icon:Hn,label:`Attempts`,value:e.attempts>0?`${e.attempts}/${e.maxAttempts}`:null}),(0,K.jsx)(Wo,{icon:nn,label:`Files`,value:e.filesChanged||null,color:`text-info`}),e.linesAdded?(0,K.jsxs)(`span`,{className:`text-[10px] font-mono text-success`,children:[`+`,e.linesAdded]}):null,e.linesRemoved?(0,K.jsxs)(`span`,{className:`text-[10px] font-mono text-error`,children:[`-`,e.linesRemoved]}):null]})]})})}function qo({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,expanded:a=!1,focusedIndex:o=-1}){return e.length===0?(0,K.jsx)(Xa,{icon:wn,title:`No issues found`,description:`Try adjusting your search or filters, or create your first issue to get started.`}):a?(0,K.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 stagger-children`,children:e.map((e,t)=>(0,K.jsx)(`div`,{className:t===o?`ring-2 ring-primary/50 rounded-2xl`:``,children:(0,K.jsx)(Ko,{issue:e,onSelect:i})},e.id))}):(0,K.jsx)(`div`,{className:`space-y-2 stagger-children`,children:e.map((e,t)=>(0,K.jsx)(`div`,{className:t===o?`ring-2 ring-primary/50 rounded-lg`:``,children:(0,K.jsx)(Ya,{issue:e,onSelect:i})},e.id))})}var Jo=[{label:`Active`,states:[`Planning`,`PendingApproval`,`Queued`,`Running`]},{label:`Review`,states:[`Reviewing`,`PendingDecision`]},{label:`Waiting`,states:[`Blocked`,`Approved`]},{label:`Final`,states:[`Merged`,`Cancelled`]}];Jo.flatMap(e=>e.states);var Yo={Planning:`badge-info`,PendingApproval:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Reviewing:`badge-secondary`,PendingDecision:`badge-success`,Blocked:`badge-error`,Approved:`badge-success`,Merged:`badge-success`,Cancelled:`badge-neutral`},Xo=[{value:`updated`,label:`Last updated`},{value:`created`,label:`Newest first`},{value:`state`,label:`State`},{value:`tokens`,label:`Most tokens`}],Zo=[{value:`recent`,label:`Active + recent`},{value:`all`,label:`All issues`}],Qo=m(`/issues`)({component:$o});function $o(){let e=bt(),[t,n]=(0,W.useState)(!1),[r,i]=(0,W.useState)(`updated`),[a,o]=(0,W.useState)(-1),s=(0,W.useRef)(null),[c,l]=(0,W.useState)(new Set),u=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},d=e=>{l(t=>{let n=new Set(t);if(e.every(e=>n.has(e)))for(let t of e)n.delete(t);else for(let t of e)n.add(t);return n})},f=c.size>0||e.completionFilter!==`recent`||e.query.length>0,p=(e.data._totalIssues??0)-(e.issues.length??0),m={};for(let t of e.issues)m[t.state]=(m[t.state]||0)+1;let h=(0,W.useMemo)(()=>{let t=e.query.toLowerCase();return e.issues.filter(e=>!(e.state===`Archived`||c.size>0&&!c.has(e.state)||t&&!`${e.identifier} ${e.title} ${e.description||``} ${e.issueType||``}`.toLowerCase().includes(t)))},[e.issues,c,e.query]),g=(0,W.useMemo)(()=>[...h].sort((e,t)=>{switch(r){case`created`:return(t.createdAt||``).localeCompare(e.createdAt||``);case`state`:return(e.state||``).localeCompare(t.state||``);case`tokens`:return(t.tokenUsage?.totalTokens||0)-(e.tokenUsage?.totalTokens||0);default:return(t.updatedAt||t.createdAt||``).localeCompare(e.updatedAt||e.createdAt||``)}}),[h,r]),_=()=>{e.setQuery(``),l(new Set),e.setCompletionFilter(`recent`),i(`updated`)},v=!e.selectedIssue,y=(0,W.useRef)(g);y.current=g,$(`slash`,()=>s.current?.focus(),{enabled:v,preventDefault:!0,description:`Focus search`,metadata:{group:`issues`}},[v]),$(`j`,()=>o(e=>{let t=y.current.length;return t===0?-1:Math.min(e+1,t-1)}),{enabled:v,description:`Next issue`,metadata:{group:`issues`}},[v]),$(`k`,()=>o(e=>Math.max(e<=0?0:e-1,0)),{enabled:v,description:`Previous issue`,metadata:{group:`issues`}},[v]),$(`enter`,()=>{let t=y.current[a];t&&e.setSelectedIssue(t)},{enabled:v&&a>=0,description:`Open issue`,metadata:{group:`issues`}},[a,e,v]),$(`f`,()=>n(e=>!e),{enabled:v,description:`Toggle filters`,metadata:{group:`issues`}},[v]),$(`x`,_,{enabled:v,description:`Clear all filters`,metadata:{group:`issues`}},[_,v]),$(`escape`,()=>o(-1),{enabled:a>=0&&v,description:`Clear focus`,metadata:{group:`issues`}},[a,v]);let b=(c.size>0?1:0)+(e.completionFilter===`recent`?0:1),x={Planning:`To Do`,PendingApproval:`To Do`,Queued:`To Do`,Running:`In Progress`,Reviewing:`In Progress`,PendingDecision:`In Review`,Blocked:`Blocked`,Approved:`Done`,Merged:`Done`,Cancelled:`Cancelled`},S={bug:`Bug`,feature:`Story`,refactor:`Task`,docs:`Task`,chore:`Task`},C=(0,W.useCallback)(()=>{let e=e=>{let t=String(e??``).replace(/"/g,`""`);return t.includes(`,`)||t.includes(`"`)||t.includes(`
|
|
51
|
+
`)?`"${t}"`:t},t=[`Summary`,`Issue Type`,`Status`,`Description`,`Created`,`Updated`],n=g.map(t=>[e(t.title),e(S[t.issueType]||`Task`),e(x[t.state]||`To Do`),e(t.description),e(t.createdAt?.slice(0,10)),e(t.updatedAt?.slice(0,10))]),r=[t.join(`,`),...n.map(e=>e.join(`,`))].join(`
|
|
52
|
+
`),i=new Blob([r],{type:`text/csv;charset=utf-8;`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`fifony-export-${new Date().toISOString().slice(0,10)}.csv`,o.click(),URL.revokeObjectURL(a)},[g]);return(0,K.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:[(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1`,children:[(0,K.jsx)(Wn,{className:`size-4 opacity-40`}),(0,K.jsx)(`input`,{ref:s,type:`text`,className:`grow`,placeholder:`Search title, ID, type...`,value:e.query,onChange:t=>e.setQuery(t.target.value)}),e.query&&(0,K.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-circle`,onClick:()=>e.setQuery(``),children:(0,K.jsx)(fr,{className:`size-3`})})]}),(0,K.jsx)(`select`,{className:`select select-bordered select-sm w-auto`,value:r,onChange:e=>i(e.target.value),title:`Sort by`,children:Xo.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,K.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:C,title:`Export to Jira CSV`,children:(0,K.jsx)($t,{className:`size-4`})}),(0,K.jsx)(`button`,{className:`btn btn-sm btn-square ${t?`btn-primary`:`btn-ghost`}`,onClick:()=>n(!t),title:`Toggle filters`,children:(0,K.jsx)(Jn,{className:`size-4`})}),b>0&&(0,K.jsx)(`span`,{className:`badge badge-sm badge-primary`,children:b}),(0,K.jsxs)(`div`,{className:`text-xs opacity-40 shrink-0`,children:[g.length,` result`,g.length===1?``:`s`,p>0&&e.completionFilter===`recent`&&(0,K.jsxs)(`span`,{children:[` · `,p,` older hidden`]})]})]}),t&&(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 space-y-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`State`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.size>0&&(0,K.jsx)(`button`,{className:`badge badge-sm badge-ghost cursor-pointer opacity-60 hover:opacity-100`,onClick:()=>l(new Set),children:`Clear`}),Jo.map(e=>{let t=e.states.every(e=>c.has(e)),n=!t&&e.states.some(e=>c.has(e));return(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`button`,{className:`badge badge-sm cursor-pointer font-semibold transition-all ${t?`badge-primary`:n?`badge-primary badge-outline`:`badge-ghost opacity-50 hover:opacity-80`}`,onClick:()=>d(e.states),title:`Toggle all ${e.label} states`,children:e.label}),e.states.map(e=>{let t=m[e]||0;return(0,K.jsxs)(`button`,{className:`badge badge-sm gap-1 cursor-pointer transition-all ${c.has(e)?Yo[e]:`badge-outline opacity-50 hover:opacity-100`}`,onClick:()=>u(e),children:[e,t>0&&(0,K.jsx)(`span`,{className:`font-mono text-[10px]`,children:t})]},e)})]},e.label)})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Show`}),(0,K.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.completionFilter,onChange:t=>e.setCompletionFilter(t.target.value),children:Zo.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),f&&(0,K.jsx)(`div`,{className:`flex items-end`,children:(0,K.jsxs)(`button`,{className:`btn btn-sm btn-ghost gap-1`,onClick:_,children:[(0,K.jsx)(fr,{className:`size-3`}),`Clear all`]})})]})]}),!t&&f&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,K.jsx)(ln,{className:`size-3 opacity-40`}),c.size>0&&(0,K.jsxs)(`span`,{className:`badge badge-sm badge-primary gap-1`,children:[c.size,` state`,c.size>1?`s`:``,(0,K.jsx)(`button`,{className:`ml-0.5`,onClick:()=>l(new Set),children:(0,K.jsx)(fr,{className:`size-2.5`})})]}),e.completionFilter!==`recent`&&(0,K.jsxs)(`span`,{className:`badge badge-sm badge-ghost gap-1`,children:[`All issues`,(0,K.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCompletionFilter(`recent`),children:(0,K.jsx)(fr,{className:`size-2.5`})})]}),(0,K.jsx)(`button`,{className:`text-xs opacity-40 hover:opacity-100 underline`,onClick:_,children:`clear all`})]})]}),(0,K.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3`,children:(0,K.jsx)(qo,{issues:g,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,expanded:!0,focusedIndex:a})})]})}var es=m(`/analytics`)({}),ts={Queued:`badge-info`,Running:`badge-primary`,Reviewing:`badge-secondary`,PendingDecision:`badge-success`,Blocked:`badge-error`,Approved:`badge-success`,Merged:`badge-success`,Cancelled:`badge-neutral`,Planning:`badge-info`},ns={Queued:Tn,Running:Wt,Reviewing:tn,PendingDecision:tn,Blocked:X,Approved:Bt,Merged:q,Cancelled:Ut};function rs(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function is(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 as({issueId:e,issueState:t}){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(!0),o=(0,W.useRef)(null),s=(0,W.useCallback)(async()=>{try{r(await V.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);(0,W.useEffect)(()=>{s();let e=setInterval(s,2e3);return()=>clearInterval(e)},[s]),(0,W.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,K.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-xs opacity-60`,children:[n&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Kt,{className:`size-3`}),B(c)]}),(0,K.jsxs)(`span`,{children:[`Log: `,l,` KB`]}),n.agentPid&&(0,K.jsxs)(`span`,{children:[`PID `,n.agentPid]}),n.agentAlive===!1&&n.agentPid&&(0,K.jsx)(`span`,{className:`text-error`,children:`dead`})]}),(0,K.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,K.jsx)(Rt,{className:`size-3`}):(0,K.jsx)(Ft,{className:`size-3`}),(0,K.jsx)(`span`,{className:`text-[10px]`,children:i?`hide`:`output`})]})]}),i&&(0,K.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,K.jsx)(`span`,{className:`opacity-30`,children:`Waiting for output…`})})]})}function os({index:e,issue:t,total:n,workflow:r}){if(!t)return(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Wt,{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===`PendingDecision`?`border-secondary bg-secondary/5`:a?`border-info bg-info/5`:`border-primary bg-primary/5`,s=a?`plan`:t.state===`Reviewing`||t.state===`PendingDecision`?`review`:`execute`,c=r?.[s],l=a?`planner`:t.state===`Reviewing`||t.state===`PendingDecision`?`reviewer`:`executor`,u=t.tokensByPhase?.[l]?.model,d=is(u||c?.model),f=c?.provider,p=t.effort?.[l]||t.effort?.default||c?.effort;return(0,K.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,K.jsxs)(`div`,{className:`flex items-center justify-between min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[a?(0,K.jsx)(Y,{className:`size-4 animate-spin text-info shrink-0`}):(0,K.jsx)(`span`,{className:`loading loading-spinner loading-sm text-primary shrink-0`}),(0,K.jsx)(`span`,{className:`font-mono text-base font-bold truncate`,children:t.identifier}),(0,K.jsx)(`span`,{className:`badge badge-sm ${ts[t.state]||`badge-ghost`} shrink-0`,children:t.state})]}),(0,K.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,K.jsx)(`div`,{className:`text-sm font-medium`,children:t.title}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs opacity-60`,children:[(0,K.jsxs)(`span`,{children:[`Attempt `,(t.attempts||0)+1,`/`,t.maxAttempts]}),t.startedAt&&(0,K.jsxs)(`span`,{children:[`started `,H(t.startedAt)]})]}),(f||d||p)&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[f&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,K.jsx)(tr,{className:`size-2.5`}),f]}),d&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:d}),p&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:p})]}),(0,K.jsx)(as,{issueId:t.id,issueState:t.state})]})}function ss({issue:e}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,K.jsx)(ns[e.state]||Wt,{className:`size-3 opacity-40 shrink-0`}),(0,K.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,K.jsx)(`span`,{className:`truncate flex-1`,children:e.title}),(0,K.jsx)(`span`,{className:`badge badge-xs ${ts[e.state]||`badge-ghost`}`,children:e.state}),e.state===`Blocked`&&e.nextRetryAt&&(0,K.jsxs)(`span`,{className:`opacity-40 shrink-0`,children:[`retry `,H(e.nextRetryAt)]})]})}function cs({issue:e}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,K.jsx)(e.state===`Merged`?q:e.state===`Approved`?Bt:Ut,{className:`size-3 shrink-0 ${e.state===`Approved`||e.state===`Merged`?`text-success`:`text-neutral`}`}),(0,K.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,K.jsx)(`span`,{className:`truncate flex-1 opacity-70`,children:e.title}),e.durationMs&&(0,K.jsx)(`span`,{className:`opacity-40 shrink-0`,children:B(e.durationMs)}),e.completedAt&&(0,K.jsx)(`span`,{className:`opacity-40 shrink-0`,children:H(e.completedAt)})]})}function ls({running:e,queued:t,concurrency:n,totalTokensToday:r}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-3`,children:[(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`bg-primary/10 rounded-btn p-2`,children:(0,K.jsx)(ar,{className:`size-5 text-primary`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`text-2xl font-bold font-mono`,children:[e.length,(0,K.jsxs)(`span`,{className:`text-sm opacity-50`,children:[`/`,n]})]}),(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Active agents`})]})]}),(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`bg-info/10 rounded-btn p-2`,children:(0,K.jsx)(Tn,{className:`size-5 text-info`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:t.length}),(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Queued`})]})]}),(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`bg-accent/10 rounded-btn p-2`,children:(0,K.jsx)(pr,{className:`size-5 text-accent`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:rs(r)}),(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Tokens today`})]})]}),(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`bg-secondary/10 rounded-btn p-2`,children:(0,K.jsx)(un,{className:`size-5 text-secondary`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:n}),(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Max parallelism`})]})]})]})}function us({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}=Wr(),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===`PendingApproval`||e.state===`Queued`||e.state===`Blocked`&&e.nextRetryAt||e.state===`Planning`&&e.planningStatus!==`planning`),f=a.filter(e=>e.state===`Approved`||e.state===`Merged`||e.state===`Cancelled`).sort((e,t)=>(t.completedAt||``).localeCompare(e.completedAt||``)).slice(0,10),p=(0,W.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,K.jsxs)(`div`,{className:`space-y-5 min-w-0 overflow-hidden flex-1`,children:[(0,K.jsx)(ls,{running:u,queued:d,concurrency:o,totalTokensToday:p}),(0,K.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,K.jsx)(Qt,{className:`size-4 opacity-50`}),`Active Agents`]}),(0,K.jsxs)(`span`,{className:`text-xs opacity-50`,children:[u.length,`/`,o,` slots`]})]}),(0,K.jsx)(`div`,{className:`grid gap-3 min-w-0`,style:{gridTemplateColumns:`repeat(${Math.min(o,3)}, 1fr)`},children:m.map((e,t)=>(0,K.jsx)(os,{index:t,issue:e,total:o,workflow:c},t))})]}),d.length>0&&(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,K.jsx)(Tn,{className:`size-4 opacity-50`}),`Queue`,(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:d.length})]}),(0,K.jsxs)(`div`,{className:`space-y-1 stagger-children`,children:[d.slice(0,12).map(e=>(0,K.jsx)(ss,{issue:e},e.id)),d.length>12&&(0,K.jsxs)(`div`,{className:`text-xs opacity-40 pl-3`,children:[`+`,d.length-12,` more`]})]})]}),f.length>0&&(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,K.jsx)(Bt,{className:`size-4 opacity-50`}),`Recently Completed`,(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:f.length})]}),(0,K.jsx)(`div`,{className:`space-y-1 stagger-children`,children:f.map(e=>(0,K.jsx)(cs,{issue:e},e.id))})]}),u.length===0&&d.length===0&&f.length===0&&(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 animate-fade-in-up`,children:[(0,K.jsx)(`div`,{className:`bg-primary/10 rounded-full p-5 mb-4`,children:(0,K.jsx)(Qt,{className:`size-10 text-primary opacity-60`})}),(0,K.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:`No agents running`}),(0,K.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 ds=m(`/agents`)({component:fs});function fs(){let e=bt();return(0,K.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:(0,K.jsx)(us,{state:e.data,providers:e.providers.data||{},parallelism:e.parallelism.data||{},onRefresh:e.refresh,issues:e.issues})})}var ps=m(`/`)({beforeLoad:()=>{throw j({to:`/kanban`})}}),ms=m(`/settings/`)({beforeLoad:()=>{throw j({to:`/settings/project`})}}),hs=[{key:`plan`,label:`Plan`,icon:Cn,description:`Generate the execution plan`,accent:`info`},{key:`execute`,label:`Execute`,icon:Ln,description:`Implement the changes`,accent:`primary`},{key:`review`,label:`Review`,icon:tn,description:`Review the implementation`,accent:`secondary`}],gs=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`extra-high`,label:`Extra High`}],_s={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 vs({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=_s[e.accent];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`card bg-base-200 border-l-4 ${u.border} animate-fade-in`,children:(0,K.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-lg ${u.bg}`,children:(0,K.jsx)(s,{className:`size-4.5 ${u.text}`})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,K.jsx)(`span`,{className:`badge badge-xs ${u.badge} badge-outline`,children:t.provider}),o===e.key&&(0,K.jsxs)(`span`,{className:`text-xs text-success flex items-center gap-1 animate-fade-in`,children:[(0,K.jsx)(Pt,{className:`size-3`}),` saved`]})]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:e.description})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2`,children:[(0,K.jsxs)(`label`,{className:`form-control`,children:[(0,K.jsx)(`div`,{className:`label py-0.5`,children:(0,K.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Provider`})}),(0,K.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,K.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),(0,K.jsxs)(`label`,{className:`form-control`,children:[(0,K.jsx)(`div`,{className:`label py-0.5`,children:(0,K.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Model`})}),(0,K.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,K.jsx)(`option`,{value:t.model,children:t.model||`(detecting...)`}),c.map(e=>(0,K.jsxs)(`option`,{value:e.id,children:[e.label,e.tier?` — ${e.tier}`:``]},e.id))]})]}),(0,K.jsxs)(`label`,{className:`form-control`,children:[(0,K.jsx)(`div`,{className:`label py-0.5`,children:(0,K.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Effort`})}),(0,K.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.effort,onChange:e=>i({...t,effort:e.target.value}),children:gs.filter(e=>t.provider===`codex`||e.value!==`extra-high`).map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})}),!a&&(0,K.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,K.jsx)(Ct,{className:`size-4 opacity-20`})})]})}var ys=m(`/settings/workflow`)({component:bs});function bs(){let e=T(),[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)([]),[a,o]=(0,W.useState)({}),[s,c]=(0,W.useState)(!0),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),p=(0,W.useRef)(null),m=(0,W.useCallback)(t=>{e.setQueryData(G,e=>Ie(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,W.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,W.useEffect)(()=>{h()},[h]);let g=(0,W.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,W.useCallback)((e,t)=>{n(n=>{let r={...n,[e]:t};return g(r,e),r})},[g]),v=(0,W.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,W.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),s||!t?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,K.jsx)(J,{className:`size-6 animate-spin opacity-30`})}):(0,K.jsxs)(`div`,{className:`space-y-4 stagger-children`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Pipeline Workflow`}),(0,K.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`Changes are saved automatically.`})]}),(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 shrink-0`,onClick:v,disabled:d,children:[d?(0,K.jsx)(J,{className:`size-3 animate-spin`}):(0,K.jsx)(Hn,{className:`size-3`}),`Restore defaults`]})]}),(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-3 p-4`,children:[(0,K.jsx)(`h3`,{className:`card-title text-sm`,children:`Pipeline`}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Configure providers/models/effort by stage and persist directly to workflow settings.`})]})}),(0,K.jsx)(`ul`,{className:`steps steps-horizontal w-full text-xs`,children:hs.map(e=>{let t=_s[e.accent];return(0,K.jsx)(`li`,{className:`step ${t.step}`,children:e.label},e.key)})}),(0,K.jsx)(`div`,{className:`flex flex-col`,children:hs.map((e,n)=>(0,K.jsx)(vs,{stage:e,config:t[e.key],providers:r,modelsByProvider:a,onChange:t=>_(e.key,t),isLast:n===hs.length-1,saving:l===e.key||l===`all`?e.key:null},e.key))})]})}function xs(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ss(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 Cs({label:e,period:t,icon:n}){let r=t.inputTokens>0&&t.outputTokens>0;return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-base-100`,children:[(0,K.jsx)(`div`,{className:`p-2 rounded-lg bg-base-300`,children:(0,K.jsx)(n,{className:`size-4 opacity-70`})}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs opacity-60`,children:e}),(0,K.jsxs)(`div`,{className:`font-mono font-semibold text-sm`,children:[xs(t.tokensUsed),` tokens`]}),r&&(0,K.jsxs)(`div`,{className:`flex gap-3 mt-0.5`,children:[(0,K.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,K.jsx)(Ct,{className:`size-2.5`}),` `,xs(t.inputTokens)]}),(0,K.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,K.jsx)(Tt,{className:`size-2.5`}),` `,xs(t.outputTokens)]})]})]}),(0,K.jsxs)(`div`,{className:`text-right`,children:[(0,K.jsx)(`div`,{className:`text-xs opacity-60`,children:`sessions`}),(0,K.jsx)(`div`,{className:`font-mono text-sm`,children:t.sessions})]})]})}function ws({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,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,K.jsx)(`span`,{className:`opacity-60`,children:`Weekly quota`}),(0,K.jsxs)(`span`,{className:`font-mono`,children:[xs(n),` / `,xs(t)]})]}),(0,K.jsx)(`progress`,{className:`progress ${r} w-full progress-animated`,value:e,max:100}),(0,K.jsxs)(`div`,{className:`flex justify-between text-[10px] mt-1`,children:[(0,K.jsxs)(`span`,{className:`opacity-50`,children:[e,`% used`]}),(0,K.jsxs)(`span`,{className:`font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[i,`% available`]})]})]})}function Ts({nextResetAt:e,resetInfo:t}){let n=Ss(e),r=e?new Date(e):null,i=r?r.toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`}):``;return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,K.jsx)(Mt,{className:`size-3.5 opacity-50 shrink-0`}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`div`,{className:`opacity-50`,children:t}),e&&(0,K.jsxs)(`div`,{className:`font-mono font-medium mt-0.5`,children:[`Resets in `,(0,K.jsx)(`span`,{className:`text-primary`,children:n}),(0,K.jsxs)(`span`,{className:`opacity-40`,children:[` — `,i]})]})]})]})}function Es({label:e,limit:t,used:n}){if(t==null)return null;let r=Math.max(0,t-n),i=Math.max(0,100-Math.round(n/t*100));return(0,K.jsxs)(`div`,{className:`flex justify-between items-center text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`opacity-60`,children:e}),(0,K.jsxs)(`span`,{className:`font-mono font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[xs(r),` available`]})]})}function Ds({models:e,currentModel:t}){let[n,r]=(0,W.useState)(!1);return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`space-y-1`,children:(n?e:e.slice(0,4)).map(e=>(0,K.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,K.jsx)(Vt,{className:`size-3 ${e.slug===t?`text-primary`:`opacity-30`}`}),(0,K.jsx)(`span`,{className:`font-mono text-xs flex-1 truncate`,children:e.displayName||e.slug}),e.slug===t&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`active`})]},e.slug))}),e.length>4&&(0,K.jsxs)(`button`,{className:`btn btn-xs btn-ghost mt-1 w-full gap-1`,onClick:()=>r(!n),children:[n?(0,K.jsx)(Rt,{className:`size-3`}):(0,K.jsx)(Ft,{className:`size-3`}),n?`Show less`:`+${e.length-4} more`]})]})}function Os(e){return e===`global`?`Global`:e===`session`?`Session`:e.replace(/\b\w/g,e=>e.toUpperCase())}function ks(e){return e===`5h`?`5h`:e===`weekly`?`Week`:e===`daily`?`Daily`:e===`session`?`Session`:e}function As({entry:e}){Math.max(0,100-e.percentUsed);let t=e.percentUsed>=90?`progress-error`:e.percentUsed>=70?`progress-warning`:`progress-primary`;return(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex justify-between text-[10px] mb-0.5`,children:[(0,K.jsxs)(`span`,{className:`opacity-60 truncate`,children:[Os(e.scope),` · `,ks(e.period)]}),(0,K.jsxs)(`span`,{className:`font-mono shrink-0`,children:[e.percentUsed,`%`]})]}),(0,K.jsx)(`progress`,{className:`progress ${t} w-full h-1.5`,value:e.percentUsed,max:100})]})})}function js({rateLimits:e}){return!e||e.length===0?null:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:`Rate limits`}),(0,K.jsx)(`div`,{className:`space-y-2 bg-base-100 rounded-lg p-3`,children:e.map((e,t)=>(0,K.jsx)(As,{entry:e},`${e.scope}-${e.period}-${t}`))})]})}function Ms({provider:e}){let{name:t,available:n,models:r,currentModel:i,usage:a,resetInfo:o,nextResetAt:s,weeklyLimitEstimate:c,percentUsed:l,version:u,plan:d,account:f,effort:p,rateLimits:m}=e,h=t===`claude`?`Claude Code`:t===`codex`?`Codex CLI`:t,g=t===`claude`?`text-warning`:`text-info`,_=a.last5Hours??a.today;return(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Qt,{className:`size-5 ${g}`}),(0,K.jsx)(`h3`,{className:`card-title text-sm`,children:h}),u&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`v`,u]})]}),(0,K.jsx)(`span`,{className:`badge badge-sm ${n?`badge-success`:`badge-error`}`,children:n?`available`:`not found`})]}),(d||f||p)&&(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[d&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-outline gap-1`,children:[(0,K.jsx)(qn,{className:`size-2.5`}),` `,d]}),f&&(0,K.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono truncate max-w-[200px]`,children:f}),p&&(0,K.jsxs)(`span`,{className:`badge badge-xs badge-outline gap-1`,children:[(0,K.jsx)(un,{className:`size-2.5`}),` `,p]})]}),i&&(0,K.jsxs)(`div`,{className:`text-xs opacity-60`,children:[`Active model: `,(0,K.jsx)(`span`,{className:`font-mono font-medium opacity-100`,children:i})]}),(0,K.jsx)(ws,{percentUsed:l,weeklyLimit:c,weeklyUsed:a.thisWeek.tokensUsed}),(0,K.jsx)(Es,{label:`This week remaining`,limit:c,used:a.thisWeek.tokensUsed}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50`,children:`Token usage`}),(0,K.jsx)(Cs,{label:`Last 5h`,period:_,icon:Kt}),(0,K.jsx)(Cs,{label:`Today`,period:a.today,icon:pr}),(0,K.jsx)(Cs,{label:`This week`,period:a.thisWeek,icon:hn}),(0,K.jsx)(Cs,{label:`All time`,period:a.allTime,icon:Kt})]}),(0,K.jsx)(js,{rateLimits:m}),(0,K.jsx)(Ts,{nextResetAt:s,resetInfo:o}),r.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:[`Available Models (`,r.length,`)`]}),(0,K.jsx)(Ds,{models:r,currentModel:i})]})]})})}function Ns({providersUsage:e}){let t=e?.data,n=t?.providers||[];return e?.isLoading&&!t?(0,K.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[...[,,]].map((e,t)=>(0,K.jsx)(`div`,{className:`skeleton-card h-72`,style:{animationDelay:`${t*100}ms`}},t))}):n.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 opacity-50 animate-fade-in-up`,children:[(0,K.jsx)(Qt,{className:`size-8`}),(0,K.jsx)(`p`,{className:`text-sm`,children:`No providers detected`})]}):(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 stagger-children`,children:n.map(e=>(0,K.jsx)(Ms,{provider:e},e.name))}),t?.collectedAt&&(0,K.jsxs)(`p`,{className:`text-xs opacity-40 text-center`,children:[`Last collected: `,new Date(t.collectedAt).toLocaleTimeString()]})]})}var Ps=m(`/settings/providers`)({component:Fs});function Fs(){return(0,K.jsx)(Ns,{providersUsage:be()})}var Is=new Set([`main`,`master`]),Ls=m(`/settings/project`)({component:Rs});function Rs(){let e=T(),t=Re(),n=Pe(t.data),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(`missing`),[l,u]=(0,W.useState)(`local`),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(!0),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(null),[y,b]=(0,W.useState)(``),[x,S]=(0,W.useState)(!0),[C,w]=(0,W.useState)(!1),[E,D]=(0,W.useState)(``),[O,k]=(0,W.useState)(!1),[A,j]=(0,W.useState)(null),[M,N]=(0,W.useState)(null),[P,F]=(0,W.useState)(!1),[I,ee]=(0,W.useState)(null),[te,L]=(0,W.useState)(!1),[R,z]=(0,W.useState)(!1),[B,H]=(0,W.useState)(!1),[U,ne]=(0,W.useState)(!1),[re,ie]=(0,W.useState)(``),ae=(0,W.useRef)(null),oe=mt(dt(a)||ae.current?.detectedProjectName||ae.current?.projectName),se=(0,W.useCallback)((t,n,r)=>{e.setQueryData(G,e=>Ie(e,{id:t,scope:r,value:n,source:`user`,updatedAt:new Date().toISOString()}))},[e]);(0,W.useEffect)(()=>{S(!0),Promise.allSettled([V.get(`/state`),V.get(`/git/status`)]).then(([e,t])=>{let n=e.status===`fulfilled`?e.value:null;if(n&&typeof n==`object`){ae.current=n;let e=dt(n.detectedProjectName||``);!y&&(n.config?.defaultBranch||e)&&b(n.config?.defaultBranch||e)}t.status===`fulfilled`&&t.value&&(v(t.value),t.value.branch&&!y&&b(t.value.branch))}).finally(()=>{S(!1)})},[]),(0,W.useEffect)(()=>{if(r||t.isLoading)return;i(!0);let e=Fe(n,`runtime.mergeMode`,`local`);(e===`local`||e===`push-pr`)&&u(e);let a=Fe(n,`runtime.prBaseBranch`,``);typeof a==`string`&&f(a);let s=Fe(n,`runtime.autoReviewApproval`,!0);typeof s==`boolean`&&m(s);let l=Fe(n,`runtime.testCommand`,``);typeof l==`string`&&g(l);let p=gt(n,ae.current||{});o(p.projectName||``),c(p.source),!d&&p.projectName&&f(p.detectedProjectName||y||a||``)},[n,t.isLoading,r]);let ce=(0,W.useCallback)(async()=>{S(!0);try{let[e,t]=await Promise.all([V.get(`/state`),V.get(`/git/status`)]);ae.current=e,e?.config?.defaultBranch&&b(e.config.defaultBranch),t&&(v(t),t.branch&&b(t.branch))}finally{S(!1)}},[]),le=(0,W.useCallback)(async()=>{let e=dt(a);if(!e){ie(`Project name cannot be empty.`);return}L(!0),ie(``);try{await V.post(`/settings/${encodeURIComponent(ut)}`,{scope:`system`,value:e,source:`user`}),se(ut,e,`system`),o(e),ie(`Project name updated.`),setTimeout(()=>ie(``),1400)}finally{L(!1)}},[a,se]),ue=(0,W.useCallback)(async()=>{z(!0),ie(``);try{await V.post(`/settings/runtime.mergeMode`,{scope:`runtime`,value:l,source:`user`}),se(`runtime.mergeMode`,l,`runtime`),await V.post(`/settings/runtime.prBaseBranch`,{scope:`runtime`,value:d.trim(),source:`user`}),se(`runtime.prBaseBranch`,d.trim(),`runtime`),await V.post(`/settings/runtime.autoReviewApproval`,{scope:`runtime`,value:p,source:`user`}),se(`runtime.autoReviewApproval`,p,`runtime`),ie(`Delivery settings updated.`),setTimeout(()=>ie(``),1400)}finally{z(!1)}},[p,l,d,se]),de=(0,W.useCallback)(async()=>{H(!0),ie(``);try{await V.post(`/settings/runtime.testCommand`,{scope:`runtime`,value:h.trim(),source:`user`}),se(`runtime.testCommand`,h.trim(),`runtime`),ie(`Validation command updated.`),setTimeout(()=>ie(``),1400)}finally{H(!1)}},[h,se]),fe=(0,W.useCallback)(()=>{w(!0),D(y||``),j(null),N(null)},[y]),pe=(0,W.useCallback)(async()=>{let e=E.trim();if(!(!(/^[a-zA-Z0-9/_.-]+$/.test(e)&&e.length>0)||e===y)){k(!0),ne(!0),j(null);try{let t=await V.post(`/git/switch`,{branchName:e});if(!t?.ok)throw Error(t?.error||`Failed to switch branch.`);b(e),N({branch:e,created:!!t.created}),w(!1),ne(!1),!d&&l===`push-pr`&&f(e),l||u(`local`),await ce(),!l&&d===``&&f(e)}catch(e){j(e instanceof Error?e.message:String(e)),ne(!1)}finally{k(!1)}}},[E,y,l,d,ce]),me=(0,W.useCallback)(async()=>{F(!0),ee(null);try{let e=await V.post(`/git/init`,{});if(!e?.ok)throw Error(e?.error||`Failed to initialize git.`);await ce()}catch(e){ee(e instanceof Error?e.message:String(e))}finally{F(!1)}},[ce]),he=_===null||_.isGit,ge=_?.hasCommits===!0,_e=y&&Is.has(y);return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(sn,{className:`size-4 opacity-50`}),(0,K.jsx)(`h2`,{className:`card-title text-sm`,children:`Project settings`})]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Match your workspace identity and queue naming.`}),(0,K.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,K.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`Project name`}),(0,K.jsx)(`input`,{type:`text`,className:`input input-bordered w-full`,value:a,onChange:e=>o(e.target.value),placeholder:`Project name`})]}),(0,K.jsxs)(`div`,{className:`rounded-xl border border-base-300/70 bg-base-100 px-4 py-3`,children:[(0,K.jsx)(`div`,{className:`text-xs uppercase tracking-[0.2em] text-base-content/40`,children:`Queue title preview`}),(0,K.jsx)(`div`,{className:`mt-1.5 text-base font-semibold tracking-tight break-words`,children:oe||`fifony`})]}),(0,K.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,K.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:le,disabled:te||!dt(a),children:te?(0,K.jsx)(J,{className:`size-3 animate-spin`}):`Save project name`}),(0,K.jsxs)(`span`,{className:`text-xs opacity-50`,children:[`Source: `,s]})]})]})}),(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(zn,{className:`size-4 opacity-50`}),(0,K.jsx)(`h2`,{className:`card-title text-sm`,children:`Working branch`})]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Where issue worktrees are created from. Local operations use this branch.`}),x&&(0,K.jsxs)(`div`,{className:`text-xs text-base-content/60 flex items-center gap-2`,children:[(0,K.jsx)(J,{className:`size-3 animate-spin`}),`Loading git status...`]}),!x&&!he&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,K.jsx)(q,{className:`size-4 shrink-0`}),(0,K.jsxs)(`div`,{className:`text-sm`,children:[(0,K.jsx)(`p`,{className:`font-semibold`,children:`Not a git repository`}),(0,K.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`fifony requires git and an initial commit to create agent worktrees.`})]})]}),(0,K.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:me,disabled:P,children:[P?(0,K.jsx)(J,{className:`size-4 animate-spin`}):(0,K.jsx)(q,{className:`size-4`}),`Initialize git repository`]}),I&&(0,K.jsx)(`p`,{className:`text-xs text-error`,children:I})]}),!x&&he&&!ge&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,K.jsx)(an,{className:`size-4 shrink-0`}),(0,K.jsxs)(`div`,{className:`text-sm`,children:[(0,K.jsx)(`p`,{className:`font-semibold`,children:`Repository has no commits yet`}),(0,K.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`Create an initial commit before agent worktrees can be prepared.`})]})]}),(0,K.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:me,disabled:P,children:[P?(0,K.jsx)(J,{className:`size-4 animate-spin`}):(0,K.jsx)(q,{className:`size-4`}),`Create initial commit`]})]}),he&&(0,K.jsxs)(K.Fragment,{children:[C?(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`label`,{className:`input input-bordered flex items-center gap-2 flex-1`,children:[(0,K.jsx)(dn,{className:`size-3.5 opacity-40`}),(0,K.jsx)(`input`,{type:`text`,className:`grow font-mono text-sm`,value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&pe(),e.key===`Escape`&&w(!1)},disabled:O})]}),(0,K.jsx)(`button`,{className:`btn btn-primary`,onClick:pe,disabled:O||!E.trim(),children:O?(0,K.jsx)(J,{className:`size-3 animate-spin`}):`Switch`}),(0,K.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>w(!1),disabled:O,children:`Cancel`})]}):(0,K.jsx)(`div`,{className:`rounded-box border border-base-300 bg-base-100 px-4 py-3 cursor-pointer hover:border-primary/40 transition-colors group`,onClick:fe,role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&fe(),children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(dn,{className:`size-4 opacity-50 shrink-0`}),(0,K.jsx)(`span`,{className:`text-sm opacity-60`,children:`Current branch:`}),(0,K.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:y||`—`}),_e&&(0,K.jsx)(`span`,{className:`badge badge-warning badge-sm ml-auto shrink-0`,children:`protected`}),!C&&(0,K.jsx)(In,{className:`size-3.5 opacity-0 group-hover:opacity-40 ml-auto shrink-0 transition-opacity`})]})}),A&&(0,K.jsx)(`p`,{className:`text-xs text-error`,children:A}),M&&(0,K.jsxs)(`div`,{className:`alert alert-success py-2 text-xs`,children:[(0,K.jsx)(zt,{className:`size-3 shrink-0`}),M.created?`Branch created`:`Branch switched`,`: `,(0,K.jsx)(`span`,{className:`font-mono`,children:M.branch})]}),_e&&(0,K.jsx)(`p`,{className:`text-xs text-warning`,children:`You are on a protected branch. If needed, switch to another branch before running local merges.`})]})]})}),(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(pn,{className:`size-4 opacity-50`}),(0,K.jsx)(`h2`,{className:`card-title text-sm`,children:`Delivery mode`})]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Pick how completed issues are integrated.`}),(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsxs)(`label`,{className:`flex-1 cursor-pointer rounded-xl border-2 p-3 text-center text-sm font-medium transition-colors ${l===`local`?`border-primary bg-primary/10`:`border-base-300 bg-base-100`}`,children:[(0,K.jsx)(`input`,{type:`radio`,name:`settings-merge-mode`,className:`hidden`,checked:l===`local`,onChange:()=>u(`local`)}),(0,K.jsx)(q,{className:`size-4 mx-auto mb-1 opacity-60`}),`Local merge`]}),(0,K.jsxs)(`label`,{className:`flex-1 cursor-pointer rounded-xl border-2 p-3 text-center text-sm font-medium transition-colors ${l===`push-pr`?`border-primary bg-primary/10`:`border-base-300 bg-base-100`}`,children:[(0,K.jsx)(`input`,{type:`radio`,name:`settings-merge-mode`,className:`hidden`,checked:l===`push-pr`,onChange:()=>u(`push-pr`)}),(0,K.jsx)(pn,{className:`size-4 mx-auto mb-1 opacity-60`}),`Push PR`]})]}),l===`push-pr`&&(0,K.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,K.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`PR base branch`}),(0,K.jsx)(`input`,{type:`text`,className:`input input-bordered w-full text-sm font-mono`,placeholder:y||`main`,value:d,onChange:e=>f(e.target.value)}),(0,K.jsx)(`p`,{className:`text-xs opacity-40`,children:`Branch that PRs target.`})]}),(0,K.jsxs)(`label`,{className:`label cursor-pointer justify-start gap-3`,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:p,onChange:e=>m(e.target.checked)}),(0,K.jsx)(`span`,{className:`label-text text-sm`,children:`Automatic review approval`})]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:p?`Reviewer success marks issue done.`:`Reviewer success requires manual decision.`}),(0,K.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:ue,disabled:R,children:R?(0,K.jsx)(J,{className:`size-3 animate-spin`}):`Save delivery settings`})]})}),(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(on,{className:`size-4 opacity-50`}),(0,K.jsx)(`h2`,{className:`card-title text-sm`,children:`Validation command`})]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Runs before issue completion and merge/done.`}),(0,K.jsx)(`input`,{type:`text`,className:`input input-bordered w-full text-sm font-mono`,placeholder:`pnpm test`,value:h,onChange:e=>g(e.target.value)}),(0,K.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:de,disabled:B,children:B?(0,K.jsx)(J,{className:`size-3 animate-spin`}):`Save validation command`})]})}),re&&(0,K.jsxs)(`div`,{className:`alert alert-success py-2 text-xs`,children:[(0,K.jsx)(Kn,{className:`size-3`}),` `,re]}),(0,K.jsx)(`div`,{className:`text-xs text-base-content/40`,children:(0,K.jsx)(`p`,{children:`These settings mirror the onboarding setup. Use Workflow for pipeline, Agents for catalog installs and worker concurrency, and Preferences for theme.`})})]})}var zs=(0,W.lazy)(()=>ha(()=>import(`./OnboardingWizard-9qzUVfYb.js`),__vite__mapDeps([6,1,5,2,4]))),Bs=[`auto`,`light`,`dark`],Vs=`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(`.`),Hs=[...Bs,...Vs];function Us(e){return e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function Ws({theme:e,onThemeChange:t}){let n=Us(e),r=[`dark`,`night`,`sunset`,`black`,`synthwave`,`halloween`,`forest`,`luxury`,`dracula`,`business`,`coffee`,`dim`,`abyss`].includes(n);return(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(Nn,{className:`size-4 opacity-50`}),`Theme`]}),(0,K.jsxs)(`p`,{className:`text-xs opacity-50`,children:[`Current: `,(0,K.jsx)(`span`,{className:`font-semibold`,children:e}),e===`auto`&&(0,K.jsxs)(`span`,{children:[` (resolved to `,n,`)`]}),r?(0,K.jsx)(jn,{className:`inline size-3 ml-1`}):(0,K.jsx)(er,{className:`inline size-3 ml-1`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Hs.map(n=>(0,K.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 Gs({concurrency:e,setConcurrency:t,saveConcurrency:n,savePending:r}){return(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(Qt,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Number of parallel workers executing issues simultaneously (1–10).`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.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,K.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,disabled:r,children:r?(0,K.jsx)(`span`,{className:`loading loading-spinner loading-xs`}):`Save`})]})]})})}function Ks({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,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(zn,{className:`size-4 opacity-50`}),`Connection Status`]}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,K.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[n&&(0,K.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),(0,K.jsx)(Vt,{className:`size-5 ${i} relative`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium`,children:`API`}),(0,K.jsx)(`div`,{className:`text-xs ${i}`,children:a})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,K.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[r&&(0,K.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),r?(0,K.jsx)(lr,{className:`size-5 ${o} relative`}):(0,K.jsx)(cr,{className:`size-5 ${o} relative`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium`,children:`WebSocket`}),(0,K.jsx)(`div`,{className:`text-xs ${o}`,children:s})]})]})]})]})})}function qs({pwa:e}){let t=e?.isInstalled?`Installed`:e?.canInstall?`Installable`:`Browser-managed`;return(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(Xn,{className:`size-4 opacity-50`}),`Progressive Web App`]}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Service worker`}),(0,K.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:e?.serviceWorkerSupported?`Supported`:`Unavailable`})]}),(0,K.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Install status`}),(0,K.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:t})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:()=>e.installApp(),disabled:!e?.canInstall,children:[(0,K.jsx)($t,{className:`size-3.5`}),` Install`]}),(0,K.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1`,onClick:()=>e.applyUpdate(),disabled:!e?.updateAvailable,children:[(0,K.jsx)(Bn,{className:`size-3.5`}),` Apply update`]})]})]})})}function Js({notifications:e}){if(!e?.supported)return(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(Dt,{className:`size-4 opacity-50`}),`Notifications`]}),(0,K.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,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(Ot,{className:`size-4 opacity-50`}),`Desktop Notifications`]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Get notified when issues change state — reviews needed, agents blocked, work completed.`}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Permission`}),(0,K.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,K.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,K.jsx)(`div`,{className:`text-xs opacity-50`,children:`Status`}),(0,K.jsx)(`div`,{className:`text-sm font-medium mt-1 ${e.enabled?`text-success`:``}`,children:e.enabled?`Enabled`:`Disabled`})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&!t&&(0,K.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:e.requestPermission,children:[(0,K.jsx)(Ot,{className:`size-3.5`}),` Enable notifications`]}),n&&(0,K.jsxs)(`label`,{className:`label cursor-pointer gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm`,children:`Notify on state changes`}),(0,K.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e.enabled,onChange:t=>e.setEnabled(t.target.checked)})]}),t&&(0,K.jsx)(`p`,{className:`text-xs text-error`,children:`Notifications were denied. Reset permission in your browser settings to re-enable.`}),n&&e.enabled&&(0,K.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,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(sr,{className:`size-4 opacity-50`}),`Event Types`]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Choose which events trigger notifications.`}),Ye.map(t=>{let n=r.filter(e=>e.group===t.id);return n.length===0?null:(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold opacity-40 uppercase tracking-wider`,children:t.label}),n.map(t=>(0,K.jsxs)(`label`,{className:`flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-base-300 transition-colors cursor-pointer`,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-xs toggle-primary`,checked:t.enabled,onChange:n=>e.setEventEnabled(t.id,n.target.checked)}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsxs)(`div`,{className:`text-sm font-medium flex items-center gap-2`,children:[t.label,t.sound&&(0,K.jsx)(or,{className:`size-3 opacity-30`,title:`Plays sound`})]}),(0,K.jsx)(`div`,{className:`text-xs opacity-40`,children:t.description})]})]},t.id))]},t.id)})]})})]})}function Ys(){let[e,t]=(0,W.useState)(!1),n=T();return e?(0,K.jsx)(W.Suspense,{fallback:(0,K.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,K.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,K.jsx)(zs,{onComplete:()=>{t(!1),n.invalidateQueries({queryKey:G})}})}):(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,K.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,K.jsx)(sr,{className:`size-4 opacity-50`}),`Setup Wizard`]}),(0,K.jsx)(`p`,{className:`text-xs opacity-50`,children:`Re-run the initial setup wizard to reconfigure providers, effort level, concurrency, and theme.`}),(0,K.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(G,e=>Ie(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!1,source:`user`,updatedAt:new Date().toISOString()}))}catch{}t(!0)},children:[(0,K.jsx)(sr,{className:`size-3.5`}),` Re-run Setup Wizard`]})]})})}var Xs=m(`/settings/notifications`)({component:Zs});function Zs(){return(0,K.jsx)(`div`,{className:`space-y-5`,children:(0,K.jsx)(Js,{notifications:bt().notifications})})}var Qs=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),$s=[`palette`,`navigation`,`global`,`drawer`,`kanban`,`issues`],ec={palette:{label:`Command Palette`,icon:Xt,color:`text-primary`,badge:`badge-primary`},navigation:{label:`Navigation`,icon:mn,color:`text-info`,badge:`badge-info`},global:{label:`Global`,icon:xn,color:`text-secondary`,badge:`badge-secondary`},drawer:{label:`Issue Detail`,icon:Pn,color:`text-success`,badge:`badge-success`},kanban:{label:`Kanban Board`,icon:Yt,color:`text-warning`,badge:`badge-warning`},issues:{label:`Issues List`,icon:Dn,color:`text-error`,badge:`badge-error`}};function tc(e){return(e||``).replace(/mod/gi,Qs?`⌘`:`Ctrl`).replace(/ctrl/gi,`Ctrl`).replace(/alt/gi,`Alt`).replace(/shift/gi,`Shift`).replace(/enter/gi,`↵ Enter`).replace(/escape/gi,`Esc`).replace(/slash/gi,`/`).split(`+`)}var nc=m(`/settings/hotkeys`)({component:rc});function rc(){let{hotkeys:e}=sa(),t=(0,W.useMemo)(()=>{let t=new Map,n=new Set;for(let r of e){let e=r.description,i=r.metadata?.group;if(!e||!i)continue;let a=`${i}:${e}`;n.has(a)||(n.add(a),t.has(i)||t.set(i,[]),t.get(i).push(r))}let r=[];for(let e of $s)t.has(e)&&r.push({group:e,...ec[e],shortcuts:t.get(e)});return r},[e]),n=t.reduce((e,t)=>e+t.shortcuts.length,0);return(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h2`,{className:`text-lg font-bold flex items-center gap-2`,children:[(0,K.jsx)(xn,{className:`size-5 opacity-60`}),`Keyboard Shortcuts`]}),(0,K.jsxs)(`p`,{className:`text-sm opacity-50 mt-1`,children:[n,` shortcuts across `,t.length,` contexts. Press `,(0,K.jsx)(`kbd`,{className:`kbd kbd-xs`,children:`Shift`}),`+`,(0,K.jsx)(`kbd`,{className:`kbd kbd-xs`,children:`/`}),` anywhere to see them.`]})]}),(0,K.jsx)(`span`,{className:`badge badge-ghost font-mono text-xs`,children:Qs?`macOS`:`Linux / Windows`})]}),(0,K.jsx)(`div`,{className:`space-y-4`,children:t.map(({group:e,label:t,icon:n,color:r,badge:i,shortcuts:a})=>(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`px-5 py-3 flex items-center gap-2 border-b border-base-300`,children:[(0,K.jsx)(n,{className:`size-4 ${r}`}),(0,K.jsx)(`h3`,{className:`text-sm font-semibold`,children:t}),(0,K.jsx)(`span`,{className:`badge badge-xs ${i}`,children:a.length})]}),(0,K.jsx)(`div`,{className:`divide-y divide-base-300`,children:a.map((e,t)=>{let n=tc(e.hotkey);return(0,K.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-2.5 hover:bg-base-100/50 transition-colors`,children:[(0,K.jsx)(`span`,{className:`text-sm`,children:e.description}),(0,K.jsx)(`div`,{className:`flex items-center gap-1`,children:n.map((e,t)=>(0,K.jsxs)(`span`,{className:`flex items-center`,children:[t>0&&(0,K.jsx)(`span`,{className:`text-xs opacity-20 mx-0.5`,children:`+`}),(0,K.jsx)(`kbd`,{className:`kbd kbd-sm font-mono`,children:e.trim()})]},t))})]},t)})})]},e))}),(0,K.jsxs)(`div`,{className:`bg-base-200 rounded-box p-4 text-xs opacity-50 space-y-1`,children:[(0,K.jsxs)(`p`,{children:[`Shortcuts are context-aware. `,(0,K.jsx)(`strong`,{children:`Drawer`}),` shortcuts only work when an issue detail is open. `,(0,K.jsx)(`strong`,{children:`Kanban`}),` and `,(0,K.jsx)(`strong`,{children:`Issues`}),` shortcuts work on their respective pages.`]}),(0,K.jsxs)(`p`,{children:[`Modifier key `,(0,K.jsx)(`kbd`,{className:`kbd kbd-xs`,children:Qs?`⌘`:`Ctrl`}),` works in input fields too.`]})]})]})}var ic=m(`/settings/general`)({component:ac});function ac(){let e=bt();return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(Ks,{status:e.status,wsStatus:e.wsStatus}),(0,K.jsx)(qs,{pwa:e.pwa}),(0,K.jsx)(Ys,{}),(0,K.jsx)(Ws,{theme:e.theme,onThemeChange:e.setTheme})]})}var oc=m(`/settings/agents`)({component:uc}),sc=25;function cc({onCatalogRefresh:e}){let[t,n]=(0,W.useState)([]),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(()=>new Set),[l,u]=(0,W.useState)({}),d=(0,W.useRef)(!1),f=(0,W.useCallback)(()=>(o(``),i(!0),V.get(`/reference-repositories`).then(e=>n(e?.repositories||[])).catch(e=>{let t=e?.message||`Failed to load.`;o(t.toLowerCase().includes(`route not found`)?`Backend route not loaded. Start with --dev or run pnpm build:server.`:t)}).finally(()=>i(!1))),[]);(0,W.useEffect)(()=>{d.current||(d.current=!0,f())},[f]);let p=(0,W.useCallback)(async t=>{c(e=>new Set([...e,t])),u(e=>({...e,[t]:``}));try{let n=((await V.post(`/reference-repositories/sync`,{repository:t}))?.results||[]).find(e=>e.id===t);if(n?.action===`failed`){u(e=>({...e,[t]:n.message||`Sync failed.`}));return}await V.post(`/reference-repositories/import`,{repository:t,kind:`all`,global:!1}),await f(),u(e=>({...e,[t]:`Synced.`})),e?.()}catch(e){u(n=>({...n,[t]:e?.message||`Failed.`}))}finally{c(e=>{let n=new Set(e);return n.delete(t),n})}},[f,e]);return(0,K.jsx)(`div`,{className:`card bg-base-200`,children:(0,K.jsxs)(`div`,{className:`card-body gap-3 p-4`,children:[(0,K.jsx)(`h3`,{className:`font-semibold text-sm`,children:`Sources`}),a&&(0,K.jsx)(`div`,{className:`alert alert-warning text-xs py-1`,children:a}),r?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs opacity-60`,children:[(0,K.jsx)(J,{className:`size-3 animate-spin`}),` Loading...`]}):(0,K.jsx)(`div`,{className:`grid grid-cols-2 xl:grid-cols-4 gap-2`,children:t.map(e=>{let t=s.has(e.id),n=e?.artifactCounts??null,r=e?.present&&e?.synced;return(0,K.jsxs)(`div`,{className:`rounded-lg border border-base-300/70 bg-base-100 p-2 flex flex-col gap-1`,children:[(0,K.jsx)(`div`,{className:`font-medium text-xs truncate`,children:e.name}),r&&n?(0,K.jsxs)(`div`,{className:`text-[11px] opacity-60`,children:[n.agents,` agents · `,n.skills,` skills`]}):(0,K.jsx)(`span`,{className:`badge badge-xs badge-warning`,children:`Not synced`}),l[e.id]&&(0,K.jsx)(`p`,{className:`text-[11px] opacity-60 truncate`,children:l[e.id]}),(0,K.jsxs)(`button`,{className:`btn btn-xs btn-outline gap-1 mt-auto`,onClick:()=>p(e.id),disabled:t,children:[t?(0,K.jsx)(J,{className:`size-3 animate-spin`}):(0,K.jsx)(Bn,{className:`size-3`}),t?`Syncing…`:r?`Re-sync`:`Sync`]})]},e.id)})})]})})}function lc(){let[e,t]=(0,W.useState)([]),[n,r]=(0,W.useState)([]),[i,a]=(0,W.useState)(!0),[o,s]=(0,W.useState)(`agents`),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(1),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)([]),[g,_]=(0,W.useState)([]),[v,y]=(0,W.useState)(!1),[b,x]=(0,W.useState)(``),[S,C]=(0,W.useState)(``),w=(0,W.useCallback)(async()=>{a(!0);try{let[e,n]=await Promise.allSettled([V.get(`/catalog/agents`),V.get(`/catalog/skills`)]);t(e.status===`fulfilled`&&e.value?.agents||[]),r(n.status===`fulfilled`&&n.value?.skills||[])}catch{}a(!1)},[]);(0,W.useEffect)(()=>{w()},[w]);let T=o===`agents`?e:n,E=(0,W.useMemo)(()=>{let e=c.trim().toLowerCase();return e?T.filter(t=>[t.name,t.displayName,t.description].filter(Boolean).join(` `).toLowerCase().includes(e)):T},[T,c]),D=Math.max(1,Math.ceil(E.length/sc)),O=Math.min(u,D),k=E.slice((O-1)*sc,O*sc),A=E.length===0?0:(O-1)*sc+1,j=Math.min(O*sc,E.length);(0,W.useEffect)(()=>{d(1)},[o,c]),(0,W.useEffect)(()=>{p(null)},[o]);let M=o===`agents`?m:g,N=o===`agents`?h:_,P=m.length+g.length,F=(0,W.useMemo)(()=>f&&T.find(e=>e.name===f)||null,[f,T]),I=(0,W.useCallback)(e=>{N(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[N]),ee=(0,W.useCallback)(()=>{N(E.map(e=>e.name))},[E,N]),te=(0,W.useCallback)(()=>{N([])},[N]),L=(0,W.useCallback)(async()=>{if(m.length===0&&g.length===0)return;y(!0),x(``),C(``);let e=[];m.length>0&&e.push({label:`Agents`,run:()=>V.post(`/install/agents`,{agents:m})}),g.length>0&&e.push({label:`Skills`,run:()=>V.post(`/install/skills`,{skills:g})});try{let t=await Promise.allSettled(e.map(e=>e.run())),n=[],r=[];for(let i=0;i<e.length;i++){let a=t[i];if(a.status===`rejected`){r.push(`${e[i].label}: ${a.reason?.message||`Failed`}`);continue}let o=a.value||{};if(o.ok===!1){r.push(`${e[i].label}: ${o.error||`Failed`}`);continue}let s=[`${e[i].label}: ${o.installed?.length||0} installed`];o.skipped?.length&&s.push(`${o.skipped.length} skipped`),o.errors?.length&&s.push(`${o.errors.length} errors`),n.push(s.join(`, `))}r.length>0?C(r.join(` | `)):(x(n.join(` | `)),h([]),_([])),await w()}catch(e){C(e?.message||`Install failed.`)}finally{y(!1)}},[m,g,w]),R=(0,W.useCallback)(async e=>{let t=o===`agents`;y(!0),x(``),C(``);try{let n=t?await V.post(`/install/agents`,{agents:[e.name]}):await V.post(`/install/skills`,{skills:[e.name]});n.ok===!1?C(n.error||`Failed`):x(`${e.displayName||e.name} installed.`),await w()}catch(e){C(e?.message||`Failed.`)}finally{y(!1)}},[o,w]);return i?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,K.jsx)(J,{className:`size-6 animate-spin opacity-30`})}):(0,K.jsxs)(`div`,{className:`card bg-base-200`,children:[(0,K.jsxs)(`div`,{className:`card-body gap-0 p-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 pb-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,K.jsxs)(`div`,{className:`flex bg-base-300 rounded-lg p-0.5 text-xs font-medium`,children:[(0,K.jsxs)(`button`,{className:`px-3 py-1 rounded-md transition-colors ${o===`agents`?`bg-base-100 shadow-sm`:`opacity-60 hover:opacity-100`}`,onClick:()=>s(`agents`),children:[(0,K.jsx)(At,{className:`size-3 inline mr-1 -mt-0.5`}),`Agents (`,e.length,`)`]}),(0,K.jsxs)(`button`,{className:`px-3 py-1 rounded-md transition-colors ${o===`skills`?`bg-base-100 shadow-sm`:`opacity-60 hover:opacity-100`}`,onClick:()=>s(`skills`),children:[(0,K.jsx)(pr,{className:`size-3 inline mr-1 -mt-0.5`}),`Skills (`,n.length,`)`]})]}),(0,K.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1 min-w-[180px]`,children:[(0,K.jsx)(Wn,{className:`size-3.5 opacity-60`}),(0,K.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Search ${o}...`,value:c,onChange:e=>l(e.target.value)}),c&&(0,K.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-circle`,onClick:()=>l(``),children:(0,K.jsx)(fr,{className:`size-3`})})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 text-xs`,children:[(0,K.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:ee,disabled:E.length===0,children:`All`}),(0,K.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:te,disabled:M.length===0,children:`None`})]})]}),E.length>0&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] opacity-50`,children:[(0,K.jsxs)(`span`,{children:[A,`–`,j,` of `,E.length]}),D>1&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-square`,disabled:O<=1,onClick:()=>d(e=>Math.max(1,e-1)),children:(0,K.jsx)(It,{className:`size-3`})}),(0,K.jsxs)(`span`,{children:[O,`/`,D]}),(0,K.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-square`,disabled:O>=D,onClick:()=>d(e=>Math.min(D,e+1)),children:(0,K.jsx)(Lt,{className:`size-3`})})]})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[1fr_1.2fr] min-h-[320px] border-t border-base-300/50`,children:[(0,K.jsx)(`div`,{className:`border-r border-base-300/50 overflow-y-auto max-h-[480px]`,children:k.length===0?(0,K.jsx)(`div`,{className:`flex flex-col items-center justify-center py-12 text-xs opacity-50`,children:T.length===0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{children:[`No `,o,` in catalog.`]}),(0,K.jsx)(`p`,{className:`mt-1`,children:`Sync a source above.`})]}):(0,K.jsxs)(`p`,{children:[`No matches for "`,c,`"`]})}):k.map(e=>{let t=M.includes(e.name);return(0,K.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors border-b border-base-300/30 last:border-b-0
|
|
53
|
+
${f===e.name?`bg-primary/10`:`hover:bg-base-100/60`}
|
|
54
|
+
`,onClick:()=>p(e.name),children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-xs checkbox-primary shrink-0`,checked:t,onChange:t=>{t.stopPropagation(),I(e.name)},onClick:e=>e.stopPropagation()}),(0,K.jsx)(`span`,{className:`shrink-0`,children:e.emoji||(o===`agents`?`🤖`:`⚡`)}),(0,K.jsx)(`span`,{className:`truncate font-medium flex-1`,children:e.displayName||e.name}),e.source&&(0,K.jsx)(`span`,{className:`badge badge-ghost badge-xs shrink-0 opacity-60`,children:e.source})]},e.name)})}),(0,K.jsx)(`div`,{className:`p-4 overflow-y-auto max-h-[480px]`,children:F?(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(`span`,{className:`text-2xl`,children:F.emoji||(o===`agents`?`🤖`:`⚡`)}),(0,K.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,K.jsx)(`h4`,{className:`font-semibold text-sm`,children:F.displayName||F.name}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,K.jsx)(`span`,{className:`text-[11px] opacity-50 font-mono`,children:F.name}),F.source&&(0,K.jsx)(`span`,{className:`badge badge-ghost badge-xs`,children:F.source})]})]})]}),F.description&&(0,K.jsx)(`p`,{className:`text-xs opacity-70 leading-relaxed`,children:F.description}),F.domains?.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:F.domains.map(e=>(0,K.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[M.includes(F.name)?(0,K.jsxs)(`button`,{className:`btn btn-xs btn-outline gap-1`,onClick:()=>I(F.name),children:[(0,K.jsx)(Pt,{className:`size-3`}),` Selected`]}):(0,K.jsx)(`button`,{className:`btn btn-xs btn-primary gap-1`,onClick:()=>I(F.name),children:`Add to selection`}),(0,K.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1`,onClick:()=>R(F),disabled:v,children:[(0,K.jsx)($t,{className:`size-3`}),`Install now`]})]})]}):(0,K.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full text-xs opacity-40`,children:(0,K.jsx)(`p`,{children:`Select an item to view details`})})})]}),D>1&&(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-2 p-2 border-t border-base-300/50 text-xs`,children:[(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,disabled:O<=1,onClick:()=>d(e=>Math.max(1,e-1)),children:[(0,K.jsx)(It,{className:`size-3`}),` Prev`]}),(0,K.jsxs)(`span`,{className:`opacity-50`,children:[O,` of `,D]}),(0,K.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,disabled:O>=D,onClick:()=>d(e=>Math.min(D,e+1)),children:[`Next `,(0,K.jsx)(Lt,{className:`size-3`})]})]}),(b||S)&&(0,K.jsxs)(`div`,{className:`px-4 pb-3`,children:[b&&(0,K.jsx)(`p`,{className:`text-xs text-success`,children:b}),S&&(0,K.jsx)(`p`,{className:`text-xs text-error`,children:S})]})]}),P>0&&(0,K.jsxs)(`div`,{className:`sticky bottom-0 bg-base-300 border-t border-base-content/10 px-4 py-2 flex items-center justify-between rounded-b-2xl`,children:[(0,K.jsxs)(`span`,{className:`text-xs opacity-70`,children:[m.length>0&&`${m.length} agent${m.length>1?`s`:``}`,m.length>0&&g.length>0&&`, `,g.length>0&&`${g.length} skill${g.length>1?`s`:``}`,` `,`selected`]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:()=>{h([]),_([])},children:`Clear`}),(0,K.jsxs)(`button`,{className:`btn btn-xs btn-primary gap-1`,onClick:L,disabled:v,children:[v?(0,K.jsx)(J,{className:`size-3 animate-spin`}):(0,K.jsx)(zt,{className:`size-3`}),v?`Installing…`:`Install selected`]})]})]})]})}function uc(){let e=bt(),[t,n]=(0,W.useState)(0);return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(Gs,{concurrency:e.concurrency,setConcurrency:e.setConcurrency,saveConcurrency:e.saveConcurrency,savePending:e.saveConcPending}),(0,K.jsx)(cc,{onCatalogRefresh:()=>n(e=>e+1)}),(0,K.jsx)(lc,{},t)]})}var dc=Aa.update({id:`/settings`,path:`/settings`,getParentRoute:()=>Oa}),fc=Pa.update({id:`/onboarding`,path:`/onboarding`,getParentRoute:()=>Oa}),pc=Io.update({id:`/kanban`,path:`/kanban`,getParentRoute:()=>Oa}),mc=Qo.update({id:`/issues`,path:`/issues`,getParentRoute:()=>Oa}),hc=es.update({id:`/analytics`,path:`/analytics`,getParentRoute:()=>Oa}).lazy(()=>ha(()=>import(`./analytics.lazy-C25zZ3JA.js`).then(e=>e.Route),__vite__mapDeps([7,1,5,2]))),gc=ds.update({id:`/agents`,path:`/agents`,getParentRoute:()=>Oa}),_c=ps.update({id:`/`,path:`/`,getParentRoute:()=>Oa}),vc=ms.update({id:`/`,path:`/`,getParentRoute:()=>dc}),yc=ys.update({id:`/workflow`,path:`/workflow`,getParentRoute:()=>dc}),bc=Ps.update({id:`/providers`,path:`/providers`,getParentRoute:()=>dc}),xc=Ls.update({id:`/project`,path:`/project`,getParentRoute:()=>dc}),Sc=Xs.update({id:`/notifications`,path:`/notifications`,getParentRoute:()=>dc}),Cc=nc.update({id:`/hotkeys`,path:`/hotkeys`,getParentRoute:()=>dc}),wc=ic.update({id:`/general`,path:`/general`,getParentRoute:()=>dc}),Tc={SettingsAgentsRoute:oc.update({id:`/agents`,path:`/agents`,getParentRoute:()=>dc}),SettingsGeneralRoute:wc,SettingsHotkeysRoute:Cc,SettingsNotificationsRoute:Sc,SettingsProjectRoute:xc,SettingsProvidersRoute:bc,SettingsWorkflowRoute:yc,SettingsIndexRoute:vc},Ec={IndexRoute:_c,AgentsRoute:gc,AnalyticsRoute:hc,IssuesRoute:mc,KanbanRoute:pc,OnboardingRoute:fc,SettingsRoute:dc._addFileChildren(Tc)},Dc=Oa._addFileChildren(Ec)._addFileTypes();window.__fifonyInstallPrompt=null,window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),window.__fifonyInstallPrompt=e});var Oc=new ce({defaultOptions:{queries:{staleTime:2e3,retry:1,refetchOnWindowFocus:!1}}}),kc=O({routeTree:Dc,basepath:`/`,defaultPreload:`intent`});(0,le.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(W.StrictMode,{children:(0,K.jsx)(D,{client:Oc,children:(0,K.jsx)(E,{router:kc})})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/service-worker.js`,{scope:`/`}).catch(()=>{})});export{Kt as A,ut as B,dn as C,an as D,on as E,It as F,Fe as G,dt as H,Pt as I,Ue as J,Pe as K,At as L,Bt as M,zt as N,rn as O,Lt as P,ue as Q,Ct as R,q as S,sn as T,gt as U,mt as V,G as W,Re as X,We as Y,He as Z,J as _,ar as a,pn as b,rr as c,Wn as d,Vn as f,Y as g,Nn as h,fr as i,Ut as j,Qt as k,Zn as l,In as m,Ii as n,X as o,Bn as p,Ie as q,pr as r,ir as s,sa as t,Kn as u,Sn as v,un as w,fn as x,xn as y,St as z};
|