import{ao as a,ba as o,aq as u,aI as p,i$ as j,j0 as b,aR as x,f1 as S,v as g,iV as U,L as r,j1 as v,cb as B}from"./app-k0jcl5PQ.js";import{u as m}from"./wuHL1Gkg.chunk.js";import{W as A,a as C}from"./Djb1f-EX.chunk.js";const w="userManager.userWizardBackButtons";function E(e){return e.currentStep==="status"?a.jsx(a.Fragment,{}):a.jsx(o,{className:"btn btn-link me-2",appLink:e.appLinks.userManager,children:a.jsx(u,{namespace:w,phrase:"cancel"})})}const l="userManager.userWizardHeader";function N(e){const{duplicateSets:n,hasExistingUsers:s}=m(),{disableNext:t,onClickConfirm:k}=p.useContext(j),L=!!(n!=null&&n.length),i=b.getCurrentContext().appLink;if(e.showStatusStepButton&&i.action===e.appLinks.userUploadStatus.polling.action)return a.jsx(x,{className:e.isPolling?"disabled":"",variant:"dark",onClick:k,disabled:t,children:a.jsx(u,{namespace:l,phrase:"create"})});if(i.action===e.appLinks.userUploadStatus.polling.action)return a.jsx(a.Fragment,{});if(i.action===e.appLinks.userUploadStatus.complete.action&&e.showStatusStepButton)return a.jsx(o,{className:`btn btn-dark ${e.isPolling?"disabled":""}`,appLink:e.appLinks.userManager,disabled:t,children:a.jsx(u,{namespace:l,phrase:"finish"})});if(i.action===e.appLinks.userUploadStatus.complete.action&&!e.showStatusStepButton)return a.jsx(a.Fragment,{});function f(){switch(i.action){case e.appLinks.userUploadPopup.action:case e.appLinks.userUploadReviewAccounts.action:return!L&&!s;case e.appLinks.userUploadFixDuplicates.action:return!s;case e.appLinks.userUploadReviewExistingAccounts.action:return!s;default:return!0}}if(f())return a.jsx(x,{className:t?"disabled":"",variant:"dark",onClick:k,disabled:t,children:a.jsx(u,{namespace:l,phrase:"create"})});function h(){switch(i.action){case e.appLinks.userUploadReviewAccounts.action:if(L)return e.appLinks.userUploadFixDuplicates;if(s&&e.canAddExistingUsers)return e.appLinks.userUploadReviewExistingAccounts;case e.appLinks.userUploadFixDuplicates.action:if(s&&e.canAddExistingUsers)return e.appLinks.userUploadReviewExistingAccounts;case e.appLinks.userUploadReviewExistingAccounts.action:if(e.canAddExistingUsers)return e.appLinks.userUploadConfirmation;default:return null}}return a.jsx(o,{className:`btn btn-dark ${t?"disabled":""}`,appLink:h(),disabled:t,children:a.jsx(u,{namespace:l,phrase:"next"})})}const z="_wizardContent_1apso_1",P={wizardContent:z},c="userManager.bulkUserUploadWizardLayout",d="bulk:user:upload:nav:lock";function y(e){const{users:n,setUsers:s}=m(),t=S();return p.useEffect(()=>{if(!n){g.trigger(e.appLinks.userManager,{replace:!0});return}return t.lock({id:d,title:r.getPhrase(c,"navLockTitle"),text:r.getPhrase(c,"navLockBody"),appLinkWhitelist:U.getWizardAppLinks(e.appLinks),onConfirmUnlock:()=>{s(null)}}),()=>{t.unlock(d)}},[]),p.useEffect(()=>{n!=null&&n.length||(t.unlock(d),g.trigger(e.appLinks.userManager,{replace:!0}))},[n==null?void 0:n.length]),n?a.jsx(v,{children:a.jsxs("div",{className:"px-3",children:[a.jsx(A,{title:r.getPhrase(c,"bulkUpload"),currentStep:e.currentStep,loaded:!0,continueButton:a.jsx(N,{currentStep:e.currentStep,appLinks:e.appLinks,canAddExistingUsers:e.canAddExistingUsers}),backButton:a.jsx(E,{currentStep:e.currentStep,appLinks:e.appLinks}),breadcrumbs:[{name:r.getPhrase(c,"settingsBreadcrumb"),appLink:e.appLinks.settings},{name:r.getPhrase(c,e.userType===B.Learner?"studentManager":"staffManager"),appLink:e.appLinks.userManager},{name:r.getPhrase(c,"bulkUpload"),active:!0}]}),a.jsxs("div",{className:"row g-0",children:[a.jsx("div",{className:"col-2",children:a.jsx(C,{steps:U.getSteps(e.userType,e.canAddExistingUsers),currentStep:e.currentStep})}),a.jsx("div",{className:`col-10 ${P.wizardContent}`,children:e.children})]})]})}):a.jsx(a.Fragment,{})}export{y as B,d as a};
//# sourceMappingURL=B7GcIt_R.chunk.js.map
