import{F as o,bV as s,aw as h,bT as b,aL as R,j as a,T as x,ax as c,bE as v,ao as g,O as j}from"./app-BgLa5dit.js";const A="_checkWrapper_1s4po_1",k={checkWrapper:A},S="userManager.userRoleField",n=o.encloseNamespace(S);function F(e){const m=[{value:s.Admin,label:n("admin")},{value:s.SuperAdmin,label:e.countryCode==="US"?n("superAdminUs"):n("superAdmin")}],i=h(),u=!e.hasOrg||!e.canEditSuperAdmin;if(e.userType===b.Learner||e.isEditingCurrentUser)return null;const d=e.isDisabled||e.isValidatingEmail||R.hasNonLegacySso(e.user)&&!e.editSsoFields;return i.values.masterRole===s.SuperAdmin&&!e.canEditSuperAdmin?a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{children:n("role")}),a.jsx(x,{title:n("superAdminTooltip"),spanHack:!0,children:a.jsx("div",{className:"border rounded-pill border-dark",children:n("superAdmin")})})]}):u?a.jsx("div",{className:"d-flex justify-content-between align-items-center",children:a.jsx(c,{id:"masterRole",name:"masterRole",disabled:d,children:()=>a.jsxs("div",{className:"d-flex align-items-center",children:[a.jsx(v,{onClick:()=>{var r;const l=i.values.masterRole===s.User?s.Admin:s.User;i.setFieldValue("masterRole",l),(r=e.onRoleChange)==null||r.call(e,l)},on:i.values.masterRole===s.Admin,disabled:d,showStateWhenDisabled:!0}),!e.hideLabel&&a.jsx("span",{className:"fw-semibold ms-2",children:n("admin")})]})})}):a.jsxs("div",{children:[a.jsx(c,{id:"masterRole",name:"masterRole",disabled:d,label:!e.hideLabel&&"Role",children:()=>m.map(l=>a.jsx("div",{className:`${k.checkWrapper} mb-2`,children:a.jsx(g.Check,{className:"form-check",id:l.value,type:"radio",label:l.label,checked:i.values.masterRole===l.value,onChange:r=>{var t;r.target.checked&&(i.setFieldValue("masterRole",l.value),(t=e.onRoleChange)==null||t.call(e,l.value))},disabled:d})},l.value))}),(i.values.masterRole===s.Admin||i.values.masterRole===s.SuperAdmin)&&a.jsx(j,{className:"text-info mb-2 mt-n2",onClick:()=>{var l;i.setFieldValue("masterRole",s.User),(l=e.onRoleChange)==null||l.call(e,s.User)},children:n("clear")})]})}export{F as U};
//# sourceMappingURL=R6rHoxuD.chunk.js.map
