import{c as et,u as st,o as at,q as K,t as L,v as lt,i as W,r as it,S as O,w as G,j as e,x as nt,y as ot,z as rt,n as H,F as U,C as ct,D as ut,E as dt,B as P,g as ft,H as mt}from"./index-26FXPGkN.js";import{I as St}from"./IconArrowRight-BTNBWTJ0.js";const Q=()=>ft.dispatch(mt.actions.close()),bt=()=>{var $,J;const t=et.c(54),{t:s}=st(),{tasks:a,sprintId:X,onSuccess:j}=at(pt);let g;t[0]!==a?(g=($=a==null?void 0:a.at(0))==null?void 0:$.SprintId,t[0]=a,t[1]=g):g=t[1];const Y=K(g),b=K(X),{statuses:n}=L(Y),{statuses:F}=L(b),V=lt((J=a??[])==null?void 0:J.map(xt).filter(W).filter(l=>n.some(o=>o.Id===l)));let C;t[2]===Symbol.for("react.memo_cache_sentinel")?(C={},t[2]=C):C=t[2];const[i,Z]=it.useState(C);let y;t[3]!==n||t[4]!==i||t[5]!==a?(y=a==null?void 0:a.filter(l=>n.some(o=>o.Id===l.Status)).every(l=>W(l.newStatus)||W(i[l.Status])),t[3]=n,t[4]=i,t[5]=a,t[6]=y):y=t[6];const I=!!y;let v;t[7]!==I||t[8]!==b||t[9]!==j||t[10]!==i||t[11]!==a?(v=()=>{!a||!b||!I||(rt({tasks:a.map(l=>{const{newStatus:o,...w}=l;return{...w,Status:o??i[w.Status]??w.Status}}),sprint:b}),Q(),j==null||j())},t[7]=I,t[8]=b,t[9]=j,t[10]=i,t[11]=a,t[12]=v):v=t[12];const M=v;let r;t[13]!==s?(r=s("diffStatus.description"),t[13]=s,t[14]=r):r=t[14];let k;t[15]!==r?(k=e.jsx(H,{children:r}),t[15]=r,t[16]=k):k=t[16];let T;t[17]===Symbol.for("react.memo_cache_sentinel")?(T={base:12,md:6},t[17]=T):T=t[17];let c;t[18]!==s?(c=s("diffStatus.current"),t[18]=s,t[19]=c):c=t[19];let z;t[20]!==c?(z=e.jsx(H,{fw:"bold",children:c}),t[20]=c,t[21]=z):z=t[21];let B;t[22]!==n?(B=l=>e.jsxs(U,{gap:8,justify:"space-between",children:[e.jsx(ct,{status:ut(n,["Id",l])}),e.jsx(St,{color:"var(--mantine-color-gray-5)",size:20})]},l),t[22]=n,t[23]=B):B=t[23];const R=G;let u;t[24]===Symbol.for("react.memo_cache_sentinel")?(u={base:12,md:6},t[24]=u):u=t[24];const q=O,tt=16;let d;t[25]!==s?(d=s("diffStatus.new"),t[25]=s,t[26]=d):d=t[26];let f;t[27]!==d?(f=e.jsx(H,{fw:"bold",children:d}),t[27]=d,t[28]=f):f=t[28];let D;t[29]!==F||t[30]!==i||t[31]!==s?(D=l=>e.jsx(U,{children:e.jsx(dt,{placeholder:s("diffStatus.choose"),value:i[l],onChange:o=>Z(w=>({...w,[l]:o.Id})),statuses:F||[]})},l),t[29]=F,t[30]=i,t[31]=s,t[32]=D):D=t[32];const A=V.map(D);let m;t[33]!==q||t[34]!==f||t[35]!==A?(m=e.jsxs(q,{gap:tt,children:[f,A]}),t[33]=q,t[34]=f,t[35]=A,t[36]=m):m=t[36];let E;t[37]!==R.Col||t[38]!==u||t[39]!==m?(E=e.jsx(R.Col,{span:u,children:m}),t[37]=R.Col,t[38]=u,t[39]=m,t[40]=E):E=t[40];let S;t[41]!==s?(S=s("common.action.cancel"),t[41]=s,t[42]=S):S=t[42];let p;t[43]!==S?(p=e.jsx(P,{size:"md",fullWidth:!0,radius:"md",variant:"subtle",color:"dark.3",onClick:Q,children:S}),t[43]=S,t[44]=p):p=t[44];const N=!I;let x;t[45]!==s?(x=s("common.action.save"),t[45]=s,t[46]=x):x=t[46];let h;t[47]!==M||t[48]!==N||t[49]!==x?(h=e.jsx(P,{size:"md",fullWidth:!0,radius:"md",onClick:M,disabled:N,children:x}),t[47]=M,t[48]=N,t[49]=x,t[50]=h):h=t[50];let _;return t[51]!==p||t[52]!==h?(_=e.jsxs(U,{gap:16,children:[p,h]}),t[51]=p,t[52]=h,t[53]=_):_=t[53],e.jsxs(e.Fragment,{children:[k,e.jsx(nt,{flex:1,py:32,children:e.jsxs(G,{children:[e.jsx(G.Col,{span:T,children:e.jsxs(O,{gap:16,children:[z,V.map(B)]})}),E]})}),_]})};function pt(t){return t.diffStatusesModal}function xt(t){return ot(t.newStatus)?t.Status:void 0}export{bt as default};
