import{aC as C,ao as s,aJ as U,ax as p,e9 as f,aI as l,i$ as j,aq as u,cb as R,az as i,iO as O,ay as T,bN as N,L as b,aj as k,gA as B,iW as v,iP as z}from"./app-k0jcl5PQ.js";import{u as G,a as L}from"./DaGep5vp.chunk.js";import{O as P}from"./DhqTzqky.chunk.js";import{u as I}from"./VKSuH0OD.chunk.js";import{U as d,A as _}from"./9ls1F1Ve.chunk.js";import{J as w}from"./hKqzfsO4.chunk.js";import"./CpGXOT1_.chunk.js";import"./DkDkjje4.chunk.js";import"./Djb1f-EX.chunk.js";import"./CCtuxSlD.chunk.js";import"./CPXlV0fg.chunk.js";import"./CnmbO5oy.chunk.js";import"./fstW5ZQE.chunk.js";const E="_descriptionContainer_1psgp_1",F={descriptionContainer:E};function M(e){if(e.options.sort((n,r)=>n.order-r.order).some(n=>n.hasOwnProperty("groupName"))){const n=Object.entries(C.groupBy(e.options,"groupName"));return s.jsx(s.Fragment,{children:n.map(([r,t])=>U.createElement(m,{...e,groupName:r,key:t[0].id,options:t,selectedAction:e.selectedAction,setOption:e.setOption}))})}return s.jsx(m,{...e})}function m(e){var r;function a(t){if(!t.disabled){if(e.selectedAction===t.id){e.setOption(null);return}e.setOption(t.id)}}const n=(r=e.options.find(t=>t.id===e.selectedAction))==null?void 0:r.infoComponent;return s.jsxs(s.Fragment,{children:[e.groupName&&s.jsx("h3",{className:"h6 mt-2",children:e.groupName}),s.jsx("ul",{className:"list-unstyled d-flex align-items-center mx-n1 flex-wrap mb-1",children:e.options.map(t=>s.jsx("li",{className:"mx-1",children:s.jsx(P,{name:t.name,icon:t.icon,onClick:()=>a(t),isSelected:e.selectedAction===t.id,disabled:t.disabled,tooltip:t.tooltip,fontSize:t.fontSize,iconClassName:e.iconClassName,iconSize:e.iconSize,enableHighlight:e.enableHighlight})},t.id))}),s.jsx("div",{className:F.descriptionContainer,children:!!n&&s.jsx(n,{})})]})}const g="userManager.bulkUserActionsSelectAction";function W(e){const[a,n]=p(f.BULK_USER_ACTIONS),{setDisableNext:r}=l.useContext(j);return l.useEffect(()=>{r(!(a!=null&&a.action))},[a==null?void 0:a.action]),s.jsxs("div",{children:[s.jsx("h2",{className:"h4",children:s.jsx(u,{namespace:g,phrase:"heading"})}),s.jsx("p",{children:s.jsx(u,{namespace:g,phrase:e.userType===R.Learner?"infoStudents":"infoStaff",options:{smartCount:e.userCount}})}),s.jsx(M,{options:e.actions,setOption:t=>n("action",t),selectedAction:a==null?void 0:a.action})]})}function q(e){var r,t;const[a]=p(f.BULK_USER_ACTIONS),n=i(!!e&&e);return(r=n.data)!=null&&r.canRollover?!a.allUsersSelected||a.userIdMap.size<a.allUsersCount?{canRollover:!1,reason:"select-all-students"}:{canRollover:!0}:{canRollover:!1,reason:"cooldown",lastRolloverDate:(t=n.data)==null?void 0:t.previousRolloverDate}}const H="userManager.selectBulkAction";function ne(e){const{users:a,count:n}=G(e.userType),r=O(e.userType),{hasClassrooms:t}=T(null);N({title:b.getPhrase(H,"pageTitle")});const o=i(k.currentUser()),h=q(o.data&&w.getYearGroupRolloverStatus(o.data.customerId)),A=i(B.userProducts()),x=i(o.data&&d.yearGroups(o.data.customerId)),c=I({userType:e.userType,field:_.UserProfilesStatus,getSearchAggregation:d.getSearchAggregation}),y=v.getActionOptions({userType:e.userType,allowYearGroupRollover:h,countsByStatus:c,client:z.Primary,products:A.data.map(S=>S.id)??[],yearGroups:x.data,hasClassroomsFeature:t});return s.jsx(L,{appLinks:r,userType:e.userType,users:a,currentStep:"select-action",userCount:n,loaded:!!c,children:s.jsx(W,{actions:y,appLinks:r,userType:e.userType,userCount:n})})}export{ne as BulkUserActionsSelectActionView};
//# sourceMappingURL=vbeLEtAd.chunk.js.map
