fifony 0.1.34 → 0.1.36
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-Du7aS97R.js → CommandPalette-CyyF04a2.js} +1 -1
- package/app/dist/assets/{KeyboardShortcutsHelp-mguoBIXk.js → KeyboardShortcutsHelp-D71YmyfF.js} +1 -1
- package/app/dist/assets/{OnboardingWizard-dOrVz-hX.js → OnboardingWizard-TLlzqU2A.js} +1 -1
- package/app/dist/assets/{analytics.lazy-CKd9S45z.js → analytics.lazy-D8vsSFxh.js} +1 -1
- package/app/dist/assets/{index-nWJMQsCn.js → index-Ccu8chEN.js} +6 -6
- package/app/dist/index.html +1 -1
- package/app/dist/service-worker.js +1 -1
- package/dist/agent/run-local.js +4 -4
- package/dist/{agent-QWN3JVX5.js → agent-5AEC4SL7.js} +5 -5
- package/dist/{chunk-TSSVMTCS.js → chunk-A7BVAGPW.js} +40 -17
- package/dist/{chunk-2ZK3IUJQ.js → chunk-GYVLPWYB.js} +11 -11
- package/dist/{chunk-GW7LVDP3.js → chunk-LUIPCPRO.js} +2 -2
- package/dist/{chunk-KRH4LWCW.js → chunk-QBAR5JLY.js} +4 -4
- package/dist/cli.js +4 -4
- package/dist/{issue-runner-QGJY5COY.js → issue-runner-VOW7MZEK.js} +5 -5
- package/dist/{issue-state-machine-6Y2OTUGI.js → issue-state-machine-JCGSR5QP.js} +3 -3
- package/dist/{issues-QSMDQQFO.js → issues-2ENRFJHC.js} +5 -5
- package/dist/{queue-workers-TDJWHJMJ.js → queue-workers-BQLDNMFQ.js} +2 -2
- package/dist/{scheduler-LWCF7U6Q.js → scheduler-5XTHGLCA.js} +5 -5
- package/dist/{store-DSMN6IKR.js → store-44KLJAXC.js} +5 -5
- package/dist/{workspace-S5F5JFM6.js → workspace-U43FRPEB.js} +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KeyboardShortcutsHelp-
|
|
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 ne,r as R,s as z,t as B,u as V}from"./api-ChEctgc5.js";import{t as H}from"./createLucideIcon-CBw-4t9s.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 re(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?ae:ie,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:ie(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 ie(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 ae(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var oe=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=se(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=se(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=se(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=se(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 se(e){return e.options.scope?.id}var ce=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()})})}},le=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ce,this.#t=e.mutationCache||new oe,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=re(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(C).catch(C)}ensureInfiniteQueryData(e){return e.behavior=re(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()}},ue=a(),U=e(o(),1),de=`/assets/dinofffaur.webp`;function fe(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 pe(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=fe(Array.isArray(n.issues)?n.issues:[],t.issuesDelta,t.issuesRemoved||[])),Array.isArray(t.events)&&(r.events=t.events),r}function me(e){let[t,n]=(0,U.useState)(`disconnected`),r=T();return(0,U.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=>pe(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 he({pollInterval:e=3e3,showAll:t=!1}={}){return v({queryKey:[`runtime-state`,t],queryFn:()=>B.get(t?`/state?all=1`:`/state`),refetchInterval:e})}function ge(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:()=>B.get(`/events/feed${r.size?`?${r}`:``}`),refetchInterval:n})}function _e(){return v({queryKey:[`providers`],queryFn:()=>B.get(`/providers`),refetchInterval:15e3})}function ve(){return v({queryKey:[`parallelism`],queryFn:()=>B.get(`/parallelism`),refetchInterval:15e3})}var ye=[`claude`,`codex`,`gemini`];function be(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 xe(){return v({queryKey:[`providers-usage`],queryFn:async()=>{let e=await Promise.allSettled(ye.map(e=>B.get(`/providers/${e}/usage`))),t=[],n=[];for(let r of e){if(r.status!==`fulfilled`)continue;let e=be(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=be(await B.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 Se=[`auto`,`light`,`dark`],Ce=`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(`.`),we=[...Se,...Ce],W=[`settings`],Te=`ui.theme`,Ee=`ui.notifications.enabled`,De=`ui.issues.stateFilter`,Oe=`ui.issues.completionFilter`,ke=`ui.events.kind`,Ae=`ui.events.issueId`,je=window.matchMedia(`(prefers-color-scheme: dark)`);function Me(e){return e===`auto`?je.matches?`dark`:`light`:e}function Ne(e){return we.includes(e)?e:`auto`}function Pe(e,t=!1){return typeof e==`boolean`?e:t}function Fe(e){return Array.isArray(e?.settings)?e.settings:[]}function Ie(e,t,n){return(Array.isArray(e)?e.find(e=>e?.id===t):null)?.value??n}function Le(e,t){let n=e&&typeof e==`object`?e:{},r=Fe(n).filter(e=>e?.id!==t.id);return{...n,settings:[...r,t]}}async function Re(e,t){return B.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:t,source:`user`})}function ze(){return v({queryKey:W,queryFn:()=>B.get(`/settings`),staleTime:3e4})}function Be(e,t,n={}){let r=T(),i=ze(),a=typeof n.normalize==`function`?n.normalize:e=>e,o=a(Ie(Fe(i.data),e,t)),[s,c]=(0,U.useState)(o),l=(0,U.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:W}),r.setQueryData(W,e=>Le(e,i)),B.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:n,source:`user`}).then(e=>{e?.setting&&r.setQueryData(W,t=>Le(t,e.setting))}).catch(()=>{r.invalidateQueries({queryKey:W})})},[a,r,e]);return(0,U.useEffect)(()=>{c(e=>Object.is(e,o)?e:o)},[o]),[s,l]}function Ve(){let e=T(),t=Ne(Ie(Fe(ze().data),Te,`auto`)),[n,r]=(0,U.useState)(t),i=(0,U.useCallback)(t=>{let n=Ne(t);r(n);let i={id:Te,scope:`ui`,value:n,source:`user`,updatedAt:new Date().toISOString()};e.cancelQueries({queryKey:W}),e.setQueryData(W,e=>Le(e,i)),B.post(`/settings/${encodeURIComponent(Te)}`,{scope:`ui`,value:n,source:`user`}).then(t=>{t?.setting&&e.setQueryData(W,e=>Le(e,t.setting))}).catch(()=>{e.invalidateQueries({queryKey:W})})},[e]);return(0,U.useEffect)(()=>{r(e=>e===t?e:t)},[t]),(0,U.useEffect)(()=>{let e=()=>{let e=document.documentElement;return e.classList.add(`theme-transitioning`),e.setAttribute(`data-theme`,Me(n)),setTimeout(()=>e.classList.remove(`theme-transitioning`),350)},t=e();if(n===`auto`){let n=()=>e();return je.addEventListener(`change`,n),()=>{clearTimeout(t),je.removeEventListener(`change`,n)}}return()=>clearTimeout(t)},[n]),[n,i]}function He(){return Be(Ee,!1,{normalize:e=>Pe(e,!1)})}function Ue(){return v({queryKey:[`token-analytics`],queryFn:()=>B.get(`/analytics/tokens`),refetchInterval:1e4})}function We({pollInterval:e=3e4}={}){return v({queryKey:[`analytics-lines`],queryFn:()=>B.get(`/analytics/lines`),refetchInterval:e})}function Ge({pollInterval:e=3e4}={}){return v({queryKey:[`analytics-kpis`],queryFn:()=>B.get(`/analytics/kpis`),refetchInterval:e})}function Ke(){let[e,t]=(0,U.useState)(()=>navigator.onLine),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(!1),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(()=>window.matchMedia(`(display-mode: standalone)`).matches||window.navigator.standalone===!0);(0,U.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,U.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,U.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,U.useCallback)(async()=>!n||(await n.prompt(),(await n.userChoice)?.outcome!==`accepted`)?!1:(r(null),a(!1),!0),[n]),d=(0,U.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 qe=`ui.notifications.events.`,Je=[1e4,5e4,1e5,5e5,1e6],Ye=[{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`}],Xe=[{id:`execution`,label:`Execution`},{id:`review`,label:`Review`},{id:`lifecycle`,label:`Lifecycle`},{id:`usage`,label:`Usage`}],Ze=new Map(Ye.map(e=>[e.state,e]));function Qe(e){return Ze.get(e)??null}function $e(e){return`${qe}${e}`}function et(e,t){let n=Ze.get(t);if(!n)return!1;let r=$e(n.id);return(Array.isArray(e)?e.find(e=>e?.id===r):null)?.value??n.defaultEnabled}function tt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function nt(){return`Notification`in window?Notification.permission:`unsupported`}function rt(e,t,n){if(nt()===`granted`)try{new Notification(e,{body:t,tag:`fifony-${n}`,icon:`/icon.svg`,badge:`/icon.svg`,silent:!1})}catch{}}var it=null;function at(){if(!it)try{it=new(window.AudioContext||window.webkitAudioContext)}catch{return null}return it}var ot=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;function st(e){if(!e||ot)return;let t=at();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 ct=0;function lt(){let[e,t]=(0,U.useState)([]),[n,r]=(0,U.useState)(0),i=(0,U.useCallback)(e=>{let n=++ct,i={id:n,...e,timestamp:Date.now(),read:!1};return t(e=>[i,...e].slice(0,30)),r(e=>e+1),n},[]),a=(0,U.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,U.useCallback)(()=>{t(e=>e.map(e=>e.read?e:{...e,read:!0})),r(0)},[]);return(0,U.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 ut(e){let[t,n]=He(),[r,i]=(0,U.useState)(nt),a=(0,U.useRef)(new Map),o=(0,U.useRef)(new Map),s=lt(),c=Fe(ze().data),l=T(),u=(0,U.useCallback)(e=>{n(e)},[n]),d=(0,U.useCallback)(async()=>{if(!(`Notification`in window))return`unsupported`;let e=await Notification.requestPermission();return i(e),e===`granted`&&u(!0),e},[u]),f=Ye.map(e=>({...e,enabled:et(c,e.state),settingId:$e(e.id)})),p=(0,U.useCallback)(async(e,t)=>{await Re($e(e),t),l.invalidateQueries({queryKey:[`settings`]})},[l]);return(0,U.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=Qe(r.state);if(e&&et(c,r.state)){let n=`${e.label}: ${r.identifier}`,i=r.title;rt(n,i,`${e.id}-${r.id}`),s.addNotification({title:n,body:i,state:r.state,icon:e.icon,issueId:r.id}),e.sound&&st(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 Je)if(a>=t&&!e.has(t)&&(e.add(t),n.size>0&&Qe(`token-milestone`)&&et(c,`token-milestone`))){let e=tt(t),n=`Token milestone: ${e}`,i=`${r.identifier} has used ${e} tokens`;rt(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 dt=`system.projectName`;function ft(e){return typeof e==`string`?e.trim().replace(/\s+/g,` `):``}function pt(e){let t=typeof e==`string`?e.trim().replace(/[\\/]+$/,``):``;return t?ft(t.split(/[\\/]+/).filter(Boolean).at(-1)||``):``}function mt(e){return ft((Array.isArray(e)?e:[]).find(e=>e?.id===dt)?.value)}function ht(e){let t=ft(e);return t?`fifony: ${t}`:`fifony`}function gt({savedProjectName:e=``,detectedProjectName:t=``}={}){let n=ft(e),r=ft(t),i=n||r;return{projectName:i,detectedProjectName:r,source:n?`saved`:r?`detected`:`missing`,requiresManualEntry:!i}}function _t(e,t={}){let n=mt(e),r=ft(t?.detectedProjectName)||pt(t?.sourceRepoUrl||t?.config?.sourceRepo||``),i=ft(t?.projectName),a=t?.projectNameSource,o=gt({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:ht(s)}}var G=b(),vt=(0,U.createContext)(null),yt=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],bt=new Set([`recent`,`all`]);function xt(){let e=(0,U.useContext)(vt);if(!e)throw Error(`useDashboard must be used within DashboardProvider`);return e}function St({children:e}){let t=ze(),[n,r]=Ve(),[i,a]=Be(De,`all`,{normalize:e=>e===`all`||te.includes(e)?e:`all`}),o=()=>{},[s,c]=Be(Oe,`recent`,{normalize:e=>bt.has(e)?e:`recent`}),[l,u]=(0,U.useState)(``),[d,f]=Be(ke,`all`,{normalize:e=>yt.includes(e)?e:`all`}),[p,m]=Be(Ae,`all`,{normalize:e=>typeof e==`string`&&e.trim()?e:`all`}),[h,g]=(0,U.useState)(`3`),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(null),[w,E]=(0,U.useState)(!1),[D,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(!1),[j,M]=(0,U.useState)([]),N=Ke(),P=T(),F=me((0,U.useCallback)(e=>{Array.isArray(e?.events)&&M(e.events)},[])),I=F===`connected`,ee=he({pollInterval:3e3,showAll:s===`all`}),L=ge(d,p,I?3e3:2500),ne=_e(),R=ve(),z=ee.data||{},V=Array.isArray(z.issues)?z.issues:[],H=z.metrics||{},re=(0,U.useMemo)(()=>_t(Fe(t.data),z),[t.data,z]),ie=I||z.config?`ok`:`offline`,ae=I?j:L.data?.events||[],oe=(0,U.useMemo)(()=>D&&V.find(e=>e.id===D)||null,[D,V]),se=(0,U.useCallback)(e=>{O(e?.id||null)},[]),ce=(0,U.useMemo)(()=>{let e=l.toLowerCase();return V.filter(t=>!(i!==`all`&&t.state!==i||e&&!`${t.identifier} ${t.title} ${t.description||``}`.toLowerCase().includes(e)))},[V,i,l]),le=(0,U.useMemo)(()=>[`all`],[]),ue=(0,U.useMemo)(()=>[...new Set(V.map(e=>e.id))].sort(),[V]);(0,U.useEffect)(()=>{p!==`all`&&!ue.includes(p)&&m(`all`)},[p,ue,m]);let de=(0,U.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)},[]),fe=(0,U.useCallback)((e,t,n)=>{C({x:e??window.innerWidth/2,y:t??window.innerHeight/3,count:n??24})},[]),pe=(0,U.useCallback)(()=>C(null),[]),ye=_({mutationFn:e=>B.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),de(`Issue created`,`success`),fe()},onError:e=>de(e.message,`error`)}),be=_({mutationFn:({id:e,state:t})=>B.post(`/issues/${encodeURIComponent(e)}/state`,{state:t}),onSuccess:()=>{P.invalidateQueries({queryKey:[`runtime-state`]}),de(`State updated`,`success`)},onError:e=>de(e.message,`error`)}),xe=_({mutationFn:e=>B.post(`/issues/${encodeURIComponent(e)}/retry`),onSuccess:()=>P.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>de(e.message)}),Se=_({mutationFn:e=>B.post(`/issues/${encodeURIComponent(e)}/cancel`),onSuccess:()=>P.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>de(e.message)}),Ce=_({mutationFn:()=>B.post(`/refresh`,{}),onSuccess:()=>P.invalidateQueries(),onError:e=>de(e.message)}),we=_({mutationFn:()=>B.post(`/config/concurrency`,{concurrency:parseInt(h,10)}),onSuccess:()=>{P.invalidateQueries({queryKey:[`runtime-state`]}),de(`Concurrency updated`,`success`)},onError:e=>de(e.message,`error`)});(0,U.useEffect)(()=>{z.config?.workerConcurrency&&g(String(z.config.workerConcurrency))},[z.config?.workerConcurrency]);let W=(0,U.useCallback)(()=>A(e=>!e),[]),Te=ut(V),Ee=(0,U.useRef)(new Map);(0,U.useEffect)(()=>{let e=Ee.current;for(let t of V){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();fe(t.left+t.width/2,t.top+t.height/2,12)}else fe(void 0,void 0,12)}}let t=new Map;for(let e of V)t.set(e.id,e.state);Ee.current=t},[V,fe]);let je=(0,U.useMemo)(()=>({theme:n,setTheme:r,status:ie,wsStatus:F,liveMode:I,data:z,issues:V,filtered:ce,metrics:H,eventsData:ae,providers:ne,parallelism:R,projectName:re.projectName,queueTitle:re.queueTitle,categoryOptions:le,issueOptions:ue,runtime:ee,query:l,setQuery:u,stateFilter:i,setStateFilter:a,categoryFilter:`all`,setCategoryFilter:o,completionFilter:s,setCompletionFilter:c,isEventsOpen:k,toggleEvents:W,setIsEventsOpen:A,eventKind:d,setEventKind:f,eventIssueId:p,setEventIssueId:m,isCreateOpen:w,setIsCreateOpen:E,createIssue:ye,selectedIssue:oe,setSelectedIssue:se,updateState:(e,t)=>be.mutate({id:e,state:t}),retryIssue:e=>xe.mutate(e),cancelIssue:e=>Se.mutate(e),refresh:()=>Ce.mutate(),concurrency:h,setConcurrency:g,saveConcurrency:()=>we.mutate(),saveConcPending:we.isPending,pwa:N,notifications:Te,toast:v,toastExiting:b,showToast:de,confetti:S,showConfetti:fe,clearConfetti:pe}),[n,ie,F,I,z,V,ce,H,ae,ne,R,le,ue,ee,re,l,i,`all`,s,k,d,p,w,oe,h,v,b,S,N,Te,r,u,a,o,c,W,A,f,m,E,se,g,de,fe,pe,ye,be,xe,Se,Ce,we]);return(0,G.jsx)(vt.Provider,{value:je,children:e})}var Ct=H(`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`}]]),wt=H(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Tt=H(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Et=H(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Dt=H(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Ot=H(`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`}]]),kt=H(`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`}]]),At=H(`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`}]]),jt=H(`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`}]]),Mt=H(`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`}]]),Nt=H(`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`}]]),Pt=H(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ft=H(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),It=H(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Lt=H(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Rt=H(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),zt=H(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Bt=H(`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`}]]),Vt=H(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ht=H(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ut=H(`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`}]]),Wt=H(`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`}]]),Gt=H(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Kt=H(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),qt=H(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Jt=H(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Yt=H(`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`}]]),Xt=H(`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`}]]),Zt=H(`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`}]]),Qt=H(`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`}]]),$t=H(`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`}]]),en=H(`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`}]]),tn=H(`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`}]]),nn=H(`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`}]]),rn=H(`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`}]]),an=H(`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`}]]),on=H(`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`}]]),sn=H(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),cn=H(`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`}]]),ln=H(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),un=H(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),dn=H(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),fn=H(`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`}]]),K=H(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),pn=H(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),mn=H(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),hn=H(`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`}]]),gn=H(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),_n=H(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),vn=H(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),yn=H(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),bn=H(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),xn=H(`kanban`,[[`path`,{d:`M5 3v14`,key:`9nsxs2`}],[`path`,{d:`M12 3v8`,key:`1h2ygw`}],[`path`,{d:`M19 3v18`,key:`1sk56x`}]]),Sn=H(`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`}]]),Cn=H(`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`}]]),wn=H(`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`}]]),Tn=H(`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`}]]),En=H(`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`}]]),Dn=H(`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`}]]),On=H(`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`}]]),q=H(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),J=H(`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`}]]),kn=H(`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`}]]),An=H(`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=H(`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`}]]),Mn=H(`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`}]]),Nn=H(`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`}]]),Pn=H(`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`}]]),Fn=H(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),In=H(`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`}]]),Ln=H(`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`}]]),Rn=H(`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`}]]),zn=H(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Bn=H(`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`}]]),Vn=H(`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`}]]),Y=H(`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`}]]),Hn=H(`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`}]]),Un=H(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Wn=H(`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`}]]),Gn=H(`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`}]]),Kn=H(`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`}]]),qn=H(`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`}]]),Jn=H(`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`}]]),Yn=H(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Xn=H(`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`}]]),Zn=H(`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`}]]),Qn=H(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),$n=H(`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`}]]),er=H(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),tr=H(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),nr=H(`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=H(`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=H(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),X=H(`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=H(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),or=H(`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`}]]),sr=H(`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`}]]),cr=H(`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`}]]),lr=H(`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`}]]),ur=H(`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`}]]),dr=H(`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`}]]),fr=H(`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`}]]),pr=H(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),mr=H(`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`}]]),hr={Running:Rn,Queued:qt,Reviewing:nn,PendingDecision:nn,Approved:Bt,Blocked:X,Cancelled:Wt,"token-milestone":mr},gr={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`},_r={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 vr(){let[e,t]=(0,U.useState)(()=>window.innerWidth<768);return(0,U.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function yr({notif:e,onDismiss:t}){let n=hr[e.state]||kt,r=gr[e.state]||`text-base-content`,i=e.read?``:_r[e.state]||``,a=e.title?.match(/(.*?):\s*(#\S+|[A-Z]+-\d+)$/),o=a?a[1]:e.title,s=a?a[2]:null;return(0,G.jsxs)(`li`,{className:`group relative px-3 py-2.5 transition-colors
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KeyboardShortcutsHelp-D71YmyfF.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/vendor-DkWeBvNl.js","assets/CommandPalette-CyyF04a2.js","assets/createLucideIcon-CBw-4t9s.js","assets/api-ChEctgc5.js","assets/OnboardingWizard-TLlzqU2A.js","assets/analytics.lazy-D8vsSFxh.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 ne,r as R,s as z,t as B,u as V}from"./api-ChEctgc5.js";import{t as H}from"./createLucideIcon-CBw-4t9s.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 re(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?ae:ie,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:ie(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 ie(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 ae(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var oe=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=se(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=se(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=se(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=se(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 se(e){return e.options.scope?.id}var ce=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()})})}},le=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ce,this.#t=e.mutationCache||new oe,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=re(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(C).catch(C)}ensureInfiniteQueryData(e){return e.behavior=re(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()}},ue=a(),U=e(o(),1),de=`/assets/dinofffaur.webp`;function fe(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 pe(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=fe(Array.isArray(n.issues)?n.issues:[],t.issuesDelta,t.issuesRemoved||[])),Array.isArray(t.events)&&(r.events=t.events),r}function me(e){let[t,n]=(0,U.useState)(`disconnected`),r=T();return(0,U.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=>pe(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 he({pollInterval:e=3e3,showAll:t=!1}={}){return v({queryKey:[`runtime-state`,t],queryFn:()=>B.get(t?`/state?all=1`:`/state`),refetchInterval:e})}function ge(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:()=>B.get(`/events/feed${r.size?`?${r}`:``}`),refetchInterval:n})}function _e(){return v({queryKey:[`providers`],queryFn:()=>B.get(`/providers`),refetchInterval:15e3})}function ve(){return v({queryKey:[`parallelism`],queryFn:()=>B.get(`/parallelism`),refetchInterval:15e3})}var ye=[`claude`,`codex`,`gemini`];function be(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 xe(){return v({queryKey:[`providers-usage`],queryFn:async()=>{let e=await Promise.allSettled(ye.map(e=>B.get(`/providers/${e}/usage`))),t=[],n=[];for(let r of e){if(r.status!==`fulfilled`)continue;let e=be(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=be(await B.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 Se=[`auto`,`light`,`dark`],Ce=`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(`.`),we=[...Se,...Ce],W=[`settings`],Te=`ui.theme`,Ee=`ui.notifications.enabled`,De=`ui.issues.stateFilter`,Oe=`ui.issues.completionFilter`,ke=`ui.events.kind`,Ae=`ui.events.issueId`,je=window.matchMedia(`(prefers-color-scheme: dark)`);function Me(e){return e===`auto`?je.matches?`dark`:`light`:e}function Ne(e){return we.includes(e)?e:`auto`}function Pe(e,t=!1){return typeof e==`boolean`?e:t}function Fe(e){return Array.isArray(e?.settings)?e.settings:[]}function Ie(e,t,n){return(Array.isArray(e)?e.find(e=>e?.id===t):null)?.value??n}function Le(e,t){let n=e&&typeof e==`object`?e:{},r=Fe(n).filter(e=>e?.id!==t.id);return{...n,settings:[...r,t]}}async function Re(e,t){return B.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:t,source:`user`})}function ze(){return v({queryKey:W,queryFn:()=>B.get(`/settings`),staleTime:3e4})}function Be(e,t,n={}){let r=T(),i=ze(),a=typeof n.normalize==`function`?n.normalize:e=>e,o=a(Ie(Fe(i.data),e,t)),[s,c]=(0,U.useState)(o),l=(0,U.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:W}),r.setQueryData(W,e=>Le(e,i)),B.post(`/settings/${encodeURIComponent(e)}`,{scope:`ui`,value:n,source:`user`}).then(e=>{e?.setting&&r.setQueryData(W,t=>Le(t,e.setting))}).catch(()=>{r.invalidateQueries({queryKey:W})})},[a,r,e]);return(0,U.useEffect)(()=>{c(e=>Object.is(e,o)?e:o)},[o]),[s,l]}function Ve(){let e=T(),t=Ne(Ie(Fe(ze().data),Te,`auto`)),[n,r]=(0,U.useState)(t),i=(0,U.useCallback)(t=>{let n=Ne(t);r(n);let i={id:Te,scope:`ui`,value:n,source:`user`,updatedAt:new Date().toISOString()};e.cancelQueries({queryKey:W}),e.setQueryData(W,e=>Le(e,i)),B.post(`/settings/${encodeURIComponent(Te)}`,{scope:`ui`,value:n,source:`user`}).then(t=>{t?.setting&&e.setQueryData(W,e=>Le(e,t.setting))}).catch(()=>{e.invalidateQueries({queryKey:W})})},[e]);return(0,U.useEffect)(()=>{r(e=>e===t?e:t)},[t]),(0,U.useEffect)(()=>{let e=()=>{let e=document.documentElement;return e.classList.add(`theme-transitioning`),e.setAttribute(`data-theme`,Me(n)),setTimeout(()=>e.classList.remove(`theme-transitioning`),350)},t=e();if(n===`auto`){let n=()=>e();return je.addEventListener(`change`,n),()=>{clearTimeout(t),je.removeEventListener(`change`,n)}}return()=>clearTimeout(t)},[n]),[n,i]}function He(){return Be(Ee,!1,{normalize:e=>Pe(e,!1)})}function Ue(){return v({queryKey:[`token-analytics`],queryFn:()=>B.get(`/analytics/tokens`),refetchInterval:1e4})}function We({pollInterval:e=3e4}={}){return v({queryKey:[`analytics-lines`],queryFn:()=>B.get(`/analytics/lines`),refetchInterval:e})}function Ge({pollInterval:e=3e4}={}){return v({queryKey:[`analytics-kpis`],queryFn:()=>B.get(`/analytics/kpis`),refetchInterval:e})}function Ke(){let[e,t]=(0,U.useState)(()=>navigator.onLine),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(!1),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(()=>window.matchMedia(`(display-mode: standalone)`).matches||window.navigator.standalone===!0);(0,U.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,U.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,U.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,U.useCallback)(async()=>!n||(await n.prompt(),(await n.userChoice)?.outcome!==`accepted`)?!1:(r(null),a(!1),!0),[n]),d=(0,U.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 qe=`ui.notifications.events.`,Je=[1e4,5e4,1e5,5e5,1e6],Ye=[{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`}],Xe=[{id:`execution`,label:`Execution`},{id:`review`,label:`Review`},{id:`lifecycle`,label:`Lifecycle`},{id:`usage`,label:`Usage`}],Ze=new Map(Ye.map(e=>[e.state,e]));function Qe(e){return Ze.get(e)??null}function $e(e){return`${qe}${e}`}function et(e,t){let n=Ze.get(t);if(!n)return!1;let r=$e(n.id);return(Array.isArray(e)?e.find(e=>e?.id===r):null)?.value??n.defaultEnabled}function tt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function nt(){return`Notification`in window?Notification.permission:`unsupported`}function rt(e,t,n){if(nt()===`granted`)try{new Notification(e,{body:t,tag:`fifony-${n}`,icon:`/icon.svg`,badge:`/icon.svg`,silent:!1})}catch{}}var it=null;function at(){if(!it)try{it=new(window.AudioContext||window.webkitAudioContext)}catch{return null}return it}var ot=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;function st(e){if(!e||ot)return;let t=at();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 ct=0;function lt(){let[e,t]=(0,U.useState)([]),[n,r]=(0,U.useState)(0),i=(0,U.useCallback)(e=>{let n=++ct,i={id:n,...e,timestamp:Date.now(),read:!1};return t(e=>[i,...e].slice(0,30)),r(e=>e+1),n},[]),a=(0,U.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,U.useCallback)(()=>{t(e=>e.map(e=>e.read?e:{...e,read:!0})),r(0)},[]);return(0,U.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 ut(e){let[t,n]=He(),[r,i]=(0,U.useState)(nt),a=(0,U.useRef)(new Map),o=(0,U.useRef)(new Map),s=lt(),c=Fe(ze().data),l=T(),u=(0,U.useCallback)(e=>{n(e)},[n]),d=(0,U.useCallback)(async()=>{if(!(`Notification`in window))return`unsupported`;let e=await Notification.requestPermission();return i(e),e===`granted`&&u(!0),e},[u]),f=Ye.map(e=>({...e,enabled:et(c,e.state),settingId:$e(e.id)})),p=(0,U.useCallback)(async(e,t)=>{await Re($e(e),t),l.invalidateQueries({queryKey:[`settings`]})},[l]);return(0,U.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=Qe(r.state);if(e&&et(c,r.state)){let n=`${e.label}: ${r.identifier}`,i=r.title;rt(n,i,`${e.id}-${r.id}`),s.addNotification({title:n,body:i,state:r.state,icon:e.icon,issueId:r.id}),e.sound&&st(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 Je)if(a>=t&&!e.has(t)&&(e.add(t),n.size>0&&Qe(`token-milestone`)&&et(c,`token-milestone`))){let e=tt(t),n=`Token milestone: ${e}`,i=`${r.identifier} has used ${e} tokens`;rt(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 dt=`system.projectName`;function ft(e){return typeof e==`string`?e.trim().replace(/\s+/g,` `):``}function pt(e){let t=typeof e==`string`?e.trim().replace(/[\\/]+$/,``):``;return t?ft(t.split(/[\\/]+/).filter(Boolean).at(-1)||``):``}function mt(e){return ft((Array.isArray(e)?e:[]).find(e=>e?.id===dt)?.value)}function ht(e){let t=ft(e);return t?`fifony: ${t}`:`fifony`}function gt({savedProjectName:e=``,detectedProjectName:t=``}={}){let n=ft(e),r=ft(t),i=n||r;return{projectName:i,detectedProjectName:r,source:n?`saved`:r?`detected`:`missing`,requiresManualEntry:!i}}function _t(e,t={}){let n=mt(e),r=ft(t?.detectedProjectName)||pt(t?.sourceRepoUrl||t?.config?.sourceRepo||``),i=ft(t?.projectName),a=t?.projectNameSource,o=gt({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:ht(s)}}var G=b(),vt=(0,U.createContext)(null),yt=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],bt=new Set([`recent`,`all`]);function xt(){let e=(0,U.useContext)(vt);if(!e)throw Error(`useDashboard must be used within DashboardProvider`);return e}function St({children:e}){let t=ze(),[n,r]=Ve(),[i,a]=Be(De,`all`,{normalize:e=>e===`all`||te.includes(e)?e:`all`}),o=()=>{},[s,c]=Be(Oe,`recent`,{normalize:e=>bt.has(e)?e:`recent`}),[l,u]=(0,U.useState)(``),[d,f]=Be(ke,`all`,{normalize:e=>yt.includes(e)?e:`all`}),[p,m]=Be(Ae,`all`,{normalize:e=>typeof e==`string`&&e.trim()?e:`all`}),[h,g]=(0,U.useState)(`3`),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(null),[w,E]=(0,U.useState)(!1),[D,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(!1),[j,M]=(0,U.useState)([]),N=Ke(),P=T(),F=me((0,U.useCallback)(e=>{Array.isArray(e?.events)&&M(e.events)},[])),I=F===`connected`,ee=he({pollInterval:3e3,showAll:s===`all`}),L=ge(d,p,I?3e3:2500),ne=_e(),R=ve(),z=ee.data||{},V=Array.isArray(z.issues)?z.issues:[],H=z.metrics||{},re=(0,U.useMemo)(()=>_t(Fe(t.data),z),[t.data,z]),ie=I||z.config?`ok`:`offline`,ae=I?j:L.data?.events||[],oe=(0,U.useMemo)(()=>D&&V.find(e=>e.id===D)||null,[D,V]),se=(0,U.useCallback)(e=>{O(e?.id||null)},[]),ce=(0,U.useMemo)(()=>{let e=l.toLowerCase();return V.filter(t=>!(i!==`all`&&t.state!==i||e&&!`${t.identifier} ${t.title} ${t.description||``}`.toLowerCase().includes(e)))},[V,i,l]),le=(0,U.useMemo)(()=>[`all`],[]),ue=(0,U.useMemo)(()=>[...new Set(V.map(e=>e.id))].sort(),[V]);(0,U.useEffect)(()=>{p!==`all`&&!ue.includes(p)&&m(`all`)},[p,ue,m]);let de=(0,U.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)},[]),fe=(0,U.useCallback)((e,t,n)=>{C({x:e??window.innerWidth/2,y:t??window.innerHeight/3,count:n??24})},[]),pe=(0,U.useCallback)(()=>C(null),[]),ye=_({mutationFn:e=>B.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),de(`Issue created`,`success`),fe()},onError:e=>de(e.message,`error`)}),be=_({mutationFn:({id:e,state:t})=>B.post(`/issues/${encodeURIComponent(e)}/state`,{state:t}),onSuccess:()=>{P.invalidateQueries({queryKey:[`runtime-state`]}),de(`State updated`,`success`)},onError:e=>de(e.message,`error`)}),xe=_({mutationFn:({id:e,feedback:t})=>B.post(`/issues/${encodeURIComponent(e)}/retry`,t?{feedback:t}:void 0),onSuccess:()=>P.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>de(e.message)}),Se=_({mutationFn:e=>B.post(`/issues/${encodeURIComponent(e)}/cancel`),onSuccess:()=>P.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>de(e.message)}),Ce=_({mutationFn:()=>B.post(`/refresh`,{}),onSuccess:()=>P.invalidateQueries(),onError:e=>de(e.message)}),we=_({mutationFn:()=>B.post(`/config/concurrency`,{concurrency:parseInt(h,10)}),onSuccess:()=>{P.invalidateQueries({queryKey:[`runtime-state`]}),de(`Concurrency updated`,`success`)},onError:e=>de(e.message,`error`)});(0,U.useEffect)(()=>{z.config?.workerConcurrency&&g(String(z.config.workerConcurrency))},[z.config?.workerConcurrency]);let W=(0,U.useCallback)(()=>A(e=>!e),[]),Te=ut(V),Ee=(0,U.useRef)(new Map);(0,U.useEffect)(()=>{let e=Ee.current;for(let t of V){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();fe(t.left+t.width/2,t.top+t.height/2,12)}else fe(void 0,void 0,12)}}let t=new Map;for(let e of V)t.set(e.id,e.state);Ee.current=t},[V,fe]);let je=(0,U.useMemo)(()=>({theme:n,setTheme:r,status:ie,wsStatus:F,liveMode:I,data:z,issues:V,filtered:ce,metrics:H,eventsData:ae,providers:ne,parallelism:R,projectName:re.projectName,queueTitle:re.queueTitle,categoryOptions:le,issueOptions:ue,runtime:ee,query:l,setQuery:u,stateFilter:i,setStateFilter:a,categoryFilter:`all`,setCategoryFilter:o,completionFilter:s,setCompletionFilter:c,isEventsOpen:k,toggleEvents:W,setIsEventsOpen:A,eventKind:d,setEventKind:f,eventIssueId:p,setEventIssueId:m,isCreateOpen:w,setIsCreateOpen:E,createIssue:ye,selectedIssue:oe,setSelectedIssue:se,updateState:(e,t)=>be.mutate({id:e,state:t}),retryIssue:(e,t)=>xe.mutate({id:e,feedback:t}),cancelIssue:e=>Se.mutate(e),refresh:()=>Ce.mutate(),concurrency:h,setConcurrency:g,saveConcurrency:()=>we.mutate(),saveConcPending:we.isPending,pwa:N,notifications:Te,toast:v,toastExiting:b,showToast:de,confetti:S,showConfetti:fe,clearConfetti:pe}),[n,ie,F,I,z,V,ce,H,ae,ne,R,le,ue,ee,re,l,i,`all`,s,k,d,p,w,oe,h,v,b,S,N,Te,r,u,a,o,c,W,A,f,m,E,se,g,de,fe,pe,ye,be,xe,Se,Ce,we]);return(0,G.jsx)(vt.Provider,{value:je,children:e})}var Ct=H(`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`}]]),wt=H(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Tt=H(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Et=H(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Dt=H(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),Ot=H(`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`}]]),kt=H(`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`}]]),At=H(`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`}]]),jt=H(`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`}]]),Mt=H(`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`}]]),Nt=H(`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`}]]),Pt=H(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ft=H(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),It=H(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Lt=H(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Rt=H(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),zt=H(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Bt=H(`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`}]]),Vt=H(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ht=H(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ut=H(`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`}]]),Wt=H(`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`}]]),Gt=H(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Kt=H(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),qt=H(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Jt=H(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Yt=H(`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`}]]),Xt=H(`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`}]]),Zt=H(`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`}]]),Qt=H(`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`}]]),$t=H(`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`}]]),en=H(`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`}]]),tn=H(`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`}]]),nn=H(`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`}]]),rn=H(`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`}]]),an=H(`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`}]]),on=H(`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`}]]),sn=H(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),cn=H(`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`}]]),ln=H(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),un=H(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),dn=H(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),fn=H(`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`}]]),K=H(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),pn=H(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),mn=H(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),hn=H(`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`}]]),gn=H(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),_n=H(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),vn=H(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),yn=H(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),bn=H(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),xn=H(`kanban`,[[`path`,{d:`M5 3v14`,key:`9nsxs2`}],[`path`,{d:`M12 3v8`,key:`1h2ygw`}],[`path`,{d:`M19 3v18`,key:`1sk56x`}]]),Sn=H(`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`}]]),Cn=H(`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`}]]),wn=H(`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`}]]),Tn=H(`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`}]]),En=H(`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`}]]),Dn=H(`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`}]]),On=H(`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`}]]),q=H(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),J=H(`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`}]]),kn=H(`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`}]]),An=H(`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=H(`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`}]]),Mn=H(`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`}]]),Nn=H(`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`}]]),Pn=H(`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`}]]),Fn=H(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),In=H(`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`}]]),Ln=H(`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`}]]),Rn=H(`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`}]]),zn=H(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Bn=H(`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`}]]),Vn=H(`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`}]]),Y=H(`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`}]]),Hn=H(`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`}]]),Un=H(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Wn=H(`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`}]]),Gn=H(`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`}]]),Kn=H(`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`}]]),qn=H(`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`}]]),Jn=H(`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`}]]),Yn=H(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Xn=H(`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`}]]),Zn=H(`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`}]]),Qn=H(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),$n=H(`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`}]]),er=H(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),tr=H(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),nr=H(`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=H(`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=H(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),X=H(`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=H(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),or=H(`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`}]]),sr=H(`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`}]]),cr=H(`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`}]]),lr=H(`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`}]]),ur=H(`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`}]]),dr=H(`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`}]]),fr=H(`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`}]]),pr=H(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),mr=H(`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`}]]),hr={Running:Rn,Queued:qt,Reviewing:nn,PendingDecision:nn,Approved:Bt,Blocked:X,Cancelled:Wt,"token-milestone":mr},gr={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`},_r={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 vr(){let[e,t]=(0,U.useState)(()=>window.innerWidth<768);return(0,U.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function yr({notif:e,onDismiss:t}){let n=hr[e.state]||kt,r=gr[e.state]||`text-base-content`,i=e.read?``:_r[e.state]||``,a=e.title?.match(/(.*?):\s*(#\S+|[A-Z]+-\d+)$/),o=a?a[1]:e.title,s=a?a[2]:null;return(0,G.jsxs)(`li`,{className:`group relative px-3 py-2.5 transition-colors
|
|
3
3
|
${e.read?`opacity-50`:``}
|
|
4
4
|
${i}
|
|
5
5
|
hover:bg-base-200/60`,role:`menuitem`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(`span`,{className:`mt-0.5 shrink-0 ${r}`,children:(0,G.jsx)(n,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[s&&(0,G.jsx)(`span`,{className:`font-mono text-[11px] font-semibold opacity-70 shrink-0`,children:s}),(0,G.jsx)(`p`,{className:`text-xs font-medium leading-snug line-clamp-2`,children:o})]}),e.body&&(0,G.jsx)(`p`,{className:`text-xs opacity-50 leading-snug mt-0.5 line-clamp-1`,children:e.body}),(0,G.jsx)(`p`,{className:`text-[10px] opacity-30 mt-1`,children:V(e.timestamp)})]}),!e.read&&(0,G.jsx)(`span`,{className:`size-1.5 rounded-full shrink-0 mt-1.5 ${r.replace(`text-`,`bg-`)}`})]}),(0,G.jsx)(`button`,{className:`absolute top-1.5 right-1.5 btn btn-ghost btn-xs btn-circle
|
|
@@ -41,9 +41,9 @@ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,C as n,D as r,E
|
|
|
41
41
|
w-full md:w-[480px] ${e?`translate-x-0`:`translate-x-full`}`,...k,children:(0,G.jsxs)(`form`,{onSubmit:M,className:`flex flex-col h-full`,children:[(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(wn,{className:`size-5 opacity-60`}),(0,G.jsx)(`h2`,{className:`text-lg font-bold`,children:`New Issue`})]}),(0,G.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,G.jsx)(pr,{className:`size-4`})})]}),(0,G.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,G.jsx)(`div`,{className:`flex flex-wrap sm:grid sm:grid-cols-3 gap-1.5`,children:Br.map(e=>{let t=e.icon;return(0,G.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,G.jsx)(t,{className:`size-3 sm:size-3.5 shrink-0`}),e.label]},e.id)})}),(0,G.jsxs)(`div`,{className:`form-control`,children:[(0,G.jsx)(`label`,{className:`label pb-1`,children:(0,G.jsx)(`span`,{className:`label-text font-medium`,children:`What needs to be done?`})}),(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-1 mt-1.5`,children:[w&&(0,G.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,G.jsx)(An,{className:`size-3`}):(0,G.jsx)(jn,{className:`size-3`}),C.listening&&_===`title`?`Stop`:`Dictate`]}),(0,G.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,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Xn,{className:`size-3`}),`Enhance`]})]}),(0,G.jsx)(zr,{active:C.listening&&_===`title`,onStop:()=>E(`title`)})]}),(0,G.jsxs)(`div`,{className:`form-control`,children:[(0,G.jsx)(`label`,{className:`label pb-1`,children:(0,G.jsx)(`span`,{className:`label-text font-medium`,children:`Context & details`})}),(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-1 mt-1.5`,children:[w&&(0,G.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,G.jsx)(An,{className:`size-3`}):(0,G.jsx)(jn,{className:`size-3`}),C.listening&&_===`description`?`Stop`:`Dictate`]}),(0,G.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,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Xn,{className:`size-3`}),`Enhance`]})]}),(0,G.jsx)(zr,{active:C.listening&&_===`description`,onStop:()=>E(`description`)})]}),(0,G.jsxs)(`div`,{className:`form-control`,children:[(0,G.jsxs)(`label`,{className:`label justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`label-text font-medium`,children:`Screenshots & Evidence`}),(0,G.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-ghost gap-1`,onClick:()=>S.current?.click(),disabled:h,children:[h?(0,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(In,{className:`size-3`}),`Attach`]})]}),(0,G.jsx)(`input`,{ref:S,type:`file`,multiple:!0,accept:`image/*`,className:`hidden`,onChange:j}),p.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2 mt-1`,children:p.map((e,t)=>(0,G.jsxs)(`div`,{className:`relative group`,children:[e.preview?(0,G.jsx)(`img`,{src:e.preview,alt:e.name,className:`size-16 object-cover rounded-lg border border-base-300`}):(0,G.jsx)(`div`,{className:`size-16 rounded-lg border border-base-300 bg-base-200 flex items-center justify-center`,children:(0,G.jsx)(vn,{className:`size-5 opacity-40`})}),(0,G.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,G.jsx)(pr,{className:`size-2.5`})})]},t))})]}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 text-xs opacity-60 space-y-1`,children:[(0,G.jsxs)(`p`,{children:[`The issue will be created in `,(0,G.jsx)(`strong`,{children:`Planning`}),` state.`]}),(0,G.jsx)(`p`,{children:`Open it to generate an AI plan, review it, then approve to start execution.`})]})]}),(0,G.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,G.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm sm:btn-md max-sm:w-full`,onClick:t,children:`Cancel`}),(0,G.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,G.jsx)(q,{className:`size-4 animate-spin`}):(0,G.jsx)(wn,{className:`size-4`}),r?`Creating...`:`Create Issue`]})]})]})})]})}var Hr={added:`badge-success`,removed:`badge-error`,modified:`badge-info`};function Ur({text:e}){let[t,n]=(0,U.useState)(!1);return(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost shrink-0`,onClick:(0,U.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},[e]),title:`Copy to clipboard`,children:t?(0,G.jsx)(Ft,{className:`size-3 text-success`}):(0,G.jsx)(Qt,{className:`size-3`})})}function Wr({cmd:e}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-1 bg-base-300 rounded px-2 py-1`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs flex-1 select-all`,children:e}),(0,G.jsx)(Ur,{text:e})]})}function Gr({issue:e,onClose:t}){let n=T(),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(!0),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null),x=(0,U.useCallback)(async()=>{try{b(await B.get(`/issues/${encodeURIComponent(e.id)}/merge-preview`))}catch{b(null)}},[e.id]);(0,U.useEffect)(()=>{x()},[x]);let S=(0,U.useCallback)(async()=>{o(!0),c(null);try{i(await B.get(`/diff/${encodeURIComponent(e.id)}`))}catch(e){c(e.message)}finally{o(!1)}},[e.id]);(0,U.useEffect)(()=>{S()},[S]);let C=(0,U.useCallback)(async()=>{m(!0),g(null);try{await B.post(`/issues/${encodeURIComponent(e.id)}/try`),u(!0)}catch(e){g(e.message)}finally{m(!1)}},[e.id]),w=(0,U.useCallback)(async()=>{m(!0),g(null);try{await B.post(`/issues/${encodeURIComponent(e.id)}/revert-try`),u(!1)}catch(e){g(e.message)}finally{m(!1)}},[e.id]),E=(0,U.useCallback)(async()=>{m(!0),g(null);try{await B.post(`/issues/${encodeURIComponent(e.id)}/merge`),n.invalidateQueries({queryKey:[`runtime-state`]}),t()}catch(e){g(e.message),m(!1)}},[e.id,n,t]),D=(0,U.useCallback)(async()=>{m(!0),g(null);try{await B.post(`/issues/${encodeURIComponent(e.id)}/rollback`),n.invalidateQueries({queryKey:[`runtime-state`]}),t()}catch(e){g(e.message),m(!1)}},[e.id,n,t]),O=e.worktreePath??e.workspacePath??``,k=e.branchName??`fifony/${e.id}`,A=e.baseBranch??`main`,{files:j=[],totalAdditions:M=0,totalDeletions:N=0,message:P}=r??{},F=`git merge --squash ${k}`,I=`git commit -m "feat: merge ${k}"`,ee=`git diff ${A}...${k}`;return(0,G.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/50`,onClick:t,children:(0,G.jsxs)(`div`,{className:`bg-base-100 rounded-box shadow-2xl w-full max-w-lg mx-4 flex flex-col max-h-[90vh]`,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-base-300 shrink-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-40 font-mono`,children:e.identifier}),(0,G.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-circle shrink-0 ml-3`,onClick:t,"aria-label":`Close`,children:(0,G.jsx)(pr,{className:`size-4`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4 min-h-0`,children:[O&&(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box px-3 py-2 flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-xs opacity-50 shrink-0`,children:`Worktree`}),(0,G.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:O}),(0,G.jsx)(Ur,{text:O})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs bg-base-200 px-2 py-0.5 rounded`,children:k}),(0,G.jsx)(K,{className:`size-3.5 opacity-40 shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono text-xs bg-base-200 px-2 py-0.5 rounded`,children:A})]}),y?.willConflict&&(0,G.jsxs)(`div`,{className:`alert alert-warning text-xs py-2 gap-1.5`,children:[(0,G.jsx)(X,{className:`size-3.5 shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Merge will conflict`}),(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` — `,y.conflictFiles.length,` file`,y.conflictFiles.length===1?``:`s`]}),y.conflictFiles.length>0&&(0,G.jsx)(`ul`,{className:`mt-1 ml-4 list-disc space-y-0.5 font-mono opacity-80`,children:y.conflictFiles.map(e=>(0,G.jsx)(`li`,{children:e},e))})]})]}),y&&!y.willConflict&&(0,G.jsxs)(`div`,{className:`alert alert-success text-xs py-2 gap-1.5`,children:[(0,G.jsx)(Vt,{className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{children:`Merge is clean — no conflicts detected.`})]}),l&&(0,G.jsxs)(`div`,{className:`alert alert-info text-xs py-2 gap-1.5`,children:[(0,G.jsx)(sn,{className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{children:`Squash test applied to your workspace — your server rebuilt with the changes. Review then accept or revert it.`})]}),a&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-6 justify-center`,children:[(0,G.jsx)(`span`,{className:`loading loading-spinner loading-sm`}),` Loading changes...`]}),s&&!a&&(0,G.jsx)(`div`,{className:`text-sm text-error`,children:s}),r&&!a&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,G.jsxs)(`span`,{className:`opacity-60`,children:[j.length,` file`,j.length===1?``:`s`,` changed`]}),(0,G.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,M]}),(0,G.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,N]})]}),j.length>0?(0,G.jsx)(`div`,{className:`space-y-0.5 max-h-[22vh] overflow-y-auto rounded-box border border-base-300 p-1`,children:j.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded hover:bg-base-200 transition-colors`,children:[(0,G.jsx)(`span`,{className:`badge badge-xs shrink-0 ${Hr[e.status]||`badge-ghost`}`,children:e.status}),(0,G.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:e.path}),(0,G.jsxs)(`span`,{className:`text-xs text-success shrink-0`,children:[`+`,e.additions]}),(0,G.jsxs)(`span`,{className:`text-xs text-error shrink-0`,children:[`-`,e.deletions]})]},e.path))}):(0,G.jsx)(`div`,{className:`text-sm opacity-40 text-center py-4`,children:P||`No changes detected.`})]}),(0,G.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,G.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 text-left text-xs opacity-60 hover:opacity-100 hover:bg-base-200 transition-colors`,onClick:()=>v(e=>!e),children:[(0,G.jsx)(er,{className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Comandos manuais`}),(0,G.jsx)(`span`,{className:`text-[10px] opacity-50`,children:_?`▲`:`▼`})]}),_&&(0,G.jsxs)(`div`,{className:`px-3 pb-3 space-y-2 border-t border-base-300 pt-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Inspect only`}),(0,G.jsx)(Wr,{cmd:ee})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Test with hot reload (no commit)`}),(0,G.jsx)(Wr,{cmd:F})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Revert test`}),(0,G.jsx)(Wr,{cmd:`git reset --hard HEAD && git clean -fd`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-[10px] opacity-50 uppercase tracking-wide`,children:`Accept manually`}),(0,G.jsx)(Wr,{cmd:I})]})]})]}),h&&(0,G.jsxs)(`div`,{className:`alert alert-error text-xs py-2 gap-1.5`,children:[(0,G.jsx)(X,{className:`size-3.5 shrink-0`}),` `,h]}),d&&(0,G.jsxs)(`div`,{className:`border border-base-300 rounded-box p-4 space-y-3 bg-base-200`,children:[d===`merge`?(0,G.jsxs)(`p`,{className:`text-sm`,children:[`You are about to merge into`,` `,(0,G.jsx)(`span`,{className:`font-mono font-semibold`,children:A}),`. The worktree and branch will be removed after merge.`]}):(0,G.jsx)(`p`,{className:`text-sm`,children:`You are about to discard all changes from this issue. The worktree and branch will be removed permanently.`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{className:`btn btn-sm btn-ghost flex-1`,onClick:()=>f(null),disabled:p,children:`Cancel`}),(0,G.jsx)(`button`,{className:`btn btn-sm flex-1 ${d===`merge`?`btn-success`:`btn-error`}`,onClick:d===`merge`?E:D,disabled:p,children:p?(0,G.jsx)(J,{className:`size-4 animate-spin`}):d===`merge`?`Confirm merge`:`Confirm rollback`})]})]})]}),!d&&(0,G.jsxs)(`div`,{className:`px-5 py-4 border-t border-base-300 shrink-0 space-y-2`,children:[l?(0,G.jsxs)(`button`,{className:`btn btn-sm btn-warning btn-soft gap-1.5 w-full`,onClick:w,disabled:p,title:`git reset --hard HEAD && git clean -fd`,children:[p?(0,G.jsx)(J,{className:`size-3.5 animate-spin`}):(0,G.jsx)(ar,{className:`size-3.5`}),`Revert Test`]}):(0,G.jsxs)(`button`,{className:`btn btn-sm btn-info btn-soft gap-1.5 w-full`,onClick:C,disabled:p||!e.branchName,title:`Run git merge --squash on your workspace to test with hot reload without committing`,children:[p?(0,G.jsx)(J,{className:`size-3.5 animate-spin`}):(0,G.jsx)(sn,{className:`size-3.5`}),`Test Live`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-sm btn-error btn-soft gap-1.5 flex-1`,onClick:()=>{f(`rollback`),g(null)},disabled:p,children:[(0,G.jsx)(Y,{className:`size-3.5`}),` Reject & Rollback`]}),(0,G.jsxs)(`button`,{className:`btn btn-sm gap-1.5 flex-1 ${y?.willConflict?`btn-warning`:`btn-success`}`,onClick:()=>{f(`merge`),g(null)},disabled:p,children:[(0,G.jsx)(K,{className:`size-3.5`}),` `,y?.willConflict?`Merge (conflicts expected)`:`Approve & Merge`]})]})]})]})})}var Kr=`runtime.workflowConfig`;function qr(e){return!!e&&typeof e==`object`&&typeof e.provider==`string`&&typeof e.model==`string`&&typeof e.effort==`string`}function Jr(e){let t=Ie(Fe(e),Kr,null);return!t||typeof t!=`object`?null:qr(t.plan)&&qr(t.execute)&&qr(t.review)?t:null}function Yr(){let e=Jr(ze().data),t=v({queryKey:[`workflow-config`],queryFn:()=>B.get(`/config/workflow`),enabled:!e,staleTime:6e4});return{...t,data:e?{ok:!0,workflow:e,isDefault:!1}:t.data}}var Xr={Planning:wn,PendingApproval:Gt,Queued:En,Running:Ut,Reviewing:nn,PendingDecision:Vt,Blocked:X,Approved:Vt,Merged:K,Cancelled:Wt,Archived:Wt},Zr={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`},$r={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`},ei={bug:`badge-error`,feature:`badge-primary`,refactor:`badge-warning`,docs:`badge-info`,chore:`badge-secondary`},ti=[{id:`overview`,label:`Overview`,icon:bn,color:`text-info`,activeColor:`tab-active text-info`},{id:`planning`,label:`Plan`,icon:wn,color:`text-primary`,activeColor:`tab-active text-primary`},{id:`execution`,label:`Execution`,icon:er,color:`text-secondary`,activeColor:`tab-active text-secondary`},{id:`review`,label:`Review`,icon:Kt,color:`text-success`,activeColor:`tab-active text-success`},{id:`diff`,label:`Diff`,icon:Jt,color:`text-warning`,activeColor:`tab-active text-warning`},{id:`routing`,label:`Routing`,icon:Hn,color:`text-accent`,activeColor:`tab-active text-accent`},{id:`events`,label:`Events`,icon:Ct,color:`text-error`,activeColor:`tab-active text-error`}];function ni(e){return e===`Planning`||e===`PendingApproval`?`planning`:e===`Reviewing`||e===`PendingDecision`?`review`:`overview`}function ri(e){return{PendingApproval:0,Queued:1,Running:2,Reviewing:2,PendingDecision:3,Blocked:3,Approved:4,Merged:5,Cancelled:4}[e]??0}var ii=[{key:`plan`,label:`Plan`,icon:wn,states:[`Planning`]},{key:`execute`,label:`Execute`,icon:Ut,states:[`PendingApproval`,`Queued`,`Running`]},{key:`review`,label:`Review`,icon:nn,states:[`Reviewing`,`PendingDecision`]},{key:`done`,label:`Approved`,icon:Vt,states:[`Approved`]},{key:`merge`,label:`Merge`,icon:K,states:[`Merged`]}];function ai(e){return e.state===`Cancelled`?-1:e.state===`Merged`?4: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 oi({issue:e}){let t=ai(e),n=!!e.mergedAt||e.state===`Merged`;if(e.state===`Cancelled`)return null;let r=ii[t],i=n?`Merged`:r?.label;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 py-1.5`,children:[i&&(0,G.jsx)(`span`,{className:`text-[10px] shrink-0 font-medium ${n||e.state===`Approved`?`text-success`:`text-primary opacity-70`}`,children:i}),(0,G.jsx)(`div`,{className:`flex items-center flex-1 gap-0`,children:ii.map((r,i)=>{let a=i<t||i===t&&e.state===`Approved`,o=r.key===`merge`,s=o&&n,c=i===t&&e.state!==`Approved`||o&&e.state===`Approved`&&!n,l=a||s;return(0,G.jsxs)(U.Fragment,{children:[i>0&&(0,G.jsx)(`div`,{className:`flex-1 h-px transition-colors duration-300 ${l?`bg-success`:c?`bg-primary/30`:`bg-base-300`}`}),(0,G.jsx)(`div`,{title:r.label,className:[`size-2 rounded-full transition-all duration-300 shrink-0`,l?`bg-success`:``,c?`bg-primary ring-2 ring-primary/25 scale-[1.4]`:``,!l&&!c?`bg-base-300`:``].filter(Boolean).join(` `)})]},r.key)})})]})}function Z({title:e,icon:t,children:n,badge:r}){return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[t&&(0,G.jsx)(t,{className:`size-4 opacity-50`}),e,r!=null&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:r})]}),(0,G.jsx)(`div`,{children:n})]})}function Q({label:e,value:t,mono:n}){return t==null||t===``?null:(0,G.jsxs)(`div`,{className:`flex justify-between items-baseline gap-4 py-0.5`,children:[(0,G.jsx)(`span`,{className:`text-xs opacity-50 shrink-0`,children:e}),(0,G.jsx)(`span`,{className:`text-sm text-right truncate ${n?`font-mono text-xs`:``}`,children:t})]})}function si({text:e}){let[t,n]=(0,U.useState)(!1),r=(0,U.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return(0,G.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1 ${t?`text-success`:``}`,onClick:r,title:`Copy to clipboard`,children:[t?(0,G.jsx)(Ft,{className:`size-3 animate-bounce-in`}):(0,G.jsx)(Qt,{className:`size-3`}),t?(0,G.jsx)(`span`,{className:`animate-fade-in`,children:`Copied`}):`Copy`]})}function ci({config:e}){if(!e)return null;let{provider:t,model:n,effort:r}=e;return!t&&!n&&!r?null:(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[t&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,G.jsx)(er,{className:`size-2.5`}),t]}),n&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:n}),r&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:r})]})}var li={planner:`Plan`,executor:`Execute`,reviewer:`Review`},ui={planner:`text-info`,executor:`text-primary`,reviewer:`text-secondary`};function di({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,G.jsxs)(`div`,{className:`space-y-3`,children:[n.length>0&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[n.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`w-14 shrink-0 font-medium ${ui[e]||`text-base-content`}`,children:li[e]||e}),(0,G.jsxs)(`span`,{className:`opacity-50`,children:[i(t.totalTokens),` total`]}),(0,G.jsxs)(`span`,{className:`opacity-30 text-[10px]`,children:[i(t.inputTokens),`↑ `,i(t.outputTokens),`↓`]}),t.model&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono ml-auto`,children:t.model})]},e)),n.length>1&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs border-t border-base-300 pt-1 mt-1`,children:[(0,G.jsx)(`span`,{className:`w-14 shrink-0 font-semibold opacity-60`,children:`Total`}),(0,G.jsx)(`span`,{className:`font-semibold`,children:i(n.reduce((e,[,t])=>e+(t.totalTokens??0),0))})]})]}),r.length>0&&(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-40 mb-1`,children:`by model`}),r.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`font-mono opacity-70 truncate flex-1`,children:e}),(0,G.jsx)(`span`,{className:`opacity-50 shrink-0`,children:i(t.totalTokens)})]},e))]})]})}function fi({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,G.jsxs)(`div`,{className:`space-y-5`,children:[e.mergedReason&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 bg-success/10 border border-success/20 rounded-box px-3 py-2.5`,children:[(0,G.jsx)(K,{className:`size-3.5 text-success shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-success/70 mb-0.5`,children:`Merged`}),(0,G.jsx)(`div`,{className:`text-xs text-success/90`,children:e.mergedReason})]})]}),e.cancelledReason&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 bg-error/10 border border-error/20 rounded-box px-3 py-2.5`,children:[(0,G.jsx)(Nn,{className:`size-3.5 text-error shrink-0 mt-0.5`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-error/70 mb-0.5`,children:`Cancelled`}),(0,G.jsx)(`div`,{className:`text-xs text-error/90`,children:e.cancelledReason})]})]}),(0,G.jsx)(Z,{title:`Details`,icon:Cn,children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(Q,{label:`Attempts`,value:`${e.attempts??0} / ${e.maxAttempts??0}`}),e.branchName&&(0,G.jsx)(Q,{label:`Branch`,value:e.branchName,mono:!0}),e.baseBranch&&(0,G.jsx)(Q,{label:`Base branch`,value:e.baseBranch,mono:!0}),e.worktreePath&&(0,G.jsx)(Q,{label:`Code worktree`,value:e.worktreePath,mono:!0}),e.url&&(0,G.jsx)(Q,{label:`URL`,value:e.url,mono:!0}),(0,G.jsx)(Q,{label:`Created`,value:ne(e.createdAt)}),e.startedAt&&(0,G.jsx)(Q,{label:`Started`,value:ne(e.startedAt)}),e.completedAt&&(0,G.jsx)(Q,{label:`Completed`,value:ne(e.completedAt)}),e.nextRetryAt&&(0,G.jsx)(Q,{label:`Next retry`,value:ne(e.nextRetryAt)}),(0,G.jsx)(Q,{label:`Duration`,value:z(e.durationMs)}),e.tokenUsage?.totalTokens>0&&(0,G.jsx)(Q,{label:`Tokens`,value:`${e.tokenUsage.totalTokens.toLocaleString()}${e.tokenUsage.costUsd?` ($${e.tokenUsage.costUsd.toFixed(4)})`:``}`})]})}),i.length>0&&(0,G.jsx)(Z,{title:`Dependencies`,icon:Dt,badge:i.length,children:(0,G.jsx)(`div`,{className:`space-y-0.5`,children:i.map(e=>(0,G.jsx)(`div`,{className:`font-mono text-xs`,children:e},e))})}),(0,G.jsx)(Z,{title:`Actions`,icon:fr,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50 mb-1.5`,children:`Move to`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5 max-sm:flex-col`,children:a.map(n=>{let r=Xr[n]||Gt;return(0,G.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1.5 max-sm:w-full ${Qr[n]||``}`,onClick:()=>t?.(e.id,n),children:[(0,G.jsx)(r,{className:`size-3.5`}),n]},n)})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 max-sm:flex-col`,children:[(0,G.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,G.jsx)(Y,{className:`size-3`}),` Retry`]}),(0,G.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,G.jsx)(Wt,{className:`size-3`}),` Cancel`]})]})]})})]})}function pi({issueId:e,running:t,startedAt:n,onOutput:r}){let[i,a]=(0,U.useState)(null),o=(0,U.useCallback)(async()=>{try{let t=await B.get(`/live/${encodeURIComponent(e)}`);a(t),r?.(t?.logTail||``)}catch{}},[e]);if((0,U.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,G.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`loading loading-spinner loading-xs text-primary`}),(0,G.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`Agent running`}),(0,G.jsxs)(`span`,{className:`text-xs opacity-50 ml-auto`,children:[c,`m `,l,`s elapsed`]})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 text-xs opacity-60`,children:[(0,G.jsxs)(`span`,{children:[`Log: `,u,` KB`]}),i.agentPid&&(0,G.jsxs)(`span`,{children:[`PID: `,i.agentPid]}),i.agentAlive===!1&&i.agentPid&&(0,G.jsx)(`span`,{className:`text-error`,children:`process dead`})]})]})}function mi({issue:e,workflowConfig:t}){let n=e.state===`Running`||e.state===`Reviewing`,r=t?.workflow?.execute,[i,a]=(0,U.useState)(``),o=(0,U.useCallback)(e=>a(e||``),[]),s=n?i||e.commandOutputTail||``:e.commandOutputTail||``,c=!!s;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(pi,{issueId:e.id,running:n,startedAt:e.startedAt,onOutput:o}),r&&(0,G.jsx)(Z,{title:`Execution Config`,icon:qn,children:(0,G.jsx)(ci,{config:r})}),(0,G.jsx)(Z,{title:`Run Info`,icon:er,children:(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(Q,{label:`Exit code`,value:e.commandExitCode??`-`,mono:!0}),(0,G.jsx)(Q,{label:`Duration`,value:z(e.durationMs)}),e.workspacePath&&(0,G.jsx)(Q,{label:`Issue workspace root`,value:e.workspacePath,mono:!0}),e.worktreePath&&(0,G.jsx)(Q,{label:`Issue code checkout`,value:e.worktreePath,mono:!0}),e.workspacePreparedAt&&(0,G.jsx)(Q,{label:`Workspace prepared at`,value:ne(e.workspacePreparedAt)})]})}),e.lastError&&(0,G.jsx)(Z,{title:`Last Error`,icon:X,children:(0,G.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})}),c?(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,G.jsx)(er,{className:`size-4 opacity-50`}),` CLI Output`]}),(0,G.jsx)(si,{text:s})]}),(0,G.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-[50vh] overflow-y-auto`,children:s})]}):(0,G.jsx)(`div`,{className:`text-sm opacity-40 text-center py-4`,children:`No command output yet.`}),(e.tokensByPhase||e.tokensByModel)&&(0,G.jsx)(Z,{title:`Token Usage`,icon:mr,children:(0,G.jsx)(di,{tokensByPhase:e.tokensByPhase,tokensByModel:e.tokensByModel})}),!e.lastError&&!c&&!e.tokensByPhase&&!e.tokensByModel&&(0,G.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No execution data yet.`})]})}var hi={added:`badge-success`,removed:`badge-error`,modified:`badge-info`};function gi({file:e,isOpen:t,onToggle:n}){return(0,G.jsx)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:(0,G.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,G.jsx)(`span`,{className:`text-xs opacity-40 transition-transform`,style:{transform:t?`rotate(90deg)`:``},children:`▶`}),(0,G.jsx)(`span`,{className:`badge badge-xs ${hi[e.status]||`badge-ghost`}`,children:e.status}),(0,G.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:e.path}),(0,G.jsxs)(`span`,{className:`text-xs text-success`,children:[`+`,e.additions]}),(0,G.jsxs)(`span`,{className:`text-xs text-error`,children:[`-`,e.deletions]})]})})}function _i({lines:e}){return!e||e.length===0?null:(0,G.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,G.jsx)(`div`,{className:n,children:e||`\xA0`},t)})})}function vi({issueId:e}){let[t,n]=(0,U.useState)(null),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(null),l=(0,U.useCallback)(async()=>{i(!0),o(null);try{n(await B.get(`/diff/${encodeURIComponent(e)}`))}catch(e){o(e.message)}finally{i(!1)}},[e]);if((0,U.useEffect)(()=>{n(null),o(null),c(null)},[e]),(0,U.useEffect)(()=>{l()},[l]),r)return(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm opacity-50 py-12`,children:[(0,G.jsx)(`span`,{className:`loading loading-spinner loading-sm`}),` Loading changes...`]});if(a)return(0,G.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,G.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
42
|
`))}}return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,G.jsxs)(`span`,{className:`opacity-60`,children:[u.length,` file`,u.length===1?``:`s`,` changed`]}),(0,G.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,p]}),(0,G.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,m]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(si,{text:d}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1`,onClick:l,children:[(0,G.jsx)(Y,{className:`size-3`}),` Refresh`]})]})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>(0,G.jsx)(gi,{file:e,isOpen:s===e.path,onToggle:()=>c(s===e.path?null:e.path)},e.path))}),s&&h[s]&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:s}),(0,G.jsx)(_i,{lines:h[s]})]}),!s&&(0,G.jsxs)(`details`,{className:`group`,children:[(0,G.jsxs)(`summary`,{className:`text-xs opacity-50 cursor-pointer select-none list-none flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`transition-transform group-open:rotate-90`,children:`▶`}),`Show full diff`]}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(_i,{lines:d.split(`
|
|
43
43
|
`)})})]})]})}var yi=/^(\.fifony|fifony[-_]|WORKFLOW\.local)/;function bi(e){return(Array.isArray(e)?e:[]).filter(e=>!yi.test(e))}function xi({issue:e}){let t=bi(e.paths);return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(Z,{title:`State Machine`,icon:fn,children:(0,G.jsx)(`div`,{className:`space-y-1`,children:te.map(t=>{let n=t===e.state,r=Xr[t]||Gt,i=R[t]||[],a=ri(t)<ri(e.state);return(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg px-2 py-1.5 border text-sm ${n?$r[t]+` font-semibold`:a?`border-transparent opacity-40`:`border-transparent opacity-60`}`,children:[(0,G.jsx)(r,{className:`size-4 mt-0.5 shrink-0 ${n?Zr[t]:``}`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:t}),n&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`current`})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:i.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-xs opacity-50`,children:[(0,G.jsx)(Tt,{className:`size-2.5`}),e]},e))})]})]},t)})})}),t.length>0&&(0,G.jsx)(Z,{title:`Paths`,icon:ln,badge:t.length,children:(0,G.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>(0,G.jsx)(`div`,{className:`font-mono text-xs truncate`,children:e},e))})})]})}var Si=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],Ci={error:`badge-error`,state:`badge-primary`,progress:`badge-info`,manual:`badge-warning`,runner:`badge-accent`,info:`badge-ghost`},wi={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`},Ti=/([\d,]+)\s+tokens/gi,Ei=100;function Di(e,t){if(!e)return``;if(!t)return e;let n=[],r=0,i,a=new RegExp(Ti.source,`gi`);for(;(i=a.exec(e))!==null;)i.index>r&&n.push(e.slice(r,i.index)),n.push((0,G.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 Oi(e){if(!e)return null;for(let t of Object.keys(wi))if(e.includes(t))return t;return null}function ki({value:e}){let[,t]=(0,U.useState)(0);return(0,U.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),5e3);return()=>clearInterval(e)},[]),(0,G.jsx)(`span`,{title:ne(e),children:V(e)})}function Ai({ev:e}){let t=typeof e.message==`string`&&/tokens/i.test(e.message),n=e.kind===`state`,r=n?Oi(e.message):null,i=r?wi[r]:``;return(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box px-3 py-2 ${n?`border-l-[3px] ${i}`:``}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`opacity-50`,children:(0,G.jsx)(ki,{value:e.at})}),(0,G.jsx)(`span`,{className:`badge badge-xs ${Ci[e.kind]||`badge-ghost`}`,children:e.kind||`info`}),n&&(0,G.jsx)(Tt,{className:`size-3 opacity-50`}),t&&(0,G.jsx)(mr,{className:`size-3 text-warning`})]}),(0,G.jsx)(`div`,{className:`text-sm mt-0.5`,children:Di(e.message,t)})]})}function ji({issueId:e,events:t}){let[n,r]=(0,U.useState)(`all`),i=(0,U.useRef)(null),[a,o]=(0,U.useState)(!0),[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(0),u=(0,U.useMemo)(()=>Array.isArray(t)?t.filter(t=>t.issueId===e&&(n===`all`||t.kind===n)).slice(0,200):[],[t,e,n]),d=(0,U.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<Ei;o(t),t&&c(!1)},[]);(0,U.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,U.useCallback)(()=>{i.current?.scrollTo({top:i.current.scrollHeight,behavior:`smooth`}),c(!1)},[]);return(0,G.jsxs)(`div`,{className:`flex flex-col h-full -mx-6 -my-4`,children:[(0,G.jsxs)(`div`,{className:`px-5 py-2.5 border-b border-base-300 flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(qn,{className:`size-3.5 opacity-50`}),(0,G.jsx)(`select`,{className:`select select-bordered select-xs`,value:n,onChange:e=>r(e.target.value),"aria-label":`Filter by event kind`,children:Si.map(e=>(0,G.jsx)(`option`,{value:e,children:e===`all`?`All kinds`:e.charAt(0).toUpperCase()+e.slice(1)},e))}),u.length>0&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-neutral ml-auto`,children:u.length})]}),(0,G.jsx)(`div`,{ref:i,className:`flex-1 overflow-y-auto px-5 py-3 relative`,onScroll:d,children:u.length===0?(0,G.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No events for this issue yet.`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:u.map((e,t)=>(0,G.jsx)(Ai,{ev:e},`${e.at}-${t}`))})}),s&&(0,G.jsx)(`div`,{className:`absolute bottom-16 left-1/2 -translate-x-1/2 z-10`,children:(0,G.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-primary rounded-full shadow-lg animate-fade-in-up gap-1`,onClick:f,children:[(0,G.jsx)(It,{className:`size-3`}),` New events`]})})]})}var Mi={trivial:`badge-ghost`,low:`badge-success`,medium:`badge-warning`,high:`badge-error`};function Ni({issue:e,onStateChange:t,workflowConfig:n}){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(0),[y,b]=(0,U.useState)(!1),x=(0,U.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,U.useEffect)(()=>{e.planningError&&o(null)},[e.planningError]),(0,U.useEffect)(()=>{s&&(S||e.planningError)&&c(!1)},[s,S,e.planningError]),(0,U.useEffect)(()=>{l&&(e.planningStatus!==`planning`||e.planningError)&&u(!1)},[l,e.planningStatus,e.planningError]),(0,U.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,U.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,U.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 B.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 B.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 B.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 B.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,G.jsxs)(`div`,{className:`space-y-4 py-4`,children:[N&&(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`loading loading-dots loading-sm text-info`}),(0,G.jsx)(`span`,{className:`text-sm opacity-60`,children:`Queued — waiting for the planner worker...`})]}),(0,G.jsx)(`div`,{className:`text-xs opacity-30`,children:`The plan will be generated automatically shortly.`}),(0,G.jsx)(`div`,{className:`flex items-center gap-2 mt-2`,children:(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1 opacity-50 hover:opacity-100`,onClick:()=>P(!1),children:[(0,G.jsx)(mr,{className:`size-3`}),` Generate now`]})})]}),O&&(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`alert alert-error text-sm flex-col items-start gap-1`,children:[(0,G.jsxs)(`div`,{className:`font-medium flex items-center gap-1.5`,children:[(0,G.jsx)(X,{className:`size-4`}),` Plan generation failed`]}),(0,G.jsx)(`div`,{className:`text-xs opacity-80`,children:O})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1.5`,onClick:()=>P(!1),children:[(0,G.jsx)(Y,{className:`size-3.5`}),` Try again`]}),(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1`,onClick:()=>P(!0),children:[(0,G.jsx)(mr,{className:`size-3.5`}),` Fast`]})]})]})]}):(0,G.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium opacity-70`,children:`No plan yet`}),(0,G.jsx)(`p`,{className:`text-xs opacity-40`,children:`Generate an AI plan to break this issue into actionable steps.`})]}),O&&(0,G.jsx)(`div`,{className:`alert alert-error text-sm`,children:O})]});if(A&&!S){let e=_>0?z(_*1e3):``;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-12`,children:[(0,G.jsx)(J,{className:`size-8 animate-spin text-primary`}),(0,G.jsx)(`div`,{className:`text-sm opacity-60`,children:`Generating execution plan...`}),(0,G.jsx)(`div`,{className:`text-xs opacity-30`,children:`This may take a few minutes`}),e&&(0,G.jsxs)(`div`,{className:`text-xs font-mono opacity-40`,children:[e,` elapsed`]})]})}return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[M&&(0,G.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 flex items-center gap-3`,children:[(0,G.jsx)(J,{className:`size-4 animate-spin text-primary shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`span`,{className:`text-sm text-primary font-medium`,children:A?`Re-generating plan...`:`Refining to v${w+2}...`}),_>0&&(0,G.jsx)(`span`,{className:`text-xs text-primary/60 ml-2 font-mono`,children:z(_*1e3)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsxs)(`span`,{className:`badge badge-sm ${Mi[S.estimatedComplexity]||`badge-ghost`}`,children:[S.estimatedComplexity,` complexity`]}),E>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-info badge-soft font-mono`,children:[`Plan v`,E]}),w>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,G.jsx)(Y,{className:`size-2.5`}),` Refined ×`,w]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[n?.workflow?.plan&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs opacity-60`,children:[(0,G.jsx)(qn,{className:`size-3 shrink-0`}),(0,G.jsx)(ci,{config:n.workflow.plan})]}),e.tokensByPhase?.planner?.totalTokens>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs opacity-50`,children:[(0,G.jsx)(mr,{className:`size-3`}),(0,G.jsxs)(`span`,{children:[e.tokensByPhase.planner.totalTokens.toLocaleString(),` tokens`]})]})]}),w>0&&(0,G.jsxs)(`div`,{className:`rounded-box border-l-4 border-secondary bg-secondary/5 px-4 py-3 animate-fade-in`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider opacity-40 mb-1`,children:`Last refinement feedback`}),(0,G.jsxs)(`p`,{className:`text-sm leading-relaxed italic opacity-80`,children:[`“`,S.refinements[w-1].feedback,`”`]}),(0,G.jsxs)(`span`,{className:`text-[10px] opacity-30 mt-1 block`,children:[`v`,S.refinements[w-1].version||w+1,` · `,V(S.refinements[w-1].at)]})]}),(0,G.jsxs)(`div`,{className:`space-y-5 animate-fade-in`,children:[(0,G.jsx)(Z,{title:`Summary`,icon:bn,children:(0,G.jsx)(`p`,{className:`text-sm leading-relaxed`,children:S.summary})}),S.phases?.length>0&&(0,G.jsx)(Z,{title:`Phases (${S.phases.length})`,icon:Cn,children:(0,G.jsx)(`div`,{className:`space-y-3`,children:S.phases.map((e,t)=>(0,G.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`bg-base-200 px-3 py-2 flex items-center gap-2`,children:[(0,G.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,G.jsx)(`span`,{className:`text-sm font-semibold`,children:e.phaseName}),e.tasks?.length>0&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:[e.tasks.length,` tasks`]})]}),e.goal&&(0,G.jsx)(`div`,{className:`px-3 pt-2 text-xs opacity-60`,children:e.goal}),e.tasks?.length>0&&(0,G.jsx)(`div`,{className:`px-3 pb-2 pt-1.5 space-y-1.5`,children:e.tasks.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,G.jsxs)(`span`,{className:`opacity-30 shrink-0 font-mono w-4`,children:[e.step,`.`]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:e.action}),e.details&&(0,G.jsxs)(`span`,{className:`opacity-50 ml-1`,children:[`— `,e.details]})]})]},t))}),e.outputs?.length>0&&(0,G.jsx)(`div`,{className:`px-3 pb-2 flex flex-wrap gap-1`,children:e.outputs.map(e=>(0,G.jsx)(`span`,{className:`badge badge-xs badge-outline opacity-60`,children:e},e))})]},t))})}),(0,G.jsx)(Z,{title:`Steps (${S.steps.length})`,icon:En,children:(0,G.jsx)(`div`,{className:`space-y-2`,children:S.steps.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex gap-3 p-3 bg-base-200 rounded-box`,children:[(0,G.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,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:e.action}),e.details&&(0,G.jsx)(`div`,{className:`text-xs opacity-50 mt-0.5`,children:e.details}),e.files?.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.files.map(e=>(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:e},e))})]})]},t))})})]},`plan-content-${w}`),S.suggestedPaths?.length>0&&(0,G.jsx)(Z,{title:`Suggested Paths`,icon:ln,children:(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:S.suggestedPaths.map(e=>(0,G.jsx)(`span`,{className:`badge badge-sm badge-ghost font-mono`,children:e},e))})}),w>0&&(0,G.jsx)(Z,{title:`Refinements (${w})`,icon:kn,children:(0,G.jsx)(`div`,{className:`space-y-2`,children:(()=>{let e=S.refinements,t=!y&&e.length>2,n=t?e.slice(-2):e;return(0,G.jsxs)(G.Fragment,{children:[t&&(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>b(!0),children:[(0,G.jsx)(It,{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,G.jsxs)(`div`,{className:`flex gap-3 p-2.5 bg-base-200 rounded-box text-sm animate-fade-in`,children:[(0,G.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,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`p`,{className:`text-sm leading-relaxed`,children:n.feedback}),(0,G.jsx)(`span`,{className:`text-[10px] opacity-40 mt-1 block`,children:V(n.at)})]})]},i)}),y&&e.length>2&&(0,G.jsx)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>b(!1),children:`Show less`})]})})()})}),T.length>0&&(0,G.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,G.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,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Y,{className:`size-3.5 opacity-60`}),`Plan History (`,T.length,` previous)`]}),(0,G.jsx)(It,{className:`size-3.5 opacity-60 transition-transform ${h?`rotate-180`:``}`})]}),h&&(0,G.jsx)(`div`,{className:`divide-y divide-base-300`,children:T.map((e,t)=>(0,G.jsxs)(`div`,{className:`px-3 py-2.5 space-y-1 text-xs`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 opacity-60`,children:[(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`v`,t+1]}),(0,G.jsxs)(`span`,{children:[e.steps?.length??0,` steps`]}),(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.estimatedComplexity}),(0,G.jsx)(`span`,{className:`ml-auto`,children:V(e.createdAt)})]}),(0,G.jsx)(`p`,{className:`opacity-70 leading-relaxed line-clamp-2`,children:e.summary})]},t))})]}),C&&S&&(0,G.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`text-xs font-semibold flex items-center gap-1.5 opacity-70`,children:[(0,G.jsx)(kn,{className:`size-3.5`}),`Refine Plan`]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.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,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{className:`btn btn-secondary btn-sm gap-1.5`,onClick:I,disabled:M||!r.trim(),children:j?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{className:`size-3.5 animate-spin`}),` Generating v`,w+2,`...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`size-3.5`}),` Refine Plan`]})}),(0,G.jsx)(`span`,{className:`text-[10px] opacity-30`,children:`Ctrl+Enter to send`})]})]}),O&&(0,G.jsx)(`div`,{className:`alert alert-error text-sm`,children:O}),C&&!M&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-3 border-t border-base-300 max-sm:flex-col`,children:[(0,G.jsx)(`button`,{className:`btn btn-primary gap-1.5 max-sm:w-full`,onClick:F,disabled:d||!S,children:d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{className:`size-4 animate-spin`}),` Starting...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vt,{className:`size-4`}),` Approve & Start`]})}),S&&(0,G.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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{className:`size-3 animate-spin`}),` Replanning...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{className:`size-3`}),` Replan`]})})]})]})}function Pi({issue:e,issueId:t,onStateChange:n,onRetry:r}){let[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(e.images??[]),[g,_]=(0,U.useState)(!1),v=(0,U.useRef)(null),y=(0,U.useCallback)(async()=>{s(!0);try{a(await B.get(`/diff/${encodeURIComponent(t)}`))}catch{a(null)}finally{s(!1)}},[t]);(0,U.useEffect)(()=>{a(null),d(null),l(``),p(null),h(e.images??[])},[t]),(0,U.useEffect)(()=>{y()},[y]);let b=(0,U.useCallback)(async e=>{if(e.length){_(!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 B.post(`/issues/${encodeURIComponent(t)}/images`,{files:n});r.ok&&r.paths&&h(e=>[...e,...r.paths])}catch{}finally{_(!1),v.current&&(v.current.value=``)}}},[t]),x=e.state===`Reviewing`||e.state===`PendingDecision`,S=e.state===`Approved`;(0,U.useEffect)(()=>{if(!x)return;let e=e=>{let t=Array.from(e.clipboardData?.items??[]).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(Boolean);t.length&&b(t)};return window.addEventListener(`paste`,e),()=>window.removeEventListener(`paste`,e)},[x,b]);let C=i?.files||[],w=i?.diff||``,T={};if(w)for(let e of w.split(/(?=^diff --git )/m)){let t=e.match(/^diff --git a\/(.+?) b\//);t&&(T[t[1]]=e.split(`
|
|
44
|
-
`))}let E=()=>{d(`approved`),n?.(e.id,`Approved`)},D=()=>{d(`rework`),r?.(e.id)},O=()=>{d(`rejected`),n?.(e.id,`Blocked`)},k=e.mergeResult,A=!!e.mergedAt;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[A&&(0,G.jsxs)(`div`,{className:`alert border text-sm ${k?.conflicts>0?`border-warning/30 bg-warning/5`:`border-success/30 bg-success/5`}`,children:[(0,G.jsx)(K,{className:`size-4 shrink-0 ${k?.conflicts>0?`text-warning`:`text-success`}`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Code merged to project root`}),k&&(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` — `,k.copied,` file`,k.copied===1?``:`s`,` copied`,k.deleted>0?`, ${k.deleted} deleted`:``]}),k?.conflicts>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-warning font-medium mt-0.5`,children:[`Merge aborted — `,k.conflicts,` file`,k.conflicts===1?``:`s`,` had conflicts. No changes were applied.`]}),k.conflictFiles?.length>0&&(0,G.jsx)(`ul`,{className:`text-xs text-warning/80 mt-1 ml-4 list-disc space-y-0.5`,children:k.conflictFiles.map(e=>(0,G.jsx)(`li`,{className:`font-mono`,children:e},e))})]}),(!k?.conflicts||k.conflicts===0)&&(0,G.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`The approved branch has been integrated into the current project branch.`})]})]}),e.prUrl&&(0,G.jsxs)(`div`,{className:`alert border border-primary/30 bg-primary/5 text-sm`,children:[(0,G.jsx)(tn,{className:`size-4 shrink-0 text-primary`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Pull request created`}),(0,G.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})]})]}),!A&&S&&k?.conflicts>0&&(0,G.jsxs)(`div`,{className:`alert border border-warning/30 bg-warning/5 text-sm`,children:[(0,G.jsx)(X,{className:`size-4 shrink-0 text-warning`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Merge failed due to conflicts`}),(0,G.jsxs)(`p`,{className:`text-xs opacity-70 mt-0.5`,children:[`The branch `,e.branchName?(0,G.jsx)(`span`,{className:`font-mono`,children:e.branchName}):``,` could not be merged because `,k.conflicts,` file`,k.conflicts===1?``:`s`,` diverged from the base branch. You can send it back for rework so the agent resolves the conflicts.`]}),k.conflictFiles?.length>0&&(0,G.jsx)(`ul`,{className:`text-xs opacity-60 mt-1 ml-4 list-disc space-y-0.5`,children:k.conflictFiles.map(e=>(0,G.jsx)(`li`,{className:`font-mono`,children:e},e))}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-warning gap-1 mt-2`,onClick:()=>r?.(e.id),children:[(0,G.jsx)(Y,{className:`size-3`}),` Requeue for Rework`]})]})]}),!A&&S&&(!k||k.conflicts===0)&&(0,G.jsxs)(`div`,{className:`alert border border-info/30 bg-info/5 text-sm`,children:[(0,G.jsx)(fn,{className:`size-4 shrink-0 text-info`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Review approved, merge still pending`}),(0,G.jsxs)(`p`,{className:`text-xs opacity-70 mt-0.5`,children:[`The code is still isolated on `,e.branchName?(0,G.jsx)(`span`,{className:`font-mono`,children:e.branchName}):`the issue branch`,` and in the worktree until you run Merge.`]})]})]}),S&&(0,G.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,G.jsx)(Vt,{className:`size-4`}),` This issue has been approved.`]}),e.state===`Blocked`&&(0,G.jsxs)(`div`,{className:`alert alert-error text-sm`,children:[(0,G.jsx)(X,{className:`size-4`}),` Review failed. Check execution output.`]}),u===`approved`&&x&&(0,G.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,G.jsx)(nr,{className:`size-4`}),` Approved! Moving to Approved.`]}),u===`rework`&&(0,G.jsxs)(`div`,{className:`alert alert-warning text-sm`,children:[(0,G.jsx)(Y,{className:`size-4`}),` Sent back for rework.`]}),x&&!u&&(0,G.jsx)(Z,{title:`Review Checklist`,icon:Kt,children:(0,G.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,G.jsx)(`p`,{className:`opacity-60`,children:`Before deciding, consider:`}),(0,G.jsxs)(`ul`,{className:`list-disc ml-5 space-y-1 opacity-80`,children:[(0,G.jsx)(`li`,{children:`Does the diff address the issue title and description?`}),(0,G.jsx)(`li`,{children:`Are there unintended side effects or regressions?`}),(0,G.jsx)(`li`,{children:`Is the scope appropriate — no unnecessary changes?`}),(0,G.jsx)(`li`,{children:`Are there files that shouldn't have been modified?`})]})]})}),(0,G.jsx)(Z,{title:`Changes`,icon:Jt,children:o?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-4`,children:[(0,G.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),` Loading changes...`]}):C.length>0?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,G.jsxs)(`span`,{className:`opacity-60`,children:[C.length,` file`,C.length===1?``:`s`]}),(0,G.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,i?.totalAdditions||0]}),(0,G.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,i?.totalDeletions||0]})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:C.map(e=>(0,G.jsx)(gi,{file:e,isOpen:f===e.path,onToggle:()=>p(f===e.path?null:e.path)},e.path))}),f&&T[f]&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:f}),(0,G.jsx)(_i,{lines:T[f]})]})]}):(0,G.jsx)(`div`,{className:`text-sm opacity-40 py-4`,children:`No changes detected.`})}),(e.lastError||e.commandOutputTail)&&(0,G.jsxs)(Z,{title:`Agent Output`,icon:er,children:[e.lastError&&(0,G.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-2`,children:e.lastError}),e.commandOutputTail&&!e.lastError&&(0,G.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto`,children:e.commandOutputTail})]}),(x||S)&&(0,G.jsxs)(Z,{title:`Evidence`,icon:vn,children:[(0,G.jsx)(`input`,{ref:v,type:`file`,multiple:!0,accept:`image/*`,className:`hidden`,onChange:e=>b(Array.from(e.target.files??[]))}),m.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map((e,n)=>{let r=e.split(`/`).pop(),i=`/api/issues/${encodeURIComponent(t)}/images/${encodeURIComponent(r)}`;return(0,G.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`block`,children:(0,G.jsx)(`img`,{src:i,alt:r,className:`size-20 object-cover rounded-lg border border-base-300 hover:opacity-80 transition-opacity`})},n)})}):(0,G.jsx)(`p`,{className:`text-xs opacity-40`,children:`No screenshots attached yet.`}),x&&(0,G.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-ghost gap-1 mt-2`,onClick:()=>v.current?.click(),disabled:g,children:[g?(0,G.jsx)(J,{className:`size-3 animate-spin`}):(0,G.jsx)(In,{className:`size-3`}),`Attach Screenshot`]})]}),x&&!u&&(0,G.jsx)(Z,{title:`Review Note`,icon:er,children:(0,G.jsx)(`textarea`,{className:`textarea textarea-bordered w-full text-sm`,rows:3,placeholder:`Optional: leave a note about your decision...`,value:c,onChange:e=>l(e.target.value)})}),x&&!u&&(0,G.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold`,children:`Verdict`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:E,children:[(0,G.jsx)(nr,{className:`size-4`}),` Approve`]}),(0,G.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:D,children:[(0,G.jsx)(Y,{className:`size-4`}),` Request Rework`]}),(0,G.jsxs)(`button`,{className:`btn btn-error btn-sm gap-1.5 flex-1`,onClick:O,children:[(0,G.jsx)(tr,{className:`size-4`}),` Reject`]})]}),(0,G.jsxs)(`p`,{className:`text-xs opacity-40`,children:[(0,G.jsx)(`strong`,{children:`Approve`}),` moves to Approved. `,(0,G.jsx)(`strong`,{children:`Rework`}),` sends back to executor. `,(0,G.jsx)(`strong`,{children:`Reject`}),` blocks the issue.`]})]})]})}function Fi({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,U.useState)(!1),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(!1),g=(0,U.useCallback)(async()=>{d(!0),p(null);try{let t=await B.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]),_=e.state===`Planning`,v=e.state===`PendingApproval`,y=e.state===`Running`||e.state===`Queued`,b=e.state===`Reviewing`||e.state===`PendingDecision`,x=e.state===`Approved`,S=e.state===`Merged`,C=!!e.mergedAt||S;return _?null:v?(0,G.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-1.5`,style:l,children:[f&&(0,G.jsxs)(`div`,{className:`alert alert-error text-xs py-1.5`,children:[(0,G.jsx)(X,{className:`size-3.5`}),` `,f]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsx)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1`,onClick:g,disabled:u,children:u?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{className:`size-4 animate-spin`}),` Starting...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ut,{className:`size-4`}),` Execute`]})})})]}):y?(0,G.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,G.jsx)(`span`,{className:`issue-phase-dot`}),(0,G.jsx)(`span`,{className:`text-sm opacity-50`,children:`Watching...`})]}):b?(0,G.jsxs)(G.Fragment,{children:[m&&(0,G.jsx)(Gr,{issue:e,onClose:()=>h(!1)}),(0,G.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-1.5`,style:l,children:[(0,G.jsxs)(`button`,{className:`btn btn-primary btn-sm btn-soft gap-1.5 w-full`,onClick:()=>h(!0),children:[(0,G.jsx)(nn,{className:`size-3.5`}),` Preview Changes`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Approved`),children:[(0,G.jsx)(nr,{className:`size-4`}),` Approve`]}),(0,G.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:()=>n?.(e.id),children:[(0,G.jsx)(Y,{className:`size-4`}),` Rework`]})]})]})]}):x&&!C?(0,G.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-2`,style:l,children:[o&&(0,G.jsxs)(`div`,{className:`alert alert-error text-sm py-2`,children:[(0,G.jsx)(X,{className:`size-4`}),` `,o]}),s&&!o&&(0,G.jsxs)(`div`,{className:`alert alert-success text-sm py-2`,children:[(0,G.jsx)(`span`,{className:`size-4`}),` `,s]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:c===`push-pr`?(0,G.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,G.jsx)(J,{className:`size-4 animate-spin`}):(0,G.jsx)(mn,{className:`size-4`}),a?`Pushing...`:e.baseBranch?(0,G.jsxs)(G.Fragment,{children:[`Push PR → `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Push & Open PR`]}):(0,G.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,G.jsx)(J,{className:`size-4 animate-spin`}):(0,G.jsx)(K,{className:`size-4`}),a?`Merging...`:e.baseBranch?(0,G.jsxs)(G.Fragment,{children:[`Merge → `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Merge to Project`]})})]}):null}function Ii({issue:e,onClose:t,onStateChange:n,onRetry:r,onCancel:i,events:a,mergeMode:o,tabRef:s}){let[c,l]=(0,U.useState)(`overview`),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(null),w=(0,U.useRef)(null),{data:T}=Yr(),E=(0,U.useCallback)(async()=>{if(!(!e?.id||b)){x(!0),C(null);try{let t=await B.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,U.useCallback)(()=>{p(!0),setTimeout(()=>{d(!1),p(!1),t()},250)},[t]),{ref:O,handlers:k}=Nr({onDismiss:D,direction:`right`});(0,U.useEffect)(()=>{e&&l(ni(e.state))},[e?.id]),(0,U.useEffect)(()=>{s&&(s.current={get:()=>c,set:e=>l(e)})},[s,c]),(0,U.useEffect)(()=>{h(!1),_(null),y(null),e&&(d(!0),p(!1))},[e?.id,e?.state]);let A=(0,U.useCallback)(async()=>{if(!(!e?.id||m)){h(!0),_(null),y(null);try{let t=await B.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,U.useCallback)(async()=>{if(!(!e?.id||m)){h(!0),_(null),y(null);try{let t=await B.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,U.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,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/35 ${f?`animate-fade-out`:`animate-fade-in`}`,onClick:D,children:(0,G.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,G.jsxs)(`div`,{className:`px-6 pt-4 pb-0 shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-40 shrink-0`,children:e.identifier}),e.baseBranch&&(0,G.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,G.jsx)(K,{className:`size-2.5`}),e.baseBranch]}),e.state!==`Planning`&&e.plan&&![`Running`,`Reviewing`,`Queued`].includes(e.state)&&(0,G.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,G.jsx)(J,{className:`size-3 animate-spin`}):(0,G.jsx)(Y,{className:`size-3`}),`Replan`]}),S&&(0,G.jsx)(`span`,{className:`text-xs text-error truncate`,children:S})]}),(0,G.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle shrink-0`,onClick:D,"aria-label":`Close`,children:(0,G.jsx)(pr,{className:`size-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 mb-1`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-bold leading-tight flex-1`,children:e.title||`-`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 mt-0.5 flex-wrap justify-end`,children:[e.issueType&&ei[e.issueType]&&(0,G.jsx)(`span`,{className:`badge badge-sm ${ei[e.issueType]} badge-soft`,children:e.issueType}),(e.planVersion??0)>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-info badge-soft font-mono`,children:[`Plan v`,e.planVersion]}),(e.executeAttempt??0)>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-ghost font-mono opacity-60`,children:[`exec v`,e.planVersion??1,`a`,e.executeAttempt]})]})]}),e.description&&(0,G.jsx)(`p`,{className:`text-xs opacity-45 leading-relaxed mb-1 line-clamp-2`,children:e.description}),(0,G.jsx)(oi,{issue:e}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.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:ti.map(({id:t,label:n,icon:r,color:i,activeColor:a})=>{let o=c===t,s=o?a.replace(`tab-active `,``):i;return(0,G.jsxs)(`a`,{role:`tab`,className:`tab gap-1 text-xs whitespace-nowrap ${o?a:i} ${o?`font-semibold`:``}`,onClick:()=>l(t),children:[(0,G.jsx)(r,{className:`size-3 ${s}`}),n,t===`review`&&(e.state===`Reviewing`||e.state===`PendingDecision`)&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-secondary`,children:`!`}),t===`planning`&&e.planningStatus===`planning`&&(0,G.jsx)(`span`,{className:`loading loading-spinner loading-xs text-info`}),t===`planning`&&M&&(0,G.jsx)(`span`,{className:`loading loading-dots loading-xs text-info opacity-50`})]},t)})}),(0,G.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,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4 min-h-0 drawer-safe-bottom`,children:(0,G.jsxs)(`div`,{className:`animate-fade-in`,children:[c===`overview`&&(0,G.jsx)(fi,{issue:e,onStateChange:n,onRetry:r,onCancel:i}),c===`planning`&&(0,G.jsx)(Ni,{issue:e,onStateChange:n,workflowConfig:T}),c===`review`&&(0,G.jsx)(Pi,{issue:e,issueId:e.id,onStateChange:n,onRetry:r}),c===`execution`&&(0,G.jsx)(mi,{issue:e,workflowConfig:T}),c===`diff`&&(0,G.jsx)(vi,{issueId:e.id}),c===`routing`&&(0,G.jsx)(xi,{issue:e}),c===`events`&&(0,G.jsx)(ji,{issueId:e.id,events:a})]},c)}),(0,G.jsx)(Fi,{issue:e,onStateChange:n,onRetry:r,onMerge:A,onPush:j,mergeBusy:m,mergeError:g,mergeNotice:v,mergeMode:o})]})})}function Li({pwa:e}){return e?e.updateAvailable?(0,G.jsxs)(`div`,{className:`alert alert-info rounded-none border-x-0`,children:[(0,G.jsx)(Vn,{className:`size-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:`A fresh dashboard build is ready.`}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>e.applyUpdate(),children:`Reload app`})]}):e.isOnline?null:(0,G.jsxs)(`div`,{className:`alert alert-warning rounded-none border-x-0`,children:[(0,G.jsx)(lr,{className:`size-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:`You are offline. The app shell is available, but live runtime data may be stale.`})]}):null}var Ri=[`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 zi(e,t){return Math.random()*(t-e)+e}function Bi({color:e,style:t}){return(0,G.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 Vi({x:e=`50%`,y:t=`50%`,active:n,onDone:r,count:i=24}){let[a,o]=(0,U.useState)([]),s=(0,U.useRef)(r);(0,U.useEffect)(()=>{s.current=r},[r]);let c=(0,U.useCallback)(()=>{let e=Array.from({length:i},(e,t)=>{let n=Math.PI*2*t/i+zi(-.3,.3),r=zi(40,120),a=zi(4,8);return{id:t,color:Ri[t%Ri.length],size:a,x:0,y:0,tx:`${Math.cos(n)*r}px`,ty:`${Math.sin(n)*r-zi(20,60)}px`,r:`${zi(-180,180)}deg`,duration:zi(600,1e3)}});o(e);let t=Math.max(...e.map(e=>e.duration));setTimeout(()=>{o([]),s.current?.()},t+50)},[i]);return(0,U.useEffect)(()=>{n&&c()},[n,c]),a.length===0?null:(0,G.jsx)(`div`,{className:`fixed pointer-events-none z-[100]`,style:{left:e,top:t,transform:`translate(-50%, -50%)`},children:a.map(e=>(0,G.jsx)(Bi,{color:e.color,style:e},e.id))})}var Hi=[`shift`,`alt`,`meta`,`mod`,`ctrl`,`control`],Ui={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 Wi(e){return(Ui[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,``)}function Gi(e){return Hi.includes(e)}function Ki(e,t=`,`){return e.toLowerCase().split(t)}function qi(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=>Wi(e))):o=e.toLocaleLowerCase().split(t).map(e=>Wi(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=>!Hi.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&&Zi([Wi(e.code)])}),document.addEventListener(`keyup`,e=>{e.code!==void 0&&Qi([Wi(e.code)])})),typeof window<`u`&&(window.addEventListener(`blur`,()=>{Ji.clear()}),window.addEventListener(`contextmenu`,()=>{setTimeout(()=>{Ji.clear()},0)}));var Ji=new Set;function Yi(e){return Array.isArray(e)}function Xi(e,t=`,`){return(Yi(e)?e:e.split(t)).every(e=>Ji.has(e.trim().toLowerCase()))}function Zi(e){let t=Array.isArray(e)?e:[e];Ji.has(`meta`)&&Ji.forEach(e=>{Gi(e)||Ji.delete(e.toLowerCase())}),t.forEach(e=>{Ji.add(e.toLowerCase())})}function Qi(e){e===`meta`?Ji.clear():(Array.isArray(e)?e:[e]).forEach(e=>{Ji.delete(e.toLowerCase())})}function $i(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function ea(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}var ta=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`];function na(e){return ra(e,ta)}function ra(e,t=!1){let{target:n,composed:r}=e,i,a;return ia(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),Yi(t)?!!(i&&t&&t.some(e=>e.toLowerCase()===i.toLowerCase()||e===a)):!!(i&&t&&t)}function ia(e){return!!e.tagName&&!e.tagName.startsWith(`-`)&&e.tagName.includes(`-`)}function aa(e,t){return e.length===0&&t?!1:t?e.some(e=>t.includes(e))||e.includes(`*`):!0}var oa=(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=Wi(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)?Xi(c):!1:!c||c.length===0},sa=(0,U.createContext)(void 0),ca=()=>(0,U.useContext)(sa);function la({addHotkey:e,removeHotkey:t,children:n}){return(0,G.jsx)(sa.Provider,{value:{addHotkey:e,removeHotkey:t},children:n})}function ua(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&&ua(e[r],t[r]),!0):e===t}var da=(0,U.createContext)({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),fa=()=>(0,U.useContext)(da),pa=({initiallyActiveScopes:e=[`*`],children:t})=>{let[n,r]=(0,U.useState)(e),[i,a]=(0,U.useState)([]),o=(0,U.useCallback)(e=>{r(t=>t.includes(`*`)?[e]:Array.from(new Set([...t,e])))},[]),s=(0,U.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]),c=(0,U.useCallback)(e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):t.includes(`*`)?[e]:Array.from(new Set([...t,e])))},[]),l=(0,U.useCallback)(e=>{a(t=>[...t,e])},[]),u=(0,U.useCallback)(e=>{a(t=>t.filter(t=>!ua(t,e)))},[]);return(0,G.jsx)(da.Provider,{value:{activeScopes:n,hotkeys:i,enableScope:o,disableScope:s,toggleScope:c},children:(0,G.jsx)(la,{addHotkey:l,removeHotkey:u,children:t})})};function ma(e){let t=(0,U.useRef)(void 0);return ua(t.current,e)||(t.current=e),t.current}var ha=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},ga=typeof window<`u`?U.useLayoutEffect:U.useEffect;function $(e,t,n,r){let i=(0,U.useRef)(null),a=(0,U.useRef)(!1),o=Array.isArray(n)?Array.isArray(r)?void 0:r:n,s=Yi(e)?e.join(o?.delimiter):e,c=Array.isArray(n)?n:Array.isArray(r)?r:void 0,l=(0,U.useCallback)(t,c??[]),u=(0,U.useRef)(l);c?u.current=l:u.current=t;let d=ma(o),{activeScopes:f}=fa(),p=ca();return ga(()=>{if(d?.enabled===!1||!aa(f,d?.scopes))return;let e=[],t,n=(n,r=!1)=>{if(!(na(n)&&!ra(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)){ha(n);return}}n.target?.isContentEditable&&!d?.enableOnContentEditable||Ki(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=qi(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:Wi(n.code);if(Gi(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(oa(n,o,d?.ignoreModifiers)||o.keys?.includes(`*`)){if(d?.ignoreEventWhen?.(n)||r&&a.current)return;if($i(n,o,d?.preventDefault),!ea(n,o,d?.enabled)){ha(n);return}u.current(n,o),r||(a.current=!0)}})}},r=e=>{e.code!==void 0&&(Zi(Wi(e.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&n(e))},c=e=>{e.code!==void 0&&(Qi(Wi(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&&Ki(s,d?.delimiter).forEach(e=>{p.addHotkey(qi(e,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description,d?.metadata))}),()=>{l.removeEventListener(`keyup`,c,o?.eventListenerOptions),l.removeEventListener(`keydown`,r,o?.eventListenerOptions),p&&Ki(s,d?.delimiter).forEach(e=>{p.removeHotkey(qi(e,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description,d?.metadata))}),e=[],t&&clearTimeout(t)}},[s,d,f]),i}var _a=`modulepreload`,va=function(e){return`/assets/`+e},ya={},ba=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=va(t,n),t in ya)return;ya[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`:_a,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)})},xa=(0,U.lazy)(()=>ba(()=>import(`./KeyboardShortcutsHelp-mguoBIXk.js`),__vite__mapDeps([0,1,2]))),Sa=(0,U.lazy)(()=>ba(()=>import(`./CommandPalette-Du7aS97R.js`),__vite__mapDeps([3,1,2,4])));function Ca({children:e}){let t=A().location.pathname,n=(0,U.useRef)(null),r=(0,U.useRef)(t);return(0,U.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,G.jsx)(`div`,{ref:n,className:`flex-1 flex flex-col min-h-0`,children:e})}function wa(){let e=xt(),t=w(),n=A().location.pathname,[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(null),[,c]=(0,U.useState)(0);(0,U.useEffect)(()=>{document.title=e.queueTitle||`fifony`},[e.queueTitle]);let l=!!e.selectedIssue,u=e.isCreateOpen,d=a,f=r,p=(0,U.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,U.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,U.useCallback)(e=>{if(!s.current)return;let t=ti.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,U.useCallback)(()=>{let t=e.selectedIssue;if(!t)return;let n=t.state;n===`PendingApproval`?ba(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`?e.updateState(t.id,`Approved`):n===`Approved`&&!t.mergedAt&&ba(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===`Reviewing`||v===`PendingDecision`,b=v===`Approved`&&!e.selectedIssue?.mergedAt,S=!!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`,()=>ba(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:b,enableOnFormTags:!0,preventDefault:!0,description:`Merge issue`,metadata:{group:`drawer`}},[e,b]),$(`mod+w`,()=>e.retryIssue(e.selectedIssue.id),{enabled:y,enableOnFormTags:!0,preventDefault:!0,description:`Rework issue`,metadata:{group:`drawer`}},[e,y]),$(`mod+p`,()=>ba(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:S,enableOnFormTags:!0,preventDefault:!0,description:`Replan issue`,metadata:{group:`drawer`}},[e,S]);let[C,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),O=(0,U.useRef)(null),k=e.runtime.isLoading&&!e.runtime.data&&!e.runtime.isError;if((0,U.useEffect)(()=>(!C&&!O.current&&(O.current=setTimeout(()=>{D(!0),setTimeout(()=>T(!0),400)},1e3)),()=>{}),[C]),!C&&k)return(0,G.jsx)(Ta,{});if(!C&&E)return(0,G.jsx)(Ta,{fadeOut:!0});if(!C&&!k)return(0,G.jsx)(Ta,{});let j=e.toast?.type||`info`,M=typeof e.toast==`string`?e.toast:e.toast?.message;return(0,G.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[e.toast&&(0,G.jsx)(`div`,{className:`toast toast-end toast-top z-50`,children:(0,G.jsxs)(`div`,{className:`alert text-sm shadow-lg ${j===`success`?`alert-success`:j===`error`?`alert-error`:`alert-info`} ${e.toastExiting?`animate-toast-out`:`animate-toast-in`}`,children:[j===`success`?(0,G.jsx)(Bt,{className:`size-4`}):j===`error`?(0,G.jsx)(X,{className:`size-4`}):(0,G.jsx)(bn,{className:`size-4`}),(0,G.jsx)(`span`,{children:M}),(0,G.jsx)(`div`,{className:`toast-progress`})]})}),e.confetti&&(0,G.jsx)(Vi,{x:e.confetti.x,y:e.confetti.y,count:e.confetti.count,active:!0,onDone:()=>e.clearConfetti?.()}),(0,G.jsx)(kr,{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,G.jsx)(Li,{pwa:e.pwa}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0`,children:[(0,G.jsx)(Ca,{children:(0,G.jsx)(x,{})}),e.runtime.isError&&(0,G.jsx)(`div`,{className:`px-4 pb-4`,children:(0,G.jsx)(`div`,{className:`alert alert-error`,children:String(e.runtime.error?.message||`Runtime unavailable`)})})]}),(0,G.jsx)(Ar,{onClick:()=>e.setIsCreateOpen(!0)}),(0,G.jsx)(jr,{}),(0,G.jsx)(Vr,{open:e.isCreateOpen,onClose:()=>e.setIsCreateOpen(!1),onSubmit:t=>e.createIssue.mutate(t),isLoading:e.createIssue.isPending,onToast:e.showToast}),(0,G.jsx)(Ii,{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,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(xa,{open:r,onClose:()=>i(!1)})}),a&&(0,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(Sa,{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 Ta({fadeOut:e=!1}){return(0,G.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,G.jsxs)(`div`,{className:`relative z-10 flex flex-col items-center gap-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,G.jsx)(`img`,{src:de,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,G.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,G.jsx)(`span`,{className:`text-primary`,children:`fifony`})})]}),(0,G.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,G.jsx)(`span`,{className:`loading loading-dots loading-sm`}),(0,G.jsx)(`span`,{className:`text-sm`,children:`Warming up the orchestra...`})]})]})})}function Ea({children:e}){let t=ze(),n=Ie(Fe(t.data),`ui.onboarding.completed`,null);return t.isLoading&&!t.data?(0,G.jsx)(Ta,{}):t.isError||n===!0?e:(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(Ta,{}),children:(0,G.jsx)(Da,{})})}function Da(){let e=w(),t=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{t.current||(t.current=!0,e({to:`/onboarding`,replace:!0}))},[e]),(0,G.jsx)(Ta,{})}function Oa(){return A().location.pathname===`/onboarding`?(0,G.jsx)(x,{}):(0,G.jsx)(pa,{children:(0,G.jsx)(Ea,{children:(0,G.jsx)(St,{children:(0,G.jsx)(wa,{})})})})}function ka(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 Aa(e){if(!e)return e;try{let t=new URL(e);return t.pathname+(t.searchParams.toString()?`?`+t.searchParams:``)}catch{return e}}function ja({text:e}){let[t,n]=(0,U.useState)(!1);return(0,G.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 Ma({error:e,reset:t}){let[n,r]=(0,U.useState)(!0),[i,a]=(0,U.useState)(!1),o=e?.name||`Error`,s=e?.message||String(e)||`An unexpected error occurred.`,c=e?.stack||``,l=ka(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,G.jsxs)(`div`,{className:`min-h-screen bg-base-200 flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`bg-error text-error-content px-4 py-2.5 flex items-center gap-3 shrink-0`,children:[(0,G.jsx)(X,{className:`size-4 shrink-0`}),(0,G.jsxs)(`span`,{className:`font-mono text-sm font-semibold flex-1 truncate`,children:[o,`: `,s]}),(0,G.jsx)(`span`,{className:`text-xs opacity-60 shrink-0`,children:d})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row gap-0 min-h-0 overflow-auto`,children:[(0,G.jsxs)(`div`,{className:`flex-1 p-6 space-y-5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Error`}),(0,G.jsx)(ja,{text:p})]}),(0,G.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`badge badge-error badge-sm mt-0.5 shrink-0 font-mono`,children:o}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-error leading-relaxed break-all`,children:s})]}),m&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-base-content/50`,children:[(0,G.jsx)(`span`,{className:`opacity-40`,children:`at`}),(0,G.jsx)(`span`,{className:`font-mono font-semibold text-base-content/70`,children:m.fn||`<anonymous>`}),(0,G.jsx)(`span`,{className:`opacity-30`,children:`—`}),(0,G.jsx)(`span`,{className:`font-mono`,children:Aa(m.file)}),m.line&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`:`,m.line,`:`,m.col]})]})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,G.jsx)(`div`,{className:`px-5 py-3 border-b border-base-300`,children:(0,G.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Context`})}),(0,G.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,G.jsxs)(`div`,{className:`px-5 py-2.5 flex items-start gap-4`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold opacity-40 w-24 shrink-0 pt-0.5`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs break-all text-base-content/70`,children:t})]},e))})]}),l.length>0&&(0,G.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,G.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,G.jsx)(It,{className:`size-3.5 transition-transform ${n?`rotate-180`:``}`}),`Stack trace`,(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost normal-case tracking-normal font-mono`,children:[l.length,` frames`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-50 hover:opacity-100 ${i?`btn-active`:``}`,onClick:()=>a(e=>!e),children:`raw`}),(0,G.jsx)(ja,{text:c})]})]}),n&&(i?(0,G.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,G.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=Aa(e.file);return(0,G.jsxs)(`div`,{className:`px-5 py-2 flex items-start gap-3 ${n?`bg-warning/5`:`opacity-40`}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] opacity-30 w-5 shrink-0 text-right pt-0.5`,children:t}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[e.fn&&(0,G.jsx)(`span`,{className:`font-mono text-xs font-semibold ${n?`text-warning`:`text-base-content/60`}`,children:e.fn}),n&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-warning badge-soft`,children:`app`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[10px] text-base-content/40 truncate`,children:[r,e.line&&(0,G.jsxs)(`span`,{className:`text-base-content/60 ml-0.5`,children:[`:`,e.line,`:`,e.col]})]})]})]},t)})}))]})]}),(0,G.jsxs)(`div`,{className:`lg:w-64 p-6 space-y-4 shrink-0`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-primary w-full gap-2`,onClick:()=>window.location.reload(),children:[(0,G.jsx)(Y,{className:`size-4`}),` Reload page`]}),t&&(0,G.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:t,children:`Try to recover`}),(0,G.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:()=>{window.location.href=`/`},children:`Go home`})]}),(0,G.jsx)(`div`,{className:`divider text-xs opacity-30`,children:`about`}),(0,G.jsxs)(`div`,{className:`space-y-1 text-xs text-base-content/40`,children:[(0,G.jsx)(`p`,{children:`This error was caught by the app's error boundary. The details above will help you identify the root cause.`}),(0,G.jsxs)(`p`,{className:`mt-2`,children:[`App frames are `,(0,G.jsx)(`span`,{className:`text-warning font-semibold`,children:`highlighted`}),`.`]})]})]})]})]})}var Na=k({component:Oa,errorComponent:Ma}),Pa=[{to:`/settings/project`,label:`Project`,icon:cn},{to:`/settings/workflow`,label:`Execution`,icon:dr},{to:`/settings/agents`,label:`Agents`,icon:or},{to:`/settings/general`,label:`System`,icon:Wn},{to:`/settings/notifications`,label:`Notifications`,icon:kt},{to:`/settings/providers`,label:`Providers`,icon:qn},{to:`/settings/hotkeys`,label:`Hotkeys`,icon:Sn}],Fa=m(`/settings`)({component:Ia});function Ia(){let e=A().location.pathname;return(0,G.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,G.jsxs)(`div`,{className:`max-w-5xl w-full mx-auto flex-1 flex flex-col min-h-0 gap-5`,children:[(0,G.jsx)(`div`,{role:`tablist`,className:`tabs tabs-lift overflow-x-auto flex-nowrap scrollbar-none`,style:{scrollbarWidth:`none`},children:Pa.map(({to:t,label:n,icon:r})=>(0,G.jsxs)(g,{to:t,role:`tab`,className:`tab gap-1.5 whitespace-nowrap ${e.startsWith(t)?`tab-active`:``}`,children:[(0,G.jsx)(r,{className:`size-3.5`}),n]},t))}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,G.jsx)(x,{})})]})})}var La=(0,U.lazy)(()=>ba(()=>import(`./OnboardingWizard-dOrVz-hX.js`),__vite__mapDeps([6,1,5,2,4])));function Ra(){let e=w(),t=T();return(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,G.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,G.jsx)(La,{onComplete:()=>{t.invalidateQueries({queryKey:W}),e({to:`/`})}})})}var za=m(`/onboarding`)({component:Ra});function Ba(e){let[t,n]=(0,U.useState)(()=>Va(e)),r=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(!e){n(null);return}let t=()=>n(Va(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 Va(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 Ha={bug:`badge-error`,feature:`badge-primary`,refactor:`badge-warning`,docs:`badge-info`,chore:`badge-secondary`},Ua={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 Wa(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ga(e){if(!e)return null;let t=e.match(/\d+$/);return t?t[0]:null}function Ka(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 qa(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:Ka(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 Ja(e){return e?e.reviewer?.totalTokens>0?`reviewing`:e.executor?.totalTokens>0?`executing`:e.planner?.totalTokens>0?`planning`:null:null}function Ya(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 Xa(e){return e.state===`Reviewing`?e.updatedAt:e.state===`PendingDecision`?e.completedAt||e.updatedAt:e.state===`Blocked`?e.updatedAt:null}function Za(e){let{state:t,planningStatus:n,assignedToWorker:r,startedAt:i,tokenUsage:a,tokensByPhase:o}=e;switch(t){case`Planning`:return n===`planning`?{label:`Writing plan…`,Icon:J,spin:!0,pulse:!1,color:`text-info`}:e.plan?{label:`Plan ready`,Icon:wn,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:qt,spin:!1,pulse:!0,color:`text-info/50`};case`PendingApproval`:return null;case`Queued`:return r?{label:`Starting…`,Icon:Rn,spin:!1,pulse:!0,color:`text-primary/80`}:{label:`In queue`,Icon:En,spin:!1,pulse:!1,color:`text-base-content/40`};case`Running`:{let e=Ja(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning…`,Icon:J,spin:!0,pulse:!1,color:`text-primary`}:t?e===`reviewing`?{label:`Reviewing…`,Icon:nn,spin:!1,pulse:!0,color:`text-secondary`}:e===`planning`?{label:`Planning…`,Icon:wn,spin:!1,pulse:!0,color:`text-info`}:{label:`Working…`,Icon:Rn,spin:!1,pulse:!0,color:`text-primary`}:{label:`Starting…`,Icon:J,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,U.useState)(()=>e?Math.max(0,Date.now()-new Date(e).getTime()):0);return(0,U.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 $a({issue:e}){let t=Za(e),n=Xa(e),r=Qa(t===`stall`?n:null),i=Ba(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,G.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] font-medium ${t}`,children:[(0,G.jsx)(qt,{size:10,className:`shrink-0`}),(0,G.jsx)(`span`,{className:`tabular-nums font-mono`,children:Ya(r)}),(0,G.jsxs)(`span`,{className:`opacity-60 font-normal`,children:[`· `,i]})]})}let{label:a,Icon:o,spin:s,pulse:c,color:l}=t;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] ${l}`,children:[o&&(0,G.jsx)(o,{size:10,className:[s?`animate-spin`:``,c?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,G.jsx)(`span`,{className:`font-medium truncate`,children:a}),i&&(0,G.jsx)(`span`,{className:`font-mono opacity-50 tabular-nums shrink-0 ml-0.5`,children:i})]})}function eo({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,U.useRef)(e.tokenUsage?.totalTokens),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(!1),S=(0,U.useRef)(e.state);(0,U.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,U.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=Ga(e.identifier),w=Wa(e.tokenUsage?.totalTokens||0),T=e.history?.length||0,E=qa(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,G.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`,Ua[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,G.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,G.jsx)(`div`,{className:`absolute top-1.5 left-1.5 z-10`,children:(0,G.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,G.jsx)(Zn,{size:14})})}),(0,G.jsxs)(`div`,{className:`card-body gap-1 p-3 relative`,children:[(0,G.jsx)(`div`,{className:o?`pl-5`:``,children:(0,G.jsx)($a,{issue:e})}),(0,G.jsx)(`h3`,{className:[`font-semibold text-sm leading-snug`,d?`line-through opacity-40`:``].filter(Boolean).join(` `),children:e.title}),E.length>0&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-35 truncate`,children:E.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 shrink-0`,children:[e.label&&(0,G.jsx)(`span`,{className:`opacity-50 uppercase tracking-wide`,style:{fontSize:`8px`},children:e.label}),(0,G.jsx)(`span`,{children:e.model}),e.effort&&(0,G.jsxs)(`span`,{className:`opacity-60`,children:[`·`,e.effort]})]},e.label??`single`))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-40 mt-0.5`,children:[e.issueType&&Ha[e.issueType]&&(0,G.jsx)(`span`,{className:`badge badge-xs ${Ha[e.issueType]} badge-soft shrink-0`,children:e.issueType}),e.planVersion>1&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-info badge-soft shrink-0 font-mono`,children:[`v`,e.planVersion]}),w&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 ${v?`animate-count-bump`:``}`,children:[(0,G.jsx)(mr,{size:9}),w]}),T>0&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(Ct,{size:9}),T]}),(0,G.jsx)(`span`,{className:`shrink-0`,children:V(e.createdAt)}),h&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-error font-semibold ml-auto shrink-0 opacity-100`,children:[(0,G.jsx)(Wt,{size:10}),`merge failed`]}),g&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-semibold ml-auto shrink-0 opacity-100 animate-pulse`,children:[(0,G.jsx)(pn,{size:10}),`ready to merge`]}),m&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-success font-semibold ml-auto shrink-0 opacity-100`,children:[(0,G.jsx)(K,{size:10}),`merged`]})]})]}),s&&(0,G.jsx)(`div`,{className:`issue-heartbeat-bar animate-pulse-soft`}),p&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-info animate-pulse-soft`}),c&&!p&&!e.plan&&!e.planningError&&(0,G.jsx)(`div`,{className:`h-[2px] rounded-b-[var(--rounded-box,1rem)] bg-info/20 animate-pulse`}),h&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-error animate-pulse`}),g&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-warning animate-pulse-soft`}),m&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-success`})]})}function to({icon:e=yn,title:t=`Nothing here`,description:n=``,action:r,actionLabel:i=`Action`}){return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 opacity-60 animate-fade-in-up`,children:[(0,G.jsx)(e,{className:`size-12 mb-4 opacity-40`}),(0,G.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:t}),n&&(0,G.jsx)(`p`,{className:`text-sm opacity-70 text-center max-w-xs`,children:n}),r&&(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary mt-4`,onClick:r,children:i})]})}var no={Planning:[`Planning`],"Needs Approval":[`PendingApproval`,`PendingDecision`],"In Progress":[`Queued`,`Running`,`Reviewing`],Blocked:[`Blocked`],Done:[`Approved`,`Merged`,`Cancelled`]},ro=new Set([`Planning`]),io=new Set([`PendingApproval`,`PendingDecision`]),ao=new Set([`Queued`,`Running`,`Reviewing`]),oo=new Set([`Approved`,`Merged`,`Cancelled`]);function so(e){return ro.has(e)?`Planning`:io.has(e)?`Needs Approval`:ao.has(e)?`In Progress`:oo.has(e)?`Done`:e}function co(e){let t=R[e];if(!t)return new Set;let n=new Set(t.map(e=>so(e)));return n.delete(so(e)),n}var lo=300,uo=5;function fo({onStateChange:e}){let[t,n]=(0,U.useState)(null),r=(0,U.useRef)(null),i=(0,U.useRef)({pointerId:null,startX:0,startY:0,isDragging:!1,longPressTimer:null,longPressReady:!1,pointerType:null,issue:null,sourceColumn:null,didDrag:!1}),a=(0,U.useRef)(null),o=(0,U.useRef)(new Map);(0,U.useEffect)(()=>()=>{clearTimeout(i.current.longPressTimer)},[]);let s=(0,U.useCallback)((e,t)=>{let n=r.current;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)},[]),c=(0,U.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,U.useCallback)((e,t,r,a)=>{let o=co(e.state);i.current.isDragging=!0,n({issueId:e.id,issue:e,sourceColumn:t,validColumns:o,overColumn:null}),s(r,a)},[s]),u=(0,U.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,U.useCallback)(n=>{if(t){if(t.validColumns.has(n)){let r=R[t.issue.state]||[],i=new Set(no[n]||[]),a=r.find(e=>i.has(e));a&&e(t.issueId,a)}u()}},[t,e,u]),f=(0,U.useCallback)((e,t)=>{t?o.current.set(e,t):o.current.delete(e)},[]);return{dragState:t,ghostRef:r,boardRef:a,getCardHandlers:(0,U.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)},lo))))}}),[l]),registerColumn:f,onBoardPointerMove:(0,U.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>uo&&!t.longPressReady){clearTimeout(t.longPressTimer),t.pointerId=null;return}if(!t.longPressReady)return}else{if(o<uo)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,U.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,U.useCallback)(()=>{u()},[u]),cancelDrag:u,shouldSuppressClick:(0,U.useCallback)(()=>i.current.didDrag||i.current.isDragging,[])}}function po({count:e,className:t}){let n=(0,U.useRef)(e),[r,i]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{if(n.current!==e){n.current=e,i(!0);let t=setTimeout(()=>i(!1),300);return()=>clearTimeout(t)}},[e]),e===0?null:(0,G.jsx)(`span`,{className:`badge badge-xs ${t} ${r?`animate-count-bump`:``}`,children:e})}var mo=[`Planning`,`In Progress`,`Needs Approval`,`Blocked`,`Done`],ho=new Set([`Planning`]),go=new Set([`PendingApproval`,`PendingDecision`]),_o=new Set([`Queued`,`Running`,`Reviewing`]),vo=new Set([`Archived`]),yo={Planning:`badge-info`,"Needs Approval":`badge-warning`,"In Progress":`badge-primary`,Blocked:`badge-error`,Done:`badge-success`},bo={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)`}},xo={Planning:`var(--color-info)`,"Needs Approval":`var(--color-warning)`,"In Progress":`var(--color-primary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`},So={Planning:`var(--color-info)`,"Needs Approval":`var(--color-warning)`,"In Progress":`var(--color-primary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`},Co={Planning:{icon:wn,desc:`Create an issue to start planning`},"Needs Approval":{icon:nn,desc:`Issues waiting for your approval`},"In Progress":{icon:Rn,desc:`Issues move here when agents start`},Blocked:{icon:X,desc:`Needs attention`},Done:{icon:Bt,desc:`Completed`}};function wo({delay:e=0}){return(0,G.jsx)(`div`,{className:`skeleton-card h-20 w-full rounded-lg`,style:{animationDelay:`${e}ms`}})}function To({dragState:e,ghostRef:t}){if(!e)return null;let{issue:n}=e;return(0,G.jsx)(`div`,{ref:t,className:`drag-ghost`,"aria-hidden":`true`,children:(0,G.jsxs)(`div`,{className:`card card-compact bg-base-100 border border-primary border-l-[3px] shadow-2xl p-3 w-56`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:n.identifier}),(0,G.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:n.title})]})})}function Eo({onCreateIssue:e}){return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 px-3 animate-fade-in-up`,children:[(0,G.jsx)(`div`,{className:`bg-primary/10 rounded-full p-4 mb-3 animate-pulse-soft`,children:(0,G.jsx)(wn,{className:`size-8 text-primary`})}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold mb-1`,children:`Start here`}),(0,G.jsx)(`p`,{className:`text-xs opacity-50 text-center mb-3`,children:`Create your first issue to begin`}),e&&(0,G.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:e,children:[(0,G.jsx)(zn,{className:`size-3.5`}),`New Issue`]})]})}function Do({issue:e,onClose:t,onStateChange:n,onSelect:r}){let i=ee(e.state).filter(t=>t!==e.state);return(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50 animate-fade-in`,onClick:t}),(0,G.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,G.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,G.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,G.jsxs)(`div`,{className:`px-4 py-2 border-b border-base-300`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,G.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,G.jsxs)(`div`,{className:`p-3 space-y-1`,children:[(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{r(e),t()},children:[(0,G.jsx)(nn,{className:`size-4`}),` View Details`]}),i.length>0&&(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide opacity-40 px-3 pt-2`,children:`Move to`}),i.map(r=>(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{n(e.id,r),t()},children:[(0,G.jsx)(Tt,{className:`size-4`}),` `,r]},r))]}),(0,G.jsx)(`div`,{className:`p-3 pt-0`,children:(0,G.jsx)(`button`,{className:`btn btn-ghost btn-sm w-full`,onClick:t,children:`Cancel`})})]})]})}function Oo({columns:e,activeIndex:t}){return(0,G.jsx)(`div`,{className:`kanban-dots md:hidden`,children:e.map((e,n)=>(0,G.jsx)(`div`,{className:`kanban-dot ${n===t?`active`:``}`,style:{backgroundColor:So[e]}},e))})}var ko={Done:20};function Ao({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,U.useRef)(null),[v,y]=(0,U.useState)(!1);(0,U.useEffect)(()=>(a(e,_.current),()=>a(e,null)),[e,a]);let b=i!=null,x=i?.overColumn===e,S=i?.sourceColumn===e,C=i?.validColumns?.has(e)??!1,w=b&&!C&&!S,T=t.length===0,E=T&&e!==`Planning`&&d===0,D=ko[e],O=D!=null&&t.length>D,k=O&&!v?t.slice(0,D):t,A=t.length-k.length,j=`kanban-column bg-base-200 rounded-box p-3 flex flex-col min-h-0 overflow-hidden`;E&&(j+=` kanban-column-collapsed`),b&&(x&&C?j+=` kanban-column-drop-valid`:x&&!C?j+=` kanban-column-drop-invalid`:w&&(j+=` kanban-column-dimmed`));let M={borderTop:`3px solid transparent`,...bo[e]||{},...E?{alignSelf:`start`}:{}};return(0,G.jsxs)(`div`,{ref:_,className:j,style:M,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsxs)(`h3`,{className:`text-xs font-semibold tracking-wide flex items-center gap-1.5`,style:{color:xo[e],fontFamily:`'Space Grotesk', system-ui, sans-serif`},children:[e,e===`In Progress`&&u&&(0,G.jsx)(`span`,{className:`issue-phase-dot`,title:`Agents working`})]}),(0,G.jsx)(po,{count:t.length,className:r})]}),!E&&(0,G.jsx)(`div`,{className:`space-y-2 flex-1 overflow-y-auto kanban-card-list`,children:T?x&&C?(0,G.jsx)(`div`,{className:`kanban-drop-placeholder`}):e===`Planning`&&d===0?(0,G.jsx)(Eo,{onCreateIssue:c}):(0,G.jsxs)(`div`,{className:`flex flex-col items-center py-6 opacity-30`,children:[(0,G.jsx)(n.icon,{className:`size-5 mb-1`}),(0,G.jsx)(`span`,{className:`text-[10px]`,children:n.desc})]}):(0,G.jsxs)(`div`,{className:`stagger-children space-y-2`,children:[k.map(t=>{let n=i?.issueId===t.id,r=l===t.id,a=g===t.id;return(0,G.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,G.jsx)(eo,{issue:t,onSelect:s,dragHandlers:o(t,e),isDragging:n,isSelected:p?.has(t.id),onToggleSelect:m,hasSelection:h})},t.id)}),O&&(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50 hover:opacity-80`,onClick:e=>{e.stopPropagation(),y(!v)},children:[(0,G.jsx)(It,{className:`size-3 transition-transform ${v?`rotate-180`:``}`}),v?`Show less`:`+${A} more`]}),x&&C&&(0,G.jsx)(`div`,{className:`kanban-drop-placeholder`})]})})]},e)}function jo(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 Mo({count:e,transitions:t,onBulkAction:n,onClear:r}){return(0,G.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,G.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:t.map(e=>(0,G.jsxs)(`button`,{className:`btn btn-sm btn-outline gap-1`,onClick:()=>n(e),children:[(0,G.jsx)(Tt,{className:`size-3`}),e]},e))}),(0,G.jsx)(`div`,{className:`divider divider-horizontal mx-0`}),(0,G.jsxs)(`span`,{className:`text-sm font-medium whitespace-nowrap opacity-70`,children:[e,` selected`]}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:r,"aria-label":`Clear selection`,children:(0,G.jsx)(pr,{className:`size-4`})})]})}function No({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,onCreateIssue:a,isLoading:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(0),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(()=>new Set),h=(0,U.useRef)(null),[g,_]=(0,U.useState)(-1),[v,y]=(0,U.useState)(-1),b=p.size>0,x=(0,U.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,U.useCallback)(()=>{m(new Set)},[]);(0,U.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,U.useMemo)(()=>jo(p,e),[p,e]),w=(0,U.useCallback)(e=>{for(let n of p)t(n,e);S()},[p,t,S]),T=(0,U.useMemo)(()=>{let t=Object.fromEntries(mo.map(e=>[e,[]]));for(let n of e){if(vo.has(n.state))continue;let e;e=ho.has(n.state)?`Planning`:go.has(n.state)?`Needs Approval`:_o.has(n.state)?`In Progress`:n.state===`Blocked`?`Blocked`:`Done`,t[e].push(n)}for(let e of mo)t[e].sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt));return t},[e]),E=(0,U.useMemo)(()=>e.some(e=>e.state===`Running`),[e]),D=(0,U.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}=fo({onStateChange:D}),I=(0,U.useCallback)(e=>{F()||i?.(e)},[i,F]);(0,U.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,U.useRef)(null);let ee=(0,U.useCallback)(e=>{f(e)},[]),{selectedIssue:te}=xt(),L=!te,ne=(0,U.useRef)(T);ne.current=T;let R=(0,U.useCallback)(e=>{_(e),y(0);let t=h.current;t&&(t.querySelector(`[class*='grid']`)?.children[e])?.scrollIntoView({behavior:`smooth`,inline:`center`,block:`nearest`})},[]),z=(0,U.useCallback)(e=>{if(g<0){_(0),y(0);return}let t=mo[g],n=ne.current[t]||[];y(t=>Math.max(0,Math.min(t+e,n.length-1)))},[g]),B=(0,U.useCallback)(()=>{if(g<0||v<0)return;let e=ne.current[mo[g]]||[];e[v]&&i?.(e[v])},[g,v,i]);return $(`1`,()=>R(0),{enabled:L,description:`Planning column`,metadata:{group:`kanban`}},[R,L]),$(`2`,()=>R(1),{enabled:L,description:`In Progress column`,metadata:{group:`kanban`}},[R,L]),$(`3`,()=>R(2),{enabled:L,description:`Needs Approval column`,metadata:{group:`kanban`}},[R,L]),$(`4`,()=>R(3),{enabled:L,description:`Blocked column`,metadata:{group:`kanban`}},[R,L]),$(`5`,()=>R(4),{enabled:L,description:`Done column`,metadata:{group:`kanban`}},[R,L]),$(`j`,()=>z(1),{enabled:L,description:`Next card`,metadata:{group:`kanban`}},[z,L]),$(`k`,()=>z(-1),{enabled:L,description:`Previous card`,metadata:{group:`kanban`}},[z,L]),$(`enter`,B,{enabled:L&&v>=0,description:`Open card`,metadata:{group:`kanban`}},[B,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,U.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,G.jsx)(`div`,{className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,children:(0,G.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children`,style:{gridTemplateColumns:`repeat(${mo.length}, minmax(0, 1fr))`,minWidth:`${mo.length*200}px`},children:mo.map((e,t)=>(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex flex-col gap-2`,children:[(0,G.jsx)(`div`,{className:`skeleton-line h-4 w-20 mb-2`}),(0,G.jsx)(wo,{delay:t*80}),(0,G.jsx)(wo,{delay:t*80+120}),t<2&&(0,G.jsx)(wo,{delay:t*80+240})]},e))})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.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,G.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children ${O?`kanban-dragging`:``}`,style:{gridTemplateColumns:`repeat(${mo.length}, minmax(0, 1fr))`,minWidth:`${mo.length*200}px`},children:mo.map((t,n)=>{let r=T[t],i=g===n&&v>=0&&v<r.length?r[v]?.id:null;return(0,G.jsx)(Ao,{col:t,issues:r,empty:Co[t],badgeClass:yo[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,G.jsx)(To,{dragState:O,ghostRef:k})]}),(0,G.jsx)(Oo,{columns:mo,activeIndex:l}),d&&(0,G.jsx)(Do,{issue:d,onClose:()=>f(null),onStateChange:D,onSelect:I}),b&&(0,G.jsx)(Mo,{count:p.size,transitions:C,onBulkAction:w,onClear:S})]})}function Po(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Fo({value:e,format:t=Po,className:n=``}){let[r,i]=(0,U.useState)(()=>t(e)),a=(0,U.useRef)(e),o=(0,U.useRef)(null);return(0,U.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,G.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}function Io({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,G.jsxs)(`div`,{className:`flex items-center gap-1.5 ${o}`,children:[(0,G.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,G.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,G.jsx)(`title`,{children:`${p}: ${a>999?Po(a):a}`})},e.date||n)})}),a&&(0,G.jsxs)(`span`,{className:`text-[9px] font-mono opacity-50 shrink-0`,children:[Po(s[s.length-1]?.[r]||0),`/d`]})]})}function Lo({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,G.jsx)(`div`,{className:`flex items-center gap-1.5 ${r}`,children:(0,G.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,G.jsxs)(`g`,{children:[f>0&&(0,G.jsx)(`rect`,{x:p,y:t-f,width:l,height:f,rx:`0.5`,className:`fill-error`,opacity:m,children:(0,G.jsx)(`title`,{children:`${h}: +${r} / -${i}`})}),d>0&&(0,G.jsx)(`rect`,{x:p,y:t-u,width:l,height:d,rx:`0.5`,className:`fill-success`,opacity:m,children:(0,G.jsx)(`title`,{children:`${h}: +${r} / -${i}`})})]},e.date||n)})})})}function Ro(){let[e,t]=(0,U.useState)(()=>window.innerWidth<768);return(0,U.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function zo({monthlyTokens:e,monthlyEvents:t,dailyData:n,hasDailyData:r,hasEventData:i,linesDaily:a,hasChurnData:o}){let[s,c]=(0,U.useState)(!1);return(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box animate-fade-in overflow-hidden`,children:[(0,G.jsxs)(`button`,{className:`flex items-center justify-between w-full px-4 py-2.5 text-left`,onClick:()=>c(!s),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,G.jsx)(mr,{className:`size-3.5 text-primary`}),(0,G.jsx)(Fo,{value:e}),(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 font-normal ml-1`,children:`this month`})]}),t>0&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs opacity-50`,children:[(0,G.jsx)(Ct,{className:`size-3`}),t]})]}),(0,G.jsx)(It,{className:`size-4 opacity-40 transition-transform ${s?`rotate-180`:``}`})]}),s&&(0,G.jsxs)(`div`,{className:`px-4 pb-3 space-y-3 animate-fade-in border-t border-base-300 pt-3`,children:[r&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(ir,{className:`size-2.5`}),` Tokens / day`]}),(0,G.jsx)(Io,{data:n,height:32,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`,className:`w-full`})]}),i&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(Ct,{className:`size-2.5`}),` Events / day`]}),(0,G.jsx)(Io,{data:n,height:24,cols:14,valueKey:`events`,colorClass:`text-secondary`,className:`w-full`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(K,{className:`size-2.5`}),` Lines / day`]}),(0,G.jsx)(Lo,{data:a,height:24,cols:14,className:`w-full`})]})]})]})}function Bo({issues:e=[],defaultBranch:t}){let{data:n}=Ue(),{data:r}=We({pollInterval:6e4}),i=Ro(),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,U.useRef)(p),[h,g]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{!m.current&&p&&(m.current=!0,g(!0))},[p]),p?i?(0,G.jsx)(zo,{monthlyTokens:s,monthlyEvents:c,dailyData:a,hasDailyData:u,hasEventData:d,linesDaily:l,hasChurnData:f}):(0,G.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,G.jsxs)(`div`,{className:`flex flex-col justify-center px-4 py-2.5`,children:[(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Tokens / month`}),(0,G.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5 mt-0.5`,children:[(0,G.jsx)(mr,{className:`size-3.5 text-primary shrink-0`}),(0,G.jsx)(Fo,{value:s})]})]}),u&&(0,G.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(ir,{className:`size-2.5`}),` Tokens / day`]}),(0,G.jsx)(Io,{data:a,height:28,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`})]}),d&&(0,G.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(Ct,{className:`size-2.5`}),` Events / day`]}),(0,G.jsx)(Io,{data:a,height:28,cols:14,valueKey:`events`,colorClass:`text-secondary`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(K,{className:`size-2.5`}),` Lines / day`]}),(0,G.jsx)(Lo,{data:l,height:28,cols:14})]}),t&&(0,G.jsxs)(`div`,{className:`flex flex-col justify-center px-3 border-l border-base-300`,children:[(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Branch`}),(0,G.jsxs)(`span`,{className:`text-xs font-mono font-medium flex items-center gap-1 mt-0.5`,children:[(0,G.jsx)(fn,{className:`size-3 text-primary shrink-0`}),t]})]})]}):null}var Vo=m(`/kanban`)({component:Ho});function Ho(){let e=xt(),{data:t}=Ue();return(0,G.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,G.jsx)(Bo,{metrics:e.metrics,total:e.issues.length,issues:e.issues,compact:!0,defaultBranch:e.data?.config?.defaultBranch}),(0,G.jsx)(No,{issues:e.filtered,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,onCreateIssue:()=>e.setIsCreateOpen(!0)})]})}function Uo(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:J,color:`text-info`,spin:!0}:e.plan?{label:`Plan ready`,icon:wn,color:`text-info`,spin:!1}:e.planningError?{label:`Plan failed`,icon:X,color:`text-error`,spin:!1}:{label:`Aguardando scheduler…`,icon:qt,color:`text-info/60`,spin:!1};case`PendingApproval`:return{label:`Ready to queue`,icon:En,color:`text-warning/70`,spin:!1};case`Queued`:return r?{label:`Worker assigned, starting...`,icon:Rn,color:`text-primary`,spin:!1,pulse:!0}:{label:`Waiting for worker slot...`,icon:qt,color:`text-info/70`,spin:!1};case`Running`:{let e=Wo(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning agent...`,icon:J,color:`text-primary`,spin:!0}:t?e===`Reviewing`?{label:`Agent reviewing...`,icon:nn,color:`text-secondary`,spin:!1,pulse:!0}:e===`Planning`?{label:`Agent planning...`,icon:wn,color:`text-info`,spin:!1,pulse:!0}:{label:`Agent working...`,icon:Rn,color:`text-primary`,spin:!1,pulse:!0}:{label:`Starting agent...`,icon:J,color:`text-primary`,spin:!0}}case`Reviewing`:return Wo(o)===`Reviewing`?{label:`Review in progress...`,icon:nn,color:`text-secondary`,spin:!1,pulse:!0}:{label:`Reviewing`,icon:nn,color:`text-secondary/70`,spin:!1};case`PendingDecision`:return{label:`Review complete`,icon:nn,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:Vt,color:`text-success`,spin:!1};case`Merged`:return{label:`Merged`,icon:K,color:`text-success`,spin:!1};case`Cancelled`:return{label:`Cancelled`,icon:Wt,color:`text-neutral`,spin:!1};default:return{label:t,icon:null,color:`opacity-50`,spin:!1}}}function Wo(e){return e?e.reviewer?.totalTokens>0?`Reviewing`:e.executor?.totalTokens>0?`Executing`:e.planner?.totalTokens>0?`Planning`:null:null}function Go({issue:e,showElapsed:t=!0,compact:n=!1}){let r=Uo(e),i=r.icon,a=Ba([`Running`,`Queued`,`Planning`,`Reviewing`].includes(e.state)&&t?e.startedAt:null);return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs ${r.color} ${n?``:`font-medium`}`,children:[i&&(0,G.jsx)(i,{size:n?10:12,className:[r.spin?`animate-spin`:``,r.pulse?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,G.jsx)(`span`,{className:n?`truncate max-w-[120px]`:`truncate`,children:r.label}),a&&(0,G.jsx)(`span`,{className:`font-mono opacity-60 tabular-nums shrink-0`,children:a})]})}var Ko={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`},qo={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 Jo(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Yo({icon:e,label:t,value:n,color:r=``}){return!n&&n!==0?null:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[10px]`,title:t,children:[(0,G.jsx)(e,{className:`size-2.5 ${r||`opacity-40`}`}),(0,G.jsx)(`span`,{className:`font-mono opacity-70`,children:n})]})}function Xo(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 Zo({issue:e,onSelect:t}){let n=e.state===`Running`,r=Jo(e.tokenUsage?.totalTokens),i=e.description||``,{leadTimeMs:a,cycleTimeMs:o,waitTimeMs:s}=Xo(e);return e.state===`Approved`||e.state,(0,G.jsx)(`div`,{className:`card bg-base-100 border border-base-300 border-l-[3px] ${qo[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,G.jsxs)(`div`,{className:`card-body gap-3 p-4 justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,G.jsx)(`span`,{className:`badge badge-xs ${Ko[e.state]||`badge-ghost`}`,children:e.state})]}),(0,G.jsx)(`span`,{className:`text-xs opacity-40 shrink-0`,children:V(e.updatedAt)})]}),(0,G.jsx)(`h3`,{className:`font-semibold text-sm leading-snug line-clamp-2`,children:e.title}),i&&(0,G.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,G.jsx)(`div`,{className:`pt-1`,children:(0,G.jsx)(Go,{issue:e,showElapsed:!0})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-2 border-t border-base-200`,children:[(0,G.jsx)(Yo,{icon:_n,label:`Wait`,value:s>0?z(s):null}),(0,G.jsx)(Yo,{icon:rr,label:`Cycle`,value:o>0?z(o):null,color:`text-primary`}),(0,G.jsx)(Yo,{icon:qt,label:`Lead`,value:a>0?z(a):null}),(0,G.jsx)(Yo,{icon:mr,label:`Tokens`,value:r,color:`text-warning`}),(0,G.jsx)(Yo,{icon:Yt,label:`Cost`,value:e.tokenUsage?.costUsd?`$${e.tokenUsage.costUsd.toFixed(2)}`:null,color:`text-secondary`}),(0,G.jsx)(Yo,{icon:Y,label:`Attempts`,value:e.attempts>0?`${e.attempts}/${e.maxAttempts}`:null}),(0,G.jsx)(Yo,{icon:rn,label:`Files`,value:e.filesChanged||null,color:`text-info`}),e.linesAdded?(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-success`,children:[`+`,e.linesAdded]}):null,e.linesRemoved?(0,G.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,G.jsx)(to,{icon:Tn,title:`No issues found`,description:`Try adjusting your search or filters, or create your first issue to get started.`}):a?(0,G.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,G.jsx)(`div`,{className:t===o?`ring-2 ring-primary/50 rounded-2xl`:``,children:(0,G.jsx)(Zo,{issue:e,onSelect:i})},e.id))}):(0,G.jsx)(`div`,{className:`space-y-2 stagger-children`,children:e.map((e,t)=>(0,G.jsx)(`div`,{className:t===o?`ring-2 ring-primary/50 rounded-lg`:``,children:(0,G.jsx)(eo,{issue:e,onSelect:i})},e.id))})}var $o=[{label:`Active`,states:[`Planning`,`PendingApproval`,`Queued`,`Running`]},{label:`Review`,states:[`Reviewing`,`PendingDecision`]},{label:`Waiting`,states:[`Blocked`,`Approved`]},{label:`Final`,states:[`Merged`,`Cancelled`]}];$o.flatMap(e=>e.states);var es={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`},ts=[{value:`updated`,label:`Last updated`},{value:`created`,label:`Newest first`},{value:`state`,label:`State`},{value:`tokens`,label:`Most tokens`}],ns=[{value:`recent`,label:`Active + recent`},{value:`all`,label:`All issues`}],rs=m(`/issues`)({component:is});function is(){let e=xt(),[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(`updated`),[a,o]=(0,U.useState)(-1),s=(0,U.useRef)(null),[c,l]=(0,U.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,U.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,U.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,U.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,U.useCallback)(()=>{let e=e=>{let t=String(e??``).replace(/"/g,`""`);return t.includes(`,`)||t.includes(`"`)||t.includes(`
|
|
44
|
+
`))}let E=()=>{d(`approved`),n?.(e.id,`Approved`)},D=()=>{d(`rework`),r?.(e.id,c||void 0)},O=()=>{d(`rejected`),n?.(e.id,`Blocked`)},k=e.mergeResult,A=!!e.mergedAt;return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[A&&(0,G.jsxs)(`div`,{className:`alert border text-sm ${k?.conflicts>0?`border-warning/30 bg-warning/5`:`border-success/30 bg-success/5`}`,children:[(0,G.jsx)(K,{className:`size-4 shrink-0 ${k?.conflicts>0?`text-warning`:`text-success`}`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Code merged to project root`}),k&&(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` — `,k.copied,` file`,k.copied===1?``:`s`,` copied`,k.deleted>0?`, ${k.deleted} deleted`:``]}),k?.conflicts>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`text-xs text-warning font-medium mt-0.5`,children:[`Merge aborted — `,k.conflicts,` file`,k.conflicts===1?``:`s`,` had conflicts. No changes were applied.`]}),k.conflictFiles?.length>0&&(0,G.jsx)(`ul`,{className:`text-xs text-warning/80 mt-1 ml-4 list-disc space-y-0.5`,children:k.conflictFiles.map(e=>(0,G.jsx)(`li`,{className:`font-mono`,children:e},e))})]}),(!k?.conflicts||k.conflicts===0)&&(0,G.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`The approved branch has been integrated into the current project branch.`})]})]}),e.prUrl&&(0,G.jsxs)(`div`,{className:`alert border border-primary/30 bg-primary/5 text-sm`,children:[(0,G.jsx)(tn,{className:`size-4 shrink-0 text-primary`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Pull request created`}),(0,G.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})]})]}),!A&&S&&k?.conflicts>0&&(0,G.jsxs)(`div`,{className:`alert border border-warning/30 bg-warning/5 text-sm`,children:[(0,G.jsx)(X,{className:`size-4 shrink-0 text-warning`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Merge failed due to conflicts`}),(0,G.jsxs)(`p`,{className:`text-xs opacity-70 mt-0.5`,children:[`The branch `,e.branchName?(0,G.jsx)(`span`,{className:`font-mono`,children:e.branchName}):``,` could not be merged because `,k.conflicts,` file`,k.conflicts===1?``:`s`,` diverged from the base branch. You can send it back for rework so the agent resolves the conflicts.`]}),k.conflictFiles?.length>0&&(0,G.jsx)(`ul`,{className:`text-xs opacity-60 mt-1 ml-4 list-disc space-y-0.5`,children:k.conflictFiles.map(e=>(0,G.jsx)(`li`,{className:`font-mono`,children:e},e))}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-warning gap-1 mt-2`,onClick:()=>r?.(e.id),children:[(0,G.jsx)(Y,{className:`size-3`}),` Requeue for Rework`]})]})]}),!A&&S&&(!k||k.conflicts===0)&&(0,G.jsxs)(`div`,{className:`alert border border-info/30 bg-info/5 text-sm`,children:[(0,G.jsx)(fn,{className:`size-4 shrink-0 text-info`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:`Review approved, merge still pending`}),(0,G.jsxs)(`p`,{className:`text-xs opacity-70 mt-0.5`,children:[`The code is still isolated on `,e.branchName?(0,G.jsx)(`span`,{className:`font-mono`,children:e.branchName}):`the issue branch`,` and in the worktree until you run Merge.`]})]})]}),S&&(0,G.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,G.jsx)(Vt,{className:`size-4`}),` This issue has been approved.`]}),e.state===`Blocked`&&(0,G.jsxs)(`div`,{className:`alert alert-error text-sm`,children:[(0,G.jsx)(X,{className:`size-4`}),` Review failed. Check execution output.`]}),u===`approved`&&x&&(0,G.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,G.jsx)(nr,{className:`size-4`}),` Approved! Moving to Approved.`]}),u===`rework`&&(0,G.jsxs)(`div`,{className:`alert alert-warning text-sm`,children:[(0,G.jsx)(Y,{className:`size-4`}),` Sent back for rework.`]}),x&&!u&&(0,G.jsx)(Z,{title:`Review Checklist`,icon:Kt,children:(0,G.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,G.jsx)(`p`,{className:`opacity-60`,children:`Before deciding, consider:`}),(0,G.jsxs)(`ul`,{className:`list-disc ml-5 space-y-1 opacity-80`,children:[(0,G.jsx)(`li`,{children:`Does the diff address the issue title and description?`}),(0,G.jsx)(`li`,{children:`Are there unintended side effects or regressions?`}),(0,G.jsx)(`li`,{children:`Is the scope appropriate — no unnecessary changes?`}),(0,G.jsx)(`li`,{children:`Are there files that shouldn't have been modified?`})]})]})}),(0,G.jsx)(Z,{title:`Changes`,icon:Jt,children:o?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-4`,children:[(0,G.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),` Loading changes...`]}):C.length>0?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,G.jsxs)(`span`,{className:`opacity-60`,children:[C.length,` file`,C.length===1?``:`s`]}),(0,G.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,i?.totalAdditions||0]}),(0,G.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,i?.totalDeletions||0]})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:C.map(e=>(0,G.jsx)(gi,{file:e,isOpen:f===e.path,onToggle:()=>p(f===e.path?null:e.path)},e.path))}),f&&T[f]&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:f}),(0,G.jsx)(_i,{lines:T[f]})]})]}):(0,G.jsx)(`div`,{className:`text-sm opacity-40 py-4`,children:`No changes detected.`})}),(e.lastError||e.commandOutputTail)&&(0,G.jsxs)(Z,{title:`Agent Output`,icon:er,children:[e.lastError&&(0,G.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-2`,children:e.lastError}),e.commandOutputTail&&!e.lastError&&(0,G.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto`,children:e.commandOutputTail})]}),(x||S)&&(0,G.jsxs)(Z,{title:`Evidence`,icon:vn,children:[(0,G.jsx)(`input`,{ref:v,type:`file`,multiple:!0,accept:`image/*`,className:`hidden`,onChange:e=>b(Array.from(e.target.files??[]))}),m.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map((e,n)=>{let r=e.split(`/`).pop(),i=`/api/issues/${encodeURIComponent(t)}/images/${encodeURIComponent(r)}`;return(0,G.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`block`,children:(0,G.jsx)(`img`,{src:i,alt:r,className:`size-20 object-cover rounded-lg border border-base-300 hover:opacity-80 transition-opacity`})},n)})}):(0,G.jsx)(`p`,{className:`text-xs opacity-40`,children:`No screenshots attached yet.`}),x&&(0,G.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-ghost gap-1 mt-2`,onClick:()=>v.current?.click(),disabled:g,children:[g?(0,G.jsx)(J,{className:`size-3 animate-spin`}):(0,G.jsx)(In,{className:`size-3`}),`Attach Screenshot`]})]}),x&&!u&&(0,G.jsx)(Z,{title:`Review Note`,icon:er,children:(0,G.jsx)(`textarea`,{className:`textarea textarea-bordered w-full text-sm`,rows:3,placeholder:`Describe what needs to change (sent to the agent on Rework)...`,value:c,onChange:e=>l(e.target.value)})}),x&&!u&&(0,G.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`text-sm font-semibold`,children:`Verdict`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:E,children:[(0,G.jsx)(nr,{className:`size-4`}),` Approve`]}),(0,G.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:D,children:[(0,G.jsx)(Y,{className:`size-4`}),` Request Rework`]}),(0,G.jsxs)(`button`,{className:`btn btn-error btn-sm gap-1.5 flex-1`,onClick:O,children:[(0,G.jsx)(tr,{className:`size-4`}),` Reject`]})]}),(0,G.jsxs)(`p`,{className:`text-xs opacity-40`,children:[(0,G.jsx)(`strong`,{children:`Approve`}),` moves to Approved. `,(0,G.jsx)(`strong`,{children:`Rework`}),` sends back to executor. `,(0,G.jsx)(`strong`,{children:`Reject`}),` blocks the issue.`]})]})]})}function Fi({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,U.useState)(!1),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(!1),g=(0,U.useCallback)(async()=>{d(!0),p(null);try{let t=await B.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]),_=e.state===`Planning`,v=e.state===`PendingApproval`,y=e.state===`Running`||e.state===`Queued`,b=e.state===`Reviewing`||e.state===`PendingDecision`,x=e.state===`Approved`,S=e.state===`Merged`,C=!!e.mergedAt||S;return _?null:v?(0,G.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-1.5`,style:l,children:[f&&(0,G.jsxs)(`div`,{className:`alert alert-error text-xs py-1.5`,children:[(0,G.jsx)(X,{className:`size-3.5`}),` `,f]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsx)(`button`,{className:`btn btn-primary btn-sm gap-1.5 flex-1`,onClick:g,disabled:u,children:u?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(J,{className:`size-4 animate-spin`}),` Starting...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ut,{className:`size-4`}),` Execute`]})})})]}):y?(0,G.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,G.jsx)(`span`,{className:`issue-phase-dot`}),(0,G.jsx)(`span`,{className:`text-sm opacity-50`,children:`Watching...`})]}):b?(0,G.jsxs)(G.Fragment,{children:[m&&(0,G.jsx)(Gr,{issue:e,onClose:()=>h(!1)}),(0,G.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-1.5`,style:l,children:[(0,G.jsxs)(`button`,{className:`btn btn-primary btn-sm btn-soft gap-1.5 w-full`,onClick:()=>h(!0),children:[(0,G.jsx)(nn,{className:`size-3.5`}),` Preview Changes`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Approved`),children:[(0,G.jsx)(nr,{className:`size-4`}),` Approve`]}),(0,G.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:()=>n?.(e.id),children:[(0,G.jsx)(Y,{className:`size-4`}),` Rework`]})]})]})]}):x&&!C?(0,G.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 space-y-2`,style:l,children:[o&&(0,G.jsxs)(`div`,{className:`alert alert-error text-sm py-2`,children:[(0,G.jsx)(X,{className:`size-4`}),` `,o]}),s&&!o&&(0,G.jsxs)(`div`,{className:`alert alert-success text-sm py-2`,children:[(0,G.jsx)(`span`,{className:`size-4`}),` `,s]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:c===`push-pr`?(0,G.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,G.jsx)(J,{className:`size-4 animate-spin`}):(0,G.jsx)(mn,{className:`size-4`}),a?`Pushing...`:e.baseBranch?(0,G.jsxs)(G.Fragment,{children:[`Push PR → `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Push & Open PR`]}):(0,G.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,G.jsx)(J,{className:`size-4 animate-spin`}):(0,G.jsx)(K,{className:`size-4`}),a?`Merging...`:e.baseBranch?(0,G.jsxs)(G.Fragment,{children:[`Merge → `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.baseBranch})]}):`Merge to Project`]})})]}):null}function Ii({issue:e,onClose:t,onStateChange:n,onRetry:r,onCancel:i,events:a,mergeMode:o,tabRef:s}){let[c,l]=(0,U.useState)(`overview`),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(null),w=(0,U.useRef)(null),{data:T}=Yr(),E=(0,U.useCallback)(async()=>{if(!(!e?.id||b)){x(!0),C(null);try{let t=await B.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,U.useCallback)(()=>{p(!0),setTimeout(()=>{d(!1),p(!1),t()},250)},[t]),{ref:O,handlers:k}=Nr({onDismiss:D,direction:`right`});(0,U.useEffect)(()=>{e&&l(ni(e.state))},[e?.id]),(0,U.useEffect)(()=>{s&&(s.current={get:()=>c,set:e=>l(e)})},[s,c]),(0,U.useEffect)(()=>{h(!1),_(null),y(null),e&&(d(!0),p(!1))},[e?.id,e?.state]);let A=(0,U.useCallback)(async()=>{if(!(!e?.id||m)){h(!0),_(null),y(null);try{let t=await B.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,U.useCallback)(async()=>{if(!(!e?.id||m)){h(!0),_(null),y(null);try{let t=await B.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,U.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,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/35 ${f?`animate-fade-out`:`animate-fade-in`}`,onClick:D,children:(0,G.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,G.jsxs)(`div`,{className:`px-6 pt-4 pb-0 shrink-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-40 shrink-0`,children:e.identifier}),e.baseBranch&&(0,G.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,G.jsx)(K,{className:`size-2.5`}),e.baseBranch]}),e.state!==`Planning`&&e.plan&&![`Running`,`Reviewing`,`Queued`].includes(e.state)&&(0,G.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,G.jsx)(J,{className:`size-3 animate-spin`}):(0,G.jsx)(Y,{className:`size-3`}),`Replan`]}),S&&(0,G.jsx)(`span`,{className:`text-xs text-error truncate`,children:S})]}),(0,G.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle shrink-0`,onClick:D,"aria-label":`Close`,children:(0,G.jsx)(pr,{className:`size-4`})})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 mb-1`,children:[(0,G.jsx)(`h2`,{className:`text-lg font-bold leading-tight flex-1`,children:e.title||`-`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 mt-0.5 flex-wrap justify-end`,children:[e.issueType&&ei[e.issueType]&&(0,G.jsx)(`span`,{className:`badge badge-sm ${ei[e.issueType]} badge-soft`,children:e.issueType}),(e.planVersion??0)>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-info badge-soft font-mono`,children:[`Plan v`,e.planVersion]}),(e.executeAttempt??0)>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-ghost font-mono opacity-60`,children:[`exec v`,e.planVersion??1,`a`,e.executeAttempt]})]})]}),e.description&&(0,G.jsx)(`p`,{className:`text-xs opacity-45 leading-relaxed mb-1 line-clamp-2`,children:e.description}),(0,G.jsx)(oi,{issue:e}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.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:ti.map(({id:t,label:n,icon:r,color:i,activeColor:a})=>{let o=c===t,s=o?a.replace(`tab-active `,``):i;return(0,G.jsxs)(`a`,{role:`tab`,className:`tab gap-1 text-xs whitespace-nowrap ${o?a:i} ${o?`font-semibold`:``}`,onClick:()=>l(t),children:[(0,G.jsx)(r,{className:`size-3 ${s}`}),n,t===`review`&&(e.state===`Reviewing`||e.state===`PendingDecision`)&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-secondary`,children:`!`}),t===`planning`&&e.planningStatus===`planning`&&(0,G.jsx)(`span`,{className:`loading loading-spinner loading-xs text-info`}),t===`planning`&&M&&(0,G.jsx)(`span`,{className:`loading loading-dots loading-xs text-info opacity-50`})]},t)})}),(0,G.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,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4 min-h-0 drawer-safe-bottom`,children:(0,G.jsxs)(`div`,{className:`animate-fade-in`,children:[c===`overview`&&(0,G.jsx)(fi,{issue:e,onStateChange:n,onRetry:r,onCancel:i}),c===`planning`&&(0,G.jsx)(Ni,{issue:e,onStateChange:n,workflowConfig:T}),c===`review`&&(0,G.jsx)(Pi,{issue:e,issueId:e.id,onStateChange:n,onRetry:r}),c===`execution`&&(0,G.jsx)(mi,{issue:e,workflowConfig:T}),c===`diff`&&(0,G.jsx)(vi,{issueId:e.id}),c===`routing`&&(0,G.jsx)(xi,{issue:e}),c===`events`&&(0,G.jsx)(ji,{issueId:e.id,events:a})]},c)}),(0,G.jsx)(Fi,{issue:e,onStateChange:n,onRetry:r,onMerge:A,onPush:j,mergeBusy:m,mergeError:g,mergeNotice:v,mergeMode:o})]})})}function Li({pwa:e}){return e?e.updateAvailable?(0,G.jsxs)(`div`,{className:`alert alert-info rounded-none border-x-0`,children:[(0,G.jsx)(Vn,{className:`size-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:`A fresh dashboard build is ready.`}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>e.applyUpdate(),children:`Reload app`})]}):e.isOnline?null:(0,G.jsxs)(`div`,{className:`alert alert-warning rounded-none border-x-0`,children:[(0,G.jsx)(lr,{className:`size-4`}),(0,G.jsx)(`span`,{className:`text-sm`,children:`You are offline. The app shell is available, but live runtime data may be stale.`})]}):null}var Ri=[`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 zi(e,t){return Math.random()*(t-e)+e}function Bi({color:e,style:t}){return(0,G.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 Vi({x:e=`50%`,y:t=`50%`,active:n,onDone:r,count:i=24}){let[a,o]=(0,U.useState)([]),s=(0,U.useRef)(r);(0,U.useEffect)(()=>{s.current=r},[r]);let c=(0,U.useCallback)(()=>{let e=Array.from({length:i},(e,t)=>{let n=Math.PI*2*t/i+zi(-.3,.3),r=zi(40,120),a=zi(4,8);return{id:t,color:Ri[t%Ri.length],size:a,x:0,y:0,tx:`${Math.cos(n)*r}px`,ty:`${Math.sin(n)*r-zi(20,60)}px`,r:`${zi(-180,180)}deg`,duration:zi(600,1e3)}});o(e);let t=Math.max(...e.map(e=>e.duration));setTimeout(()=>{o([]),s.current?.()},t+50)},[i]);return(0,U.useEffect)(()=>{n&&c()},[n,c]),a.length===0?null:(0,G.jsx)(`div`,{className:`fixed pointer-events-none z-[100]`,style:{left:e,top:t,transform:`translate(-50%, -50%)`},children:a.map(e=>(0,G.jsx)(Bi,{color:e.color,style:e},e.id))})}var Hi=[`shift`,`alt`,`meta`,`mod`,`ctrl`,`control`],Ui={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 Wi(e){return(Ui[e.trim()]||e.trim()).toLowerCase().replace(/key|digit|numpad/,``)}function Gi(e){return Hi.includes(e)}function Ki(e,t=`,`){return e.toLowerCase().split(t)}function qi(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=>Wi(e))):o=e.toLocaleLowerCase().split(t).map(e=>Wi(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=>!Hi.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&&Zi([Wi(e.code)])}),document.addEventListener(`keyup`,e=>{e.code!==void 0&&Qi([Wi(e.code)])})),typeof window<`u`&&(window.addEventListener(`blur`,()=>{Ji.clear()}),window.addEventListener(`contextmenu`,()=>{setTimeout(()=>{Ji.clear()},0)}));var Ji=new Set;function Yi(e){return Array.isArray(e)}function Xi(e,t=`,`){return(Yi(e)?e:e.split(t)).every(e=>Ji.has(e.trim().toLowerCase()))}function Zi(e){let t=Array.isArray(e)?e:[e];Ji.has(`meta`)&&Ji.forEach(e=>{Gi(e)||Ji.delete(e.toLowerCase())}),t.forEach(e=>{Ji.add(e.toLowerCase())})}function Qi(e){e===`meta`?Ji.clear():(Array.isArray(e)?e:[e]).forEach(e=>{Ji.delete(e.toLowerCase())})}function $i(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function ea(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}var ta=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`];function na(e){return ra(e,ta)}function ra(e,t=!1){let{target:n,composed:r}=e,i,a;return ia(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),Yi(t)?!!(i&&t&&t.some(e=>e.toLowerCase()===i.toLowerCase()||e===a)):!!(i&&t&&t)}function ia(e){return!!e.tagName&&!e.tagName.startsWith(`-`)&&e.tagName.includes(`-`)}function aa(e,t){return e.length===0&&t?!1:t?e.some(e=>t.includes(e))||e.includes(`*`):!0}var oa=(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=Wi(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)?Xi(c):!1:!c||c.length===0},sa=(0,U.createContext)(void 0),ca=()=>(0,U.useContext)(sa);function la({addHotkey:e,removeHotkey:t,children:n}){return(0,G.jsx)(sa.Provider,{value:{addHotkey:e,removeHotkey:t},children:n})}function ua(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&&ua(e[r],t[r]),!0):e===t}var da=(0,U.createContext)({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),fa=()=>(0,U.useContext)(da),pa=({initiallyActiveScopes:e=[`*`],children:t})=>{let[n,r]=(0,U.useState)(e),[i,a]=(0,U.useState)([]),o=(0,U.useCallback)(e=>{r(t=>t.includes(`*`)?[e]:Array.from(new Set([...t,e])))},[]),s=(0,U.useCallback)(e=>{r(t=>t.filter(t=>t!==e))},[]),c=(0,U.useCallback)(e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):t.includes(`*`)?[e]:Array.from(new Set([...t,e])))},[]),l=(0,U.useCallback)(e=>{a(t=>[...t,e])},[]),u=(0,U.useCallback)(e=>{a(t=>t.filter(t=>!ua(t,e)))},[]);return(0,G.jsx)(da.Provider,{value:{activeScopes:n,hotkeys:i,enableScope:o,disableScope:s,toggleScope:c},children:(0,G.jsx)(la,{addHotkey:l,removeHotkey:u,children:t})})};function ma(e){let t=(0,U.useRef)(void 0);return ua(t.current,e)||(t.current=e),t.current}var ha=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},ga=typeof window<`u`?U.useLayoutEffect:U.useEffect;function $(e,t,n,r){let i=(0,U.useRef)(null),a=(0,U.useRef)(!1),o=Array.isArray(n)?Array.isArray(r)?void 0:r:n,s=Yi(e)?e.join(o?.delimiter):e,c=Array.isArray(n)?n:Array.isArray(r)?r:void 0,l=(0,U.useCallback)(t,c??[]),u=(0,U.useRef)(l);c?u.current=l:u.current=t;let d=ma(o),{activeScopes:f}=fa(),p=ca();return ga(()=>{if(d?.enabled===!1||!aa(f,d?.scopes))return;let e=[],t,n=(n,r=!1)=>{if(!(na(n)&&!ra(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)){ha(n);return}}n.target?.isContentEditable&&!d?.enableOnContentEditable||Ki(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=qi(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:Wi(n.code);if(Gi(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(oa(n,o,d?.ignoreModifiers)||o.keys?.includes(`*`)){if(d?.ignoreEventWhen?.(n)||r&&a.current)return;if($i(n,o,d?.preventDefault),!ea(n,o,d?.enabled)){ha(n);return}u.current(n,o),r||(a.current=!0)}})}},r=e=>{e.code!==void 0&&(Zi(Wi(e.code)),(d?.keydown===void 0&&d?.keyup!==!0||d?.keydown)&&n(e))},c=e=>{e.code!==void 0&&(Qi(Wi(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&&Ki(s,d?.delimiter).forEach(e=>{p.addHotkey(qi(e,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description,d?.metadata))}),()=>{l.removeEventListener(`keyup`,c,o?.eventListenerOptions),l.removeEventListener(`keydown`,r,o?.eventListenerOptions),p&&Ki(s,d?.delimiter).forEach(e=>{p.removeHotkey(qi(e,d?.splitKey,d?.sequenceSplitKey,d?.useKey,d?.description,d?.metadata))}),e=[],t&&clearTimeout(t)}},[s,d,f]),i}var _a=`modulepreload`,va=function(e){return`/assets/`+e},ya={},ba=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=va(t,n),t in ya)return;ya[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`:_a,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)})},xa=(0,U.lazy)(()=>ba(()=>import(`./KeyboardShortcutsHelp-D71YmyfF.js`),__vite__mapDeps([0,1,2]))),Sa=(0,U.lazy)(()=>ba(()=>import(`./CommandPalette-CyyF04a2.js`),__vite__mapDeps([3,1,2,4])));function Ca({children:e}){let t=A().location.pathname,n=(0,U.useRef)(null),r=(0,U.useRef)(t);return(0,U.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,G.jsx)(`div`,{ref:n,className:`flex-1 flex flex-col min-h-0`,children:e})}function wa(){let e=xt(),t=w(),n=A().location.pathname,[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=(0,U.useRef)(null),[,c]=(0,U.useState)(0);(0,U.useEffect)(()=>{document.title=e.queueTitle||`fifony`},[e.queueTitle]);let l=!!e.selectedIssue,u=e.isCreateOpen,d=a,f=r,p=(0,U.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,U.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,U.useCallback)(e=>{if(!s.current)return;let t=ti.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,U.useCallback)(()=>{let t=e.selectedIssue;if(!t)return;let n=t.state;n===`PendingApproval`?ba(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`?e.updateState(t.id,`Approved`):n===`Approved`&&!t.mergedAt&&ba(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===`Reviewing`||v===`PendingDecision`,b=v===`Approved`&&!e.selectedIssue?.mergedAt,S=!!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`,()=>ba(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:b,enableOnFormTags:!0,preventDefault:!0,description:`Merge issue`,metadata:{group:`drawer`}},[e,b]),$(`mod+w`,()=>e.retryIssue(e.selectedIssue.id),{enabled:y,enableOnFormTags:!0,preventDefault:!0,description:`Rework issue`,metadata:{group:`drawer`}},[e,y]),$(`mod+p`,()=>ba(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:S,enableOnFormTags:!0,preventDefault:!0,description:`Replan issue`,metadata:{group:`drawer`}},[e,S]);let[C,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),O=(0,U.useRef)(null),k=e.runtime.isLoading&&!e.runtime.data&&!e.runtime.isError;if((0,U.useEffect)(()=>(!C&&!O.current&&(O.current=setTimeout(()=>{D(!0),setTimeout(()=>T(!0),400)},1e3)),()=>{}),[C]),!C&&k)return(0,G.jsx)(Ta,{});if(!C&&E)return(0,G.jsx)(Ta,{fadeOut:!0});if(!C&&!k)return(0,G.jsx)(Ta,{});let j=e.toast?.type||`info`,M=typeof e.toast==`string`?e.toast:e.toast?.message;return(0,G.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[e.toast&&(0,G.jsx)(`div`,{className:`toast toast-end toast-top z-50`,children:(0,G.jsxs)(`div`,{className:`alert text-sm shadow-lg ${j===`success`?`alert-success`:j===`error`?`alert-error`:`alert-info`} ${e.toastExiting?`animate-toast-out`:`animate-toast-in`}`,children:[j===`success`?(0,G.jsx)(Bt,{className:`size-4`}):j===`error`?(0,G.jsx)(X,{className:`size-4`}):(0,G.jsx)(bn,{className:`size-4`}),(0,G.jsx)(`span`,{children:M}),(0,G.jsx)(`div`,{className:`toast-progress`})]})}),e.confetti&&(0,G.jsx)(Vi,{x:e.confetti.x,y:e.confetti.y,count:e.confetti.count,active:!0,onDone:()=>e.clearConfetti?.()}),(0,G.jsx)(kr,{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,G.jsx)(Li,{pwa:e.pwa}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0`,children:[(0,G.jsx)(Ca,{children:(0,G.jsx)(x,{})}),e.runtime.isError&&(0,G.jsx)(`div`,{className:`px-4 pb-4`,children:(0,G.jsx)(`div`,{className:`alert alert-error`,children:String(e.runtime.error?.message||`Runtime unavailable`)})})]}),(0,G.jsx)(Ar,{onClick:()=>e.setIsCreateOpen(!0)}),(0,G.jsx)(jr,{}),(0,G.jsx)(Vr,{open:e.isCreateOpen,onClose:()=>e.setIsCreateOpen(!1),onSubmit:t=>e.createIssue.mutate(t),isLoading:e.createIssue.isPending,onToast:e.showToast}),(0,G.jsx)(Ii,{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,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(xa,{open:r,onClose:()=>i(!1)})}),a&&(0,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(Sa,{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 Ta({fadeOut:e=!1}){return(0,G.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,G.jsxs)(`div`,{className:`relative z-10 flex flex-col items-center gap-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,G.jsx)(`img`,{src:de,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,G.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,G.jsx)(`span`,{className:`text-primary`,children:`fifony`})})]}),(0,G.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,G.jsx)(`span`,{className:`loading loading-dots loading-sm`}),(0,G.jsx)(`span`,{className:`text-sm`,children:`Warming up the orchestra...`})]})]})})}function Ea({children:e}){let t=ze(),n=Ie(Fe(t.data),`ui.onboarding.completed`,null);return t.isLoading&&!t.data?(0,G.jsx)(Ta,{}):t.isError||n===!0?e:(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(Ta,{}),children:(0,G.jsx)(Da,{})})}function Da(){let e=w(),t=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{t.current||(t.current=!0,e({to:`/onboarding`,replace:!0}))},[e]),(0,G.jsx)(Ta,{})}function Oa(){return A().location.pathname===`/onboarding`?(0,G.jsx)(x,{}):(0,G.jsx)(pa,{children:(0,G.jsx)(Ea,{children:(0,G.jsx)(St,{children:(0,G.jsx)(wa,{})})})})}function ka(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 Aa(e){if(!e)return e;try{let t=new URL(e);return t.pathname+(t.searchParams.toString()?`?`+t.searchParams:``)}catch{return e}}function ja({text:e}){let[t,n]=(0,U.useState)(!1);return(0,G.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 Ma({error:e,reset:t}){let[n,r]=(0,U.useState)(!0),[i,a]=(0,U.useState)(!1),o=e?.name||`Error`,s=e?.message||String(e)||`An unexpected error occurred.`,c=e?.stack||``,l=ka(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,G.jsxs)(`div`,{className:`min-h-screen bg-base-200 flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`bg-error text-error-content px-4 py-2.5 flex items-center gap-3 shrink-0`,children:[(0,G.jsx)(X,{className:`size-4 shrink-0`}),(0,G.jsxs)(`span`,{className:`font-mono text-sm font-semibold flex-1 truncate`,children:[o,`: `,s]}),(0,G.jsx)(`span`,{className:`text-xs opacity-60 shrink-0`,children:d})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col lg:flex-row gap-0 min-h-0 overflow-auto`,children:[(0,G.jsxs)(`div`,{className:`flex-1 p-6 space-y-5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Error`}),(0,G.jsx)(ja,{text:p})]}),(0,G.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`badge badge-error badge-sm mt-0.5 shrink-0 font-mono`,children:o}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-error leading-relaxed break-all`,children:s})]}),m&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-base-content/50`,children:[(0,G.jsx)(`span`,{className:`opacity-40`,children:`at`}),(0,G.jsx)(`span`,{className:`font-mono font-semibold text-base-content/70`,children:m.fn||`<anonymous>`}),(0,G.jsx)(`span`,{className:`opacity-30`,children:`—`}),(0,G.jsx)(`span`,{className:`font-mono`,children:Aa(m.file)}),m.line&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`:`,m.line,`:`,m.col]})]})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,G.jsx)(`div`,{className:`px-5 py-3 border-b border-base-300`,children:(0,G.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider opacity-40`,children:`Context`})}),(0,G.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,G.jsxs)(`div`,{className:`px-5 py-2.5 flex items-start gap-4`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold opacity-40 w-24 shrink-0 pt-0.5`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs break-all text-base-content/70`,children:t})]},e))})]}),l.length>0&&(0,G.jsxs)(`div`,{className:`bg-base-100 rounded-2xl border border-base-300 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-5 py-3 border-b border-base-300 flex items-center justify-between gap-3`,children:[(0,G.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,G.jsx)(It,{className:`size-3.5 transition-transform ${n?`rotate-180`:``}`}),`Stack trace`,(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost normal-case tracking-normal font-mono`,children:[l.length,` frames`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost opacity-50 hover:opacity-100 ${i?`btn-active`:``}`,onClick:()=>a(e=>!e),children:`raw`}),(0,G.jsx)(ja,{text:c})]})]}),n&&(i?(0,G.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,G.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=Aa(e.file);return(0,G.jsxs)(`div`,{className:`px-5 py-2 flex items-start gap-3 ${n?`bg-warning/5`:`opacity-40`}`,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] opacity-30 w-5 shrink-0 text-right pt-0.5`,children:t}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[e.fn&&(0,G.jsx)(`span`,{className:`font-mono text-xs font-semibold ${n?`text-warning`:`text-base-content/60`}`,children:e.fn}),n&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-warning badge-soft`,children:`app`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[10px] text-base-content/40 truncate`,children:[r,e.line&&(0,G.jsxs)(`span`,{className:`text-base-content/60 ml-0.5`,children:[`:`,e.line,`:`,e.col]})]})]})]},t)})}))]})]}),(0,G.jsxs)(`div`,{className:`lg:w-64 p-6 space-y-4 shrink-0`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-primary w-full gap-2`,onClick:()=>window.location.reload(),children:[(0,G.jsx)(Y,{className:`size-4`}),` Reload page`]}),t&&(0,G.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:t,children:`Try to recover`}),(0,G.jsx)(`button`,{className:`btn btn-ghost w-full gap-2`,onClick:()=>{window.location.href=`/`},children:`Go home`})]}),(0,G.jsx)(`div`,{className:`divider text-xs opacity-30`,children:`about`}),(0,G.jsxs)(`div`,{className:`space-y-1 text-xs text-base-content/40`,children:[(0,G.jsx)(`p`,{children:`This error was caught by the app's error boundary. The details above will help you identify the root cause.`}),(0,G.jsxs)(`p`,{className:`mt-2`,children:[`App frames are `,(0,G.jsx)(`span`,{className:`text-warning font-semibold`,children:`highlighted`}),`.`]})]})]})]})]})}var Na=k({component:Oa,errorComponent:Ma}),Pa=[{to:`/settings/project`,label:`Project`,icon:cn},{to:`/settings/workflow`,label:`Execution`,icon:dr},{to:`/settings/agents`,label:`Agents`,icon:or},{to:`/settings/general`,label:`System`,icon:Wn},{to:`/settings/notifications`,label:`Notifications`,icon:kt},{to:`/settings/providers`,label:`Providers`,icon:qn},{to:`/settings/hotkeys`,label:`Hotkeys`,icon:Sn}],Fa=m(`/settings`)({component:Ia});function Ia(){let e=A().location.pathname;return(0,G.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,G.jsxs)(`div`,{className:`max-w-5xl w-full mx-auto flex-1 flex flex-col min-h-0 gap-5`,children:[(0,G.jsx)(`div`,{role:`tablist`,className:`tabs tabs-lift overflow-x-auto flex-nowrap scrollbar-none`,style:{scrollbarWidth:`none`},children:Pa.map(({to:t,label:n,icon:r})=>(0,G.jsxs)(g,{to:t,role:`tab`,className:`tab gap-1.5 whitespace-nowrap ${e.startsWith(t)?`tab-active`:``}`,children:[(0,G.jsx)(r,{className:`size-3.5`}),n]},t))}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,G.jsx)(x,{})})]})})}var La=(0,U.lazy)(()=>ba(()=>import(`./OnboardingWizard-TLlzqU2A.js`),__vite__mapDeps([6,1,5,2,4])));function Ra(){let e=w(),t=T();return(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,G.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,G.jsx)(La,{onComplete:()=>{t.invalidateQueries({queryKey:W}),e({to:`/`})}})})}var za=m(`/onboarding`)({component:Ra});function Ba(e){let[t,n]=(0,U.useState)(()=>Va(e)),r=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(!e){n(null);return}let t=()=>n(Va(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 Va(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 Ha={bug:`badge-error`,feature:`badge-primary`,refactor:`badge-warning`,docs:`badge-info`,chore:`badge-secondary`},Ua={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 Wa(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ga(e){if(!e)return null;let t=e.match(/\d+$/);return t?t[0]:null}function Ka(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 qa(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:Ka(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 Ja(e){return e?e.reviewer?.totalTokens>0?`reviewing`:e.executor?.totalTokens>0?`executing`:e.planner?.totalTokens>0?`planning`:null:null}function Ya(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 Xa(e){return e.state===`Reviewing`?e.updatedAt:e.state===`PendingDecision`?e.completedAt||e.updatedAt:e.state===`Blocked`?e.updatedAt:null}function Za(e){let{state:t,planningStatus:n,assignedToWorker:r,startedAt:i,tokenUsage:a,tokensByPhase:o}=e;switch(t){case`Planning`:return n===`planning`?{label:`Writing plan…`,Icon:J,spin:!0,pulse:!1,color:`text-info`}:e.plan?{label:`Plan ready`,Icon:wn,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:qt,spin:!1,pulse:!0,color:`text-info/50`};case`PendingApproval`:return null;case`Queued`:return r?{label:`Starting…`,Icon:Rn,spin:!1,pulse:!0,color:`text-primary/80`}:{label:`In queue`,Icon:En,spin:!1,pulse:!1,color:`text-base-content/40`};case`Running`:{let e=Ja(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning…`,Icon:J,spin:!0,pulse:!1,color:`text-primary`}:t?e===`reviewing`?{label:`Reviewing…`,Icon:nn,spin:!1,pulse:!0,color:`text-secondary`}:e===`planning`?{label:`Planning…`,Icon:wn,spin:!1,pulse:!0,color:`text-info`}:{label:`Working…`,Icon:Rn,spin:!1,pulse:!0,color:`text-primary`}:{label:`Starting…`,Icon:J,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,U.useState)(()=>e?Math.max(0,Date.now()-new Date(e).getTime()):0);return(0,U.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 $a({issue:e}){let t=Za(e),n=Xa(e),r=Qa(t===`stall`?n:null),i=Ba(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,G.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] font-medium ${t}`,children:[(0,G.jsx)(qt,{size:10,className:`shrink-0`}),(0,G.jsx)(`span`,{className:`tabular-nums font-mono`,children:Ya(r)}),(0,G.jsxs)(`span`,{className:`opacity-60 font-normal`,children:[`· `,i]})]})}let{label:a,Icon:o,spin:s,pulse:c,color:l}=t;return(0,G.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] ${l}`,children:[o&&(0,G.jsx)(o,{size:10,className:[s?`animate-spin`:``,c?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,G.jsx)(`span`,{className:`font-medium truncate`,children:a}),i&&(0,G.jsx)(`span`,{className:`font-mono opacity-50 tabular-nums shrink-0 ml-0.5`,children:i})]})}function eo({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,U.useRef)(e.tokenUsage?.totalTokens),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(!1),S=(0,U.useRef)(e.state);(0,U.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,U.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=Ga(e.identifier),w=Wa(e.tokenUsage?.totalTokens||0),T=e.history?.length||0,E=qa(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,G.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`,Ua[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,G.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,G.jsx)(`div`,{className:`absolute top-1.5 left-1.5 z-10`,children:(0,G.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,G.jsx)(Zn,{size:14})})}),(0,G.jsxs)(`div`,{className:`card-body gap-1 p-3 relative`,children:[(0,G.jsx)(`div`,{className:o?`pl-5`:``,children:(0,G.jsx)($a,{issue:e})}),(0,G.jsx)(`h3`,{className:[`font-semibold text-sm leading-snug`,d?`line-through opacity-40`:``].filter(Boolean).join(` `),children:e.title}),E.length>0&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-35 truncate`,children:E.map(e=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 shrink-0`,children:[e.label&&(0,G.jsx)(`span`,{className:`opacity-50 uppercase tracking-wide`,style:{fontSize:`8px`},children:e.label}),(0,G.jsx)(`span`,{children:e.model}),e.effort&&(0,G.jsxs)(`span`,{className:`opacity-60`,children:[`·`,e.effort]})]},e.label??`single`))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] opacity-40 mt-0.5`,children:[e.issueType&&Ha[e.issueType]&&(0,G.jsx)(`span`,{className:`badge badge-xs ${Ha[e.issueType]} badge-soft shrink-0`,children:e.issueType}),e.planVersion>1&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-info badge-soft shrink-0 font-mono`,children:[`v`,e.planVersion]}),w&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 ${v?`animate-count-bump`:``}`,children:[(0,G.jsx)(mr,{size:9}),w]}),T>0&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(Ct,{size:9}),T]}),(0,G.jsx)(`span`,{className:`shrink-0`,children:V(e.createdAt)}),h&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-error font-semibold ml-auto shrink-0 opacity-100`,children:[(0,G.jsx)(Wt,{size:10}),`merge failed`]}),g&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-semibold ml-auto shrink-0 opacity-100 animate-pulse`,children:[(0,G.jsx)(pn,{size:10}),`ready to merge`]}),m&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-success font-semibold ml-auto shrink-0 opacity-100`,children:[(0,G.jsx)(K,{size:10}),`merged`]})]})]}),s&&(0,G.jsx)(`div`,{className:`issue-heartbeat-bar animate-pulse-soft`}),p&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-info animate-pulse-soft`}),c&&!p&&!e.plan&&!e.planningError&&(0,G.jsx)(`div`,{className:`h-[2px] rounded-b-[var(--rounded-box,1rem)] bg-info/20 animate-pulse`}),h&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-error animate-pulse`}),g&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-warning animate-pulse-soft`}),m&&(0,G.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-success`})]})}function to({icon:e=yn,title:t=`Nothing here`,description:n=``,action:r,actionLabel:i=`Action`}){return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 opacity-60 animate-fade-in-up`,children:[(0,G.jsx)(e,{className:`size-12 mb-4 opacity-40`}),(0,G.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:t}),n&&(0,G.jsx)(`p`,{className:`text-sm opacity-70 text-center max-w-xs`,children:n}),r&&(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary mt-4`,onClick:r,children:i})]})}var no={Planning:[`Planning`],"Needs Approval":[`PendingApproval`,`PendingDecision`],"In Progress":[`Queued`,`Running`,`Reviewing`],Blocked:[`Blocked`],Done:[`Approved`,`Merged`,`Cancelled`]},ro=new Set([`Planning`]),io=new Set([`PendingApproval`,`PendingDecision`]),ao=new Set([`Queued`,`Running`,`Reviewing`]),oo=new Set([`Approved`,`Merged`,`Cancelled`]);function so(e){return ro.has(e)?`Planning`:io.has(e)?`Needs Approval`:ao.has(e)?`In Progress`:oo.has(e)?`Done`:e}function co(e){let t=R[e];if(!t)return new Set;let n=new Set(t.map(e=>so(e)));return n.delete(so(e)),n}var lo=300,uo=5;function fo({onStateChange:e}){let[t,n]=(0,U.useState)(null),r=(0,U.useRef)(null),i=(0,U.useRef)({pointerId:null,startX:0,startY:0,isDragging:!1,longPressTimer:null,longPressReady:!1,pointerType:null,issue:null,sourceColumn:null,didDrag:!1}),a=(0,U.useRef)(null),o=(0,U.useRef)(new Map);(0,U.useEffect)(()=>()=>{clearTimeout(i.current.longPressTimer)},[]);let s=(0,U.useCallback)((e,t)=>{let n=r.current;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)},[]),c=(0,U.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,U.useCallback)((e,t,r,a)=>{let o=co(e.state);i.current.isDragging=!0,n({issueId:e.id,issue:e,sourceColumn:t,validColumns:o,overColumn:null}),s(r,a)},[s]),u=(0,U.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,U.useCallback)(n=>{if(t){if(t.validColumns.has(n)){let r=R[t.issue.state]||[],i=new Set(no[n]||[]),a=r.find(e=>i.has(e));a&&e(t.issueId,a)}u()}},[t,e,u]),f=(0,U.useCallback)((e,t)=>{t?o.current.set(e,t):o.current.delete(e)},[]);return{dragState:t,ghostRef:r,boardRef:a,getCardHandlers:(0,U.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)},lo))))}}),[l]),registerColumn:f,onBoardPointerMove:(0,U.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>uo&&!t.longPressReady){clearTimeout(t.longPressTimer),t.pointerId=null;return}if(!t.longPressReady)return}else{if(o<uo)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,U.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,U.useCallback)(()=>{u()},[u]),cancelDrag:u,shouldSuppressClick:(0,U.useCallback)(()=>i.current.didDrag||i.current.isDragging,[])}}function po({count:e,className:t}){let n=(0,U.useRef)(e),[r,i]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{if(n.current!==e){n.current=e,i(!0);let t=setTimeout(()=>i(!1),300);return()=>clearTimeout(t)}},[e]),e===0?null:(0,G.jsx)(`span`,{className:`badge badge-xs ${t} ${r?`animate-count-bump`:``}`,children:e})}var mo=[`Planning`,`In Progress`,`Needs Approval`,`Blocked`,`Done`],ho=new Set([`Planning`]),go=new Set([`PendingApproval`,`PendingDecision`]),_o=new Set([`Queued`,`Running`,`Reviewing`]),vo=new Set([`Archived`]),yo={Planning:`badge-info`,"Needs Approval":`badge-warning`,"In Progress":`badge-primary`,Blocked:`badge-error`,Done:`badge-success`},bo={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)`}},xo={Planning:`var(--color-info)`,"Needs Approval":`var(--color-warning)`,"In Progress":`var(--color-primary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`},So={Planning:`var(--color-info)`,"Needs Approval":`var(--color-warning)`,"In Progress":`var(--color-primary)`,Blocked:`var(--color-error)`,Done:`var(--color-success)`},Co={Planning:{icon:wn,desc:`Create an issue to start planning`},"Needs Approval":{icon:nn,desc:`Issues waiting for your approval`},"In Progress":{icon:Rn,desc:`Issues move here when agents start`},Blocked:{icon:X,desc:`Needs attention`},Done:{icon:Bt,desc:`Completed`}};function wo({delay:e=0}){return(0,G.jsx)(`div`,{className:`skeleton-card h-20 w-full rounded-lg`,style:{animationDelay:`${e}ms`}})}function To({dragState:e,ghostRef:t}){if(!e)return null;let{issue:n}=e;return(0,G.jsx)(`div`,{ref:t,className:`drag-ghost`,"aria-hidden":`true`,children:(0,G.jsxs)(`div`,{className:`card card-compact bg-base-100 border border-primary border-l-[3px] shadow-2xl p-3 w-56`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:n.identifier}),(0,G.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:n.title})]})})}function Eo({onCreateIssue:e}){return(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 px-3 animate-fade-in-up`,children:[(0,G.jsx)(`div`,{className:`bg-primary/10 rounded-full p-4 mb-3 animate-pulse-soft`,children:(0,G.jsx)(wn,{className:`size-8 text-primary`})}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold mb-1`,children:`Start here`}),(0,G.jsx)(`p`,{className:`text-xs opacity-50 text-center mb-3`,children:`Create your first issue to begin`}),e&&(0,G.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:e,children:[(0,G.jsx)(zn,{className:`size-3.5`}),`New Issue`]})]})}function Do({issue:e,onClose:t,onStateChange:n,onSelect:r}){let i=ee(e.state).filter(t=>t!==e.state);return(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50 animate-fade-in`,onClick:t}),(0,G.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,G.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,G.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,G.jsxs)(`div`,{className:`px-4 py-2 border-b border-base-300`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,G.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,G.jsxs)(`div`,{className:`p-3 space-y-1`,children:[(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{r(e),t()},children:[(0,G.jsx)(nn,{className:`size-4`}),` View Details`]}),i.length>0&&(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide opacity-40 px-3 pt-2`,children:`Move to`}),i.map(r=>(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{n(e.id,r),t()},children:[(0,G.jsx)(Tt,{className:`size-4`}),` `,r]},r))]}),(0,G.jsx)(`div`,{className:`p-3 pt-0`,children:(0,G.jsx)(`button`,{className:`btn btn-ghost btn-sm w-full`,onClick:t,children:`Cancel`})})]})]})}function Oo({columns:e,activeIndex:t}){return(0,G.jsx)(`div`,{className:`kanban-dots md:hidden`,children:e.map((e,n)=>(0,G.jsx)(`div`,{className:`kanban-dot ${n===t?`active`:``}`,style:{backgroundColor:So[e]}},e))})}var ko={Done:20};function Ao({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,U.useRef)(null),[v,y]=(0,U.useState)(!1);(0,U.useEffect)(()=>(a(e,_.current),()=>a(e,null)),[e,a]);let b=i!=null,x=i?.overColumn===e,S=i?.sourceColumn===e,C=i?.validColumns?.has(e)??!1,w=b&&!C&&!S,T=t.length===0,E=T&&e!==`Planning`&&d===0,D=ko[e],O=D!=null&&t.length>D,k=O&&!v?t.slice(0,D):t,A=t.length-k.length,j=`kanban-column bg-base-200 rounded-box p-3 flex flex-col min-h-0 overflow-hidden`;E&&(j+=` kanban-column-collapsed`),b&&(x&&C?j+=` kanban-column-drop-valid`:x&&!C?j+=` kanban-column-drop-invalid`:w&&(j+=` kanban-column-dimmed`));let M={borderTop:`3px solid transparent`,...bo[e]||{},...E?{alignSelf:`start`}:{}};return(0,G.jsxs)(`div`,{ref:_,className:j,style:M,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,G.jsxs)(`h3`,{className:`text-xs font-semibold tracking-wide flex items-center gap-1.5`,style:{color:xo[e],fontFamily:`'Space Grotesk', system-ui, sans-serif`},children:[e,e===`In Progress`&&u&&(0,G.jsx)(`span`,{className:`issue-phase-dot`,title:`Agents working`})]}),(0,G.jsx)(po,{count:t.length,className:r})]}),!E&&(0,G.jsx)(`div`,{className:`space-y-2 flex-1 overflow-y-auto kanban-card-list`,children:T?x&&C?(0,G.jsx)(`div`,{className:`kanban-drop-placeholder`}):e===`Planning`&&d===0?(0,G.jsx)(Eo,{onCreateIssue:c}):(0,G.jsxs)(`div`,{className:`flex flex-col items-center py-6 opacity-30`,children:[(0,G.jsx)(n.icon,{className:`size-5 mb-1`}),(0,G.jsx)(`span`,{className:`text-[10px]`,children:n.desc})]}):(0,G.jsxs)(`div`,{className:`stagger-children space-y-2`,children:[k.map(t=>{let n=i?.issueId===t.id,r=l===t.id,a=g===t.id;return(0,G.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,G.jsx)(eo,{issue:t,onSelect:s,dragHandlers:o(t,e),isDragging:n,isSelected:p?.has(t.id),onToggleSelect:m,hasSelection:h})},t.id)}),O&&(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50 hover:opacity-80`,onClick:e=>{e.stopPropagation(),y(!v)},children:[(0,G.jsx)(It,{className:`size-3 transition-transform ${v?`rotate-180`:``}`}),v?`Show less`:`+${A} more`]}),x&&C&&(0,G.jsx)(`div`,{className:`kanban-drop-placeholder`})]})})]},e)}function jo(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 Mo({count:e,transitions:t,onBulkAction:n,onClear:r}){return(0,G.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,G.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:t.map(e=>(0,G.jsxs)(`button`,{className:`btn btn-sm btn-outline gap-1`,onClick:()=>n(e),children:[(0,G.jsx)(Tt,{className:`size-3`}),e]},e))}),(0,G.jsx)(`div`,{className:`divider divider-horizontal mx-0`}),(0,G.jsxs)(`span`,{className:`text-sm font-medium whitespace-nowrap opacity-70`,children:[e,` selected`]}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:r,"aria-label":`Clear selection`,children:(0,G.jsx)(pr,{className:`size-4`})})]})}function No({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,onCreateIssue:a,isLoading:o}){let[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(0),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(()=>new Set),h=(0,U.useRef)(null),[g,_]=(0,U.useState)(-1),[v,y]=(0,U.useState)(-1),b=p.size>0,x=(0,U.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,U.useCallback)(()=>{m(new Set)},[]);(0,U.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,U.useMemo)(()=>jo(p,e),[p,e]),w=(0,U.useCallback)(e=>{for(let n of p)t(n,e);S()},[p,t,S]),T=(0,U.useMemo)(()=>{let t=Object.fromEntries(mo.map(e=>[e,[]]));for(let n of e){if(vo.has(n.state))continue;let e;e=ho.has(n.state)?`Planning`:go.has(n.state)?`Needs Approval`:_o.has(n.state)?`In Progress`:n.state===`Blocked`?`Blocked`:`Done`,t[e].push(n)}for(let e of mo)t[e].sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt));return t},[e]),E=(0,U.useMemo)(()=>e.some(e=>e.state===`Running`),[e]),D=(0,U.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}=fo({onStateChange:D}),I=(0,U.useCallback)(e=>{F()||i?.(e)},[i,F]);(0,U.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,U.useRef)(null);let ee=(0,U.useCallback)(e=>{f(e)},[]),{selectedIssue:te}=xt(),L=!te,ne=(0,U.useRef)(T);ne.current=T;let R=(0,U.useCallback)(e=>{_(e),y(0);let t=h.current;t&&(t.querySelector(`[class*='grid']`)?.children[e])?.scrollIntoView({behavior:`smooth`,inline:`center`,block:`nearest`})},[]),z=(0,U.useCallback)(e=>{if(g<0){_(0),y(0);return}let t=mo[g],n=ne.current[t]||[];y(t=>Math.max(0,Math.min(t+e,n.length-1)))},[g]),B=(0,U.useCallback)(()=>{if(g<0||v<0)return;let e=ne.current[mo[g]]||[];e[v]&&i?.(e[v])},[g,v,i]);return $(`1`,()=>R(0),{enabled:L,description:`Planning column`,metadata:{group:`kanban`}},[R,L]),$(`2`,()=>R(1),{enabled:L,description:`In Progress column`,metadata:{group:`kanban`}},[R,L]),$(`3`,()=>R(2),{enabled:L,description:`Needs Approval column`,metadata:{group:`kanban`}},[R,L]),$(`4`,()=>R(3),{enabled:L,description:`Blocked column`,metadata:{group:`kanban`}},[R,L]),$(`5`,()=>R(4),{enabled:L,description:`Done column`,metadata:{group:`kanban`}},[R,L]),$(`j`,()=>z(1),{enabled:L,description:`Next card`,metadata:{group:`kanban`}},[z,L]),$(`k`,()=>z(-1),{enabled:L,description:`Previous card`,metadata:{group:`kanban`}},[z,L]),$(`enter`,B,{enabled:L&&v>=0,description:`Open card`,metadata:{group:`kanban`}},[B,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,U.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,G.jsx)(`div`,{className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,children:(0,G.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children`,style:{gridTemplateColumns:`repeat(${mo.length}, minmax(0, 1fr))`,minWidth:`${mo.length*200}px`},children:mo.map((e,t)=>(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex flex-col gap-2`,children:[(0,G.jsx)(`div`,{className:`skeleton-line h-4 w-20 mb-2`}),(0,G.jsx)(wo,{delay:t*80}),(0,G.jsx)(wo,{delay:t*80+120}),t<2&&(0,G.jsx)(wo,{delay:t*80+240})]},e))})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.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,G.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children ${O?`kanban-dragging`:``}`,style:{gridTemplateColumns:`repeat(${mo.length}, minmax(0, 1fr))`,minWidth:`${mo.length*200}px`},children:mo.map((t,n)=>{let r=T[t],i=g===n&&v>=0&&v<r.length?r[v]?.id:null;return(0,G.jsx)(Ao,{col:t,issues:r,empty:Co[t],badgeClass:yo[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,G.jsx)(To,{dragState:O,ghostRef:k})]}),(0,G.jsx)(Oo,{columns:mo,activeIndex:l}),d&&(0,G.jsx)(Do,{issue:d,onClose:()=>f(null),onStateChange:D,onSelect:I}),b&&(0,G.jsx)(Mo,{count:p.size,transitions:C,onBulkAction:w,onClear:S})]})}function Po(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Fo({value:e,format:t=Po,className:n=``}){let[r,i]=(0,U.useState)(()=>t(e)),a=(0,U.useRef)(e),o=(0,U.useRef)(null);return(0,U.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,G.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}function Io({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,G.jsxs)(`div`,{className:`flex items-center gap-1.5 ${o}`,children:[(0,G.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,G.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,G.jsx)(`title`,{children:`${p}: ${a>999?Po(a):a}`})},e.date||n)})}),a&&(0,G.jsxs)(`span`,{className:`text-[9px] font-mono opacity-50 shrink-0`,children:[Po(s[s.length-1]?.[r]||0),`/d`]})]})}function Lo({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,G.jsx)(`div`,{className:`flex items-center gap-1.5 ${r}`,children:(0,G.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,G.jsxs)(`g`,{children:[f>0&&(0,G.jsx)(`rect`,{x:p,y:t-f,width:l,height:f,rx:`0.5`,className:`fill-error`,opacity:m,children:(0,G.jsx)(`title`,{children:`${h}: +${r} / -${i}`})}),d>0&&(0,G.jsx)(`rect`,{x:p,y:t-u,width:l,height:d,rx:`0.5`,className:`fill-success`,opacity:m,children:(0,G.jsx)(`title`,{children:`${h}: +${r} / -${i}`})})]},e.date||n)})})})}function Ro(){let[e,t]=(0,U.useState)(()=>window.innerWidth<768);return(0,U.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function zo({monthlyTokens:e,monthlyEvents:t,dailyData:n,hasDailyData:r,hasEventData:i,linesDaily:a,hasChurnData:o}){let[s,c]=(0,U.useState)(!1);return(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box animate-fade-in overflow-hidden`,children:[(0,G.jsxs)(`button`,{className:`flex items-center justify-between w-full px-4 py-2.5 text-left`,onClick:()=>c(!s),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,G.jsx)(mr,{className:`size-3.5 text-primary`}),(0,G.jsx)(Fo,{value:e}),(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 font-normal ml-1`,children:`this month`})]}),t>0&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs opacity-50`,children:[(0,G.jsx)(Ct,{className:`size-3`}),t]})]}),(0,G.jsx)(It,{className:`size-4 opacity-40 transition-transform ${s?`rotate-180`:``}`})]}),s&&(0,G.jsxs)(`div`,{className:`px-4 pb-3 space-y-3 animate-fade-in border-t border-base-300 pt-3`,children:[r&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(ir,{className:`size-2.5`}),` Tokens / day`]}),(0,G.jsx)(Io,{data:n,height:32,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`,className:`w-full`})]}),i&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(Ct,{className:`size-2.5`}),` Events / day`]}),(0,G.jsx)(Io,{data:n,height:24,cols:14,valueKey:`events`,colorClass:`text-secondary`,className:`w-full`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(K,{className:`size-2.5`}),` Lines / day`]}),(0,G.jsx)(Lo,{data:a,height:24,cols:14,className:`w-full`})]})]})]})}function Bo({issues:e=[],defaultBranch:t}){let{data:n}=Ue(),{data:r}=We({pollInterval:6e4}),i=Ro(),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,U.useRef)(p),[h,g]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{!m.current&&p&&(m.current=!0,g(!0))},[p]),p?i?(0,G.jsx)(zo,{monthlyTokens:s,monthlyEvents:c,dailyData:a,hasDailyData:u,hasEventData:d,linesDaily:l,hasChurnData:f}):(0,G.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,G.jsxs)(`div`,{className:`flex flex-col justify-center px-4 py-2.5`,children:[(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Tokens / month`}),(0,G.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5 mt-0.5`,children:[(0,G.jsx)(mr,{className:`size-3.5 text-primary shrink-0`}),(0,G.jsx)(Fo,{value:s})]})]}),u&&(0,G.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(ir,{className:`size-2.5`}),` Tokens / day`]}),(0,G.jsx)(Io,{data:a,height:28,cols:14,valueKey:`totalTokens`,colorClass:`text-primary`})]}),d&&(0,G.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(Ct,{className:`size-2.5`}),` Events / day`]}),(0,G.jsx)(Io,{data:a,height:28,cols:14,valueKey:`events`,colorClass:`text-secondary`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[120px]`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,G.jsx)(K,{className:`size-2.5`}),` Lines / day`]}),(0,G.jsx)(Lo,{data:l,height:28,cols:14})]}),t&&(0,G.jsxs)(`div`,{className:`flex flex-col justify-center px-3 border-l border-base-300`,children:[(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Branch`}),(0,G.jsxs)(`span`,{className:`text-xs font-mono font-medium flex items-center gap-1 mt-0.5`,children:[(0,G.jsx)(fn,{className:`size-3 text-primary shrink-0`}),t]})]})]}):null}var Vo=m(`/kanban`)({component:Ho});function Ho(){let e=xt(),{data:t}=Ue();return(0,G.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,G.jsx)(Bo,{metrics:e.metrics,total:e.issues.length,issues:e.issues,compact:!0,defaultBranch:e.data?.config?.defaultBranch}),(0,G.jsx)(No,{issues:e.filtered,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,onCreateIssue:()=>e.setIsCreateOpen(!0)})]})}function Uo(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:J,color:`text-info`,spin:!0}:e.plan?{label:`Plan ready`,icon:wn,color:`text-info`,spin:!1}:e.planningError?{label:`Plan failed`,icon:X,color:`text-error`,spin:!1}:{label:`Aguardando scheduler…`,icon:qt,color:`text-info/60`,spin:!1};case`PendingApproval`:return{label:`Ready to queue`,icon:En,color:`text-warning/70`,spin:!1};case`Queued`:return r?{label:`Worker assigned, starting...`,icon:Rn,color:`text-primary`,spin:!1,pulse:!0}:{label:`Waiting for worker slot...`,icon:qt,color:`text-info/70`,spin:!1};case`Running`:{let e=Wo(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning agent...`,icon:J,color:`text-primary`,spin:!0}:t?e===`Reviewing`?{label:`Agent reviewing...`,icon:nn,color:`text-secondary`,spin:!1,pulse:!0}:e===`Planning`?{label:`Agent planning...`,icon:wn,color:`text-info`,spin:!1,pulse:!0}:{label:`Agent working...`,icon:Rn,color:`text-primary`,spin:!1,pulse:!0}:{label:`Starting agent...`,icon:J,color:`text-primary`,spin:!0}}case`Reviewing`:return Wo(o)===`Reviewing`?{label:`Review in progress...`,icon:nn,color:`text-secondary`,spin:!1,pulse:!0}:{label:`Reviewing`,icon:nn,color:`text-secondary/70`,spin:!1};case`PendingDecision`:return{label:`Review complete`,icon:nn,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:Vt,color:`text-success`,spin:!1};case`Merged`:return{label:`Merged`,icon:K,color:`text-success`,spin:!1};case`Cancelled`:return{label:`Cancelled`,icon:Wt,color:`text-neutral`,spin:!1};default:return{label:t,icon:null,color:`opacity-50`,spin:!1}}}function Wo(e){return e?e.reviewer?.totalTokens>0?`Reviewing`:e.executor?.totalTokens>0?`Executing`:e.planner?.totalTokens>0?`Planning`:null:null}function Go({issue:e,showElapsed:t=!0,compact:n=!1}){let r=Uo(e),i=r.icon,a=Ba([`Running`,`Queued`,`Planning`,`Reviewing`].includes(e.state)&&t?e.startedAt:null);return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs ${r.color} ${n?``:`font-medium`}`,children:[i&&(0,G.jsx)(i,{size:n?10:12,className:[r.spin?`animate-spin`:``,r.pulse?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,G.jsx)(`span`,{className:n?`truncate max-w-[120px]`:`truncate`,children:r.label}),a&&(0,G.jsx)(`span`,{className:`font-mono opacity-60 tabular-nums shrink-0`,children:a})]})}var Ko={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`},qo={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 Jo(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Yo({icon:e,label:t,value:n,color:r=``}){return!n&&n!==0?null:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[10px]`,title:t,children:[(0,G.jsx)(e,{className:`size-2.5 ${r||`opacity-40`}`}),(0,G.jsx)(`span`,{className:`font-mono opacity-70`,children:n})]})}function Xo(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 Zo({issue:e,onSelect:t}){let n=e.state===`Running`,r=Jo(e.tokenUsage?.totalTokens),i=e.description||``,{leadTimeMs:a,cycleTimeMs:o,waitTimeMs:s}=Xo(e);return e.state===`Approved`||e.state,(0,G.jsx)(`div`,{className:`card bg-base-100 border border-base-300 border-l-[3px] ${qo[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,G.jsxs)(`div`,{className:`card-body gap-3 p-4 justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,G.jsx)(`span`,{className:`badge badge-xs ${Ko[e.state]||`badge-ghost`}`,children:e.state})]}),(0,G.jsx)(`span`,{className:`text-xs opacity-40 shrink-0`,children:V(e.updatedAt)})]}),(0,G.jsx)(`h3`,{className:`font-semibold text-sm leading-snug line-clamp-2`,children:e.title}),i&&(0,G.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,G.jsx)(`div`,{className:`pt-1`,children:(0,G.jsx)(Go,{issue:e,showElapsed:!0})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-2 border-t border-base-200`,children:[(0,G.jsx)(Yo,{icon:_n,label:`Wait`,value:s>0?z(s):null}),(0,G.jsx)(Yo,{icon:rr,label:`Cycle`,value:o>0?z(o):null,color:`text-primary`}),(0,G.jsx)(Yo,{icon:qt,label:`Lead`,value:a>0?z(a):null}),(0,G.jsx)(Yo,{icon:mr,label:`Tokens`,value:r,color:`text-warning`}),(0,G.jsx)(Yo,{icon:Yt,label:`Cost`,value:e.tokenUsage?.costUsd?`$${e.tokenUsage.costUsd.toFixed(2)}`:null,color:`text-secondary`}),(0,G.jsx)(Yo,{icon:Y,label:`Attempts`,value:e.attempts>0?`${e.attempts}/${e.maxAttempts}`:null}),(0,G.jsx)(Yo,{icon:rn,label:`Files`,value:e.filesChanged||null,color:`text-info`}),e.linesAdded?(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-success`,children:[`+`,e.linesAdded]}):null,e.linesRemoved?(0,G.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,G.jsx)(to,{icon:Tn,title:`No issues found`,description:`Try adjusting your search or filters, or create your first issue to get started.`}):a?(0,G.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,G.jsx)(`div`,{className:t===o?`ring-2 ring-primary/50 rounded-2xl`:``,children:(0,G.jsx)(Zo,{issue:e,onSelect:i})},e.id))}):(0,G.jsx)(`div`,{className:`space-y-2 stagger-children`,children:e.map((e,t)=>(0,G.jsx)(`div`,{className:t===o?`ring-2 ring-primary/50 rounded-lg`:``,children:(0,G.jsx)(eo,{issue:e,onSelect:i})},e.id))})}var $o=[{label:`Active`,states:[`Planning`,`PendingApproval`,`Queued`,`Running`]},{label:`Review`,states:[`Reviewing`,`PendingDecision`]},{label:`Waiting`,states:[`Blocked`,`Approved`]},{label:`Final`,states:[`Merged`,`Cancelled`]}];$o.flatMap(e=>e.states);var es={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`},ts=[{value:`updated`,label:`Last updated`},{value:`created`,label:`Newest first`},{value:`state`,label:`State`},{value:`tokens`,label:`Most tokens`}],ns=[{value:`recent`,label:`Active + recent`},{value:`all`,label:`All issues`}],rs=m(`/issues`)({component:is});function is(){let e=xt(),[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(`updated`),[a,o]=(0,U.useState)(-1),s=(0,U.useRef)(null),[c,l]=(0,U.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,U.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,U.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,U.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,U.useCallback)(()=>{let e=e=>{let t=String(e??``).replace(/"/g,`""`);return t.includes(`,`)||t.includes(`"`)||t.includes(`
|
|
46
46
|
`)?`"${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(`
|
|
47
|
-
`),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,G.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:[(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1`,children:[(0,G.jsx)(Un,{className:`size-4 opacity-40`}),(0,G.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,G.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-circle`,onClick:()=>e.setQuery(``),children:(0,G.jsx)(pr,{className:`size-3`})})]}),(0,G.jsx)(`select`,{className:`select select-bordered select-sm w-auto`,value:r,onChange:e=>i(e.target.value),title:`Sort by`,children:ts.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:C,title:`Export to Jira CSV`,children:(0,G.jsx)(en,{className:`size-4`})}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-square ${t?`btn-primary`:`btn-ghost`}`,onClick:()=>n(!t),title:`Toggle filters`,children:(0,G.jsx)(qn,{className:`size-4`})}),b>0&&(0,G.jsx)(`span`,{className:`badge badge-sm badge-primary`,children:b}),(0,G.jsxs)(`div`,{className:`text-xs opacity-40 shrink-0`,children:[g.length,` result`,g.length===1?``:`s`,p>0&&e.completionFilter===`recent`&&(0,G.jsxs)(`span`,{children:[` · `,p,` older hidden`]})]})]}),t&&(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`State`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.size>0&&(0,G.jsx)(`button`,{className:`badge badge-sm badge-ghost cursor-pointer opacity-60 hover:opacity-100`,onClick:()=>l(new Set),children:`Clear`}),$o.map(e=>{let t=e.states.every(e=>c.has(e)),n=!t&&e.states.some(e=>c.has(e));return(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.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,G.jsxs)(`button`,{className:`badge badge-sm gap-1 cursor-pointer transition-all ${c.has(e)?es[e]:`badge-outline opacity-50 hover:opacity-100`}`,onClick:()=>u(e),children:[e,t>0&&(0,G.jsx)(`span`,{className:`font-mono text-[10px]`,children:t})]},e)})]},e.label)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Show`}),(0,G.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.completionFilter,onChange:t=>e.setCompletionFilter(t.target.value),children:ns.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),f&&(0,G.jsx)(`div`,{className:`flex items-end`,children:(0,G.jsxs)(`button`,{className:`btn btn-sm btn-ghost gap-1`,onClick:_,children:[(0,G.jsx)(pr,{className:`size-3`}),`Clear all`]})})]})]}),!t&&f&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,G.jsx)(un,{className:`size-3 opacity-40`}),c.size>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-primary gap-1`,children:[c.size,` state`,c.size>1?`s`:``,(0,G.jsx)(`button`,{className:`ml-0.5`,onClick:()=>l(new Set),children:(0,G.jsx)(pr,{className:`size-2.5`})})]}),e.completionFilter!==`recent`&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-ghost gap-1`,children:[`All issues`,(0,G.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCompletionFilter(`recent`),children:(0,G.jsx)(pr,{className:`size-2.5`})})]}),(0,G.jsx)(`button`,{className:`text-xs opacity-40 hover:opacity-100 underline`,onClick:_,children:`clear all`})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3`,children:(0,G.jsx)(Qo,{issues:g,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,expanded:!0,focusedIndex:a})})]})}var as=m(`/analytics`)({}),os={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`},ss={Queued:En,Running:Gt,Reviewing:nn,PendingDecision:nn,Blocked:X,Approved:Vt,Merged:K,Cancelled:Wt};function cs(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function ls(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 us({issueId:e,issueState:t}){let[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(!0),o=(0,U.useRef)(null),s=(0,U.useCallback)(async()=>{try{r(await B.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);(0,U.useEffect)(()=>{s();let e=setInterval(s,2e3);return()=>clearInterval(e)},[s]),(0,U.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,G.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-xs opacity-60`,children:[n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(qt,{className:`size-3`}),z(c)]}),(0,G.jsxs)(`span`,{children:[`Log: `,l,` KB`]}),n.agentPid&&(0,G.jsxs)(`span`,{children:[`PID `,n.agentPid]}),n.agentAlive===!1&&n.agentPid&&(0,G.jsx)(`span`,{className:`text-error`,children:`dead`})]}),(0,G.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,G.jsx)(zt,{className:`size-3`}):(0,G.jsx)(It,{className:`size-3`}),(0,G.jsx)(`span`,{className:`text-[10px]`,children:i?`hide`:`output`})]})]}),i&&(0,G.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,G.jsx)(`span`,{className:`opacity-30`,children:`Waiting for output…`})})]})}function ds({index:e,issue:t,total:n,workflow:r}){if(!t)return(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(Gt,{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=ls(u||c?.model),f=c?.provider,p=t.effort?.[l]||t.effort?.default||c?.effort;return(0,G.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,G.jsxs)(`div`,{className:`flex items-center justify-between min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[a?(0,G.jsx)(J,{className:`size-4 animate-spin text-info shrink-0`}):(0,G.jsx)(`span`,{className:`loading loading-spinner loading-sm text-primary shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono text-base font-bold truncate`,children:t.identifier}),(0,G.jsx)(`span`,{className:`badge badge-sm ${os[t.state]||`badge-ghost`} shrink-0`,children:t.state})]}),(0,G.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,G.jsx)(`div`,{className:`text-sm font-medium`,children:t.title}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs opacity-60`,children:[(0,G.jsxs)(`span`,{children:[`Attempt `,(t.attempts||0)+1,`/`,t.maxAttempts]}),t.startedAt&&(0,G.jsxs)(`span`,{children:[`started `,V(t.startedAt)]})]}),(f||d||p)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[f&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,G.jsx)(er,{className:`size-2.5`}),f]}),d&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:d}),p&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:p})]}),(0,G.jsx)(us,{issueId:t.id,issueState:t.state})]})}function fs({issue:e}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,G.jsx)(ss[e.state]||Gt,{className:`size-3 opacity-40 shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,G.jsx)(`span`,{className:`truncate flex-1`,children:e.title}),(0,G.jsx)(`span`,{className:`badge badge-xs ${os[e.state]||`badge-ghost`}`,children:e.state}),e.state===`Blocked`&&e.nextRetryAt&&(0,G.jsxs)(`span`,{className:`opacity-40 shrink-0`,children:[`retry `,V(e.nextRetryAt)]})]})}function ps({issue:e}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,G.jsx)(e.state===`Merged`?K:e.state===`Approved`?Vt:Wt,{className:`size-3 shrink-0 ${e.state===`Approved`||e.state===`Merged`?`text-success`:`text-neutral`}`}),(0,G.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,G.jsx)(`span`,{className:`truncate flex-1 opacity-70`,children:e.title}),e.durationMs&&(0,G.jsx)(`span`,{className:`opacity-40 shrink-0`,children:z(e.durationMs)}),e.completedAt&&(0,G.jsx)(`span`,{className:`opacity-40 shrink-0`,children:V(e.completedAt)})]})}function ms({running:e,queued:t,concurrency:n,totalTokensToday:r}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-3`,children:[(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-primary/10 rounded-btn p-2`,children:(0,G.jsx)(or,{className:`size-5 text-primary`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-2xl font-bold font-mono`,children:[e.length,(0,G.jsxs)(`span`,{className:`text-sm opacity-50`,children:[`/`,n]})]}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Active agents`})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-info/10 rounded-btn p-2`,children:(0,G.jsx)(En,{className:`size-5 text-info`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:t.length}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Queued`})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-accent/10 rounded-btn p-2`,children:(0,G.jsx)(mr,{className:`size-5 text-accent`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:cs(r)}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Tokens today`})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-secondary/10 rounded-btn p-2`,children:(0,G.jsx)(dn,{className:`size-5 text-secondary`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:n}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Max parallelism`})]})]})]})}function hs({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}=Yr(),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,U.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,G.jsxs)(`div`,{className:`space-y-5 min-w-0 overflow-hidden flex-1`,children:[(0,G.jsx)(ms,{running:u,queued:d,concurrency:o,totalTokensToday:p}),(0,G.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,G.jsx)($t,{className:`size-4 opacity-50`}),`Active Agents`]}),(0,G.jsxs)(`span`,{className:`text-xs opacity-50`,children:[u.length,`/`,o,` slots`]})]}),(0,G.jsx)(`div`,{className:`grid gap-3 min-w-0`,style:{gridTemplateColumns:`repeat(${Math.min(o,3)}, 1fr)`},children:m.map((e,t)=>(0,G.jsx)(ds,{index:t,issue:e,total:o,workflow:c},t))})]}),d.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,G.jsx)(En,{className:`size-4 opacity-50`}),`Queue`,(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:d.length})]}),(0,G.jsxs)(`div`,{className:`space-y-1 stagger-children`,children:[d.slice(0,12).map(e=>(0,G.jsx)(fs,{issue:e},e.id)),d.length>12&&(0,G.jsxs)(`div`,{className:`text-xs opacity-40 pl-3`,children:[`+`,d.length-12,` more`]})]})]}),f.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,G.jsx)(Vt,{className:`size-4 opacity-50`}),`Recently Completed`,(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:f.length})]}),(0,G.jsx)(`div`,{className:`space-y-1 stagger-children`,children:f.map(e=>(0,G.jsx)(ps,{issue:e},e.id))})]}),u.length===0&&d.length===0&&f.length===0&&(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 animate-fade-in-up`,children:[(0,G.jsx)(`div`,{className:`bg-primary/10 rounded-full p-5 mb-4`,children:(0,G.jsx)($t,{className:`size-10 text-primary opacity-60`})}),(0,G.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:`No agents running`}),(0,G.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 gs=m(`/agents`)({component:_s});function _s(){let e=xt();return(0,G.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:(0,G.jsx)(hs,{state:e.data,providers:e.providers.data||{},parallelism:e.parallelism.data||{},onRefresh:e.refresh,issues:e.issues})})}var vs=m(`/`)({beforeLoad:()=>{throw j({to:`/kanban`})}}),ys=m(`/settings/`)({beforeLoad:()=>{throw j({to:`/settings/project`})}}),bs=[{key:`plan`,label:`Plan`,icon:wn,description:`Generate the execution plan`,accent:`info`},{key:`execute`,label:`Execute`,icon:Rn,description:`Implement the changes`,accent:`primary`},{key:`review`,label:`Review`,icon:nn,description:`Review the implementation`,accent:`secondary`}],xs=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`extra-high`,label:`Extra High`}],Ss={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 Cs({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=Ss[e.accent];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`card bg-base-200 border-l-4 ${u.border} animate-fade-in`,children:(0,G.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-lg ${u.bg}`,children:(0,G.jsx)(s,{className:`size-4.5 ${u.text}`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,G.jsx)(`span`,{className:`badge badge-xs ${u.badge} badge-outline`,children:t.provider}),o===e.key&&(0,G.jsxs)(`span`,{className:`text-xs text-success flex items-center gap-1 animate-fade-in`,children:[(0,G.jsx)(Ft,{className:`size-3`}),` saved`]})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:e.description})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2`,children:[(0,G.jsxs)(`label`,{className:`form-control`,children:[(0,G.jsx)(`div`,{className:`label py-0.5`,children:(0,G.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Provider`})}),(0,G.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,G.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),(0,G.jsxs)(`label`,{className:`form-control`,children:[(0,G.jsx)(`div`,{className:`label py-0.5`,children:(0,G.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Model`})}),(0,G.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,G.jsx)(`option`,{value:t.model,children:t.model||`(detecting...)`}),c.map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[e.label,e.tier?` — ${e.tier}`:``]},e.id))]})]}),(0,G.jsxs)(`label`,{className:`form-control`,children:[(0,G.jsx)(`div`,{className:`label py-0.5`,children:(0,G.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Effort`})}),(0,G.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.effort,onChange:e=>i({...t,effort:e.target.value}),children:xs.filter(e=>t.provider===`codex`||e.value!==`extra-high`).map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})}),!a&&(0,G.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,G.jsx)(wt,{className:`size-4 opacity-20`})})]})}var ws=m(`/settings/workflow`)({component:Ts});function Ts(){let e=T(),[t,n]=(0,U.useState)(null),[r,i]=(0,U.useState)([]),[a,o]=(0,U.useState)({}),[s,c]=(0,U.useState)(!0),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),p=(0,U.useRef)(null),m=(0,U.useCallback)(t=>{e.setQueryData(W,e=>Le(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,U.useCallback)(async()=>{c(!0);try{let e=await B.get(`/config/workflow?details=1`);n(e.workflow),i(e.providers||[]),o(e.models||{})}catch{}c(!1)},[]);(0,U.useEffect)(()=>{h()},[h]);let g=(0,U.useCallback)((e,t)=>{p.current&&clearTimeout(p.current),p.current=setTimeout(async()=>{try{await B.post(`/config/workflow`,{workflow:e}),m(e),u(t),setTimeout(()=>u(null),1500)}catch{}},600)},[m]),_=(0,U.useCallback)((e,t)=>{n(n=>{let r={...n,[e]:t};return g(r,e),r})},[g]),v=(0,U.useCallback)(async()=>{f(!0);try{let e=await B.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 B.post(`/config/workflow`,{workflow:f}),m(f),u(`all`),setTimeout(()=>u(null),1500)}catch{}f(!1)},[m]);return(0,U.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),s||!t?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(q,{className:`size-6 animate-spin opacity-30`})}):(0,G.jsxs)(`div`,{className:`space-y-4 stagger-children`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Pipeline Workflow`}),(0,G.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`Changes are saved automatically.`})]}),(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 shrink-0`,onClick:v,disabled:d,children:[d?(0,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Y,{className:`size-3`}),`Restore defaults`]})]}),(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-3 p-4`,children:[(0,G.jsx)(`h3`,{className:`card-title text-sm`,children:`Pipeline`}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Configure providers/models/effort by stage and persist directly to workflow settings.`})]})}),(0,G.jsx)(`ul`,{className:`steps steps-horizontal w-full text-xs`,children:bs.map(e=>{let t=Ss[e.accent];return(0,G.jsx)(`li`,{className:`step ${t.step}`,children:e.label},e.key)})}),(0,G.jsx)(`div`,{className:`flex flex-col`,children:bs.map((e,n)=>(0,G.jsx)(Cs,{stage:e,config:t[e.key],providers:r,modelsByProvider:a,onChange:t=>_(e.key,t),isLast:n===bs.length-1,saving:l===e.key||l===`all`?e.key:null},e.key))})]})}function Es(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ds(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 Os({label:e,period:t,icon:n}){let r=t.inputTokens>0&&t.outputTokens>0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-base-100`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg bg-base-300`,children:(0,G.jsx)(n,{className:`size-4 opacity-70`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-60`,children:e}),(0,G.jsxs)(`div`,{className:`font-mono font-semibold text-sm`,children:[Es(t.tokensUsed),` tokens`]}),r&&(0,G.jsxs)(`div`,{className:`flex gap-3 mt-0.5`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,G.jsx)(wt,{className:`size-2.5`}),` `,Es(t.inputTokens)]}),(0,G.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,G.jsx)(Et,{className:`size-2.5`}),` `,Es(t.outputTokens)]})]})]}),(0,G.jsxs)(`div`,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-60`,children:`sessions`}),(0,G.jsx)(`div`,{className:`font-mono text-sm`,children:t.sessions})]})]})}function ks({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,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,G.jsx)(`span`,{className:`opacity-60`,children:`Weekly quota`}),(0,G.jsxs)(`span`,{className:`font-mono`,children:[Es(n),` / `,Es(t)]})]}),(0,G.jsx)(`progress`,{className:`progress ${r} w-full progress-animated`,value:e,max:100}),(0,G.jsxs)(`div`,{className:`flex justify-between text-[10px] mt-1`,children:[(0,G.jsxs)(`span`,{className:`opacity-50`,children:[e,`% used`]}),(0,G.jsxs)(`span`,{className:`font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[i,`% available`]})]})]})}function As({nextResetAt:e,resetInfo:t}){let n=Ds(e),r=e?new Date(e):null,i=r?r.toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`}):``;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,G.jsx)(Nt,{className:`size-3.5 opacity-50 shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`opacity-50`,children:t}),e&&(0,G.jsxs)(`div`,{className:`font-mono font-medium mt-0.5`,children:[`Resets in `,(0,G.jsx)(`span`,{className:`text-primary`,children:n}),(0,G.jsxs)(`span`,{className:`opacity-40`,children:[` — `,i]})]})]})]})}function js({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,G.jsxs)(`div`,{className:`flex justify-between items-center text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`opacity-60`,children:e}),(0,G.jsxs)(`span`,{className:`font-mono font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[Es(r),` available`]})]})}function Ms({models:e,currentModel:t}){let[n,r]=(0,U.useState)(!1);return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`space-y-1`,children:(n?e:e.slice(0,4)).map(e=>(0,G.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,G.jsx)(Ht,{className:`size-3 ${e.slug===t?`text-primary`:`opacity-30`}`}),(0,G.jsx)(`span`,{className:`font-mono text-xs flex-1 truncate`,children:e.displayName||e.slug}),e.slug===t&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`active`})]},e.slug))}),e.length>4&&(0,G.jsxs)(`button`,{className:`btn btn-xs btn-ghost mt-1 w-full gap-1`,onClick:()=>r(!n),children:[n?(0,G.jsx)(zt,{className:`size-3`}):(0,G.jsx)(It,{className:`size-3`}),n?`Show less`:`+${e.length-4} more`]})]})}function Ns(e){return e===`global`?`Global`:e===`session`?`Session`:e.replace(/\b\w/g,e=>e.toUpperCase())}function Ps(e){return e===`5h`?`5h`:e===`weekly`?`Week`:e===`daily`?`Daily`:e===`session`?`Session`:e}function Fs({entry:e}){Math.max(0,100-e.percentUsed);let t=e.percentUsed>=90?`progress-error`:e.percentUsed>=70?`progress-warning`:`progress-primary`;return(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-[10px] mb-0.5`,children:[(0,G.jsxs)(`span`,{className:`opacity-60 truncate`,children:[Ns(e.scope),` · `,Ps(e.period)]}),(0,G.jsxs)(`span`,{className:`font-mono shrink-0`,children:[e.percentUsed,`%`]})]}),(0,G.jsx)(`progress`,{className:`progress ${t} w-full h-1.5`,value:e.percentUsed,max:100})]})})}function Is({rateLimits:e}){return!e||e.length===0?null:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:`Rate limits`}),(0,G.jsx)(`div`,{className:`space-y-2 bg-base-100 rounded-lg p-3`,children:e.map((e,t)=>(0,G.jsx)(Fs,{entry:e},`${e.scope}-${e.period}-${t}`))})]})}function Ls({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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)($t,{className:`size-5 ${g}`}),(0,G.jsx)(`h3`,{className:`card-title text-sm`,children:h}),u&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`v`,u]})]}),(0,G.jsx)(`span`,{className:`badge badge-sm ${n?`badge-success`:`badge-error`}`,children:n?`available`:`not found`})]}),(d||f||p)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[d&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-outline gap-1`,children:[(0,G.jsx)(Kn,{className:`size-2.5`}),` `,d]}),f&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono truncate max-w-[200px]`,children:f}),p&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-outline gap-1`,children:[(0,G.jsx)(dn,{className:`size-2.5`}),` `,p]})]}),i&&(0,G.jsxs)(`div`,{className:`text-xs opacity-60`,children:[`Active model: `,(0,G.jsx)(`span`,{className:`font-mono font-medium opacity-100`,children:i})]}),(0,G.jsx)(ks,{percentUsed:l,weeklyLimit:c,weeklyUsed:a.thisWeek.tokensUsed}),(0,G.jsx)(js,{label:`This week remaining`,limit:c,used:a.thisWeek.tokensUsed}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50`,children:`Token usage`}),(0,G.jsx)(Os,{label:`Last 5h`,period:_,icon:qt}),(0,G.jsx)(Os,{label:`Today`,period:a.today,icon:mr}),(0,G.jsx)(Os,{label:`This week`,period:a.thisWeek,icon:gn}),(0,G.jsx)(Os,{label:`All time`,period:a.allTime,icon:qt})]}),(0,G.jsx)(Is,{rateLimits:m}),(0,G.jsx)(As,{nextResetAt:s,resetInfo:o}),r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:[`Available Models (`,r.length,`)`]}),(0,G.jsx)(Ms,{models:r,currentModel:i})]})]})})}function Rs({providersUsage:e}){let t=e?.data,n=t?.providers||[];return e?.isLoading&&!t?(0,G.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[...[,,]].map((e,t)=>(0,G.jsx)(`div`,{className:`skeleton-card h-72`,style:{animationDelay:`${t*100}ms`}},t))}):n.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 opacity-50 animate-fade-in-up`,children:[(0,G.jsx)($t,{className:`size-8`}),(0,G.jsx)(`p`,{className:`text-sm`,children:`No providers detected`})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 stagger-children`,children:n.map(e=>(0,G.jsx)(Ls,{provider:e},e.name))}),t?.collectedAt&&(0,G.jsxs)(`p`,{className:`text-xs opacity-40 text-center`,children:[`Last collected: `,new Date(t.collectedAt).toLocaleTimeString()]})]})}var zs=m(`/settings/providers`)({component:Bs});function Bs(){return(0,G.jsx)(Rs,{providersUsage:xe()})}var Vs=new Set([`main`,`master`]),Hs=m(`/settings/project`)({component:Us});function Us(){let e=T(),t=ze(),n=Fe(t.data),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(`missing`),[l,u]=(0,U.useState)(`local`),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(!0),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(``),[x,S]=(0,U.useState)(!0),[C,w]=(0,U.useState)(!1),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(null),[M,N]=(0,U.useState)(null),[P,F]=(0,U.useState)(!1),[I,ee]=(0,U.useState)(null),[te,L]=(0,U.useState)(!1),[ne,R]=(0,U.useState)(!1),[z,V]=(0,U.useState)(!1),[H,re]=(0,U.useState)(!1),[ie,ae]=(0,U.useState)(``),oe=(0,U.useRef)(null),se=ht(ft(a)||oe.current?.detectedProjectName||oe.current?.projectName),ce=(0,U.useCallback)((t,n,r)=>{e.setQueryData(W,e=>Le(e,{id:t,scope:r,value:n,source:`user`,updatedAt:new Date().toISOString()}))},[e]);(0,U.useEffect)(()=>{S(!0),Promise.allSettled([B.get(`/state`),B.get(`/git/status`)]).then(([e,t])=>{let n=e.status===`fulfilled`?e.value:null;if(n&&typeof n==`object`){oe.current=n;let e=ft(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,U.useEffect)(()=>{if(r||t.isLoading)return;i(!0);let e=Ie(n,`runtime.mergeMode`,`local`);(e===`local`||e===`push-pr`)&&u(e);let a=Ie(n,`runtime.prBaseBranch`,``);typeof a==`string`&&f(a);let s=Ie(n,`runtime.autoReviewApproval`,!0);typeof s==`boolean`&&m(s);let l=Ie(n,`runtime.testCommand`,``);typeof l==`string`&&g(l);let p=_t(n,oe.current||{});o(p.projectName||``),c(p.source),!d&&p.projectName&&f(p.detectedProjectName||y||a||``)},[n,t.isLoading,r]);let le=(0,U.useCallback)(async()=>{S(!0);try{let[e,t]=await Promise.all([B.get(`/state`),B.get(`/git/status`)]);oe.current=e,e?.config?.defaultBranch&&b(e.config.defaultBranch),t&&(v(t),t.branch&&b(t.branch))}finally{S(!1)}},[]),ue=(0,U.useCallback)(async()=>{let e=ft(a);if(!e){ae(`Project name cannot be empty.`);return}L(!0),ae(``);try{await B.post(`/settings/${encodeURIComponent(dt)}`,{scope:`system`,value:e,source:`user`}),ce(dt,e,`system`),o(e),ae(`Project name updated.`),setTimeout(()=>ae(``),1400)}finally{L(!1)}},[a,ce]),de=(0,U.useCallback)(async()=>{R(!0),ae(``);try{await B.post(`/settings/runtime.mergeMode`,{scope:`runtime`,value:l,source:`user`}),ce(`runtime.mergeMode`,l,`runtime`),await B.post(`/settings/runtime.prBaseBranch`,{scope:`runtime`,value:d.trim(),source:`user`}),ce(`runtime.prBaseBranch`,d.trim(),`runtime`),await B.post(`/settings/runtime.autoReviewApproval`,{scope:`runtime`,value:p,source:`user`}),ce(`runtime.autoReviewApproval`,p,`runtime`),ae(`Delivery settings updated.`),setTimeout(()=>ae(``),1400)}finally{R(!1)}},[p,l,d,ce]),fe=(0,U.useCallback)(async()=>{V(!0),ae(``);try{await B.post(`/settings/runtime.testCommand`,{scope:`runtime`,value:h.trim(),source:`user`}),ce(`runtime.testCommand`,h.trim(),`runtime`),ae(`Validation command updated.`),setTimeout(()=>ae(``),1400)}finally{V(!1)}},[h,ce]),pe=(0,U.useCallback)(()=>{w(!0),D(y||``),j(null),N(null)},[y]),me=(0,U.useCallback)(async()=>{let e=E.trim();if(!(!(/^[a-zA-Z0-9/_.-]+$/.test(e)&&e.length>0)||e===y)){k(!0),re(!0),j(null);try{let t=await B.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),re(!1),!d&&l===`push-pr`&&f(e),l||u(`local`),await le(),!l&&d===``&&f(e)}catch(e){j(e instanceof Error?e.message:String(e)),re(!1)}finally{k(!1)}}},[E,y,l,d,le]),he=(0,U.useCallback)(async()=>{F(!0),ee(null);try{let e=await B.post(`/git/init`,{});if(!e?.ok)throw Error(e?.error||`Failed to initialize git.`);await le()}catch(e){ee(e instanceof Error?e.message:String(e))}finally{F(!1)}},[le]),ge=_===null||_.isGit,_e=_?.hasCommits===!0,ve=y&&Vs.has(y);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Project settings`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Match your workspace identity and queue naming.`}),(0,G.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,G.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`Project name`}),(0,G.jsx)(`input`,{type:`text`,className:`input input-bordered w-full`,value:a,onChange:e=>o(e.target.value),placeholder:`Project name`})]}),(0,G.jsxs)(`div`,{className:`rounded-xl border border-base-300/70 bg-base-100 px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-[0.2em] text-base-content/40`,children:`Queue title preview`}),(0,G.jsx)(`div`,{className:`mt-1.5 text-base font-semibold tracking-tight break-words`,children:se||`fifony`})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:ue,disabled:te||!ft(a),children:te?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Save project name`}),(0,G.jsxs)(`span`,{className:`text-xs opacity-50`,children:[`Source: `,s]})]})]})}),(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Bn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Working branch`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Where issue worktrees are created from. Local operations use this branch.`}),x&&(0,G.jsxs)(`div`,{className:`text-xs text-base-content/60 flex items-center gap-2`,children:[(0,G.jsx)(q,{className:`size-3 animate-spin`}),`Loading git status...`]}),!x&&!ge&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,G.jsx)(K,{className:`size-4 shrink-0`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(`p`,{className:`font-semibold`,children:`Not a git repository`}),(0,G.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`fifony requires git and an initial commit to create agent worktrees.`})]})]}),(0,G.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:he,disabled:P,children:[P?(0,G.jsx)(q,{className:`size-4 animate-spin`}):(0,G.jsx)(K,{className:`size-4`}),`Initialize git repository`]}),I&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:I})]}),!x&&ge&&!_e&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,G.jsx)(on,{className:`size-4 shrink-0`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(`p`,{className:`font-semibold`,children:`Repository has no commits yet`}),(0,G.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`Create an initial commit before agent worktrees can be prepared.`})]})]}),(0,G.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:he,disabled:P,children:[P?(0,G.jsx)(q,{className:`size-4 animate-spin`}):(0,G.jsx)(K,{className:`size-4`}),`Create initial commit`]})]}),ge&&(0,G.jsxs)(G.Fragment,{children:[C?(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`label`,{className:`input input-bordered flex items-center gap-2 flex-1`,children:[(0,G.jsx)(fn,{className:`size-3.5 opacity-40`}),(0,G.jsx)(`input`,{type:`text`,className:`grow font-mono text-sm`,value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&me(),e.key===`Escape`&&w(!1)},disabled:O})]}),(0,G.jsx)(`button`,{className:`btn btn-primary`,onClick:me,disabled:O||!E.trim(),children:O?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Switch`}),(0,G.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>w(!1),disabled:O,children:`Cancel`})]}):(0,G.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:pe,role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&pe(),children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(fn,{className:`size-4 opacity-50 shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm opacity-60`,children:`Current branch:`}),(0,G.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:y||`—`}),ve&&(0,G.jsx)(`span`,{className:`badge badge-warning badge-sm ml-auto shrink-0`,children:`protected`}),!C&&(0,G.jsx)(Ln,{className:`size-3.5 opacity-0 group-hover:opacity-40 ml-auto shrink-0 transition-opacity`})]})}),A&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:A}),M&&(0,G.jsxs)(`div`,{className:`alert alert-success py-2 text-xs`,children:[(0,G.jsx)(Bt,{className:`size-3 shrink-0`}),M.created?`Branch created`:`Branch switched`,`: `,(0,G.jsx)(`span`,{className:`font-mono`,children:M.branch})]}),ve&&(0,G.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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(mn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Delivery mode`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Pick how completed issues are integrated.`}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.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,G.jsx)(`input`,{type:`radio`,name:`settings-merge-mode`,className:`hidden`,checked:l===`local`,onChange:()=>u(`local`)}),(0,G.jsx)(K,{className:`size-4 mx-auto mb-1 opacity-60`}),`Local merge`]}),(0,G.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,G.jsx)(`input`,{type:`radio`,name:`settings-merge-mode`,className:`hidden`,checked:l===`push-pr`,onChange:()=>u(`push-pr`)}),(0,G.jsx)(mn,{className:`size-4 mx-auto mb-1 opacity-60`}),`Push PR`]})]}),l===`push-pr`&&(0,G.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,G.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`PR base branch`}),(0,G.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,G.jsx)(`p`,{className:`text-xs opacity-40`,children:`Branch that PRs target.`})]}),(0,G.jsxs)(`label`,{className:`label cursor-pointer justify-start gap-3`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:p,onChange:e=>m(e.target.checked)}),(0,G.jsx)(`span`,{className:`label-text text-sm`,children:`Automatic review approval`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:p?`Reviewer success marks issue done.`:`Reviewer success requires manual decision.`}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:de,disabled:ne,children:ne?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Save delivery settings`})]})}),(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Validation command`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Runs before issue completion and merge/done.`}),(0,G.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,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:fe,disabled:z,children:z?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Save validation command`})]})}),ie&&(0,G.jsxs)(`div`,{className:`alert alert-success py-2 text-xs`,children:[(0,G.jsx)(Gn,{className:`size-3`}),` `,ie]}),(0,G.jsx)(`div`,{className:`text-xs text-base-content/40`,children:(0,G.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 Ws=(0,U.lazy)(()=>ba(()=>import(`./OnboardingWizard-dOrVz-hX.js`),__vite__mapDeps([6,1,5,2,4]))),Gs=[`auto`,`light`,`dark`],Ks=`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(`.`),qs=[...Gs,...Ks];function Js(e){return e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function Ys({theme:e,onThemeChange:t}){let n=Js(e),r=[`dark`,`night`,`sunset`,`black`,`synthwave`,`halloween`,`forest`,`luxury`,`dracula`,`business`,`coffee`,`dim`,`abyss`].includes(n);return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Pn,{className:`size-4 opacity-50`}),`Theme`]}),(0,G.jsxs)(`p`,{className:`text-xs opacity-50`,children:[`Current: `,(0,G.jsx)(`span`,{className:`font-semibold`,children:e}),e===`auto`&&(0,G.jsxs)(`span`,{children:[` (resolved to `,n,`)`]}),r?(0,G.jsx)(Mn,{className:`inline size-3 ml-1`}):(0,G.jsx)($n,{className:`inline size-3 ml-1`})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qs.map(n=>(0,G.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 Xs({concurrency:e,setConcurrency:t,saveConcurrency:n,savePending:r}){return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)($t,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Number of parallel workers executing issues simultaneously (1–10).`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.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,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,disabled:r,children:r?(0,G.jsx)(`span`,{className:`loading loading-spinner loading-xs`}):`Save`})]})]})})}function Zs({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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Bn,{className:`size-4 opacity-50`}),`Connection Status`]}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,G.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[n&&(0,G.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),(0,G.jsx)(Ht,{className:`size-5 ${i} relative`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:`API`}),(0,G.jsx)(`div`,{className:`text-xs ${i}`,children:a})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,G.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[r&&(0,G.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),r?(0,G.jsx)(ur,{className:`size-5 ${o} relative`}):(0,G.jsx)(lr,{className:`size-5 ${o} relative`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:`WebSocket`}),(0,G.jsx)(`div`,{className:`text-xs ${o}`,children:s})]})]})]})]})})}function Qs({pwa:e}){let t=e?.isInstalled?`Installed`:e?.canInstall?`Installable`:`Browser-managed`;return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Yn,{className:`size-4 opacity-50`}),`Progressive Web App`]}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Service worker`}),(0,G.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:e?.serviceWorkerSupported?`Supported`:`Unavailable`})]}),(0,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Install status`}),(0,G.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:t})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:()=>e.installApp(),disabled:!e?.canInstall,children:[(0,G.jsx)(en,{className:`size-3.5`}),` Install`]}),(0,G.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1`,onClick:()=>e.applyUpdate(),disabled:!e?.updateAvailable,children:[(0,G.jsx)(Vn,{className:`size-3.5`}),` Apply update`]})]})]})})}function $s({notifications:e}){if(!e?.supported)return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Ot,{className:`size-4 opacity-50`}),`Notifications`]}),(0,G.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,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(kt,{className:`size-4 opacity-50`}),`Desktop Notifications`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Get notified when issues change state — reviews needed, agents blocked, work completed.`}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Permission`}),(0,G.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,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Status`}),(0,G.jsx)(`div`,{className:`text-sm font-medium mt-1 ${e.enabled?`text-success`:``}`,children:e.enabled?`Enabled`:`Disabled`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&!t&&(0,G.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:e.requestPermission,children:[(0,G.jsx)(kt,{className:`size-3.5`}),` Enable notifications`]}),n&&(0,G.jsxs)(`label`,{className:`label cursor-pointer gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm`,children:`Notify on state changes`}),(0,G.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e.enabled,onChange:t=>e.setEnabled(t.target.checked)})]}),t&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:`Notifications were denied. Reset permission in your browser settings to re-enable.`}),n&&e.enabled&&(0,G.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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(cr,{className:`size-4 opacity-50`}),`Event Types`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Choose which events trigger notifications.`}),Xe.map(t=>{let n=r.filter(e=>e.group===t.id);return n.length===0?null:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold opacity-40 uppercase tracking-wider`,children:t.label}),n.map(t=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-base-300 transition-colors cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-xs toggle-primary`,checked:t.enabled,onChange:n=>e.setEventEnabled(t.id,n.target.checked)}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`text-sm font-medium flex items-center gap-2`,children:[t.label,t.sound&&(0,G.jsx)(sr,{className:`size-3 opacity-30`,title:`Plays sound`})]}),(0,G.jsx)(`div`,{className:`text-xs opacity-40`,children:t.description})]})]},t.id))]},t.id)})]})})]})}function ec(){let[e,t]=(0,U.useState)(!1),n=T();return e?(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,G.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,G.jsx)(Ws,{onComplete:()=>{t(!1),n.invalidateQueries({queryKey:W})}})}):(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(cr,{className:`size-4 opacity-50`}),`Setup Wizard`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Re-run the initial setup wizard to reconfigure providers, effort level, concurrency, and theme.`}),(0,G.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1 w-fit`,onClick:async()=>{try{await B.post(`/settings/ui.onboarding.completed`,{scope:`ui`,value:!1,source:`user`}),n.setQueryData(W,e=>Le(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!1,source:`user`,updatedAt:new Date().toISOString()}))}catch{}t(!0)},children:[(0,G.jsx)(cr,{className:`size-3.5`}),` Re-run Setup Wizard`]})]})})}var tc=m(`/settings/notifications`)({component:nc});function nc(){return(0,G.jsx)(`div`,{className:`space-y-5`,children:(0,G.jsx)($s,{notifications:xt().notifications})})}var rc=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),ic=[`palette`,`navigation`,`global`,`drawer`,`kanban`,`issues`],ac={palette:{label:`Command Palette`,icon:Zt,color:`text-primary`,badge:`badge-primary`},navigation:{label:`Navigation`,icon:hn,color:`text-info`,badge:`badge-info`},global:{label:`Global`,icon:Sn,color:`text-secondary`,badge:`badge-secondary`},drawer:{label:`Issue Detail`,icon:Fn,color:`text-success`,badge:`badge-success`},kanban:{label:`Kanban Board`,icon:Xt,color:`text-warning`,badge:`badge-warning`},issues:{label:`Issues List`,icon:On,color:`text-error`,badge:`badge-error`}};function oc(e){return(e||``).replace(/mod/gi,rc?`⌘`:`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 sc=m(`/settings/hotkeys`)({component:cc});function cc(){let{hotkeys:e}=fa(),t=(0,U.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 ic)t.has(e)&&r.push({group:e,...ac[e],shortcuts:t.get(e)});return r},[e]),n=t.reduce((e,t)=>e+t.shortcuts.length,0);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-bold flex items-center gap-2`,children:[(0,G.jsx)(Sn,{className:`size-5 opacity-60`}),`Keyboard Shortcuts`]}),(0,G.jsxs)(`p`,{className:`text-sm opacity-50 mt-1`,children:[n,` shortcuts across `,t.length,` contexts. Press `,(0,G.jsx)(`kbd`,{className:`kbd kbd-xs`,children:`Shift`}),`+`,(0,G.jsx)(`kbd`,{className:`kbd kbd-xs`,children:`/`}),` anywhere to see them.`]})]}),(0,G.jsx)(`span`,{className:`badge badge-ghost font-mono text-xs`,children:rc?`macOS`:`Linux / Windows`})]}),(0,G.jsx)(`div`,{className:`space-y-4`,children:t.map(({group:e,label:t,icon:n,color:r,badge:i,shortcuts:a})=>(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-5 py-3 flex items-center gap-2 border-b border-base-300`,children:[(0,G.jsx)(n,{className:`size-4 ${r}`}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:t}),(0,G.jsx)(`span`,{className:`badge badge-xs ${i}`,children:a.length})]}),(0,G.jsx)(`div`,{className:`divide-y divide-base-300`,children:a.map((e,t)=>{let n=oc(e.hotkey);return(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-2.5 hover:bg-base-100/50 transition-colors`,children:[(0,G.jsx)(`span`,{className:`text-sm`,children:e.description}),(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:n.map((e,t)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[t>0&&(0,G.jsx)(`span`,{className:`text-xs opacity-20 mx-0.5`,children:`+`}),(0,G.jsx)(`kbd`,{className:`kbd kbd-sm font-mono`,children:e.trim()})]},t))})]},t)})})]},e))}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-4 text-xs opacity-50 space-y-1`,children:[(0,G.jsxs)(`p`,{children:[`Shortcuts are context-aware. `,(0,G.jsx)(`strong`,{children:`Drawer`}),` shortcuts only work when an issue detail is open. `,(0,G.jsx)(`strong`,{children:`Kanban`}),` and `,(0,G.jsx)(`strong`,{children:`Issues`}),` shortcuts work on their respective pages.`]}),(0,G.jsxs)(`p`,{children:[`Modifier key `,(0,G.jsx)(`kbd`,{className:`kbd kbd-xs`,children:rc?`⌘`:`Ctrl`}),` works in input fields too.`]})]})]})}var lc=m(`/settings/general`)({component:uc});function uc(){let e=xt();return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(Zs,{status:e.status,wsStatus:e.wsStatus}),(0,G.jsx)(Qs,{pwa:e.pwa}),(0,G.jsx)(ec,{}),(0,G.jsx)(Ys,{theme:e.theme,onThemeChange:e.setTheme})]})}var dc=m(`/settings/agents`)({component:hc}),fc=25;function pc({onCatalogRefresh:e}){let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(()=>new Set),[l,u]=(0,U.useState)({}),d=(0,U.useRef)(!1),f=(0,U.useCallback)(()=>(o(``),i(!0),B.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,U.useEffect)(()=>{d.current||(d.current=!0,f())},[f]);let p=(0,U.useCallback)(async t=>{c(e=>new Set([...e,t])),u(e=>({...e,[t]:``}));try{let n=((await B.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 B.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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-3 p-4`,children:[(0,G.jsx)(`h3`,{className:`font-semibold text-sm`,children:`Sources`}),a&&(0,G.jsx)(`div`,{className:`alert alert-warning text-xs py-1`,children:a}),r?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs opacity-60`,children:[(0,G.jsx)(q,{className:`size-3 animate-spin`}),` Loading...`]}):(0,G.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,G.jsxs)(`div`,{className:`rounded-lg border border-base-300/70 bg-base-100 p-2 flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-xs truncate`,children:e.name}),r&&n?(0,G.jsxs)(`div`,{className:`text-[11px] opacity-60`,children:[n.agents,` agents · `,n.skills,` skills`]}):(0,G.jsx)(`span`,{className:`badge badge-xs badge-warning`,children:`Not synced`}),l[e.id]&&(0,G.jsx)(`p`,{className:`text-[11px] opacity-60 truncate`,children:l[e.id]}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-outline gap-1 mt-auto`,onClick:()=>p(e.id),disabled:t,children:[t?(0,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Vn,{className:`size-3`}),t?`Syncing…`:r?`Re-sync`:`Sync`]})]},e.id)})})]})})}function mc(){let[e,t]=(0,U.useState)([]),[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)(`agents`),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(1),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)([]),[g,_]=(0,U.useState)([]),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),w=(0,U.useCallback)(async()=>{a(!0);try{let[e,n]=await Promise.allSettled([B.get(`/catalog/agents`),B.get(`/catalog/skills`)]);t(e.status===`fulfilled`&&e.value?.agents||[]),r(n.status===`fulfilled`&&n.value?.skills||[])}catch{}a(!1)},[]);(0,U.useEffect)(()=>{w()},[w]);let T=o===`agents`?e:n,E=(0,U.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/fc)),O=Math.min(u,D),k=E.slice((O-1)*fc,O*fc),A=E.length===0?0:(O-1)*fc+1,j=Math.min(O*fc,E.length);(0,U.useEffect)(()=>{d(1)},[o,c]),(0,U.useEffect)(()=>{p(null)},[o]);let M=o===`agents`?m:g,N=o===`agents`?h:_,P=m.length+g.length,F=(0,U.useMemo)(()=>f&&T.find(e=>e.name===f)||null,[f,T]),I=(0,U.useCallback)(e=>{N(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[N]),ee=(0,U.useCallback)(()=>{N(E.map(e=>e.name))},[E,N]),te=(0,U.useCallback)(()=>{N([])},[N]),L=(0,U.useCallback)(async()=>{if(m.length===0&&g.length===0)return;y(!0),x(``),C(``);let e=[];m.length>0&&e.push({label:`Agents`,run:()=>B.post(`/install/agents`,{agents:m})}),g.length>0&&e.push({label:`Skills`,run:()=>B.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]),ne=(0,U.useCallback)(async e=>{let t=o===`agents`;y(!0),x(``),C(``);try{let n=t?await B.post(`/install/agents`,{agents:[e.name]}):await B.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,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(q,{className:`size-6 animate-spin opacity-30`})}):(0,G.jsxs)(`div`,{className:`card bg-base-200`,children:[(0,G.jsxs)(`div`,{className:`card-body gap-0 p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 pb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex bg-base-300 rounded-lg p-0.5 text-xs font-medium`,children:[(0,G.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,G.jsx)(jt,{className:`size-3 inline mr-1 -mt-0.5`}),`Agents (`,e.length,`)`]}),(0,G.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,G.jsx)(mr,{className:`size-3 inline mr-1 -mt-0.5`}),`Skills (`,n.length,`)`]})]}),(0,G.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1 min-w-[180px]`,children:[(0,G.jsx)(Un,{className:`size-3.5 opacity-60`}),(0,G.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Search ${o}...`,value:c,onChange:e=>l(e.target.value)}),c&&(0,G.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-circle`,onClick:()=>l(``),children:(0,G.jsx)(pr,{className:`size-3`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 text-xs`,children:[(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:ee,disabled:E.length===0,children:`All`}),(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:te,disabled:M.length===0,children:`None`})]})]}),E.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] opacity-50`,children:[(0,G.jsxs)(`span`,{children:[A,`–`,j,` of `,E.length]}),D>1&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-square`,disabled:O<=1,onClick:()=>d(e=>Math.max(1,e-1)),children:(0,G.jsx)(Lt,{className:`size-3`})}),(0,G.jsxs)(`span`,{children:[O,`/`,D]}),(0,G.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-square`,disabled:O>=D,onClick:()=>d(e=>Math.min(D,e+1)),children:(0,G.jsx)(Rt,{className:`size-3`})})]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[1fr_1.2fr] min-h-[320px] border-t border-base-300/50`,children:[(0,G.jsx)(`div`,{className:`border-r border-base-300/50 overflow-y-auto max-h-[480px]`,children:k.length===0?(0,G.jsx)(`div`,{className:`flex flex-col items-center justify-center py-12 text-xs opacity-50`,children:T.length===0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`No `,o,` in catalog.`]}),(0,G.jsx)(`p`,{className:`mt-1`,children:`Sync a source above.`})]}):(0,G.jsxs)(`p`,{children:[`No matches for "`,c,`"`]})}):k.map(e=>{let t=M.includes(e.name);return(0,G.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
|
|
47
|
+
`),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,G.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:[(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1`,children:[(0,G.jsx)(Un,{className:`size-4 opacity-40`}),(0,G.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,G.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-circle`,onClick:()=>e.setQuery(``),children:(0,G.jsx)(pr,{className:`size-3`})})]}),(0,G.jsx)(`select`,{className:`select select-bordered select-sm w-auto`,value:r,onChange:e=>i(e.target.value),title:`Sort by`,children:ts.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:C,title:`Export to Jira CSV`,children:(0,G.jsx)(en,{className:`size-4`})}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-square ${t?`btn-primary`:`btn-ghost`}`,onClick:()=>n(!t),title:`Toggle filters`,children:(0,G.jsx)(qn,{className:`size-4`})}),b>0&&(0,G.jsx)(`span`,{className:`badge badge-sm badge-primary`,children:b}),(0,G.jsxs)(`div`,{className:`text-xs opacity-40 shrink-0`,children:[g.length,` result`,g.length===1?``:`s`,p>0&&e.completionFilter===`recent`&&(0,G.jsxs)(`span`,{children:[` · `,p,` older hidden`]})]})]}),t&&(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 space-y-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`State`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.size>0&&(0,G.jsx)(`button`,{className:`badge badge-sm badge-ghost cursor-pointer opacity-60 hover:opacity-100`,onClick:()=>l(new Set),children:`Clear`}),$o.map(e=>{let t=e.states.every(e=>c.has(e)),n=!t&&e.states.some(e=>c.has(e));return(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.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,G.jsxs)(`button`,{className:`badge badge-sm gap-1 cursor-pointer transition-all ${c.has(e)?es[e]:`badge-outline opacity-50 hover:opacity-100`}`,onClick:()=>u(e),children:[e,t>0&&(0,G.jsx)(`span`,{className:`font-mono text-[10px]`,children:t})]},e)})]},e.label)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Show`}),(0,G.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.completionFilter,onChange:t=>e.setCompletionFilter(t.target.value),children:ns.map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),f&&(0,G.jsx)(`div`,{className:`flex items-end`,children:(0,G.jsxs)(`button`,{className:`btn btn-sm btn-ghost gap-1`,onClick:_,children:[(0,G.jsx)(pr,{className:`size-3`}),`Clear all`]})})]})]}),!t&&f&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,G.jsx)(un,{className:`size-3 opacity-40`}),c.size>0&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-primary gap-1`,children:[c.size,` state`,c.size>1?`s`:``,(0,G.jsx)(`button`,{className:`ml-0.5`,onClick:()=>l(new Set),children:(0,G.jsx)(pr,{className:`size-2.5`})})]}),e.completionFilter!==`recent`&&(0,G.jsxs)(`span`,{className:`badge badge-sm badge-ghost gap-1`,children:[`All issues`,(0,G.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCompletionFilter(`recent`),children:(0,G.jsx)(pr,{className:`size-2.5`})})]}),(0,G.jsx)(`button`,{className:`text-xs opacity-40 hover:opacity-100 underline`,onClick:_,children:`clear all`})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3`,children:(0,G.jsx)(Qo,{issues:g,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,expanded:!0,focusedIndex:a})})]})}var as=m(`/analytics`)({}),os={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`},ss={Queued:En,Running:Gt,Reviewing:nn,PendingDecision:nn,Blocked:X,Approved:Vt,Merged:K,Cancelled:Wt};function cs(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function ls(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 us({issueId:e,issueState:t}){let[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(!0),o=(0,U.useRef)(null),s=(0,U.useCallback)(async()=>{try{r(await B.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);(0,U.useEffect)(()=>{s();let e=setInterval(s,2e3);return()=>clearInterval(e)},[s]),(0,U.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,G.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 text-xs opacity-60`,children:[n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(qt,{className:`size-3`}),z(c)]}),(0,G.jsxs)(`span`,{children:[`Log: `,l,` KB`]}),n.agentPid&&(0,G.jsxs)(`span`,{children:[`PID `,n.agentPid]}),n.agentAlive===!1&&n.agentPid&&(0,G.jsx)(`span`,{className:`text-error`,children:`dead`})]}),(0,G.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,G.jsx)(zt,{className:`size-3`}):(0,G.jsx)(It,{className:`size-3`}),(0,G.jsx)(`span`,{className:`text-[10px]`,children:i?`hide`:`output`})]})]}),i&&(0,G.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,G.jsx)(`span`,{className:`opacity-30`,children:`Waiting for output…`})})]})}function ds({index:e,issue:t,total:n,workflow:r}){if(!t)return(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(Gt,{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=ls(u||c?.model),f=c?.provider,p=t.effort?.[l]||t.effort?.default||c?.effort;return(0,G.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,G.jsxs)(`div`,{className:`flex items-center justify-between min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[a?(0,G.jsx)(J,{className:`size-4 animate-spin text-info shrink-0`}):(0,G.jsx)(`span`,{className:`loading loading-spinner loading-sm text-primary shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono text-base font-bold truncate`,children:t.identifier}),(0,G.jsx)(`span`,{className:`badge badge-sm ${os[t.state]||`badge-ghost`} shrink-0`,children:t.state})]}),(0,G.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,G.jsx)(`div`,{className:`text-sm font-medium`,children:t.title}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs opacity-60`,children:[(0,G.jsxs)(`span`,{children:[`Attempt `,(t.attempts||0)+1,`/`,t.maxAttempts]}),t.startedAt&&(0,G.jsxs)(`span`,{children:[`started `,V(t.startedAt)]})]}),(f||d||p)&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[f&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,G.jsx)(er,{className:`size-2.5`}),f]}),d&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:d}),p&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:p})]}),(0,G.jsx)(us,{issueId:t.id,issueState:t.state})]})}function fs({issue:e}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,G.jsx)(ss[e.state]||Gt,{className:`size-3 opacity-40 shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,G.jsx)(`span`,{className:`truncate flex-1`,children:e.title}),(0,G.jsx)(`span`,{className:`badge badge-xs ${os[e.state]||`badge-ghost`}`,children:e.state}),e.state===`Blocked`&&e.nextRetryAt&&(0,G.jsxs)(`span`,{className:`opacity-40 shrink-0`,children:[`retry `,V(e.nextRetryAt)]})]})}function ps({issue:e}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,G.jsx)(e.state===`Merged`?K:e.state===`Approved`?Vt:Wt,{className:`size-3 shrink-0 ${e.state===`Approved`||e.state===`Merged`?`text-success`:`text-neutral`}`}),(0,G.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,G.jsx)(`span`,{className:`truncate flex-1 opacity-70`,children:e.title}),e.durationMs&&(0,G.jsx)(`span`,{className:`opacity-40 shrink-0`,children:z(e.durationMs)}),e.completedAt&&(0,G.jsx)(`span`,{className:`opacity-40 shrink-0`,children:V(e.completedAt)})]})}function ms({running:e,queued:t,concurrency:n,totalTokensToday:r}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-3`,children:[(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-primary/10 rounded-btn p-2`,children:(0,G.jsx)(or,{className:`size-5 text-primary`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-2xl font-bold font-mono`,children:[e.length,(0,G.jsxs)(`span`,{className:`text-sm opacity-50`,children:[`/`,n]})]}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Active agents`})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-info/10 rounded-btn p-2`,children:(0,G.jsx)(En,{className:`size-5 text-info`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:t.length}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Queued`})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-accent/10 rounded-btn p-2`,children:(0,G.jsx)(mr,{className:`size-5 text-accent`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:cs(r)}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Tokens today`})]})]}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`bg-secondary/10 rounded-btn p-2`,children:(0,G.jsx)(dn,{className:`size-5 text-secondary`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:n}),(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Max parallelism`})]})]})]})}function hs({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}=Yr(),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,U.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,G.jsxs)(`div`,{className:`space-y-5 min-w-0 overflow-hidden flex-1`,children:[(0,G.jsx)(ms,{running:u,queued:d,concurrency:o,totalTokensToday:p}),(0,G.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,G.jsx)($t,{className:`size-4 opacity-50`}),`Active Agents`]}),(0,G.jsxs)(`span`,{className:`text-xs opacity-50`,children:[u.length,`/`,o,` slots`]})]}),(0,G.jsx)(`div`,{className:`grid gap-3 min-w-0`,style:{gridTemplateColumns:`repeat(${Math.min(o,3)}, 1fr)`},children:m.map((e,t)=>(0,G.jsx)(ds,{index:t,issue:e,total:o,workflow:c},t))})]}),d.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,G.jsx)(En,{className:`size-4 opacity-50`}),`Queue`,(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:d.length})]}),(0,G.jsxs)(`div`,{className:`space-y-1 stagger-children`,children:[d.slice(0,12).map(e=>(0,G.jsx)(fs,{issue:e},e.id)),d.length>12&&(0,G.jsxs)(`div`,{className:`text-xs opacity-40 pl-3`,children:[`+`,d.length-12,` more`]})]})]}),f.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,G.jsx)(Vt,{className:`size-4 opacity-50`}),`Recently Completed`,(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:f.length})]}),(0,G.jsx)(`div`,{className:`space-y-1 stagger-children`,children:f.map(e=>(0,G.jsx)(ps,{issue:e},e.id))})]}),u.length===0&&d.length===0&&f.length===0&&(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 animate-fade-in-up`,children:[(0,G.jsx)(`div`,{className:`bg-primary/10 rounded-full p-5 mb-4`,children:(0,G.jsx)($t,{className:`size-10 text-primary opacity-60`})}),(0,G.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:`No agents running`}),(0,G.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 gs=m(`/agents`)({component:_s});function _s(){let e=xt();return(0,G.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:(0,G.jsx)(hs,{state:e.data,providers:e.providers.data||{},parallelism:e.parallelism.data||{},onRefresh:e.refresh,issues:e.issues})})}var vs=m(`/`)({beforeLoad:()=>{throw j({to:`/kanban`})}}),ys=m(`/settings/`)({beforeLoad:()=>{throw j({to:`/settings/project`})}}),bs=[{key:`plan`,label:`Plan`,icon:wn,description:`Generate the execution plan`,accent:`info`},{key:`execute`,label:`Execute`,icon:Rn,description:`Implement the changes`,accent:`primary`},{key:`review`,label:`Review`,icon:nn,description:`Review the implementation`,accent:`secondary`}],xs=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`extra-high`,label:`Extra High`}],Ss={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 Cs({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=Ss[e.accent];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`card bg-base-200 border-l-4 ${u.border} animate-fade-in`,children:(0,G.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-lg ${u.bg}`,children:(0,G.jsx)(s,{className:`size-4.5 ${u.text}`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,G.jsx)(`span`,{className:`badge badge-xs ${u.badge} badge-outline`,children:t.provider}),o===e.key&&(0,G.jsxs)(`span`,{className:`text-xs text-success flex items-center gap-1 animate-fade-in`,children:[(0,G.jsx)(Ft,{className:`size-3`}),` saved`]})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:e.description})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2`,children:[(0,G.jsxs)(`label`,{className:`form-control`,children:[(0,G.jsx)(`div`,{className:`label py-0.5`,children:(0,G.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Provider`})}),(0,G.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,G.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),(0,G.jsxs)(`label`,{className:`form-control`,children:[(0,G.jsx)(`div`,{className:`label py-0.5`,children:(0,G.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Model`})}),(0,G.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,G.jsx)(`option`,{value:t.model,children:t.model||`(detecting...)`}),c.map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[e.label,e.tier?` — ${e.tier}`:``]},e.id))]})]}),(0,G.jsxs)(`label`,{className:`form-control`,children:[(0,G.jsx)(`div`,{className:`label py-0.5`,children:(0,G.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Effort`})}),(0,G.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.effort,onChange:e=>i({...t,effort:e.target.value}),children:xs.filter(e=>t.provider===`codex`||e.value!==`extra-high`).map(e=>(0,G.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})}),!a&&(0,G.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,G.jsx)(wt,{className:`size-4 opacity-20`})})]})}var ws=m(`/settings/workflow`)({component:Ts});function Ts(){let e=T(),[t,n]=(0,U.useState)(null),[r,i]=(0,U.useState)([]),[a,o]=(0,U.useState)({}),[s,c]=(0,U.useState)(!0),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),p=(0,U.useRef)(null),m=(0,U.useCallback)(t=>{e.setQueryData(W,e=>Le(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,U.useCallback)(async()=>{c(!0);try{let e=await B.get(`/config/workflow?details=1`);n(e.workflow),i(e.providers||[]),o(e.models||{})}catch{}c(!1)},[]);(0,U.useEffect)(()=>{h()},[h]);let g=(0,U.useCallback)((e,t)=>{p.current&&clearTimeout(p.current),p.current=setTimeout(async()=>{try{await B.post(`/config/workflow`,{workflow:e}),m(e),u(t),setTimeout(()=>u(null),1500)}catch{}},600)},[m]),_=(0,U.useCallback)((e,t)=>{n(n=>{let r={...n,[e]:t};return g(r,e),r})},[g]),v=(0,U.useCallback)(async()=>{f(!0);try{let e=await B.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 B.post(`/config/workflow`,{workflow:f}),m(f),u(`all`),setTimeout(()=>u(null),1500)}catch{}f(!1)},[m]);return(0,U.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),s||!t?(0,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(q,{className:`size-6 animate-spin opacity-30`})}):(0,G.jsxs)(`div`,{className:`space-y-4 stagger-children`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Pipeline Workflow`}),(0,G.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`Changes are saved automatically.`})]}),(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 shrink-0`,onClick:v,disabled:d,children:[d?(0,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Y,{className:`size-3`}),`Restore defaults`]})]}),(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-3 p-4`,children:[(0,G.jsx)(`h3`,{className:`card-title text-sm`,children:`Pipeline`}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Configure providers/models/effort by stage and persist directly to workflow settings.`})]})}),(0,G.jsx)(`ul`,{className:`steps steps-horizontal w-full text-xs`,children:bs.map(e=>{let t=Ss[e.accent];return(0,G.jsx)(`li`,{className:`step ${t.step}`,children:e.label},e.key)})}),(0,G.jsx)(`div`,{className:`flex flex-col`,children:bs.map((e,n)=>(0,G.jsx)(Cs,{stage:e,config:t[e.key],providers:r,modelsByProvider:a,onChange:t=>_(e.key,t),isLast:n===bs.length-1,saving:l===e.key||l===`all`?e.key:null},e.key))})]})}function Es(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ds(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 Os({label:e,period:t,icon:n}){let r=t.inputTokens>0&&t.outputTokens>0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-base-100`,children:[(0,G.jsx)(`div`,{className:`p-2 rounded-lg bg-base-300`,children:(0,G.jsx)(n,{className:`size-4 opacity-70`})}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-60`,children:e}),(0,G.jsxs)(`div`,{className:`font-mono font-semibold text-sm`,children:[Es(t.tokensUsed),` tokens`]}),r&&(0,G.jsxs)(`div`,{className:`flex gap-3 mt-0.5`,children:[(0,G.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,G.jsx)(wt,{className:`size-2.5`}),` `,Es(t.inputTokens)]}),(0,G.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,G.jsx)(Et,{className:`size-2.5`}),` `,Es(t.outputTokens)]})]})]}),(0,G.jsxs)(`div`,{className:`text-right`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-60`,children:`sessions`}),(0,G.jsx)(`div`,{className:`font-mono text-sm`,children:t.sessions})]})]})}function ks({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,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,G.jsx)(`span`,{className:`opacity-60`,children:`Weekly quota`}),(0,G.jsxs)(`span`,{className:`font-mono`,children:[Es(n),` / `,Es(t)]})]}),(0,G.jsx)(`progress`,{className:`progress ${r} w-full progress-animated`,value:e,max:100}),(0,G.jsxs)(`div`,{className:`flex justify-between text-[10px] mt-1`,children:[(0,G.jsxs)(`span`,{className:`opacity-50`,children:[e,`% used`]}),(0,G.jsxs)(`span`,{className:`font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[i,`% available`]})]})]})}function As({nextResetAt:e,resetInfo:t}){let n=Ds(e),r=e?new Date(e):null,i=r?r.toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`}):``;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,G.jsx)(Nt,{className:`size-3.5 opacity-50 shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`opacity-50`,children:t}),e&&(0,G.jsxs)(`div`,{className:`font-mono font-medium mt-0.5`,children:[`Resets in `,(0,G.jsx)(`span`,{className:`text-primary`,children:n}),(0,G.jsxs)(`span`,{className:`opacity-40`,children:[` — `,i]})]})]})]})}function js({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,G.jsxs)(`div`,{className:`flex justify-between items-center text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`opacity-60`,children:e}),(0,G.jsxs)(`span`,{className:`font-mono font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[Es(r),` available`]})]})}function Ms({models:e,currentModel:t}){let[n,r]=(0,U.useState)(!1);return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`space-y-1`,children:(n?e:e.slice(0,4)).map(e=>(0,G.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,G.jsx)(Ht,{className:`size-3 ${e.slug===t?`text-primary`:`opacity-30`}`}),(0,G.jsx)(`span`,{className:`font-mono text-xs flex-1 truncate`,children:e.displayName||e.slug}),e.slug===t&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`active`})]},e.slug))}),e.length>4&&(0,G.jsxs)(`button`,{className:`btn btn-xs btn-ghost mt-1 w-full gap-1`,onClick:()=>r(!n),children:[n?(0,G.jsx)(zt,{className:`size-3`}):(0,G.jsx)(It,{className:`size-3`}),n?`Show less`:`+${e.length-4} more`]})]})}function Ns(e){return e===`global`?`Global`:e===`session`?`Session`:e.replace(/\b\w/g,e=>e.toUpperCase())}function Ps(e){return e===`5h`?`5h`:e===`weekly`?`Week`:e===`daily`?`Daily`:e===`session`?`Session`:e}function Fs({entry:e}){Math.max(0,100-e.percentUsed);let t=e.percentUsed>=90?`progress-error`:e.percentUsed>=70?`progress-warning`:`progress-primary`;return(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-[10px] mb-0.5`,children:[(0,G.jsxs)(`span`,{className:`opacity-60 truncate`,children:[Ns(e.scope),` · `,Ps(e.period)]}),(0,G.jsxs)(`span`,{className:`font-mono shrink-0`,children:[e.percentUsed,`%`]})]}),(0,G.jsx)(`progress`,{className:`progress ${t} w-full h-1.5`,value:e.percentUsed,max:100})]})})}function Is({rateLimits:e}){return!e||e.length===0?null:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:`Rate limits`}),(0,G.jsx)(`div`,{className:`space-y-2 bg-base-100 rounded-lg p-3`,children:e.map((e,t)=>(0,G.jsx)(Fs,{entry:e},`${e.scope}-${e.period}-${t}`))})]})}function Ls({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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)($t,{className:`size-5 ${g}`}),(0,G.jsx)(`h3`,{className:`card-title text-sm`,children:h}),u&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:[`v`,u]})]}),(0,G.jsx)(`span`,{className:`badge badge-sm ${n?`badge-success`:`badge-error`}`,children:n?`available`:`not found`})]}),(d||f||p)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[d&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-outline gap-1`,children:[(0,G.jsx)(Kn,{className:`size-2.5`}),` `,d]}),f&&(0,G.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono truncate max-w-[200px]`,children:f}),p&&(0,G.jsxs)(`span`,{className:`badge badge-xs badge-outline gap-1`,children:[(0,G.jsx)(dn,{className:`size-2.5`}),` `,p]})]}),i&&(0,G.jsxs)(`div`,{className:`text-xs opacity-60`,children:[`Active model: `,(0,G.jsx)(`span`,{className:`font-mono font-medium opacity-100`,children:i})]}),(0,G.jsx)(ks,{percentUsed:l,weeklyLimit:c,weeklyUsed:a.thisWeek.tokensUsed}),(0,G.jsx)(js,{label:`This week remaining`,limit:c,used:a.thisWeek.tokensUsed}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50`,children:`Token usage`}),(0,G.jsx)(Os,{label:`Last 5h`,period:_,icon:qt}),(0,G.jsx)(Os,{label:`Today`,period:a.today,icon:mr}),(0,G.jsx)(Os,{label:`This week`,period:a.thisWeek,icon:gn}),(0,G.jsx)(Os,{label:`All time`,period:a.allTime,icon:qt})]}),(0,G.jsx)(Is,{rateLimits:m}),(0,G.jsx)(As,{nextResetAt:s,resetInfo:o}),r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:[`Available Models (`,r.length,`)`]}),(0,G.jsx)(Ms,{models:r,currentModel:i})]})]})})}function Rs({providersUsage:e}){let t=e?.data,n=t?.providers||[];return e?.isLoading&&!t?(0,G.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[...[,,]].map((e,t)=>(0,G.jsx)(`div`,{className:`skeleton-card h-72`,style:{animationDelay:`${t*100}ms`}},t))}):n.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 opacity-50 animate-fade-in-up`,children:[(0,G.jsx)($t,{className:`size-8`}),(0,G.jsx)(`p`,{className:`text-sm`,children:`No providers detected`})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 stagger-children`,children:n.map(e=>(0,G.jsx)(Ls,{provider:e},e.name))}),t?.collectedAt&&(0,G.jsxs)(`p`,{className:`text-xs opacity-40 text-center`,children:[`Last collected: `,new Date(t.collectedAt).toLocaleTimeString()]})]})}var zs=m(`/settings/providers`)({component:Bs});function Bs(){return(0,G.jsx)(Rs,{providersUsage:xe()})}var Vs=new Set([`main`,`master`]),Hs=m(`/settings/project`)({component:Us});function Us(){let e=T(),t=ze(),n=Fe(t.data),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(`missing`),[l,u]=(0,U.useState)(`local`),[d,f]=(0,U.useState)(``),[p,m]=(0,U.useState)(!0),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(``),[x,S]=(0,U.useState)(!0),[C,w]=(0,U.useState)(!1),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(null),[M,N]=(0,U.useState)(null),[P,F]=(0,U.useState)(!1),[I,ee]=(0,U.useState)(null),[te,L]=(0,U.useState)(!1),[ne,R]=(0,U.useState)(!1),[z,V]=(0,U.useState)(!1),[H,re]=(0,U.useState)(!1),[ie,ae]=(0,U.useState)(``),oe=(0,U.useRef)(null),se=ht(ft(a)||oe.current?.detectedProjectName||oe.current?.projectName),ce=(0,U.useCallback)((t,n,r)=>{e.setQueryData(W,e=>Le(e,{id:t,scope:r,value:n,source:`user`,updatedAt:new Date().toISOString()}))},[e]);(0,U.useEffect)(()=>{S(!0),Promise.allSettled([B.get(`/state`),B.get(`/git/status`)]).then(([e,t])=>{let n=e.status===`fulfilled`?e.value:null;if(n&&typeof n==`object`){oe.current=n;let e=ft(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,U.useEffect)(()=>{if(r||t.isLoading)return;i(!0);let e=Ie(n,`runtime.mergeMode`,`local`);(e===`local`||e===`push-pr`)&&u(e);let a=Ie(n,`runtime.prBaseBranch`,``);typeof a==`string`&&f(a);let s=Ie(n,`runtime.autoReviewApproval`,!0);typeof s==`boolean`&&m(s);let l=Ie(n,`runtime.testCommand`,``);typeof l==`string`&&g(l);let p=_t(n,oe.current||{});o(p.projectName||``),c(p.source),!d&&p.projectName&&f(p.detectedProjectName||y||a||``)},[n,t.isLoading,r]);let le=(0,U.useCallback)(async()=>{S(!0);try{let[e,t]=await Promise.all([B.get(`/state`),B.get(`/git/status`)]);oe.current=e,e?.config?.defaultBranch&&b(e.config.defaultBranch),t&&(v(t),t.branch&&b(t.branch))}finally{S(!1)}},[]),ue=(0,U.useCallback)(async()=>{let e=ft(a);if(!e){ae(`Project name cannot be empty.`);return}L(!0),ae(``);try{await B.post(`/settings/${encodeURIComponent(dt)}`,{scope:`system`,value:e,source:`user`}),ce(dt,e,`system`),o(e),ae(`Project name updated.`),setTimeout(()=>ae(``),1400)}finally{L(!1)}},[a,ce]),de=(0,U.useCallback)(async()=>{R(!0),ae(``);try{await B.post(`/settings/runtime.mergeMode`,{scope:`runtime`,value:l,source:`user`}),ce(`runtime.mergeMode`,l,`runtime`),await B.post(`/settings/runtime.prBaseBranch`,{scope:`runtime`,value:d.trim(),source:`user`}),ce(`runtime.prBaseBranch`,d.trim(),`runtime`),await B.post(`/settings/runtime.autoReviewApproval`,{scope:`runtime`,value:p,source:`user`}),ce(`runtime.autoReviewApproval`,p,`runtime`),ae(`Delivery settings updated.`),setTimeout(()=>ae(``),1400)}finally{R(!1)}},[p,l,d,ce]),fe=(0,U.useCallback)(async()=>{V(!0),ae(``);try{await B.post(`/settings/runtime.testCommand`,{scope:`runtime`,value:h.trim(),source:`user`}),ce(`runtime.testCommand`,h.trim(),`runtime`),ae(`Validation command updated.`),setTimeout(()=>ae(``),1400)}finally{V(!1)}},[h,ce]),pe=(0,U.useCallback)(()=>{w(!0),D(y||``),j(null),N(null)},[y]),me=(0,U.useCallback)(async()=>{let e=E.trim();if(!(!(/^[a-zA-Z0-9/_.-]+$/.test(e)&&e.length>0)||e===y)){k(!0),re(!0),j(null);try{let t=await B.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),re(!1),!d&&l===`push-pr`&&f(e),l||u(`local`),await le(),!l&&d===``&&f(e)}catch(e){j(e instanceof Error?e.message:String(e)),re(!1)}finally{k(!1)}}},[E,y,l,d,le]),he=(0,U.useCallback)(async()=>{F(!0),ee(null);try{let e=await B.post(`/git/init`,{});if(!e?.ok)throw Error(e?.error||`Failed to initialize git.`);await le()}catch(e){ee(e instanceof Error?e.message:String(e))}finally{F(!1)}},[le]),ge=_===null||_.isGit,_e=_?.hasCommits===!0,ve=y&&Vs.has(y);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Project settings`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Match your workspace identity and queue naming.`}),(0,G.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,G.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`Project name`}),(0,G.jsx)(`input`,{type:`text`,className:`input input-bordered w-full`,value:a,onChange:e=>o(e.target.value),placeholder:`Project name`})]}),(0,G.jsxs)(`div`,{className:`rounded-xl border border-base-300/70 bg-base-100 px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-[0.2em] text-base-content/40`,children:`Queue title preview`}),(0,G.jsx)(`div`,{className:`mt-1.5 text-base font-semibold tracking-tight break-words`,children:se||`fifony`})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:ue,disabled:te||!ft(a),children:te?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Save project name`}),(0,G.jsxs)(`span`,{className:`text-xs opacity-50`,children:[`Source: `,s]})]})]})}),(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Bn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Working branch`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Where issue worktrees are created from. Local operations use this branch.`}),x&&(0,G.jsxs)(`div`,{className:`text-xs text-base-content/60 flex items-center gap-2`,children:[(0,G.jsx)(q,{className:`size-3 animate-spin`}),`Loading git status...`]}),!x&&!ge&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,G.jsx)(K,{className:`size-4 shrink-0`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(`p`,{className:`font-semibold`,children:`Not a git repository`}),(0,G.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`fifony requires git and an initial commit to create agent worktrees.`})]})]}),(0,G.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:he,disabled:P,children:[P?(0,G.jsx)(q,{className:`size-4 animate-spin`}):(0,G.jsx)(K,{className:`size-4`}),`Initialize git repository`]}),I&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:I})]}),!x&&ge&&!_e&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`alert alert-warning py-3`,children:[(0,G.jsx)(on,{className:`size-4 shrink-0`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(`p`,{className:`font-semibold`,children:`Repository has no commits yet`}),(0,G.jsx)(`p`,{className:`opacity-80 mt-0.5`,children:`Create an initial commit before agent worktrees can be prepared.`})]})]}),(0,G.jsxs)(`button`,{className:`btn btn-primary gap-2 self-start`,onClick:he,disabled:P,children:[P?(0,G.jsx)(q,{className:`size-4 animate-spin`}):(0,G.jsx)(K,{className:`size-4`}),`Create initial commit`]})]}),ge&&(0,G.jsxs)(G.Fragment,{children:[C?(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`label`,{className:`input input-bordered flex items-center gap-2 flex-1`,children:[(0,G.jsx)(fn,{className:`size-3.5 opacity-40`}),(0,G.jsx)(`input`,{type:`text`,className:`grow font-mono text-sm`,value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&me(),e.key===`Escape`&&w(!1)},disabled:O})]}),(0,G.jsx)(`button`,{className:`btn btn-primary`,onClick:me,disabled:O||!E.trim(),children:O?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Switch`}),(0,G.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>w(!1),disabled:O,children:`Cancel`})]}):(0,G.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:pe,role:`button`,tabIndex:0,onKeyDown:e=>e.key===`Enter`&&pe(),children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(fn,{className:`size-4 opacity-50 shrink-0`}),(0,G.jsx)(`span`,{className:`text-sm opacity-60`,children:`Current branch:`}),(0,G.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:y||`—`}),ve&&(0,G.jsx)(`span`,{className:`badge badge-warning badge-sm ml-auto shrink-0`,children:`protected`}),!C&&(0,G.jsx)(Ln,{className:`size-3.5 opacity-0 group-hover:opacity-40 ml-auto shrink-0 transition-opacity`})]})}),A&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:A}),M&&(0,G.jsxs)(`div`,{className:`alert alert-success py-2 text-xs`,children:[(0,G.jsx)(Bt,{className:`size-3 shrink-0`}),M.created?`Branch created`:`Branch switched`,`: `,(0,G.jsx)(`span`,{className:`font-mono`,children:M.branch})]}),ve&&(0,G.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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(mn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Delivery mode`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Pick how completed issues are integrated.`}),(0,G.jsxs)(`div`,{className:`flex gap-3`,children:[(0,G.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,G.jsx)(`input`,{type:`radio`,name:`settings-merge-mode`,className:`hidden`,checked:l===`local`,onChange:()=>u(`local`)}),(0,G.jsx)(K,{className:`size-4 mx-auto mb-1 opacity-60`}),`Local merge`]}),(0,G.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,G.jsx)(`input`,{type:`radio`,name:`settings-merge-mode`,className:`hidden`,checked:l===`push-pr`,onChange:()=>u(`push-pr`)}),(0,G.jsx)(mn,{className:`size-4 mx-auto mb-1 opacity-60`}),`Push PR`]})]}),l===`push-pr`&&(0,G.jsxs)(`label`,{className:`form-control w-full gap-2`,children:[(0,G.jsx)(`span`,{className:`label-text text-sm font-medium`,children:`PR base branch`}),(0,G.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,G.jsx)(`p`,{className:`text-xs opacity-40`,children:`Branch that PRs target.`})]}),(0,G.jsxs)(`label`,{className:`label cursor-pointer justify-start gap-3`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:p,onChange:e=>m(e.target.checked)}),(0,G.jsx)(`span`,{className:`label-text text-sm`,children:`Automatic review approval`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:p?`Reviewer success marks issue done.`:`Reviewer success requires manual decision.`}),(0,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:de,disabled:ne,children:ne?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Save delivery settings`})]})}),(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(sn,{className:`size-4 opacity-50`}),(0,G.jsx)(`h2`,{className:`card-title text-sm`,children:`Validation command`})]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Runs before issue completion and merge/done.`}),(0,G.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,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:fe,disabled:z,children:z?(0,G.jsx)(q,{className:`size-3 animate-spin`}):`Save validation command`})]})}),ie&&(0,G.jsxs)(`div`,{className:`alert alert-success py-2 text-xs`,children:[(0,G.jsx)(Gn,{className:`size-3`}),` `,ie]}),(0,G.jsx)(`div`,{className:`text-xs text-base-content/40`,children:(0,G.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 Ws=(0,U.lazy)(()=>ba(()=>import(`./OnboardingWizard-TLlzqU2A.js`),__vite__mapDeps([6,1,5,2,4]))),Gs=[`auto`,`light`,`dark`],Ks=`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(`.`),qs=[...Gs,...Ks];function Js(e){return e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function Ys({theme:e,onThemeChange:t}){let n=Js(e),r=[`dark`,`night`,`sunset`,`black`,`synthwave`,`halloween`,`forest`,`luxury`,`dracula`,`business`,`coffee`,`dim`,`abyss`].includes(n);return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Pn,{className:`size-4 opacity-50`}),`Theme`]}),(0,G.jsxs)(`p`,{className:`text-xs opacity-50`,children:[`Current: `,(0,G.jsx)(`span`,{className:`font-semibold`,children:e}),e===`auto`&&(0,G.jsxs)(`span`,{children:[` (resolved to `,n,`)`]}),r?(0,G.jsx)(Mn,{className:`inline size-3 ml-1`}):(0,G.jsx)($n,{className:`inline size-3 ml-1`})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qs.map(n=>(0,G.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 Xs({concurrency:e,setConcurrency:t,saveConcurrency:n,savePending:r}){return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)($t,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Number of parallel workers executing issues simultaneously (1–10).`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.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,G.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,disabled:r,children:r?(0,G.jsx)(`span`,{className:`loading loading-spinner loading-xs`}):`Save`})]})]})})}function Zs({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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Bn,{className:`size-4 opacity-50`}),`Connection Status`]}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,G.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[n&&(0,G.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),(0,G.jsx)(Ht,{className:`size-5 ${i} relative`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:`API`}),(0,G.jsx)(`div`,{className:`text-xs ${i}`,children:a})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,G.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[r&&(0,G.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),r?(0,G.jsx)(ur,{className:`size-5 ${o} relative`}):(0,G.jsx)(lr,{className:`size-5 ${o} relative`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:`WebSocket`}),(0,G.jsx)(`div`,{className:`text-xs ${o}`,children:s})]})]})]})]})})}function Qs({pwa:e}){let t=e?.isInstalled?`Installed`:e?.canInstall?`Installable`:`Browser-managed`;return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Yn,{className:`size-4 opacity-50`}),`Progressive Web App`]}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Service worker`}),(0,G.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:e?.serviceWorkerSupported?`Supported`:`Unavailable`})]}),(0,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Install status`}),(0,G.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:t})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:()=>e.installApp(),disabled:!e?.canInstall,children:[(0,G.jsx)(en,{className:`size-3.5`}),` Install`]}),(0,G.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1`,onClick:()=>e.applyUpdate(),disabled:!e?.updateAvailable,children:[(0,G.jsx)(Vn,{className:`size-3.5`}),` Apply update`]})]})]})})}function $s({notifications:e}){if(!e?.supported)return(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(Ot,{className:`size-4 opacity-50`}),`Notifications`]}),(0,G.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,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(kt,{className:`size-4 opacity-50`}),`Desktop Notifications`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Get notified when issues change state — reviews needed, agents blocked, work completed.`}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Permission`}),(0,G.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,G.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,G.jsx)(`div`,{className:`text-xs opacity-50`,children:`Status`}),(0,G.jsx)(`div`,{className:`text-sm font-medium mt-1 ${e.enabled?`text-success`:``}`,children:e.enabled?`Enabled`:`Disabled`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&!t&&(0,G.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:e.requestPermission,children:[(0,G.jsx)(kt,{className:`size-3.5`}),` Enable notifications`]}),n&&(0,G.jsxs)(`label`,{className:`label cursor-pointer gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm`,children:`Notify on state changes`}),(0,G.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e.enabled,onChange:t=>e.setEnabled(t.target.checked)})]}),t&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:`Notifications were denied. Reset permission in your browser settings to re-enable.`}),n&&e.enabled&&(0,G.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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(cr,{className:`size-4 opacity-50`}),`Event Types`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Choose which events trigger notifications.`}),Xe.map(t=>{let n=r.filter(e=>e.group===t.id);return n.length===0?null:(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`div`,{className:`text-xs font-semibold opacity-40 uppercase tracking-wider`,children:t.label}),n.map(t=>(0,G.jsxs)(`label`,{className:`flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-base-300 transition-colors cursor-pointer`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-xs toggle-primary`,checked:t.enabled,onChange:n=>e.setEventEnabled(t.id,n.target.checked)}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`text-sm font-medium flex items-center gap-2`,children:[t.label,t.sound&&(0,G.jsx)(sr,{className:`size-3 opacity-30`,title:`Plays sound`})]}),(0,G.jsx)(`div`,{className:`text-xs opacity-40`,children:t.description})]})]},t.id))]},t.id)})]})})]})}function ec(){let[e,t]=(0,U.useState)(!1),n=T();return e?(0,G.jsx)(U.Suspense,{fallback:(0,G.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,G.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,G.jsx)(Ws,{onComplete:()=>{t(!1),n.invalidateQueries({queryKey:W})}})}):(0,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,G.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,G.jsx)(cr,{className:`size-4 opacity-50`}),`Setup Wizard`]}),(0,G.jsx)(`p`,{className:`text-xs opacity-50`,children:`Re-run the initial setup wizard to reconfigure providers, effort level, concurrency, and theme.`}),(0,G.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1 w-fit`,onClick:async()=>{try{await B.post(`/settings/ui.onboarding.completed`,{scope:`ui`,value:!1,source:`user`}),n.setQueryData(W,e=>Le(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!1,source:`user`,updatedAt:new Date().toISOString()}))}catch{}t(!0)},children:[(0,G.jsx)(cr,{className:`size-3.5`}),` Re-run Setup Wizard`]})]})})}var tc=m(`/settings/notifications`)({component:nc});function nc(){return(0,G.jsx)(`div`,{className:`space-y-5`,children:(0,G.jsx)($s,{notifications:xt().notifications})})}var rc=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform),ic=[`palette`,`navigation`,`global`,`drawer`,`kanban`,`issues`],ac={palette:{label:`Command Palette`,icon:Zt,color:`text-primary`,badge:`badge-primary`},navigation:{label:`Navigation`,icon:hn,color:`text-info`,badge:`badge-info`},global:{label:`Global`,icon:Sn,color:`text-secondary`,badge:`badge-secondary`},drawer:{label:`Issue Detail`,icon:Fn,color:`text-success`,badge:`badge-success`},kanban:{label:`Kanban Board`,icon:Xt,color:`text-warning`,badge:`badge-warning`},issues:{label:`Issues List`,icon:On,color:`text-error`,badge:`badge-error`}};function oc(e){return(e||``).replace(/mod/gi,rc?`⌘`:`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 sc=m(`/settings/hotkeys`)({component:cc});function cc(){let{hotkeys:e}=fa(),t=(0,U.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 ic)t.has(e)&&r.push({group:e,...ac[e],shortcuts:t.get(e)});return r},[e]),n=t.reduce((e,t)=>e+t.shortcuts.length,0);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-lg font-bold flex items-center gap-2`,children:[(0,G.jsx)(Sn,{className:`size-5 opacity-60`}),`Keyboard Shortcuts`]}),(0,G.jsxs)(`p`,{className:`text-sm opacity-50 mt-1`,children:[n,` shortcuts across `,t.length,` contexts. Press `,(0,G.jsx)(`kbd`,{className:`kbd kbd-xs`,children:`Shift`}),`+`,(0,G.jsx)(`kbd`,{className:`kbd kbd-xs`,children:`/`}),` anywhere to see them.`]})]}),(0,G.jsx)(`span`,{className:`badge badge-ghost font-mono text-xs`,children:rc?`macOS`:`Linux / Windows`})]}),(0,G.jsx)(`div`,{className:`space-y-4`,children:t.map(({group:e,label:t,icon:n,color:r,badge:i,shortcuts:a})=>(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-5 py-3 flex items-center gap-2 border-b border-base-300`,children:[(0,G.jsx)(n,{className:`size-4 ${r}`}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold`,children:t}),(0,G.jsx)(`span`,{className:`badge badge-xs ${i}`,children:a.length})]}),(0,G.jsx)(`div`,{className:`divide-y divide-base-300`,children:a.map((e,t)=>{let n=oc(e.hotkey);return(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-2.5 hover:bg-base-100/50 transition-colors`,children:[(0,G.jsx)(`span`,{className:`text-sm`,children:e.description}),(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:n.map((e,t)=>(0,G.jsxs)(`span`,{className:`flex items-center`,children:[t>0&&(0,G.jsx)(`span`,{className:`text-xs opacity-20 mx-0.5`,children:`+`}),(0,G.jsx)(`kbd`,{className:`kbd kbd-sm font-mono`,children:e.trim()})]},t))})]},t)})})]},e))}),(0,G.jsxs)(`div`,{className:`bg-base-200 rounded-box p-4 text-xs opacity-50 space-y-1`,children:[(0,G.jsxs)(`p`,{children:[`Shortcuts are context-aware. `,(0,G.jsx)(`strong`,{children:`Drawer`}),` shortcuts only work when an issue detail is open. `,(0,G.jsx)(`strong`,{children:`Kanban`}),` and `,(0,G.jsx)(`strong`,{children:`Issues`}),` shortcuts work on their respective pages.`]}),(0,G.jsxs)(`p`,{children:[`Modifier key `,(0,G.jsx)(`kbd`,{className:`kbd kbd-xs`,children:rc?`⌘`:`Ctrl`}),` works in input fields too.`]})]})]})}var lc=m(`/settings/general`)({component:uc});function uc(){let e=xt();return(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsx)(Zs,{status:e.status,wsStatus:e.wsStatus}),(0,G.jsx)(Qs,{pwa:e.pwa}),(0,G.jsx)(ec,{}),(0,G.jsx)(Ys,{theme:e.theme,onThemeChange:e.setTheme})]})}var dc=m(`/settings/agents`)({component:hc}),fc=25;function pc({onCatalogRefresh:e}){let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(()=>new Set),[l,u]=(0,U.useState)({}),d=(0,U.useRef)(!1),f=(0,U.useCallback)(()=>(o(``),i(!0),B.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,U.useEffect)(()=>{d.current||(d.current=!0,f())},[f]);let p=(0,U.useCallback)(async t=>{c(e=>new Set([...e,t])),u(e=>({...e,[t]:``}));try{let n=((await B.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 B.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,G.jsx)(`div`,{className:`card bg-base-200`,children:(0,G.jsxs)(`div`,{className:`card-body gap-3 p-4`,children:[(0,G.jsx)(`h3`,{className:`font-semibold text-sm`,children:`Sources`}),a&&(0,G.jsx)(`div`,{className:`alert alert-warning text-xs py-1`,children:a}),r?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs opacity-60`,children:[(0,G.jsx)(q,{className:`size-3 animate-spin`}),` Loading...`]}):(0,G.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,G.jsxs)(`div`,{className:`rounded-lg border border-base-300/70 bg-base-100 p-2 flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{className:`font-medium text-xs truncate`,children:e.name}),r&&n?(0,G.jsxs)(`div`,{className:`text-[11px] opacity-60`,children:[n.agents,` agents · `,n.skills,` skills`]}):(0,G.jsx)(`span`,{className:`badge badge-xs badge-warning`,children:`Not synced`}),l[e.id]&&(0,G.jsx)(`p`,{className:`text-[11px] opacity-60 truncate`,children:l[e.id]}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-outline gap-1 mt-auto`,onClick:()=>p(e.id),disabled:t,children:[t?(0,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Vn,{className:`size-3`}),t?`Syncing…`:r?`Re-sync`:`Sync`]})]},e.id)})})]})})}function mc(){let[e,t]=(0,U.useState)([]),[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)(`agents`),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(1),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)([]),[g,_]=(0,U.useState)([]),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),w=(0,U.useCallback)(async()=>{a(!0);try{let[e,n]=await Promise.allSettled([B.get(`/catalog/agents`),B.get(`/catalog/skills`)]);t(e.status===`fulfilled`&&e.value?.agents||[]),r(n.status===`fulfilled`&&n.value?.skills||[])}catch{}a(!1)},[]);(0,U.useEffect)(()=>{w()},[w]);let T=o===`agents`?e:n,E=(0,U.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/fc)),O=Math.min(u,D),k=E.slice((O-1)*fc,O*fc),A=E.length===0?0:(O-1)*fc+1,j=Math.min(O*fc,E.length);(0,U.useEffect)(()=>{d(1)},[o,c]),(0,U.useEffect)(()=>{p(null)},[o]);let M=o===`agents`?m:g,N=o===`agents`?h:_,P=m.length+g.length,F=(0,U.useMemo)(()=>f&&T.find(e=>e.name===f)||null,[f,T]),I=(0,U.useCallback)(e=>{N(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[N]),ee=(0,U.useCallback)(()=>{N(E.map(e=>e.name))},[E,N]),te=(0,U.useCallback)(()=>{N([])},[N]),L=(0,U.useCallback)(async()=>{if(m.length===0&&g.length===0)return;y(!0),x(``),C(``);let e=[];m.length>0&&e.push({label:`Agents`,run:()=>B.post(`/install/agents`,{agents:m})}),g.length>0&&e.push({label:`Skills`,run:()=>B.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]),ne=(0,U.useCallback)(async e=>{let t=o===`agents`;y(!0),x(``),C(``);try{let n=t?await B.post(`/install/agents`,{agents:[e.name]}):await B.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,G.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,G.jsx)(q,{className:`size-6 animate-spin opacity-30`})}):(0,G.jsxs)(`div`,{className:`card bg-base-200`,children:[(0,G.jsxs)(`div`,{className:`card-body gap-0 p-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 pb-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex bg-base-300 rounded-lg p-0.5 text-xs font-medium`,children:[(0,G.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,G.jsx)(jt,{className:`size-3 inline mr-1 -mt-0.5`}),`Agents (`,e.length,`)`]}),(0,G.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,G.jsx)(mr,{className:`size-3 inline mr-1 -mt-0.5`}),`Skills (`,n.length,`)`]})]}),(0,G.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1 min-w-[180px]`,children:[(0,G.jsx)(Un,{className:`size-3.5 opacity-60`}),(0,G.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Search ${o}...`,value:c,onChange:e=>l(e.target.value)}),c&&(0,G.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-circle`,onClick:()=>l(``),children:(0,G.jsx)(pr,{className:`size-3`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 text-xs`,children:[(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:ee,disabled:E.length===0,children:`All`}),(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:te,disabled:M.length===0,children:`None`})]})]}),E.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] opacity-50`,children:[(0,G.jsxs)(`span`,{children:[A,`–`,j,` of `,E.length]}),D>1&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-square`,disabled:O<=1,onClick:()=>d(e=>Math.max(1,e-1)),children:(0,G.jsx)(Lt,{className:`size-3`})}),(0,G.jsxs)(`span`,{children:[O,`/`,D]}),(0,G.jsx)(`button`,{className:`btn btn-ghost btn-xs btn-square`,disabled:O>=D,onClick:()=>d(e=>Math.min(D,e+1)),children:(0,G.jsx)(Rt,{className:`size-3`})})]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[1fr_1.2fr] min-h-[320px] border-t border-base-300/50`,children:[(0,G.jsx)(`div`,{className:`border-r border-base-300/50 overflow-y-auto max-h-[480px]`,children:k.length===0?(0,G.jsx)(`div`,{className:`flex flex-col items-center justify-center py-12 text-xs opacity-50`,children:T.length===0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`No `,o,` in catalog.`]}),(0,G.jsx)(`p`,{className:`mt-1`,children:`Sync a source above.`})]}):(0,G.jsxs)(`p`,{children:[`No matches for "`,c,`"`]})}):k.map(e=>{let t=M.includes(e.name);return(0,G.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
|
|
48
48
|
${f===e.name?`bg-primary/10`:`hover:bg-base-100/60`}
|
|
49
|
-
`,onClick:()=>p(e.name),children:[(0,G.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,G.jsx)(`span`,{className:`shrink-0`,children:e.emoji||(o===`agents`?`🤖`:`⚡`)}),(0,G.jsx)(`span`,{className:`truncate font-medium flex-1`,children:e.displayName||e.name}),e.source&&(0,G.jsx)(`span`,{className:`badge badge-ghost badge-xs shrink-0 opacity-60`,children:e.source})]},e.name)})}),(0,G.jsx)(`div`,{className:`p-4 overflow-y-auto max-h-[480px]`,children:F?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`text-2xl`,children:F.emoji||(o===`agents`?`🤖`:`⚡`)}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h4`,{className:`font-semibold text-sm`,children:F.displayName||F.name}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,G.jsx)(`span`,{className:`text-[11px] opacity-50 font-mono`,children:F.name}),F.source&&(0,G.jsx)(`span`,{className:`badge badge-ghost badge-xs`,children:F.source})]})]})]}),F.description&&(0,G.jsx)(`p`,{className:`text-xs opacity-70 leading-relaxed`,children:F.description}),F.domains?.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:F.domains.map(e=>(0,G.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[M.includes(F.name)?(0,G.jsxs)(`button`,{className:`btn btn-xs btn-outline gap-1`,onClick:()=>I(F.name),children:[(0,G.jsx)(Ft,{className:`size-3`}),` Selected`]}):(0,G.jsx)(`button`,{className:`btn btn-xs btn-primary gap-1`,onClick:()=>I(F.name),children:`Add to selection`}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1`,onClick:()=>ne(F),disabled:v,children:[(0,G.jsx)(en,{className:`size-3`}),`Install now`]})]})]}):(0,G.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full text-xs opacity-40`,children:(0,G.jsx)(`p`,{children:`Select an item to view details`})})})]}),D>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 p-2 border-t border-base-300/50 text-xs`,children:[(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,disabled:O<=1,onClick:()=>d(e=>Math.max(1,e-1)),children:[(0,G.jsx)(Lt,{className:`size-3`}),` Prev`]}),(0,G.jsxs)(`span`,{className:`opacity-50`,children:[O,` of `,D]}),(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,disabled:O>=D,onClick:()=>d(e=>Math.min(D,e+1)),children:[`Next `,(0,G.jsx)(Rt,{className:`size-3`})]})]}),(b||S)&&(0,G.jsxs)(`div`,{className:`px-4 pb-3`,children:[b&&(0,G.jsx)(`p`,{className:`text-xs text-success`,children:b}),S&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:S})]})]}),P>0&&(0,G.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,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:()=>{h([]),_([])},children:`Clear`}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-primary gap-1`,onClick:L,disabled:v,children:[v?(0,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Bt,{className:`size-3`}),v?`Installing…`:`Install selected`]})]})]})]})}function hc(){let e=xt(),[t,n]=(0,U.useState)(0);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Xs,{concurrency:e.concurrency,setConcurrency:e.setConcurrency,saveConcurrency:e.saveConcurrency,savePending:e.saveConcPending}),(0,G.jsx)(pc,{onCatalogRefresh:()=>n(e=>e+1)}),(0,G.jsx)(mc,{},t)]})}var gc=Fa.update({id:`/settings`,path:`/settings`,getParentRoute:()=>Na}),_c=za.update({id:`/onboarding`,path:`/onboarding`,getParentRoute:()=>Na}),vc=Vo.update({id:`/kanban`,path:`/kanban`,getParentRoute:()=>Na}),yc=rs.update({id:`/issues`,path:`/issues`,getParentRoute:()=>Na}),bc=as.update({id:`/analytics`,path:`/analytics`,getParentRoute:()=>Na}).lazy(()=>ba(()=>import(`./analytics.lazy-
|
|
49
|
+
`,onClick:()=>p(e.name),children:[(0,G.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,G.jsx)(`span`,{className:`shrink-0`,children:e.emoji||(o===`agents`?`🤖`:`⚡`)}),(0,G.jsx)(`span`,{className:`truncate font-medium flex-1`,children:e.displayName||e.name}),e.source&&(0,G.jsx)(`span`,{className:`badge badge-ghost badge-xs shrink-0 opacity-60`,children:e.source})]},e.name)})}),(0,G.jsx)(`div`,{className:`p-4 overflow-y-auto max-h-[480px]`,children:F?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`text-2xl`,children:F.emoji||(o===`agents`?`🤖`:`⚡`)}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h4`,{className:`font-semibold text-sm`,children:F.displayName||F.name}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,G.jsx)(`span`,{className:`text-[11px] opacity-50 font-mono`,children:F.name}),F.source&&(0,G.jsx)(`span`,{className:`badge badge-ghost badge-xs`,children:F.source})]})]})]}),F.description&&(0,G.jsx)(`p`,{className:`text-xs opacity-70 leading-relaxed`,children:F.description}),F.domains?.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:F.domains.map(e=>(0,G.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[M.includes(F.name)?(0,G.jsxs)(`button`,{className:`btn btn-xs btn-outline gap-1`,onClick:()=>I(F.name),children:[(0,G.jsx)(Ft,{className:`size-3`}),` Selected`]}):(0,G.jsx)(`button`,{className:`btn btn-xs btn-primary gap-1`,onClick:()=>I(F.name),children:`Add to selection`}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1`,onClick:()=>ne(F),disabled:v,children:[(0,G.jsx)(en,{className:`size-3`}),`Install now`]})]})]}):(0,G.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full text-xs opacity-40`,children:(0,G.jsx)(`p`,{children:`Select an item to view details`})})})]}),D>1&&(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-2 p-2 border-t border-base-300/50 text-xs`,children:[(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,disabled:O<=1,onClick:()=>d(e=>Math.max(1,e-1)),children:[(0,G.jsx)(Lt,{className:`size-3`}),` Prev`]}),(0,G.jsxs)(`span`,{className:`opacity-50`,children:[O,` of `,D]}),(0,G.jsxs)(`button`,{className:`btn btn-ghost btn-xs gap-1`,disabled:O>=D,onClick:()=>d(e=>Math.min(D,e+1)),children:[`Next `,(0,G.jsx)(Rt,{className:`size-3`})]})]}),(b||S)&&(0,G.jsxs)(`div`,{className:`px-4 pb-3`,children:[b&&(0,G.jsx)(`p`,{className:`text-xs text-success`,children:b}),S&&(0,G.jsx)(`p`,{className:`text-xs text-error`,children:S})]})]}),P>0&&(0,G.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,G.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,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:()=>{h([]),_([])},children:`Clear`}),(0,G.jsxs)(`button`,{className:`btn btn-xs btn-primary gap-1`,onClick:L,disabled:v,children:[v?(0,G.jsx)(q,{className:`size-3 animate-spin`}):(0,G.jsx)(Bt,{className:`size-3`}),v?`Installing…`:`Install selected`]})]})]})]})}function hc(){let e=xt(),[t,n]=(0,U.useState)(0);return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Xs,{concurrency:e.concurrency,setConcurrency:e.setConcurrency,saveConcurrency:e.saveConcurrency,savePending:e.saveConcPending}),(0,G.jsx)(pc,{onCatalogRefresh:()=>n(e=>e+1)}),(0,G.jsx)(mc,{},t)]})}var gc=Fa.update({id:`/settings`,path:`/settings`,getParentRoute:()=>Na}),_c=za.update({id:`/onboarding`,path:`/onboarding`,getParentRoute:()=>Na}),vc=Vo.update({id:`/kanban`,path:`/kanban`,getParentRoute:()=>Na}),yc=rs.update({id:`/issues`,path:`/issues`,getParentRoute:()=>Na}),bc=as.update({id:`/analytics`,path:`/analytics`,getParentRoute:()=>Na}).lazy(()=>ba(()=>import(`./analytics.lazy-D8vsSFxh.js`).then(e=>e.Route),__vite__mapDeps([7,1,5,2]))),xc=gs.update({id:`/agents`,path:`/agents`,getParentRoute:()=>Na}),Sc=vs.update({id:`/`,path:`/`,getParentRoute:()=>Na}),Cc=ys.update({id:`/`,path:`/`,getParentRoute:()=>gc}),wc=ws.update({id:`/workflow`,path:`/workflow`,getParentRoute:()=>gc}),Tc=zs.update({id:`/providers`,path:`/providers`,getParentRoute:()=>gc}),Ec=Hs.update({id:`/project`,path:`/project`,getParentRoute:()=>gc}),Dc=tc.update({id:`/notifications`,path:`/notifications`,getParentRoute:()=>gc}),Oc=sc.update({id:`/hotkeys`,path:`/hotkeys`,getParentRoute:()=>gc}),kc=lc.update({id:`/general`,path:`/general`,getParentRoute:()=>gc}),Ac={SettingsAgentsRoute:dc.update({id:`/agents`,path:`/agents`,getParentRoute:()=>gc}),SettingsGeneralRoute:kc,SettingsHotkeysRoute:Oc,SettingsNotificationsRoute:Dc,SettingsProjectRoute:Ec,SettingsProvidersRoute:Tc,SettingsWorkflowRoute:wc,SettingsIndexRoute:Cc},jc={IndexRoute:Sc,AgentsRoute:xc,AnalyticsRoute:bc,IssuesRoute:yc,KanbanRoute:vc,OnboardingRoute:_c,SettingsRoute:gc._addFileChildren(Ac)},Mc=Na._addFileChildren(jc)._addFileTypes();window.__fifonyInstallPrompt=null,window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),window.__fifonyInstallPrompt=e});var Nc=new le({defaultOptions:{queries:{staleTime:2e3,retry:1,refetchOnWindowFocus:!1}}}),Pc=O({routeTree:Mc,basepath:`/`,defaultPreload:`intent`});(0,ue.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(U.StrictMode,{children:(0,G.jsx)(D,{client:Nc,children:(0,G.jsx)(E,{router:Pc})})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/service-worker.js`,{scope:`/`}).catch(()=>{})});export{Wt as A,ht as B,dn as C,an as D,on as E,Ft as F,Fe as G,_t as H,jt as I,Ge as J,Le as K,wt as L,Bt as M,Rt as N,$t as O,Lt as P,Ct as R,fn as S,sn as T,W as U,ft as V,Ie as W,Ue as X,ze as Y,de as Z,Cn as _,or as a,pn as b,rr as c,Un as d,Vn as f,q as g,J as h,pr as i,Vt as j,qt as k,Xn as l,Pn as m,Vi as n,X as o,Ln as p,We as q,mr as r,ir as s,fa as t,Gn as u,Sn as v,cn as w,K as x,mn as y,dt as z};
|