import{s as _,a as m,f as p,d as G,e as H}from"../chunks/BLoZk-4Q.js";import"../chunks/DnbEMVOy.js";import{P as X,R as v,K as r,U as d,T as s,t as B,Q as q,V as g,f as J,X as N,W as Y}from"../chunks/CkWh75VR.js";import{i as S,a as A,b as V}from"../chunks/BIAtSU2q.js";import{b as Z,a as D,c as $,t as E,e as W,i as ee}from"../chunks/Bmr4jBBJ.js";import{s as ae}from"../chunks/CLAQm0y3.js";import{P as te,B as se,a as re}from"../chunks/BK8gH9sp.js";import{P as le}from"../chunks/DTg57pEf.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){X(l,!0);const w=()=>V(E,"$t",u),[u,U]=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")),O=g(()=>l.task.current_phase==="implement"&&l.task.total_stages>0),R=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 C=e=>{var a=ve(),t=v(a);se(t,{size:20}),s(a),m(e,a)},j=e=>{var a=ie(),t=v(a);re(t,{size:20}),s(a),m(e,a)};S(b,e=>{r(f)?e(C):e(j,!1)})}var I=d(b);s(k);var T=d(k,2),K=v(T,!0);s(T),s(P);var M=d(P,2);te(M,{get phases(){return l.task.phases}});var L=d(M,2);{var Q=e=>{var a=oe(),t=J(a);let n;var c=v(t);s(t);var i=d(t,2),o=v(i);s(i),B(x=>{n=D(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)};S(L,e=>{r(O)&&e(Q)})}s(h),B(()=>{Z(h,"href",l.href),_(I,` ${l.task.name??""}`),_(K,r(R))}),m(y,h),q(),U()}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){X(l,!0);const w=()=>V(ae,"$status",U),u=()=>V(E,"$t",U),[U,z]=A();let f=Y("__all__"),O=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()}),R=g(()=>[{id:"__all__",label:u()("task.all_milestones")},...r(O).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),C=v(b),j=v(C);le(j,{size:24});var I=d(j);s(C);var T=d(C,2),K=v(T,!0);s(T),s(b);var M=d(b,2);{var L=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),B((o,x)=>{_(n,o),_(i,x)},[()=>u()("task.empty"),()=>u()("task.empty_hint")]),m(e,a)},Q=e=>{var a=me(),t=v(a);W(t,21,()=>r(R),ee,(c,i)=>{var o=_e();let x;var F=v(o,!0);s(o),B(()=>{x=D(o,1,"tab-item svelte-giyzvd",null,x,{active:r(f)===r(i).id}),_(F,r(i).label)}),H("click",o,()=>N(f,r(i).id,!0)),m(c,o)}),s(t);var n=d(t,2);W(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)};S(M,e=>{var a,t;(t=(a=w())==null?void 0:a.tasks)!=null&&t.length?e(Q,!1):e(L)})}s(k),B((e,a)=>{_(I,` ${e??""}`),_(K,a)},[()=>u()("task.title"),()=>u()("task.subtitle")]),m(y,k),q(),z()}G(["click"]);function ze(y){pe(y,{})}export{ze as component};
