import{aI as m,bc as H,aX as U,bp as _,ax as D,bd as M,e9 as O,bI as V,ge as G,bK as z,aZ as B,f$ as A,L as f,ao as e,aF as K,aq as $,bU as l,o as F,bg as W,W as q,p as X,E as Z,r as J,a as Q,gC as Y,gD as ee,v as p,f as se,e as te,gE as oe}from"./app-k0jcl5PQ.js";import{S as ne}from"./CSEWPTB7.chunk.js";import"./BcYgJJPz.chunk.js";const ie="_selectPresentation_1vc9d_18",ae={selectPresentation:ie},u="settings.schoolLevelSelectorPopup",i=f.encloseNamespace(u);function pe(a){const[s,d]=m.useState(),g=H(),{hasPermissions:x}=U(),c=_(),S=c.xs||c.sm,v=S||c.md,[,E]=D(O.AUDIENCE_FILTER,void 0,{storage:M.SessionStorage}),{activePresentation:t,setActivePresentation:L}=V(),{preferredPresentation:r,setPreferredPresentation:C}=G(),{availablePresentations:o,hasCompleted:T}=z();m.useEffect(()=>{t!=null&&t.id&&d(t)},[t==null?void 0:t.id]);function j(n){d(n)}function k(){F.logUserAction({id:r==null?void 0:r.id,targetId:s.id},{actionType:J.EditAssoc,entity:Z.Presentation,location:X.Popup,workflowPhase:q.Complete,eventVersion:W.V3});const n=Q.getCurrentRoute().appLink;Y.has(ee(n))?p.trigger({application:te.DASHBOARD,action:se.Dashboard.HOME,args:[null]}):oe(n)?p.trigger({...n,args:[s.vanitySlug,...n.args.slice(1)??[]]}):p.trigger(n),g.success(i("success")),a.closePopup()}function I(){g.error(f.getPhrase(u,"error")),a.closePopup()}function N(){E(null),w()}function w(){L(s),C(s).then(k).catch(I)}const h=x(B.GuestExperience),y=(o==null?void 0:o.length)>A.MULTI_PRESENTATION_THRESHOLD?"lg":void 0,R=(o==null?void 0:o.length)>A.MULTI_PRESENTATION_THRESHOLD?"largePopup":"";let P=i(h?"titleGuest":"title");S&&(P=i("titleSmall"));const b=()=>e.jsxs("div",{className:`${ae.selectPresentation} ${R}`,children:[e.jsx("p",{children:e.jsx($,{namespace:u,phrase:h?"infoGuest":"info"})}),e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"position-relative",children:e.jsx(ne,{schoolLevels:o,onSelect:j,selectedId:s==null?void 0:s.id,showCoverPills:v})}),e.jsxs(l,{children:[e.jsx(l.Cancel,{onClick:a.closePopup}),e.jsx(l.Submit,{variant:"dark",onClick:N,text:i("save")})]})]})]});return e.jsx(K,{title:P,closePopup:a.closePopup,showLoadingSpinner:!T,size:y,children:e.jsx(b,{})})}export{pe as SchoolLevelSelectorPopupView};
//# sourceMappingURL=c2PKhr0i.chunk.js.map
