const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ParticipantsForm-CNczFlC8.js","assets/index-DTC0Ed21.js","assets/index-By4xmZe0.css","assets/SegmentedControl-CI2D3wRP.js","assets/tasks-ClycqzjK.js","assets/tasks-Ct0kp_KC.css","assets/use-resize-observer-B2T5TxF-.js","assets/PillsInput-BQBRVlfT.js","assets/IconChevronLeft-DwnMQlxZ.js","assets/modifiers.esm-C4X3-xc2.js","assets/IconUser-Bh9n--nN.js","assets/IconGripVertical-A4WphpSm.js","assets/ParticipantsForm-keH5QOhC.css"])))=>i.map(i=>d[i]);
import{$ as E,j as e,q as T,I as le,l as _,e as de,r as p,i as b,dm as ue,a$ as he,ac as G,dn as K,dp as pe,dq as me,H as M,bD as z,al as J,dj as ge,cV as xe,d2 as ye,d3 as fe,dr as je,cY as Ie,d5 as ve,d4 as H,d9 as be,d8 as ke,S as F,M as P,D as we,ds as _e,dt as Ce,du as Se,u as Te,dv as Me,bT as Ae,dw as A,K as De,G as N,af as D,a_ as Z,d as S,bx as w,y as O,k as Oe,aS as ee,dl as Ue,dx as ze,p as V,c9 as Fe,f as Ne,a1 as Ee,dy as se,ah as Pe,a as Be,aa as Re,bj as Ge,aU as He,a3 as $,ae as W,bF as Ve,dz as U,aD as L,ca as C,dA as $e}from"./index-DTC0Ed21.js";import{I as We}from"./IconChevronLeft-DwnMQlxZ.js";import{r as Le}from"./modifiers.esm-C4X3-xc2.js";import{a as Qe,I as qe}from"./IconUser-Bh9n--nN.js";import{I as Xe}from"./IconGripVertical-A4WphpSm.js";/**
 * @license @tabler/icons-react v3.35.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ye=[["path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6l8 0",key:"svg-1"}],["path",{d:"M16 6l4 0",key:"svg-2"}],["path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M4 12l2 0",key:"svg-4"}],["path",{d:"M10 12l10 0",key:"svg-5"}],["path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-6"}],["path",{d:"M4 18l11 0",key:"svg-7"}],["path",{d:"M19 18l1 0",key:"svg-8"}]],Ke=E("outline","adjustments-horizontal","AdjustmentsHorizontal",Ye);/**
 * @license @tabler/icons-react v3.35.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */const Je=[["path",{d:"M5 14h14l-4.5 -4.5l4.5 -4.5h-14v16",key:"svg-0"}]],Ze=E("outline","flag-3","Flag3",Je);/**
 * @license @tabler/icons-react v3.35.0 - MIT
 *
 * This source code is licensed under the MIT license.
 * See the LICENSE file in the root directory of this source tree.
 */const es=[["path",{d:"M5 9l14 0",key:"svg-0"}],["path",{d:"M5 15l14 0",key:"svg-1"}],["path",{d:"M11 4l-4 16",key:"svg-2"}],["path",{d:"M17 4l-4 16",key:"svg-3"}]],ss=E("outline","hash","Hash",es),ts=r=>e.jsx(T,{size:"sm",variant:"subtle",color:"gray.5",c:"light-dark(var(--mantine-color-dark-5), var(--mantine-color-dark-0))",...r,children:e.jsx(We,{})}),rs=r=>e.jsx(T,{size:"sm",variant:"subtle",color:"gray.5",c:"light-dark(var(--mantine-color-dark-5), var(--mantine-color-dark-0))",...r,children:e.jsx(le,{})}),ns=()=>{const{t:r}=_(),{generic:t,attributes:n,isKanban:s,onChange:o}=de({skipAttributesCheck:!0}),[d,l]=p.useState([]);p.useEffect(()=>{const g=Object.entries(is[s?"kanban":"list"]).map(([i,m])=>({...m,id:i,label:r(`sprintViewSettings.fields.${i}`),icon:as[i]}));g.push(...b(n,"Order").map(i=>({id:String(i.Id),label:i.Name,value:!1,icon:ue[i.ValueType]})));const y=g.map((i,m)=>({...i,order:m})).map(i=>{const m=t[i.id];return m?{...i,order:m.order,value:m.display}:i});l(b(y,"order"))},[n,t,s,r]);const a=p.useCallback(c=>{l(g=>{const u=typeof c=="function"?c(g):c;return he(u,g)?g:(o(u.reduce((y,{id:i,order:m,value:f})=>({...y,[i]:{order:m,display:f}}),{})),b(u,"order"))})},[o]);return[d,a]},as={type:e.jsx(me,{}),code:e.jsx(ss,{}),name:e.jsx(pe,{}),status:e.jsx(K,{}),priority:e.jsx(Ze,{}),performer:e.jsx(Qe,{}),startDate:e.jsx(G,{}),dueDate:e.jsx(G,{})},is={list:{type:{value:!0,keepOrder:!0},code:{value:!0,keepOrder:!0},name:{value:!0,disabled:!0,keepOrder:!0},status:{value:!0},priority:{value:!0},performer:{value:!0},startDate:{value:!1},dueDate:{value:!1}},kanban:{name:{value:!0,disabled:!0,keepOrder:!0},type:{value:!0,keepOrder:!0},code:{value:!0,keepOrder:!0},priority:{value:!0,keepOrder:!0},performer:{value:!0,keepOrder:!0},startDate:{value:!1,keepOrder:!0},dueDate:{value:!0,keepOrder:!0}}},os="_menuItem_1igh0_1",cs="_field_1igh0_15",ls="_icon_1igh0_23",ds="_label_1igh0_24",us="_grip_1igh0_30",hs="_switchInput_1igh0_50",ps="_switchTrack_1igh0_50",ms="_switchThumb_1igh0_55",x={menuItem:os,field:cs,icon:ls,label:ds,switch:"_switch_1igh0_25",grip:us,switchInput:hs,switchTrack:ps,switchThumb:ms},B=p.forwardRef(({id:r,icon:t,label:n,value:s,disabled:o,keepOrder:d,gripProps:l,onChange:a,...c},g)=>e.jsxs(M,{ref:g,className:x.field,gap:8,"data-disabled":o,...c,children:[s&&e.jsx(z,{variant:"transparent",size:"sm",className:x.grip,"data-keep-order":d,...l,children:e.jsx(Xe,{})}),e.jsx(z,{variant:"transparent",size:"sm",className:x.icon,children:t}),e.jsx(J,{className:x.label,children:n}),e.jsx(ge,{className:x.switch,classNames:{input:x.switchInput,track:x.switchTrack,thumb:x.switchThumb},size:"xs",checked:s,disabled:o,onChange:u=>a==null?void 0:a(r,u.currentTarget.checked)})]})),gs=()=>{const{active:r}=xe();return r!=null&&r.data.current?e.jsx(ye,{children:e.jsx(fe,{children:e.jsx(B,{...r.data.current})})}):null},xs=({onChange:r,...t})=>{const{attributes:{tabIndex:n,...s},listeners:o,setNodeRef:d,transform:l,transition:a,isDragging:c}=je({id:t.id,data:t});return e.jsx(B,{ref:d,style:{transform:Ie.Transform.toString(l),transition:a,opacity:c?.5:1},gripProps:{...s,...o},onChange:r,...t})},ys=()=>{const{t:r}=_(),[t,n]=ns(),s=p.useCallback((o,d)=>{const l=fs(t,{from:o,to:d});n(l)},[t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(Q,{title:r("sprintViewSettings.fieldGroups.visible"),fields:t.filter(o=>o.value),onChange:n,onOrder:s}),e.jsx(Q,{title:r("sprintViewSettings.fieldGroups.hidden"),fields:t.filter(o=>!o.value),onChange:n})]})},Q=({title:r,fields:t,onChange:n,onOrder:s})=>{const o=ve(H(ke,js),H(be,Is)),d=p.useCallback((a,c)=>{n(g=>g.map(u=>u.id===a?{...u,value:c}:u))},[n]),l=p.useCallback(a=>{a.over&&(s==null||s(String(a.active.id),String(a.over.id)))},[s]);return t.length?e.jsxs(F,{gap:4,children:[e.jsx(P,{fz:12,c:"gray.6",mb:4,children:r}),e.jsxs(we,{sensors:o,onDragEnd:l,modifiers:[Le],collisionDetection:_e,children:[e.jsx(Ce,{items:t,strategy:Se,children:t.map(a=>{const c=a.keepOrder?B:xs;return e.jsx(c,{...a,onChange:d},a.id)})}),e.jsx(gs,{})]})]}):null},fs=(r,{from:t,to:n})=>{const s=b(r,"order"),o=s.findIndex(a=>a.id===t),d=s.findIndex(a=>a.id===n),l=s[o];return s.splice(o,1),s.splice(d,0,l),s.map((a,c)=>({...a,order:c}))},js={activationConstraint:{distance:10}},Is={activationConstraint:{delay:150,tolerance:5}},vs=({icon:r,label:t,onClick:n})=>e.jsxs(M,{gap:8,className:x.menuItem,onClick:n,children:[e.jsx(z,{variant:"transparent",size:"sm",c:"inherit",children:r}),e.jsx(P,{fz:14,flex:1,children:t})]}),Gs=()=>{const{t:r}=_(),t=Te(),{handleDownload:n}=Me({sprint:t??void 0}),[s,o]=p.useState(t?"root":"fields"),[d,{toggle:l,close:a}]=Ae(!1,{onClose:()=>{t&&setTimeout(()=>o("root"),100)}});return e.jsxs(A,{opened:d,onChange:l,width:300,floatingStrategy:"fixed",middlewares:ks,children:[e.jsx(A.Target,{children:e.jsx(T,{variant:"default",size:"lg","aria-label":"Settings",onClick:l,children:e.jsx(Ke,{style:{width:"50%",height:"50%"},stroke:1.5})})}),e.jsx(A.Dropdown,{children:e.jsxs(F,{gap:16,children:[e.jsxs(M,{justify:"space-between",children:[t&&s!=="root"&&e.jsx(ts,{onClick:()=>o("root")}),e.jsx(De,{order:3,fz:16,fw:500,children:r(`sprintViewSettings.tabs.${s}`)}),e.jsx(rs,{onClick:a})]}),s==="root"&&e.jsx(F,{gap:0,children:["fields","export"].map(c=>e.jsx(vs,{icon:bs[c],label:r(`sprintViewSettings.tabs.${c}`),onClick:()=>{c==="export"?(n(),a()):o(c)}},c))}),s==="fields"&&e.jsx(ys,{})]})})]})},bs={fields:e.jsx(K,{}),export:e.jsx(qe,{})},q=r=>{const s=r.y+r.height+8;return Math.max(65,s)},ks={shift:{padding:0,crossAxis:!0,limiter:{fn:({x:r,rects:t})=>({x:r,y:q(t.reference)})}},size:{apply:async({elements:r,platform:t,strategy:n,rects:s})=>{const o=await t.getClippingRect({element:r.floating,boundary:"clippingAncestors",rootBoundary:"viewport",strategy:n}),d=q(s.reference);Object.assign(r.floating.style,{height:`${o.height-d}px`})}}},ws=({count:r})=>e.jsx("div",{children:Array(r||4).fill(null).map((t,n)=>e.jsx(_s,{},n))}),_s=()=>e.jsxs(N,{gap:8,h:56,px:12,justify:"space-between",children:[e.jsxs(N,{gap:8,flex:1,children:[e.jsx(D,{style:{flexShrink:0},w:38,h:38,radius:"xl"}),e.jsx(D,{w:"50%",h:20})]}),e.jsx(D,{w:"10%",h:20})]}),Cs="_modalContent_11yjh_1",Ss="_modalBody_11yjh_5",X={modalContent:Cs,modalBody:Ss},Ts=p.lazy(()=>Pe(()=>import("./ParticipantsForm-CNczFlC8.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Ms=()=>{const{t:r}=_(),t=Z(),{opened:n,project:s}=S(h=>h.manageUsersModal),o=S(h=>h.usersCache.currentUser.Id),d=S(h=>h.usersCache.entities),l=p.useMemo(()=>({entityId:(s==null?void 0:s.Id)||0,entityType:w.Entity.Project}),[s==null?void 0:s.Id]),{data:a,status:c,isFetching:g}=O.useGetQuery(l,{skip:!n||!s}),u=p.useMemo(()=>{if(!(a!=null&&a.UserAccessRights)||!s)return[];const h=a.UserAccessRights.map(v=>v.PrincipalId);return Oe([...h,s.OwnerId,o])},[o,a==null?void 0:a.UserAccessRights,s]),{status:y,isFetching:i}=ee.useGetByIdQuery({ids:u},{skip:c!==Ue.fulfilled}),m=p.useMemo(()=>ze([c,y]),[c,y]),f=p.useMemo(()=>{if(!a)return[];const h=u.map(v=>{var R;const ae=v===(s==null?void 0:s.OwnerId),ie=v===o,oe=((R=a.UserAccessRights.find(ce=>ce.PrincipalId===v))==null?void 0:R.Type)??w.AccessType.Read,j=d[v];return j?{Email:j.Email,isOwner:ae,isCurrent:ie,accessType:oe,Avatar:j.Avatar,FirstName:j.FirstName,Id:j.Id,Name:j.Name,Surname:j.Surname,Status:null}:null}).filter(Boolean)||[];return b(h,["isCurrent","isOwner","Name"],["desc","desc","asc"])},[o,a,s==null?void 0:s.OwnerId,u,d]),[I]=O.useGiveMutation(),[k]=O.useRemoveMutation(),te=p.useCallback(h=>{s&&I({entityType:w.Entity.Project,ids:[s.Id],type:h.type,userIds:h.userIds}).unwrap().then(()=>{t(V.util.invalidateTags(["Project"]))})},[t,I,s]),re=p.useCallback(h=>{s&&I({entityType:w.Entity.Project,ids:[s.Id],type:h.type,userIds:h.userIds})},[I,s]),ne=p.useCallback(h=>{s&&Fe({title:r("members.remove.title"),children:e.jsx(P,{dangerouslySetInnerHTML:{__html:r("members.remove.confirm",{user:h.Name})}}),onConfirm:()=>{k({entityId:s.Id,entityType:w.Entity.Project,userId:h.Id}).unwrap().then(()=>{t(V.util.invalidateTags(["Project"])),t(Ne.util.invalidateTags([{type:"Performer",id:h.Id}]))})}})},[t,s,k,r]);return s?e.jsx(Ee,{opened:n,onClose:()=>t(se.actions.close()),title:r("members.subtitle"),size:"lg",classNames:{content:X.modalContent,body:X.modalBody},children:e.jsx(p.Suspense,{fallback:e.jsx(ws,{}),children:e.jsx(Ts,{usersData:f,onRemove:ne,onUpdate:re,onAdd:te,status:m,isFetching:g||i,projectId:s.Id})})}):null},As="_root_12hzk_1",Ds="_labelWrapper_12hzk_9",Y={root:As,labelWrapper:Ds},Os=6,Us=3,zs=({project:r,selected:t,onSelect:n})=>{const{t:s}=_(),o=Ge("(max-width: 576px)"),d=S(i=>i.usersCache.currentUser.Id),{data:l}=ee.useGetByIdQuery({ids:r.UserIds}),a=He("light",{getInitialValueInEffect:!0})==="light",c=o?Us:Os,{users:g,hiddenUsers:u}=p.useMemo(()=>{const i=l==null?void 0:l.map(k=>({...k,isCurrent:k.Id===d})),m=b(i,["isCurrent","Name"],["desc","asc"]),f=m.slice(0,c).filter(Boolean),I=m.slice(c,r.UserIds.length).filter(Boolean)||[];return{users:f,hiddenUsers:I}},[r,l,d,c]),y=p.useMemo(()=>u.some(i=>t==null?void 0:t.includes(i.Id)),[u,t]);return e.jsx($.Group,{openDelay:300,closeDelay:100,children:e.jsxs(W.Group,{spacing:"sm",children:[g.map(i=>{const m=t==null?void 0:t.includes(i.Id);return e.jsx(Ve,{size:36,onClick:()=>n==null?void 0:n(U(t,[i.Id])),user:i,style:m?{boxShadow:"0 0 0 2px var(--mantine-color-blue-5)",cursor:"pointer",zIndex:1}:{cursor:"pointer"}},i.Id)}),e.jsx($,{label:s("members.notAssigned"),withArrow:!0,children:e.jsx(L,{size:36,onClick:()=>n==null?void 0:n(U(t,[-1])),style:{cursor:"pointer",...t!=null&&t.includes(-1)?{boxShadow:"0 0 0 2px var(--mantine-color-blue-5)",zIndex:1}:{}}})}),u.length>0&&e.jsxs(C,{closeOnItemClick:!1,transitionProps:{transition:"fade-down",duration:150},children:[e.jsx(C.Target,{children:e.jsx(W,{radius:"xl",color:a?"dark.5":"light.5",style:y?{boxShadow:"0 0 0 2px var(--mantine-color-blue-5)",cursor:"pointer",zIndex:1}:{cursor:"pointer"},children:u.length>99?"99+":`+${u.length}`})}),e.jsx(C.Dropdown,{mah:300,maw:640,style:{overflowY:"auto",overflowX:"hidden"},children:u.map((i,m)=>{const f=t==null?void 0:t.includes(i.Id);return e.jsx(C.Item,{styles:{itemLabel:{minWidth:0}},children:e.jsx($e,{checked:f,classNames:{root:Y.root,labelWrapper:Y.labelWrapper},styles:{body:{display:"flex",alignItems:"center"}},label:e.jsxs(N,{children:[e.jsx(L,{size:36,user:i,style:{cursor:"default"}}),e.jsx(J,{fw:400,children:i==null?void 0:i.Name})]}),onChange:()=>n==null?void 0:n(U(t,[i.Id]))})},(i==null?void 0:i.Id)??m)})})]})]})})},Hs=({projectId:r,selected:t,onSelect:n})=>{const s=Z(),{project:o}=Be(r);if(o)return e.jsxs(M,{gap:12,wrap:"nowrap",pt:2,children:[e.jsx(zs,{project:o,selected:t,onSelect:n}),e.jsx(Ms,{}),e.jsx(T,{size:36,variant:"light",color:"dark",radius:100,onClick:()=>s(se.actions.open({project:o})),children:e.jsx(Re,{size:16,color:"var(--mantine-color-gray-6)"})})]})};export{Gs as G,Ke as I,Hs as P,ws as a};
