import{j as t,b7 as s,Q as x,bU as f,cA as g,ag as j,bT as S,R as l,b8 as w,cB as L,g as k}from"./app-BgLa5dit.js";import{B as o}from"./DkDkjje4.chunk.js";import{h as y}from"./vyqb6V0P.chunk.js";const r="userManager.wizardInProgress";function E(e){const a=Math.floor(e.totalItemsComplete/e.totalItems*100)||0;function u(){return e.objectType===j.User&&e.userType?t.jsx(s,{namespace:r,phrase:e.userType===S.Learner?"progressStudents":"progressStaff",options:{totalComplete:e.totalItemsComplete,total:e.totalItems,smartCount:e.totalItems}}):e.objectType===j.Video?t.jsx(s,{namespace:r,phrase:"progressVideos",options:{totalComplete:e.totalItemsComplete,total:e.totalItems,smartCount:e.totalItems}}):t.jsx(s,{namespace:r,phrase:"progressItems",options:{totalComplete:e.totalItemsComplete,total:e.totalItems,smartCount:e.totalItems}})}return t.jsxs("div",{children:[t.jsxs("div",{className:"d-flex align-items-center mb-2",children:[t.jsx("h2",{className:"h5 mb-0",children:t.jsx(s,{namespace:r,phrase:"heading",options:{percentage:a,actionName:e.actionName}})}),t.jsx(x,{svg:f})]}),t.jsx("p",{children:t.jsx(s,{namespace:r,phrase:`info${e.actionVerb}`})}),t.jsxs("p",{className:"mb-1",children:[t.jsx("span",{className:"text-info",children:e.progressVerbPhrase?t.jsx("span",{children:e.progressVerbPhrase}):t.jsx(s,{namespace:r,phrase:`progressVerb${e.actionVerb}`})})," ",u()]}),t.jsx(g,{variant:"info",now:a})]})}const m="userManager.wizardSubmitted";function P(e){return t.jsxs("div",{children:[t.jsxs("div",{className:"d-flex align-items-center mb-2",children:[t.jsx("h2",{className:"h5 mb-0",children:e.actionName?t.jsx(s,{namespace:m,phrase:"heading",options:{actionName:e.actionName}}):t.jsx(s,{namespace:m,phrase:"headingGeneric"})}),t.jsx(x,{svg:f})]}),t.jsx("p",{children:t.jsx(s,{namespace:m,phrase:`info${e.actionVerb}`})}),t.jsx("p",{className:"mb-1 text-info",children:t.jsx(s,{namespace:m,phrase:"preparing"})}),t.jsx(g,{variant:"info",now:0})]})}const b=2e3,R=3;function W(e){const[a,u]=l.useState(null),[I,C]=l.useState(0),i=l.useRef(null),h=w(),N=L();l.useEffect(()=>(d(),()=>{i.current&&window.clearTimeout(i.current)}),[e.jobId]);function d(){e.pollJob(T,v)}function T(n){if(u(n),!(n.status===o.Completed||n.status===o.CompletedWithError||n.status===o.Failed)){i.current=window.setTimeout(d,b);return}window.setTimeout(()=>{V()},2e3)}function v(n){I===R&&(window.clearTimeout(i.current),e.navLockId&&h.unlock(e.navLockId),y(n)),C(c=>c+1),i.current=window.setTimeout(d,b)}function V(){var c;e.navLockId&&h.unlock(e.navLockId);const n={jobId:e.jobId};if(e.userType&&(n.userType=e.userType,N(["school:users","user:count","search:aggregation","search:users"])),e.statusCompleteAppLink){k.trigger({...e.statusCompleteAppLink,params:n});return}(c=e.onStatusCompleted)==null||c.call(e)}return!a||a.status===o.Submitted||a.status===o.Queued||a.status===o.Pending||a.totalItems===0?t.jsx(P,{actionName:e.actionName,actionVerb:e.actionVerb}):t.jsx(E,{totalItems:a.totalItems,totalItemsComplete:a.processedItems,userType:e.userType,objectType:e.objectType,actionName:e.actionName,actionVerb:e.actionVerb,progressVerbPhrase:e.progressVerbPhrase})}export{W,E as a};
//# sourceMappingURL=6ciM85sA.chunk.js.map
