import{s as _,a as m,f as p,d as Q,e as V}from"../chunks/BqgPKE-B.js";import"../chunks/zzPCSqzL.js";import{B as S,F as v,K as r,I as d,J as s,t as T,D as q,M as g,f as W,G as X,L as Y}from"../chunks/6mnWt3YZ.js";import{i as J,a as A,b as K}from"../chunks/BJ0MJm0w.js";import{b as Z,a as E,c as $,t as H,e as R,i as ee}from"../chunks/BfTcz1DI.js";import{s as ae}from"../chunks/DTfXqUUs.js";import{P as te,B as se,a as re}from"../chunks/sxu8pfo9.js";import{P as le}from"../chunks/CrkyYhGx.js";var ve=p('<span class="status-icon complete svelte-a8gvc2"><!></span>'),ie=p('<span class="status-icon wip svelte-a8gvc2"><!></span>'),oe=p('<div> </div> <div class="progress-bar svelte-a8gvc2"><div class="progress-fill svelte-a8gvc2"></div></div>',1),ne=p('<a class="card task-item svelte-a8gvc2"><div class="task-head svelte-a8gvc2"><h3 class="svelte-a8gvc2"><!> </h3> <span class="milestone-badge svelte-a8gvc2"> </span></div> <!> <!></a>');function ce(y,l){S(l,!0);const w=()=>K(H,"$t",u),[u,M]=A();let z=g(()=>l.task.total_stages>0?Math.round(l.task.current_stage/l.task.total_stages*100):0),f=g(()=>l.task.phases&&Object.values(l.task.phases).length>0&&Object.values(l.task.phases).every(e=>e==="complete")),I=g(()=>l.task.current_phase==="implement"&&l.task.total_stages>0),L=g(()=>(l.task.milestone||"").replace(/^\d+-/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())||"—");var h=ne(),P=v(h),k=v(P),b=v(k);{var B=e=>{var a=ve(),t=v(a);se(t,{size:20}),s(a),m(e,a)},U=e=>{var a=ie(),t=v(a);re(t,{size:20}),s(a),m(e,a)};J(b,e=>{r(f)?e(B):e(U,!1)})}var O=d(b);s(k);var C=d(k,2),D=v(C,!0);s(C),s(P);var j=d(P,2);te(j,{get phases(){return l.task.phases}});var F=d(j,2);{var G=e=>{var a=oe(),t=W(a);let n;var c=v(t);s(t);var i=d(t,2),o=v(i);s(i),T(x=>{n=E(t,1,"progress-label svelte-a8gvc2",null,n,{"progress-complete":r(z)>=100}),_(c,`${x??""}: ${l.task.current_stage??""}/${l.task.total_stages??""} (${r(z)??""}%)`),$(o,`width: ${r(z)??""}%`)},[()=>w()("task.implement_progress")]),m(e,a)};J(F,e=>{r(I)&&e(G)})}s(h),T(()=>{Z(h,"href",l.href),_(O,` ${l.task.name??""}`),_(D,r(L))}),m(y,h),q(),M()}var de=p('<div class="card empty"><p> </p> <p class="hint"> </p></div>'),_e=p("<button> </button>"),me=p('<div class="milestone-tabs-layout svelte-giyzvd"><nav class="milestone-tabs-nav svelte-giyzvd"></nav> <div class="milestone-tabs-content svelte-giyzvd"></div></div>'),ge=p('<div class="page-with-tabs"><div class="main-header"><h2><!> </h2> <p> </p></div> <!></div>');function pe(y,l){S(l,!0);const w=()=>K(ae,"$status",M),u=()=>K(H,"$t",M),[M,z]=A();let f=Y("__all__"),I=g(()=>{var t;const e=((t=w())==null?void 0:t.tasks)||[],a=new Set;for(const n of e)n.milestone&&a.add(n.milestone);return[...a].sort()}),L=g(()=>[{id:"__all__",label:u()("task.all_milestones")},...r(I).map(e=>({id:e,label:P(e)}))]),h=g(()=>{var a;const e=((a=w())==null?void 0:a.tasks)||[];return r(f)==="__all__"?e:e.filter(t=>t.milestone===r(f))});function P(e){return(e||"").replace(/^\d+-/,"").replace(/-/g," ").replace(/\b\w/g,a=>a.toUpperCase())||e}var k=ge(),b=v(k),B=v(b),U=v(B);le(U,{size:24});var O=d(U);s(B);var C=d(B,2),D=v(C,!0);s(C),s(b);var j=d(b,2);{var F=e=>{var a=de(),t=v(a),n=v(t,!0);s(t);var c=d(t,2),i=v(c,!0);s(c),s(a),T((o,x)=>{_(n,o),_(i,x)},[()=>u()("task.empty"),()=>u()("task.empty_hint")]),m(e,a)},G=e=>{var a=me(),t=v(a);R(t,21,()=>r(L),ee,(c,i)=>{var o=_e();let x;var N=v(o,!0);s(o),T(()=>{x=E(o,1,"tab-item svelte-giyzvd",null,x,{active:r(f)===r(i).id}),_(N,r(i).label)}),V("click",o,()=>X(f,r(i).id,!0)),m(c,o)}),s(t);var n=d(t,2);R(n,21,()=>r(h),c=>c.name,(c,i)=>{{let o=g(()=>encodeURIComponent(r(i).name));ce(c,{get task(){return r(i)},get href(){return`/tasks/${r(o)??""}`}})}}),s(n),s(a),m(e,a)};J(j,e=>{var a,t;(t=(a=w())==null?void 0:a.tasks)!=null&&t.length?e(G,!1):e(F)})}s(k),T((e,a)=>{_(O,` ${e??""}`),_(D,a)},[()=>u()("task.title"),()=>u()("task.subtitle")]),m(y,k),q(),z()}Q(["click"]);function ze(y){pe(y,{})}export{ze as component};
