(this["webpackJsonpecho-connect"]=this["webpackJsonpecho-connect"]||[]).push([[0],{21:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"g",(function(){return a})),n.d(t,"u",(function(){return i})),n.d(t,"c",(function(){return c})),n.d(t,"k",(function(){return s})),n.d(t,"e",(function(){return o})),n.d(t,"p",(function(){return l})),n.d(t,"b",(function(){return d})),n.d(t,"s",(function(){return u})),n.d(t,"q",(function(){return j})),n.d(t,"r",(function(){return b})),n.d(t,"t",(function(){return h})),n.d(t,"d",(function(){return O})),n.d(t,"f",(function(){return x})),n.d(t,"i",(function(){return m})),n.d(t,"h",(function(){return p})),n.d(t,"j",(function(){return v})),n.d(t,"l",(function(){return g})),n.d(t,"n",(function(){return f})),n.d(t,"m",(function(){return y})),n.d(t,"o",(function(){return C}));var r="d7aa5e26-9893-44b1-b740-6b0026c4bc8e",a="7385e85a-1fac-11ec-9ca8-7f152a1ef718",i="a7b5caf6-1906-11ed-8a7d-6ba44a079035",c="af8b6092-1906-11ed-9657-0f0a11c66d5a",s="d53d6d2b-8d4f-4dce-bc65-5a5be31b8e2a",o="40fe0dc8-3062-4677-bf41-882c9a62e995",l="2b154ce8-4eb4-4e0c-8d54-0771c74fc7c3",d="c43b6754-948b-4b13-9769-9f07cc2bf2f5",u="user_id",j="user_email",b="user_fullname",h="user_roles",O=50,x="f9643c34-ae41-4515-89d8-532ea166c9a9",m="8542c25f-e67d-432c-8e1f-59d6fe04b7a2",p="217630cb-815b-456c-87e8-be3858015f41",v="8c3fe862-46e1-11ec-82a5-13a60ed940a6",g="America/Chicago",f="America/Denver",y="America/New_York",C="America/Los_Angeles"},30:function(e,t,n){"use strict";n.d(t,"g",(function(){return h})),n.d(t,"j",(function(){return O})),n.d(t,"i",(function(){return x})),n.d(t,"k",(function(){return m})),n.d(t,"f",(function(){return p})),n.d(t,"a",(function(){return v})),n.d(t,"c",(function(){return g})),n.d(t,"e",(function(){return f})),n.d(t,"b",(function(){return y})),n.d(t,"d",(function(){return C})),n.d(t,"h",(function(){return w}));var r=n(21),a=window.location.hostname,i=window.location.port,c=3e3,s=3001,o=3002,l=3003,d=3004,u=3005,j=3006,b=3010,h="".concat("production"),O=function(){if("development"===h)return"localhost:3000"==="".concat(a.toLowerCase(),":").concat(i)?"http://localhost:4002":"localhost:3001"==="".concat(a.toLowerCase(),":").concat(i)?"http://localhost:4003":"localhost:3002"==="".concat(a.toLowerCase(),":").concat(i)?"http://localhost:4004":"localhost:3003"==="".concat(a.toLowerCase(),":").concat(i)?"http://localhost:4005":"localhost:3004"==="".concat(a.toLowerCase(),":").concat(i)?"http://localhost:4006":"localhost:3005"==="".concat(a.toLowerCase(),":").concat(i)?"http://localhost:4007":"localhost:3006"==="".concat(a.toLowerCase(),":").concat(i)?"http://localhost:4008":"https://localhost:4002";if("staging"===h||""===h)return"echo-n4e21x-colorado.cfwebtools.com"===a.toLowerCase()?"https://echo-api-n4e21x-colorado.cfwebtools.com":"echo-88sjg2-oregon.cfwebtools.com"===a.toLowerCase()?"https://echo-api-88sjg2-oregon.cfwebtools.com":"echo-qgbsdp-virginia.cfwebtools.com"===a.toLowerCase()?"https://echo-api-qgbsdp-virginia.cfwebtools.com":"echo-x6waou-dartmouth.cfwebtools.com"===a.toLowerCase()?"https://echo-api-x6waou-dartmouth.cfwebtools.com":"echo-9sj23a-rutgers.cfwebtools.com"===a.toLowerCase()?"https://echo-api-9sj23a-rutgers.cfwebtools.com":"echo-demo.cfwebtools.com"===a.toLowerCase()?"https://echo-api-demo.cfwebtools.com":"echo-trial.cfwebtools.com"===a.toLowerCase()?"https://echo-api-trial.cfwebtools.com":"https://echo-api.cfwebtools.com";if("production"===h)return"connect.echocolorado.org"===a.toLowerCase()?"https://api.echocolorado.org":"connect.oregonechonetwork.org"===a.toLowerCase()?"https://api.oregonechonetwork.org":"connect.virginiaprojectecho.org"===a.toLowerCase()?"https://api.virginiaprojectecho.org":"connect.echodartmouth-hitchcock.org"===a.toLowerCase()?"https://api.echodartmouth-hitchcock.org":"demo.echocolorado.org"===a.toLowerCase()?"https://demo-api.echocolorado.org":"https://api.echocolorado.org";return""}(),x=O+"/graphql",m="".concat("https://echoconnect-app.s3.us-east-2.amazonaws.com"),p="".concat("2cd014ef664d58164619e126069e43a8eb1552efea6697ecdef09f1bb3b66319"),v="".concat(""),g="".concat(""),f="".concat(""),y="".concat(""),C="6LfSfzAqAAAAAPpTXZyoLvBjQguECxMasJbCe_FF";function w(){return"localhost"===a?function(){switch(Number(window.location.port)){case c:return r.a;case s:return r.g;case o:return r.u;case l:return r.c;case d:return r.k;case u:return r.e;case j:return r.p;case b:return r.b;default:return""}}():"staging"===h||"development"===h?"echo-n4e21x-colorado.cfwebtools.com"===a.toLowerCase()?r.a:"echo-88sjg2-oregon.cfwebtools.com"===a.toLowerCase()?r.g:"echo-qgbsdp-virginia.cfwebtools.com"===a.toLowerCase()?r.u:"echo-x6waou-dartmouth.cfwebtools.com"===a.toLowerCase()?r.c:"echo-9sj23a-rutgers.cfwebtools.com"===a.toLowerCase()?r.k:"echo-demo.cfwebtools.com"===a.toLowerCase()?r.e:"echo-trial.cfwebtools.com"===a.toLowerCase()?r.p:r.b:"production"===h?"connect.echocolorado.org"===a.toLowerCase()?r.a:"connect.oregonechonetwork.org"===a.toLowerCase()?r.g:"connect.virginiaprojectecho.org"===a.toLowerCase()?r.u:"connect.echodartmouth-hitchcock.org"===a.toLowerCase()?r.c:"demo.echocolorado.org"===a.toLowerCase()?r.e:r.b:""}},474:function(e){e.exports=JSON.parse('[{"name":"Outside the US","abbreviation":"XX"},{"name":"Alabama","abbreviation":"AL"},{"name":"Alaska","abbreviation":"AK"},{"name":"Arizona","abbreviation":"AZ"},{"name":"Arkansas","abbreviation":"AR"},{"name":"California","abbreviation":"CA"},{"name":"Colorado","abbreviation":"CO"},{"name":"Connecticut","abbreviation":"CT"},{"name":"Delaware","abbreviation":"DE"},{"name":"District of Colombia","abbreviation":"DC"},{"name":"Florida","abbreviation":"FL"},{"name":"Georgia","abbreviation":"GA"},{"name":"Hawaii","abbreviation":"HI"},{"name":"Idaho","abbreviation":"ID"},{"name":"Illinois","abbreviation":"IL"},{"name":"Indiana","abbreviation":"IN"},{"name":"Iowa","abbreviation":"IA"},{"name":"Kansas","abbreviation":"KS"},{"name":"Kentucky","abbreviation":"KY"},{"name":"Louisiana","abbreviation":"LA"},{"name":"Maine","abbreviation":"ME"},{"name":"Maryland","abbreviation":"MD"},{"name":"Massachusetts","abbreviation":"MA"},{"name":"Michigan","abbreviation":"MI"},{"name":"Minnesota","abbreviation":"MN"},{"name":"Mississippi","abbreviation":"MS"},{"name":"Missouri","abbreviation":"MO"},{"name":"Montana","abbreviation":"MT"},{"name":"Nebraska","abbreviation":"NE"},{"name":"Nevada","abbreviation":"NV"},{"name":"New Hampshire","abbreviation":"NH"},{"name":"New Jersey","abbreviation":"NJ"},{"name":"New Mexico","abbreviation":"NM"},{"name":"New York","abbreviation":"NY"},{"name":"North Carolina","abbreviation":"NC"},{"name":"North Dakota","abbreviation":"ND"},{"name":"Ohio","abbreviation":"OH"},{"name":"Oklahoma","abbreviation":"OK"},{"name":"Oregon","abbreviation":"OR"},{"name":"Pennsylvania","abbreviation":"PA"},{"name":"Rhode Island","abbreviation":"RI"},{"name":"South Carolina","abbreviation":"SC"},{"name":"South Dakota","abbreviation":"SD"},{"name":"Tennessee","abbreviation":"TN"},{"name":"Texas","abbreviation":"TX"},{"name":"Utah","abbreviation":"UT"},{"name":"Vermont","abbreviation":"VT"},{"name":"Virginia","abbreviation":"VA"},{"name":"Washington","abbreviation":"WA"},{"name":"West Virginia","abbreviation":"WV"},{"name":"Wisconsin","abbreviation":"WI"},{"name":"Wyoming","abbreviation":"WY"}]')},544:function(e,t,n){},545:function(e,t,n){},624:function(e,t){},626:function(e,t){},636:function(e,t){},638:function(e,t){},665:function(e,t){},666:function(e,t){},671:function(e,t){},673:function(e,t){},680:function(e,t){},699:function(e,t){},721:function(e){e.exports=JSON.parse('[{"value":"America/Los_Angeles","text":"(UTC-08:00) Pacific Time (US &amp; Canada)"},{"value":"America/Denver","text":"(UTC-07:00) Mountain Time (US &amp; Canada)"},{"value":"America/Chicago","text":"(UTC-06:00) Central Time (US &amp; Canada)"},{"value":"America/New_York","text":"(UTC-05:00) Eastern Time (US &amp; Canada)"}]')},833:function(e,t,n){"use strict";n.r(t);var r=n(6),a=n(2),i=n.n(a),c=n(99),s=n.n(c),o=n(31),l=n(496),d=n(224),u=n(949),j=n(951),b=n(944),h=n(494),O=n(493),x=n(30),m=(n(544),n(545),n(497)),p=Object(m.a)({palette:{primary:{main:"#be051b"},secondary:{main:"#FFF"},text:{primary:"#000",secondary:"#000",disabled:"#666666"},warning:{main:"#000"}},components:{MuiFormLabel:{styleOverrides:{asterisk:{color:"#be051b"}}}}}),v=n(1008),g=n(131),f=n(973),y=n(974),C=n(975),w=n(227),S=n(976),I=n(977),k=n(253),A=n.n(k),N=n(966),D=n(0),T=function(e){var t=e.title;return Object(D.jsx)(w.a,{sx:{mt:4,mb:4,textAlign:"center"},variant:"h4",color:"primary",children:t})},E=function(e){var t=e.title,n=e.children;return Object(D.jsxs)(N.a,{container:!0,sx:{mt:2},children:[Object(D.jsx)(N.a,{item:!0,xs:2}),Object(D.jsxs)(N.a,{item:!0,xs:8,children:[Object(D.jsx)(T,{title:t}),n]}),Object(D.jsx)(N.a,{item:!0,xs:2})]})},P=[{name:"chrome",minVersion:88},{name:"firefox",minVersion:68},{name:"safari",minVersion:13},{name:"edge",minVersion:88}],R=function(){var e=P.map((function(e){return"<li>".concat(e.name," (version ").concat(e.minVersion," or higher)</li>")})).join(" "),t='<div style="margin-left: 20px;"><ul>'.concat(e,"</ul></div>");return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(f.a,{position:"static",sx:{mb:2},children:Object(D.jsxs)(y.a,{children:[Object(D.jsx)(C.a,{edge:"start",color:"inherit","aria-label":"menu",children:Object(D.jsx)(A.a,{})}),Object(D.jsx)(w.a,{variant:"h6",sx:{flexGrow:1,textAlign:"left"},children:"ECHO Connect"})]})}),Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsx)(E,{title:"Unsupported Browser",children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsxs)(w.a,{variant:"subtitle1",children:["We're sorry, but your browser is not supported. Check your browser version by visiting ",Object(D.jsx)("a",{href:"https://www.whatsmybrowser.org/",children:"What's my browser?"}),Object(D.jsx)("br",{}),Object(D.jsx)("br",{}),"Please upgrade to one of the following compatible browsers to be use this website:"]}),Object(D.jsx)(w.a,{variant:"subtitle1",children:Object(D.jsx)("div",{dangerouslySetInnerHTML:{__html:t}})}),Object(D.jsx)(w.a,{variant:"subtitle1",children:"If you need further assistance, please contact the UIS Service Desk at 303-860-HELP(4357) or via email at help@cu.edu."})]})})})]})},L=n(4),F=n(59),U=n(492),M=n.n(U),q=n(491),z=n.n(q),H=n(277),W=n.n(H),Y=n(68),B=n(503),Q=n(989),$=n(952),V=n(990),G=n(967),J=n(986),Z=n(968),K=n(980),_=n(506),X=n(981),ee=n(985),te=n(983),ne=n(984),re=n(87),ae=n.n(re),ie=n(923),ce=n(927),se=n(978),oe=n(979),le=function(e){var t=e.isOpen,n=e.title,r=Object(a.useState)(t),i=Object(L.a)(r,2),c=i[0],s=i[1];return Object(a.useEffect)((function(){s(t)}),[t]),Object(D.jsxs)(ie.a,{sx:{"& .MuiDialog-paper":{width:"80vw",maxHeight:435},textAlign:"center"},open:c,children:[Object(D.jsx)(ce.a,{children:n}),Object(D.jsx)(se.a,{children:Object(D.jsx)(oe.a,{color:"primary"})})]})},de=n(46),ue=n.n(de),je=n(982),be=function(e){var t=e.registrations;return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Program Name"}),Object(D.jsx)(ne.a,{align:"center",children:"Registration Date"}),Object(D.jsx)(ne.a,{align:"center",children:"Start Date"})]})}),Object(D.jsx)(ee.a,{children:t&&t.map((function(e){var t,n,r,a,i;return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:null===(r=e.cohort)||void 0===r||null===(a=r.program)||void 0===a?void 0:a.name}),Object(D.jsx)(ne.a,{align:"center",children:ue()(e.createdAt).format("MM/DD/YYYY")}),Object(D.jsx)(ne.a,{align:"center",children:null!==(i=e.cohort)&&void 0!==i&&i.startDate?ue()(e.cohort.startDate).format("MM/DD/YYYY"):""})]},null===(t=e.cohort)||void 0===t||null===(n=t.program)||void 0===n?void 0:n.name)}))})]})})})},he=n(988),Oe=n(987),xe=n(930),me=n(953),pe=n(452),ve=n.n(pe),ge=n(153),fe=n.n(ge),ye=n(154),Ce=n.n(ye),we=n(48),Se=n.n(we),Ie=n(21);function ke(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!e)return"";var i=Ne(Object(x.h)()),c=De(i),s=t?Te(ue()(e),i,r,a):function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e.utc(),i=e.utc();if(n&&r)return i.format("MM/DD/YYYY");if(n)return i.format("MMMM D, YYYY");if(!n&&r)return a.format("MM/DD/YYYY");return a.format("MMMM D, YYYY")}(ue()(e),i,r,a);return n?"".concat(s," ").concat(c):s}function Ae(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)return"";var r=Ne(Object(x.h)()),a=De(r),i=t?Te(ue()(e),r,!1):ue()(e).utc().format("h:mm A");return n?"".concat(i," ").concat(a):i}function Ne(e){return e===Ie.a||e===Ie.b?Ie.n:e===Ie.g?Ie.o:e===Ie.c||e===Ie.u?Ie.m:e===Ie.e?Ie.l:""}function De(e){return e===Ie.n?"MT":e===Ie.o?"PT":e===Ie.m?"ET":e===Ie.l?"CT":""}function Te(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e.utc(),i=e.utc();return n&&r?i.format("MM/DD/YYYY h:mm A"):n?i.format("MMMM D, YYYY h:mm A"):!n&&r?a.format("MM/DD/YYYY h:mm A"):e.utc().format("MMMM D, YYYY h:mm A")}ue.a.extend(fe.a),ue.a.extend(Ce.a);var Ee,Pe,Re,Le,Fe,Ue=function(){var e=Ne(Object(x.h)()),t=Se.a.tz(Se.a.tz(e).toISOString().slice(0,10),e),n="".concat(t.format("YYYY-MM-DD"),"T00:00:00.000Z");return new Date(n)},Me=n(15),qe=n(950),ze=Object(qe.a)(Ee||(Ee=Object(Me.a)(["\n  query GetEmailHistoryForUser($userId: ID!) {\n    getEmailHistoryForUser(userId: $userId) {\n      fromAddress\n      subject\n      text\n      sentAt\n    }\n  }\n"]))),He=(n(147),n(76)),We=function(e){var t=e.htmlText;return Object(D.jsx)(He,{value:t,readonly:!0,theme:"bubble"})},Ye=function(e){var t=e.subject,n=e.text,r=e.dateSent,i=e.from,c=Object(a.useState)(!1),s=Object(L.a)(c,2),o=s[0],l=s[1],d=function(){l(!1)};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"View Email",children:Object(D.jsx)(ve.a,{onClick:function(){l(!0)},sx:{cursor:"pointer",color:"primary.main"}})}),Object(D.jsxs)(ie.a,{open:o,onClose:d,children:[Object(D.jsx)(ce.a,{children:"Email Preview"}),Object(D.jsx)(se.a,{children:Object(D.jsx)(Oe.a,{children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)("b",{children:"Sent: "})," ",r,Object(D.jsx)("b",{children:"From: "})," ",i,Object(D.jsx)("b",{children:"Subject: "})," ",t,Object(D.jsx)(xe.a,{}),Object(D.jsx)(We,{htmlText:n})]})})}),Object(D.jsx)(he.a,{children:Object(D.jsx)(G.a,{variant:"contained",onClick:d,children:"Close"})})]})]})},Be=function(e){var t=e.userId,n=Object(B.b)(ze,{variables:{userId:t}}),r=n.loading,a=n.data,i=null===a||void 0===a?void 0:a.getEmailHistoryForUser;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:r,title:"Loading..."}),i&&i.length>0&&Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Date Sent"}),Object(D.jsx)(ne.a,{align:"left",children:"From Address"}),Object(D.jsx)(ne.a,{align:"left",children:"Subject"}),Object(D.jsx)(ne.a,{align:"right"})]})}),Object(D.jsx)(ee.a,{children:i.map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:ke(e.sentAt,!0)}),Object(D.jsx)(ne.a,{align:"left",children:e.fromAddress}),Object(D.jsx)(ne.a,{align:"left",children:e.subject}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(Ye,{subject:e.subject,text:e.text,dateSent:ke(e.sentAt,!0),from:e.fromAddress})})]},e.sentAt)}))})]})}),(!i||0===i.length)&&Object(D.jsx)(me.a,{severity:"info",children:"This user hasn't been sent any emails yet."})]})},Qe=Object(qe.a)(Pe||(Pe=Object(Me.a)(["\n  query GetFullUserById($id: String!) {\n    getFullUserById(id: $id) {\n      id\n      fullName\n      firstName\n      lastName\n      email\n      otherCredential\n      professionId\n      secondLevelProfessionId\n      thirdLevelProfessionId\n      otherProfession\n      otherEthnicity\n      organization\n      organizationAddress1\n      organizationAddress2\n      city\n      state\n      countyId\n      zip\n      provideDirectCare\n      provideMedicaid\n      primaryCare\n      createdAt\n      updatedAt\n      credentials\n      receiveEmails\n      userCredentialIds\n      userEthnicityIds\n      partnerId\n      userCredentialsForDisplay\n      userProfessionsForDisplay\n      userEthnicitiesForDisplay\n      cohortRegistrationsAsUsers {\n        createdAt\n        cohort {\n          startDate\n          program {\n            name\n          }\n        }\n      }\n      emails {\n        id\n        createdAt\n      }\n    }\n  }\n"]))),$e=function(){var e=Object(a.useState)(!1),t=Object(L.a)(e,2),n=t[0],r=t[1];return Object(a.useEffect)((function(){var e=setTimeout((function(){r(!0),window.location.href="/"}),9e3);return function(){return clearTimeout(e)}}),[]),Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:n,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:[Object(D.jsx)(T,{title:"This page isn't available to you"}),Object(D.jsxs)(N.a,{container:!0,sx:{mt:5},children:[Object(D.jsx)(N.a,{item:!0,xs:2}),Object(D.jsx)(N.a,{item:!0,xs:8,children:Object(D.jsx)(I.a,{spacing:5,children:Object(D.jsx)(me.a,{severity:"info",children:"You are being redirected back to Home"})})}),Object(D.jsx)(N.a,{item:!0,xs:2})]})]})]})},Ve=n(8),Ge=n(16),Je=n(189),Ze=n(931),Ke=n(78),_e=n.n(Ke),Xe=n(88),et=Object(qe.a)(Re||(Re=Object(Me.a)(["\n  mutation LoginUser($credentials: ValidateLoginInput!) {\n    loginUser(credentials: $credentials) {\n      isValid\n      needsPasswordReset\n      isRegistrationComplete\n      errorMessage\n      userProfile {\n        id\n        firstName\n        lastName\n        email\n        roles\n      }\n    }\n  }\n"]))),tt=Object(qe.a)(Le||(Le=Object(Me.a)(["\n  mutation LogoutUser {\n    logout {\n      success\n    }\n  }\n"]))),nt=Object(qe.a)(Fe||(Fe=Object(Me.a)(["\n  mutation ExtendSession {\n    extendToken {\n      isValid\n      errorMessage\n    }\n  }\n"]))),rt=Object(a.createContext)(void 0),at=function(e){var t=e.children,n=function(){var e=Object(Je.a)(),t=Object(a.useState)((function(){return U()})),n=Object(L.a)(t,2),r=n[0],i=n[1],c=Object(a.useState)(),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(!0),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(Ze.a)(nt),O=Object(L.a)(h,2),m=O[0],p=O[1],v=p.error,f=p.loading,y=Object(Ze.a)(et),C=Object(L.a)(y,2),w=C[0],S=C[1],I=S.error,k=S.loading,A=Object(Ze.a)(tt),N=Object(L.a)(A,2),D=N[0],T=N[1],E=T.error,P=T.loading;Object(a.useEffect)((function(){l(I||E||v)}),[I,E,v]),Object(a.useEffect)((function(){b(k||P||f)}),[k,P,f]),Object(a.useEffect)((function(){var e=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(t=U()).isAuthenticated?i(t):i(null),b(!1);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var R=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){var r,a,c,s,o,l,d,u,j,b,h,O,m,p,v,f;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,w({variables:{credentials:{email:t,password:Object(Xe.a)(n)}}});case 3:if(e.t1=r=e.sent.data,e.t0=null===e.t1,e.t0){e.next=7;break}e.t0=void 0===r;case 7:if(!e.t0){e.next=11;break}e.t2=void 0,e.next=12;break;case 11:e.t2=r.loginUser;case 12:if(a=e.t2){e.next=15;break}throw new Error("Login failed");case 15:if(a.isValid){e.next=17;break}return e.abrupt("return",{isAdmin:!1,isSuccessful:a.isValid,needsPasswordReset:a.needsPasswordReset,isRegistrationComplete:!(!a||!a.isRegistrationComplete),errorMessage:a.errorMessage});case 17:if(c=a.userProfile){e.next=20;break}throw new Error("User profile was null");case 20:console.log(c),s=c.roles,o=c.id,l=c.email,d=c.firstName,u=c.lastName,j=s.indexOf("Administrator")>-1,b=s.indexOf("Albatross")>-1,h=!!(s&&s.indexOf("ECHOStaff")>-1),O=!!(s&&s.indexOf("development")>-1),m=!!(s&&s.indexOf("implementation")>-1),p=!!(s&&s.indexOf("evaluation")>-1),v=!!(s&&s.indexOf("Partner")>-1),f=!!(s&&s.indexOf("Registrant")>-1);try{g.clarity.hasStarted()&&(g.clarity.identify("USER_ID",{userProperty:"".concat(l)}),g.clarity.setTag("user_role_admin","".concat(j)),g.clarity.setTag("user_role_echoStaff","".concat(h)),g.clarity.setTag("user_role_partner","".concat(v)),g.clarity.setTag("user_full_name","".concat(d," ").concat(u)),g.clarity.setTag("environment","".concat(x.g)))}catch(y){console.log("There was an error setting Clarity variables",y)}return i({id:o,email:l,fullName:"".concat(d," ").concat(u),userRoles:s,isRegistrationComplete:a.isRegistrationComplete,isAuthenticated:!0,isAdmin:j,isAlbatross:b,isRegistrant:f,isEchoStaff:h,isDevelopmentStaff:O,isImplementationStaff:m,isEvaluationStaff:p,isPartner:v}),_e.a.set(Ie.s,o||"",{secure:!0,sameSite:"strict"}),_e.a.set(Ie.q,l||"",{secure:!0,sameSite:"strict"}),_e.a.set(Ie.r,"".concat(d," ").concat(u),{secure:!0,sameSite:"strict"}),_e.a.set(Ie.t,s||"",{secure:!0,sameSite:"strict"}),e.abrupt("return",{isAdmin:j||b||h||O||m||p||v,isSuccessful:!0,isRegistrationComplete:a.isRegistrationComplete,needsPasswordReset:!1,errorMessage:null});case 39:return e.prev=39,e.t3=e.catch(0),console.log("signIn Error",e.t3),e.abrupt("return",{isAdmin:!1,isSuccessful:!1,isRegistrationComplete:!1,needsPasswordReset:!1,errorMessage:e.t3});case 43:case"end":return e.stop()}}),e,null,[[0,39]])})));return function(t,n){return e.apply(this,arguments)}}(),F=function(){var t=Object(Ge.a)(Object(Ve.a)().mark((function t(){var n,r,a;return Object(Ve.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,D();case 3:r=t.sent,null!==(a=r.data)&&void 0!==a&&null!==(n=a.logout)&&void 0!==n&&n.success?(e.clearStore(),_e.a.remove(Ie.s),_e.a.remove(Ie.q),_e.a.remove(Ie.r),_e.a.remove(Ie.t),i(U())):console.error("Logout failed:",null===a||void 0===a?void 0:a.logout),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Logout error",t.t0);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(){return t.apply(this,arguments)}}();function U(){if(!_e.a.get(Ie.s))return{email:null,fullName:null,id:null,isAdmin:!1,isAlbatross:!1,isAuthenticated:!1,isRegistrant:!1,isEchoStaff:!1,isDevelopmentStaff:!1,isImplementationStaff:!1,isEvaluationStaff:!1,isPartner:!1,userRoles:null,isRegistrationComplete:!1};var e=_e.a.get(Ie.t)||"",t=e.indexOf("Administrator")>-1,n=e.indexOf("Albatross")>-1,r=e.indexOf("ECHOStaff")>-1,a=e.indexOf("development")>-1,i=e.indexOf("implementation")>-1,c=e.indexOf("evaluation")>-1,s=e.indexOf("Partner")>-1,o=e.indexOf("Registrant")>-1;return{id:_e.a.get(Ie.s)||null,email:_e.a.get(Ie.q)||null,fullName:_e.a.get(Ie.r)||null,userRoles:e,isRegistrationComplete:!0,isAuthenticated:!0,isAdmin:t,isAlbatross:n,isRegistrant:o,isEchoStaff:r,isDevelopmentStaff:a,isImplementationStaff:i,isEvaluationStaff:c,isPartner:s}}var M=function(){var e=U();return e.isAuthenticated?i(e):i(null),console.log("Admin session continue successfully"),!0},q=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,n,r,a;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m();case 3:if(n=e.sent,!((r=n.data)&&r.extendToken&&r.extendToken.isValid)){e.next=12;break}if(U(),!(r&&r.extendToken&&r.extendToken.isValid)){e.next=12;break}return(a=U()).isAuthenticated?i(a):i(null),console.log("Admin session extended successfully"),e.abrupt("return",!0);case 12:return console.error("Failed to extend session:",null===r||void 0===r||null===(t=r.extendToken)||void 0===t?void 0:t.errorMessage),e.abrupt("return",!1);case 16:return e.prev=16,e.t0=e.catch(0),console.error("Error extending admin session:",e.t0),e.abrupt("return",!1);case 20:case"end":return e.stop()}}),e,null,[[0,16]])})));return function(){return e.apply(this,arguments)}}();return{user:r,signIn:R,signOut:F,signInErrors:o,isLoading:j,extendAdminSession:q,adminSessionContinue:M}}();return Object(D.jsx)(rt.Provider,{value:n,children:t})},it=function(){return Object(a.useContext)(rt)};var ct=["children","value","index"];function st(e){var t=e.children,n=e.value,a=e.index,i=Object(Y.a)(e,ct);return Object(D.jsx)("div",Object(r.a)(Object(r.a)({role:"tabpanel",hidden:n!==a,id:"simple-tabpanel-".concat(a),"aria-labelledby":"simple-tab-".concat(a)},i),{},{children:n===a&&Object(D.jsx)(Q.a,{sx:{p:3,textAlign:"left"},children:Object(D.jsx)(w.a,{children:t})})}))}var ot,lt,dt,ut,jt,bt,ht,Ot,xt,mt,pt,vt=function(){var e,t,n=Object(F.j)().id,a=i.a.useState(0),c=Object(L.a)(a,2),s=c[0],l=c[1],d=Object(B.b)(Qe,{variables:{id:n}}),u=d.loading,j=d.data,b=null!==(e=null===j||void 0===j?void 0:j.getFullUserById)&&void 0!==e?e:null;function h(e){return{id:"simple-tab-".concat(e),"aria-controls":"simple-tabpanel-".concat(e)}}var O=it(),x=function(){var e,t,n,r,a,i;return(null===(e=O.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=O.user)||void 0===t?void 0:t.isAdmin)||(null===(n=O.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=O.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=O.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=O.user)||void 0===i?void 0:i.isEvaluationStaff)};return x()?u||!b?Object(D.jsx)(le,{title:"Loading...",isOpen:u}):x()?Object(D.jsx)(D.Fragment,{children:x()&&Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:12},children:[Object(D.jsx)(T,{title:null!==(t=null===b||void 0===b?void 0:b.fullName)&&void 0!==t?t:""}),Object(D.jsxs)(Q.a,{sx:{width:"100%",textAlign:"left"},children:[Object(D.jsx)(Q.a,{sx:{borderBottom:1,borderColor:"divider"},children:Object(D.jsxs)($.a,{value:s,onChange:function(e,t){l(t)},"aria-label":"basic tabs example",children:[Object(D.jsx)(V.a,Object(r.a)({label:"Account"},h(0))),Object(D.jsx)(V.a,Object(r.a)({label:"Registration History"},h(1))),Object(D.jsx)(V.a,Object(r.a)({label:"Email History"},h(2)))]})}),Object(D.jsxs)(st,{value:s,index:0,children:[Object(D.jsx)(G.a,{sx:{mb:2},size:"small",variant:"outlined",component:o.b,to:"/admin/account/edit/".concat(n),children:"Edit Account"}),Object(D.jsxs)(N.a,{container:!0,spacing:2,children:[Object(D.jsxs)(N.a,{item:!0,xs:6,children:[Object(D.jsx)(w.a,{variant:"h6",children:"About"}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsx)(X.a,{children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Name"}),Object(D.jsx)(ne.a,{children:b.fullName})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Email"}),Object(D.jsxs)(ne.a,{children:[b.email,Object(D.jsx)(J.a,{title:"Email ".concat(b.firstName),children:Object(D.jsx)(Z.a,{href:"mailto:".concat(b.email),children:Object(D.jsx)(ae.a,{sx:{fontSize:16,verticalAlign:"middle",ml:1}})})})]})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Credentials"}),Object(D.jsx)(ne.a,{children:b.userCredentialsForDisplay})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Profession"}),Object(D.jsx)(ne.a,{children:b.userProfessionsForDisplay})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Race/Ethnicity"}),Object(D.jsx)(ne.a,{children:b.userEthnicitiesForDisplay})]})]})})})]}),Object(D.jsxs)(N.a,{item:!0,xs:6,children:[Object(D.jsx)(w.a,{variant:"h6",children:"Organization"}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsx)(X.a,{children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Organization/Employer"}),Object(D.jsx)(ne.a,{children:b.organization})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Organization Address"}),Object(D.jsxs)(ne.a,{children:[b.organizationAddress1,b.organizationAddress2&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)("br",{}),b.organizationAddress2]}),Object(D.jsx)("br",{}),b.city,", ",b.state," ",b.zip]})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Provide Direct Care"}),Object(D.jsx)(ne.a,{children:b.provideDirectCare?"Yes":"No"})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Provide Medicaid"}),Object(D.jsx)(ne.a,{children:b.provideMedicaid?"Yes":"No"})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Primary Care Setting"}),Object(D.jsx)(ne.a,{children:b.primaryCare?"Yes":"No"})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{sx:{fontWeight:"bold"},children:"Receive Emails"}),Object(D.jsx)(ne.a,{children:b.receiveEmails?"Yes":"No"})]})]})})})]})]})]}),Object(D.jsx)(st,{value:s,index:1,children:Object(D.jsx)(be,{registrations:b.cohortRegistrationsAsUsers})}),Object(D.jsx)(st,{value:s,index:2,children:Object(D.jsx)(Be,{userId:n})})]})]})}):Object(D.jsx)($e,{}):Object(D.jsx)($e,{})},gt=n(935),ft=n(998),yt=n(999),Ct=n(993),wt=n(962),St=n(996),It=n(991),kt=n(956),At="GetAllPartners",Nt=Object(qe.a)(ot||(ot=Object(Me.a)(["\n  query GetAllPartners {\n    getPartners {\n      id\n      name\n    }\n  }\n"]))),Dt=Object(qe.a)(lt||(lt=Object(Me.a)(["\n  mutation AddStaffUser($user: AddOrUpdateStaffUserInput!) {\n    addStaffUser(user: $user) {\n      id\n      firstName\n      lastName\n      email\n    }\n  }\n"]))),Tt=n(5),Et=function(){return Object(D.jsx)(w.a,{variant:"caption",sx:{textAlign:"center"},children:"Password must be at least 8 characters long, contain one uppercase, one lowercase, one number, and one special character."})},Pt=n(969),Rt=["textAlign","anchor"],Lt=function(e){e.textAlign;var t=e.anchor,n=void 0===t?"right":t,r=Object(Y.a)(e,Rt),i=r.trigger,c=r.children,s=r.width,o=r.title,l=r.showSave,d=r.showCancel,u=r.cancelText,j=r.isOpen,b=r.onSaveClick,h=r.onCancelClick,O=r.openDrawer,x=Object(a.useState)(j),m=Object(L.a)(x,2),p=m[0],v=m[1];Object(a.useEffect)((function(){v(j)}),[j]);var g=function(){h&&h(),v(!1)};return Object(D.jsxs)(D.Fragment,{children:[O?Object(D.jsx)("span",{onClick:O,children:i}):Object(D.jsx)("span",{onClick:function(){return v(!0)},children:i}),Object(D.jsx)(Pt.a,{anchor:n,open:p,onClose:function(){return g()},children:Object(D.jsxs)(Q.a,{sx:{width:"".concat(s,"px"),textAlign:"center",mt:2},children:[Object(D.jsx)(T,{title:o}),Object(D.jsxs)(I.a,{spacing:2,sx:{ml:2,mr:2},children:[c,l&&b&&Object(D.jsx)(G.a,{color:"primary",variant:"contained",onClick:function(){return b()},children:"Save"}),d&&Object(D.jsx)(G.a,{color:"primary",variant:"outlined",onClick:g,children:null!==u&&void 0!==u?u:"Cancel"})]})]})})]})},Ft=function(e){var t,n=e.drawerTrigger,i=e.user,c=e.saveUserClick,s=e.onCancelClick,o=e.partners,l=e.errors,d=e.isOpen,u=l.errorText,j=l.firstNameError,b=l.lastNameError,h=l.emailError,O=l.passwordError,x=void 0!==O&&O,m=Object(a.useState)(i),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)(""),y=Object(L.a)(f,2),C=y[0],S=y[1],k=Object(a.useState)(d),A=Object(L.a)(k,2),N=A[0],T=A[1];Object(a.useEffect)((function(){T(d)}),[d]),Object(a.useEffect)((function(){var e;g(i),0===(null===i||void 0===i||null===(e=i.password)||void 0===e?void 0:e.length)&&S("")}),[i]);var E=function(e){var t=e.target.name,n=e.target.value;g(Object(r.a)(Object(r.a)({},v),{},Object(Tt.a)({},t,n)))};return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(Lt,{width:500,title:"Add Staff Account",showSave:!0,showCancel:!0,onSaveClick:function(){c(v,C)},isOpen:N,trigger:n,onCancelClick:s,children:[Object(D.jsx)(w.a,{variant:"caption",children:"By default, the new staff account will get the ECHO staff security role"}),Object(D.jsxs)(I.a,{spacing:2,sx:{ml:2,mr:2},children:[Object(D.jsx)(It.a,{label:"First Name",value:v.firstName,color:"warning",onChange:E,name:"firstName",error:j}),Object(D.jsx)(It.a,{label:"Last Name",value:v.lastName,color:"warning",name:"lastName",onChange:E,error:b}),Object(D.jsx)(It.a,{label:"Email",value:v.email,color:"warning",name:"email",onChange:E,error:h}),!i.id&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(It.a,{label:"Password",type:"password",value:v.password,color:"warning",onChange:E,name:"password",error:x}),Object(D.jsx)(Et,{}),Object(D.jsx)(It.a,{label:"Confirm Password",type:"password",value:C,color:"warning",onChange:function(e){var t=e.target.value;S(t)}})]}),Object(D.jsxs)(Ct.a,{sx:{width:"100%"},children:[Object(D.jsx)(wt.a,{color:"warning",id:"partner-label",children:"Implementation Partner"}),Object(D.jsxs)(kt.a,{labelId:"partner-label",id:"partner-select",value:null!==(t=v.partnerId)&&void 0!==t?t:"",label:"Partner",color:"warning",onChange:function(e){var t=e.target.value;g(Object(r.a)(Object(r.a)({},v),{},{partnerId:t.length>0?t:null}))},sx:{textAlign:"left"},children:[Object(D.jsx)(St.a,{value:"",children:"No Partner"}),o.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))]})]}),u.length>0&&Object(D.jsx)(me.a,{severity:"error",children:u})]})]})})},Ut=function(){var e,t=Object(a.useState)(""),n=Object(L.a)(t,2),r=n[0],i=n[1],c=Object(a.useState)({firstName:"",lastName:"",email:"",password:"",partnerId:null}),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(!1),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(a.useState)(!1),O=Object(L.a)(h,2),x=O[0],m=O[1],p=Object(a.useState)(!1),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)(!1),C=Object(L.a)(y,2),w=C[0],S=C[1],I=Object(a.useState)(!1),k=Object(L.a)(I,2),A=k[0],N=k[1],T=Object(B.b)(Nt),E=T.data,P=T.loading,R=null!==(e=null===E||void 0===E?void 0:E.getPartners)&&void 0!==e?e:[],F=function(e){return e.trim().length>0},U=Object(Ze.a)(Dt),M=Object(L.a)(U,2),q=M[0],z=M[1].loading,H=function(){i(""),b(!1),m(!1),f(!1),S(!1),l({firstName:"",lastName:"",email:"",password:"",partnerId:null})},W=function(e,t){var n,r=!0;i(""),b(!1),m(!1),f(!1),S(!1),F(e.firstName)||(b(!0),r=!1),F(e.lastName)||(m(!0),r=!1),F(e.email)||(f(!0),r=!1),r||i("Please enter the required fields");var a=Object(Xe.b)(null!==(n=e.password)&&void 0!==n?n:"",t);return a.isValid||(S(!0),i(a.message),r=!1),r},Y=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==W(t,n)){e.next=11;break}return e.prev=1,e.next=4,q({variables:{user:t}});case 4:H(),N(!1),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),i(e.t0.graphQLErrors[0].message);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:P,title:"Loading..."}),Object(D.jsx)(le,{isOpen:z,title:"Saving..."}),Object(D.jsx)(Ft,{drawerTrigger:Object(D.jsx)(G.a,{variant:"outlined",color:"primary",size:"small",onClick:function(){return N(!0)},children:"+ Add Staff Account"}),user:o,saveUserClick:Y,onCancelClick:function(){H(),N(!1)},partners:R,isOpen:A,errors:{errorText:r,firstNameError:j,lastNameError:x,emailError:g,passwordError:w}})]})},Mt=n(73),qt=n.n(Mt),zt=n(456),Ht=n.n(zt),Wt=function(e){var t=e.userId,n=e.name,r=e.email;return Object(D.jsxs)("div",{children:[Object(D.jsx)(Z.a,{component:o.b,to:"/admin/account/detail/".concat(t),children:n}),r&&r.length>0&&Object(D.jsx)(Z.a,{href:"mailto:".concat(r),children:Object(D.jsx)(ae.a,{color:"primary",sx:{ml:1,fontSize:"16px",verticalAlign:"middle"}})})]})},Yt=n(265),Bt=n.n(Yt),Qt=n(849),$t=n(997),Vt=n(957),Gt=Object(qe.a)(dt||(dt=Object(Me.a)(["\n  query GetRolesForUser($userId: ID!) {\n    getRolesForUser(userId: $userId) {\n      id\n      name\n    }\n  }\n"]))),Jt=Object(qe.a)(ut||(ut=Object(Me.a)(["\n  mutation UpdateUserRoles($userId: ID!, $roleIds: [ID!]!) {\n    updateUserRoles(userId: $userId, roleIds: $roleIds)\n  }\n"]))),Zt=n(97),Kt="39df8f29-88d7-4afd-be7c-c743b853574b",_t="3eeb3971-69b1-4411-87b7-1936f84a1ef3",Xt="939906d5-f90d-43a5-84ba-4f6ac084d69f",en="b20e0a41-d07e-4b71-9936-5a865a83423c",tn="123173c8-caed-4688-9cab-fd1dd8d4f865",nn="f5829ef9-83df-4f13-bda1-c966e36f1385",rn="cf068bd1-9694-4c2a-8cb2-5f224be229ad",an=function(e){var t=e.userId,n=e.firstName,i=e.lastName,c=it().user,s=Object(a.useState)(!1),o=Object(L.a)(s,2),l=o[0],d=o[1],u=Object(a.useState)(""),j=Object(L.a)(u,2),b=j[0],h=j[1],O=Object(a.useState)({isAdmin:!1,isEchoStaff:!1,isDevelopment:!1,isEvaluation:!1,isImplementation:!1,isPartner:!1,isRegistrant:!1}),x=Object(L.a)(O,2),m=x[0],p=x[1],v=Object(B.b)(Gt,{variables:{userId:t}}),g=v.loading,f=v.data;Object(a.useEffect)((function(){var e;if(!g&&f){var t=null!==(e=null===f||void 0===f?void 0:f.getRolesForUser)&&void 0!==e?e:[];t.length>0&&h(t.map((function(e){return e.id})).join(",")),p({isAdmin:t.some((function(e){return e.id===Kt})),isDevelopment:t.some((function(e){return e.id===_t})),isEchoStaff:t.some((function(e){return e.id===Xt})),isEvaluation:t.some((function(e){return e.id===en})),isImplementation:t.some((function(e){return e.id===tn})),isPartner:t.some((function(e){return e.id===nn})),isRegistrant:t.some((function(e){return e.id===rn}))})}}),[g,f]);var y=Object(Ze.a)(Jt),C=Object(L.a)(y,1)[0],w=function(e){var t=e.target,n=t.name,a=t.checked,i=t.value,c=b.split(",");if(a)c.push(i);else{var s=Zt.indexOf(i,c);s>=0&&c.splice(s,1)}h(c.join(",")),p(Object(r.a)(Object(r.a)({},m),{},Object(Tt.a)({},n,a)))},S=!(m.isEchoStaff||m.isPartner);return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(Lt,{trigger:Object(D.jsx)(J.a,{title:"Manage Permissions",children:Object(D.jsx)(Bt.a,{color:"primary",sx:{ml:1,fontSize:"16px",cursor:"pointer"},onClick:function(){return d(!0)}})}),width:500,title:"Manage Permissions - ".concat(n," ").concat(i),showSave:!0,onSaveClick:function(){if(0!==b.length){var e=b.split(",");""===e[0]&&e.splice(0,1),C({variables:{userId:t,roleIds:e}}),d(!1)}},showCancel:!0,isOpen:l,children:Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{item:!0,xs:6,children:Object(D.jsxs)(Qt.a,{children:[((null===c||void 0===c?void 0:c.isAlbatross)||(null===c||void 0===c?void 0:c.isAdmin))&&Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{value:Kt,checked:m.isAdmin,onChange:w,name:"isAdmin"}),label:"Administrator"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{value:Xt,checked:m.isEchoStaff,onChange:w,name:"isEchoStaff"}),label:"ECHOStaff"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{value:nn,checked:m.isPartner,onChange:w,name:"isPartner"}),label:"Partner"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{value:rn,checked:m.isRegistrant,onChange:w,name:"isRegistrant"}),label:"Learner"})]})}),Object(D.jsx)(N.a,{item:!0,xs:6,children:Object(D.jsxs)(Qt.a,{children:[Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{value:_t,checked:m.isDevelopment,onChange:w,name:"isDevelopment",disabled:S}),label:"Development"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{value:tn,checked:m.isImplementation,onChange:w,name:"isImplementation",disabled:S}),label:"Implementation"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{value:en,checked:m.isEvaluation,onChange:w,name:"isEvaluation",disabled:S}),label:"Evaluation"})]})})]})})})},cn=Object(qe.a)(jt||(jt=Object(Me.a)(["\n  mutation UpdateStaffUser($user: AddOrUpdateStaffUserInput!) {\n    updateStaffUser(user: $user) {\n      id\n      firstName\n      lastName\n      email\n    }\n  }\n"]))),sn=function(e){var t,n=e.user,r=Object(a.useState)(!1),i=Object(L.a)(r,2),c=i[0],s=i[1],o=Object(a.useState)(""),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)({firstName:"",lastName:"",email:"",password:"",partnerId:null}),b=Object(L.a)(j,2),h=b[0],O=b[1];Object(a.useEffect)((function(){var e,t,r,a;O({id:n.id,firstName:null!==(e=n.firstName)&&void 0!==e?e:"",lastName:null!==(t=n.lastName)&&void 0!==t?t:"",email:null!==(r=n.email)&&void 0!==r?r:"",partnerId:null!==(a=n.partnerId)&&void 0!==a?a:""})}),[n]);var x=Object(a.useState)(!1),m=Object(L.a)(x,2),p=m[0],v=m[1],g=Object(a.useState)(!1),f=Object(L.a)(g,2),y=f[0],C=f[1],w=Object(a.useState)(!1),S=Object(L.a)(w,2),I=S[0],k=S[1],A=Object(B.b)(Nt),N=A.data,T=A.loading,E=null!==(t=null===N||void 0===N?void 0:N.getPartners)&&void 0!==t?t:[],P=function(e){return e.trim().length>0},R=Object(Ze.a)(cn),F=Object(L.a)(R,2),U=F[0],M=F[1].loading,q=function(){var e,t,r,a;u(""),v(!1),C(!1),k(!1),O({id:n.id,firstName:null!==(e=n.firstName)&&void 0!==e?e:"",lastName:null!==(t=n.lastName)&&void 0!==t?t:"",email:null!==(r=n.email)&&void 0!==r?r:"",partnerId:null!==(a=n.partnerId)&&void 0!==a?a:""})},z=function(e){var t=!0;return u(""),v(!1),C(!1),k(!1),P(e.firstName)||(v(!0),t=!1),P(e.lastName)||(C(!0),t=!1),P(e.email)||(k(!0),t=!1),t||u("Please enter the required fields"),t},H=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(O(t),!0!==z(t)){e.next=12;break}return e.prev=2,e.next=5,U({variables:{user:t}});case 5:q(),s(!1),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),u(e.t0.graphQLErrors[0].message);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:T,title:"Loading..."}),Object(D.jsx)(le,{isOpen:M,title:"Saving..."}),Object(D.jsx)(Ft,{drawerTrigger:Object(D.jsx)(qt.a,{onClick:function(){return s(!0)},color:"primary",sx:{fontSize:"16px",cursor:"pointer"}}),user:h,saveUserClick:H,onCancelClick:function(){q(),s(!1)},partners:E,isOpen:c,errors:{errorText:d,firstNameError:p,lastNameError:y,emailError:I}})]})},on=n(455),ln=n.n(on),dn=Object(qe.a)(bt||(bt=Object(Me.a)(["\n  mutation UpdatePassword($userId: ID!, $password: String!) {\n    updatePassword(userId: $userId, password: $password) {\n      id\n      firstName\n      lastName\n      email\n    }\n  }\n"]))),un=function(e){var t=e.userId,n=e.firstName,c=e.lastName,s=e.labelText,o=void 0===s?"":s,l=i.a.useState(!1),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(""),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)({password:"",confirmPassword:""}),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(Ze.a)(dn),y=Object(L.a)(f,2),C=y[0],w=y[1].loading,S=function(e){var t=e.target.name,n=e.target.value;g(Object(r.a)(Object(r.a)({},v),{},Object(Tt.a)({},t,n)))},I=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(x(""),!(n=Object(Xe.b)(v.password,v.confirmPassword)).isValid){e.next=14;break}return e.prev=3,e.next=6,C({variables:{userId:t,password:v.password}});case 6:k(),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(3),x(e.t0.graphQLErrors[0].message);case 12:e.next=15;break;case 14:x(n.message);case 15:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(){return e.apply(this,arguments)}}(),k=function(){g({password:"",confirmPassword:""}),j(!1)};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"Change password for ".concat(n),children:Object(D.jsx)(ln.a,{color:"primary",sx:{cursor:"pointer"},onClick:function(){j(!0)}})})," ",o,Object(D.jsxs)(ie.a,{open:u,onClose:k,children:[Object(D.jsx)(ce.a,{children:"Change Password for ".concat(n," ").concat(c)}),Object(D.jsxs)(se.a,{sx:{width:400},children:[Object(D.jsx)(le,{isOpen:w,title:"Saving..."}),Object(D.jsx)(It.a,{autoFocus:!0,margin:"dense",name:"password",label:"Password",type:"password",fullWidth:!0,variant:"outlined",color:"warning",value:v.password,onChange:S}),Object(D.jsx)(Et,{}),Object(D.jsx)(It.a,{sx:{mt:2},margin:"dense",name:"confirmPassword",label:"Confirm Password",type:"password",fullWidth:!0,variant:"outlined",color:"warning",value:v.confirmPassword,onChange:S}),O.length>0&&Object(D.jsx)(me.a,{sx:{mt:2},severity:"error",children:O})]}),Object(D.jsxs)(he.a,{children:[Object(D.jsx)(G.a,{onClick:k,variant:"outlined",children:"Cancel"}),Object(D.jsx)(G.a,{onClick:I,variant:"contained",children:"Update"})]})]})]})},jn=function(e){var t=e.users,n=e.searchWasRun;if(n&&0===t.length)return Object(D.jsx)(me.a,{severity:"info",children:"No results found"});var r=function(e){return!(!e||!e.userRolesForDisplay)&&e.userRolesForDisplay.indexOf("ECHOStaff")>=0};return Object(D.jsx)(D.Fragment,{children:n&&Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{width:"100%"},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Name"}),Object(D.jsx)(ne.a,{children:"Email"}),Object(D.jsx)(ne.a,{align:"left",children:"Credentials"}),Object(D.jsx)(ne.a,{align:"left",children:"Organization"}),Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:t.map((function(e){var t,n,a,i;return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsxs)(ne.a,{component:"th",scope:"row",children:[Object(D.jsx)(Wt,{userId:e.id,name:"".concat(e.lastName,", ").concat(e.firstName),email:e.email}),Object(D.jsx)(w.a,{variant:"caption",children:e.userRolesForDisplay})]}),Object(D.jsx)(ne.a,{children:e.email}),Object(D.jsx)(ne.a,{align:"left",children:e.userCredentialsForDisplay}),Object(D.jsx)(ne.a,{align:"left",children:e.organization}),Object(D.jsx)(ne.a,{sx:{width:"18px"},children:Object(D.jsx)(J.a,{title:"Edit ".concat(e.firstName),children:r(e)?Object(D.jsx)(sn,{user:e}):Object(D.jsx)(o.b,{to:"/admin/account/edit/".concat(e.id),children:Object(D.jsx)(qt.a,{color:"primary",sx:{fontSize:"16px"}})})})}),Object(D.jsx)(ne.a,{sx:{width:"18px"},children:Object(D.jsx)(un,{userId:e.id,firstName:null!==(t=e.firstName)&&void 0!==t?t:"",lastName:null!==(n=e.lastName)&&void 0!==n?n:""})}),Object(D.jsx)(ne.a,{sx:{width:"18px"},children:Object(D.jsx)(J.a,{title:"Manage permissions for ".concat(e.firstName),children:Object(D.jsx)(an,{userId:e.id,firstName:null!==(a=e.firstName)&&void 0!==a?a:"",lastName:null!==(i=e.lastName)&&void 0!==i?i:""})})}),Object(D.jsx)(ne.a,{sx:{width:"18px"},children:Object(D.jsx)(J.a,{title:"View Cohorts as ".concat(e.firstName),children:Object(D.jsx)(o.b,{to:"/NotImplemented",target:"_blank",children:Object(D.jsx)(Ht.a,{color:"primary",sx:{ml:1,fontSize:"16px"}})})})})]},e.id)}))})]})})})},bn=Object(qe.a)(ht||(ht=Object(Me.a)(["\n  query SearchUsersByField($search: String, $field: String) {\n    searchUsersByField(search: $search, field: $field) {\n      id\n      firstName\n      lastName\n      email\n      userCredentialsForDisplay\n      organization\n      userRolesForDisplay\n      partnerId\n    }\n  }\n"]))),hn=4,On=2,xn=function(){var e,t=Object(a.useState)({search:"",field:"lastName"}),n=Object(L.a)(t,2),i=n[0],c=n[1],s=Object(a.useState)(!1),o=Object(L.a)(s,2),l=o[0],d=o[1],u=Object(a.useState)(null),j=Object(L.a)(u,2),b=j[0],h=j[1],O=Object(gt.a)(bn,{fetchPolicy:"no-cache"}),x=Object(L.a)(O,2),m=x[0],p=x[1],v=p.loading,g=p.data,f=it(),y=function(){var e,t,n,r,a,i;return(null===(e=f.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=f.user)||void 0===t?void 0:t.isAdmin)||(null===(n=f.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=f.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=f.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=f.user)||void 0===i?void 0:i.isEvaluationStaff)},C=function(){(function(){var e="email"===i.field?hn:On;return i.search.length<e?(h("Search term must be at least ".concat(e," characters.")),!1):(h(null),!0)})()&&(d(!0),m({variables:{search:i.search,field:i.field}}))},I=null!==(e=null===g||void 0===g?void 0:g.searchUsersByField)&&void 0!==e?e:[];return y()&&y()?Object(D.jsx)(D.Fragment,{children:y()&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:v,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:6},children:[Object(D.jsx)(T,{title:"Accounts"}),Object(D.jsx)(Ut,{}),Object(D.jsx)(ft.a,{sx:{width:"100%",mt:2,mb:3,textAlign:"left"},children:Object(D.jsxs)(yt.a,{children:[Object(D.jsx)(w.a,{sx:{marginBottom:"20px"},gutterBottom:!0,variant:"h5",component:"div",children:"User Search"}),Object(D.jsxs)(N.a,{container:!0,spacing:2,children:[Object(D.jsx)(N.a,{item:!0,xs:3,children:Object(D.jsxs)(Ct.a,{fullWidth:!0,children:[Object(D.jsx)(wt.a,{children:"Search Field"}),Object(D.jsxs)(kt.a,{size:"small",value:i.field,label:"Search Field",onChange:function(e){c(Object(r.a)(Object(r.a)({},i),{},{field:e.target.value})),h(null)},children:[Object(D.jsx)(St.a,{value:"lastName",children:"Last Name"}),Object(D.jsx)(St.a,{value:"firstName",children:"First Name"}),Object(D.jsx)(St.a,{value:"email",children:"Email"}),Object(D.jsx)(St.a,{value:"organization",children:"Organization"})]})]})}),Object(D.jsx)(N.a,{item:!0,xs:3,children:Object(D.jsx)(It.a,{sx:{width:"100%"},size:"small",label:"Search",value:i.search,onChange:function(e){c(Object(r.a)(Object(r.a)({},i),{},{search:e.target.value})),h(null)},error:!!b,helperText:b||" ",onKeyDown:function(e){"Enter"!==e.key||b||(e.preventDefault(),C())}})}),Object(D.jsxs)(N.a,{item:!0,xs:3,children:[Object(D.jsx)(G.a,{onClick:C,sx:{width:"40%"},color:"primary",variant:"contained",disabled:!!b,children:"Search"}),Object(D.jsx)(G.a,{onClick:function(){d(!1),c({search:"",field:"firstName"}),h(null)},sx:{width:"40%",ml:2},color:"primary",variant:"outlined",children:"Reset"})]})]}),Object(D.jsx)(w.a,{variant:"caption",children:"Select a field and enter a search term"})]})}),!v&&Object(D.jsx)(jn,{users:I,searchWasRun:l})]})]})}):Object(D.jsx)($e,{})},mn=n(936),pn=n(948),vn=n(965),gn="GetCohortById",fn=Object(qe.a)(Ot||(Ot=Object(Me.a)(["\n  query GetCohortById($cohortId: String!) {\n    getCohortById(cohortId: $cohortId) {\n      id\n      programId\n      developmentUserId\n      implementationUserId\n      evaluationUserId\n      meetingLink\n      caseFormLink\n      evaluationGoal\n      audience\n      agreement\n      startDate\n      endDate\n      scheduleDescription\n      statistics\n      registrationOpenDate\n      registrationCloseDate\n      registrationQuestions {\n        id\n        title\n        type\n        name\n        required\n        isMultiSelect\n        yesNo {\n          noText\n          yesText\n        }\n        options {\n          label\n          value\n        }\n        hasOtherOption\n        scale {\n          label\n        }\n        statements {\n          name\n          statement\n        }\n      }\n      archived\n      internalLabel\n      externalLabel\n      prelaunchDateTime\n      projectPartner\n      tenantId\n      learningObjectives\n      surveyLink\n      timeZone\n      allowPreregistration\n      isOngoing\n      sessionDurationInMinutes\n      agreement\n      developmentSupportUserIds\n      evaluationSupportUserIds\n      implementationSupportUserIds\n    }\n  }\n"]))),yn=["children","value","index"],Cn=function(e){var t=e.children,n=e.value,a=e.index,i=Object(Y.a)(e,yn);return Object(D.jsx)("div",Object(r.a)(Object(r.a)({role:"tabpanel",hidden:n!==a,id:"simple-tabpanel-".concat(a),"aria-labelledby":"simple-tab-".concat(a)},i),{},{children:n===a&&Object(D.jsx)(Q.a,{p:3,children:Object(D.jsx)(w.a,{children:t})})}))},wn=n(964),Sn=n(995),In=n(219),kn=n.n(In),An=n(963),Nn=function(e){var t=e.isOpen,n=e.text,r=Object(a.useState)(t),i=Object(L.a)(r,2),c=i[0],s=i[1],o=Object(a.useState)(n),l=Object(L.a)(o,2),d=l[0],u=l[1];return Object(a.useEffect)((function(){s(t)}),[t]),Object(a.useEffect)((function(){u(d)}),[d]),Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(An.a,{anchorOrigin:{vertical:"bottom",horizontal:"center"},open:c,onClose:function(){return s(!1)},autoHideDuration:5e3,children:Object(D.jsx)(me.a,{sx:{mt:2},severity:"success",children:d})})})},Dn="GetCohortDashboard",Tn=Object(qe.a)(xt||(xt=Object(Me.a)(["\n  query GetCohortDashboard($cohortId: String!) {\n    getCohortDashboard(cohortId: $cohortId) {\n      allSessions {\n        id\n        title\n        number\n        startDate\n        endDate\n        HubMemberCohortSession {\n          id\n          hubRoleId\n          hubMemberCohort {\n            id\n            facilitateAll\n            presentAll\n            panelistAll\n            credentials\n            hide\n            user {\n              id\n              firstName\n              lastName\n            }\n          }\n          hubRole {\n            id\n            name\n          }\n        }\n      }\n      allowPreregistration\n      internalTitle\n      externalTitle\n      evaluationGoal\n      learningObjectives\n      audience\n      agreement\n      partnerName\n      registrationOpenDate\n      registrationCloseDate\n      startDate\n      endDate\n      isOngoing\n      meetingLink\n      caseFormLink\n      surveyLink\n      scheduleDescription\n      registrationQuestions {\n        id\n        title\n        type\n        name\n        required\n        isMultiSelect\n        yesNo {\n          noText\n          yesText\n        }\n        options {\n          label\n          value\n        }\n        hasOtherOption\n        scale {\n          label\n        }\n        statements {\n          name\n          statement\n        }\n      }\n      sessions {\n        id\n        title\n        number\n        startDate\n        endDate\n        sessionResources {\n          id\n          resource {\n            name\n            displayName\n            url\n            archived\n            deleted\n          }\n        }\n      }\n      preRegistrantCount\n      newRegistrantCount\n      registeredCount\n      waitlistedCount\n      deniedCount\n      developmentUser {\n        id\n        firstName\n        lastName\n        email\n      }\n      implementationUser {\n        id\n        firstName\n        lastName\n        email\n      }\n      evaluationUser {\n        id\n        firstName\n        lastName\n        email\n      }\n      developmentSupportUser {\n        id\n        firstName\n        lastName\n        email\n      }\n      evaluationSupportUser {\n        id\n        firstName\n        lastName\n        email\n      }\n      implementationSupportUser {\n        id\n        firstName\n        lastName\n        email\n      }\n    }\n  }\n"]))),En=Object(qe.a)(mt||(mt=Object(Me.a)(["\n  mutation EditCohort($cohort: EditCohortInput!) {\n    editCohort(cohort: $cohort) {\n      id\n      internalLabel\n    }\n  }\n"]))),Pn=Object(qe.a)(pt||(pt=Object(Me.a)(["\n  query GetHubTeamUsers {\n    getHubTeamUsers {\n      developmentUsers {\n        id\n        firstName\n        lastName\n      }\n      implementationUsers {\n        id\n        firstName\n        lastName\n      }\n      evaluationUsers {\n        id\n        firstName\n        lastName\n      }\n    }\n  }\n"]))),Rn=n(721);ue.a.extend(fe.a),ue.a.extend(Ce.a);var Ln,Fn,Un,Mn,qn,zn,Hn=Object(pn.a)((function(e){return Object(mn.a)({dateField:{position:"relative"},edit:{color:"goldenrod",cursor:"pointer"},delete:{color:e.palette.primary.main,cursor:"pointer",position:"absolute",top:8,right:40},attendanceLink:{color:e.palette.primary.main}})})),Wn=function(e){var t,n,i,c,s,o,l,d,u,j,b=e.cohort,h=Object(a.useState)(b),O=Object(L.a)(h,2),x=O[0],m=O[1],p=Object(a.useState)(!1),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)(!1),C=Object(L.a)(y,2),S=C[0],k=C[1],A=Object(a.useRef)(null),T=Object(a.useRef)(null),E=Object(a.useRef)(null),P=Object(a.useRef)(null),R=Hn();Object(a.useEffect)((function(){m(b)}),[b]);var F=Object(B.b)(Pn),U=F.loading,M=F.data,q=Object(Ze.a)(En,{refetchQueries:[gn,Dn]}),z=Object(L.a)(q,2),H=z[0],W=z[1],Y=W.loading,Q=W.error,$=Object(a.useState)(null!==(t=x.developmentUserId)&&void 0!==t&&t),V=Object(L.a)($,2),Z=V[0],K=V[1],_=Object(a.useState)(null!==(n=x.implementationUserId)&&void 0!==n&&n),X=Object(L.a)(_,2),ee=X[0],te=X[1],ne=Object(a.useState)(null!==(i=x.evaluationUserId)&&void 0!==i&&i),re=Object(L.a)(ne,2),ae=re[0],ie=re[1],ce=x.startDate?x.startDate.split("T")[0]:"",se=x.endDate?x.endDate.split("T")[0]:"",oe=x.registrationOpenDate?x.registrationOpenDate.split("T")[0]:"",de=x.registrationCloseDate?x.registrationCloseDate.split("T")[0]:"",ue=Object(a.useState)(ce),je=Object(L.a)(ue,2),be=je[0],he=je[1],Oe=Object(a.useState)(se),xe=Object(L.a)(Oe,2),pe=xe[0],ve=xe[1],ge=Object(a.useState)(oe),fe=Object(L.a)(ge,2),ye=fe[0],Ce=fe[1],we=Object(a.useState)(de),Se=Object(L.a)(we,2),Ie=Se[0],ke=Se[1];Object(a.useEffect)((function(){f(!(!U&&!Y))}),[U,Y]);var Ae=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,n,r,a,i,c,s,o,l,d,u,j,b;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i=(null===A||void 0===A||null===(t=A.current)||void 0===t?void 0:t.value)||"",c=(null===T||void 0===T||null===(n=T.current)||void 0===n?void 0:n.value)||"",s=(null===E||void 0===E||null===(r=E.current)||void 0===r?void 0:r.value)||"",o=(null===P||void 0===P||null===(a=P.current)||void 0===a?void 0:a.value)||"",l=i?"".concat(i,"T00:00:00.000Z"):null,d=c?"".concat(c,"T00:00:00.000Z"):null,u=s?"".concat(s,"T00:00:00.000Z"):null,j=o?"".concat(o,"T00:00:00.000Z"):null,b={id:x.id,developmentUserId:x.developmentUserId,implementationUserId:x.implementationUserId,evaluationUserId:x.evaluationUserId,meetingLink:x.meetingLink,evaluationGoal:x.evaluationGoal,audience:x.audience,startDate:l,endDate:x.isOngoing?null:d,scheduleDescription:x.scheduleDescription,statistics:x.statistics,registrationOpenDate:u,registrationCloseDate:x.isOngoing?null:j,archived:x.archived,internalLabel:x.internalLabel,externalLabel:x.externalLabel,prelaunchDateTime:x.prelaunchDateTime,projectPartner:x.projectPartner,learningObjectives:x.learningObjectives,caseFormLink:x.caseFormLink,surveyLink:x.surveyLink,timeZone:x.timeZone,allowPreregistration:x.allowPreregistration,isOngoing:x.isOngoing,sessionDurationInMinutes:x.sessionDurationInMinutes,implementationSupportUserIds:x.implementationSupportUserIds,developmentSupportUserIds:x.developmentSupportUserIds,evaluationSupportUserIds:x.evaluationSupportUserIds},e.next=12,H({variables:{cohort:b}});case 12:Q||k(!0),e.next=17;break;case 15:e.prev=15,e.t0=e.catch(0);case 17:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),Ne=function(e){var t=e.target.name,n=e.target.value;m("sessionDurationInMinutes"===t?Object(r.a)(Object(r.a)({},x),{},{sessionDurationInMinutes:n.length>0?Number(n):0}):Object(r.a)(Object(r.a)({},x),{},Object(Tt.a)({},t,n)))},De=function(e){var t=e.target.name,n=e.target.checked;m(Object(r.a)(Object(r.a)({},x),{},Object(Tt.a)({},t,n)))};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:g,title:"Saving"}),Q&&Object(D.jsx)(me.a,{sx:{mb:2},severity:"error",children:Q}),Object(D.jsxs)(N.a,{container:!0,spacing:4,sx:{pb:2,mt:1},children:[Object(D.jsx)(N.a,{item:!0,xs:12,children:Object(D.jsxs)(I.a,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[Object(D.jsxs)(I.a,{direction:"row",spacing:2,flex:1,children:[Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{size:"small",color:"primary",checked:x.allowPreregistration||!1,name:"allowPreregistration",onChange:De}),label:"Allow Pre-Registration"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{size:"small",color:"primary",checked:x.isOngoing,name:"isOngoing",onChange:De}),label:"Ongoing Cohort"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{size:"small",color:"primary",checked:x.archived,name:"archived",onChange:De}),label:"Archive Cohort"})]}),Object(D.jsxs)(kt.a,{size:"small",labelId:"timezone-select-label",label:"Time Zone",name:"timeZone",color:"warning",value:null!==(c=x.timeZone)&&void 0!==c?c:void 0,disabled:!0,children:[Object(D.jsx)(St.a,{value:"",children:Object(D.jsx)("em",{children:"Select a Timezone"})}),Rn.map((function(e,t){return Object(D.jsx)(St.a,{value:e.value,children:(n=e.text,n.replace(new RegExp("&amp;","g"),"&"))},t);var n}))]})]})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:6,children:Object(D.jsx)(It.a,{size:"small",label:"Internal Title",variant:"outlined",name:"internalLabel",value:x.internalLabel,onChange:Ne,color:"warning",fullWidth:!0})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:6,children:Object(D.jsx)(It.a,{size:"small",label:"External Title",variant:"outlined",name:"externalLabel",value:x.externalLabel,color:"warning",onChange:Ne,fullWidth:!0})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:6,children:Object(D.jsxs)("div",{className:R.dateField,children:[Object(D.jsx)(It.a,{size:"small",type:"date",id:"startDate",name:"startDate",inputRef:A,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;he(t)}},value:be,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Start Date",color:"warning"}),be&&Object(D.jsx)(J.a,{title:"Clear",placement:"top",children:Object(D.jsx)(kn.a,{className:R.delete,onClick:function(){he("")}})})]})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:6,children:Object(D.jsxs)("div",{className:R.dateField,children:[Object(D.jsx)(It.a,{size:"small",type:"date",id:"registrationOpenDate",name:"registrationOpenDate",inputRef:E,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;Ce(t)}},value:ye,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Date to Open Registration",color:"warning"}),ye&&Object(D.jsx)(J.a,{title:"Clear",placement:"top",children:Object(D.jsx)(kn.a,{className:R.delete,onClick:function(){Ce("")}})})]})}),!x.isOngoing&&Object(D.jsx)(N.a,{item:!0,xs:12,sm:6,children:Object(D.jsxs)("div",{className:R.dateField,children:[Object(D.jsx)(It.a,{size:"small",type:"date",id:"endDate",name:"endDate",inputRef:T,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;ve(t)}},value:pe,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"End Date",color:"warning"}),pe&&Object(D.jsx)(J.a,{title:"Clear",placement:"top",children:Object(D.jsx)(kn.a,{className:R.delete,onClick:function(){ve("")}})})]})}),!x.isOngoing&&Object(D.jsx)(N.a,{item:!0,xs:12,sm:6,children:Object(D.jsxs)("div",{className:R.dateField,children:[Object(D.jsx)(It.a,{size:"small",type:"date",id:"registrationCloseDate",name:"registrationCloseDate",inputRef:P,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;ke(t)}},value:Ie,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Date to Close Registration",color:"warning"}),Ie&&Object(D.jsx)(J.a,{title:"Clear",placement:"top",children:Object(D.jsx)(kn.a,{className:R.delete,onClick:function(){ke("")}})})]})}),Object(D.jsx)(N.a,{item:!0,xs:12,marginTop:"10px",children:Object(D.jsx)(w.a,{variant:"h6",gutterBottom:!0,children:"Cohort Links"})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsx)(It.a,{size:"small",label:"Video Conference Link",variant:"outlined",name:"meetingLink",value:x.meetingLink,color:"warning",onChange:Ne,fullWidth:!0})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsx)(It.a,{size:"small",label:"Case Form Link",variant:"outlined",name:"caseFormLink",value:x.caseFormLink,color:"warning",onChange:Ne,fullWidth:!0})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsx)(It.a,{size:"small",label:"Survey Link",variant:"outlined",name:"surveyLink",value:x.surveyLink,color:"warning",onChange:Ne,fullWidth:!0})}),Object(D.jsx)(N.a,{item:!0,xs:12,marginTop:"10px",children:Object(D.jsx)(w.a,{variant:"h6",gutterBottom:!0,children:"Assign Users"})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsxs)(Ct.a,{error:!Z,fullWidth:!0,size:"small",children:[Object(D.jsx)(wn.a,{size:"small",id:"development-lead-autocomplete",options:null!==(s=null===M||void 0===M?void 0:M.getHubTeamUsers.developmentUsers)&&void 0!==s?s:[],getOptionLabel:function(e){return"".concat(e.firstName," ").concat(e.lastName)},value:(null===M||void 0===M?void 0:M.getHubTeamUsers.developmentUsers.find((function(e){return e.id===x.developmentUserId})))||null,onChange:function(e,t){K(!!t),m(Object(r.a)(Object(r.a)({},x),{},{developmentUserId:t?t.id:null}))},renderInput:function(e){return Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({},e),{},{label:"Development Lead",placeholder:"Select Development Lead"}))},isOptionEqualToValue:function(e,t){return e.id===t.id}}),!Z&&Object(D.jsx)(Sn.a,{children:"This field is required."})]})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsxs)(Ct.a,{error:!ee,fullWidth:!0,size:"small",children:[Object(D.jsx)(wn.a,{size:"small",id:"implementation-lead-autocomplete",options:null!==(o=null===M||void 0===M?void 0:M.getHubTeamUsers.implementationUsers)&&void 0!==o?o:[],getOptionLabel:function(e){return"".concat(e.firstName," ").concat(e.lastName)},value:(null===M||void 0===M?void 0:M.getHubTeamUsers.implementationUsers.find((function(e){return e.id===x.implementationUserId})))||null,onChange:function(e,t){te(!!t),m(Object(r.a)(Object(r.a)({},x),{},{implementationUserId:t?t.id:null}))},renderInput:function(e){return Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({},e),{},{label:"Implementation Lead",placeholder:"Select Implementation Lead"}))},isOptionEqualToValue:function(e,t){return e.id===t.id}}),!ee&&Object(D.jsx)(Sn.a,{children:"This field is required."})]})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsxs)(Ct.a,{error:!ae,fullWidth:!0,size:"small",children:[Object(D.jsx)(wn.a,{size:"small",id:"evaluation-lead-autocomplete",options:null!==(l=null===M||void 0===M?void 0:M.getHubTeamUsers.evaluationUsers)&&void 0!==l?l:[],getOptionLabel:function(e){return"".concat(e.firstName," ").concat(e.lastName)},value:(null===M||void 0===M?void 0:M.getHubTeamUsers.evaluationUsers.find((function(e){return e.id===x.evaluationUserId})))||null,onChange:function(e,t){ie(!!t),m(Object(r.a)(Object(r.a)({},x),{},{evaluationUserId:t?t.id:null}))},renderInput:function(e){return Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({},e),{},{label:"Evaluation Lead",placeholder:"Select Evaluation Lead"}))},isOptionEqualToValue:function(e,t){return e.id===t.id}}),!ae&&Object(D.jsx)(Sn.a,{children:"This field is required."})]})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsx)(Ct.a,{fullWidth:!0,size:"small",children:Object(D.jsx)(wn.a,{size:"small",multiple:!0,id:"development-support-autocomplete",options:null!==(d=null===M||void 0===M?void 0:M.getHubTeamUsers.developmentUsers)&&void 0!==d?d:[],getOptionLabel:function(e){return"".concat(e.firstName," ").concat(e.lastName)},value:(null===M||void 0===M?void 0:M.getHubTeamUsers.developmentUsers.filter((function(e){var t;return null===x||void 0===x||null===(t=x.developmentSupportUserIds)||void 0===t?void 0:t.includes(e.id)})))||[],onChange:function(e,t){m(Object(r.a)(Object(r.a)({},x),{},{developmentSupportUserIds:t.map((function(e){return e.id}))}))},renderInput:function(e){return Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({},e),{},{label:"Development Support",placeholder:"Select Development Support"}))},isOptionEqualToValue:function(e,t){return e.id===t.id}})})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsx)(Ct.a,{fullWidth:!0,size:"small",children:Object(D.jsx)(wn.a,{size:"small",multiple:!0,id:"implementation-support-autocomplete",options:null!==(u=null===M||void 0===M?void 0:M.getHubTeamUsers.implementationUsers)&&void 0!==u?u:[],getOptionLabel:function(e){return"".concat(e.firstName," ").concat(e.lastName)},value:(null===M||void 0===M?void 0:M.getHubTeamUsers.implementationUsers.filter((function(e){var t;return null===x||void 0===x||null===(t=x.implementationSupportUserIds)||void 0===t?void 0:t.includes(e.id)})))||[],onChange:function(e,t){m(Object(r.a)(Object(r.a)({},x),{},{implementationSupportUserIds:t.map((function(e){return e.id}))}))},renderInput:function(e){return Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({},e),{},{label:"Implementation Support",placeholder:"Select Implementation Support"}))},isOptionEqualToValue:function(e,t){return e.id===t.id}})})}),Object(D.jsx)(N.a,{item:!0,xs:12,sm:4,children:Object(D.jsx)(Ct.a,{fullWidth:!0,size:"small",children:Object(D.jsx)(wn.a,{size:"small",multiple:!0,id:"evaluation-support-autocomplete",options:null!==(j=null===M||void 0===M?void 0:M.getHubTeamUsers.evaluationUsers)&&void 0!==j?j:[],getOptionLabel:function(e){return"".concat(e.firstName," ").concat(e.lastName)},value:(null===M||void 0===M?void 0:M.getHubTeamUsers.evaluationUsers.filter((function(e){var t;return null===x||void 0===x||null===(t=x.evaluationSupportUserIds)||void 0===t?void 0:t.includes(e.id)})))||[],onChange:function(e,t){m(Object(r.a)(Object(r.a)({},x),{},{evaluationSupportUserIds:t.map((function(e){return e.id}))}))},renderInput:function(e){return Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({},e),{},{label:"Evaluation Support",placeholder:"Select Evaluation Support"}))},isOptionEqualToValue:function(e,t){return e.id===t.id}})})}),Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Q&&Object(D.jsx)(me.a,{sx:{mt:2},severity:"error",children:Q}),Object(D.jsx)(G.a,{sx:{mt:2},onClick:Ae,variant:"contained",color:"primary",disabled:!(Z&&ee&&ae),children:"Save Details"}),Object(D.jsx)(Nn,{isOpen:S,text:"Cohort details have been saved"})]})]})]})},Yn=n(76),Bn=Object(pn.a)((function(e){return Object(mn.a)({editor:{height:"100px"},label:{textAlign:"left"}})})),Qn=function(e){var t=e.cohort,n=Bn(),i=Object(a.useState)(t),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)(!1),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(!1),h=Object(L.a)(b,2),O=h[0],x=h[1];Object(a.useEffect)((function(){o(t)}),[t]);var m=Object(Ze.a)(En,{refetchQueries:[gn,Dn]}),p=Object(L.a)(m,2),v=p[0],g=p[1],f=g.loading,y=g.error;Object(a.useEffect)((function(){j(f)}),[f]);var C=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,n,r,a,i,c,o;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o={allowPreregistration:s.allowPreregistration,archived:s.archived,audience:null!==(t=s.audience)&&void 0!==t?t:"",agreement:null!==(n=s.agreement)&&void 0!==n?n:"",caseFormLink:s.caseFormLink,developmentUserId:s.developmentUserId,endDate:s.endDate,evaluationGoal:null!==(r=s.evaluationGoal)&&void 0!==r?r:"",evaluationUserId:s.evaluationUserId,externalLabel:s.externalLabel,id:s.id,implementationUserId:s.implementationUserId,internalLabel:null!==(a=s.internalLabel)&&void 0!==a?a:"",isOngoing:s.isOngoing,learningObjectives:null!==(i=s.learningObjectives)&&void 0!==i?i:"",meetingLink:s.meetingLink,prelaunchDateTime:s.prelaunchDateTime,projectPartner:null!==(c=s.projectPartner)&&void 0!==c?c:"",registrationCloseDate:s.registrationCloseDate,registrationOpenDate:s.registrationOpenDate,scheduleDescription:s.scheduleDescription,sessionDurationInMinutes:s.sessionDurationInMinutes,startDate:s.startDate,statistics:s.statistics,surveyLink:s.surveyLink,timeZone:s.timeZone},e.next=4,v({variables:{cohort:o}});case 4:y||x(!0),e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:u,title:"Saving"}),y&&Object(D.jsx)(me.a,{sx:{mb:2},severity:"error",children:y}),Object(D.jsx)(N.a,{sx:{height:"200px"},container:!0,children:Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Object(D.jsx)(w.a,{className:n.label,variant:"h6",children:"Goals"}),Object(D.jsx)(w.a,{variant:"caption",children:"The overarching goal of this ECHO is for WHO to DO WHAT"}),Object(D.jsx)(Yn,{id:"evaluationGoal",className:n.editor,value:s.evaluationGoal,onChange:function(e){e!==s.evaluationGoal&&o(Object(r.a)(Object(r.a)({},s),{},{evaluationGoal:e}))}})]})}),Object(D.jsx)(N.a,{sx:{height:"200px",mt:3},container:!0,children:Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Object(D.jsx)(w.a,{className:n.label,variant:"h6",children:"Learning Objectives"}),Object(D.jsx)(w.a,{variant:"caption"}),Object(D.jsx)(Yn,{id:"learningObjectives",className:n.editor,value:s.learningObjectives,onChange:function(e){e!==s.learningObjectives&&o(Object(r.a)(Object(r.a)({},s),{},{learningObjectives:e}))}})]})}),Object(D.jsx)(N.a,{sx:{height:"200px",mt:3},container:!0,children:Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Object(D.jsx)(w.a,{className:n.label,variant:"h6",children:"Project Partners"}),Object(D.jsx)(Yn,{id:"projectPartner",className:n.editor,value:s.projectPartner,onChange:function(e){e!==s.projectPartner&&o(Object(r.a)(Object(r.a)({},s),{},{projectPartner:e}))}})]})}),Object(D.jsx)(N.a,{sx:{height:"200px",mt:3},container:!0,children:Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Object(D.jsx)(w.a,{className:n.label,variant:"h6",children:"Audience"}),Object(D.jsx)(w.a,{className:n.label,variant:"caption",children:"Describe the ideal participant for this ECHO"}),Object(D.jsx)(Yn,{id:"audience",className:n.editor,value:s.audience,onChange:function(e){e!==s.audience&&o(Object(r.a)(Object(r.a)({},s),{},{audience:e}))}})]})}),Object(D.jsx)(N.a,{sx:{height:"200px",mt:3},container:!0,children:Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Object(D.jsx)(w.a,{className:n.label,variant:"h6",children:"Build Schedule Description"}),Object(D.jsx)(w.a,{className:n.label,variant:"caption",children:"This text is used in all email communication with participants"}),Object(D.jsx)(Yn,{id:"scheduleDescription",className:n.editor,value:s.scheduleDescription,onChange:function(e){e!==s.scheduleDescription&&o(Object(r.a)(Object(r.a)({},s),{},{scheduleDescription:e}))}})]})}),Object(D.jsx)(N.a,{sx:{height:"200px",mt:3},container:!0,children:Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Object(D.jsx)(w.a,{className:n.label,variant:"h6",children:"Agreement"}),Object(D.jsx)(w.a,{className:n.label,variant:"caption",children:"Agreement for all series participants"}),Object(D.jsx)(Yn,{id:"agreement",className:n.editor,value:s.agreement,onChange:function(e){e!==s.agreement&&o(Object(r.a)(Object(r.a)({},s),{},{agreement:e}))}})]})}),Object(D.jsx)(N.a,{spacing:2,sx:{pb:2,mt:1,textAlign:"center"},container:!0,children:Object(D.jsxs)(N.a,{item:!0,xs:12,children:[y&&Object(D.jsx)(me.a,{sx:{mt:2},severity:"error",children:y}),Object(D.jsx)(G.a,{onClick:C,variant:"contained",color:"primary",children:"Save Notes"}),Object(D.jsx)(Nn,{isOpen:O,text:"Cohort notes have been saved"})]})})]})},$n=function(e){var t=e.cohort,n=i.a.useState(0),c=Object(L.a)(n,2),s=c[0],o=c[1],l=Object(a.useState)(t),d=Object(L.a)(l,2),u=d[0],j=d[1];Object(a.useEffect)((function(){j(t)}),[t]);var b=function(e){return{id:"edit-cohort-tab-".concat(e),"aria-controls":"edit-cohort-tabpanel-".concat(e)}};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:"Edit Cohort"}),Object(D.jsxs)($.a,{value:s,onChange:function(e,t){o(t)},"aria-label":"edit cohort tabs",textColor:"primary",indicatorColor:"primary",children:[Object(D.jsx)(V.a,Object(r.a)({label:"Cohort Details"},b(0))),Object(D.jsx)(V.a,Object(r.a)({label:"Notes"},b(1)))]}),Object(D.jsx)(Cn,{value:s,index:0,children:Object(D.jsx)(Wn,{cohort:u})}),Object(D.jsx)(Cn,{value:s,index:1,children:Object(D.jsx)(Qn,{cohort:u})})]})},Vn=n(24),Gn=n(458),Jn=n.n(Gn),Zn=n(459),Kn=n.n(Zn),_n=n(190),Xn=n.n(_n),er=function(e){var t=e.open,n=e.dialogTitle,r=e.confirmText,a=e.dialogText,i=e.onClose,c=e.cancelText,s=void 0===c?"Cancel":c,o=function(e){i(e)};return Object(D.jsxs)(ie.a,{onClose:function(){return o(!1)},open:t,children:[Object(D.jsx)(ce.a,{children:n}),Object(D.jsx)(se.a,{children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(w.a,{variant:"body1",children:a}),Object(D.jsxs)(Q.a,{sx:{textAlign:"right"},children:[Object(D.jsx)(G.a,{sx:{mr:3},variant:"outlined",color:"warning",onClick:function(){return o(!1)},children:s}),Object(D.jsx)(G.a,{variant:"contained",color:"warning",onClick:function(){return o(!0)},children:r})]})]})})]})},tr=function(e){var t=e.iconTooltip,n=e.dialogTitle,r=e.confirmText,i=e.dialogText,c=e.reference,s=e.onClose,o=Object(a.useState)(!1),l=Object(L.a)(o,2),d=l[0],u=l[1];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:t,children:Object(D.jsx)(Xn.a,{sx:{cursor:"pointer"},onClick:function(){return u(!0)}})}),Object(D.jsx)(er,{dialogTitle:n,confirmText:r,dialogText:i,open:d,onClose:function(e){u(!1),s(e,c)}})]})},nr=n(961),rr=n(57),ar=function(e){var t=e.question,n=e.setQuestion,i=Object(a.useState)({label:""}),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)({label:"",value:"",limit:""}),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(null),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)({name:"",statement:""}),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)({name:"",statement:"",limit:""}),y=Object(L.a)(f,2),S=y[0],I=y[1],k=Object(a.useState)(null),A=Object(L.a)(k,2),T=A[0],E=A[1],P=function(e){I(Object(r.a)(Object(r.a)({},S),{},Object(Tt.a)({},e.target.name,""))),g(Object(r.a)(Object(r.a)({},v),{},Object(Tt.a)({},e.target.name,e.target.value)))};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{variant:"h6",textAlign:"left",mt:4,mb:1,children:"Add Scale Response Options"}),Object(D.jsxs)(N.a,{container:!0,mb:2,children:[Object(D.jsx)(N.a,{item:!0,xs:8,pr:1,children:Object(D.jsx)(Q.a,{textAlign:"left",children:Object(D.jsx)(It.a,{size:"small",fullWidth:!0,name:"label",onChange:function(e){j(Object(r.a)(Object(r.a)({},u),{},Object(Tt.a)({},e.target.name,""))),o(Object(r.a)(Object(r.a)({},s),{},Object(Tt.a)({},e.target.name,e.target.value)))},variant:"outlined",color:"warning",label:"Scale Label",value:s.label,error:!!u.label,helperText:u.label})})}),Object(D.jsxs)(N.a,{item:!0,xs:4,pl:1,children:[Object(D.jsx)(G.a,{variant:"outlined",fullWidth:!0,onClick:function(){if(t.scale&&t.scale.length>=10)j(Object(r.a)(Object(r.a)({},u),{},{limit:"You can only add up to 10 scales"}));else if(""!==s.label)if(t.scale&&t.scale.some((function(e,t){return e.label===s.label&&t!==O})))j(Object(r.a)(Object(r.a)({},u),{},{label:"Label must be unique"}));else{if(null!==O){var e,a=null===(e=t.scale)||void 0===e?void 0:e.map((function(e,t){return t===O?s:e}));n(Object(r.a)(Object(r.a)({},t),{},{scale:a})),x(null)}else if(t.scale&&Array.isArray(t.scale)){var i=Object(Vn.a)(t.scale);n(Object(r.a)(Object(r.a)({},t),{},{scale:[].concat(Object(Vn.a)(i),[s])}))}else n(Object(r.a)(Object(r.a)({},t),{},{scale:[s]}));o({label:""})}else j(Object(r.a)(Object(r.a)({},u),{},{label:"Label is required"}))},sx:{lineHeight:2},children:null!==O?"Update Scale":"Add Scale"}),u.limit&&Object(D.jsx)(w.a,{color:"error",variant:"body2",mt:1,children:u.limit})]}),Object(D.jsx)(N.a,{item:!0,xs:12,pt:0,textAlign:"left",children:Object(D.jsx)(w.a,{variant:"caption",textAlign:"left",color:"primary.main",children:"Add options in order as they should appear left to right"})})]}),t.scale&&t.scale.length>0&&Object(D.jsx)(X.a,{"aria-label":"bordered table",size:"small",sx:{mb:5},children:Object(D.jsx)(ee.a,{children:t.scale.map((function(e,a){return Object(D.jsx)(te.a,{sx:{display:"flex",position:"relative"},children:Object(D.jsxs)(ne.a,{sx:{border:1,borderColor:"grey.300",flex:1,position:"relative",paddingRight:"75px"},children:[e.label,Object(D.jsx)(C.a,{"aria-label":"edit",size:"small",sx:{position:"absolute",right:40,top:"50%",transform:"translateY(-50%)",color:"primary.main",backgroundColor:"white",borderRadius:"50%",padding:"4px"},onClick:function(){return function(e){t.scale&&(o({label:t.scale[e].label||""}),x(e))}(a)},children:Object(D.jsx)(rr.a,{})}),Object(D.jsx)(C.a,{"aria-label":"delete",size:"small",sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",color:"primary.main",backgroundColor:"white",borderRadius:"50%",padding:"4px"},onClick:function(){return function(e){var a,i=null===(a=t.scale)||void 0===a?void 0:a.filter((function(t,n){return n!==e}));n(Object(r.a)(Object(r.a)({},t),{},{scale:i}))}(a)},children:Object(D.jsx)(rr.d,{})})]})},a)}))})}),Object(D.jsx)(w.a,{variant:"h6",textAlign:"left",my:1,children:"Statements"}),Object(D.jsxs)(N.a,{container:!0,spacing:2,mb:2,children:[Object(D.jsx)(N.a,{item:!0,xs:12,children:Object(D.jsx)(Q.a,{textAlign:"left",children:Object(D.jsx)(It.a,{size:"small",fullWidth:!0,name:"name",onChange:P,variant:"outlined",color:"warning",label:"Name/Export Label",value:v.name,error:!!S.name,helperText:S.name})})}),Object(D.jsx)(N.a,{item:!0,xs:12,children:Object(D.jsx)(Q.a,{textAlign:"left",children:Object(D.jsx)(It.a,{size:"small",fullWidth:!0,name:"statement",onChange:P,variant:"outlined",color:"warning",label:"Statement",value:v.statement,error:!!S.statement,helperText:S.statement})})}),Object(D.jsxs)(N.a,{item:!0,xs:12,children:[Object(D.jsx)(G.a,{variant:"outlined",fullWidth:!0,onClick:function(){if(t.statements&&t.statements.length>=10)I(Object(r.a)(Object(r.a)({},S),{},{limit:"You can only add up to 10 statements"}));else if(""!==v.name)if(""!==v.statement)if(t.statements&&t.statements.some((function(e,t){return e.name===v.name&&t!==T})))I(Object(r.a)(Object(r.a)({},S),{},{name:"Name must be unique"}));else{if(null!==T){var e,a=null===(e=t.statements)||void 0===e?void 0:e.map((function(e,t){return t===T?v:e}));n(Object(r.a)(Object(r.a)({},t),{},{statements:a})),E(null)}else if(t.statements&&Array.isArray(t.statements)){var i=Object(Vn.a)(t.statements);n(Object(r.a)(Object(r.a)({},t),{},{statements:[].concat(Object(Vn.a)(i),[v])}))}else n(Object(r.a)(Object(r.a)({},t),{},{statements:[v]}));g({name:"",statement:""})}else I(Object(r.a)(Object(r.a)({},S),{},{statement:"Statement is required"}));else I(Object(r.a)(Object(r.a)({},S),{},{name:"Name is required"}))},children:null!==T?"Update Statement":"Add Statement"}),S.limit&&Object(D.jsx)(w.a,{color:"error",variant:"body2",mt:1,children:S.limit})]})]}),t.statements&&t.statements.length>0&&Object(D.jsx)(X.a,{"aria-label":"bordered table",size:"small",sx:{mb:4},children:Object(D.jsx)(ee.a,{children:t.statements.map((function(e,a){return Object(D.jsx)(te.a,{sx:{display:"flex",position:"relative"},children:Object(D.jsxs)(ne.a,{sx:{border:1,borderColor:"grey.300",flex:1,position:"relative",paddingRight:"75px"},children:[e.statement," - ",Object(D.jsx)(w.a,{variant:"caption",children:e.name}),Object(D.jsx)(C.a,{"aria-label":"edit",size:"small",sx:{position:"absolute",right:40,top:"50%",transform:"translateY(-50%)",color:"primary.main",backgroundColor:"white",borderRadius:"50%",padding:"4px"},onClick:function(){return function(e){t.statements&&(g({name:t.statements[e].name||"",statement:t.statements[e].statement||""}),E(e))}(a)},children:Object(D.jsx)(rr.a,{})}),Object(D.jsx)(C.a,{"aria-label":"delete",size:"small",sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",color:"primary.main",backgroundColor:"white",borderRadius:"50%",padding:"4px"},onClick:function(){return function(e){var a,i=null===(a=t.statements)||void 0===a?void 0:a.filter((function(t,n){return n!==e}));n(Object(r.a)(Object(r.a)({},t),{},{statements:i}))}(a)},children:Object(D.jsx)(rr.d,{})})]})},a)}))})})]})},ir=n(76),cr=(n(97),Object(pn.a)((function(e){return Object(mn.a)({helperText:{color:e.palette.primary.main},editor:{height:"200px",marginBottom:"45px"},delete:{color:e.palette.primary.main,cursor:"pointer"},add:{color:"green",cursor:"pointer"}})}))),sr=function(e){var t,n,i=e.registrationQuestion,c=e.onSave,s=e.errorText,o=cr(),l=Object(a.useState)(i),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(""),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)(!1),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)(!1),y=Object(L.a)(f,2),C=y[0],S=y[1],k=Object(a.useState)(!1),A=Object(L.a)(k,2),T=A[0],E=A[1],P=Object(a.useState)(!1),R=Object(L.a)(P,2),F=R[0],U=R[1],M=Object(a.useState)(!1),q=Object(L.a)(M,2),z=q[0],H=q[1],W=Object(a.useState)(!1),Y=Object(L.a)(W,2),B=Y[0],$=Y[1],V=Object(a.useState)(!1),J=Object(L.a)(V,2),Z=J[0],re=J[1];Object(a.useEffect)((function(){j(JSON.parse(JSON.stringify(i)))}),[i]);var ae=function(e){var t=e.target.value,n=e.target.name;if("yesText"!==n)if("noText"!==n)j(Object(r.a)(Object(r.a)({},u),{},Object(Tt.a)({},n,t)));else{var a,i=null===(a=u.yesNo)||void 0===a?void 0:a.yesText;j(Object(r.a)(Object(r.a)({},u),{},{yesNo:{yesText:i,noText:t}}))}else{var c,s=null===(c=u.yesNo)||void 0===c?void 0:c.noText;j(Object(r.a)(Object(r.a)({},u),{},{yesNo:{yesText:t,noText:s}}))}};return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(I.a,{mt:1,children:[s.length>0&&Object(D.jsx)(me.a,{severity:"error",children:s}),v&&Object(D.jsx)(me.a,{severity:"error",children:"Please update all required fields"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{onChange:function(e){var t=e.target.checked;j(Object(r.a)(Object(r.a)({},u),{},{required:t}))},checked:u.required||void 0,size:"small"}),label:"Question is Required"}),"select"===u.type&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{onChange:function(e){var t=e.target.checked;j(Object(r.a)(Object(r.a)({},u),{},{hasOtherOption:t}))},checked:u.hasOtherOption||void 0,size:"small"}),label:'Add "Other" Option'}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{onChange:function(e){var t=e.target.checked;j(Object(r.a)(Object(r.a)({},u),{},{isMultiSelect:t}))},checked:u.isMultiSelect||!1,size:"small"}),label:"Multi Select"})]}),Object(D.jsxs)(Q.a,{mb:1,mt:2,textAlign:"left",children:[Object(D.jsx)(It.a,{size:"small",fullWidth:!0,name:"name",onChange:ae,variant:"outlined",color:"warning",label:"Name/Export Label",value:u.name,error:C,FormHelperTextProps:{classes:{root:o.helperText}}}),Object(D.jsx)(w.a,{variant:"caption",color:"primary.main",sx:{textAlign:"left"},children:"Required (Do not add special characters to the Name/Export Label)"})]}),Object(D.jsxs)(Q.a,{my:1,textAlign:"left",children:[Object(D.jsx)(ir,{id:"title",className:o.editor,value:u.title,onChange:function(e){return j(Object(r.a)(Object(r.a)({},u),{},{title:e}))}}),Object(D.jsx)(w.a,{variant:"caption",color:"primary.main",sx:{textAlign:"left"},children:"Required"})]}),"yes/no"===u.type&&Object(D.jsxs)(N.a,{container:!0,spacing:2,alignItems:"center",my:1,children:[Object(D.jsx)(N.a,{item:!0,xs:6,children:Object(D.jsxs)(Q.a,{textAlign:"left",children:[Object(D.jsx)(It.a,{size:"small",fullWidth:!0,name:"yesText",onChange:ae,variant:"outlined",color:"warning",label:"Yes Text",value:null===(t=u.yesNo)||void 0===t?void 0:t.yesText,error:T}),Object(D.jsx)(w.a,{variant:"caption",color:"primary.main",children:"Required"})]})}),Object(D.jsx)(N.a,{item:!0,xs:6,children:Object(D.jsxs)(Q.a,{textAlign:"left",children:[Object(D.jsx)(It.a,{size:"small",fullWidth:!0,name:"noText",onChange:ae,variant:"outlined",color:"warning",label:"No Text",value:null===(n=u.yesNo)||void 0===n?void 0:n.noText,error:F}),Object(D.jsx)(w.a,{variant:"caption",color:"primary.main",children:"Required"})]})})]}),"likert"===u.type&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(ar,{question:u,setQuestion:j}),B&&Object(D.jsx)(me.a,{severity:"error",sx:{mb:2},children:"You must have at least 2 scales"}),Z&&Object(D.jsx)(me.a,{severity:"error",sx:{mb:2},children:"You must have at least 2 statements"})]}),"select"===u.type&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{variant:"h6",textAlign:"left",mb:1,children:"Add Answers"}),Object(D.jsxs)(N.a,{container:!0,mb:2,children:[Object(D.jsx)(N.a,{item:!0,xs:10,children:Object(D.jsx)(It.a,{size:"small",fullWidth:!0,onChange:function(e){var t=e.target.value;x(t)},variant:"outlined",color:"warning",label:"New Answer",value:O,FormHelperTextProps:{classes:{root:o.helperText}}})}),Object(D.jsx)(N.a,{item:!0,xs:2,children:Object(D.jsx)(G.a,{onClick:function(){var e=u.options;e||(e=[]),e.push({label:O,value:O}),j(Object(r.a)(Object(r.a)({},u),{},{options:e})),x("")},variant:"contained",children:"Add"})})]}),z&&Object(D.jsx)(me.a,{severity:"error",sx:{mb:2},children:"You must have at least 2 answer options"}),u.options&&u.options.length>0&&Object(D.jsx)(K.a,{component:_.a,sx:{mb:2},children:Object(D.jsx)(X.a,{sx:{width:"100%"},"aria-label":"simple table",children:Object(D.jsx)(ee.a,{children:u.options&&u.options.map((function(e,t){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:e.label}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(rr.d,{onClick:function(){return function(e){var t=u.options;t||(t=[]),e>-1&&(t.splice(e,1),j(Object(r.a)(Object(r.a)({},u),{},{options:t})))}(t)},title:"Delete Question",className:o.delete})})]},"".concat(e.label,"-").concat(t))}))})})})]}),Object(D.jsx)(G.a,{variant:"contained",onClick:function(){if(function(){var e,t,n,r,a,i=!0;return g(!1),S(!1),E(!1),U(!1),H(!1),$(!1),re(!1),0===u.name.length&&(S(!0),i=!1),0!==u.title.length&&"<p><br></p>"!==u.title||(i=!1),"yes/no"===u.type&&(0===(null===u||void 0===u||null===(e=u.yesNo)||void 0===e||null===(t=e.yesText)||void 0===t?void 0:t.length)&&(E(!0),i=!1),0===(null===u||void 0===u||null===(n=u.yesNo)||void 0===n||null===(r=n.noText)||void 0===r?void 0:r.length)&&(U(!0),i=!1)),"select"===u.type&&u.options&&(null===(a=u.options)||void 0===a?void 0:a.length)<2&&(H(!0),i=!1),"likert"===u.type&&(u.scale&&u.scale.length<2&&($(!0),i=!1),u.statements&&u.statements.length<2&&(re(!0),i=!1)),g(!i),i}()){var e,t;if("yes/no"===u.type)u.yesNo={noText:null===(e=u.yesNo)||void 0===e?void 0:e.noText,yesText:null===(t=u.yesNo)||void 0===t?void 0:t.yesText};c(u)}},children:"Save"})]})})},or=Object(qe.a)(Ln||(Ln=Object(Me.a)(["\n  mutation AddRegistrationQuestion($cohortId: String!, $registrationQuestion: RegistrationQuestionInput!) {\n    addRegistrationQuestion(cohortId: $cohortId, registrationQuestion: $registrationQuestion) {\n      id\n    }\n  }\n"]))),lr={id:"",title:"",type:"text",name:"",required:!1,yesNo:null,options:null,scale:null,statements:null},dr={id:"",title:"",type:"yes/no",name:"",required:!1,yesNo:{yesText:"Yes",noText:"No"},options:null,scale:null,statements:null},ur={id:"",title:"",type:"select",name:"",required:!1,yesNo:null,options:[],scale:null,statements:null},jr={id:"",title:"",type:"likert",name:"",required:!1,yesNo:null,options:null,scale:[],statements:[]},br=function(e){var t=e.cohortId,n=Object(a.useState)(""),i=Object(L.a)(n,2),c=i[0],s=i[1],o=Object(a.useState)(""),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(Ze.a)(or,{refetchQueries:[gn]}),b=Object(L.a)(j,2),h=b[0],O=b[1].loading,x=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,s(""),e.next=4,h({variables:{cohortId:t,registrationQuestion:Object(r.a)(Object(r.a)({},n),{},{id:Object(nr.a)()})}});case 4:u(""),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),s(e.t0.graphQLErrors[0].message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(I.a,{direction:"row",spacing:3,children:[Object(D.jsxs)(Lt,{trigger:Object(D.jsx)(G.a,{variant:"outlined",onClick:function(){return u("text")},size:"small",children:"+ Text Question"}),width:500,title:"Add Registration Question",showSave:!1,showCancel:!0,isOpen:"text"===d,children:[Object(D.jsx)(le,{isOpen:O,title:"Saving..."}),Object(D.jsx)(sr,{registrationQuestion:lr,onSave:x,errorText:c})]}),Object(D.jsxs)(Lt,{trigger:Object(D.jsx)(G.a,{variant:"outlined",onClick:function(){return u("yesNo")},size:"small",children:"+ Yes/No Question"}),width:500,title:"Add Registration Question",showSave:!1,showCancel:!0,isOpen:"yesNo"===d,children:[Object(D.jsx)(le,{isOpen:O,title:"Saving..."}),Object(D.jsx)(sr,{registrationQuestion:dr,onSave:x,errorText:c})]}),Object(D.jsxs)(Lt,{trigger:Object(D.jsx)(G.a,{variant:"outlined",onClick:function(){return u("select")},size:"small",children:"+ Dropdown Question"}),width:500,title:"Add Registration Question",showSave:!1,showCancel:!0,isOpen:"select"===d,children:[Object(D.jsx)(le,{isOpen:O,title:"Saving..."}),Object(D.jsx)(sr,{registrationQuestion:ur,onSave:x,errorText:c})]}),Object(D.jsxs)(Lt,{trigger:Object(D.jsx)(G.a,{variant:"outlined",onClick:function(){return u("likert")},size:"small",children:"+ Likert Scale Question"}),width:500,title:"Add Registration Question",showSave:!1,showCancel:!0,isOpen:"likert"===d,children:[Object(D.jsx)(le,{isOpen:O,title:"Saving..."}),Object(D.jsx)(sr,{registrationQuestion:jr,onSave:x,errorText:c})]})]})})},hr=Object(qe.a)(Fn||(Fn=Object(Me.a)(["\n  mutation UpdateRegistrationQuestion($cohortId: String!, $registrationQuestion: RegistrationQuestionInput!) {\n    updateRegistrationQuestion(cohortId: $cohortId, registrationQuestion: $registrationQuestion) {\n      id\n    }\n  }\n"]))),Or=function(e){var t,n,r=e.cohortId,i=e.registrationQuestion,c=Object(a.useState)(""),s=Object(L.a)(c,2),o=s[0],l=s[1],d={id:i.id,title:i.title,type:i.type,name:i.name,required:i.required,yesNo:i.yesNo,isMultiSelect:i.isMultiSelect,hasOtherOption:i.hasOtherOption,scale:null===(t=i.scale)||void 0===t?void 0:t.map((function(e){return{label:e.label}})),statements:null===(n=i.statements)||void 0===n?void 0:n.map((function(e){return{name:e.name,statement:e.statement}}))};i.options&&(d.options=[],i.options.forEach((function(e){var t;null===d||void 0===d||null===(t=d.options)||void 0===t||t.push({label:e.label,value:e.value})})));var u=Object(a.useState)(!1),j=Object(L.a)(u,2),b=j[0],h=j[1],O=Object(Ze.a)(hr,{refetchQueries:[gn]}),x=Object(L.a)(O,2),m=x[0],p=x[1].loading,v=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,l(""),e.next=4,m({variables:{cohortId:r,registrationQuestion:t}});case 4:h(!1),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),console.info("error: ".concat(JSON.stringify(e.t0))),l(e.t0.graphQLErrors[0].message);case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(Lt,{trigger:Object(D.jsx)(J.a,{title:"Edit ".concat(d.name),children:Object(D.jsx)(qt.a,{sx:{color:"primary.main",cursor:"pointer"},onClick:function(){return h(!0)}})}),width:500,title:"Edit Registration Question",showSave:!1,showCancel:!0,isOpen:b,children:[Object(D.jsx)(le,{isOpen:p,title:"Saving..."}),Object(D.jsx)(sr,{registrationQuestion:d,onSave:v,errorText:o})]})})},xr=Object(qe.a)(Un||(Un=Object(Me.a)(["\n  mutation DeleteRegistrationQuestion($cohortId: String!, $registrationQuestionId: String!) {\n    deleteRegistrationQuestion(cohortId: $cohortId, registrationQuestionId: $registrationQuestionId) {\n      id\n    }\n  }\n"]))),mr=Object(qe.a)(Mn||(Mn=Object(Me.a)(["\n  mutation updateAllRegistrationQuestions($cohortId: String!, $registrationQuestions: [RegistrationQuestionInput!]!) {\n    updateAllRegistrationQuestions(cohortId: $cohortId, registrationQuestions: $registrationQuestions) {\n      id\n    }\n  }\n"]))),pr=["__typename","options","yesNo","statements","scale"],vr=["__typename"],gr=["__typename"],fr=["__typename"],yr=["__typename"],Cr=Object(pn.a)((function(e){return Object(mn.a)({buttonRow:{display:"inline-block"},delete:{color:e.palette.primary.main,cursor:"pointer"}})})),wr=function(e){var t=e.registrationQuestions,n=e.cohortId,i=Cr(),c=Object(a.useState)(""),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(t||[]),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(Ze.a)(xr,{refetchQueries:[gn]}),O=Object(L.a)(h,2),x=O[0],m=O[1].loading,p=Object(Ze.a)(mr,{refetchQueries:[gn]}),v=Object(L.a)(p,2),g=v[0],f=v[1].loading;Object(a.useEffect)((function(){null!==t&&b(t)}),[t,b]);var y=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t&&o.length>0)){e.next=3;break}return e.next=3,x({variables:{cohortId:n,registrationQuestionId:o}});case 3:l("");case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),C=function(e,t){b((function(n){var r=Object(Vn.a)(n),a="up"===t?e-1:e+1,i=[r[a],r[e]];return r[e]=i[0],r[a]=i[1],r}))},w=Object(a.useCallback)((function(){if(!t||!j||t.length!==j.length)return!0;for(var e=0;e<t.length;e++)if(t[e].id!==j[e].id)return!0;return!1}),[t,j]),S=Object(a.useCallback)((function(){b(t||[])}),[t,b]),I=Object(a.useCallback)((function(){var e=j.map((function(e){e.__typename;var t=e.options,n=e.yesNo,a=e.statements,i=e.scale,c=Object(Y.a)(e,pr),s=(null===t||void 0===t?void 0:t.map((function(e){e.__typename;return Object(Y.a)(e,vr)})))||t,o=n?function(e){e.__typename;return Object(Y.a)(e,gr)}(n):n,l=(null===a||void 0===a?void 0:a.map((function(e){e.__typename;return Object(Y.a)(e,fr)})))||a,d=(null===i||void 0===i?void 0:i.map((function(e){e.__typename;return Object(Y.a)(e,yr)})))||i;return Object(r.a)(Object(r.a)({},c),{},{options:s,yesNo:o,statements:l,scale:d})}));g({variables:{cohortId:n,registrationQuestions:e}})}),[j,n,g]);return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:m||f,title:"Saving..."}),Object(D.jsx)(F.a,{when:w(),message:"You have unsaved changes. Are you sure you want to leave?"}),Object(D.jsx)(T,{title:"Cohort Registration Questions"}),Object(D.jsxs)(Q.a,{display:"flex",justifyContent:"space-between",marginBottom:"15px",children:[Object(D.jsx)(br,{cohortId:n}),w()&&Object(D.jsxs)(Q.a,{children:[Object(D.jsx)(G.a,{variant:"contained",onClick:I,children:"Update Sorting"}),Object(D.jsx)(G.a,{style:{marginLeft:10},onClick:S,children:"Discard"})]})]}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{size:"small","aria-label":"simple table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{children:"Sort"}),Object(D.jsx)(ne.a,{children:"Question"}),Object(D.jsx)(ne.a,{align:"center",children:"Name/Export Label"}),Object(D.jsx)(ne.a,{align:"center",children:"Question Type"}),Object(D.jsx)(ne.a,{align:"center",children:"Required"}),Object(D.jsx)(ne.a,{align:"right"})]})}),Object(D.jsx)(ee.a,{children:j&&j.map((function(e,t){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:Object(D.jsx)(Or,{cohortId:n,registrationQuestion:e})}),Object(D.jsx)(ne.a,{children:Object(D.jsxs)(Q.a,{display:"flex",children:[0!==t&&Object(D.jsx)(Jn.a,{fontSize:"small",sx:{cursor:"pointer"},onClick:function(){return C(t,"up")}}),t!==j.length-1&&Object(D.jsx)(Kn.a,{fontSize:"small",sx:{cursor:"pointer"},onClick:function(){return C(t,"down")}})]})}),Object(D.jsx)(ne.a,{children:Object(D.jsx)("div",{dangerouslySetInnerHTML:{__html:e.title}})}),Object(D.jsx)(ne.a,{align:"center",children:e.name}),Object(D.jsx)(ne.a,{align:"center",children:(r=e,"radio"===r.type?"yes/no":r.isMultiSelect?"".concat(r.type,"-multi"):r.type)}),Object(D.jsx)(ne.a,{align:"center",children:e.required?"Yes":"No"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)("div",{className:i.buttonRow,onClick:function(){return l(e.id)},children:Object(D.jsx)(tr,{iconTooltip:"Remove ".concat(e.name," from registration questions?"),dialogTitle:"Remove Registration Question",dialogText:"Are you sure you want to remove the ".concat(e.name," registration question?"),confirmText:"Remove",onClose:y})})})]},"".concat(e.name,"-").concat(t));var r}))})]})})]})},Sr=function(e){var t=function(e){var t={Facilitator:new Set,Presenter:new Set,Panelist:new Set};return null===e||void 0===e||e.forEach((function(e){var n,r,a="".concat(null===e||void 0===e||null===(n=e.user)||void 0===n?void 0:n.firstName," ").concat(null===e||void 0===e||null===(r=e.user)||void 0===r?void 0:r.lastName),i=null===e||void 0===e?void 0:e.credentials,c=i?"".concat(a,", ").concat(i):a;e.sessionsAsFacilitator.length>0&&t.Facilitator.add(c),e.sessionsAsPresenter.length>0&&t.Presenter.add(c),e.sessionsAsPanelist.length>0&&t.Panelist.add(c)})),{Facilitator:Array.from(t.Facilitator),Presenter:Array.from(t.Presenter),Panelist:Array.from(t.Panelist)}}(e.hubTeamMembers||[]),n=function(e){return"Facilitator"===e?"Facilitator(s)":"Presenter"===e?"Presenter(s)":"Panelist(s)"};return Object(D.jsx)(Q.a,{sx:{my:5},children:Object(D.jsx)(X.a,{size:"small",sx:{marginBottom:"10px"},children:Object(D.jsx)(ee.a,{children:Object.keys(t).map((function(e){return Object(D.jsxs)(te.a,{children:[Object(D.jsxs)(ne.a,{component:"th",scope:"row",children:[n(e),":"]}),Object(D.jsx)(ne.a,{align:"right",children:t[e].join("; ")})]},e)}))})})})},Ir=function(e){var t=e.text;return Object(D.jsx)(w.a,{align:"left",variant:"body1",sx:{fontWeight:"bold"},color:"textPrimary",children:t})},kr=function(e){var t=e.label,n=e.value;return Object(D.jsx)(D.Fragment,{children:n&&Object(D.jsxs)(Q.a,{sx:{mb:2},children:[Object(D.jsx)(Ir,{text:t}),Object(D.jsx)(w.a,{variant:"body1",color:"textPrimary",children:Object(D.jsx)("div",{dangerouslySetInnerHTML:{__html:n.replaceAll("&amp;","&")}})})]})})},Ar=Object(qe.a)(qn||(qn=Object(Me.a)(["\n  query GetAttendanceForSession($cohortId: String!, $sessionId: String!) {\n    getAttendanceForSession(cohortId: $cohortId, sessionId: $sessionId) {\n      cohortRegistrationId\n      sessionId\n      userId\n      sessionAttendanceId\n      firstName\n      lastName\n      email\n      credentials\n      organization\n      isPresent\n      notes\n    }\n  }\n"]))),Nr=Object(qe.a)(zn||(zn=Object(Me.a)(["\n  mutation AddOrUpdateCohortAttendance($cohortAttendance: AddOrUpdateCohortAttendanceInput!) {\n    addOrUpdateCohortAttendance(cohortAttendance: $cohortAttendance) {\n      id\n    }\n  }\n"]))),Dr=n(460),Tr=n.n(Dr),Er=n(461),Pr=n.n(Er),Rr=n(422),Lr=n(187),Fr=n(421),Ur=n(420);function Mr(e,t){return t&&t.order?Object(Vn.a)(e).sort((function(e,n){return function(e,t,n,r){var a=function(e,t){var n=e[t];if(null===n)return[1,0];if("Ongoing"===n)return[2,0];if("number"===typeof n)return[3,n];if("string"===typeof n){var r=n.trim().toLowerCase(),a=r.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(a){var i=Object(L.a)(a,4),c=i[1],s=i[2],o=i[3];return[4,parseInt("".concat(o).concat(c).concat(s),10)]}return[5,r]}return[6,""]},i=a(e,n),c=a(t,n);if(i[0]!==c[0])return"asc"===r?i[0]-c[0]:c[0]-i[0];if(i[1]!==c[1]){if("number"===typeof i[1]&&"number"===typeof c[1])return"asc"===r?i[1]-c[1]:c[1]-i[1];if("string"===typeof i[1]&&"string"===typeof c[1])return"asc"===r?i[1].localeCompare(c[1]):c[1].localeCompare(i[1])}return 0}(e,n,t.prop,t.order)})):e}function qr(e,t){return t&&t.order?("asc"===t.order?Rr.a(Lr.a(t.prop)):Fr.a(Ur.a(Lr.a(t.prop))))(e):e}var zr=function(e){var t=e.currentSort,n=e.sortProperty,r=e.headerText,i=e.align,c=e.onSort,s=e.order,o=Object(a.useState)(s),l=Object(L.a)(o,2),d=l[0],u=l[1];return Object(a.useEffect)((function(){t!==n&&u(void 0)}),[t,n,u]),Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(ne.a,{align:i,sx:{color:"primary.main",cursor:"pointer",userSelect:"none",msUserSelect:"none",MozUserSelect:"none",WebkitUserSelect:"none",whiteSpace:"nowrap"},onClick:function(){var e=d?"asc"===d?"desc":void 0:"asc";u(e),null===c||void 0===c||c({prop:n,order:e})},children:[r,t===n&&"asc"===d?Object(D.jsx)(Tr.a,{sx:{fontSize:"16px",verticalAlign:"middle"}}):t===n&&"desc"===d?Object(D.jsx)(Pr.a,{sx:{fontSize:"16px",verticalAlign:"middle"}}):Object(D.jsx)(Q.a,{sx:{display:"inline-block",width:"16px",height:"16px"}})]})})},Hr=Object(pn.a)((function(e){return Object(mn.a)({iconLink:{cursor:"pointer",color:e.palette.primary.main}})})),Wr=function(e){var t=e.cohortId,n=e.sessionId,i=e.sessionName,c=e.sessionStartDate,s=(e.sessionEndDate,Hr()),o=Object(a.useState)(!1),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)(!1),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(a.useState)(),m=Object(L.a)(x,2),p=m[0],v=m[1],g=Object(a.useState)(null),f=Object(L.a)(g,2),y=f[0],C=f[1],w=Object(a.useRef)([]),S=Object(a.useRef)([]),I=Object(B.b)(Ar,{variables:{cohortId:t,sessionId:n}}),k=I.loading,A=(I.error,I.data);Object(a.useEffect)((function(){var e;if(A){var t=(null===(e=A.getAttendanceForSession)||void 0===e?void 0:e.map((function(e){return Object(r.a)(Object(r.a)({},e),{},{name:"".concat(e.firstName," ").concat(e.lastName)})})))||[];C(qr(t,p))}}),[A,p]);var N=Object(Ze.a)(Nr),E=Object(L.a)(N,1)[0],P=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var a,i,c,s,o;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.target.name,i=t.target.checked,y){e.next=4;break}return e.abrupt("return");case 4:O(!0),c=Object(Vn.a)(y),s=0;case 7:if(!(s<c.length)){e.next=14;break}if(c[s].cohortRegistrationId!==a){e.next=11;break}return c[s]=Object(r.a)(Object(r.a)({},c[s]),{},{isPresent:i}),e.abrupt("break",14);case 11:s++,e.next=7;break;case 14:if(C(c),!(o=y.filter((function(e){return e.cohortRegistrationId===a})))){e.next=19;break}return e.next=19,E({variables:{cohortAttendance:{sessionAttendanceId:o[0].sessionAttendanceId,cohortRegistrationId:o[0].cohortRegistrationId,sessionId:n,userId:o[0].userId,present:i,notes:o[0].notes?o[0].notes:""}}});case 19:O(!1);case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,a){var i,c,s,o,l,d;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c="".concat(null===(i=w.current[t])||void 0===i?void 0:i.value),y){e.next=3;break}return e.abrupt("return");case 3:O(!0),s=Object(Vn.a)(y),o=0;case 6:if(!(o<s.length)){e.next=13;break}if(s[o].cohortRegistrationId!==a){e.next=10;break}return s[o]=Object(r.a)(Object(r.a)({},s[o]),{},{notes:c}),e.abrupt("break",13);case 10:o++,e.next=6;break;case 13:if(C(s),!(l=y.filter((function(e){return e.cohortRegistrationId===a})))){e.next=18;break}return e.next=18,E({variables:{cohortAttendance:{sessionAttendanceId:l[0].sessionAttendanceId,cohortRegistrationId:l[0].cohortRegistrationId,sessionId:n,userId:l[0].userId,present:!(!l[0]||!l[0].isPresent)&&l[0].isPresent,notes:c||""}}});case 18:S.current&&S.current[t]&&null!==(d=S.current[t])&&(d.style.display="none"),O(!1);case 20:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),F=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,a){var i,c,s,o,l;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(y){e.next=2;break}return e.abrupt("return");case 2:O(!0),w.current&&w.current[t]&&null!==(i=w.current[t])&&(i.value=""),c=Object(Vn.a)(y),s=0;case 6:if(!(s<c.length)){e.next=13;break}if(c[s].cohortRegistrationId!==a){e.next=10;break}return c[s]=Object(r.a)(Object(r.a)({},c[s]),{},{notes:""}),e.abrupt("break",13);case 10:s++,e.next=6;break;case 13:if(C(c),!(o=y.filter((function(e){return e.cohortRegistrationId===a})))){e.next=18;break}return e.next=18,E({variables:{cohortAttendance:{sessionAttendanceId:o[0].sessionAttendanceId,cohortRegistrationId:o[0].cohortRegistrationId,sessionId:n,userId:o[0].userId,present:!(!o[0]||!o[0].isPresent)&&o[0].isPresent,notes:""}}});case 18:S.current&&S.current[t]&&null!==(l=S.current[t])&&(l.style.display="none"),O(!1);case 20:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{title:"Loading",isOpen:k||h}),Object(D.jsx)("span",{className:s.iconLink,onClick:function(){return u(!0)},children:"Attendance"}),Object(D.jsxs)(ie.a,{fullScreen:!0,open:d,children:[Object(D.jsxs)(ce.a,{sx:{textAlign:"center"},children:[Object(D.jsx)(T,{title:i}),Object(D.jsx)(T,{title:"Session: ".concat(ke(c,!0,!1,!1))})]}),Object(D.jsxs)(se.a,{children:[Object(D.jsx)(G.a,{variant:"contained",color:"primary",size:"small",onClick:function(){return u(!1)},children:"Close"}),Object(D.jsx)(K.a,{sx:{mt:3},component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{sx:{position:"sticky",top:0,backgroundColor:"#fff",zIndex:10},children:[Object(D.jsx)(ne.a,{align:"center",children:"Present"}),Object(D.jsx)(zr,{currentSort:null===p||void 0===p?void 0:p.prop,onSort:v,sortProperty:"name",headerText:"Attendee"}),Object(D.jsx)(ne.a,{children:"Credentials"}),Object(D.jsx)(ne.a,{children:"Organization"}),Object(D.jsx)(ne.a,{children:"Notes"})]})}),Object(D.jsx)(ee.a,{children:y&&y.map((function(e,t){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{align:"center",children:Object(D.jsx)(Vt.a,{name:e.cohortRegistrationId,onChange:P,checked:!!e.isPresent&&e.isPresent})}),Object(D.jsx)(ne.a,{component:"th",scope:"row",children:Object(D.jsx)(Wt,{userId:e.userId,name:"".concat(e.firstName," ").concat(e.lastName),email:e.email})}),Object(D.jsx)(ne.a,{children:e.credentials}),Object(D.jsx)(ne.a,{children:e.organization}),Object(D.jsxs)(ne.a,{children:[Object(D.jsx)(It.a,{sx:{width:350,mb:3},label:"",name:"notes".concat(t),defaultValue:e.notes,variant:"outlined",color:"warning",inputRef:function(e){w.current[t]=e},onFocus:function(){if(S.current&&S.current[t]){var e=S.current[t];null!==e&&(e.style.display="inline")}},onClick:function(){if(S.current&&S.current[t]){var e=S.current[t];null!==e&&(e.style.display="inline")}}}),Object(D.jsx)("br",{}),Object(D.jsxs)("div",{ref:function(e){return S.current[t]=e},style:{display:"none"},children:[Object(D.jsx)(G.a,{onClick:function(n){return R(t,e.cohortRegistrationId)},color:"primary",variant:"contained",children:"Add/Update"}),"\xa0\xa0\xa0",Object(D.jsx)(G.a,{onClick:function(n){return F(t,e.cohortRegistrationId)},color:"primary",variant:"contained",children:"Clear"}),"\xa0\xa0\xa0",Object(D.jsx)(G.a,{color:"primary",variant:"outlined",onClick:function(){if(S.current&&S.current[t]){var e=S.current[t];null!==e&&(e.style.display="none")}},children:"Cancel"})]})]},t)]},e.cohortRegistrationId)}))})]})})]})]})]})},Yr=function(e){var t=e.cohortId,n=e.cohortDashboard;e.refetchDashboard;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Ir,{text:"Upcoming Sessions"}),Object(D.jsx)(X.a,{size:"small",children:Object(D.jsx)(ee.a,{children:n.sessions&&n.sessions.map((function(e){var n,r,a;return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{children:ke(e.startDate,!0,!1,!1)}),Object(D.jsx)(ne.a,{children:ke(e.endDate,!0,!1,!0)}),Object(D.jsxs)(ne.a,{children:[e.number," - ",e.title]}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Wr,{cohortId:t,sessionId:e.id,sessionName:null!==(n=e.title)&&void 0!==n?n:"",sessionStartDate:null!==(r=e.startDate)&&void 0!==r?r:"",sessionEndDate:null!==(a=e.endDate)&&void 0!==a?a:""})})]},e.id)}))})})]})},Br=function(e){var t=e.label,n=e.link;return Object(D.jsx)(D.Fragment,{children:n&&Object(D.jsx)(Q.a,{sx:{mb:1},children:Object(D.jsxs)(w.a,{variant:"body1",color:"textPrimary",children:[t," ",Object(D.jsx)(Z.a,{href:n,children:n})]})})})},Qr=n(103),$r=n.n(Qr),Vr=function(e){var t=e.cohortId,n=e.cohortDashboard,r=null===n||void 0===n?void 0:n.registrationOpenDate,a=null===n||void 0===n?void 0:n.registrationCloseDate,i=$r()();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Ir,{text:"Quick Links"}),r&&r.length&&$r()(r).subtract(1,"day").isBefore(Ue())&&Object(D.jsx)(Br,{label:"Learner Cohort Details",link:"/cohortDetails/".concat(t)}),Object(D.jsx)(Br,{label:"Video Conference",link:n.meetingLink}),a&&a.length&&$r()(a).add(1,"day").isBefore(i)||r&&r.length&&$r()(r).isAfter(i)?Object(D.jsx)(kr,{label:"",value:"Registration is currently closed"}):Object(D.jsx)(Br,{label:"Registration",link:"/registration/".concat(t)}),Object(D.jsx)(Br,{label:"Case Form",link:n.caseFormLink}),Object(D.jsx)(Br,{label:"Survey",link:n.surveyLink})]})},Gr=function(e){var t=e.cohortDashboard;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Ir,{text:"Registrant Summary"}),Object(D.jsx)(X.a,{size:"small",children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Pre-Registrants"}),Object(D.jsx)(ne.a,{align:"right",children:t.preRegistrantCount})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"New Registrants"}),Object(D.jsx)(ne.a,{align:"right",children:t.newRegistrantCount})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Registered"}),Object(D.jsx)(ne.a,{align:"right",children:t.registeredCount})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Waitlisted"}),Object(D.jsx)(ne.a,{align:"right",children:t.waitlistedCount})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{children:"Denied"}),Object(D.jsx)(ne.a,{align:"right",children:t.deniedCount})]})]})})]})},Jr=function(e){var t=e.development,n=e.implementation,r=e.evaluation,a=e.developmentSupportUser,i=e.implementationSupportUser,c=e.evaluationSupportUser;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Ir,{text:"ECHO Team Leads"}),Object(D.jsx)(X.a,{size:"small",sx:{marginBottom:"10px"},children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Development"}),Object(D.jsx)(ne.a,{align:"right",children:t&&Object(D.jsx)(Wt,{userId:t.id,name:"".concat(t.firstName," ").concat(t.lastName),email:t.email})})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{children:"Implementation"}),Object(D.jsx)(ne.a,{align:"right",children:n&&Object(D.jsx)(Wt,{userId:n.id,name:"".concat(n.firstName," ").concat(n.lastName),email:n.email})})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Evaluation"}),Object(D.jsx)(ne.a,{align:"right",children:r&&Object(D.jsx)(Wt,{userId:r.id,name:"".concat(r.firstName," ").concat(r.lastName),email:r.email})})]})]})}),Object(D.jsx)(Ir,{text:"ECHO Support Team"}),Object(D.jsx)(X.a,{size:"small",children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Development"}),Object(D.jsx)(ne.a,{align:"right",children:null===a||void 0===a?void 0:a.map((function(e,t){return 0===t?"".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName):", ".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName)}))})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{children:"Implementation"}),Object(D.jsx)(ne.a,{align:"right",children:null===i||void 0===i?void 0:i.map((function(e,t){return 0===t?"".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName):", ".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName)}))})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Evaluation"}),Object(D.jsx)(ne.a,{align:"right",children:null===c||void 0===c?void 0:c.map((function(e,t){return 0===t?"".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName):", ".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName)}))})]})]})})]})},Zr=n(156),Kr=n.n(Zr),_r=n(160),Xr=n.n(_r),ea=n(462),ta=n.n(ea),na=Object(x.h)();function ra(e){return aa.apply(this,arguments)}function aa(){return(aa=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca(x.j+"/exportAccountsNoRegistration","Accounts No Registration_".concat(ue()().format("MM_DD_YYYY_HHmmss"),".xlsx"),t);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ia(e){return ca.apply(this,arguments)}function ca(){return(ca=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca(x.j+"/exportRegistrants","All Registrants_".concat(ue()().format("MM_DD_YYYY_HHmmss"),".xlsx"),t);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sa(e,t){return oa.apply(this,arguments)}function oa(){return(oa=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca("".concat(x.j,"/evaluationExport?exportType=").concat(t),"Evaluation-All_".concat(ue()().format("MM_DD_YYYY_HHmmss"),".xlsx"),n);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function la(e,t){return da.apply(this,arguments)}function da(){return(da=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca("".concat(x.j,"/exportSessionICS?sessionId=").concat(t),"CalendarInvite_".concat(ue()().format("MM_DD_YYYY_HHmmss"),".ics"),n);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ua(e,t,n){return ja.apply(this,arguments)}function ja(){return(ja=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n,r){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca("".concat(x.j,"/exportAttendance?cohortId=").concat(t),"Attendance-".concat(n,"_").concat(ue()().format("MM_DD_YYYY_HHmmss"),".xlsx"),r);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ba(e,t,n,r){return ha.apply(this,arguments)}function ha(){return(ha=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n,r,a){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca("".concat(x.j,"/evaluationExport?cohortId=").concat(t,"&exportType=").concat(r),"Evaluation-".concat(n,"_").concat(ue()().format("MM_DD_YYYY_HHmmss"),".xlsx"),a);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oa(e,t,n){return xa.apply(this,arguments)}function xa(){return(xa=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n,r){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca("".concat(x.j,"/exportPreRegistrant?cohortId=").concat(t),"PreRegistrants-".concat(n,"_").concat(ue()().format("MM_DD_YYYY_HHmmss"),".xlsx"),r);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ma(e,t,n){return pa.apply(this,arguments)}function pa(){return(pa=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n,r){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ca("".concat(x.j,"/exportRegistrants?cohortId=").concat(t),"Cohort Registrants-".concat(n,"_").concat(ue()().format("MM_DD_YYYY_HHmmss"),".xlsx"),r);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var va,ga,fa,ya,Ca=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n,r){var a,i,c;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a={tenant:na,"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"},e.prev=1,r(!0),e.next=5,Xr.a.get(t,{responseType:"blob",headers:a,withCredentials:!0});case 5:i=e.sent,c=i.data,ta()(c,n),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(1),console.error(e.t0.message);case 13:return e.prev=13,r(!1),e.finish(13);case 16:case"end":return e.stop()}}),e,null,[[1,10,13,16]])})));return function(t,n,r){return e.apply(this,arguments)}}(),wa=function(e){var t=e.onClick;return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(Kr.a,{onClick:t,sx:{cursor:"pointer",color:"primary.main"}})})},Sa=function(e){var t=e.cohortId,n=e.internalLabel,r=e.onExportStart;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Ir,{text:"Data Exports"}),Object(D.jsx)(X.a,{size:"small",children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Attendance"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(wa,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ua(t,n,r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Registrants (Coordinators)"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(wa,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ma(t,n,r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Registrants with Labels (Evaluators)"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(wa,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ba(t,n,"label",r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:"Registrants with Values (Evaluators)"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(wa,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ba(t,n,"value",r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]})]})})]})},Ia="GetMembersByCohort",ka=Object(qe.a)(va||(va=Object(Me.a)(["\n  query GetMembersByCohort($cohortId: String!) {\n    getMembersByCohort(cohortId: $cohortId) {\n      id\n      userId\n      cohortId\n      nextStepsSentDate\n      user {\n        firstName\n        lastName\n        email\n      }\n      facilitateAll\n      presentAll\n      panelistAll\n      sessionsAsFacilitator\n      sessionsAsPresenter\n      sessionsAsPanelist\n      credentials\n      hide\n    }\n  }\n"]))),Aa=function(e){var t,n,r,i=e.cohortId,c=Object(a.useState)(),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(!1),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(B.b)(Tn,{variables:{cohortId:i}}),O=h.loading,x=h.data,m=h.refetch,p=Object(B.b)(ka,{variables:{cohortId:i}}),v=(p.loading,p.data),g=null!==(t=null===v||void 0===v?void 0:v.getMembersByCohort)&&void 0!==t?t:[];return Object(a.useEffect)((function(){!O&&x&&l(x.getCohortDashboard)}),[x,O]),Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:O,title:"Loading..."}),Object(D.jsx)(le,{isOpen:j,title:"Processing Excel export..."}),o&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:null!==(n=o.internalTitle)&&void 0!==n?n:""}),Object(D.jsx)(Q.a,{children:Object(D.jsxs)(N.a,{container:!0,spacing:3,children:[Object(D.jsxs)(N.a,{item:!0,xs:7,children:[Object(D.jsx)(kr,{label:"External Title",value:o.externalTitle}),Object(D.jsx)(kr,{label:"Project Partner(s)",value:o.partnerName}),Object(D.jsx)(kr,{label:"Goal",value:o.evaluationGoal}),Object(D.jsx)(kr,{label:"Learning Objectives/Outcomes",value:o.learningObjectives}),Object(D.jsx)(kr,{label:"Audience",value:o.audience}),Object(D.jsx)(xe.a,{sx:{mb:2}}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsxs)(N.a,{item:!0,xs:6,children:[Object(D.jsx)(kr,{label:"Registration Open Date",value:ke(o.registrationOpenDate)}),Object(D.jsx)(kr,{label:"Registration Close Date",value:o.isOngoing?"Ongoing":ke(o.registrationCloseDate)})]}),Object(D.jsxs)(N.a,{item:!0,xs:6,children:[Object(D.jsx)(kr,{label:"Start Date",value:ke(o.startDate,!1)}),Object(D.jsx)(kr,{label:"End Date",value:o.isOngoing?"Ongoing":ke(o.endDate,!1)})]})]}),Object(D.jsx)(xe.a,{sx:{mb:2}}),Object(D.jsx)(Yr,{cohortId:i,cohortDashboard:o,refetchDashboard:m})]}),Object(D.jsxs)(N.a,{item:!0,xs:5,children:[Object(D.jsx)(Vr,{cohortId:i,cohortDashboard:o}),Object(D.jsx)(xe.a,{sx:{mb:2}}),Object(D.jsx)(Gr,{cohortDashboard:o}),Object(D.jsx)(xe.a,{sx:{mb:2}}),Object(D.jsx)(Jr,{development:o.developmentUser,implementation:o.implementationUser,evaluation:o.evaluationUser,developmentSupportUser:o.developmentSupportUser,implementationSupportUser:o.implementationSupportUser,evaluationSupportUser:o.evaluationSupportUser}),Object(D.jsx)(Sr,{hubTeamMembers:g}),Object(D.jsx)(Sa,{cohortId:i,internalLabel:null!==(r=o.internalTitle)&&void 0!==r?r:"",onExportStart:b})]})]})})]})]})},Na="GetSessionsByCohort",Da=Object(qe.a)(ga||(ga=Object(Me.a)(["\n  query GetSessionsByCohort($cohortId: String!) {\n    getSessionsByCohort(cohortId: $cohortId) {\n      id\n      cohortId\n      number\n      title\n      startDate\n      endDate\n      active\n      learningOutcomes\n      presenterNotes\n      facultyNotes\n      isFuture\n    }\n  }\n"]))),Ta=Object(qe.a)(fa||(fa=Object(Me.a)(["\n  mutation UpdateSession($session: UpdateSessionInput!) {\n    updateSession(session: $session) {\n      id\n    }\n  }\n"]))),Ea=n(127),Pa=n.n(Ea),Ra=Object(qe.a)(ya||(ya=Object(Me.a)(["\n  mutation AddSession($session: AddSessionInput!) {\n    addSession(session: $session) {\n      id\n    }\n  }\n"]))),La=function(e){var t=e.cohortId,n=Object(a.useRef)(null),i=Object(a.useRef)(null),c=Object(a.useRef)(null),s=Object(a.useRef)(null),o=Object(a.useState)(!1),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)(!1),b=Object(L.a)(j,2),h=b[0],O=b[1],m=Object(a.useState)(!1),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)({cohortId:t,number:null,title:"",startDate:new Date,endDate:new Date,active:!0,learningOutcomes:"",presenterNotes:"",facultyNotes:"",sendCalendarInvites:!1}),y=Object(L.a)(f,2),C=y[0],S=y[1],I=Ne(Object(x.h)()),k=new Date,A=new Date(k.getFullYear(),0,1).getTimezoneOffset(),N=new Date(k.getFullYear(),6,1).getTimezoneOffset(),T=Math.min(A,N)!==k.getTimezoneOffset(),E=T?Se.a.tz(I).utcOffset()-60:Se.a.tz(I).utcOffset(),P=T?Se.a.tz(Se.a.tz.guess()).utcOffset()-60:Se.a.tz(Se.a.tz.guess()).utcOffset(),R=E>P?"-":"",F=Math.abs(E-P),U=(parseInt("".concat(R).concat(F)),Object(a.useState)(Se()().format("YYYY-MM-DD"))),M=Object(L.a)(U,2),q=M[0],z=M[1],H=Object(a.useState)(Se()().format("HH:mm:ss")),W=Object(L.a)(H,2),Y=W[0],B=W[1],$=Object(a.useState)(Se()().add(1,"hours").format("YYYY-MM-DD")),V=Object(L.a)($,2),Z=V[0],K=V[1],_=Object(a.useState)(Se()().add(1,"hours").format("HH:mm:ss")),X=Object(L.a)(_,2),ee=X[0],te=X[1],ne=Object(Ze.a)(Ra,{variables:{session:C},refetchQueries:[Na]}),re=Object(L.a)(ne,2),ae=re[0],ie=re[1],ce=ie.loading,se=ie.error;Object(a.useEffect)((function(){O(ce)}),[ce]);var oe=function(e){var t=e.target.value,n=e.target.name;S("number"===n?Object(r.a)(Object(r.a)({},C),{},Object(Tt.a)({},n,Number(t))):Object(r.a)(Object(r.a)({},C),{},Object(Tt.a)({},n,t)))},de=function(){var e,t=!0;return g(!1),null!==C.title&&0!==(null===(e=C.title)||void 0===e?void 0:e.length)||(g(!0),t=!1),t},ue=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,r,a,o,l,d,j,b,h,O;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,de()){e.next=3;break}return e.abrupt("return");case 3:return l=(null===n||void 0===n||null===(t=n.current)||void 0===t?void 0:t.value)||"",d=(null===i||void 0===i||null===(r=i.current)||void 0===r?void 0:r.value)||"",j=(null===c||void 0===c||null===(a=c.current)||void 0===a?void 0:a.value)||"",b=(null===s||void 0===s||null===(o=s.current)||void 0===o?void 0:o.value)||"",h=Se()("".concat(l).concat(d),"YYYY-MM-DD HH:mm",I),O=Se()("".concat(j).concat(b),"YYYY-MM-DD HH:mm",I),C.startDate=new Date("".concat(h.format("YYYY-MM-DD"),"T").concat(h.format("HH:mm:ss"),".000Z")),C.endDate=new Date("".concat(O.format("YYYY-MM-DD"),"T").concat(O.format("HH:mm:ss"),".000Z")),e.next=13,ae();case 13:u(!1),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(0),console.error(e.t0);case 19:case"end":return e.stop()}}),e,null,[[0,16]])})));return function(){return e.apply(this,arguments)}}(),je=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u(!1);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)("div",{children:Object(D.jsxs)(G.a,{onClick:function(){return u(!0)},variant:"outlined",color:"primary",children:[Object(D.jsx)(rr.c,{}),"\xa0 Add New Session"]})}),Object(D.jsxs)(Pt.a,{anchor:"right",open:d,onClose:function(){return u(!1)},children:[Object(D.jsx)(w.a,{sx:{marginTop:3,marginBottom:3,textAlign:"center"},variant:"h5",color:"primary",children:"Add New Session"}),se&&Object(D.jsx)(me.a,{sx:{mb:2},severity:"error",children:se}),Object(D.jsxs)(Q.a,{sx:{width:400,ml:2},children:[Object(D.jsx)(It.a,{sx:{width:350,mb:3},label:"Session Number",name:"number",type:"number",variant:"outlined",onChange:oe,color:"warning"}),Object(D.jsx)(It.a,{sx:{width:350,mb:3},label:"Title",name:"title",variant:"outlined",error:v,helperText:"Required",onChange:oe,color:"warning"}),Object(D.jsxs)(Q.a,{sx:{width:350,mb:3},children:[Object(D.jsxs)("div",{style:{display:"flex"},children:[Object(D.jsx)(It.a,{sx:{mb:3},type:"date",id:"startDate",name:"startDate",inputRef:n,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;z(t)}},value:q,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Session Start Date",color:"warning"}),Object(D.jsx)(It.a,{sx:{mb:3},type:"time",id:"startTime",name:"startstartTimeDate",inputRef:i,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;B(t)}else console.log("startTime")},value:Y.substring(0,5),style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Time",color:"warning"})]}),Object(D.jsxs)("div",{style:{display:"flex"},children:[Object(D.jsx)(It.a,{sx:{mb:3},type:"date",id:"endDate",name:"endDate",inputRef:c,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;K(t)}},value:Z,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Session End Date",color:"warning"}),Object(D.jsx)(It.a,{sx:{mb:3},type:"time",id:"endTime",name:"endTime",inputRef:s,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;te(t)}else console.log("endTime")},value:ee.substring(0,5),style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Time",color:"warning"})]}),Object(D.jsx)(me.a,{sx:{mt:2},severity:"info",children:"Note: These times are in the organization's local timezone."})]}),Object(D.jsxs)("div",{children:[Object(D.jsx)(J.a,{title:"This will send calendar invites for the session to all registered learners",children:Object(D.jsx)(Pa.a,{sx:{fontSize:"16px",mr:2,color:"primary.main"}})}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{color:"primary",checked:C.sendCalendarInvites,onChange:function(e){S(Object(r.a)(Object(r.a)({},C),{},{sendCalendarInvites:e.target.checked}))}}),label:"Send Calendar Invites for this Session"})]}),Object(D.jsxs)(Q.a,{sx:{mt:3,marginLeft:2,textAlign:"center"},children:[Object(D.jsx)(G.a,{onClick:ue,color:"primary",variant:"contained",children:"Add"}),"\xa0\xa0\xa0",Object(D.jsx)(G.a,{onClick:je,color:"primary",variant:"outlined",children:"Cancel"})]})]})]}),Object(D.jsx)(le,{isOpen:h,title:"Saving Session"})]})},Fa=n(130),Ua=n(188),Ma=n(463),qa=n(502),za=n(76),Ha=n.n(za),Wa=n(464),Ya=n.n(Wa),Ba=function(e){Object(Ma.a)(n,e);var t=Object(qa.a)(n);function n(){return Object(Ua.a)(this,n),t.apply(this,arguments)}return Object(Fa.a)(n)}(za.Quill.import("blots/block"));Ba.tagName="DIV",za.Quill.register("blots/block",Ba,!0),za.Quill.register("modules/htmlSource",Ya.a);var Qa=za.Quill.import("formats/size");Qa.whitelist=["extra-small","small","medium","large"],za.Quill.register(Qa,!0);var $a=za.Quill.import("formats/font");$a.whitelist=["arial","comic-sans","courier-new","georgia","helvetica","lucida"],za.Quill.register($a,!0);var Va=["header","font","size","bold","italic","underline","align","strike","script","blockquote","background","list","bullet","indent","link","image","color","code-block"],Ga=function(e){var t=e.name;return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)("div",{id:t,children:[Object(D.jsxs)("span",{className:"ql-formats",children:[Object(D.jsxs)("select",{className:"ql-font",defaultValue:"arial",children:[Object(D.jsx)("option",{value:"arial",children:"Arial"}),Object(D.jsx)("option",{value:"comic-sans",children:"Comic Sans"}),Object(D.jsx)("option",{value:"courier-new",children:"Courier New"}),Object(D.jsx)("option",{value:"georgia",children:"Georgia"}),Object(D.jsx)("option",{value:"helvetica",children:"Helvetica"}),Object(D.jsx)("option",{value:"lucida",children:"Lucida"})]}),Object(D.jsxs)("select",{className:"ql-header",defaultValue:"3",children:[Object(D.jsx)("option",{value:"1",children:"Heading"}),Object(D.jsx)("option",{value:"2",children:"Subheading"}),Object(D.jsx)("option",{value:"3",children:"Normal"})]})]}),Object(D.jsxs)("span",{className:"ql-formats",children:[Object(D.jsx)("button",{className:"ql-bold",title:"Bold"}),Object(D.jsx)("button",{className:"ql-italic",title:"Italic"}),Object(D.jsx)("button",{className:"ql-underline",title:"Underline"}),Object(D.jsx)("button",{className:"ql-strike",title:"Strikethrough"})]}),Object(D.jsxs)("span",{className:"ql-formats",children:[Object(D.jsx)("button",{className:"ql-list",value:"ordered",title:"Numbered List"}),Object(D.jsx)("button",{className:"ql-list",value:"bullet",title:"Bullet List"}),Object(D.jsx)("button",{className:"ql-indent",value:"-1",title:"Decrease Indent"}),Object(D.jsx)("button",{className:"ql-indent",value:"+1",title:"Increase Indent"})]}),Object(D.jsxs)("span",{className:"ql-formats",children:[Object(D.jsx)("button",{className:"ql-blockquote",title:"Blockquote"}),Object(D.jsx)("select",{className:"ql-color",title:"Text Color"}),Object(D.jsx)("button",{className:"ql-link",title:"Insert Link"})]})]})})},Ja=n(76),Za=function(e){var t=e.name,n=e.onChange,r=e.value,a=e.title,i=e.style;return Object(D.jsxs)(D.Fragment,{children:[a&&Object(D.jsx)("strong",{children:a}),Object(D.jsx)(Ga,{name:"toolbar-"+t}),Object(D.jsx)(Ja,{theme:"snow",id:t,value:r,style:i,onChange:function(e){return n(t,e)},modules:{toolbar:{container:"#toolbar-"+t}},formats:Va})]})};ue.a.extend(fe.a),ue.a.extend(Ce.a);var Ka=function(e){var t=e.sessionId,n=e.sessionCohortId,i=e.sessionNumber,c=e.sessionTitle,s=e.sessionSartDate,o=e.sEndDate,l=e.sessionActive,d=e.sessionLearningOutcomes,u=e.sessionPresenterNotes,j=e.sessionFacultyNotes,b=Object(a.useRef)(null),h=Object(a.useRef)(null),O=Object(a.useRef)(null),m=Object(a.useRef)(null),p=Object(a.useState)(!1),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)({__typename:"Session",id:t,cohortId:n,number:i,title:"".concat(c),startDate:s,endDate:o,active:!!l,learningOutcomes:"".concat(d),presenterNotes:"".concat(u),facultyNotes:"".concat(j),isFuture:!1}),C=Object(L.a)(y,2),w=C[0],S=C[1],k=Object(a.useState)(!1),A=Object(L.a)(k,2),N=A[0],E=A[1],P=Object(a.useState)(!1),R=Object(L.a)(P,2),F=R[0],U=R[1],M=Object(Ze.a)(Ta,{refetchQueries:[Na]}),q=Object(L.a)(M,2),z=q[0],H=q[1],W=H.loading,Y=H.error,B=Ne(Object(x.h)()),$=new Date,V=new Date($.getFullYear(),0,1).getTimezoneOffset(),Z=new Date($.getFullYear(),6,1).getTimezoneOffset(),K=Math.min(V,Z)!==$.getTimezoneOffset(),_=K?Se.a.tz(B).utcOffset()-60:Se.a.tz(B).utcOffset(),X=K?Se.a.tz(Se.a.tz.guess()).utcOffset()-60:Se.a.tz(Se.a.tz.guess()).utcOffset(),ee=_>X?"-":"",te=Math.abs(_-X),ne=(parseInt("".concat(ee).concat(te)),ue()(w.startDate).utc()),re=ue()(w.endDate).utc(),ae=Object(a.useState)(ne.format("YYYY-MM-DD")),ce=Object(L.a)(ae,2),oe=ce[0],de=ce[1],je=Object(a.useState)(ne.format("HH:mm:ss")),be=Object(L.a)(je,2),Oe=be[0],xe=be[1],pe=Object(a.useState)(re.format("YYYY-MM-DD")),ve=Object(L.a)(pe,2),ge=ve[0],fe=ve[1],ye=Object(a.useState)(re.format("HH:mm:ss")),Ce=Object(L.a)(ye,2),we=Ce[0],Ie=Ce[1],ke=function(e){var t=e.target.value,n=e.target.name;S("number"===n?Object(r.a)(Object(r.a)({},w),{},Object(Tt.a)({},n,Number(t))):Object(r.a)(Object(r.a)({},w),{},Object(Tt.a)({},n,t)))},Ae=function(e,t){S(Object(r.a)(Object(r.a)({},w),{},Object(Tt.a)({},e,t)))},De=function(){var e,t=!0;return E(!1),null!==w.title&&0!==(null===(e=w.title)||void 0===e?void 0:e.length)||(E(!0),t=!1),t},Te=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,n,r,a,i,c,s,o,l,d,u;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(De()){e.next=2;break}return e.abrupt("return");case 2:return i={id:w.id,cohortId:w.cohortId,number:w.number,title:w.title,startDate:w.startDate,endDate:w.endDate,active:w.active,learningOutcomes:w.learningOutcomes,presenterNotes:w.presenterNotes,facultyNotes:w.facultyNotes,sendCalendarInvites:F},c=(null===b||void 0===b||null===(t=b.current)||void 0===t?void 0:t.value)||"",s=(null===h||void 0===h||null===(n=h.current)||void 0===n?void 0:n.value)||"",o=(null===O||void 0===O||null===(r=O.current)||void 0===r?void 0:r.value)||"",l=(null===m||void 0===m||null===(a=m.current)||void 0===a?void 0:a.value)||"",d=Se()("".concat(c).concat(s),"YYYY-MM-DD HH:mm",B),u=Se()("".concat(o).concat(l),"YYYY-MM-DD HH:mm",B),i.startDate=new Date("".concat(d.format("YYYY-MM-DD"),"T").concat(d.format("HH:mm:ss"),".000Z")),i.endDate=new Date("".concat(u.format("YYYY-MM-DD"),"T").concat(u.format("HH:mm:ss"),".000Z")),e.prev=11,e.next=14,z({variables:{session:i}});case 14:e.next=18;break;case 16:e.prev=16,e.t0=e.catch(11);case 18:Y||f(!1);case 19:case"end":return e.stop()}}),e,null,[[11,16]])})));return function(){return e.apply(this,arguments)}}(),Ee=function(){f(!1)};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"Edit Session",children:Object(D.jsx)(qt.a,{onClick:function(){return f(!0)},sx:{color:"primary.main",cursor:"pointer"}})}),Object(D.jsxs)(ie.a,{open:g,onClose:Ee,children:[Object(D.jsxs)(se.a,{children:[Object(D.jsx)(le,{isOpen:W,title:"Saving Session"}),Object(D.jsx)(Q.a,{sx:{textAlign:"center"},children:Object(D.jsx)(T,{title:"Edit Session"})}),Object(D.jsxs)(Q.a,{sx:{width:550},children:[Y&&Object(D.jsx)(me.a,{sx:{mb:2},severity:"error",children:Y}),Object(D.jsxs)(I.a,{sx:{mt:3},spacing:2,children:[Object(D.jsxs)("div",{children:[Object(D.jsx)(J.a,{title:"This will send calendar invites for the session to all registered learners and hub team members",children:Object(D.jsx)(Pa.a,{sx:{fontSize:"16px",mr:2,color:"primary.main"}})}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{color:"primary",checked:F,onChange:function(e){U(e.target.checked)}}),label:"Send Calendar Invites for this Session"})]}),Object(D.jsx)(It.a,{sx:{width:"100%"},name:"title",onChange:ke,variant:"outlined",label:"Title",value:w.title,error:N,helperText:"Required",color:"warning"}),Object(D.jsx)(It.a,{sx:{width:"100%"},name:"number",onChange:ke,variant:"outlined",label:"Session Number",type:"number",color:"warning",value:w.number}),Object(D.jsxs)("div",{style:{display:"flex"},children:[Object(D.jsx)(It.a,{sx:{mb:3},type:"date",id:"startDate",name:"startDate",inputRef:b,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;de(t)}},value:oe,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Session Start Date",color:"warning"}),Object(D.jsx)(It.a,{sx:{mb:3},type:"time",id:"startTime",name:"startstartTimeDate",inputRef:h,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;xe(t)}else console.log("startTime")},value:Oe.substring(0,5),style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Time",color:"warning"})]}),Object(D.jsxs)("div",{style:{display:"flex"},children:[Object(D.jsx)(It.a,{sx:{mb:3},type:"date",id:"endDate",name:"endDate",inputRef:O,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;fe(t)}},value:ge,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Session End Date",color:"warning"}),Object(D.jsx)(It.a,{sx:{mb:3},type:"time",id:"endTime",name:"endTime",inputRef:m,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;Ie(t)}else console.log("endTime")},value:we.substring(0,5),style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Time",color:"warning"})]}),Object(D.jsx)(me.a,{sx:{mt:2},severity:"info",children:"Note: These times are in the organization's local timezone."})]}),Object(D.jsx)(Q.a,{sx:{mt:2},children:Object(D.jsx)(Za,{name:"learningOutcomes",onChange:Ae,value:w.learningOutcomes,title:"Learning Outcomes",style:{height:"200px"}})}),Object(D.jsx)(Q.a,{sx:{mt:8},children:Object(D.jsx)(Za,{name:"presenterNotes",onChange:Ae,value:w.presenterNotes,title:"Presenter Notes",style:{height:"200px"}})}),Object(D.jsx)(Q.a,{sx:{mt:8},children:Object(D.jsx)(Za,{name:"facultyNotes",onChange:Ae,value:w.facultyNotes,title:"Faculty Notes",style:{height:"200px"}})})]})]}),Object(D.jsxs)(he.a,{children:[Object(D.jsx)(G.a,{onClick:Te,variant:"contained",children:"Save"}),Object(D.jsx)(G.a,{onClick:Ee,variant:"outlined",children:"Cancel"})]})]})]})},_a=n(266),Xa=n.n(_a);ue.a.extend(fe.a),ue.a.extend(Ce.a);n(97);var ei,ti,ni,ri,ai,ii,ci,si,oi,li,di,ui,ji,bi,hi,Oi,xi=Object(pn.a)((function(e){return Object(mn.a)({edit:{color:"goldenrod",cursor:"pointer"},delete:{color:e.palette.primary.main,cursor:"pointer"},attendanceLink:{color:e.palette.primary.main}})})),mi=function(e){var t=e.cohortId,n=xi(),r=Object(a.useState)(!1),i=Object(L.a)(r,2),c=i[0],s=i[1],o=Object(a.useState)(null),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)(!1),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(a.useState)(!1),m=Object(L.a)(x,2),p=(m[0],m[1]),v=Object(a.useState)(),g=Object(L.a)(v,2),f=g[0],y=g[1],C=Object(B.b)(Da,{variables:{cohortId:t}}),w=C.loading,S=C.data,I=function(e){var t=e.onClick;return Object(D.jsx)(J.a,{title:"Download .ics (calendar) file",children:Object(D.jsx)(Xa.a,{onClick:t,sx:{cursor:"pointer",color:"primary.main",ml:1}})})},k=Object(Ze.a)(Ta),A=Object(L.a)(k,2),N=A[0],E=A[1].error,P=function(e){if(s(!1),e&&d){var t=d;N({variables:{session:{id:t.id,cohortId:t.cohortId,number:t.number,title:t.title,startDate:t.startDate,endDate:t.endDate,active:!1,learningOutcomes:t.learningOutcomes,presenterNotes:t.presenterNotes,facultyNotes:t.facultyNotes,sendCalendarInvites:!1}},refetchQueries:[Na]})}u(null)};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:w,title:"Loading"}),Object(D.jsx)(T,{title:"Session Management"}),Object(D.jsxs)(Q.a,{sx:{textAlign:"left"},children:[Object(D.jsx)(La,{cohortId:t}),Object(D.jsx)($t.a,{sx:{mb:1},control:Object(D.jsx)(Vt.a,{color:"primary",checked:h,onChange:function(e){O(e.target.checked)},name:"showPastSessions"}),label:"Show Past Sessions"}),E&&Object(D.jsx)(me.a,{sx:{mb:2},severity:"error",children:E}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{size:"small","aria-label":"a dense table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{}),Object(D.jsx)(zr,{currentSort:null===f||void 0===f?void 0:f.prop,onSort:y,sortProperty:"number",headerText:"Session Number"}),Object(D.jsx)(zr,{currentSort:null===f||void 0===f?void 0:f.prop,onSort:y,sortProperty:"title",headerText:"Title"}),Object(D.jsx)(zr,{currentSort:null===f||void 0===f?void 0:f.prop,onSort:y,sortProperty:"startDate",headerText:"Start Date"}),Object(D.jsx)(zr,{currentSort:null===f||void 0===f?void 0:f.prop,onSort:y,sortProperty:"endDate",headerText:"End Date"}),Object(D.jsx)(ne.a,{children:"Attendance"}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:function(){var e,t=S&&null!==(e=S.getSessionsByCohort)&&void 0!==e?e:[],n=t.filter((function(e){return e.isFuture&&e.active}));return qr(h?t:n,f)}().map((function(e,r){var a,i,o;return Object(D.jsxs)(te.a,{children:[Object(D.jsxs)(ne.a,{component:"th",scope:"row",children:[Object(D.jsx)(Ka,{sessionId:e.id,sessionCohortId:e.cohortId,sessionNumber:e.number,sessionTitle:e.title,sessionSartDate:e.startDate,sEndDate:e.endDate,sessionActive:e.active,sessionLearningOutcomes:e.learningOutcomes,sessionPresenterNotes:e.presenterNotes,sessionFacultyNotes:e.facultyNotes}),Object(D.jsx)(I,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function t(){return Object(Ve.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,la(e.id,p);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))})]}),Object(D.jsx)(ne.a,{children:e.number}),Object(D.jsx)(ne.a,{children:e.title}),Object(D.jsx)(ne.a,{children:ke(e.startDate,!0,!1,!1)}),Object(D.jsx)(ne.a,{children:ke(e.endDate,!0,!1,!0)}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Wr,{cohortId:t,sessionId:e.id,sessionName:null!==(a=e.title)&&void 0!==a?a:"",sessionStartDate:null!==(i=e.startDate)&&void 0!==i?i:"",sessionEndDate:null!==(o=e.endDate)&&void 0!==o?o:""})}),Object(D.jsxs)(ne.a,{children:[Object(D.jsx)(rr.d,{title:"Delete Session",className:n.delete,onClick:function(){return function(e){u(e),s(!0)}(e)}}),Object(D.jsx)(er,{dialogTitle:"Delete Session",confirmText:"Delete",dialogText:"Are you sure you want to delete this session?",open:c,onClose:P})]})]},e.id)}))})]})})]})]})},pi=n(465),vi=Object(qe.a)(ei||(ei=Object(Me.a)(["\n  mutation SendInvitationToPreRegistrant($preRegistrantId: String!) {\n    sendInvitationToPreRegistrant(preRegistrantId: $preRegistrantId)\n  }\n"]))),gi=Object(qe.a)(ti||(ti=Object(Me.a)(["\n  mutation SendInvitationToAllPreRegistrants($cohortId: String!) {\n    sendInvitationToAllPreRegistrants(cohortId: $cohortId)\n  }\n"]))),fi="GetPreRegistrantsForCohort",yi=Object(qe.a)(ni||(ni=Object(Me.a)(["\n  query GetPreRegistrantsForCohort($cohortId: String!) {\n    getPreRegistrantsForCohort(cohortId: $cohortId) {\n      id\n      cohortId\n      userId\n      email\n      emailSent\n      firstName\n      lastName\n      organization\n      profession\n      createdAt\n      user {\n        firstName\n        lastName\n        email\n        organization\n        profession {\n          name\n        }\n      }\n    }\n  }\n"]))),Ci={prop:"email",order:"asc"},wi=function(e){var t=e.cohortId,n=e.internalLabel,i=e.preRegistrants,c=Object(a.useState)(!1),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(Ci),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(Ze.a)(vi),O=Object(L.a)(h,2),x=O[0],m=O[1].loading,p=Object(Ze.a)(gi),v=Object(L.a)(p,2),g=v[0],f=v[1].loading,y=Object(a.useMemo)((function(){return i.map((function(e){var t;return e.user?Object(r.a)(Object(r.a)({},e),{},{fullName:"".concat(e.user.lastName,", ").concat(e.user.firstName),email:e.user.email,organization:e.user.organization,profession:null===(t=e.user.profession)||void 0===t?void 0:t.name}):Object(r.a)(Object(r.a)({},e),{},{fullName:"".concat(e.lastName,", ").concat(e.firstName),email:e.email,organization:e.organization,profession:e.profession})}))}),[i]),C=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g({variables:{cohortId:t},refetchQueries:[fi]});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),w=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x({variables:{preRegistrantId:t},refetchQueries:[fi]});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:m||f,title:"Sending..."}),Object(D.jsx)(le,{isOpen:o,title:"Processing Excel export..."}),Object(D.jsxs)(I.a,{direction:"row",spacing:3,sx:{mb:3},children:[Object(D.jsx)(G.a,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Oa(t,null!==n&&void 0!==n?n:"",l));case 1:case"end":return e.stop()}}),e)}))),variant:"outlined",startIcon:Object(D.jsx)(pi.a,{}),children:"Download Pre-Registrants"}),Object(D.jsx)(G.a,{onClick:C,variant:"outlined",startIcon:Object(D.jsx)(rr.b,{}),children:"Send Registration Email to All"})]}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{size:"small","aria-label":"a dense table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(zr,{currentSort:null===j||void 0===j?void 0:j.prop,onSort:b,sortProperty:"fullName",headerText:"Name",order:null===j||void 0===j?void 0:j.order}),Object(D.jsx)(zr,{currentSort:null===j||void 0===j?void 0:j.prop,onSort:b,sortProperty:"email",headerText:"Email",order:null===j||void 0===j?void 0:j.order}),Object(D.jsx)(zr,{currentSort:null===j||void 0===j?void 0:j.prop,onSort:b,sortProperty:"organization",headerText:"Organization",order:null===j||void 0===j?void 0:j.order}),Object(D.jsx)(zr,{currentSort:null===j||void 0===j?void 0:j.prop,onSort:b,sortProperty:"profession",headerText:"Profession",order:null===j||void 0===j?void 0:j.order}),Object(D.jsx)(zr,{currentSort:null===j||void 0===j?void 0:j.prop,onSort:b,sortProperty:"createdAt",headerText:"Registration Date",order:null===j||void 0===j?void 0:j.order}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:y&&Mr(y,j.order?j:Ci).map((function(e){return Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:e.fullName}),Object(D.jsx)(ne.a,{children:e.email}),Object(D.jsx)(ne.a,{children:e.organization}),Object(D.jsx)(ne.a,{children:e.profession}),Object(D.jsx)(ne.a,{children:ke(e.createdAt)}),Object(D.jsxs)(ne.a,{children:[e.emailSent&&Object(D.jsx)("div",{children:"Registration Email Sent"}),!e.emailSent&&Object(D.jsx)(G.a,{onClick:function(){return w(e.id)},variant:"outlined",color:"primary",size:"small",children:"Send Registration Email"})]})]},e.id)}))})]})})]})},Si=n(51),Ii=n(1002),ki=n(958),Ai=n(469),Ni=n.n(Ai),Di=n(333),Ti=n.n(Di),Ei=n(335),Pi=n.n(Ei),Ri=n(334),Li=n.n(Ri),Fi=n(332),Ui=n.n(Fi),Mi=n(267),qi=n.n(Mi),zi="GetRegistrantsForCohort",Hi=Object(qe.a)(ri||(ri=Object(Me.a)(["\n  query GetRegistrantsForCohort($cohortId: String!) {\n    getRegistrantsForCohort(cohortId: $cohortId) {\n      id\n      userId\n      isActive\n      isApproved\n      isDenied\n      isWaitlisted\n      copiedFromWaitlist\n      createdAt\n      registrationAnswers\n      user {\n        id\n        firstName\n        lastName\n        email\n        organization\n        userCredentialsForDisplay\n        profession {\n          name\n        }\n      }\n    }\n  }\n"]))),Wi=Object(qe.a)(ai||(ai=Object(Me.a)(["\n  mutation ApproveCohortRegistration($cohortRegistration: ApproveCohortRegistrationInput!) {\n    approveCohortRegistration(cohortRegistration: $cohortRegistration) {\n      id\n      updatedAt\n    }\n  }\n"]))),Yi=function(e){var t=e.approveRegistrationInput,n=Object(Ze.a)(Wi,{variables:{cohortRegistration:t},refetchQueries:[zi]}),r=Object(L.a)(n,2),a=r[0],i=r[1],c=i.loading,s=i.error,o=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:c,title:"Saving..."}),s&&Object(D.jsx)(me.a,{severity:"error",children:s.graphQLErrors[0].message}),Object(D.jsx)(J.a,{title:"Approve Registrant",children:Object(D.jsx)(qi.a,{onClick:o,sx:{color:"green",cursor:"pointer",mr:1}})})]})},Bi=n(466),Qi=n.n(Bi),$i=Object(qe.a)(ii||(ii=Object(Me.a)(["\n  mutation WaitlistCohortRegistration($cohortRegistration: WaitlistCohortRegistrationInput!) {\n    waitlistCohortRegistration(cohortRegistration: $cohortRegistration) {\n      id\n      updatedAt\n    }\n  }\n"]))),Vi=function(e){var t=e.waitlistRegistrationInput,n=Object(Ze.a)($i,{variables:{cohortRegistration:t},refetchQueries:[zi]}),r=Object(L.a)(n,2),a=r[0],i=r[1],c=i.loading,s=i.error,o=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:c,title:"Saving"}),s&&Object(D.jsx)(me.a,{severity:"error",children:s.graphQLErrors[0].message}),Object(D.jsx)(J.a,{title:"Waitlist Registrant",children:Object(D.jsx)(Qi.a,{onClick:o,sx:{color:"#CCCC00",cursor:"pointer",mr:1}})})]})},Gi=n(268),Ji=n.n(Gi),Zi=Object(qe.a)(ci||(ci=Object(Me.a)(["\n  mutation DenyCohortRegistration($cohortRegistration: DenyCohortRegistrationInput!) {\n    denyCohortRegistration(cohortRegistration: $cohortRegistration) {\n      id\n      updatedAt\n    }\n  }\n"]))),Ki=Object(qe.a)(si||(si=Object(Me.a)(["\n  query GetRegistrationDenialEmail($cohortRegistrationId: ID!) {\n    getRegistrationDenialEmail(cohortRegistrationId: $cohortRegistrationId) {\n      subject\n      text\n    }\n  }\n"]))),_i=n(970),Xi=Object(qe.a)(oi||(oi=Object(Me.a)(["\n  mutation SendEmail($email: SendEmailInput!) {\n    sendEmail(email: $email) {\n      success\n    }\n  }\n"]))),ec=n(76),tc=Object(pn.a)((function(e){return Object(mn.a)({icon:{color:e.palette.primary.main,cursor:"pointer",paddingRight:15},disabled:{opacity:.5,pointerEvents:"none"}})})),nc=function(e){var t=e.renderTrigger,n=e.onBodyUpdate,r=void 0===n?function(){}:n,i=e.onSubjectUpdate,c=void 0===i?function(){}:i,s=e.popupTitle,o=e.subject,l=void 0===o?"":o,d=e.body,u=void 0===d?"":d,j=e.submitButtonText,b=void 0===j?"Send":j,h=e.submitButtonTextAlt,O=e.checkSendEmail,x=void 0!==O&&O,m=e.recipients,p=e.onSubmit,v=void 0===p?function(){}:p,g=e.progressText,f=void 0===g?"":g,y=e.errorText,C=void 0===y?"":y,w=e.senderId,S=tc(),I=Object(a.useState)(!1),k=Object(L.a)(I,2),A=k[0],N=k[1],T=Object(a.useState)(!x),E=Object(L.a)(T,2),P=E[0],R=E[1],F=Object(a.useState)(l),U=Object(L.a)(F,2),M=U[0],q=U[1],z=Object(a.useState)(u),H=Object(L.a)(z,2),W=H[0],Y=H[1],B=Object(Ze.a)(Xi),Q=Object(L.a)(B,2),$=Q[0],V=Q[1],J=V.loading,Z=V.error;Object(a.useEffect)((function(){x&&R(!1)}),[A,x]),Object(a.useEffect)((function(){q(l)}),[l]),Object(a.useEffect)((function(){Y(u)}),[u]);var K=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:N(!0);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),_=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!P){e.next=4;break}return e.next=4,$({variables:{email:{recipientIds:null===m||void 0===m?void 0:m.map((function(e){return e.userId})),senderId:w,nonTemplateSubject:M,nonTemplateText:W}}});case 4:v(),X(),e.next=10;break;case 8:e.prev=8,e.t0=e.catch(0);case 10:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}(),X=function(){N(!1)};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:Boolean(f)||J,title:f||"Saving..."}),(Boolean(C)||Z)&&Object(D.jsx)(me.a,{severity:"error",children:C||(null===Z||void 0===Z?void 0:Z.graphQLErrors[0].message)}),t(K),Object(D.jsxs)(ie.a,{open:A,onClose:X,children:[Object(D.jsx)(ce.a,{children:s}),Object(D.jsxs)(se.a,{children:[Object(D.jsxs)(Oe.a,{className:P?"":S.disabled,children:[Object(D.jsxs)("p",{children:["To: ",m.map((function(e){var t,n;return Object(D.jsx)(_i.a,{style:{margin:5},label:null===e||void 0===e||null===(n=e.user)||void 0===n?void 0:n.email},null===e||void 0===e||null===(t=e.user)||void 0===t?void 0:t.email)}))]}),Object(D.jsx)("br",{}),Object(D.jsx)(It.a,{value:M,fullWidth:!0,placeholder:"Subject",onChange:function(e){c(e.target.value),q(e.target.value)}})]}),Object(D.jsx)("br",{}),Object(D.jsx)(ec,{id:"emailDescription",className:P?"":S.disabled,value:W,readOnly:!P,onChange:function(e){r(e),Y(e)},placeholder:"Body"}),x&&Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{checked:P,onChange:function(e){return R(e.target.checked)},name:"sendEmail"}),label:"Send Email"})]}),Object(D.jsxs)(he.a,{children:[Object(D.jsx)(G.a,{onClick:X,children:"Cancel"}),Object(D.jsx)(G.a,{variant:"contained",onClick:_,children:x&&!P?h:b})]})]})]})},rc=function(e){var t=e.registration,n=e.denyRegistrationInput,r=n.id,i=n.decisionUserId,c=Object(a.useState)(""),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(""),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(B.b)(Ki,{variables:{cohortRegistrationId:r}}),O=h.loading,x=h.data,m=Object(Ze.a)(Zi,{variables:{cohortRegistration:n},refetchQueries:[zi]}),p=Object(L.a)(m,2),v=p[0],g=p[1],f=g.loading,y=g.error;return Object(a.useEffect)((function(){null!==x&&void 0!==x&&x.getRegistrationDenialEmail&&(l(x.getRegistrationDenialEmail.subject),b(x.getRegistrationDenialEmail.text))}),[x]),Object(D.jsx)(nc,{renderTrigger:function(e){return Object(D.jsx)(J.a,{title:"Deny Registrant",children:Object(D.jsx)(Ji.a,{onClick:e,sx:{color:"primary.main",cursor:"pointer",mr:1}})})},popupTitle:"Deny Registration",subject:o,body:j,recipients:[t],senderId:i,progressText:O?"Loading...":f?"Saving...":"",errorText:y?null===y||void 0===y?void 0:y.graphQLErrors[0].message:"",submitButtonText:"Send Denial",submitButtonTextAlt:"Deny",checkSendEmail:!0,onSubmit:v})},ac=n(191),ic=n.n(ac),cc=n(467),sc=n.n(cc),oc=Object(qe.a)(li||(li=Object(Me.a)(["\n  mutation ToggleCohortRegistrationActive($cohortRegistration: ToggleCohortRegistrationActiveInput!) {\n    toggleCohortRegistrationActive(cohortRegistration: $cohortRegistration) {\n      id\n      updatedAt\n    }\n  }\n"]))),lc=function(e){var t=e.registrationInput,n=Object(Ze.a)(oc,{refetchQueries:[zi]}),r=Object(L.a)(n,2),a=r[0],i=r[1],c=i.loading,s=i.error,o=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a({variables:{cohortRegistration:{id:t.id,decisionUserId:t.decisionUserId,isActive:n}}});case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:c,title:"Saving..."}),s&&Object(D.jsx)(me.a,{severity:"error",children:s.graphQLErrors[0].message}),t.isActive&&Object(D.jsx)(J.a,{title:"Mark Registrant Inactive",children:Object(D.jsx)(ic.a,{onClick:function(){return o(!1)},sx:{color:"green",mr:1,cursor:"pointer"}})}),!t.isActive&&Object(D.jsx)(J.a,{title:"Mark Registrant Active",children:Object(D.jsx)(sc.a,{onClick:function(){return o(!0)},sx:{color:"red",mr:1,cursor:"pointer"}})})]})},dc=n(468),uc=n.n(dc),jc=Object(qe.a)(di||(di=Object(Me.a)(["\n  mutation ResendRegistrationConfirmationEmail($cohortRegistrationId: String!) {\n    resendRegistrationConfirmationEmail(cohortRegistrationId: $cohortRegistrationId) {\n      id\n      updatedAt\n    }\n  }\n"]))),bc=function(e){var t=e.id,n=Object(a.useState)(!1),r=Object(L.a)(n,2),i=r[0],c=r[1],s=Object(a.useState)(!1),o=Object(L.a)(s,2),l=o[0],d=o[1],u=Object(Ze.a)(jc,{variables:{cohortRegistrationId:t}}),j=Object(L.a)(u,2),b=j[0],h=j[1],O=h.loading,x=h.error;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:O,title:"Sending..."}),x&&Object(D.jsx)(me.a,{severity:"error",children:x.graphQLErrors[0].message}),Object(D.jsx)(J.a,{title:"Resend Confirmation Email",children:Object(D.jsx)(uc.a,{onClick:function(){c(!0)},sx:{color:"navy",cursor:"pointer",mr:1}})}),Object(D.jsx)(er,{dialogTitle:"Resend Confirmation Email with Calendar Invites",confirmText:"Send",dialogText:"This will send the confirmation email again, along with the calendar invites",open:i,onClose:function(e){if(c(!1),e)try{b(),d(!0)}catch(t){}}}),Object(D.jsx)(An.a,{open:l,autoHideDuration:6e3,onClose:function(){return d(!1)},children:Object(D.jsx)(me.a,{onClose:function(){return d(!1)},severity:"success",sx:{width:"100%"},children:"Confirmation Email was Sent"})})]})},hc=Object(qe.a)(ui||(ui=Object(Me.a)(["\n  mutation DeleteCohortRegistration($id: String!) {\n    deleteCohortRegistration(id: $id) {\n      message\n      status\n    }\n  }\n"]))),Oc=function(e){var t=e.id,n=Object(Ze.a)(hc,{variables:{id:t},refetchQueries:[zi]}),r=Object(L.a)(n,2),a=r[0],i=r[1],c=i.loading,s=i.error,o=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a();case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:c,title:"Saving..."}),s&&Object(D.jsx)(me.a,{severity:"error",children:s.graphQLErrors[0].message}),Object(D.jsx)(J.a,{title:"Remove Registrant",children:Object(D.jsx)(Xn.a,{onClick:o,sx:{color:"primary.main",cursor:"pointer",mr:1}})})]})},xc={prop:"fullName",order:"asc"},mc=function(e){var t=Object(Si.a)(),n=e.count,r=e.page,a=e.rowsPerPage,i=e.onPageChange;return Object(D.jsxs)(Q.a,{sx:{flexShrink:0,ml:2.5},children:[Object(D.jsx)(C.a,{onClick:function(e){i(e,0)},disabled:0===r,"aria-label":"first page",children:"rtl"===t.direction?Object(D.jsx)(Ui.a,{}):Object(D.jsx)(Ti.a,{})}),Object(D.jsx)(C.a,{onClick:function(e){i(e,r-1)},disabled:0===r,"aria-label":"previous page",children:"rtl"===t.direction?Object(D.jsx)(Li.a,{}):Object(D.jsx)(Pi.a,{})}),Object(D.jsx)(C.a,{onClick:function(e){i(e,r+1)},disabled:r>=Math.ceil(n/a)-1,"aria-label":"next page",children:"rtl"===t.direction?Object(D.jsx)(Pi.a,{}):Object(D.jsx)(Li.a,{})}),Object(D.jsx)(C.a,{onClick:function(e){i(e,Math.max(0,Math.ceil(n/a)-1))},disabled:r>=Math.ceil(n/a)-1,"aria-label":"last page",children:"rtl"===t.direction?Object(D.jsx)(Ti.a,{}):Object(D.jsx)(Ui.a,{})})]})},pc=function(e){var t=e.registrationAnswers,n=e.firstName,r=i.a.useState(!1),a=Object(L.a)(r,2),c=a[0],s=a[1],o=function(){s(!1)},l=JSON.parse(t);return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"View registration answers",children:Object(D.jsx)(Ni.a,{onClick:function(){s(!0)},sx:{cursor:"pointer",color:"primary.main"}})}),Object(D.jsxs)(ie.a,{open:c,onClose:o,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[Object(D.jsxs)(ce.a,{id:"alert-dialog-title",children:["Registration Answers for ",n]}),Object(D.jsx)(se.a,{children:Object(D.jsx)(Oe.a,{id:"alert-dialog-description",children:Object.keys(l).map((function(e,t){return Object(D.jsxs)("div",{style:{marginBottom:"15px"},children:[Object(D.jsx)("p",{children:Object(D.jsxs)("strong",{children:[t+1,". ",e]})},t),Object(D.jsxs)("label",{children:["Answer: ",l[e]]})]})}))})}),Object(D.jsx)(he.a,{children:Object(D.jsx)(G.a,{variant:"contained",onClick:o,autoFocus:!0,children:"Close"})})]})]})},vc=function(e){var t,n,i=e.registrants,c=e.showActive,s=e.listType,o=it(),l=Object(a.useState)(0),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(Ie.d),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)(xc),p=Object(L.a)(m,2),v=p[0],g=p[1],f=null!==(t=null===o||void 0===o||null===(n=o.user)||void 0===n?void 0:n.id)&&void 0!==t?t:"",y=Object(a.useMemo)((function(){return i?Mr(i.map((function(e){return Object(r.a)(Object(r.a)({},e),{},{fullName:e.user?"".concat(e.user.lastName,", ").concat(e.user.firstName):"",organization:e.user.organization||"",credentials:e.user.userCredentialsForDisplay||"",isActiveText:e.isActive?"Y":"N"})})),v):[]}),[i,v]),C=Object(a.useMemo)((function(){var e=u*O;return y.slice(e,e+O)}),[y,u,O]),w=Object(a.useState)([]),S=Object(L.a)(w,2),I=S[0],k=S[1],A=function(e){var t=v.prop===e&&"asc"===v.order;g({prop:e,order:t?"desc":"asc"})},N=function(){return"new"===s};return Object(D.jsxs)(Q.a,{textAlign:"left",children:[Object(D.jsx)(nc,{renderTrigger:function(e){return Object(D.jsx)(G.a,{variant:"outlined",sx:{mb:2},onClick:e,disabled:0===I.length,children:"Email Selected Learners"})},popupTitle:"Send Email",recipients:I,senderId:f}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{size:"small","aria-label":"a dense table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[N()&&Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{children:!(null===C||void 0===C||!C.length)&&Object(D.jsx)(Vt.a,{checked:I.length===(null===C||void 0===C?void 0:C.length),onChange:function(e){e.target.checked?k(C):k([])}})}),Object(D.jsx)(zr,{currentSort:null===v||void 0===v?void 0:v.prop,onSort:function(){return A("fullName")},sortProperty:"fullName",headerText:"Name",order:null===v||void 0===v?void 0:v.order}),Object(D.jsx)(zr,{currentSort:null===v||void 0===v?void 0:v.prop,onSort:function(){return A("organization")},sortProperty:"organization",headerText:"Organization",order:null===v||void 0===v?void 0:v.order}),Object(D.jsx)(zr,{currentSort:null===v||void 0===v?void 0:v.prop,onSort:function(){return A("credentials")},sortProperty:"credentials",headerText:"Credentials",order:null===v||void 0===v?void 0:v.order}),Object(D.jsx)(zr,{currentSort:null===v||void 0===v?void 0:v.prop,onSort:function(){return A("createdAt")},sortProperty:"createdAt",headerText:"Registration Date",order:null===v||void 0===v?void 0:v.order}),c&&Object(D.jsx)(zr,{currentSort:null===v||void 0===v?void 0:v.prop,onSort:function(){return A("isActiveText")},sortProperty:"isActiveText",headerText:"Active",order:null===v||void 0===v?void 0:v.order}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:C&&C.map((function(e){var t;return Object(D.jsxs)(te.a,{children:[N()&&Object(D.jsx)(ne.a,{children:e.registrationAnswers&&Object(D.jsx)(pc,{registrationAnswers:e.registrationAnswers,firstName:null!==(t=e.user.firstName)&&void 0!==t?t:""})}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Vt.a,{checked:!!I.find((function(t){return t.userId===e.userId})),onChange:function(t){return n=e,void(t.target.checked?k([].concat(Object(Vn.a)(I),[n])):k(I.filter((function(e){return e.userId!==n.userId}))));var n}})}),Object(D.jsx)(ne.a,{component:"th",scope:"row",children:Object(D.jsx)(Wt,{userId:e.userId,name:e.fullName||"",email:e.user.email})}),Object(D.jsx)(ne.a,{children:e.organization}),Object(D.jsx)(ne.a,{children:e.credentials}),Object(D.jsx)(ne.a,{children:ke(e.createdAt)}),c&&Object(D.jsx)(ne.a,{children:e.isActiveText}),Object(D.jsxs)(ne.a,{children:["registered"!==s&&Object(D.jsx)(Yi,{approveRegistrationInput:{id:e.id,decisionUserId:f}}),"waitlist"!==s&&Object(D.jsx)(Vi,{waitlistRegistrationInput:{id:e.id,decisionUserId:f}}),"denied"!==s&&Object(D.jsx)(rc,{registration:e,denyRegistrationInput:{id:e.id,decisionUserId:f}}),"denied"===s&&Object(D.jsx)(Oc,{id:e.id}),"registered"===s&&Object(D.jsx)(lc,{registrationInput:{id:e.id,decisionUserId:f,isActive:e.isActive}}),"registered"===s&&Object(D.jsx)(bc,{id:e.id})]})]},e.id)}))}),C&&C.length>0&&Object(D.jsx)(Ii.a,{children:Object(D.jsx)(ki.a,{count:y.length,rowsPerPage:O,page:u,onPageChange:function(e,t){j(t)},onRowsPerPageChange:function(e){var t=parseInt(e.target.value,10);x(t),j(0)},ActionsComponent:mc,SelectProps:{inputProps:{"aria-label":"rows per page"},native:!0},sx:{".MuiTablePagination-spacer":{display:"none"},".MuiTablePagination-toolbar":{display:"flex",justifyContent:"center"}}})})]})})]})},gc=n(97),fc=function(e){var t=e.cohortId,n=e.internalLabel,c=i.a.useState(0),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(!1),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(a.useState)([]),O=Object(L.a)(h,2),x=O[0],m=O[1],p=Object(a.useState)([]),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)([]),C=Object(L.a)(y,2),w=C[0],S=C[1],I=Object(a.useState)([]),k=Object(L.a)(I,2),A=k[0],N=k[1],E=Object(a.useState)([]),P=Object(L.a)(E,2),R=P[0],F=P[1],U=Object(B.b)(yi,{variables:{cohortId:t}}),M=U.loading,q=U.data;Object(a.useEffect)((function(){b(M),!M&&q&&m(q.getPreRegistrantsForCohort)}),[q,M]);var z=Object(B.b)(Hi,{variables:{cohortId:t}}),H=z.loading,W=z.data;Object(a.useEffect)((function(){if(b(H),!H&&W){var e=W.getRegistrantsForCohort;if(e){f(gc.filter((function(e){return!e.isApproved&&!e.isWaitlisted&&!e.isDenied}),e));S(gc.filter((function(e){return e.isApproved}),e));N(gc.filter((function(e){return e.isDenied}),e));F(gc.filter((function(e){return e.isWaitlisted}),e))}}}),[W,H]);var Y=function(e){return{id:"registration-by-status-tab-".concat(e),"aria-controls":"registration-by-status-".concat(e)}};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:"Registrants"}),Object(D.jsx)(le,{isOpen:j,title:"Loading"}),Object(D.jsxs)($.a,{value:o,onChange:function(e,t){l(t)},"aria-label":"registration by status tabs",textColor:"primary",indicatorColor:"primary",children:[Object(D.jsx)(V.a,Object(r.a)({label:"Pre-Registrants (".concat(x.length,")")},Y(0))),Object(D.jsx)(V.a,Object(r.a)({label:"New (".concat(g.length,")")},Y(1))),Object(D.jsx)(V.a,Object(r.a)({label:"Registered (".concat(w.length,")")},Y(2))),Object(D.jsx)(V.a,Object(r.a)({label:"Waitlist (".concat(R.length,")")},Y(3))),Object(D.jsx)(V.a,Object(r.a)({label:"Denied (".concat(A.length,")")},Y(4)))]}),Object(D.jsx)(Cn,{value:o,index:0,children:Object(D.jsx)(wi,{cohortId:t,internalLabel:n,preRegistrants:x})}),Object(D.jsx)(Cn,{value:o,index:1,children:Object(D.jsx)(vc,{registrants:g,showActive:!1,listType:"new"})}),Object(D.jsx)(Cn,{value:o,index:2,children:Object(D.jsx)(vc,{registrants:w,showActive:!0,listType:"registered"})}),Object(D.jsx)(Cn,{value:o,index:3,children:Object(D.jsx)(vc,{registrants:R,showActive:!1,listType:"waitlist"})}),Object(D.jsx)(Cn,{value:o,index:4,children:Object(D.jsx)(vc,{registrants:A,showActive:!1,listType:"denied"})})]})},yc=function(e){var t,n,r=e.error;return r?Object(D.jsx)(me.a,{severity:"error",children:null!==(t=null===r||void 0===r||null===(n=r.graphQLErrors[0])||void 0===n?void 0:n.message)&&void 0!==t?t:""}):Object(D.jsx)(D.Fragment,{})},Cc=n(992),wc=n(937),Sc=n(1001),Ic=n(157),kc=n.n(Ic),Ac=n(56),Nc="GetResourceByProgram",Dc=Object(qe.a)(ji||(ji=Object(Me.a)(["\n  query GetResourceByProgram($programId: String!) {\n    getResourceByProgram(programId: $programId) {\n      id\n      programId\n      resourceTypeId\n      name\n      displayName\n      url\n      archived\n      createdAt\n      resourceType {\n        name\n      }\n    }\n  }\n"]))),Tc=Object(qe.a)(bi||(bi=Object(Me.a)(["\n  mutation AddResource($resource: AddResourceInput!) {\n    addResource(resource: $resource) {\n      id\n    }\n  }\n"]))),Ec="GetProgramById",Pc=Object(qe.a)(hi||(hi=Object(Me.a)(["\n  query GetProgramById($id: ID!) {\n    getProgramById(id: $id) {\n      id\n      name\n      partnerId\n      createdAt\n      updatedAt\n      isArchived\n      resources {\n        displayName\n        name\n        resourceTypeId\n        url\n        createdAt\n      }\n      cohorts {\n        id\n        startDate\n        endDate\n        archived\n        internalLabel\n        registrationCloseDate\n        isOngoing\n      }\n    }\n  }\n"])));function Rc(){it();var e=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,r,a=arguments;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Lc(a.length>1&&void 0!==a[1]?a[1]:null),e.next=4,Xr.a.get(t,n);case 4:return r=e.sent,e.abrupt("return",r.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){var r,a,i=arguments;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Lc(i.length>2&&void 0!==i[2]?i[2]:null),e.next=4,Xr.a.post(t,n,r);case 4:return a=e.sent,e.abrupt("return",a.data);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),n=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){var r,a,i=arguments;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.length>3?i[3]:void 0,r=Lc(i.length>2&&void 0!==i[2]?i[2]:null),e.next=5,Xr.a.put(t,n,r);case 5:return a=e.sent,e.abrupt("return",a.data);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();return{get:e,post:t,put:n}}function Lc(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return{withCredentials:!0,headers:Object(r.a)(Object(r.a)({},e),{},{tenant:Object(x.h)()})}}function Fc(){var e=Object(Ze.a)(Tc,{refetchQueries:[Nc,Ec]}),t=Object(L.a)(e,2),n=t[0],r=t[1].loading,a=Rc(),i=a.get,c=a.put,s=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,r){var a,s,o,l,d,u,j,b,h,O,m,p,v;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&0!==r.length){e.next=2;break}return e.abrupt("return",{success:[],errors:[]});case 2:a=[],s=[],o=[".csv",".doc",".docm",".docx",".dotx",".ics",".jfif",".jpeg",".jpg",".key",".mov",".mp3",".mp4",".odp",".odt",".pdf",".png",".potx",".ppt",".pptm",".pptx",".rtf",".txt",".url",".vsdx",".xls",".xlsx"],l=Object(Ac.a)(r),e.prev=6,l.s();case 8:if((d=l.n()).done){e.next=36;break}if(j=d.value,b="."+(null===(u=j.name.split(".").pop())||void 0===u?void 0:u.toLowerCase()),!o.includes(b)){e.next=32;break}return e.prev=12,O="".concat(x.j,"/resource/upload?programId=").concat(t,"&fileName=").concat(j.name,"&fileType=").concat(j.type),e.next=16,i(O);case 16:return m=e.sent.data,p={},e.next=20,c(m,j,p,!1);case 20:return e.next=22,n({variables:{resource:{name:j.name,programId:t}}});case 22:v=e.sent,a.push(null===(h=v.data)||void 0===h?void 0:h.addResource.id),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(12),console.error("Error uploading file:",j.name,e.t0),s.push({file:j.name,error:e.t0.message||e.t0});case 30:e.next=34;break;case 32:console.error("Unsupported file type:",j.name),s.push({file:j.name,error:"Unsupported file type"});case 34:e.next=8;break;case 36:e.next=41;break;case 38:e.prev=38,e.t1=e.catch(6),l.e(e.t1);case 41:return e.prev=41,l.f(),e.finish(41);case 44:return e.abrupt("return",{success:a,errors:s});case 45:case"end":return e.stop()}}),e,null,[[6,38,41,44],[12,26]])})));return function(t,n){return e.apply(this,arguments)}}();return{addResourcesToS3AndDB:s,uploadingFiles:r}}var Uc=Object(qe.a)(Oi||(Oi=Object(Me.a)(["\n  mutation SendCohortEmail($cohortEmail: SendCohortEmailInput!) {\n    sendCohortEmail(cohortEmail: $cohortEmail) {\n      success\n      numberSent\n      error\n    }\n  }\n"]))),Mc=n(97),qc=n(76),zc=Object(pn.a)((function(e){return Object(mn.a)({editor:{height:"300px"},accountSelect:{width:"100%",marginBottom:2,textAlign:"left"}})})),Hc={PaperProps:{style:{maxHeight:224,minWidth:300}}},Wc=function(e){var t=e.isOpen,n=e.onClose,r=e.recipientType,i=e.cohortId,c=e.sessionId,s=e.sessionOption,o=e.sessionName,l=e.programID,d=it(),u=zc(),j=Object(a.useRef)(null),b=Object(a.useState)(!1),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)(""),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)(""),y=Object(L.a)(f,2),C=y[0],w=y[1],S=Object(a.useState)(!1),k=Object(L.a)(S,2),A=k[0],N=k[1],T=Object(a.useState)(!0),E=Object(L.a)(T,2),P=E[0],R=E[1],F=Object(a.useState)(!1),U=Object(L.a)(F,2),M=U[0],q=U[1],z=Object(a.useState)(0),H=Object(L.a)(z,2),W=H[0],Y=H[1],$=Object(a.useState)(""),V=Object(L.a)($,2),Z=V[0],K=V[1],_=Object(a.useState)([]),X=Object(L.a)(_,2),ee=X[0],te=X[1],ne=Object(a.useState)([]),re=Object(L.a)(ne,2),ae=re[0],de=re[1],ue=Object(a.useState)([]),je=Object(L.a)(ue,2),be=je[0],Oe=je[1],xe=Object(a.useState)([]),pe=Object(L.a)(xe,2),ve=pe[0],ge=pe[1],fe=Object(a.useState)([]),ye=Object(L.a)(fe,2),Ce=ye[0],we=ye[1],Se=Object(a.useState)([]),Ie=Object(L.a)(Se,2),ke=Ie[0],Ae=Ie[1],Ne=Object(a.useState)([]),De=Object(L.a)(Ne,2),Te=De[0],Ee=De[1],Pe=Object(a.useState)([]),Re=Object(L.a)(Pe,2),Le=Re[0],Fe=Re[1],Ue=Object(a.useState)([]),Me=Object(L.a)(Ue,2),qe=Me[0],ze=Me[1],He=Object(a.useState)(!1),We=Object(L.a)(He,2),Ye=We[0],Be=We[1],Qe=Object(a.useState)([]),$e=Object(L.a)(Qe,2),Je=$e[0],Ke=$e[1],_e=Fc().addResourcesToS3AndDB,Xe=Object(Ze.a)(Uc),et=Object(L.a)(Xe,2),tt=et[0],nt=et[1].loading,rt=Object(B.b)(Dc,{variables:{programId:l}}),at=rt.loading,ct=rt.data,st=Object(a.useMemo)((function(){var e;return null===ct||void 0===ct||null===(e=ct.getResourceByProgram)||void 0===e?void 0:e.filter((function(e){var t;return"URL"!==(null===(t=e.resourceType)||void 0===t?void 0:t.name)}))}),[ct]),ot=Object(B.b)(Hi,{variables:{cohortId:i}}),lt=ot.loading,dt=ot.data,ut=Object(B.b)(Ar,{variables:{cohortId:i,sessionId:"".concat(c)},skip:!c||0===c.length}),jt=ut.loading,bt=ut.data;Object(a.useEffect)((function(){if(!lt&&dt){var e=dt.getRegistrantsForCohort;if(e){te(A?Mc.filter((function(e){return!e.isApproved&&!e.isWaitlisted&&!e.isDenied}),e):Mc.filter((function(e){return!e.isApproved&&!e.isWaitlisted&&!e.isDenied&&e.isActive}),e));de(A?Mc.filter((function(e){return e.isApproved}),e):Mc.filter((function(e){return e.isApproved&&e.isActive}),e));Oe(A?Mc.filter((function(e){return e.isDenied}),e):Mc.filter((function(e){return e.isDenied&&e.isActive}),e));ge(A?Mc.filter((function(e){return e.isWaitlisted}),e):Mc.filter((function(e){return e.isWaitlisted&&e.isActive}),e))}}}),[lt,A,dt]),Object(a.useEffect)((function(){if(!jt&&bt){var e=bt.getAttendanceForSession;Ae(e||[]);Ee(Mc.filter((function(e){return e.isPresent}),e));Fe(Mc.filter((function(e){return!e.isPresent}),e))}}),[jt,bt]);var ht=Object(a.useCallback)((function(){var e;switch(r){case"new":e=ee;break;case"registered":e=ae;break;case"waitlisted":e=ve;break;case"denied":e=be;break;case"session":e="All"===s?ke:"Present"===s?Te:Le;break;default:e=[]}if(e.length>0){var t=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};return Mc.sortBy(Mc.compose(Mc.join(" "),Mc.split(" "),(function(e){return"session"===r?"".concat(t(e.firstName)," ").concat(t(e.lastName)):"".concat(t(e.user.firstName)," ").concat(t(e.user.lastName))})))(e)}return e}),[r,ee,ae,ve,be,s,ke,Te,Le]);Object(a.useEffect)((function(){if(ht().length>0){var e=[];ht().map((function(t){return"session"===r?e.push("".concat(t.firstName," ").concat(t.lastName)):e.push("".concat(t.user.firstName," ").concat(t.user.lastName))})),we(e)}else we([])}),[ht,r]);var Ot=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,a,o,l,u;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(x(!1),t){e.next=3;break}return e.abrupt("return");case 3:o=[],l=Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ht().filter((function(e){if("session"===r){var n=Ce[t].trim().split(" ");if(e.firstName.trim()===n.slice(0,-1).join(" ").trim()&&e.lastName.trim()===n.slice(-1).join(" ").trim()){var a={id:e.userId,email:e.email,firstName:e.firstName,lastName:e.lastName};return o.push(a),null}}else{var i=Ce[t].trim().split(" ");if(e.user.firstName.trim()===i[0].trim()&&e.user.lastName.trim()===i.slice(1).join(" ").trim()){var c={id:e.user.id,email:e.user.email,firstName:e.user.firstName,lastName:e.user.lastName};return o.push(c),null}}}));case 1:case"end":return e.stop()}}),e)})),u=0;case 6:if(!(u<Ce.length)){e.next=11;break}return e.delegateYield(l(u),"t0",8);case 8:u++,e.next=6;break;case 11:return Y(o.length),e.next=14,tt({variables:{cohortEmail:{cohortId:i,sendSelectedUsers:o,emailType:r,sessionId:null!==c&&void 0!==c?c:null,sessionOption:null!==s&&void 0!==s?s:null,subject:v,text:C,senderId:null!==(n=null===(a=d.user)||void 0===a?void 0:a.id)&&void 0!==n?n:"",attachments:qe}}});case 14:q(!0);case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),xt=function(){R(!0),Y(0),q(!1),g(""),w(""),n()},mt=null===st||void 0===st?void 0:st.filter((function(e){return e.name.toLowerCase().includes(Z.toLowerCase())})),pt=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,r,a,i;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_e(l,t);case 3:n=e.sent,r=n.success,a=n.errors,r.length>0&&(i=t.map((function(e){return e.name})),ze((function(e){return[].concat(Object(Vn.a)(e),Object(Vn.a)(i.filter((function(t){return!e.includes(t)}))))}))),a.length>0&&Ke(a),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Unexpected error during upload:",e.t0),Ke([{file:"Unexpected error",error:"Unexpected error"}]);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t){return e.apply(this,arguments)}}(),vt=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.target.files&&t.target.files.length>0)){e.next=8;break}return Be(!0),Ke([]),n=Array.from(t.target.files),e.next=6,pt(n);case 6:Be(!1),t.target.value="";case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsxs)(ie.a,{open:t,PaperProps:{sx:{width:"80vw",height:"80vh",maxWidth:"none",maxHeight:"none"}},children:[Object(D.jsx)(ce.a,{sx:{m:0,p:2},id:"customized-dialog-title",children:function(){switch(r){case"new":return"Email All New Registrants";case"registered":return"Email All Registered Learners";case"waitlisted":return"Email All Waitlisted Learners";case"denied":return"Email All Denied Learners";case"session":return"Email Participants (".concat(s,") for ").concat(o);default:return""}}()}),Object(D.jsxs)(se.a,{children:[Object(D.jsx)(le,{isOpen:nt||lt||jt||at,title:"Processing..."}),Object(D.jsxs)(I.a,{spacing:2,children:[!P&&Object(D.jsx)(me.a,{severity:"error",children:"Email subject, body and address are required"}),M&&Object(D.jsxs)(me.a,{severity:"info",children:["Email has been sent to ",W," recipients"]}),Object(D.jsxs)(Ct.a,{sx:{mb:1,width:"100%",marginTop:"10px"},children:[Object(D.jsx)(wt.a,{required:!0,id:"registrants-label",color:"warning",children:"To"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"registrants-label",multiple:!0,input:Object(D.jsx)(Cc.a,{label:"To"}),value:Ce,onChange:function(e){var t=e.target.value;we("string"===typeof t?t.split(","):t)},renderValue:function(e){return e.join(", ")},MenuProps:Hc,color:"warning",children:"session"===r?ht().map((function(e){return Object(D.jsxs)(St.a,{value:"".concat(e.firstName," ").concat(e.lastName),children:[Object(D.jsx)(Vt.a,{checked:Ce.indexOf("".concat(e.firstName," ").concat(e.lastName))>-1}),Object(D.jsx)(wc.a,{primary:"".concat(e.firstName," ").concat(e.lastName)})]},e.userId)})):ht().map((function(e){return Object(D.jsxs)(St.a,{value:"".concat(e.user.firstName," ").concat(e.user.lastName),children:[Object(D.jsx)(Vt.a,{checked:Ce.indexOf("".concat(e.user.firstName," ").concat(e.user.lastName))>-1}),Object(D.jsx)(wc.a,{primary:"".concat(e.user.firstName," ").concat(e.user.lastName)})]},e.id)}))})]}),Object(D.jsx)(It.a,{onChange:function(e){g(e.target.value)},value:v,variant:"outlined",label:"Email Subject",color:"warning"}),"registered"===r&&Object(D.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[Object(D.jsx)(J.a,{title:"Email will be sent to Active users",children:Object(D.jsx)(Pa.a,{sx:{fontSize:"16px",mr:2,color:"primary.main"}})}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{color:"primary",checked:A,onChange:function(e){N(e.target.checked)}}),label:"check to include Inactive Users"})]}),Object(D.jsx)(qc,{id:"scheduleDescription",className:u.editor,value:C,onChange:function(e){return w(e)}})]}),Object(D.jsx)(Q.a,{sx:{marginTop:10,display:"flex",flexWrap:"wrap",gap:1},children:qe.map((function(e,t){return Object(D.jsx)(_i.a,{label:e,onDelete:function(){return t=e,void ze((function(e){return e.filter((function(e){return e!==t}))}));var t},color:"primary",variant:"outlined"},t)}))}),Je.length>0&&Object(D.jsx)(Q.a,{marginTop:2,children:Object(D.jsx)(me.a,{severity:"error",children:Je.map((function(e,t){return Object(D.jsxs)("div",{children:[Object(D.jsxs)("strong",{children:[e.file,":"]})," ",e.error]},t)}))})}),Object(D.jsxs)(I.a,{marginTop:4,display:"flex",flexDirection:"row",alignItems:"center",children:[Object(D.jsxs)(Ct.a,{size:"small",sx:{width:"300px",marginRight:2},children:[Object(D.jsx)(wt.a,{id:"resource-select-label",children:"Select Resource"}),Object(D.jsxs)(kt.a,{labelId:"resource-select-label",multiple:!0,value:qe,onChange:function(e){var t=e.target.value,n="string"===typeof t?t.split(","):t;ze((function(e){return[].concat(Object(Vn.a)(e),Object(Vn.a)(n.filter((function(t){return!e.includes(t)}))))}))},input:Object(D.jsx)(Cc.a,{label:"Select Resource"}),MenuProps:Hc,color:"primary",renderValue:function(e){return e.join(", ")},children:[Object(D.jsx)(Sc.a,{children:Object(D.jsx)(It.a,{size:"small",placeholder:"Search...",fullWidth:!0,value:Z,onChange:function(e){K(e.target.value)}})}),null===mt||void 0===mt?void 0:mt.map((function(e){return Object(D.jsx)(St.a,{value:e.name,children:e.name},e.id)}))]})]}),Object(D.jsx)(G.a,{variant:"contained",color:"primary",onClick:function(){j.current&&j.current.click()},startIcon:Object(D.jsx)(kc.a,{}),disabled:Ye,children:"Upload New File"}),Object(D.jsx)("input",{type:"file",ref:j,style:{display:"none"},onChange:vt,accept:".pdf,.doc,.docx,.txt,.png,.jpg,.jpeg,.gif"}),Ye&&Object(D.jsx)(oe.a,{size:24,sx:{marginLeft:2}})]}),Object(D.jsx)(er,{dialogTitle:"Send Email",confirmText:"Send",dialogText:"Are you sure: you are ready to send this email to all ".concat(Ce.length," recipients?"),open:O,onClose:Ot})]}),Object(D.jsxs)(he.a,{children:[M&&Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(G.a,{sx:{width:"200px"},onClick:xt,variant:"contained",color:"primary",children:"Close"})}),!M&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(G.a,{sx:{width:"200px"},onClick:xt,variant:"outlined",color:"primary",children:"Cancel"}),Object(D.jsx)(G.a,{onClick:function(){(function(){var e=!0;return R(!0),0!==v.trim().length&&C&&"<div><br></div>"!==C&&0!==Ce.length||(e=!1,R(!1)),e})()&&x(!0)},sx:{width:"200px"},variant:"contained",color:"primary",children:"Send"})]})]})]})},Yc=n(97),Bc=function(e){var t,n,r=e.cohortId,i=e.programID,c=Object(a.useState)(!1),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)("new"),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(a.useState)(""),O=Object(L.a)(h,2),x=O[0],m=O[1],p=Object(a.useState)(""),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)("All"),C=Object(L.a)(y,2),S=C[0],k=C[1],A=Object(a.useState)([]),E=Object(L.a)(A,2),P=E[0],R=E[1],F=Object(a.useState)([]),U=Object(L.a)(F,2),M=U[0],q=U[1],z=Object(a.useState)([]),H=Object(L.a)(z,2),W=H[0],Y=H[1],Q=Object(a.useState)([]),$=Object(L.a)(Q,2),V=$[0],J=$[1],Z=Object(a.useState)([]),K=Object(L.a)(Z,2),_=K[0],X=K[1],ee=Object(a.useState)([]),te=Object(L.a)(ee,2),ne=te[0],re=te[1],ae=Object(a.useState)(""),ie=Object(L.a)(ae,2),ce=ie[0],se=ie[1],oe=Object(B.b)(Da,{variables:{cohortId:r}}),de=oe.loading,ue=oe.data,je=oe.error,be=Object(B.b)(Hi,{variables:{cohortId:r}}),he=be.loading,Oe=be.data,xe=be.error,pe=Object(B.b)(Ar,{variables:{cohortId:r,sessionId:x},skip:0===x.length}),ve=pe.loading,ge=pe.data,fe=pe.error,ye=Object(a.useMemo)((function(){var e;return null!==(e=null===ge||void 0===ge?void 0:ge.getAttendanceForSession)&&void 0!==e?e:[]}),[ge]);Object(a.useEffect)((function(){if(!ve&&ge){X(Yc.filter((function(e){return e.isPresent}),ye));re(Yc.filter((function(e){return!e.isPresent}),ye))}}),[ve,ge,ye]);var Ce=Object(a.useMemo)((function(){var e;return null!==(e=null===Oe||void 0===Oe?void 0:Oe.getRegistrantsForCohort)&&void 0!==e?e:[]}),[Oe]);Object(a.useEffect)((function(){if(!he&&Oe&&Ce){R(Yc.filter((function(e){return!e.isApproved&&!e.isWaitlisted&&!e.isDenied&&e.isActive}),Ce));q(Yc.filter((function(e){return e.isApproved&&e.isActive}),Ce));Y(Yc.filter((function(e){return e.isDenied&&e.isActive}),Ce));J(Yc.filter((function(e){return e.isWaitlisted&&e.isActive}),Ce))}}),[he,Oe,Ce]);var we=null!==(t=null===ue||void 0===ue?void 0:ue.getSessionsByCohort)&&void 0!==t?t:[],Se=function(e){var t=e.target.name,n=e.target.value;"session-select"===t&&(m(n),f(function(e){var t,n;if(0===we.length)return"";var r=Yc.findIndex(Yc.propEq("id",e))(we);return null!==(t=null===(n=we[r])||void 0===n?void 0:n.title)&&void 0!==t?t:""}(n))),"cohort-type-select"===t&&k(n)},Ie=function(e){b(e),l(!0)},ke=function(e){return e.map((function(e){return e.user.email})).join(", ")},Ae=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.clipboard.writeText(t);case 3:se("Copied to Clipboard!"),setTimeout((function(){se("")}),3e3),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),se("Failed to Copy!"),setTimeout((function(){se("")}),3e3);case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:de||he||ve,title:"Loading..."}),Object(D.jsx)(T,{title:"Email Center"}),Object(D.jsx)(yc,{error:null!==(n=null!==je&&void 0!==je?je:xe)&&void 0!==n?n:fe}),Object(D.jsxs)(N.a,{container:!0,sx:{pt:7},spacing:2,children:[Object(D.jsx)(N.a,{item:!0,xs:12,children:!!ce&&Object(D.jsx)(me.a,{severity:"success",children:ce})}),Object(D.jsxs)(N.a,{item:!0,xs:3,sx:{width:"90%",textAlign:"left"},children:[Object(D.jsx)(w.a,{variant:"h5",children:"Email Learners"}),Object(D.jsx)(w.a,{variant:"caption",children:"\xa0"}),Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsxs)(G.a,{onClick:function(){return Ie("new")},disabled:!P.length,variant:"contained",color:"success",children:["Email All New Registrants (",P.length,")"]}),Object(D.jsxs)(G.a,{onClick:function(){return Ie("registered")},disabled:!M.length,variant:"contained",color:"success",children:["Email All Registered Learners (",M.length,")"]}),Object(D.jsxs)(G.a,{onClick:function(){return Ie("waitlisted")},disabled:!V.length,variant:"contained",color:"success",children:["Email All Waitlisted Learners (",V.length,")"]}),Object(D.jsxs)(G.a,{onClick:function(){return Ie("denied")},disabled:!W.length,variant:"contained",color:"success",children:["Email All Denied Learners (",W.length,")"]})]})]}),Object(D.jsxs)(N.a,{item:!0,xs:3,sx:{width:"90%",textAlign:"left"},children:[Object(D.jsx)(w.a,{variant:"h5",children:"Actions"}),Object(D.jsx)(w.a,{variant:"caption",children:"\xa0"}),Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(G.a,{onClick:function(){return Ae(ke(P))},variant:"outlined",disabled:!P.length,children:"Copy All New Registrants"}),Object(D.jsx)(G.a,{onClick:function(){return Ae(ke(M))},variant:"outlined",disabled:!M.length,children:"Copy All Registered Learners"}),Object(D.jsx)(G.a,{onClick:function(){return Ae(ke(V))},variant:"outlined",disabled:!V.length,children:"Copy All Waitlisted Learners"}),Object(D.jsx)(G.a,{onClick:function(){return Ae(ke(W))},variant:"outlined",disabled:!W.length,children:"Copy All Denied Learners"})]})]}),Object(D.jsxs)(N.a,{item:!0,xs:6,sx:{width:"80%",textAlign:"right"},children:[Object(D.jsx)(w.a,{variant:"h5",children:"Session-Based Emails"}),Object(D.jsx)(w.a,{variant:"caption",children:"Includes all attendees, including faculty and other non-learners"}),Object(D.jsxs)(w.a,{variant:"body1",children:[Object(D.jsxs)(Ct.a,{sx:{width:400,mt:2,textAlign:"left"},children:[Object(D.jsx)(wt.a,{id:"session-label",color:"warning",children:"Select a Session"}),Object(D.jsx)(kt.a,{labelId:"session-label",name:"session-select",defaultValue:"",value:x,label:"Select a Session",color:"warning",onChange:Se,children:we&&we.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.title},e.id)}))})]}),Object(D.jsx)("br",{}),Object(D.jsxs)(Ct.a,{sx:{width:400,mt:2,textAlign:"left"},children:[Object(D.jsx)(wt.a,{id:"cohort-type-label",color:"warning",children:"Select Who to Email"}),Object(D.jsxs)(kt.a,{labelId:"cohort-type-label",name:"cohort-type-select",defaultValue:"",value:S,label:"Select Who to Email",color:"warning",onChange:Se,children:[Object(D.jsxs)(St.a,{value:"All",children:["All (",M.length,")"]}),Object(D.jsxs)(St.a,{value:"Present",disabled:!_||!_.length,children:["Present ",_&&_.length?"(".concat(_.length,")"):null]}),Object(D.jsxs)(St.a,{value:"Absent",disabled:!ne||!ne.length,children:["Absent ",ne&&ne.length?"(".concat(ne.length,")"):null]})]})]}),Object(D.jsx)("br",{}),Object(D.jsxs)(I.a,{direction:"row",spacing:2,justifyContent:"flex-end",sx:{mt:2},children:[Object(D.jsx)(G.a,{onClick:function(){return Ae(("All"===S?M:"Absent"===S?ne:_).map((function(e){return"email"in e?e.email:e.user.email})).join(", "))},variant:"outlined",disabled:!ge,children:"Copy to Clipboard"}),Object(D.jsx)(G.a,{onClick:function(){return Ie("session")},variant:"contained",color:"primary",disabled:!ge,children:"Start Email"})]})]})]})]}),o&&Object(D.jsx)(Wc,{isOpen:o,onClose:function(){l(!1)},recipientType:j,cohortId:r,sessionId:x,sessionName:g,sessionOption:S,programID:i})]})},Qc=n(97),$c={PaperProps:{style:{maxHeight:224,width:250}}};function Vc(e,t,n){return{fontWeight:-1===t.indexOf(e)?n.typography.fontWeightRegular:n.typography.fontWeightMedium}}var Gc,Jc,Zc,Kc,_c,Xc=function(e){var t=e.title,n=e.id,r=e.checkName,a=e.checkLabel,i=e.checkValue,c=e.selectLabel,s=e.selectName,o=e.selectValue,l=e.sessions,d=e.onCheckboxChange,u=e.onMultiSelectChange,j=Object(Si.a)(),b=function(e){var t=Qc.findIndex(Qc.propEq("id",e))(l);return t>=0?l[t].title:e};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(N.a,{container:!0,display:"flex",justifyContent:"space-between",alignItems:"center",children:[Object(D.jsx)(N.a,{item:!0,children:Object(D.jsx)(w.a,{variant:"h6",children:t})}),Object(D.jsx)(N.a,{item:!0,children:Object(D.jsx)($t.a,{sx:{mr:0},control:Object(D.jsx)(Vt.a,{size:"small",color:"primary",checked:i,onChange:function(e){return d(e,s)},name:r}),label:a})})]}),Object(D.jsxs)(Ct.a,{fullWidth:!0,size:"small",disabled:i,children:[Object(D.jsx)(wt.a,{id:"".concat(n,"-select-label"),color:"warning",children:c}),Object(D.jsx)(kt.a,{multiple:!0,labelId:"".concat(n,"-select-label"),id:"".concat(n,"-select"),value:o,name:s,label:c,color:"warning",onChange:u,renderValue:function(e){return Object(D.jsx)(Q.a,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((function(e){return Object(D.jsx)(_i.a,{size:"small",color:"warning",label:b(e)},e)}))})},MenuProps:$c,children:l&&l.map((function(e){return Object(D.jsx)(St.a,{value:e.id,style:Vc(e.id,o,j),children:e.title},e.id)}))})]})]})},es=function(e){var t=e.sessions,n=e.facilitateAll,r=e.selectedFacilitatorSessions,a=e.presentAll,i=e.selectedPresenterSessions,c=e.panelistAll,s=e.selectedPanelistSessions,o=e.onCheckboxChange,l=e.onMultiSelectChange;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Xc,{title:"Facilitator",id:"facilitator",selectLabel:"Select Session(s)",checkLabel:"Select All Sessions",checkValue:n,selectValue:r,checkName:"facilitateAll",selectName:"sessionsAsFacilitator",sessions:t,onCheckboxChange:o,onMultiSelectChange:l}),Object(D.jsx)(Xc,{title:"Presenter",id:"presenter",selectLabel:"Select Session(s)",checkLabel:"Select All Sessions",checkValue:a,selectValue:i,checkName:"presentAll",selectName:"sessionsAsPresenter",sessions:t,onCheckboxChange:o,onMultiSelectChange:l}),Object(D.jsx)(Xc,{title:"Panelist",id:"panelist",selectLabel:"Select Session(s)",checkLabel:"Select All Sessions",checkValue:c,selectValue:s,checkName:"panelistAll",selectName:"sessionsAsPanelist",sessions:t,onCheckboxChange:o,onMultiSelectChange:l})]})},ts=Object(qe.a)(Gc||(Gc=Object(Me.a)(["\n  mutation UpdateHubMemberCohortAndSessions($hubMemberCohort: UpdateHubMemberCohortInput!) {\n    updateHubMemberCohortAndSessions(hubMemberCohort: $hubMemberCohort) {\n      id\n      userId\n      cohortId\n    }\n  }\n"]))),ns=function(e,t,n,r){var a=[];return t.forEach((function(t){a.push({hubMemberCohortId:e,sessionId:t,hubRoleId:Ie.f})})),n.forEach((function(t){a.push({hubMemberCohortId:e,sessionId:t,hubRoleId:Ie.i})})),r.forEach((function(t){a.push({hubMemberCohortId:e,sessionId:t,hubRoleId:Ie.h})})),a},rs=function(e){var t=[];return(e.facilitateAll||e.sessionsAsFacilitator.length>0)&&t.push("Facilitator"),(e.presentAll||e.sessionsAsPresenter.length>0)&&t.push("Presenter"),(e.panelistAll||e.sessionsAsPanelist.length>0)&&t.push("Panelist"),t.length>0?t.join(", "):""},as=function(e){var t,n,i,c,s,o,l,d=e.trigger,u=e.drawerTitle,j=e.cohortMember,b=e.sessions,h=Object(a.useState)(j),O=Object(L.a)(h,2),x=O[0],m=O[1],p=Object(a.useState)(!1),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)(!1),C=Object(L.a)(y,2),w=C[0],S=C[1],k=Object(Ze.a)(ts,{refetchQueries:[Ia]}),A=Object(L.a)(k,2),N=A[0],T=A[1],E=T.loading,P=T.error,R=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=ns(x.id,x.sessionsAsFacilitator,x.sessionsAsPresenter,x.sessionsAsPanelist),n={id:x.id,facilitateAll:x.facilitateAll,presentAll:x.presentAll,panelistAll:x.panelistAll,credentials:x.credentials,hubMemberCohortSessions:t,sendEmails:w},e.next=4,N({variables:{hubMemberCohort:n}});case 4:f(!1);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[P&&Object(D.jsx)(me.a,{severity:"error",children:P.graphQLErrors[0].message}),Object(D.jsx)(le,{isOpen:E,title:"Saving"}),Object(D.jsx)(Lt,{trigger:d,width:550,title:u,showSave:!0,showCancel:!0,isOpen:g,onSaveClick:R,children:Object(D.jsxs)(I.a,{spacing:2,textAlign:"left",marginBottom:4,children:[Object(D.jsx)($t.a,{sx:{mb:1},control:Object(D.jsx)(Vt.a,{color:"primary",checked:w,onChange:function(e){var t=e.target.checked;S(t)},name:"sendEmails"}),label:"Send Calendar Invites to ".concat(null===x||void 0===x||null===(t=x.user)||void 0===t?void 0:t.firstName)}),Object(D.jsx)(It.a,{fullWidth:!0,size:"small",label:"HUB Team Credentials/Title",name:"credentials",value:x.credentials,onChange:function(e){return m(Object(r.a)(Object(r.a)({},x),{},{credentials:e.target.value}))},color:"warning"}),Object(D.jsx)(es,{sessions:b,facilitateAll:null!==(n=x.facilitateAll)&&void 0!==n&&n,selectedFacilitatorSessions:null!==(i=x.sessionsAsFacilitator)&&void 0!==i?i:[],presentAll:null!==(c=x.presentAll)&&void 0!==c&&c,selectedPresenterSessions:null!==(s=x.sessionsAsPresenter)&&void 0!==s?s:[],panelistAll:null!==(o=x.panelistAll)&&void 0!==o&&o,selectedPanelistSessions:null!==(l=x.sessionsAsPanelist)&&void 0!==l?l:[],onCheckboxChange:function(e,t){var n,a=e.target.name,i=e.target.checked;m(Object(r.a)(Object(r.a)({},x),{},(n={},Object(Tt.a)(n,a,i),Object(Tt.a)(n,t,b.map((function(e){return e.id}))),n)))},onMultiSelectChange:function(e){var t=e.target.name,n=e.target.value;m(Object(r.a)(Object(r.a)({},x),{},Object(Tt.a)({},t,"string"===typeof n?n.split(","):n)))}})]})})]})},is=Object(qe.a)(Jc||(Jc=Object(Me.a)(["\n  query GetNextStepsEmailContent($hubMemberCohortId: String!) {\n    getNextStepsEmailContent(hubMemberCohortId: $hubMemberCohortId) {\n      subject\n      text\n    }\n  }\n"]))),cs=Object(qe.a)(Zc||(Zc=Object(Me.a)(["\n  mutation SendNextStepsEmail($emailData: SendNextStepsEmailInput!) {\n    sendNextStepsEmail(emailData: $emailData)\n  }\n"]))),ss=n(76),os=function(e){var t=e.hubMemberCohortId,n=Object(a.useState)(!1),r=Object(L.a)(n,2),i=r[0],c=r[1],s=Object(a.useState)(""),o=Object(L.a)(s,2),l=o[0],d=o[1],u=Object(a.useState)(""),j=Object(L.a)(u,2),b=j[0],h=j[1],O=Object(B.b)(is,{variables:{hubMemberCohortId:t},skip:!i,fetchPolicy:"no-cache"}),x=O.loading,m=O.data;Object(a.useEffect)((function(){if(m){var e=m.getNextStepsEmailContent,t=e.subject,n=e.text;d(t),h(n)}}),[m]);var p=Object(Ze.a)(cs,{refetchQueries:[Ia]}),v=Object(L.a)(p,2),g=v[0],f=v[1].loading,y=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g({variables:{emailData:{hubMemberCohortId:t,subject:l,text:b}}});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){c(!1)};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:x,title:"Loading..."}),Object(D.jsx)(le,{isOpen:f,title:"Saving..."}),Object(D.jsx)(J.a,{title:"Send Next Steps Email",children:Object(D.jsx)(ae.a,{sx:{color:"primary.main",cursor:"pointer",mr:3},onClick:function(){return c(!0)}})}),Object(D.jsxs)(ie.a,{open:i,onClose:C,children:[Object(D.jsx)(ce.a,{children:"Deny Registration"}),Object(D.jsxs)(se.a,{children:[Object(D.jsxs)(Oe.a,{children:[Object(D.jsx)("b",{children:"Subject: "})," ",l]}),Object(D.jsx)("br",{}),Object(D.jsx)(ss,{id:"nextStepsEmailContent",value:b,onChange:function(e){return h(e)}})]}),Object(D.jsxs)(he.a,{children:[Object(D.jsx)(G.a,{onClick:C,children:"Cancel"}),Object(D.jsx)(G.a,{variant:"contained",onClick:y,children:"Send Next Steps"})]})]})]})},ls=Object(qe.a)(Kc||(Kc=Object(Me.a)(["\n  query SearchUsersByName($firstName: String, $lastName: String) {\n    searchUsersByName(firstName: $firstName, lastName: $lastName) {\n      id\n      firstName\n      lastName\n      email\n      userCredentialsForDisplay\n      organization\n      userRolesForDisplay\n      partnerId\n    }\n  }\n"]))),ds=n(336),us=n.n(ds);function js(e){return us.a.isEmpty(e.trim())}var bs,hs,Os,xs,ms,ps,vs=Object(qe.a)(_c||(_c=Object(Me.a)(["\n  mutation AddExistingHubMemberCohort($hubMemberCohort: AddExistingHubMemberCohortInput!) {\n    addExistingHubMemberCohort(hubMemberCohort: $hubMemberCohort) {\n      id\n      userId\n      cohortId\n    }\n  }\n"]))),gs=function(e){var t=e.cohortId,n=e.onCloseDrawer,r=Object(a.useState)(""),i=Object(L.a)(r,2),c=i[0],s=i[1],o=Object(a.useState)(""),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)(!1),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(a.useState)([]),m=Object(L.a)(x,2),p=m[0],v=m[1],g=Object(a.useState)(!1),f=Object(L.a)(g,2),y=f[0],C=f[1],S=Object(gt.a)(ls,{fetchPolicy:"no-cache"}),k=Object(L.a)(S,2),A=k[0],T=k[1],E=T.loading,P=T.data,R=Object(Ze.a)(vs,{refetchQueries:[Ia]}),F=Object(L.a)(R,2),U=F[0],M=F[1],q=M.loading,z=M.error;Object(a.useEffect)((function(){var e;v(null!==(e=null===P||void 0===P?void 0:P.searchUsersByName)&&void 0!==e?e:[])}),[P]);var H=function(e){var t=e.target.name,n=e.target.value;"firstName"===t&&s(n),"lastName"===t&&u(n)},W=function(){O(!1),js(c)&&js(d)?O(!0):(C(!0),A({variables:{firstName:c,lastName:d}}))},Y=function(){v([]),C(!1),O(!1),s(""),u("")},B=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(r){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,U({variables:{hubMemberCohort:{cohortId:t,userId:r}}});case 3:Y(),n(),e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),Q=function(e){"Enter"===e.key&&W()};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:E,title:"Loading..."}),Object(D.jsx)(le,{isOpen:q,title:"Saving..."}),Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(w.a,{variant:"h6",children:"Search for Existing User"}),h&&Object(D.jsx)(me.a,{severity:"error",children:"You must enter something to search by"}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{item:!0,xs:6,paddingRight:1,children:Object(D.jsx)(It.a,{fullWidth:!0,size:"small",label:"First Name",name:"firstName",onChange:H,onKeyPress:Q,value:c,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,xs:6,paddingLeft:1,children:Object(D.jsx)(It.a,{fullWidth:!0,size:"small",label:"Last Name",name:"lastName",onChange:H,onKeyPress:Q,value:d,color:"warning"})})]}),Object(D.jsx)(w.a,{variant:"caption",children:"Search by first and/or last name"}),Object(D.jsx)(G.a,{variant:"contained",color:"primary",onClick:W,children:"Search"}),z&&Object(D.jsx)(me.a,{severity:"error",children:z.graphQLErrors[0].message}),y&&0===p.length&&Object(D.jsx)(me.a,{severity:"info",children:"No matches were found"}),p.length>0&&Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{children:"Name"}),Object(D.jsx)(ne.a,{children:"Email"})]})}),Object(D.jsx)(ee.a,{children:p.map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{children:Object(D.jsx)(J.a,{title:"Add ".concat(e.firstName," to hub team"),children:Object(D.jsx)(kc.a,{sx:{color:"primary.main",cursor:"pointer"},onClick:function(){return B(e.id)}})})}),Object(D.jsx)(ne.a,{component:"th",scope:"row",children:"".concat(e.lastName,", ").concat(e.firstName)}),Object(D.jsx)(ne.a,{children:e.email})]},e.id)}))})]})}),Object(D.jsx)(G.a,{variant:"outlined",color:"primary",onClick:function(){Y(),n()},children:"Cancel"})]})]})},fs=function(e){var t=e.cohortId,n=Object(a.useState)(!1),r=Object(L.a)(n,2),i=r[0],c=r[1];return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(Lt,{trigger:Object(D.jsx)(G.a,{variant:"outlined",size:"small",startIcon:Object(D.jsx)(kc.a,{}),sx:{color:"primary.main",cursor:"pointer"},children:"Add Hub Team Member"}),width:550,title:"Add Hub Member",showSave:!1,showCancel:!1,isOpen:i,openDrawer:function(){c(!0)},children:Object(D.jsx)(Q.a,{sx:{width:"100%"},children:Object(D.jsx)(gs,{cohortId:t,onCloseDrawer:function(){c(!1)}})})})})},ys=Object(qe.a)(bs||(bs=Object(Me.a)(["\n  mutation DeleteHubMemberCohortById($hubMemberCohortId: ID!) {\n    deleteHubMemberCohortById(hubMemberCohortId: $hubMemberCohortId)\n  }\n"]))),Cs=function(){var e,t=Object(F.j)().cohortId,n=Object(B.b)(Da,{variables:{cohortId:t}}),r=n.loading,a=n.data,i=Object(B.b)(ka,{variables:{cohortId:t}}),c=i.loading,s=i.data,o=Object(Ze.a)(ts,{refetchQueries:[Ia]}),l=Object(L.a)(o,1)[0],d=Object(Ze.a)(ys,{refetchQueries:[Ia]}),u=Object(L.a)(d,2),j=u[0],b=u[1].loading,h=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=3;break}return e.next=3,j({variables:{hubMemberCohortId:n}});case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),O=null!==(e=null===s||void 0===s?void 0:s.getMembersByCohort)&&void 0!==e?e:[];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:r||c,title:"Loading..."}),Object(D.jsx)(le,{isOpen:b,title:"Saving..."}),Object(D.jsx)(T,{title:"Hub Team Management"}),Object(D.jsx)(I.a,{sx:{mb:2},spacing:2,direction:"row",children:!r&&Object(D.jsx)(fs,{cohortId:t})}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{size:"small","aria-label":"a dense table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{children:"Hide"}),Object(D.jsx)(ne.a,{children:"Name"}),Object(D.jsx)(ne.a,{children:"Role(s)"}),Object(D.jsx)(ne.a,{children:"Next Steps Sent"}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:O.map((function(e){var t,n,r,i,c,s,o,d,u;return Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:Object(D.jsx)(J.a,{title:"Edit ".concat(null===e||void 0===e||null===(t=e.user)||void 0===t?void 0:t.firstName),children:Object(D.jsx)(as,{trigger:Object(D.jsx)(qt.a,{sx:{color:"primary.main",cursor:"pointer"}}),drawerTitle:"Edit ".concat(null===e||void 0===e||null===(n=e.user)||void 0===n?void 0:n.firstName," ").concat(null===e||void 0===e||null===(r=e.user)||void 0===r?void 0:r.lastName),sessions:null===a||void 0===a?void 0:a.getSessionsByCohort,cohortMember:e})})}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Vt.a,{checked:e.hide||!1,onChange:function(t){return function(e,t){var n=ns(t.id,t.sessionsAsFacilitator,t.sessionsAsPresenter,t.sessionsAsPanelist);l({variables:{hubMemberCohort:{id:t.id,facilitateAll:t.facilitateAll,presentAll:t.presentAll,panelistAll:t.panelistAll,credentials:t.credentials,hubMemberCohortSessions:n,hide:e.target.checked}}})}(t,e)}})}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Wt,{userId:e.userId,name:"".concat(null===e||void 0===e||null===(i=e.user)||void 0===i?void 0:i.firstName," ").concat(null===e||void 0===e||null===(c=e.user)||void 0===c?void 0:c.lastName),email:null===e||void 0===e||null===(s=e.user)||void 0===s?void 0:s.email})}),Object(D.jsx)(ne.a,{children:rs(e)}),Object(D.jsx)(ne.a,{children:e.nextStepsSentDate?ke(e.nextStepsSentDate,!0):""}),Object(D.jsxs)(ne.a,{align:"right",children:[rs(e).length>0&&!e.nextStepsSentDate&&Object(D.jsx)(os,{hubMemberCohortId:e.id}),Object(D.jsx)(tr,{iconTooltip:"Remove ".concat(null===e||void 0===e||null===(o=e.user)||void 0===o?void 0:o.firstName," from hub team"),dialogTitle:"Remove Hub Team Member",confirmText:"Remove Team Member",dialogText:"This will remove ".concat(null===e||void 0===e||null===(d=e.user)||void 0===d?void 0:d.firstName," ").concat(null===e||void 0===e||null===(u=e.user)||void 0===u?void 0:u.lastName," from the hub team."),onClose:h,reference:e.id})]})]},e.id)}))})]})})]})},ws=n(1003),Ss=n(1004),Is=n(471),ks=n.n(Is),As=n(176),Ns=n.n(As),Ds=n(472),Ts=n.n(Ds),Es=n(269),Ps=n.n(Es),Rs=n(470),Ls=n.n(Rs),Fs=function(e){var t=e.activeComponent,n=e.switchComponent,r=Object(pn.a)({stickyBottom:{position:"fixed",bottom:95,width:"95%"},container:{display:"flex","justify-content":"space-around",zIndex:100}})();return Object(D.jsx)("div",{className:r.container,children:Object(D.jsxs)(ws.a,{value:t,onChange:function(e,t){n(t)},showLabels:!0,className:r.stickyBottom,children:[Object(D.jsx)(Ss.a,{label:"Dashboard",icon:Object(D.jsx)(Ps.a,{})}),Object(D.jsx)(Ss.a,{label:"Edit",icon:Object(D.jsx)(qt.a,{})}),Object(D.jsx)(Ss.a,{label:"Registration Questions",icon:Object(D.jsx)(Ls.a,{})}),Object(D.jsx)(Ss.a,{label:"Sessions",icon:Object(D.jsx)(ks.a,{})}),Object(D.jsx)(Ss.a,{label:"Registrants",icon:Object(D.jsx)(Ns.a,{})}),Object(D.jsx)(Ss.a,{label:"Email",icon:Object(D.jsx)(ae.a,{})}),Object(D.jsx)(Ss.a,{label:"Hub",icon:Object(D.jsx)(Ts.a,{})})]})})},Us=Object(pn.a)((function(e){return Object(mn.a)({bottomBuffer:{paddingBottom:55},breadcrumbLink:{color:e.palette.warning.main}})})),Ms=function(){var e=Us(),t=Object(F.j)().cohortId,n=Object(a.useState)(0),r=Object(L.a)(n,2),i=r[0],c=r[1],s=Object(a.useState)(),l=Object(L.a)(s,2),d=l[0],u=l[1],j=Object(B.b)(fn,{variables:{cohortId:t}}),b=j.loading,h=j.data;Object(a.useEffect)((function(){b||u(null===h||void 0===h?void 0:h.getCohortById)}),[h,b]);var O=it(),x=function(){var e,t,n,r,a,i,c;return(null===(e=O.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=O.user)||void 0===t?void 0:t.isAdmin)||(null===(n=O.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=O.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=O.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=O.user)||void 0===i?void 0:i.isEvaluationStaff)||(null===(c=O.user)||void 0===c?void 0:c.isPartner)};return x()&&x()?Object(D.jsx)(D.Fragment,{children:x()&&Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:2,"& ul, & ol":{marginLeft:"17px"}},children:[Object(D.jsxs)(vn.a,{"aria-label":"breadcrumb",style:{paddingBottom:25},children:[Object(D.jsx)(Z.a,{color:"inherit",href:"/admin/current-projects",children:"Current Projects"}),Object(D.jsx)(o.b,{className:e.breadcrumbLink,to:"/admin/program/dashboard/".concat(null===h||void 0===h?void 0:h.getCohortById.programId),children:"Program Dashboard"}),Object(D.jsx)(w.a,{color:"textPrimary",children:null===d||void 0===d?void 0:d.internalLabel})]}),d&&Object(D.jsxs)(D.Fragment,{children:[0===i?Object(D.jsx)(Aa,{cohortId:d.id}):null,1===i?Object(D.jsx)($n,{cohort:d}):null,2===i?Object(D.jsx)(wr,{registrationQuestions:d.registrationQuestions,cohortId:d.id}):null,3===i?Object(D.jsx)(mi,{cohortId:d.id}):null,4===i?Object(D.jsx)(fc,{cohortId:d.id,internalLabel:d.internalLabel}):null,5===i?Object(D.jsx)(Bc,{cohortId:d.id,programID:d.programId}):null,6===i?Object(D.jsx)(Cs,{}):null]}),Object(D.jsx)("div",{className:e.bottomBuffer,children:"\xa0"}),Object(D.jsx)(Fs,{activeComponent:i,switchComponent:function(e){c(e)}})]})}):Object(D.jsx)($e,{})},qs=function(e){var t=e.breadcrumbs,n=t.length-1;return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(Q.a,{sx:{textAlign:"left",mb:2},children:t&&t.map((function(e,t){return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)("span",{children:[e.isActive&&e.to?Object(D.jsx)(Z.a,{component:o.b,to:e.to,children:e.text}):Object(D.jsx)(D.Fragment,{children:e.text}),t<n?Object(D.jsx)(D.Fragment,{children:"\xa0\xa0/\xa0\xa0"}):Object(D.jsx)(D.Fragment,{})]})})}))})})},zs="/login",Hs="Log In",Ws={href:"/change-password",text:"Change Password"},Ys={href:"/createAccount",text:"Create an Account"},Bs={href:"/forgotPassword",text:"Forgot My Password"},Qs={href:"/resetPassword",title:"Reset Password"},$s={href:"/my-account",text:"Edit My Account"},Vs={href:"/cohortDetails",text:"Details"},Gs={href:"/my-echos",text:"My ECHOs"},Js={href:"/programs",text:"Browse Programs"},Zs={href:"/admin/programs",text:"All Programs"},Ks={href:"/admin/current-projects",text:"Current Projects"},_s={href:"/admin/program/manageEmailTemplates",text:"Manage Email Templates"},Xs={href:"/admin/program/manageResources",text:"Manage Resources"},eo={href:"/admin/program/dashboard",text:"Manage Program"},to=Object(qe.a)(hs||(hs=Object(Me.a)(["\n  mutation AddPreRegistrant($preRegistrant: AddCohortPreRegistrationInput!) {\n    addPreRegistrant(preRegistrant: $preRegistrant) {\n      id\n    }\n  }\n"]))),no=(Object(qe.a)(Os||(Os=Object(Me.a)(["\n  query GetPreRegistrationsForUser($userId: ID!) {\n    getPreRegistrationsForUser(userId: $userId) {\n      id\n      cohortId\n      userId\n      email\n      emailSent\n      firstName\n      lastName\n      organization\n      profession\n      createdAt\n    }\n  }\n"]))),function(e){var t,n=e.cohortTitle,i=e.cohortId,c=Object(F.h)(),s=it(),o=Object(a.useState)(!1),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)(function(){var e,t;if(!s.user)return{cohortId:i,firstName:"",lastName:"",email:""};return{userId:s.user.id,cohortId:i,firstName:H("first"),lastName:H("last"),email:null!==(e=null===(t=s.user)||void 0===t?void 0:t.email)&&void 0!==e?e:""}}()),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(a.useState)(!1),m=Object(L.a)(x,2),p=m[0],v=m[1],g=Object(a.useState)(""),f=Object(L.a)(g,2),y=f[0],C=f[1],S=Object(a.useState)(!1),k=Object(L.a)(S,2),A=k[0],T=k[1],E=Object(Ze.a)(to,{refetchQueries:["GetPreRegistrationsForUser"]}),P=Object(L.a)(E,2),R=P[0],U=P[1].loading,M=function(e){var t=e.target.name,n=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},Object(Tt.a)({},t,n)))},q=function(){O({cohortId:i,firstName:"",lastName:"",email:""}),C(""),v(!1),u(!1)},z=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,v(!1),C(""),h.firstName&&0!==h.firstName.length&&h.lastName&&0!==h.lastName.length&&h.email&&0!==h.email.length||(v(!0),0)){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,R({variables:{preRegistrant:h}});case 5:T(!0),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),C(e.t0.graphQLErrors[0].message);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();function H(e){try{if(!s.user||!s.user.fullName)return"";var t=s.user.fullName.split(" ");return"first"===e?t[0]:t[1]}catch(n){return""}}return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:U,title:"Saving..."}),Object(D.jsx)(G.a,{variant:"contained",onClick:function(){var e;null!==(e=s.user)&&void 0!==e&&e.isAuthenticated?u(!0):c.push(zs)},children:"Pre-Register For This Cohort"}),Object(D.jsxs)(ie.a,{open:d,onClose:q,children:[Object(D.jsxs)(ce.a,{children:["Pre-Register for ",n]}),Object(D.jsxs)(se.a,{children:[Object(D.jsx)(Oe.a,{children:"Please fill out the form below to pre-register. You will receive an email when registration for this cohort has been opened."}),Object(D.jsxs)(Q.a,{sx:{mt:2},children:[A&&Object(D.jsx)(me.a,{severity:"success",children:"Your pre-registration was successful"}),!A&&Object(D.jsx)(D.Fragment,{children:null!==(t=s.user)&&void 0!==t&&t.isAuthenticated?Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsxs)(N.a,{item:!0,md:6,xs:12,children:[Object(D.jsx)(w.a,{variant:"h6",children:"Name"}),Object(D.jsx)(w.a,{variant:"body1",children:"".concat(h.firstName," ").concat(h.lastName)})]}),Object(D.jsxs)(N.a,{item:!0,md:6,xs:12,children:[Object(D.jsx)(w.a,{variant:"h6",children:"Email"}),Object(D.jsx)(w.a,{variant:"body1",children:h.email})]})]})}):Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(It.a,{value:h.firstName,name:"firstName",label:"First Name",color:"warning",fullWidth:!0,variant:"standard",onChange:M}),Object(D.jsx)(It.a,{value:h.lastName,name:"lastName",label:"Last Name",color:"warning",fullWidth:!0,variant:"standard",onChange:M}),Object(D.jsx)(It.a,{value:h.email,name:"email",label:"Email",color:"warning",fullWidth:!0,variant:"standard",onChange:M})]})})})]}),p&&Object(D.jsx)(me.a,{sx:{mt:2},severity:"error",children:"All Fields are Required"}),y.length>0&&Object(D.jsx)(me.a,{severity:"error",children:y})]}),Object(D.jsxs)(he.a,{children:[A&&Object(D.jsx)(G.a,{variant:"contained",onClick:q,children:"Close"}),!A&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(G.a,{variant:"outlined",onClick:q,children:"Cancel"}),Object(D.jsx)(G.a,{variant:"contained",onClick:z,children:"Pre-Register"})]})]})]})]})}),ro=Object(qe.a)(xs||(xs=Object(Me.a)(["\n  query GetRegistrationsForUser($userId: ID!) {\n    getRegistrationsForUser(userId: $userId) {\n      id\n      cohortId\n      userId\n      isActive\n      isApproved\n      isDenied\n      isWaitlisted\n      copiedFromWaitlist\n      createdAt\n    }\n  }\n"]))),ao=function(){var e,t,n,r,i,c,s=it(),o=Object(F.h)(),l=Object(F.j)().cohortId,d=Object(B.b)(Tn,{variables:{cohortId:l}}),u=d.data,j=d.loading,b=Object(B.b)(ro,{variables:{userId:null!==(e=null===(t=s.user)||void 0===t?void 0:t.id)&&void 0!==e?e:""}}),h=b.data,O=b.loading,x=null===u||void 0===u?void 0:u.getCohortDashboard,m=(null!==(n=null===h||void 0===h?void 0:h.getRegistrationsForUser)&&void 0!==n?n:[]).some((function(e){return e.cohortId===l})),p=[{to:"/programs",text:"Browse Programs",isActive:!0},{text:null!==(r=null===x||void 0===x?void 0:x.externalTitle)&&void 0!==r?r:"",isActive:!1}],v=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.push("/registration/".concat(l));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=function(e,t,n,r){return r?"Cohort is Ongoing":e?t?Ae(e,!t,!1):ke(e,n,!1):""},f=Object(a.useState)(),y=Object(L.a)(f,2),C=y[0],I=y[1],k=new Date;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:j||O,title:"Loading"}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:12,"& ul, & ol":{marginLeft:"17px"}},children:[Object(D.jsx)(qs,{breadcrumbs:p}),x&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:null!==(i=x.externalTitle)&&void 0!==i?i:""}),Object(D.jsx)("br",{}),Object(D.jsx)("br",{}),Object(D.jsxs)(Q.a,{sx:{mb:2},children:[Object(D.jsxs)(N.a,{container:!0,spacing:9,sx:{pb:2},children:[Object(D.jsxs)(N.a,{item:!0,xs:6,md:8,children:[Object(D.jsx)(kr,{label:"When This ECHO Meets",value:x.scheduleDescription}),Object(D.jsx)(kr,{label:"What This ECHO Will Focus On",value:x.evaluationGoal}),Object(D.jsx)(kr,{label:"Learning Objectives/Outcomes",value:x.learningObjectives})]}),Object(D.jsxs)(N.a,{item:!0,xs:6,md:4,sx:{pl:10},children:[Object(D.jsx)(w.a,{variant:"body1",children:Object(D.jsx)(kr,{label:"Start Date",value:g(x.startDate,!1,!1)})}),Object(D.jsx)("br",{}),Object(D.jsx)(w.a,{variant:"body1",children:Object(D.jsx)(kr,{label:"End Date",value:g(x.endDate,!1,!1,x.isOngoing)})})]})]}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},"aria-label":"simple table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(zr,{currentSort:null===C||void 0===C?void 0:C.prop,onSort:I,sortProperty:"number",headerText:"Session/Title",align:"left"}),Object(D.jsx)(zr,{currentSort:null===C||void 0===C?void 0:C.prop,onSort:I,sortProperty:"startDate",headerText:"Date",align:"left"}),Object(D.jsx)(zr,{currentSort:null===C||void 0===C?void 0:C.prop,onSort:I,sortProperty:"startDate",headerText:"Time",align:"left"})]})}),Object(D.jsx)(ee.a,{children:x.allSessions&&qr(x.allSessions,C).map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{align:"left",children:"".concat(e.number," - ").concat(e.title)}),Object(D.jsx)(ne.a,{align:"left",children:g(e.startDate,!1,!1)}),Object(D.jsx)(ne.a,{align:"left",children:g(e.startDate,!0,!0)})]},e.id)}))})]})}),Object(D.jsx)(N.a,{container:!0,spacing:2,sx:{pb:2,mt:1,textAlign:"center"},children:Object(D.jsxs)(N.a,{item:!0,xs:12,md:12,children:[m&&Object(D.jsx)(me.a,{severity:"info",children:"You have already requested registration for this cohort"}),!m&&x.allowPreregistration&&(!x.registrationOpenDate||new Date(x.registrationOpenDate)>k)&&Object(D.jsx)(no,{cohortTitle:null!==(c=x.externalTitle)&&void 0!==c?c:"",cohortId:l}),!m&&x.registrationOpenDate&&new Date(x.registrationOpenDate)<=k&&Object(D.jsx)(G.a,{sx:{mb:3},onClick:v,variant:"contained",color:"primary",children:"Sign Up For This ECHO"})]})})]})]})]})]})},io=Object(qe.a)(ms||(ms=Object(Me.a)(["\n  query GetCohortRoster($cohortId: String!) {\n    getCohortRoster(cohortId: $cohortId) {\n      cohortTitle\n      cohortRosters {\n        name\n        email\n        credentials\n        organization\n        location\n      }\n    }\n  }\n"]))),co=function(){var e,t,n=Object(F.j)().cohortId,r=Object(B.b)(io,{variables:{cohortId:n}}),a=r.data,i=r.loading,c=null===a||void 0===a?void 0:a.getCohortRoster,s=[{to:"/my-echos",text:"My ECHOs",isActive:!0},{to:"/program-dashboard/".concat(n),text:"".concat(null!==(e=null===c||void 0===c?void 0:c.cohortTitle)&&void 0!==e?e:""),isActive:!0},{text:"Cohort Roster",isActive:!1}];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:i,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:12},children:[Object(D.jsx)(qs,{breadcrumbs:s}),Object(D.jsx)(T,{title:null!==(t=null===c||void 0===c?void 0:c.cohortTitle)&&void 0!==t?t:""}),!1,Object(D.jsx)(w.a,{sx:{mt:4,textAlign:"left"},variant:"h6",color:"primary",children:"Cohort Roster"}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Name"}),Object(D.jsx)(ne.a,{children:"Credentials"}),Object(D.jsx)(ne.a,{children:"Organization"}),Object(D.jsx)(ne.a,{children:"Location"})]})}),Object(D.jsx)(ee.a,{children:c&&c.cohortRosters&&c.cohortRosters.map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsxs)(ne.a,{children:[e.name,Object(D.jsx)(J.a,{title:"Email ".concat(e.name),children:Object(D.jsx)(Z.a,{href:e.email,children:Object(D.jsx)(ae.a,{sx:{fontSize:16,verticalAlign:"middle",ml:1}})})})]}),Object(D.jsx)(ne.a,{children:e.credentials}),Object(D.jsx)(ne.a,{children:e.organization}),Object(D.jsx)(ne.a,{children:e.location})]},e.email)}))})]})})]})]})},so=n(473),oo=n.n(so),lo=Object(qe.a)(ps||(ps=Object(Me.a)(["\n  query GetAccountLookups {\n    getAccountLookups {\n      credentials {\n        id\n        name\n        isOther\n      }\n      professions {\n        id\n        name\n        isOther\n        secondLevelProfessions {\n          id\n          name\n          isOther\n          thirdLevelProfessions {\n            id\n            name\n            isOther\n          }\n        }\n      }\n      ethnicities {\n        id\n        name\n        isOther\n      }\n      counties {\n        id\n        name\n      }\n      organizationDescriptions {\n        id\n        name\n      }\n      sexs {\n        id\n        name\n        sortOrder\n      }\n      marketingSources {\n        id\n        name\n        sortOrder\n      }\n      roleDescriptions {\n        id\n        name\n      }\n      workSettings {\n        id\n        name\n        isOther\n      }\n    }\n  }\n"]))),uo=n(97),jo=function(e,t){if(t&&t.length>0){var n=uo.findIndex(uo.propEq("id",e))(t);if(n>-1){var r=t[n];if(r){var a=r.secondLevelProfessions;if(a&&a.length>0)return a}}}return[]},bo=function(e,t,n){if(n){var r=jo(e,n);if(r&&r.length>0){var a=uo.findIndex(uo.propEq("id",t))(r);if(a>-1){var i=r[a];if(i){var c=i.thirdLevelProfessions;if(c&&c.length>0)return c}}}}return[]},ho=function(e,t,n,r){if(!r)return!1;var a=null,i=null,c=uo.findIndex(uo.propEq("id",e))(r);if(c>-1&&(a=r[c]).isOther)return!0;if(a&&a.secondLevelProfessions&&t.length>0){var s=uo.findIndex(uo.propEq("id",t))(a.secondLevelProfessions);if(s>-1&&(i=a.secondLevelProfessions[s]).isOther)return!0}if(i&&i.thirdLevelProfessions&&n.length>0){var o=uo.findIndex(uo.propEq("id",n))(i.thirdLevelProfessions);if(o>-1&&i.thirdLevelProfessions[o].isOther)return!0}return!1},Oo=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,r;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==t.length){e.next=2;break}return e.abrupt("return",[]);case 2:return n="".concat(x.j,"/county?state=").concat(t),e.next=5,Xr.a.get(n);case 5:return r=e.sent.data,e.abrupt("return",r.data);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),xo=n(474),mo=function(e){var t=e.title;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{sx:{textAlign:"left"},variant:"h5",children:t}),Object(D.jsx)(xe.a,{sx:{mb:2}})]})},po=n(97),vo=function(e,t){if(!e||0===e.length)return!1;var n,r=!1,a=Object(Ac.a)(e);try{for(a.s();!(n=a.n()).done;){var i,c=n.value;if(null!==(i=t[po.findIndex(po.propEq("id",c))(t)])&&void 0!==i&&i.isOther){r=!0;break}}}catch(s){a.e(s)}finally{a.f()}return r},go=function(e,t){if(!e||0===e.length)return!1;var n,r=!1,a=Object(Ac.a)(e);try{for(a.s();!(n=a.n()).done;){var i=n.value,c=po.findIndex(po.propEq("id",i))(t);if(!c||!t[c])return!1;if(4===t[c].sortOrder){r=!0;break}}}catch(s){a.e(s)}finally{a.f()}return r},fo=function(e,t){if(!e||0===e.length)return!1;var n,r=!1,a=Object(Ac.a)(e);try{for(a.s();!(n=a.n()).done;){var i,c=n.value;if(null!==(i=t[po.findIndex(po.propEq("id",c))(t)])&&void 0!==i&&i.isOther){r=!0;break}}}catch(s){a.e(s)}finally{a.f()}return r},yo=function(e,t){if(!e||0===e.length)return!1;var n,r=!1,a=Object(Ac.a)(e);try{for(a.s();!(n=a.n()).done;){var i,c=n.value;if(null!==(i=t[po.findIndex(po.propEq("id",c))(t)])&&void 0!==i&&i.isOther){r=!0;break}}}catch(s){a.e(s)}finally{a.f()}return r};function Co(e){var t=null===e||void 0===e?void 0:e.trim();return!(!t||0===t.length)}function wo(e){return null!==e&&void 0!==e}function So(e){return null!==e&&void 0!==e}function Io(e){return!(!e||0===e.length)}var ko,Ao,No,Do,To,Eo,Po,Ro={PaperProps:{style:{maxHeight:224,width:250}}},Lo=["yes","no"],Fo=function(e){var t=e.classes,n=e.sexs,r=e.onChange,i=e.value,c=e.user,s=e.onFormElementChange,o=Object(a.useState)(!1),l=Object(L.a)(o,2),d=l[0],u=l[1];return Object(a.useEffect)((function(){u(1===function(e,t){return t.length>0&&e?(t.find((function(t){return t.id===e}))||{}).sortOrder:""}(i,n))}),[n,i]),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:n.length>0&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"sex-select-label",color:"warning",children:"How do you identify?"}),Object(D.jsx)(kt.a,{required:!0,className:t.accountText,labelId:"sex-select-label",id:"sex-select",label:"How do you identify?",color:"warning",onChange:r,renderValue:function(){return function(e,t){return t?(t.find((function(t){return t.id===e}))||{}).name:""}(i,n)},value:i||"",sx:{textAlign:"left"},children:n.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))})]}),d&&Object(D.jsx)(It.a,{sx:{mt:1},required:!0,className:t.accountText,label:"Other Identity",name:"otherSex",value:null===c||void 0===c?void 0:c.otherSex,onChange:s,color:"warning"})]})})},Uo=function(e){var t=e.classes,n=e.onChange,r=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Lo.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"firsttime-select-label",color:"warning",children:"First time you are participating in ECHO?"}),Object(D.jsxs)(kt.a,{required:!0,className:t.accountText,labelId:"firsttime-select-label",id:"firsttime-select",label:"First time you are participating in ECHO?",color:"warning",onChange:n,sx:{textAlign:"left"},value:null===r?"":!0===r?"yes":"no",children:[Object(D.jsx)(St.a,{value:"",disabled:!0,children:"Select One"}),Lo.map((function(e,t){return Object(D.jsx)(St.a,{value:e,children:e},t)}))]})]})})},Mo=function(e){var t=e.classes,n=e.marketingSources,r=e.onChange,a=e.value,i=e.showOtherMarketingSource,c=e.user,s=e.onFormElementChange;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:n.length>0&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"marketingSources-label",color:"warning",children:"How did you hear about ECHO? (select all that apply)"}),Object(D.jsx)(kt.a,{required:!0,className:t.accountSelect,labelId:"marketingSources-label",multiple:!0,value:a.length?a:[],onChange:r,input:Object(D.jsx)(Cc.a,{label:"How did you hear about ECHO? (select all that apply)"}),renderValue:function(e){return function(e,t){var n,r=[],a=Object(Ac.a)(t);try{var i=function(){var t=n.value;r.push.apply(r,Object(Vn.a)(e.filter((function(e){return e.id===t})).map((function(e){return e.name}))))};for(a.s();!(n=a.n()).done;)i()}catch(c){a.e(c)}finally{a.f()}return r.join(", ")}(n,e)},MenuProps:Ro,color:"warning",children:n.map((function(e,t){return Object(D.jsxs)(St.a,{value:e.id,children:[Object(D.jsx)(Vt.a,{checked:a.indexOf(e.id)>-1}),Object(D.jsx)(wc.a,{primary:e.name})]},t)}))})]}),i&&Object(D.jsx)(It.a,{required:!0,className:t.accountText,label:"Other",name:"otherMarketingSource",value:c.otherMarketingSource,onChange:s,color:"warning",sx:{textAlign:"center"}})]})})},qo=function(e){var t=e.classes,n=e.roleDescriptions,r=e.onChange,a=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:n.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"roledesc-select-label",color:"warning",children:"Which of the following best describes your role?"}),Object(D.jsx)(kt.a,{required:!0,className:t.accountText,labelId:"roledesc-select-label",id:"roledesc-select",label:"Which of the following best describes your role?",color:"warning",renderValue:function(){return function(e,t){return t.find((function(t){return t.id===e})).name}(a,n)},value:a||"",onChange:r,sx:{textAlign:"left"},children:n.map((function(e,t){return Object(D.jsx)(St.a,{value:e.id,children:e.name},t)}))})]})})},zo=function(e){var t=e.classes,n=e.startYears,r=e.onChange,a=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:n.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"startyear-select-label",color:"warning",children:"What year did you start in your current profession?"}),Object(D.jsx)(kt.a,{required:!0,className:t.accountText,labelId:"startyear-select-label",id:"startyear-select",label:"What year did you start in your current profession?",color:"warning",value:a||"",onChange:r,sx:{textAlign:"left"},children:n.map((function(e,t){return Object(D.jsx)(St.a,{value:e,children:e},t)}))})]})})},Ho=function(e){var t=e.classes,n=e.birthYears,r=e.onChange,a=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:n.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"birthyear-select-label",color:"warning",children:"What is your birth year?"}),Object(D.jsx)(kt.a,{required:!0,className:t.accountText,labelId:"birthyear-select-label",id:"birthyear-select",label:"What is your birth year?",color:"warning",value:a||"",onChange:r,children:n.map((function(e,t){return Object(D.jsx)(St.a,{value:e,children:e},t)}))})]})})},Wo=function(e){var t=e.classes,n=e.isHome,r=e.user,a=e.sexs,i=e.marketingSources,c=e.roleDescriptions,s=e.onSexChange,o=e.onMarketingSourceIdsChange,l=e.onFirstTimeChange,d=e.onStartYearChange,u=e.onRoleDescChange,j=e.onBirthYearChange,b=e.onFormElementChange,h=e.showOtherMarketingSource,O=Object(x.h)();return n?O===Ie.a||O===Ie.e?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Fo,{classes:t,sexs:a,user:r,value:r.sexId,onChange:s,onFormElementChange:b}),Object(D.jsx)(Ho,{classes:t,birthYears:Bo,value:r.birthYear,onChange:j}),Object(D.jsx)(Uo,{classes:t,onChange:l,value:r.firstSeries}),Object(D.jsx)(Mo,{classes:t,marketingSources:i,value:r.marketingSourceIds,onChange:o,showOtherMarketingSource:h,user:r,onFormElementChange:b}),Object(D.jsx)(qo,{classes:t,roleDescriptions:c,value:r.roleDescriptionId,onChange:u}),Object(D.jsx)(zo,{classes:t,startYears:Yo,value:r.professionStartYear,onChange:d})]}):O===Ie.g?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Fo,{classes:t,sexs:a,value:r.sexId,onChange:s,onFormElementChange:b,user:r}),Object(D.jsx)(Ho,{classes:t,birthYears:Bo,value:r.birthYear,onChange:j})]}):O===Ie.u?Object(D.jsx)(D.Fragment,{}):O===Ie.c?Object(D.jsx)(Fo,{classes:t,sexs:a,value:r.sexId,onChange:s,onFormElementChange:b,user:r}):(Ie.b,Object(D.jsx)(D.Fragment,{})):Object(D.jsx)(D.Fragment,{})},Yo=[2024,2023,2022,2021,2020,2019,2018,2017,2016,2015,2014,2013,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2e3,1999,1998,1997,1996,1995,1994,1993,1992,1991,1990,1989,1988,1987,1986,1985,1984,1983,1982,1981,1980,1979,1978,1977,1976,1975,1974,1973,1972,1971,1970,1969,1968,1967,1966,1965,1964,1963,1962,1961,1960,1959,1958,1957,1956,1955,1954,1953,1952,1951,1950,1949,1948,1947,1946,1945,1944,1943,1942,1941,1940],Bo=function(){for(var e=(new Date).getFullYear(),t=[],n=e;n>=e-80;n--)e-n>17&&t.push(n);return t}(),Qo={PaperProps:{style:{maxHeight:224,width:250}}},$o=function(e,t){var n,r=[],a=Object(Ac.a)(t);try{var i=function(){var t=n.value;r.push.apply(r,Object(Vn.a)(e.filter((function(e){return e.id===t})).map((function(e){return e.name}))))};for(a.s();!(n=a.n()).done;)i()}catch(c){a.e(c)}finally{a.f()}return r.join(", ")},Vo=function(e){var t=e.classes,n=e.onChange,r=e.organizationDescriptions,a=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:r.length>0&&Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"orgdesc-label",color:"warning",children:"Select option(s) that describe the organization"}),Object(D.jsx)(kt.a,{required:!0,className:t.accountSelect,labelId:"orgdesc-label",multiple:!0,value:a.length?a:[],onChange:n,input:Object(D.jsx)(Cc.a,{label:"Select option(s) that describe the organization where you work"}),renderValue:function(e){return $o(r,e)},MenuProps:Qo,color:"warning",children:r.map((function(e,t){return Object(D.jsxs)(St.a,{value:e.id,disabled:(n=a,i=r,c=e,function(e,t){return e.indexOf(t.id)>-1}(n,i.find((function(e){return"None of the Above"===e.name})))&&"None of the Above"!==c.name),children:[Object(D.jsx)(Vt.a,{checked:a.indexOf(e.id)>-1}),Object(D.jsx)(wc.a,{primary:e.name})]},t);var n,i,c}))})]})})},Go=function(e){var t=e.user,n=e.classes,r=e.workSettings,a=e.showOtherWorkSetting,i=e.onChange,c=e.onFormElementChange,s=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:r.length>0&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"orgdesc-label",color:"warning",children:"Select option(s) that describe your work setting"}),Object(D.jsx)(kt.a,{required:!0,className:n.accountSelect,labelId:"orgdesc-label",multiple:!0,value:s.length?s:[],onChange:i,input:Object(D.jsx)(Cc.a,{label:"Select option(s) that describe your work setting"}),renderValue:function(e){return $o(r,e)},MenuProps:Qo,color:"warning",children:r.map((function(e,t){return Object(D.jsxs)(St.a,{value:e.id,children:[Object(D.jsx)(Vt.a,{checked:s.indexOf(e.id)>-1}),Object(D.jsx)(wc.a,{primary:e.name})]},t)}))})]}),a&&Object(D.jsx)(It.a,{required:!0,className:n.accountText,label:"Other Work Setting",name:"otherWorkSetting",value:t.otherWorkSetting,onChange:c,color:"warning",sx:{textAlign:"center"}})]})})},Jo=function(e){var t=e.isHome,n=e.user,r=e.classes,a=e.organizationDescriptions,i=e.workSettings,c=e.showOtherWorkSetting,s=e.onOrgDescChange,o=e.onWorkSettingChange,l=e.onFormElementChange,d=Object(x.h)();return t?d===Ie.a||d===Ie.e||d===Ie.g?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Vo,{classes:r,organizationDescriptions:a,onChange:s,value:n.organizationDescriptionIds}),Object(D.jsx)(Go,{classes:r,workSettings:i,onChange:o,value:n.workSettingIds,showOtherWorkSetting:c,user:n,onFormElementChange:l})]}):d===Ie.u?Object(D.jsx)(D.Fragment,{}):d===Ie.c?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Vo,{classes:r,organizationDescriptions:a,onChange:s,value:n.organizationDescriptionIds}),Object(D.jsx)(Go,{classes:r,workSettings:i,onChange:o,value:n.workSettingIds,showOtherWorkSetting:c,user:n,onFormElementChange:l})]}):(Ie.b,Object(D.jsx)(D.Fragment,{})):Object(D.jsx)(D.Fragment,{})},Zo=["yes","no"],Ko=function(e){var t=e.classes,n=e.onChange,r=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Zo.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"direct-care-select-label",color:"warning",children:"Do you provide direct care to patients/clients?"}),Object(D.jsxs)(kt.a,{required:!0,className:t.accountText,labelId:"direct-care-select-label",id:"direct-care-select",label:"Do you provide direct care to patients/clients?",color:"warning",onChange:n,value:null===r?"":!0===r?"yes":"no",sx:{textAlign:"left"},children:[Object(D.jsx)(St.a,{value:"",disabled:!0,children:"Select One"}),Zo.map((function(e,t){return Object(D.jsx)(St.a,{value:e,children:e},t)}))]})]})})},_o=function(e){var t=e.classes,n=e.onChange,r=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Zo.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"provide-medicaid-select-label",color:"warning",children:"Are you a medicaid provider?"}),Object(D.jsxs)(kt.a,{required:!0,className:t.accountText,labelId:"provide-medicaid-select-label",id:"provide-medicaid-select",label:"Are you a medicaid provider?",color:"warning",onChange:n,sx:{textAlign:"left"},value:null===r?"":!0===r?"yes":"no",children:[Object(D.jsx)(St.a,{value:"",disabled:!0,children:"Select One"}),Zo.map((function(e,t){return Object(D.jsx)(St.a,{value:e,children:e},t)}))]})]})})},Xo=function(e){var t=e.classes,n=e.onChange,r=e.value;return Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Zo.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"primary-care-select-label",color:"warning",children:"Do you work in a primary care setting?"}),Object(D.jsxs)(kt.a,{required:!0,className:t.accountText,labelId:"primary-care-select-label",id:"primary-care-select",label:"Do you work in a primary care setting?",color:"warning",onChange:n,sx:{textAlign:"left"},value:null===r?"":!0===r?"yes":"no",children:[Object(D.jsx)(St.a,{value:"",disabled:!0,children:"Select One"}),Zo.map((function(e,t){return Object(D.jsx)(St.a,{value:e,children:e},t)}))]})]})})},el=function(e){var t=e.user,n=e.classes,r=e.onDirectCareChange,a=e.onProvideMedicaidChange,i=e.onPrimaryCareChange,c=Object(x.h)();return c===Ie.a||c===Ie.e||c===Ie.g?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Ko,{classes:n,value:t.provideDirectCare,onChange:r}),Object(D.jsx)(_o,{classes:n,value:t.provideMedicaid,onChange:a}),Object(D.jsx)(Xo,{classes:n,value:t.primaryCare,onChange:i})]}):c===Ie.u?Object(D.jsx)(Ko,{classes:n,value:t.provideDirectCare,onChange:r}):c===Ie.c||c===Ie.b?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Ko,{classes:n,value:t.provideDirectCare,onChange:r}),Object(D.jsx)(_o,{classes:n,value:t.provideMedicaid,onChange:a}),Object(D.jsx)(Xo,{classes:n,value:t.primaryCare,onChange:i})]}):Object(D.jsx)(D.Fragment,{})},tl=(n(97),Object(pn.a)((function(e){return Object(mn.a)({accountText:{width:"600px",marginBottom:2},accountSelect:{width:"600px",marginBottom:2,textAlign:"left"},select:{width:"600px",marginBottom:2,textAlign:"left"}})}))),nl={PaperProps:{style:{maxHeight:224,width:250}}},rl=function(e){var t,n,i=e.userAccount,c=e.onSave,s=e.buttonText,o=e.submissionError,l=e.mode,d=Object(x.h)(),u=tl(),j=Object(a.useState)(i),b=Object(L.a)(j,2),h=b[0],O=b[1],m=Object(a.useState)([]),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)(null!==(t=h.credentials)&&void 0!==t?t:[]),y=Object(L.a)(f,2),C=y[0],S=y[1],I=Object(a.useState)(null!==(n=h.ethnicities)&&void 0!==n?n:[]),k=Object(L.a)(I,2),A=k[0],T=k[1],E=Object(a.useState)(h.state),P=Object(L.a)(E,2),R=(P[0],P[1]),F=Object(a.useState)([]),U=Object(L.a)(F,2),M=U[0],q=U[1],z=Object(a.useState)(h.countyId),H=Object(L.a)(z,2),W=(H[0],H[1]),Y=Object(a.useState)(h.phone||""),$=Object(L.a)(Y,2),V=$[0],J=$[1],Z=Object(a.useState)([]),K=Object(L.a)(Z,2),_=K[0],X=K[1],ee=Object(a.useState)([]),te=Object(L.a)(ee,2),ne=te[0],re=te[1],ae=Object(a.useState)(!1),ie=Object(L.a)(ae,2),ce=ie[0],se=ie[1],oe=Object(a.useState)(!1),le=Object(L.a)(oe,2),de=le[0],ue=le[1],je=Object(a.useState)(!1),be=Object(L.a)(je,2),he=be[0],Oe=be[1],xe=Object(a.useState)(!1),pe=Object(L.a)(xe,2),ve=pe[0],ge=pe[1],fe=Object(a.useState)(!1),ye=Object(L.a)(fe,2),Ce=ye[0],we=ye[1],Se=Object(B.b)(lo),ke=Se.error,Ae=Se.data,Ne=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.credentials)&&void 0!==e?e:[]}),[Ae]),De=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.professions)&&void 0!==e?e:[]}),[Ae]),Te=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.ethnicities)&&void 0!==e?e:[]}),[Ae]),Ee=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.workSettings)&&void 0!==e?e:[]}),[Ae]),Pe=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.sexs)&&void 0!==e?e:[]}),[Ae]),Re=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.marketingSources)&&void 0!==e?e:[]}),[Ae]),Le=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.organizationDescriptions)&&void 0!==e?e:[]}),[Ae]),Fe=Object(a.useMemo)((function(){var e,t;return null!==(e=null===Ae||void 0===Ae||null===(t=Ae.getAccountLookups)||void 0===t?void 0:t.roleDescriptions)&&void 0!==e?e:[]}),[Ae]),Ue=Object(a.useMemo)((function(){return!((h.userTenantIds||[]).length>0)||(h.userTenantIds||[]).includes(d)}),[h,d]);Object(a.useEffect)((function(){var e,t,n,r,a,c,s,o;function l(){return l=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Oo(null!==(t=i.state)&&void 0!==t?t:"");case 2:n=e.sent,q(n);case 4:case"end":return e.stop()}}),e)}))),l.apply(this,arguments)}(O(i),function(){l.apply(this,arguments)}(),se(vo(null!==(e=i.credentials)&&void 0!==e?e:[],Ne)),ge(go(null!==(t=i.marketingSourceIds)&&void 0!==t?t:[],Re)),we(fo(null!==(n=i.workSettingIds)&&void 0!==n?n:[],Ee)),ue(yo(null!==(r=i.ethnicities)&&void 0!==r?r:[],Te)),Oe(ho(null!==(a=i.professionId)&&void 0!==a?a:"",null!==(c=i.secondLevelProfessionId)&&void 0!==c?c:"",null!==(s=i.thirdLevelProfessionId)&&void 0!==s?s:"",De)),i.professionId&&i.professionId.length>0&&X(jo(i.professionId,De)),i.secondLevelProfessionId&&i.secondLevelProfessionId.length>0)&&re(bo(null!==(o=i.professionId)&&void 0!==o?o:"",i.secondLevelProfessionId,De))}),[Ne,Te,Re,De,i,Ee]);var Me=function(e){var t=e.target.name,n=e.target.value;"email"===t&&(n=e.target.value.trim()),O(Object(r.a)(Object(r.a)({},h),{},Object(Tt.a)({},t,n)))},qe=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,a;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.target.value,R(n),O(Object(r.a)(Object(r.a)({},h),{},{state:n})),e.next=5,Oo(null!==n&&void 0!==n?n:"");case 5:a=e.sent,q(a);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ze=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,W(n),O(Object(r.a)(Object(r.a)({},h),{},{countyId:n}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),He=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,O(Object(r.a)(Object(r.a)({},h),{},{sexId:n}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),We=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,a;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,a="string"===typeof n?n.split(","):n,ge(go(a,Re)),O(Object(r.a)(Object(r.a)({},h),{},{marketingSourceIds:a}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ye=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,O(Object(r.a)(Object(r.a)({},h),{},{firstSeries:"yes"===n}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Be=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,O(Object(r.a)(Object(r.a)({},h),{},{professionStartYear:Number(n)}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Qe=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,O(Object(r.a)(Object(r.a)({},h),{},{roleDescriptionId:n}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),$e=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,a,i;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,a=Le.find((function(e){return"None of the Above"===e.name})),i=[],i=n.indexOf(a.id)>-1?[a.id]:"string"===typeof n?n.split(","):n,O(Object(r.a)(Object(r.a)({},h),{},{organizationDescriptionIds:i}));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Je=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n,a;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,a="string"===typeof n?n.split(","):n,we(fo(a,Ee)),O(Object(r.a)(Object(r.a)({},h),{},{workSettingIds:a}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ze=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){var n;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.value,O(Object(r.a)(Object(r.a)({},h),{},{birthYear:Number(n)}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ke=d===Ie.u?"Preferred Work Number":"Phone Number",_e=function(e){var t=e.target.value;J(t),O(Object(r.a)(Object(r.a)({},h),{},{phone:"".concat(t.replace(/\/d/g,"").replace(/\//g,"").replace("undefined",""))}))},et=function(){g([]);var e=[];return e.push.apply(e,Object(Vn.a)(function(e,t,n,r,a){var i,c,s,o,l,d,u,j,b=[],h=Object(x.h)();if("create"===a){var O,m,p;Co(e.password)||b.push("Password is required"),Co(e.confirmPassword)||b.push("Confirm password is required");var v=Object(Xe.b)(null!==(O=e.password)&&void 0!==O?O:"",null!==(m=e.confirmPassword)&&void 0!==m?m:"");v.isValid||b.push(null!==(p=v.message)&&void 0!==p?p:"")}return Co(e.firstName)||b.push("firstName is required"),Co(e.lastName)||b.push("lastName is required"),Co(e.email)||b.push("email is required"),h!==Ie.u&&(Co(e.phone)||b.push("phone is required"),So(e.provideMedicaid)||b.push("provideMedicaid is required"),So(e.primaryCare)||b.push("primaryCare is required")),Co(e.professionId)||b.push("professionId is required"),Co(e.organization)||b.push("organization is required"),Co(e.organizationAddress1)||b.push("organizationAddress1 is required"),Co(e.city)||b.push("city is required"),Co(e.state)||b.push("state is required"),Co(e.countyId)||b.push("countyId is required"),h!==Ie.u&&(Co(e.sexId)||b.push("identity is required")),h!==Ie.a&&h!==Ie.e||(Co(e.roleDescriptionId)||b.push("roleDescription is required"),So(e.firstSeries)||b.push("firstSeries is required"),Io(e.marketingSourceIds)||b.push("marketingSourceIds is required"),wo(e.professionStartYear)||b.push("professionStartYear is required"),wo(e.birthYear)||b.push("birthYear is required")),Co(e.zip)||b.push("zip is required"),So(e.provideDirectCare)||b.push("provideDirectCare is required"),Io(e.credentials)||b.push("credentials is required"),Io(e.ethnicities)||b.push("ethnicities is required"),Co(e.professionId)&&jo(null!==(d=e.professionId)&&void 0!==d?d:"",r).length>0&&!Co(e.secondLevelProfessionId)&&b.push("Secondary profession is required"),Co(e.secondLevelProfessionId)&&bo(null!==(u=e.professionId)&&void 0!==u?u:"",null!==(j=e.secondLevelProfessionId)&&void 0!==j?j:"",r).length>0&&!Co(e.thirdLevelProfessionId)&&b.push("Tertiary profession is required"),vo(null!==(i=e.credentials)&&void 0!==i?i:[],t)&&(Co(e.otherCredential)||b.push("Other credential is required")),yo(null!==(c=e.ethnicities)&&void 0!==c?c:[],n)&&(Co(e.otherEthnicity)||b.push("Other ethnicity is required")),ho(null!==(s=e.professionId)&&void 0!==s?s:"",null!==(o=e.secondLevelProfessionId)&&void 0!==o?o:"",null!==(l=e.thirdLevelProfessionId)&&void 0!==l?l:"",r)&&(Co(e.otherProfession)||b.push("Other profession is required")),b}(h,Ne,Te,De,l))),!(e.length>0)||(g(e),!1)};return Object(D.jsxs)(D.Fragment,{children:[ke&&Object(D.jsx)(me.a,{severity:"error",children:ke.graphQLErrors[0].message}),!h.isRegistrationComplete&&Object(D.jsx)(me.a,{severity:"error",children:"Please confirm and/or complete your required account creation questions below before proceeding"}),Object(D.jsxs)(Q.a,{sx:{mt:3,pb:2,textAlign:"center"},children:[Object(D.jsx)(w.a,{variant:"subtitle1",sx:{color:"#be051b",mb:1,textAlign:"left"},children:"* - all fields required"}),Object(D.jsx)(mo,{title:"Account Information"}),Object(D.jsxs)(N.a,{container:!0,spacing:2,sx:{pb:2,mt:1,textAlign:"center"},children:[Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"First Name",name:"firstName",value:h.firstName,onChange:Me,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Last Name",name:"lastName",value:h.lastName,onChange:Me,color:"warning"})})]}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Email",name:"email",value:h.email,onChange:Me,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(oo.a,{mask:"(999) 999-9999",value:V,onChange:_e,maskChar:" ",children:function(){return Object(D.jsx)(It.a,{className:u.accountSelect,label:Ke,name:"phone",type:"text",value:V,onChange:_e,required:d!==Ie.u||void 0})}})})]}),"create"===l&&Object(D.jsxs)(N.a,{container:!0,spacing:2,sx:{pb:2,mt:1,textAlign:"center"},children:[Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Password",name:"password",type:"password",value:h.password,onChange:Me,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Confirm Password",name:"confirmPassword",type:"password",value:h.confirmPassword,onChange:Me,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,lg:12,xs:12,sx:{mb:1},children:Object(D.jsx)(Et,{})})]})]}),Ue&&Object(D.jsxs)(Q.a,{sx:{mt:3,pb:2,textAlign:"center"},children:[Object(D.jsx)(mo,{title:"About Me"}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsxs)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:[Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"credentials-label",color:"warning",children:"Credentials"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"credentials-label",multiple:!0,value:C,onChange:function(e){var t=e.target.value,n="string"===typeof t?t.split(","):t;S(n),O(Object(r.a)(Object(r.a)({},h),{},{credentials:n})),se(vo(n,Ne))},input:Object(D.jsx)(Cc.a,{label:"Credentials"}),renderValue:function(e){return function(e,t){var n,r=[],a=Object(Ac.a)(t);try{var i=function(){var t=n.value;r.push.apply(r,Object(Vn.a)(e.filter((function(e){return e.id===t})).map((function(e){return e.name}))))};for(a.s();!(n=a.n()).done;)i()}catch(c){a.e(c)}finally{a.f()}return r.join(", ")}(Ne,e)},MenuProps:nl,color:"warning",children:Ne.map((function(e){return Object(D.jsxs)(St.a,{value:e.id,children:[Object(D.jsx)(Vt.a,{checked:C.indexOf(e.id)>-1}),Object(D.jsx)(wc.a,{primary:e.name})]},e.id)}))})]}),ce&&Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Other Credential",name:"otherCredential",value:h.otherCredential,onChange:Me,color:"warning",sx:{textAlign:"center"}})]}),Object(D.jsxs)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:[Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"ethnicities-label",color:"warning",children:"Race/Ethnicity"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"ethnicities-label",multiple:!0,value:A,onChange:function(e){var t=e.target.value,n="string"===typeof t?t.split(","):t;T(n),O(Object(r.a)(Object(r.a)({},h),{},{ethnicities:n})),ue(yo(n,Te))},input:Object(D.jsx)(Cc.a,{label:"Race/Ethnicity"}),renderValue:function(e){return function(e,t){var n,r=[],a=Object(Ac.a)(t);try{var i=function(){var t=n.value;r.push.apply(r,Object(Vn.a)(e.filter((function(e){return e.id===t})).map((function(e){return e.name}))))};for(a.s();!(n=a.n()).done;)i()}catch(c){a.e(c)}finally{a.f()}return r.join(", ")}(Te,e)},MenuProps:nl,color:"warning",children:Te.map((function(e){return Object(D.jsxs)(St.a,{value:e.id,children:[Object(D.jsx)(Vt.a,{checked:A.indexOf(e.id)>-1}),Object(D.jsx)(wc.a,{primary:e.name})]},e.id)}))})]}),de&&Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Other Ethnicity",name:"otherEthnicity",value:h.otherEthnicity,onChange:Me,color:"warning"})]})]}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsxs)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:[Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"professions-label",color:"warning",children:"Profession"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"professions-label",value:h.professionId||"",input:Object(D.jsx)(Cc.a,{label:"Profession"}),onChange:function(e){var t=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},{professionId:t,secondLevelProfessionId:"",thirdLevelProfessionId:""})),X([]),re([]),Oe(ho(t,"","",De)),X(jo(t,De))},color:"warning",children:De.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))})]}),_.length>0&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)("br",{}),Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"secondary-professions-label",color:"warning",children:"Secondary Profession"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"secondary-professions-label",value:h.secondLevelProfessionId||"",onChange:function(e){var t=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},{secondLevelProfessionId:t,thirdLevelProfessionId:""})),re([]),Oe(ho(h.professionId||"",t,"",De)),re(bo(h.professionId||"",t,De))},color:"warning",children:_.length>0&&_.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))})]}),Object(D.jsx)("br",{})]}),ne&&ne.length>0&&Object(D.jsxs)(Ct.a,{sx:{mb:1},children:[Object(D.jsx)(wt.a,{required:!0,id:"third-professions-label",color:"warning",children:"Tertiary Profession"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"third-professions-label",value:h.thirdLevelProfessionId||"",onChange:function(e){var t=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},{thirdLevelProfessionId:t})),Oe(ho(h.professionId||"",h.secondLevelProfessionId||"",t,De))},color:"warning",children:ne.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))})]}),he&&Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Other Profession",name:"otherProfession",value:h.otherProfession,onChange:Me,color:"warning"})]}),Object(D.jsx)(Wo,{isHome:Ue,user:h,classes:u,sexs:Pe,marketingSources:Re,roleDescriptions:Fe,onSexChange:He,onMarketingSourceIdsChange:We,onFirstTimeChange:Ye,onStartYearChange:Be,onRoleDescChange:Qe,onBirthYearChange:Ze,showOtherMarketingSource:ve,onFormElementChange:Me})]})]}),Object(D.jsxs)(Q.a,{sx:{mt:3,pb:2,textAlign:"center"},children:[Object(D.jsx)(mo,{title:"My Organization"}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Organization/Employer",name:"organization",value:h.organization,onChange:Me,color:"warning"})}),Object(D.jsx)(Jo,{isHome:Ue,user:h,organizationDescriptions:Le,workSettings:Ee,classes:u,onOrgDescChange:$e,onWorkSettingChange:Je,showOtherWorkSetting:Ce,onFormElementChange:Me}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Organization Address 1",name:"organizationAddress1",value:h.organizationAddress1,onChange:Me,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{className:u.accountText,label:"Organization Address 2",name:"organizationAddress2",value:h.organizationAddress2,onChange:Me,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"City",name:"city",value:h.city,onChange:Me,color:"warning"})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"state-select-label",color:"warning",children:"State"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"state-select-label",id:"state-select",label:"State",value:h.state||"",onChange:qe,color:"warning",children:xo.map((function(e){return Object(D.jsx)(St.a,{value:e.abbreviation,children:e.name},e.abbreviation)}))})]})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:M.length>0&&Object(D.jsxs)(Ct.a,{children:[Object(D.jsx)(wt.a,{required:!0,id:"county-select-label",color:"warning",children:"County"}),Object(D.jsx)(kt.a,{required:!0,className:u.accountSelect,labelId:"county-select-label",id:"county-select",label:"County",disabled:!M.length,value:h.countyId||"",onChange:ze,color:"warning",children:M.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))})]})}),Object(D.jsx)(N.a,{item:!0,lg:6,xs:12,sx:{mb:1},children:Object(D.jsx)(It.a,{required:!0,className:u.accountText,label:"Zip",name:"zip",value:h.zip,onChange:Me,color:"warning"})})]}),Object(D.jsx)("br",{}),Object(D.jsx)(N.a,{container:!0,children:Object(D.jsx)(el,{classes:u,user:h,onPrimaryCareChange:function(e){var t=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},{primaryCare:"yes"===t}))},onProvideMedicaidChange:function(e){var t=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},{provideMedicaid:"yes"===t}))},onDirectCareChange:function(e){var t=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},{provideDirectCare:"yes"===t}))}})}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{name:"receiveEmails",checked:h.receiveEmails||!1,value:h.receiveEmails,onChange:function(e){var t=e.target.name,n=e.target.checked;O(Object(r.a)(Object(r.a)({},h),{},Object(Tt.a)({},t,n)))}}),label:"Yes, I want to receive ECHO emails"}),Object(D.jsx)("br",{}),Object(D.jsx)("br",{}),v.length>0&&Object(D.jsx)(me.a,{sx:{mb:2},severity:"error",children:Object(D.jsx)(Q.a,{sx:{ml:2,textAlign:"left"},children:Object(D.jsx)("ul",{children:v.map((function(e){return Object(D.jsx)("li",{children:e},e)}))})})}),o.length>0&&Object(D.jsx)(me.a,{sx:{mb:2},severity:"error",children:o}),Object(D.jsx)(G.a,{sx:{mb:6},variant:"contained",color:"primary",onClick:function(){et()&&(O(Object(r.a)(Object(r.a)({},h),{},{isRegistrationComplete:!0})),c(h))},children:s})]})]})},al=Object(qe.a)(ko||(ko=Object(Me.a)(["\n  mutation AddUser($user: AddOrUpdateUserInput) {\n    addUser(user: $user) {\n      id\n      firstName\n      lastName\n      email\n    }\n  }\n"]))),il=function(){var e,t=Object(F.h)(),n=Object(Ze.a)(al),r=Object(L.a)(n,2),a=r[0],i=r[1],c=i.error,s=i.loading,o=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,a({variables:{user:n}});case 3:c||t.push("/login"),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.log(e.t0);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:12},children:[Object(D.jsx)(T,{title:"Create Your Account"}),c&&Object(D.jsx)(me.a,{severity:"error",children:c.graphQLErrors[0].message}),Object(D.jsx)(le,{isOpen:s,title:"Saving..."}),Object(D.jsx)(Q.a,{sx:{mt:3},children:Object(D.jsx)(rl,{userAccount:{firstName:"",lastName:"",email:"",password:"",confirmPassword:"",otherCredential:"",professionId:"",secondLevelProfessionId:"",thirdLevelProfessionId:"",otherProfession:"",otherEthnicity:"",otherMarketingSource:"",otherWorkSetting:"",organization:"",organizationAddress1:"",organizationAddress2:"",city:"",state:"",countyId:"",zip:"",provideDirectCare:null,provideMedicaid:null,primaryCare:null,credentials:[],ethnicities:[],sexId:null,otherSex:"",marketingSourceIds:[],firstSeries:null,professionStartYear:null,roleDescriptionId:null,organizationDescriptionIds:[],workSettingIds:[],birthYear:null,phone:"",userTenantIds:[],isRegistrationComplete:!0},onSave:o,buttonText:"Create Account",submissionError:null!==(e=null===c||void 0===c?void 0:c.graphQLErrors[0].message)&&void 0!==e?e:"",mode:"create"})})]})})},cl=Object(qe.a)(Ao||(Ao=Object(Me.a)(["\n  query GetAllOpenCohorts($status: String!) {\n    getAllOpenCohorts(status: $status) {\n      id\n      internalLabel\n      externalLabel\n      startDate\n      endDate\n      isOngoing\n      meetingLink\n      archived\n      registrationCloseDate\n      registrationOpenDate\n      preRegistrantsCount\n      newRegistrantsCount\n      registeredCount\n      waitlistCount\n      deniedCount\n      nextSessionDate\n      program {\n        name\n      }\n      developmentUser {\n        id\n        fullName\n        email\n      }\n      implementationUser {\n        id\n        fullName\n        email\n      }\n      evaluationUser {\n        id\n        fullName\n        email\n      }\n      developmentSupportUser {\n        id\n        firstName\n        lastName\n      }\n      evaluationSupportUser {\n        id\n        firstName\n        lastName\n      }\n      implementationSupportUser {\n        id\n        firstName\n        lastName\n      }\n    }\n  }\n"]))),sl=n(475),ol=n(946),ll=n(945),dl=function(e){var t=e.cohortId,n=e.meetingLink,r=e.developmentUser,a=e.evaluationUser,i=e.implementationUser,c=e.registrationOpenDate,s=e.registrationCloseDate,l=e.preRegistrantsCount,d=e.newRegistrantsCount,u=e.registeredCount,j=e.waitlistCount,b=e.deniedCount,h=e.developmentSupportUser,O=e.evaluationSupportUser,x=e.implementationSupportUser,m=$r()();return Object(D.jsxs)(D.Fragment,{children:[s&&s.length&&$r()(s).add(1,"day").isBefore(m)||c&&c.length&&$r()(c).isAfter(m)?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{xs:1,children:"\xa0"}),Object(D.jsx)(N.a,{xs:10,children:Object(D.jsx)(kr,{label:"",value:"Registration is currently closed"})}),Object(D.jsx)(N.a,{xs:1,children:"\xa0"})]}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{xs:1,children:"\xa0"}),Object(D.jsx)(N.a,{xs:5,children:Object(D.jsx)(Z.a,{component:o.b,to:"/admin/cohort/".concat(t),children:"Dashboard Link"})}),Object(D.jsx)(N.a,{xs:5,children:n&&Object(D.jsx)(Z.a,{href:n,children:"Video Conference Link"})}),Object(D.jsx)(N.a,{xs:1,children:"\xa0"})]})]}):Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{xs:2,children:"\xa0"}),Object(D.jsx)(N.a,{xs:4,children:Object(D.jsx)(Z.a,{component:o.b,to:"/admin/cohort/".concat(t),children:"Dashboard Link"})}),Object(D.jsx)(N.a,{xs:4,children:Object(D.jsx)(Z.a,{href:"/registration/".concat(t),children:"Registration Link"})}),Object(D.jsx)(N.a,{xs:2,children:"\xa0"})]}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{xs:3,children:"\xa0"}),Object(D.jsx)(N.a,{xs:5,children:n&&Object(D.jsx)(Z.a,{href:n,children:"Video Conference Link"})}),Object(D.jsx)(N.a,{xs:3,children:"\xa0"})]})]}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{width:"100%"},children:[Object(D.jsx)(je.a,{children:Object(D.jsx)(te.a,{children:Object(D.jsx)(ne.a,{align:"center",children:"ECHO Team Leads"})})}),Object(D.jsxs)(ee.a,{children:[Object(D.jsx)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:Object(D.jsxs)(ne.a,{children:[Object(D.jsx)("b",{children:"Development: "})," ",r]})}),Object(D.jsx)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:Object(D.jsxs)(ne.a,{children:[Object(D.jsx)("b",{children:"Implementation: "})," ",i]})}),Object(D.jsx)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:Object(D.jsxs)(ne.a,{children:[Object(D.jsx)("b",{children:"Evaluation: "})," ",a]})})]})]})}),Object(D.jsx)(K.a,{sx:{margin:"10px 0"},component:_.a,children:Object(D.jsxs)(X.a,{sx:{width:"100%"},children:[Object(D.jsx)(je.a,{children:Object(D.jsx)(te.a,{children:Object(D.jsx)(ne.a,{align:"center",children:"ECHO Support Team"})})}),Object(D.jsxs)(ee.a,{children:[Object(D.jsx)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:Object(D.jsxs)(ne.a,{children:[Object(D.jsx)("b",{children:"Development: "})," ",h.map((function(e,t){return 0===t?e:", ".concat(e)}))]})}),Object(D.jsx)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:Object(D.jsxs)(ne.a,{children:[Object(D.jsx)("b",{children:"Implementation: "})," ",x.map((function(e,t){return 0===t?e:", ".concat(e)}))]})}),Object(D.jsx)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:Object(D.jsxs)(ne.a,{children:[Object(D.jsx)("b",{children:"Evaluation: "})," ",O.map((function(e,t){return 0===t?e:", ".concat(e)}))]})})]})]})}),Object(D.jsxs)("div",{children:[Object(D.jsx)(Ir,{text:"Registrant Summary"}),Object(D.jsx)(X.a,{size:"small",children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Pre-Registrants"}),Object(D.jsx)(ne.a,{align:"right",children:l||0})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"New Registrants"}),Object(D.jsx)(ne.a,{align:"right",children:d||0})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Registered"}),Object(D.jsx)(ne.a,{align:"right",children:u||0})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Waitlisted"}),Object(D.jsx)(ne.a,{align:"right",children:j||0})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{children:"Denied"}),Object(D.jsx)(ne.a,{align:"right",children:b||0})]})]})})]})]})},ul=function(e){return e?ke(e,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!1,!1,!0):""},jl=function(e){var t=e.title,n=e.cohorts,i=e.statusQuery,c=e.setStatusQuery,s=Object(pn.a)((function(e){return Object(mn.a)({select:{textAlign:"left"}})}))(),l=Object(a.useState)(null),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(null),h=Object(L.a)(b,2),O=h[0],x=h[1],m={prop:"internalLabel",order:"asc"},p=Object(a.useState)(m),v=Object(L.a)(p,2),g=v[0],f=v[1],y=n.filter((function(e){var t=e.startDate&&null!=u&&new Date(e.startDate).getTime()>=new Date(u).getTime(),n=e.endDate&&null!=O&&(!0===e.isOngoing||new Date(e.endDate).getTime()<=new Date(O).getTime());return(null===u||null!=u&&t)&&(null===O||null!=O&&n)})).map((function(e){var t,n;return Object(r.a)(Object(r.a)({},e),{},{programName:null===(t=e.program)||void 0===t||null===(n=t.name)||void 0===n?void 0:n.trim().toLowerCase()})}));return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:t}),Object(D.jsx)(ft.a,{sx:{width:"100%",mb:3,textAlign:"left"},children:Object(D.jsx)(yt.a,{children:Object(D.jsxs)(N.a,{container:!0,spacing:1,children:[Object(D.jsxs)(N.a,{item:!0,lg:4,xs:12,children:[Object(D.jsx)(wt.a,{id:"credentials-label",children:"Status"}),Object(D.jsxs)(kt.a,{label:"Status",value:i,className:s.select,onChange:function(e){return c(e.target.value)},sx:{width:"70%"},children:[Object(D.jsx)(St.a,{value:"All",children:"View All"}),Object(D.jsx)(St.a,{value:"Development",children:"Development"}),Object(D.jsx)(St.a,{value:"Live",children:"Live"}),Object(D.jsx)(St.a,{value:"Post Series",children:"Post Series"}),Object(D.jsx)(St.a,{value:"Archived",children:"Archived"}),Object(D.jsx)(St.a,{value:"Active",children:"Active (everything except for archived)"})]})]}),Object(D.jsxs)(sl.a,{dateAdapter:ll.a,children:[Object(D.jsxs)(N.a,{item:!0,lg:3,xs:12,children:[Object(D.jsx)(wt.a,{id:"credentials-label",children:"Start Date"}),Object(D.jsx)(ol.a,{slotProps:{textField:{}},value:u,className:s.select,onChange:function(e){return j(e)},sx:{width:"90%"}})]}),Object(D.jsxs)(N.a,{item:!0,lg:3,xs:12,children:[Object(D.jsx)(wt.a,{id:"credentials-label",children:"End Date"}),Object(D.jsx)(ol.a,{value:O,className:s.select,onChange:function(e){return x(e)},slotProps:{textField:{}},sx:{width:"90%"}})]})]})]})})}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{size:"small",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(zr,{currentSort:null===g||void 0===g?void 0:g.prop,onSort:f,sortProperty:"internalLabel",headerText:"Cohort Title",order:null===g||void 0===g?void 0:g.order}),Object(D.jsx)(zr,{currentSort:null===g||void 0===g?void 0:g.prop,onSort:f,sortProperty:"preRegistrantsCount",headerText:"Pre Registrants",order:null===g||void 0===g?void 0:g.order}),Object(D.jsx)(zr,{currentSort:null===g||void 0===g?void 0:g.prop,onSort:f,sortProperty:"newRegistrantsCount",headerText:"New Registrants",order:null===g||void 0===g?void 0:g.order}),Object(D.jsx)(zr,{currentSort:null===g||void 0===g?void 0:g.prop,onSort:f,sortProperty:"registeredCount",headerText:"Registered",order:null===g||void 0===g?void 0:g.order}),Object(D.jsx)(zr,{currentSort:null===g||void 0===g?void 0:g.prop,onSort:f,sortProperty:"startDate",headerText:"Start Date",order:null===g||void 0===g?void 0:g.order}),Object(D.jsx)(zr,{currentSort:null===g||void 0===g?void 0:g.prop,onSort:f,sortProperty:"endDate",headerText:"End Date",order:null===g||void 0===g?void 0:g.order}),Object(D.jsx)(zr,{currentSort:null===g||void 0===g?void 0:g.prop,onSort:f,sortProperty:"nextSessionDate",headerText:"Next Session",order:null===g||void 0===g?void 0:g.order}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:Mr(y,g.order?g:m).map((function(e){var t,n,r,a,i,c,s,l,d,u;return Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:Object(D.jsx)(J.a,{title:"Dashboard for ".concat(e.internalLabel),children:Object(D.jsx)(Z.a,{component:o.b,to:"/admin/cohort/".concat(e.id),children:e.internalLabel})})}),Object(D.jsx)(ne.a,{children:0!==e.preRegistrantsCount?e.preRegistrantsCount:""}),Object(D.jsx)(ne.a,{children:0!==e.newRegistrantsCount?e.newRegistrantsCount:""}),Object(D.jsx)(ne.a,{children:0!==e.registeredCount?e.registeredCount:""}),Object(D.jsx)(ne.a,{children:ul(e.startDate)}),Object(D.jsx)(ne.a,{children:e.isOngoing?"Ongoing":ul(e.endDate)}),Object(D.jsx)(ne.a,{children:"No session currently scheduled"!==e.nextSessionDate?e.nextSessionDate:""}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(J.a,{title:"More Info for ".concat(e.internalLabel),children:Object(D.jsx)(Lt,{trigger:Object(D.jsx)(Pa.a,{sx:{color:"primary.main",cursor:"pointer"}}),width:450,title:null!==(t=e.internalLabel)&&void 0!==t?t:"",showSave:!1,showCancel:!0,isOpen:!1,textAlign:"center",anchor:"right",cancelText:"Close",children:Object(D.jsx)(dl,{preRegistrantsCount:e.preRegistrantsCount,newRegistrantsCount:e.newRegistrantsCount,registeredCount:e.registeredCount,waitlistCount:e.waitlistCount,deniedCount:e.deniedCount,cohortId:e.id,meetingLink:e.meetingLink,developmentSupportUser:(null===e||void 0===e||null===(n=e.developmentSupportUser)||void 0===n?void 0:n.map((function(e){return"".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName)})))||[],evaluationSupportUser:(null===e||void 0===e||null===(r=e.evaluationSupportUser)||void 0===r?void 0:r.map((function(e){return"".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName)})))||[],implementationSupportUser:(null===e||void 0===e||null===(a=e.implementationSupportUser)||void 0===a?void 0:a.map((function(e){return"".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName)})))||[],registrationOpenDate:e.registrationOpenDate,registrationCloseDate:e.registrationCloseDate,developmentUser:null!==(i=null===(c=e.developmentUser)||void 0===c?void 0:c.fullName)&&void 0!==i?i:"",evaluationUser:null!==(s=null===(l=e.evaluationUser)||void 0===l?void 0:l.fullName)&&void 0!==s?s:"",implementationUser:null!==(d=null===(u=e.implementationUser)||void 0===u?void 0:u.fullName)&&void 0!==d?d:""})})})})]})}))})]})})]})},bl=function(){var e,t=Object(a.useState)("Live"),n=Object(L.a)(t,2),r=n[0],i=n[1],c=Object(B.b)(cl,{fetchPolicy:"no-cache",variables:{status:r}}),s=c.loading,o=c.data,l=null!==(e=null===o||void 0===o?void 0:o.getAllOpenCohorts)&&void 0!==e?e:[],d=it(),u=function(){var e,t,n,r,a,i,c;return(null===(e=d.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=d.user)||void 0===t?void 0:t.isAdmin)||(null===(n=d.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=d.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=d.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=d.user)||void 0===i?void 0:i.isEvaluationStaff)||(null===(c=d.user)||void 0===c?void 0:c.isPartner)};return u()&&u()?Object(D.jsx)(D.Fragment,{children:u()&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:s,title:"Loading..."}),Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:10,mb:6},children:Object(D.jsx)(jl,{title:"All Current Projects",cohorts:l,statusQuery:r,setStatusQuery:i})})]})}):Object(D.jsx)($e,{})},hl="GetUserById",Ol=Object(qe.a)(No||(No=Object(Me.a)(["\n  query GetUserById($id: String!) {\n    getUserById(id: $id) {\n      id\n      firstName\n      lastName\n      email\n      otherCredential\n      otherWorkSetting\n      professionId\n      secondLevelProfessionId\n      thirdLevelProfessionId\n      otherProfession\n      otherEthnicity\n      otherMarketingSource\n      organization\n      organizationAddress1\n      organizationAddress2\n      city\n      state\n      countyId\n      zip\n      provideDirectCare\n      provideMedicaid\n      primaryCare\n      createdAt\n      updatedAt\n      credentials\n      receiveEmails\n      userCredentialIds\n      userEthnicityIds\n      marketingSourceIds\n      organizationDescriptionIds\n      workSettingIds\n      userTenantIds\n      roleDescriptionId\n      sexId\n      otherSex\n      firstSeries\n      birthYear\n      professionStartYear\n      phone\n      isRegistrationComplete\n    }\n  }\n"]))),xl=Object(qe.a)(Do||(Do=Object(Me.a)(["\n  mutation UpdateUser($user: AddOrUpdateUserInput) {\n    updateUser(user: $user) {\n      id\n      firstName\n      lastName\n      email\n    }\n  }\n"]))),ml=function(){var e=Object(F.j)().userId,t=Object(F.h)(),n=Object(a.useState)(""),r=Object(L.a)(n,2),i=r[0],c=r[1],s=Object(B.b)(Ol,{variables:{id:e}}),o=s.data,l=s.loading,d=null===o||void 0===o?void 0:o.getUserById,u=Object(Ze.a)(xl),j=Object(L.a)(u,2),b=j[0],h=j[1],O=h.error,x=h.loading,m=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(""),e.prev=1,e.next=4,b({variables:{user:n},refetchQueries:[hl]});case 4:O||t.push("/admin/accounts"),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),c(e.t0.graphQLErrors[0].message);case 10:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:12},children:[d&&Object(D.jsx)(T,{title:"Edit ".concat(d.firstName," ").concat(d.lastName)}),i.length>0&&Object(D.jsx)(me.a,{severity:"error",children:i}),Object(D.jsx)(le,{isOpen:l,title:"Loading..."}),Object(D.jsx)(le,{isOpen:x,title:"Saving..."}),Object(D.jsx)(Q.a,{sx:{mt:3},children:!l&&Object(D.jsx)(rl,{userAccount:function(){var e,t,n,r,a,i,c,s,l,d,u,j,b,h,O,x,m,p,v,g,f,y,C,w,S,I,k,A,N,D,T,E,P,R,L,F,U,M,q,z,H,W,Y,B,Q,$,V,G,J,Z,K,_,X,ee,te,ne,re,ae,ie,ce,se,oe;return{city:null!==(e=null===o||void 0===o||null===(t=o.getUserById)||void 0===t?void 0:t.city)&&void 0!==e?e:"",countyId:null!==(n=null===o||void 0===o||null===(r=o.getUserById)||void 0===r?void 0:r.countyId)&&void 0!==n?n:"",credentials:null===o||void 0===o||null===(a=o.getUserById)||void 0===a?void 0:a.userCredentialIds,email:null!==(i=null===o||void 0===o||null===(c=o.getUserById)||void 0===c?void 0:c.email)&&void 0!==i?i:"",ethnicities:null===o||void 0===o||null===(s=o.getUserById)||void 0===s?void 0:s.userEthnicityIds,firstName:null!==(l=null===o||void 0===o||null===(d=o.getUserById)||void 0===d?void 0:d.firstName)&&void 0!==l?l:"",id:null!==(u=null===o||void 0===o||null===(j=o.getUserById)||void 0===j?void 0:j.id)&&void 0!==u?u:"",lastName:null!==(b=null===o||void 0===o||null===(h=o.getUserById)||void 0===h?void 0:h.lastName)&&void 0!==b?b:"",organization:null!==(O=null===o||void 0===o||null===(x=o.getUserById)||void 0===x?void 0:x.organization)&&void 0!==O?O:"",organizationAddress1:null!==(m=null===o||void 0===o||null===(p=o.getUserById)||void 0===p?void 0:p.organizationAddress1)&&void 0!==m?m:"",organizationAddress2:null!==(v=null===o||void 0===o||null===(g=o.getUserById)||void 0===g?void 0:g.organizationAddress2)&&void 0!==v?v:"",otherCredential:null!==(f=null===o||void 0===o||null===(y=o.getUserById)||void 0===y?void 0:y.otherCredential)&&void 0!==f?f:"",otherEthnicity:null!==(C=null===o||void 0===o||null===(w=o.getUserById)||void 0===w?void 0:w.otherEthnicity)&&void 0!==C?C:"",otherProfession:null!==(S=null===o||void 0===o||null===(I=o.getUserById)||void 0===I?void 0:I.otherProfession)&&void 0!==S?S:"",otherMarketingSource:null!==(k=null===o||void 0===o||null===(A=o.getUserById)||void 0===A?void 0:A.otherMarketingSource)&&void 0!==k?k:"",otherWorkSetting:null!==(N=null===o||void 0===o||null===(D=o.getUserById)||void 0===D?void 0:D.otherWorkSetting)&&void 0!==N?N:"",primaryCare:null===o||void 0===o||null===(T=o.getUserById)||void 0===T?void 0:T.primaryCare,professionId:null!==(E=null===o||void 0===o||null===(P=o.getUserById)||void 0===P?void 0:P.professionId)&&void 0!==E?E:"",provideDirectCare:null===o||void 0===o||null===(R=o.getUserById)||void 0===R?void 0:R.provideDirectCare,provideMedicaid:null===o||void 0===o||null===(L=o.getUserById)||void 0===L?void 0:L.provideMedicaid,receiveEmails:null!==(F=null===o||void 0===o||null===(U=o.getUserById)||void 0===U?void 0:U.receiveEmails)&&void 0!==F&&F,secondLevelProfessionId:null!==(M=null===o||void 0===o||null===(q=o.getUserById)||void 0===q?void 0:q.secondLevelProfessionId)&&void 0!==M?M:"",state:null!==(z=null===o||void 0===o||null===(H=o.getUserById)||void 0===H?void 0:H.state)&&void 0!==z?z:"",thirdLevelProfessionId:null!==(W=null===o||void 0===o||null===(Y=o.getUserById)||void 0===Y?void 0:Y.thirdLevelProfessionId)&&void 0!==W?W:"",zip:null!==(B=null===o||void 0===o||null===(Q=o.getUserById)||void 0===Q?void 0:Q.zip)&&void 0!==B?B:"",marketingSourceIds:null!==($=null===o||void 0===o||null===(V=o.getUserById)||void 0===V?void 0:V.marketingSourceIds)&&void 0!==$?$:[],organizationDescriptionIds:null!==(G=null===o||void 0===o||null===(J=o.getUserById)||void 0===J?void 0:J.organizationDescriptionIds)&&void 0!==G?G:[],roleDescriptionId:null!==(Z=null===o||void 0===o||null===(K=o.getUserById)||void 0===K?void 0:K.roleDescriptionId)&&void 0!==Z?Z:"",sexId:null!==(_=null===o||void 0===o||null===(X=o.getUserById)||void 0===X?void 0:X.sexId)&&void 0!==_?_:"",otherSex:null!==(ee=null===o||void 0===o||null===(te=o.getUserById)||void 0===te?void 0:te.otherSex)&&void 0!==ee?ee:"",firstSeries:null===o||void 0===o||null===(ne=o.getUserById)||void 0===ne?void 0:ne.firstSeries,birthYear:null===o||void 0===o||null===(re=o.getUserById)||void 0===re?void 0:re.birthYear,professionStartYear:null===o||void 0===o||null===(ae=o.getUserById)||void 0===ae?void 0:ae.professionStartYear,phone:null!==(ie=null===o||void 0===o||null===(ce=o.getUserById)||void 0===ce?void 0:ce.phone)&&void 0!==ie?ie:"",workSettingIds:null!==(se=null===o||void 0===o||null===(oe=o.getUserById)||void 0===oe?void 0:oe.workSettingIds)&&void 0!==se?se:[],isRegistrationComplete:!0}}(),onSave:m,buttonText:"Save Account",submissionError:i,mode:"update"})})]})})},pl=Object(pn.a)((function(e){return Object(mn.a)({editIcon:{color:e.palette.primary.main,cursor:"pointer"},editor:{height:"300px"}})})),vl=function(e){var t=e.template,n=e.onSaveClick,i=pl(),c=Object(a.useState)(!1),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(""),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(a.useState)(t),O=Object(L.a)(h,2),x=O[0],m=O[1];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(qt.a,{className:i.editIcon,onClick:function(){return l(!0)}}),Object(D.jsxs)(ie.a,{maxWidth:"xl",open:o,children:[Object(D.jsxs)(se.a,{sx:{height:600,width:800},children:[Object(D.jsx)(Q.a,{sx:{textAlign:"center",mb:2},children:Object(D.jsx)(T,{title:t.name})}),Object(D.jsxs)(I.a,{spacing:2,children:[j.length>0&&Object(D.jsx)(me.a,{severity:"error",children:j}),Object(D.jsx)(It.a,{onChange:function(e){var t=e.target.name,n=e.target.value;m(Object(r.a)(Object(r.a)({},x),{},Object(Tt.a)({},t,n)))},name:"subject",label:"Subject",color:"warning",value:x.subject}),Object(D.jsx)(Za,{name:"template",onChange:function(e,t){m(Object(r.a)(Object(r.a)({},x),{},Object(Tt.a)({},e,t)))},value:x.template,style:{height:"300px"}})]})]}),Object(D.jsxs)(he.a,{children:[Object(D.jsx)(G.a,{variant:"contained",color:"primary",onClick:function(){if(function(){b("");var e=!0;return 0===x.subject.length&&(b("Subject is required"),e=!1),"<p><br></p>"===x.template&&(b("Template text is required"),e=!1),e}()){var e={id:x.id,name:x.name,template:x.template,subject:x.subject};l(!1),n(e)}},children:"Save"}),Object(D.jsx)(G.a,{variant:"outlined",color:"primary",onClick:function(){return l(!1)},children:"Cancel"})]})]})]})},gl=function(e){var t=e.categoryTitle,n=e.onSaveClick,r=e.onDeleteClick,a=e.templates;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{variant:"h6",sx:{textAlign:"left"},children:t}),Object(D.jsx)(xe.a,{}),a.length>0&&Object(D.jsx)(K.a,{sx:{mt:2,mb:4},component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},"aria-label":"email templates for program",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{sx:{width:"40%"},children:"Template Name"}),Object(D.jsx)(ne.a,{sx:{width:"40%"},children:"Template Subject"}),Object(D.jsx)(ne.a,{sx:{width:"20%"},align:"right"})]})}),Object(D.jsx)(ee.a,{children:a.map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:e.name}),Object(D.jsx)(ne.a,{component:"th",scope:"row",children:e.subject}),Object(D.jsxs)(ne.a,{align:"right",children:[Object(D.jsx)(vl,{template:e,onSaveClick:n}),Object(D.jsx)(tr,{iconTooltip:"Remove ".concat(e.name," from email templates?"),dialogTitle:"Remove Registration Question",dialogText:"Are you sure you want to remove the ".concat(e.name," email template?"),confirmText:"Remove",onClose:function(){return r(e)}})]})]},e.id)}))})]})}),0===a.length&&Object(D.jsx)(me.a,{sx:{mb:4,mt:2},severity:"info",children:"No templates found"})]})},fl=function(e){var t=e.accountTemplates,n=e.cohortTemplates,r=e.hubTeamTemplates,a=e.onSaveClick,i=e.onDeleteClick,c=e.registrationTemplates,s=e.templatesNoCategory;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(gl,{categoryTitle:"Account Templates",templates:t,onSaveClick:a,onDeleteClick:i}),Object(D.jsx)(gl,{categoryTitle:"Cohort Templates",templates:n,onSaveClick:a,onDeleteClick:i}),Object(D.jsx)(gl,{categoryTitle:"Hub Team Templates",templates:r,onSaveClick:a,onDeleteClick:i}),Object(D.jsx)(gl,{categoryTitle:"Registration Templates",templates:c,onSaveClick:a,onDeleteClick:i}),s.length>0&&Object(D.jsx)(gl,{categoryTitle:"Other Templates",templates:s,onSaveClick:a,onDeleteClick:i})]})},yl="GetEmailTemplatesForTenant",Cl=Object(qe.a)(To||(To=Object(Me.a)(["\n  query GetEmailTemplatesForTenant {\n    getEmailTemplatesForTenant {\n      emailCategory\n      id\n      name\n      subject\n      template\n    }\n  }\n"]))),wl=Object(qe.a)(Eo||(Eo=Object(Me.a)(["\n  mutation UpdateEmailTemplate($template: UpdateEmailTemplateInput!) {\n    updateEmailTemplate(template: $template) {\n      id\n    }\n  }\n"]))),Sl=Object(qe.a)(Po||(Po=Object(Me.a)(["\n  mutation DeleteEmailTemplate($emailTemplateId: String!) {\n    deleteEmailTemplate(emailTemplateId: $emailTemplateId) {\n      id\n    }\n  }\n"]))),Il=function(e){return e.account="account",e.cohort="cohort",e.hubTeam="hubTeam",e.registration="registration",e}({});function kl(e){return{accountTemplates:e.filter((function(e){return e.emailCategory===Il.account})),cohortTemplates:e.filter((function(e){return e.emailCategory===Il.cohort})),hubTeamTemplates:e.filter((function(e){return e.emailCategory===Il.hubTeam})),registrationTemplates:e.filter((function(e){return e.emailCategory===Il.registration})),templatesNoCategory:e.filter((function(e){return null===e.emailCategory}))}}var Al=function(){var e,t=Object(B.b)(Cl),n=t.data,r=t.loading,a=function(e){var t=[];return e.length>0?(e.forEach((function(e){t.push({emailCategory:e.emailCategory,id:e.id,name:e.name,template:e.template,subject:e.subject})})),kl(t)):{accountTemplates:[],cohortTemplates:[],hubTeamTemplates:[],registrationTemplates:[],templatesNoCategory:[]}}(null!==(e=null===n||void 0===n?void 0:n.getEmailTemplatesForTenant)&&void 0!==e?e:[]),i=Object(Ze.a)(wl,{refetchQueries:[yl]}),c=Object(L.a)(i,1)[0],s=Object(Ze.a)(Sl,{refetchQueries:[yl]}),o=Object(L.a)(s,1)[0],l=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c({variables:{template:{id:t.id,name:t.name,subject:t.subject,template:t.template}}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),d=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o({variables:{emailTemplateId:t.id}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u=it(),j=function(){var e,t,n,r,a,i;return(null===(e=u.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=u.user)||void 0===t?void 0:t.isAdmin)||(null===(n=u.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=u.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=u.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=u.user)||void 0===i?void 0:i.isEvaluationStaff)};return j()&&j()?Object(D.jsx)(D.Fragment,{children:j()&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:r,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:2},children:[Object(D.jsx)(T,{title:"Manage Email Templates"}),Object(D.jsx)(fl,{accountTemplates:a.accountTemplates,cohortTemplates:a.cohortTemplates,hubTeamTemplates:a.hubTeamTemplates,registrationTemplates:a.registrationTemplates,templatesNoCategory:a.templatesNoCategory,onSaveClick:l,onDeleteClick:d})]})]})}):Object(D.jsx)($e,{})},Nl=function(e){var t=e.children;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{sx:{textAlign:"left",fontWeight:"bold",fontSize:"16px",mt:3},children:t}),Object(D.jsx)(xe.a,{sx:{mb:2,maxWidth:600}})]})},Dl=(n(821),function(e){var t=e.title,n=e.text;return Object(D.jsx)(D.Fragment,{children:n?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Nl,{children:t}),Object(D.jsx)(w.a,{variant:"body1",sx:{mb:2},textAlign:"justify",children:Object(D.jsx)(Ha.a,{value:n,readOnly:!0,theme:"bubble"})})]}):""})}),Tl=n(477),El=n.n(Tl),Pl=n(158),Rl=n.n(Pl);function Ll(){var e=Rc().get,t=function(){var t=Object(Ge.a)(Object(Ve.a)().mark((function t(n,r){var a,i,c,s,o,l,d,u,j;return Object(Ve.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,a="".concat(x.j,"/file/download?programId=").concat(n,"&fileName=").concat(r),t.next=4,e(a);case 4:for(i=t.sent,c=atob(i.data.file),s=new Array(c.length),o=0;o<c.length;o++)s[o]=c.charCodeAt(o);l=new Uint8Array(s),d=new Blob([l],{type:i.data.contentType}),u=document.createElement("a"),j=window.URL.createObjectURL(d),u.href=j,u.setAttribute("download",r),document.body.appendChild(u),u.click(),document.body.removeChild(u),t.next=22;break;case 19:t.prev=19,t.t0=t.catch(0),console.error("Error uploading file:",t.t0);case 22:case"end":return t.stop()}}),t,null,[[0,19]])})));return function(e,n){return t.apply(this,arguments)}}();return{getFile:t}}var Fl,Ul,Ml,ql,zl,Hl,Wl,Yl=function(e){var t=e.displayName,n=e.name,r=e.programId,a=e.resourceTypeId,i=e.url,c=Ll().getFile,s=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c(r,n);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(D.jsx)(D.Fragment,{children:a===Ie.j?Object(D.jsx)(J.a,{title:"Open Link",children:Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Rl.a,{fontSize:"small",sx:{verticalAlign:"middle",mr:1}}),Object(D.jsx)(Z.a,{href:null!==i&&void 0!==i?i:"#",target:"_blank",style:{cursor:"pointer"},children:null!==t&&void 0!==t?t:n})]})}):Object(D.jsx)(J.a,{title:"Download",children:Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(El.a,{fontSize:"small",sx:{verticalAlign:"middle",mr:1}}),Object(D.jsx)(Z.a,{onClick:s,style:{cursor:"pointer"},children:null!==t&&void 0!==t?t:n})]})})})},Bl=function(e){var t=e.programId,n=e.sessions,r=e.sessionResources;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Nl,{children:Object(D.jsx)(Q.a,{sx:{textAlign:"left"},children:"Sessions"})}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Title"}),Object(D.jsx)(ne.a,{children:"Start Date"}),Object(D.jsx)(ne.a,{children:"End Date"}),Object(D.jsx)(ne.a,{children:"Resources"})]})}),Object(D.jsx)(ee.a,{children:n&&n.map((function(e){var n,a=(n=e.id,r&&0!==r.length?r.filter((function(e){return e.sessionId===n})):[]),i=function(e){var t={facilitator:[],presenter:[],panelist:[]};return null===e||void 0===e||e.forEach((function(e){var n,r,a,i,c,s,o,l,d="".concat(null===e||void 0===e||null===(n=e.hubMemberCohort)||void 0===n||null===(r=n.user)||void 0===r?void 0:r.firstName," ").concat(null===e||void 0===e||null===(a=e.hubMemberCohort)||void 0===a||null===(i=a.user)||void 0===i?void 0:i.lastName),u=null===e||void 0===e||null===(c=e.hubMemberCohort)||void 0===c?void 0:c.credentials,j=u?"".concat(d,", ").concat(u):d;"Facilitator"!==(null===e||void 0===e?void 0:e.hubRole.name)||null!==(s=e.hubMemberCohort)&&void 0!==s&&s.hide||t.facilitator.push(j),"Presenter"!==(null===e||void 0===e?void 0:e.hubRole.name)||null!==(o=e.hubMemberCohort)&&void 0!==o&&o.hide||t.presenter.push(j),"Panelist"!==(null===e||void 0===e?void 0:e.hubRole.name)||null!==(l=e.hubMemberCohort)&&void 0!==l&&l.hide||t.panelist.push(j)})),t}(e.HubMemberCohortSession),c=function(e){return Math.max(e.facilitator.length,e.presenter.length,e.panelist.length)}(i);return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"".concat(e.number," - ").concat(e.title)}),Object(D.jsx)(ne.a,{children:ke(e.startDate,!0,!1,!1)}),Object(D.jsx)(ne.a,{children:ke(e.endDate,!0,!1,!0)}),Object(D.jsx)(ne.a,{children:a.map((function(e){return Object(D.jsx)(Yl,{displayName:e.resource.displayName,name:e.resource.name,resourceTypeId:e.resource.resourceTypeId,url:e.resource.url,programId:t},e.resource.id)}))})]},e.id),c>0&&Object(D.jsx)(te.a,{children:Object(D.jsxs)(ne.a,{colSpan:4,children:[i.facilitator.length>0&&Object(D.jsxs)("span",{style:{marginRight:"25px"},children:[Object(D.jsx)("strong",{children:"Facilitator(s):"})," ",i.facilitator.join("; ")]}),i.presenter.length>0&&Object(D.jsxs)("span",{style:{marginRight:"25px"},children:[Object(D.jsx)("strong",{children:"Presenter(s):"})," ",i.presenter.join("; ")]}),i.panelist.length>0&&Object(D.jsxs)("span",{children:[Object(D.jsx)("strong",{children:"Panelist(s):"})," ",i.panelist.join("; ")]})]})})]})}))})]})})]})},Ql=function(e){var t,n,r,a,i,c,s,l,d,u=e.cohort,j=Object(B.b)(ka,{variables:{cohortId:u.id}}),b=(j.loading,j.data),h=function(e,t){return t?"Cohort is Ongoing":e?ke(e):""},O=it();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsxs)(N.a,{xs:8,children:[Object(D.jsx)(Dl,{title:"What This ECHO Will Focus On",text:null!==(t=null===u||void 0===u?void 0:u.evaluationGoal)&&void 0!==t?t:""}),Object(D.jsx)(Dl,{title:"Learning Objectives",text:null!==(n=null===u||void 0===u?void 0:u.learningObjectives)&&void 0!==n?n:""}),Object(D.jsx)(Dl,{title:"Project Partner(s)",text:null!==(r=null===u||void 0===u?void 0:u.projectPartner)&&void 0!==r?r:""})]}),Object(D.jsxs)(N.a,{xs:4,children:[u&&u.cohortResources&&(null===(a=u.cohortResources)||void 0===a?void 0:a.length)>0&&Object(D.jsxs)(Q.a,{sx:{mb:3},children:[Object(D.jsx)(Nl,{children:"Cohort Resources"}),Object(D.jsx)(I.a,{spacing:2,children:u.cohortResources.map((function(e){return Object(D.jsx)("div",{children:Object(D.jsx)(Yl,{displayName:e.displayName,name:e.name,resourceTypeId:e.resourceTypeId,url:e.url,programId:u.programId})})}))})]}),Object(D.jsx)(Nl,{children:"Quick Links"}),Object(D.jsxs)(I.a,{spacing:1,alignItems:"baseline",children:[Object(D.jsx)(Z.a,{sx:{textDecoration:"none",color:"primary"},href:null!==(i=null===u||void 0===u?void 0:u.meetingLink)&&void 0!==i?i:"",target:"_blank",children:"Meeting Link"}),function(){var e,t,n,r;return(null===(e=O.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=O.user)||void 0===t?void 0:t.isAdmin)||(null===(n=O.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=O.user)||void 0===r?void 0:r.isPartner)||function(){var e,t=null===b||void 0===b||null===(e=b.getMembersByCohort)||void 0===e?void 0:e.findIndex((function(e){var t;return e.userId===(null===(t=O.user)||void 0===t?void 0:t.id)}));return!!t&&t>-1}()}()&&Object(D.jsx)(Z.a,{sx:{textDecoration:"none"},component:o.b,to:"/cohort-roster/".concat(null!==(c=null===u||void 0===u?void 0:u.id)&&void 0!==c?c:""),children:"View Cohort Roster"})]})]})]}),Object(D.jsx)(N.a,{container:!0,children:Object(D.jsx)(N.a,{item:!0,children:Object(D.jsx)(Dl,{title:"Program Dates",text:"".concat(h(null===u||void 0===u?void 0:u.startDate)," - ").concat(h(null===u||void 0===u?void 0:u.endDate,null===u||void 0===u?void 0:u.isOngoing))})})}),Object(D.jsx)(Bl,{programId:null!==(s=null===u||void 0===u?void 0:u.programId)&&void 0!==s?s:"",sessions:null!==(l=null===u||void 0===u?void 0:u.sessions)&&void 0!==l?l:[],sessionResources:null!==(d=null===u||void 0===u?void 0:u.sessionResources)&&void 0!==d?d:[]})]})},$l=Object(qe.a)(Fl||(Fl=Object(Me.a)(["\n  query GetCohortDetailForLearner($cohortId: String!) {\n    getCohortDetailForLearner(cohortId: $cohortId) {\n      cohortResources {\n        displayName\n        id\n        name\n        resourceTypeId\n        url\n      }\n      sessionResources {\n        sessionId\n        resource {\n          displayName\n          id\n          name\n          resourceTypeId\n          url\n        }\n      }\n      id\n      endDate\n      evaluationGoal\n      externalLabel\n      internalLabel\n      isOngoing\n      learningObjectives\n      meetingLink\n      programId\n      projectPartner\n      scheduleDescription\n      startDate\n      sessions {\n        id\n        number\n        title\n        startDate\n        endDate\n        HubMemberCohortSession {\n          id\n          hubRoleId\n          hubMemberCohort {\n            id\n            facilitateAll\n            presentAll\n            panelistAll\n            credentials\n            hide\n            user {\n              id\n              firstName\n              lastName\n            }\n          }\n          hubRole {\n            id\n            name\n          }\n        }\n      }\n    }\n  }\n"]))),Vl=function(){var e,t,n=Object(F.j)().cohortId,r=Object(B.b)($l,{variables:{cohortId:n}}),a=r.data,i=r.loading,c=null===a||void 0===a?void 0:a.getCohortDetailForLearner,s=[{to:"/my-echos",text:"My ECHOs",isActive:!0},{text:null!==(e=null===c||void 0===c?void 0:c.externalLabel)&&void 0!==e?e:"",isActive:!1}];return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:10,mb:2},children:c&&c.id&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:i,title:"Loading..."}),Object(D.jsx)(qs,{breadcrumbs:s}),Object(D.jsx)(T,{title:null!==(t=null===c||void 0===c?void 0:c.externalLabel)&&void 0!==t?t:""}),Object(D.jsx)(Ql,{cohort:c})]})})})},Gl=function(e){var t=e.to,n=e.text;return Object(D.jsx)(Z.a,{sx:{textDecoration:"none",color:"primary.main"},component:o.b,to:t,children:n})},Jl=Object(qe.a)(Ul||(Ul=Object(Me.a)(["\n  query GetCohortsOpenForRegistration {\n    getCohortsOpenForRegistration {\n      id\n      internalLabel\n      externalLabel\n      startDate\n      endDate\n      isOngoing\n      allowPreregistration\n    }\n  }\n"]))),Zl=(n(97),function(){var e=Object(B.b)(Jl),t=e.loading,n=e.data,i=Object(a.useState)(),c=Object(L.a)(i,2),s=c[0],o=c[1];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:t,title:"Loading"}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:12},children:[Object(D.jsx)(T,{title:"ECHOs You Can Explore"}),Object(D.jsx)(Q.a,{sx:{textAlign:"left",fontSize:"18px",mb:2},children:Object(D.jsx)(Gl,{to:Gs.href,text:"Take Me To My ECHOs"})}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(zr,{currentSort:null===s||void 0===s?void 0:s.prop,onSort:o,sortProperty:"label",headerText:"ECHO Title"}),Object(D.jsx)(zr,{currentSort:null===s||void 0===s?void 0:s.prop,onSort:o,sortProperty:"startDate",headerText:"When It Starts",align:"center"}),Object(D.jsx)(zr,{currentSort:null===s||void 0===s?void 0:s.prop,onSort:o,sortProperty:"endDate",headerText:"When It Ends",align:"center"}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:function(){var e,t=null!==(e=null===n||void 0===n?void 0:n.getCohortsOpenForRegistration)&&void 0!==e?e:[],a=new Set;return qr(t.filter((function(e){return!a.has(e.id)&&(a.add(e.id),!0)})).map((function(e){return Object(r.a)(Object(r.a)({},e),{},{label:e.externalLabel||"",endDate:e.isOngoing?"":e.endDate||"",startDate:e.startDate||""})})),s)}().map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsxs)(ne.a,{align:"left",children:[e.allowPreregistration&&Object(D.jsx)(J.a,{title:"This cohort is open for pre-registration. Those who pre-register will receive an email when registration opens",children:Object(D.jsx)(Xa.a,{sx:{fontSize:"16px",color:"primary.main",mr:1}})}),e.externalLabel||"(No Name)"]}),Object(D.jsx)(ne.a,{align:"center",children:ke(e.startDate)}),Object(D.jsx)(ne.a,{align:"center",children:e.isOngoing?"Ongoing":ke(e.endDate)}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(Gl,{to:"".concat(Vs.href,"/").concat(e.id),text:Vs.text})})]},e.id)}))})]})})]})]})}),Kl=function(){return Object(D.jsx)(T,{title:"Log In to ECHO Knowledge"})},_l=function(){return Object(D.jsx)(T,{title:"Log In to ECHO Knowledge"})},Xl=function(){return Object(D.jsx)(T,{title:"Log In to ECHO Knowledge"})},ed=function(){return Object(D.jsx)(T,{title:"Log In to Dartmouth Health Connect"})},td=function(){return Object(D.jsx)(T,{title:"Log In to ECHO Knowledge"})},nd=function(){return Object(D.jsx)(T,{title:"Log In to ECHO Knowledge"})},rd=function(){var e=Object(x.h)();return e===Ie.a?Object(D.jsx)(Kl,{}):e===Ie.g?Object(D.jsx)(_l,{}):e===Ie.u?Object(D.jsx)(Xl,{}):e===Ie.c?Object(D.jsx)(ed,{}):e===Ie.e?Object(D.jsx)(nd,{}):e===Ie.b?Object(D.jsx)(td,{}):Object(D.jsx)(D.Fragment,{})},ad=function(){return Object(D.jsx)(w.a,{variant:"body1",children:"Welcome to ECHO Colorado. Please enter your login info or create an account, so you can be a part of making health knowledge ECHO across the state and beyond."})},id=function(){return Object(D.jsx)(w.a,{variant:"body1",children:"Welcome to the Oregon ECHO Network. Please enter your login info or create an account. We look forward to learning with you."})},cd=function(){return Object(D.jsx)(w.a,{variant:"body1",children:"Welcome to Virginia Project ECHO. Please enter your login info or create an account, so you can be a part of making health knowledge ECHO across the state and beyond."})},sd=function(){return Object(D.jsx)(w.a,{variant:"body1",children:"Welcome to Project ECHO at Dartmouth Health. Please enter your login info or create an account."})},od=function(){return Object(D.jsx)(w.a,{variant:"body1",children:"Welcome to Campbell Software, LLC. Please enter your login info or create an account, so you can be a part of making health knowledge ECHO across the state and beyond."})},ld=function(){return Object(D.jsx)(w.a,{variant:"body1",children:"Welcome to ECHO Demo. Please enter your login info or create an account, so you can be a part of making health knowledge ECHO nationwide and beyond."})},dd=function(){var e=Object(x.h)();return e===Ie.a?Object(D.jsx)(ad,{}):e===Ie.g?Object(D.jsx)(id,{}):e===Ie.u?Object(D.jsx)(cd,{}):e===Ie.c?Object(D.jsx)(sd,{}):e===Ie.e?Object(D.jsx)(ld,{}):e===Ie.b?Object(D.jsx)(od,{}):Object(D.jsx)(D.Fragment,{})},ud=function(e){var t=e.isOpen,n=e.onClose,r=e.onContinue;return Object(D.jsxs)(ie.a,{open:t,onClose:function(){},maxWidth:"md",fullWidth:!0,PaperProps:{sx:{width:"75%",maxHeight:"75vh"}},slotProps:{backdrop:{style:{backgroundColor:"rgba(0, 0, 0, 0.85)"}}},sx:{zIndex:9999},children:[Object(D.jsx)(ce.a,{children:"Echo Connect - Admins"}),Object(D.jsx)(se.a,{children:Object(D.jsx)(w.a,{children:"You have the ability to maintain your Admin session for a length of 6 hrs at a time"})}),Object(D.jsxs)(he.a,{children:[Object(D.jsx)(G.a,{onClick:n,color:"primary",children:"Extend my Admin Session"}),Object(D.jsx)(G.a,{onClick:r,color:"primary",children:"Continue"})]})]})},jd=function(){var e=it(),t=Object(F.h)(),n=function(){var e=Object(F.i)().search;return Object(a.useMemo)((function(){return new URLSearchParams(e)}),[e])}(),i=Object(a.useState)(!1),c=Object(L.a)(i,2),s=c[0],l=c[1],d=Object(a.useState)(!1),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(a.useState)(!1),O=Object(L.a)(h,2),x=O[0],m=O[1],p=Object(a.useState)(!1),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)(!1),C=Object(L.a)(y,2),k=C[0],A=C[1],T=Object(a.useState)(null),E=Object(L.a)(T,2),P=E[0],R=E[1],U=Object(a.useState)({email:"",password:""}),M=Object(L.a)(U,2),q=M[0],z=M[1],H=Object(a.useState)(!1),W=Object(L.a)(H,2),Y=W[0],B=W[1],$=Object(a.useState)(null),V=Object(L.a)($,2),J=V[0],Z=V[1],K=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("Enter"!==t.key){e.next=3;break}return e.next=3,te();case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),_=function(e){var t=e.target.name,n=e.target.value;z(Object(r.a)(Object(r.a)({},q),{},Object(Tt.a)({},t,n))),"email"===t&&l(!1),"password"===t&&b(!1)},X=function(){var e=!0;return l(!1),b(!1),f(!1),A(!1),R(null),0===q.email.length&&(l(!0),e=!1),0===q.password.length&&(b(!0),e=!1),e},ee=function(){var n=Object(Ge.a)(Object(Ve.a)().mark((function n(){return Object(Ve.a)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.extendAdminSession();case 3:n.sent?console.info("admin session extended"):console.error("Failed to extend session"),n.next=10;break;case 7:n.prev=7,n.t0=n.catch(0),console.error("Error extending admin session:",n.t0);case 10:return n.prev=10,J?(setTimeout((function(){t.push(J)}),50),setTimeout((function(){B(!1)}),250),setTimeout((function(){Z(null)}),800)):(setTimeout((function(){t.push(Ks.href)}),50),setTimeout((function(){B(!1)}),250),setTimeout((function(){Z(null)}),800)),n.finish(10);case 13:case"end":return n.stop()}}),n,null,[[0,7,10,13]])})));return function(){return n.apply(this,arguments)}}(),te=function(){var r=Object(Ge.a)(Object(Ve.a)().mark((function r(){var a,i;return Object(Ve.a)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(X()){r.next=2;break}return r.abrupt("return");case 2:return m(!0),r.prev=3,r.next=6,e.signIn(q.email,q.password);case 6:(a=r.sent).isSuccessful?(i=n.get("redirectTo"),a.isRegistrationComplete?i?a.isAdmin?(B(!0),Z(i)):t.push(i):a.isAdmin?(B(!0),Z(Ks.href)):t.push(Js.href):t.push($s.href)):R(a.errorMessage),r.next=13;break;case 10:r.prev=10,r.t0=r.catch(3),console.log("loginUser",r.t0);case 13:return r.prev=13,m(!1),r.finish(13);case 16:case"end":return r.stop()}}),r,null,[[3,10,13,16]])})));return function(){return r.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:x,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:[Object(D.jsx)(rd,{}),Object(D.jsxs)(N.a,{sx:{mt:3},container:!0,children:[Object(D.jsx)(N.a,{item:!0,sx:{width:"20%"}}),Object(D.jsxs)(N.a,{item:!0,sx:{width:"60%"},children:[Object(D.jsx)(dd,{}),(g||(null===P||void 0===P?void 0:P.trim().length))&&Object(D.jsx)(me.a,{sx:{mt:2},severity:"error",children:P}),k&&Object(D.jsxs)(me.a,{sx:{mt:2},severity:"info",children:["Due to site-wide security enhancements, all Connect users are required to"," ",Object(D.jsx)(Gl,{to:Bs.href,text:"reset your password"}),"."]}),Object(D.jsxs)(I.a,{spacing:2,sx:{marginTop:3,textAlign:"center",justifyContent:"center"},children:[Object(D.jsxs)(Ct.a,{error:!0,variant:"standard",children:[Object(D.jsx)(It.a,{onChange:_,name:"email",label:"Email",color:"warning",onKeyPress:K}),s&&Object(D.jsx)(Sn.a,{id:"email-error",color:"error",children:"Email is required"})]}),Object(D.jsxs)(Ct.a,{error:!0,variant:"standard",children:[Object(D.jsx)(It.a,{onChange:_,name:"password",type:"password",label:"Password",color:"warning",onKeyPress:K}),j&&Object(D.jsx)(Sn.a,{id:"password-error",color:"error",children:"Password is required"})]}),Object(D.jsx)(G.a,{sx:{mb:6},variant:"contained",color:"primary",onClick:te,children:"Login"}),Object(D.jsx)(w.a,{sx:{pt:6},variant:"body1",children:"If you do not have an account or need to reset your password, please click below"}),Object(D.jsxs)(Q.a,{children:[Object(D.jsx)(G.a,{sx:{mb:6,width:"50%",margin:"auto"},variant:"contained",color:"primary",component:o.b,to:Ys.href,children:Ys.text}),Object(D.jsx)("br",{}),Object(D.jsx)("br",{}),Object(D.jsx)(G.a,{sx:{mb:6,width:"50%",margin:"auto"},variant:"contained",color:"primary",component:o.b,to:Bs.href,children:Bs.text}),Object(D.jsxs)(w.a,{sx:{pt:{xs:2,sm:3,md:4},mt:{xs:2,sm:3,md:4},fontSize:{xs:"0.8rem",sm:"0.9rem",md:"1rem"}},variant:"body2",color:"textSecondary",children:["This site uses cookies to ensure core functionality, improve user experience, and maintain service reliability. ",Object(D.jsx)("br",{}),"By using this site, you accept the site's use of cookies."]})]})]})]}),Object(D.jsx)(N.a,{item:!0,sx:{width:"20%"}})]})]}),Object(D.jsx)(ud,{isOpen:Y,onClose:ee,onContinue:function(){e.adminSessionContinue();J?(setTimeout((function(){B(!1)}),50),setTimeout((function(){t.push(J)}),200),setTimeout((function(){Z(null)}),800)):(setTimeout((function(){B(!1)}),50),setTimeout((function(){t.push(Js.href)}),200),setTimeout((function(){Z(null)}),800))}})]})},bd=function(){var e=Object(a.useState)(!1),t=Object(L.a)(e,2),n=t[0],r=t[1],i=it(),c=Object(a.useCallback)(Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=2;break}return e.abrupt("return");case 2:return r(!0),e.prev=3,e.next=6,i.signOut();case 6:window.location.href="/login",e.next=13;break;case 9:e.prev=9,e.t0=e.catch(3),console.error("Logout failed:",e.t0),r(!1);case 13:case"end":return e.stop()}}),e,null,[[3,9]])}))),[i,n]);return Object(a.useEffect)((function(){var e=setTimeout(c,3e3);return function(){return clearTimeout(e)}}),[c]),Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:n,title:"Logout..."}),Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsxs)(N.a,{container:!0,sx:{mt:5},children:[Object(D.jsx)(N.a,{item:!0,xs:2}),Object(D.jsx)(N.a,{item:!0,xs:8,children:Object(D.jsx)(I.a,{spacing:5,children:Object(D.jsx)(me.a,{severity:"info",children:"Appears your ECHO Connect session has expired or timed out. You will need to login again and are being redirected to the Login screen."})})}),Object(D.jsx)(N.a,{item:!0,xs:2})]})}),Object(D.jsx)(T,{title:"Your session has timed out or expired."})]})},hd=function(e){var t=e.programId,n=e.currentPageText;return Object(D.jsxs)(vn.a,{"aria-label":"breadcrumb",style:{paddingBottom:25},children:[Object(D.jsx)(Gl,{to:"".concat(eo.href,"/").concat(t),text:"Program Dashboard"}),Object(D.jsx)(w.a,{color:"textPrimary",children:n})]})},Od="GetEmailTemplatesForProgram",xd=Object(qe.a)(Ml||(Ml=Object(Me.a)(["\n  query GetEmailTemplatesForProgram($programId: String!) {\n    getEmailTemplatesForProgram(programId: $programId) {\n      emailCategory\n      id\n      name\n      subject\n      template\n    }\n  }\n"]))),md=Object(qe.a)(ql||(ql=Object(Me.a)(["\n  mutation CopyEmailTemplatesFromTenant($programId: String!) {\n    copyEmailTemplatesFromTenant(programId: $programId) {\n      id\n      name\n    }\n  }\n"]))),pd=Object(qe.a)(zl||(zl=Object(Me.a)(["\n  mutation UpdateProgramEmailTemplate($template: UpdateProgramEmailTemplateInput!) {\n    updateProgramEmailTemplate(template: $template) {\n      id\n    }\n  }\n"]))),vd=function(){var e,t=Object(F.j)().id,n=Object(B.b)(xd,{variables:{programId:t}}),r=n.loading,a=n.data,i=null!==(e=null===a||void 0===a?void 0:a.getEmailTemplatesForProgram)&&void 0!==e?e:[],c=function(e){var t=[];return e.length>0?(e.forEach((function(e){t.push({emailCategory:e.emailCategory,id:e.id,name:e.name,template:e.template,subject:e.subject})})),kl(t)):{accountTemplates:[],cohortTemplates:[],hubTeamTemplates:[],registrationTemplates:[],templatesNoCategory:[]}}(i),s=Object(Ze.a)(md,{variables:{programId:t},refetchQueries:[Od]}),o=Object(L.a)(s,2),l=o[0],d=o[1].loading,u=Object(Ze.a)(pd,{refetchQueries:[Od]}),j=Object(L.a)(u,2),b=j[0],h=j[1].loading,O=Object(Ze.a)(Sl,{refetchQueries:[Od]}),x=Object(L.a)(O,1)[0],m=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l();case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b({variables:{template:{id:t.id,subject:t.subject,template:t.template}}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),v=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x({variables:{emailTemplateId:t.id}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{pt:10,mb:12},children:[Object(D.jsx)(hd,{programId:t,currentPageText:"Program Email Templates"}),Object(D.jsx)(T,{title:"Manage Email Templates for Program"}),Object(D.jsx)(le,{isOpen:r,title:"Loading..."}),Object(D.jsx)(le,{isOpen:d||h,title:"Saving..."}),Object(D.jsx)("br",{}),0===i.length&&Object(D.jsxs)(Q.a,{sx:{textAlign:"center",width:"100%"},children:[Object(D.jsx)(me.a,{sx:{marginBottom:3},severity:"info",children:"There are currently no customized email templates for this program. It will use templates from the primary email template list. To customize templates for this program, duplicate the primary templates and then customize to fit the program."}),Object(D.jsx)(G.a,{onClick:function(){return m()},variant:"contained",color:"primary",children:"Duplicate Primary Templates"})]}),i.length>0&&Object(D.jsx)(fl,{accountTemplates:c.accountTemplates,cohortTemplates:c.cohortTemplates,hubTeamTemplates:c.hubTeamTemplates,registrationTemplates:c.registrationTemplates,templatesNoCategory:c.templatesNoCategory,onSaveClick:p,onDeleteClick:v})]})})},gd=n(498),fd=n(272),yd=n.n(fd),Cd=n(271),wd=n.n(Cd),Sd=Object(qe.a)(Hl||(Hl=Object(Me.a)(["\n  mutation DeleteResource($resourceId: String!) {\n    deleteResource(resourceId: $resourceId)\n  }\n"])));var Id,kd=Object(qe.a)(Wl||(Wl=Object(Me.a)(["\n  mutation ToggleArchiveState($resourceId: String!, $isArchived: Boolean!) {\n    toggleArchiveState(resourceId: $resourceId, isArchived: $isArchived) {\n      id\n      archived\n    }\n  }\n"])));var Ad,Nd,Dd,Td,Ed,Pd,Rd,Ld,Fd,Ud,Md,qd,zd,Hd,Wd=Object(qe.a)(Id||(Id=Object(Me.a)(["\n  query GetDataForResourceEdit($resourceId: String!) {\n    getDataForResourceEdit(resourceId: $resourceId) {\n      resource {\n        id\n        name\n        displayName\n        resourceTypeId\n        url\n      }\n      resourceTypes {\n        id\n        name\n      }\n      cohorts {\n        id\n        internalLabel\n        sessions {\n          id\n          title\n          number\n        }\n      }\n      cohortResources {\n        id\n        resourceId\n        cohortId\n        sessionId\n      }\n    }\n  }\n"]))),Yd=Object(qe.a)(Ad||(Ad=Object(Me.a)(["\n  mutation UpdateResource($resource: UpdateResourceInput!) {\n    updateResource(resource: $resource) {\n      id\n    }\n  }\n"]))),Bd=n(97),Qd=Object(pn.a)((function(e){return Object(mn.a)({edit:{color:"goldenrod",cursor:"pointer"},delete:{color:e.palette.primary.main,cursor:"pointer"},attendanceLink:{color:e.palette.primary.main}})})),$d=function(e){var t,n,i,c,s,o,l=e.resourceId,d=e.resourceName,u=Object(a.useState)(!1),j=Object(L.a)(u,2),b=j[0],h=j[1],O=Object(a.useState)([]),x=Object(L.a)(O,2),m=x[0],p=x[1],v=Object(a.useState)({id:l,displayName:null,resourceTypeId:null,url:null}),g=Object(L.a)(v,2),f=g[0],y=g[1],C={prop:"number",order:"asc"},S=Qd(),k=Object(B.b)(Wd,{variables:{resourceId:l},skip:!b}),A=k.data,N=k.loading,T=Object(Ze.a)(Yd,{refetchQueries:["GetDataForResourceEdit",Nc]}),E=Object(L.a)(T,2),P=E[0],R=E[1].loading;Object(a.useEffect)((function(){if(!N&&A){var e=A.getDataForResourceEdit.resource,t=A.getDataForResourceEdit.cohortResources;if(y(Object(r.a)(Object(r.a)({},f),{},{displayName:e.displayName,resourceTypeId:e.resourceTypeId,url:e.url})),t&&t.length>0){var n=[];t.forEach((function(e){n.push({id:e.id,cohortId:e.cohortId,resourceId:e.resourceId,sessionId:e.sessionId})})),p([].concat(n))}}}),[A,N]);var F=null!==(t=null===A||void 0===A?void 0:A.getDataForResourceEdit)&&void 0!==t?t:null,U=null!==(n=null===F||void 0===F?void 0:F.cohorts)&&void 0!==n?n:[],M=null!==(i=null===F||void 0===F?void 0:F.resourceTypes)&&void 0!==i?i:[],q=null!==(c=(null===F||void 0===F?void 0:F.resource.resourceTypeId)===Ie.j)&&void 0!==c&&c,z=function(e,t){var n={id:Object(nr.a)(),cohortId:e,resourceId:l,sessionId:"all"===t?null:t};p([].concat(Object(Vn.a)(m),[n]))},H=function(e){var t=Bd.find(Bd.propEq("cohortId",e))(m);return t?t.sessionId?t.sessionId:"all":""},W=function(e){var t=e.target.name,n=e.target.value;y(Object(r.a)(Object(r.a)({},f),{},Object(Tt.a)({},t,n)))},Y=function(e){var t=e.target.name,n=e.target.value,r=Bd.findIndex(Bd.propEq("cohortId",t))(m);-1===r||p(Object(Vn.a)(m.splice(r,1))),z(t,n)},Q=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n,r){var a,i,c,s;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.length&&r.length&&"all"!==r?-1===(a=Bd.findIndex(Bd.propEq("cohortId",n))(m))?console.log("Theres no assignment"):((i=Object(Vn.a)(m)).splice(a,1),p(i)):-1===(c=Bd.findIndex(Bd.propEq("cohortId",n))(m))?console.log("Theres no assignment"):((s=Object(Vn.a)(m)).splice(c,1),p(s));case 1:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),$=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,n,r;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=f.displayName,n=f.resourceTypeId,r=f.url,e.next=3,P({variables:{resource:{id:l,displayName:t,resourceTypeId:n,url:r,cohortResources:m.length>0?m:null}}});case 3:h(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(Lt,{trigger:Object(D.jsx)(J.a,{title:"Edit ".concat(d),children:Object(D.jsx)(qt.a,{onClick:function(){return h(!0)},sx:{color:"primary.main",cursor:"pointer"}})}),width:700,title:"Edit Resource",showSave:!0,onSaveClick:$,showCancel:!0,isOpen:b,cancelText:"Cancel",children:[Object(D.jsx)(le,{isOpen:N,title:"Loading..."}),Object(D.jsx)(le,{isOpen:R,title:"Saving..."}),!N&&Object(D.jsxs)(I.a,{spacing:3,children:[Object(D.jsxs)(w.a,{variant:"h6",children:[Object(D.jsx)("strong",{children:"Resource Name: "})," ",null!==(s=null===F||void 0===F?void 0:F.resource.name)&&void 0!==s?s:""]}),Object(D.jsx)(It.a,{value:f.displayName,name:"displayName",onChange:W,label:"Resource Display Name",color:"warning"}),!q&&Object(D.jsxs)(Ct.a,{fullWidth:!0,sx:{marginBottom:2},children:[Object(D.jsx)(wt.a,{id:"resource-type-label",color:"warning",children:"Resource Type"}),Object(D.jsx)(kt.a,{sx:{textAlign:"left"},labelId:"resource-type-label",id:"select-resource-type",label:"Resource Type",color:"warning",name:"resourceTypeId",onChange:function(e){var t=e.target.name,n=e.target.value;y(Object(r.a)(Object(r.a)({},f),{},Object(Tt.a)({},t,n)))},value:null!==(o=f.resourceTypeId)&&void 0!==o?o:"",children:M.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))})]}),q&&Object(D.jsx)(It.a,{value:f.url,name:"url",onChange:W,label:"URL",color:"warning"}),Object(D.jsx)(me.a,{sx:{textAlign:"left"},severity:"info",children:"Assign resources for each cohort to be available at the overall cohort level or assigned to a specific session. Clearing out your assignments will only take effect after clicking Save."}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{width:"100%"},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{width:"390px",children:"Cohort"}),Object(D.jsx)(ne.a,{align:"center",width:"290px",children:"Resource Assignment"})]})}),Object(D.jsx)(ee.a,{children:U.map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:e.internalLabel}),Object(D.jsx)(ne.a,{align:"center",children:Object(D.jsxs)(Ct.a,{fullWidth:!0,children:[Object(D.jsx)(wt.a,{id:"resource-session-label",color:"warning",children:"Assign to a Session"}),Object(D.jsxs)(kt.a,{sx:{textAlign:"left"},labelId:"resource-session-label",id:"select-session-type",label:"Assign Resource",color:"warning",name:e.id,onChange:Y,value:H(e.id),children:[Object(D.jsx)(St.a,{value:"all",children:"Overall Cohort"}),qr(e.sessions&&e.sessions.length?e.sessions:[],C).map((function(e){return Object(D.jsxs)(St.a,{value:e.id,children:["[",e.number,"]: ",e.title]},e.id)}))]})]})}),Object(D.jsx)(ne.a,{align:"center",children:Object(D.jsx)(Ct.a,{fullWidth:!0,children:""!==H(e.id)?Object(D.jsx)(rr.d,{title:"Clear Resource Assignment",className:S.delete,onClick:function(){return Q(f.id,e.id,H(e.id))}}):Object(D.jsx)(rr.d,{title:"Clear Resource Assignment",className:S.delete,style:{color:"grey"}})})})]},e.id)}))})]})})]})]})})},Vd=function(e){var t=e.resources,n=function(){var e=Object(Ze.a)(kd,{refetchQueries:[Nc]}),t=Object(L.a)(e,2);return{toggleArchived:t[0],loading:t[1].loading}}(),r=n.toggleArchived,i=n.loading,c=function(){var e=Object(Ze.a)(Sd,{refetchQueries:[Nc]}),t=Object(L.a)(e,2),n=t[0],r=t[1].loading,a=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n({variables:{resourceId:t}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return{removeResourceFromS3AndDB:a,loading:r}}(),s=c.removeResourceFromS3AndDB,o=c.loading,l=Ll().getFile,d={prop:"name",order:"asc"},u=Object(a.useState)(d),j=Object(L.a)(u,2),b=j[0],h=j[1],O=Object(a.useState)([]),x=Object(L.a)(O,2),m=x[0],p=x[1],v=Object(a.useState)(!1),g=Object(L.a)(v,2),f=g[0],y=g[1],C=Object(a.useState)(!1),w=Object(L.a)(C,2),S=w[0],I=w[1],k=function(){return t.length>0?t.filter((function(e){return!1===e.archived})):[]};Object(a.useEffect)((function(){p(f?t:k())}),[t]);var A=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,I(!0),e.next=4,r({variables:{resourceId:t,isArchived:n}});case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error("Error archiving resources",e.t0);case 9:return e.prev=9,I(!1),e.finish(9);case 12:case"end":return e.stop()}}),e,null,[[0,6,9,12]])})));return function(t,n){return e.apply(this,arguments)}}(),N=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t&&n.length>0)){e.next=13;break}return I(!0),e.prev=2,e.next=5,s(n);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),console.error("Error archiving resources",e.t0);case 10:return e.prev=10,I(!1),e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[2,7,10,13]])})));return function(t,n){return e.apply(this,arguments)}}(),T=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l(t,n);case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();return 0===t.length?Object(D.jsx)(me.a,{severity:"info",children:"There are currently no resources for this program"}):Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:i||o||S,title:"Updating Resource..."}),Object(D.jsxs)(Q.a,{children:[Object(D.jsx)(me.a,{sx:{textAlign:"left"},severity:"info",children:"Archiving a resource will NOT remove it from the learner's view and will remain accessible by the learner. Deleting the resource will remove it from all locations."}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{checked:f,onChange:function(e){var n=e.target.checked;y(n),p(n?t:k())}}),label:"Include Archived Resources"})]}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},size:"small","aria-label":"Resource Management",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{}),Object(D.jsx)(zr,{currentSort:null===b||void 0===b?void 0:b.prop,onSort:h,sortProperty:"name",headerText:"Resource",order:null===b||void 0===b?void 0:b.order}),Object(D.jsx)(zr,{currentSort:null===b||void 0===b?void 0:b.prop,onSort:h,sortProperty:"displayName",headerText:"Name",order:null===b||void 0===b?void 0:b.order}),Object(D.jsx)(zr,{currentSort:null===b||void 0===b?void 0:b.prop,onSort:h,sortProperty:"createdAt",headerText:"Date Uploaded",order:null===b||void 0===b?void 0:b.order}),f&&Object(D.jsx)(zr,{currentSort:null===b||void 0===b?void 0:b.prop,onSort:h,sortProperty:"archived",headerText:"Archived",order:null===b||void 0===b?void 0:b.order}),Object(D.jsx)(ne.a,{align:"center",children:"Type"}),Object(D.jsx)(ne.a,{align:f?"center":"left",children:"\xa0"})]})}),Object(D.jsx)(ee.a,{children:qr(m,b.order?b:d).map((function(e){var t,n,r,a;return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{style:{width:10},children:"8c3fe862-46e1-11ec-82a5-13a60ed940a6"===e.resourceTypeId?Object(D.jsx)(J.a,{title:"Open Link",children:Object(D.jsx)(Z.a,{href:null!==(t=e.url)&&void 0!==t?t:"#",target:"_blank",children:Object(D.jsx)(Rl.a,{})})}):Object(D.jsx)(J.a,{title:"Download",children:Object(D.jsx)(Z.a,{onClick:function(){return T(e.programId,e.name)},children:Object(D.jsx)(Kr.a,{})})})}),Object(D.jsx)(ne.a,{component:"th",scope:"row",style:{width:150},children:e.name}),Object(D.jsx)(ne.a,{align:"left",style:{width:150},children:null!==(n=e.displayName)&&void 0!==n?n:e.name}),Object(D.jsx)(ne.a,{align:"left",style:{width:75},children:ke(e.createdAt)}),f&&Object(D.jsx)(ne.a,{align:"center",style:{width:50},children:e.archived?"Yes":"No"}),Object(D.jsx)(ne.a,{align:"center",style:{width:75},children:null!==(r=null===(a=e.resourceType)||void 0===a?void 0:a.name)&&void 0!==r?r:"set type"}),Object(D.jsxs)(ne.a,{align:f?"center":"left",style:{width:100},children:[Object(D.jsx)($d,{resourceId:e.id,resourceName:e.name}),e.archived?Object(D.jsx)(J.a,{title:"Restore ".concat(e.name),children:Object(D.jsx)(wd.a,{onClick:function(){return A(e.id,!1)},sx:{color:"primary.main",ml:2,mr:2,cursor:"pointer"}})}):Object(D.jsx)(J.a,{title:"Archive ".concat(e.name),children:Object(D.jsx)(yd.a,{onClick:function(){return A(e.id,!0)},sx:{color:"primary.main",ml:2,mr:2,cursor:"pointer"}})}),Object(D.jsx)(tr,{iconTooltip:"Delete ".concat(e.name),dialogTitle:"Delete Resource",dialogText:"Are you sure you want to permanently delete ".concat(e.name,"?"),confirmText:"Delete",reference:e.id,onClose:N})]})]},e.id)}))})]})})]})},Gd=function(e){var t=e.programId,n=Object(a.useState)(!1),i=Object(L.a)(n,2),c=i[0],s=i[1],o=Object(a.useState)(!1),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)(y()),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(Ze.a)(Tc,{refetchQueries:[Nc]}),m=Object(L.a)(x,2),p=m[0],v=m[1].loading,g=function(e){var t=e.target.name,n=e.target.value;O(Object(r.a)(Object(r.a)({},h),{},Object(Tt.a)({},t,n)))},f=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s(!1),!(h.name&&0!==h.name.trim().length&&!(!h.url||0===h.url.trim().length)||(s(!0),!1))){e.next=6;break}return e.next=4,p({variables:{resource:h}});case 4:O(y()),u(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();function y(){return{programId:t,resourceTypeId:Ie.j,name:"",displayName:"",url:""}}return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(Lt,{trigger:Object(D.jsx)(G.a,{sx:{top:-12},variant:"outlined",color:"primary",size:"small",startIcon:Object(D.jsx)(Rl.a,{}),children:"Add URL"}),width:500,title:"Add a URL Resource",showSave:!0,onSaveClick:f,showCancel:!0,isOpen:d,children:[Object(D.jsx)(le,{isOpen:v,title:"Saving..."}),Object(D.jsxs)(I.a,{spacing:2,children:[c&&Object(D.jsx)(me.a,{severity:"error",children:"Resource name and URL are required"}),Object(D.jsx)(It.a,{onChange:g,value:h.name,name:"name",color:"warning",label:"Resource Name"}),Object(D.jsx)(It.a,{onChange:g,value:h.displayName,name:"displayName",color:"warning",label:"Display Name"}),Object(D.jsx)(It.a,{onChange:g,value:h.url,name:"url",color:"warning",label:"URL"})]})]})})},Jd=function(){var e,t,n=it(),r=Object(F.j)().id,i=Fc(),c=i.addResourcesToS3AndDB,s=i.uploadingFiles,o=Object(a.useState)(!1),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)(null),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(B.b)(Pc,{variables:{id:r}}),m=x.loading,p=x.data,v=Object(B.b)(Dc,{variables:{programId:r}}),g=v.loading,f=v.data,y=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return O(null),e.next=3,c(r,t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),C=null===p||void 0===p?void 0:p.getProgramById,w=null!==(e=null===f||void 0===f?void 0:f.getResourceByProgram)&&void 0!==e?e:[];return function(){var e,t,r;return(null===(e=n.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=n.user)||void 0===t?void 0:t.isAdmin)||(null===(r=n.user)||void 0===r?void 0:r.isEchoStaff)}()?Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{pt:10,mb:12},children:[Object(D.jsx)(hd,{programId:r,currentPageText:"Resources"}),Object(D.jsx)(T,{title:"Resources for ".concat(null!==(t=null===C||void 0===C?void 0:C.name)&&void 0!==t?t:"")}),Object(D.jsx)(le,{isOpen:m||g,title:"Loading..."}),Object(D.jsx)(le,{isOpen:s,title:"Saving..."}),Object(D.jsxs)(Q.a,{sx:{textAlign:"left",marginTop:3,marginBottom:3},children:[d&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(gd.a,{filesLimit:7,showFileNames:!0,acceptedFiles:[".csv",".doc",".docm",".docx",".dotx",".ics",".jfif",".jpeg",".jpg",".key",".mov",".mp3",".mp4",".odp",".odt",".pdf",".png",".potx",".ppt",".pptm",".pptx",".rtf",".txt",".url",".vsdx",".xls",".xlsx"],onDropRejected:function(e){console.log("Rejected files:",e);var t=e.map((function(e){return e.file.name})).join(", "),n="The following files were rejected due to unsupported file types: ".concat(t,". Please only upload files with the accepted extensions.");O(n)},showPreviews:!1,onDrop:y,maxFileSize:5e7}),h&&Object(D.jsx)(me.a,{sx:{mt:2},severity:"error",onClose:function(){return O(null)},children:h}),Object(D.jsx)(me.a,{sx:{mt:2},severity:"warning",children:"Note: You can only upload up to 7 files at a time and the maximum size for a file is 50 MB.  For larger file sizes consider uploading one at a time."}),Object(D.jsx)(G.a,{sx:{mt:3,mb:3},startIcon:Object(D.jsx)(qi.a,{}),variant:"outlined",color:"primary",size:"small",onClick:function(){return u(!1)},children:"Finished Uploading Files"})]}),!d&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(G.a,{sx:{mb:3,mr:3},variant:"outlined",color:"primary",size:"small",onClick:function(){return u(!0)},startIcon:Object(D.jsx)(kc.a,{}),children:"Upload Files"}),Object(D.jsx)(Gd,{programId:r})]}),Object(D.jsx)(Vd,{resources:w})]})]})}):Object(D.jsx)($e,{})},Zd=Object(qe.a)(Nd||(Nd=Object(Me.a)(["\n  query GetMyAccount {\n    getMyAccount {\n      id\n      firstName\n      lastName\n      email\n      otherCredential\n      professionId\n      secondLevelProfessionId\n      thirdLevelProfessionId\n      otherProfession\n      otherWorkSetting\n      otherEthnicity\n      otherMarketingSource\n      otherSex\n      organization\n      organizationAddress1\n      organizationAddress2\n      city\n      state\n      countyId\n      zip\n      provideDirectCare\n      provideMedicaid\n      primaryCare\n      createdAt\n      updatedAt\n      credentials\n      receiveEmails\n      userCredentialIds\n      userEthnicityIds\n      partnerId\n      phone\n      birthYear\n      professionStartYear\n      firstSeries\n      organizationDescriptionIds\n      workSettingIds\n      userTenantIds\n      sexId\n      marketingSourceIds\n      roleDescriptionId\n      isRegistrationComplete\n    }\n  }\n"]))),Kd=function(){var e,t=Object(F.h)(),n=Object(a.useState)(""),r=Object(L.a)(n,2),i=r[0],c=r[1],s=Object(B.b)(Zd,{fetchPolicy:"no-cache"}),o=s.data,l=s.loading,d=s.error,u=null!==(e=null===o||void 0===o?void 0:o.getMyAccount)&&void 0!==e?e:null,j=Object(Ze.a)(xl),b=Object(L.a)(j,2),h=b[0],O=b[1],x=O.error,m=O.loading,p=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c(""),e.prev=1,e.next=4,h({variables:{user:n},refetchQueries:[hl]});case 4:x||t.push("/"),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),c(e.t0.graphQLErrors[0].message);case 10:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[i.length>0&&Object(D.jsx)(me.a,{severity:"error",children:i}),d&&Object(D.jsx)(me.a,{severity:"error",children:d.graphQLErrors[0].message}),x&&Object(D.jsx)(me.a,{severity:"error",children:x.graphQLErrors[0].message}),Object(D.jsx)(le,{isOpen:l,title:"Loading..."}),Object(D.jsx)(le,{isOpen:m,title:"Saving..."}),Object(D.jsx)(Q.a,{sx:{mt:3},children:!l&&Object(D.jsx)(rl,{userAccount:function(){var e,t,n,r,a,i,c,s,o,l,d,j,b,h,O,x,m,p,v,g,f,y,C,w,S,I,k;return{city:null!==(e=null===u||void 0===u?void 0:u.city)&&void 0!==e?e:"",countyId:null!==(t=null===u||void 0===u?void 0:u.countyId)&&void 0!==t?t:"",credentials:null===u||void 0===u?void 0:u.userCredentialIds,email:null!==(n=null===u||void 0===u?void 0:u.email)&&void 0!==n?n:"",ethnicities:null===u||void 0===u?void 0:u.userEthnicityIds,firstName:null!==(r=null===u||void 0===u?void 0:u.firstName)&&void 0!==r?r:"",id:null!==(a=null===u||void 0===u?void 0:u.id)&&void 0!==a?a:"",lastName:null!==(i=null===u||void 0===u?void 0:u.lastName)&&void 0!==i?i:"",organization:null!==(c=null===u||void 0===u?void 0:u.organization)&&void 0!==c?c:"",organizationAddress1:null!==(s=null===u||void 0===u?void 0:u.organizationAddress1)&&void 0!==s?s:"",organizationAddress2:null!==(o=null===u||void 0===u?void 0:u.organizationAddress2)&&void 0!==o?o:"",otherCredential:null!==(l=null===u||void 0===u?void 0:u.otherCredential)&&void 0!==l?l:"",otherEthnicity:null!==(d=null===u||void 0===u?void 0:u.otherEthnicity)&&void 0!==d?d:"",otherProfession:null!==(j=null===u||void 0===u?void 0:u.otherProfession)&&void 0!==j?j:"",otherMarketingSource:null!==(b=null===u||void 0===u?void 0:u.otherMarketingSource)&&void 0!==b?b:"",otherWorkSetting:null!==(h=null===u||void 0===u?void 0:u.otherWorkSetting)&&void 0!==h?h:"",otherSex:null!==(O=null===u||void 0===u?void 0:u.otherSex)&&void 0!==O?O:"",primaryCare:null===u||void 0===u?void 0:u.primaryCare,professionId:null!==(x=null===u||void 0===u?void 0:u.professionId)&&void 0!==x?x:"",provideDirectCare:null===u||void 0===u?void 0:u.provideDirectCare,provideMedicaid:null===u||void 0===u?void 0:u.provideMedicaid,receiveEmails:(null===u||void 0===u?void 0:u.receiveEmails)||!1,secondLevelProfessionId:null!==(m=null===u||void 0===u?void 0:u.secondLevelProfessionId)&&void 0!==m?m:"",state:null!==(p=null===u||void 0===u?void 0:u.state)&&void 0!==p?p:"",thirdLevelProfessionId:null!==(v=null===u||void 0===u?void 0:u.thirdLevelProfessionId)&&void 0!==v?v:"",zip:null!==(g=null===u||void 0===u?void 0:u.zip)&&void 0!==g?g:"",marketingSourceIds:null!==(f=null===u||void 0===u?void 0:u.marketingSourceIds)&&void 0!==f?f:[],organizationDescriptionIds:null!==(y=null===u||void 0===u?void 0:u.organizationDescriptionIds)&&void 0!==y?y:[],roleDescriptionId:null!==(C=null===u||void 0===u?void 0:u.roleDescriptionId)&&void 0!==C?C:"",phone:null!==(w=null===u||void 0===u?void 0:u.phone)&&void 0!==w?w:"",workSettingIds:null!==(S=null===u||void 0===u?void 0:u.workSettingIds)&&void 0!==S?S:[],birthYear:null===u||void 0===u?void 0:u.birthYear,firstSeries:null===u||void 0===u?void 0:u.firstSeries,professionStartYear:null===u||void 0===u?void 0:u.professionStartYear,sexId:null!==(I=null===u||void 0===u?void 0:u.sexId)&&void 0!==I?I:"",userTenantIds:null!==(k=null===u||void 0===u?void 0:u.userTenantIds)&&void 0!==k?k:[],isRegistrationComplete:!(null===u||void 0===u||!u.isRegistrationComplete)}}(),onSave:p,buttonText:"Save Account",submissionError:i,mode:"update"})})]})},_d=function(){var e,t,n=it(),i=Object(a.useState)(""),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)(!1),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)({id:"",firstName:"",lastName:"",email:""}),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(B.b)(Ol,{variables:{id:null!==(e=null===(t=n.user)||void 0===t?void 0:t.id)&&void 0!==e?e:""},fetchPolicy:"no-cache"}),p=m.loading,v=m.error,g=m.data;Object(a.useEffect)((function(){var e,t,n;if(!p&&g){var r=g.getUserById;x({id:null===r||void 0===r?void 0:r.id,firstName:null!==(e=null===r||void 0===r?void 0:r.firstName)&&void 0!==e?e:"",lastName:null!==(t=null===r||void 0===r?void 0:r.lastName)&&void 0!==t?t:"",email:null!==(n=null===r||void 0===r?void 0:r.email)&&void 0!==n?n:"",password:"",partnerId:""})}}),[p,g]);var f=Object(Ze.a)(cn),y=Object(L.a)(f,2),C=y[0],w=y[1],S=w.loading,I=w.error,k=function(e){var t=e.target.name,n=e.target.value;x(Object(r.a)(Object(r.a)({},O),{},Object(Tt.a)({},t,n)))},A=function(){return o(""),js(O.firstName)||js(O.lastName)||js(O.email)?(o("All fields are required"),!1):(e=O.email,!!us.a.isEmail(e)||(o("Invalid email address"),!1));var e},T=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!A()){e.next=9;break}return e.prev=1,e.next=4,C({variables:{user:{id:O.id,email:O.email,firstName:O.firstName,lastName:O.lastName}}});case 4:j(!0),e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:p,title:"Loading..."}),Object(D.jsx)(le,{isOpen:S,title:"Saving..."}),Object(D.jsxs)(Q.a,{sx:{mt:3,pb:2,textAlign:"center"},children:[Object(D.jsx)(Gl,{text:"Change Your Password",to:Ws.href}),v&&Object(D.jsx)(me.a,{severity:"error",children:v.graphQLErrors[0].message}),I&&Object(D.jsx)(me.a,{severity:"error",children:I.graphQLErrors[0].message}),s&&Object(D.jsx)(me.a,{severity:"error",children:s}),Object(D.jsxs)(N.a,{container:!0,spacing:2,sx:{pb:2,mt:4,textAlign:"center"},children:[Object(D.jsx)(N.a,{item:!0,lg:12,xs:12,sx:{mb:2},children:Object(D.jsx)(It.a,{onChange:k,sx:{width:"400px"},value:O.firstName,name:"firstName",color:"warning",label:"First Name"})}),Object(D.jsx)(N.a,{item:!0,xs:12,sx:{mb:2},children:Object(D.jsx)(It.a,{onChange:k,sx:{width:"400px"},value:O.lastName,name:"lastName",color:"warning",label:"Last Name"})}),Object(D.jsx)(N.a,{item:!0,xs:12,sx:{mb:2},children:Object(D.jsx)(It.a,{onChange:k,sx:{width:"400px"},value:O.email,name:"email",color:"warning",label:"Email"})}),Object(D.jsx)(N.a,{item:!0,xs:12,sx:{mb:2},children:Object(D.jsx)(G.a,{color:"primary",onClick:T,variant:"contained",sx:{width:"200px"},children:"Save"})})]}),Object(D.jsx)(Nn,{isOpen:u,text:"Account has been saved"})]})]})},Xd=function(){var e=it();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:12,textAlign:"center"},children:[Object(D.jsx)(T,{title:"Edit Your Account"}),function(){var t,n,r;return!!e.user&&(e.user.isAlbatross||e.user.isAdmin||e.user.isEchoStaff||(null===(t=e.user)||void 0===t?void 0:t.isDevelopmentStaff)||(null===(n=e.user)||void 0===n?void 0:n.isImplementationStaff)||(null===(r=e.user)||void 0===r?void 0:r.isEvaluationStaff))}()?Object(D.jsx)(_d,{}):Object(D.jsx)(Kd,{})]})})},eu=Object(qe.a)(Dd||(Dd=Object(Me.a)(["\n  query GetAllOpenCohortsForUser($userId: String!, $status: String!) {\n    getAllOpenCohortsForUser(userId: $userId, status: $status) {\n      id\n      internalLabel\n      externalLabel\n      startDate\n      endDate\n      isOngoing\n      meetingLink\n      archived\n      registrationCloseDate\n      registrationOpenDate\n      preRegistrantsCount\n      newRegistrantsCount\n      registeredCount\n      waitlistCount\n      deniedCount\n      nextSessionDate\n      program {\n        name\n      }\n      developmentUser {\n        id\n        fullName\n        email\n      }\n      implementationUser {\n        id\n        fullName\n        email\n      }\n      evaluationUser {\n        id\n        fullName\n        email\n      }\n      developmentSupportUser {\n        id\n        firstName\n        lastName\n      }\n      evaluationSupportUser {\n        id\n        firstName\n        lastName\n      }\n      implementationSupportUser {\n        id\n        firstName\n        lastName\n      }\n    }\n  }\n"]))),tu=function(){var e,t,n,r=Object(a.useState)("Live"),i=Object(L.a)(r,2),c=i[0],s=i[1],o=it(),l=Object(B.b)(eu,{variables:{userId:null!==(e=null===(t=o.user)||void 0===t?void 0:t.id)&&void 0!==e?e:"",status:c}}).data,d=null!==(n=null===l||void 0===l?void 0:l.getAllOpenCohortsForUser)&&void 0!==n?n:[],u=function(){var e,t,n,r,a,i,c;return(null===(e=o.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=o.user)||void 0===t?void 0:t.isAdmin)||(null===(n=o.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=o.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=o.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=o.user)||void 0===i?void 0:i.isEvaluationStaff)||(null===(c=o.user)||void 0===c?void 0:c.isPartner)};return u()&&u()?Object(D.jsx)(D.Fragment,{children:u()&&Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:10,mb:12},children:Object(D.jsx)(jl,{title:"My Current Projects",cohorts:d,statusQuery:c,setStatusQuery:s})})}):Object(D.jsx)($e,{})},nu=n(960),ru=n(1006),au=n(1005),iu=n(325),cu=n.n(iu),su=n(483),ou=n.n(su),lu=function(e){var t=e.to,n=e.icon;return Object(D.jsx)(Z.a,{component:o.b,to:t,children:n})},du=function(e){var t=e.title,n=e.cohorts,r=e.showDetailLink,a=e.showNextSession,i=void 0!==a&&a;return Object(D.jsx)(D.Fragment,{children:n&&n.length>0&&Object(D.jsxs)(D.Fragment,{children:[t&&Object(D.jsx)(Nl,{children:t}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Program"}),Object(D.jsx)(ne.a,{children:"Start"}),Object(D.jsx)(ne.a,{children:"End"}),i&&Object(D.jsx)(ne.a,{children:"Next Session"}),Object(D.jsx)(ne.a,{}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:n&&n.map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{children:e.externalLabel||""}),Object(D.jsx)(ne.a,{children:ke(e.startDate,!1)}),Object(D.jsx)(ne.a,{children:e.isOngoing?"Ongoing":ke(e.endDate,!1)}),i&&null!==e.nextSessionDate&&Object(D.jsx)(ne.a,{children:e.nextSessionDate}),Object(D.jsx)(ne.a,{align:"left"}),Object(D.jsx)(ne.a,{children:r&&Object(D.jsx)(J.a,{title:"Go to program details",children:Object(D.jsx)(lu,{to:"/program-dashboard/".concat(e.id),icon:Object(D.jsx)(ou.a,{})})})})]},e.id)}))})]})})]})})},uu=Object(qe.a)(Td||(Td=Object(Me.a)(["\n  query GetLearnerCohorts($userId: ID!) {\n    getLearnerCohorts(userId: $userId) {\n      currentCohorts {\n        id\n        externalLabel\n        startDate\n        endDate\n        isOngoing\n        meetingLink\n        nextSessionDate\n      }\n      pendingCohorts {\n        id\n        externalLabel\n        startDate\n        endDate\n        isOngoing\n        meetingLink\n        nextSessionDate\n      }\n      waitlistCohorts {\n        id\n        externalLabel\n        startDate\n        endDate\n        isOngoing\n        meetingLink\n        nextSessionDate\n      }\n      completedCohorts {\n        id\n        externalLabel\n        startDate\n        endDate\n        isOngoing\n        meetingLink\n        nextSessionDate\n      }\n    }\n  }\n"]))),ju=Object(qe.a)(Ed||(Ed=Object(Me.a)(["\n  query GetCohortByHubMember($userid: ID!) {\n    getCohortByHubMember(userid: $userid) {\n      id\n      externalLabel\n      startDate\n      endDate\n      isOngoing\n      meetingLink\n      nextSessionDate\n    }\n  }\n"]))),bu=function(){var e,t,n,r,a=it(),i=Object(B.b)(uu,{variables:{userId:null!==(e=null===a||void 0===a||null===(t=a.user)||void 0===t?void 0:t.id)&&void 0!==e?e:""}}),c=i.data,s=i.loading,o=Object(B.b)(ju,{variables:{userid:null!==(n=null===(r=a.user)||void 0===r?void 0:r.id)&&void 0!==n?n:""}}),l=o.data,d=o.loading,u=null===c||void 0===c?void 0:c.getLearnerCohorts,j=(null===l||void 0===l?void 0:l.getCohortByHubMember)||[];return s&&d||!function(){var e,t,n,r;return!u||0===(null===(e=u.pendingCohorts)||void 0===e?void 0:e.length)&&0===(null===(t=u.currentCohorts)||void 0===t?void 0:t.length)&&0===(null===(n=u.waitlistCohorts)||void 0===n?void 0:n.length)&&0===(null===(r=u.completedCohorts)||void 0===r?void 0:r.length)&&0===j.length}()?Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:s||d,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:2},children:[Object(D.jsx)(T,{title:"My ECHOs"}),Object(D.jsx)(Q.a,{sx:{textAlign:"left",mb:3},children:Object(D.jsx)(du,{title:"Your Current ECHO Programs",cohorts:null===u||void 0===u?void 0:u.currentCohorts,showNextSession:!0,showDetailLink:!0})}),Object(D.jsx)(Q.a,{sx:{textAlign:"left",mb:3},children:Object(D.jsx)(du,{title:"Program Requests Pending Review",cohorts:null===u||void 0===u?void 0:u.pendingCohorts,showDetailLink:!1})}),Object(D.jsx)(Q.a,{sx:{textAlign:"left",mb:3},children:Object(D.jsx)(du,{title:"Your Waitlist",cohorts:null===u||void 0===u?void 0:u.waitlistCohorts,showDetailLink:!1})}),Object(D.jsx)(Q.a,{sx:{textAlign:"left",mb:3},children:Object(D.jsx)(du,{title:"Partnered ECHO Programs",cohorts:j,showDetailLink:!0})}),(null===u||void 0===u?void 0:u.completedCohorts)&&u.completedCohorts.length>0&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(xe.a,{sx:{mb:3}}),Object(D.jsxs)(nu.a,{children:[Object(D.jsx)(au.a,{expandIcon:Object(D.jsx)(cu.a,{}),"aria-controls":"panel1a-content",id:"panel1a-header",children:Object(D.jsx)(w.a,{variant:"h6",color:"primary",children:"Completed ECHO Programs"})}),Object(D.jsx)(ru.a,{children:Object(D.jsx)(du,{cohorts:null===u||void 0===u?void 0:u.completedCohorts,showDetailLink:!0})})]})]})]})]}):Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:10,mb:2},children:Object(D.jsxs)(me.a,{severity:"info",children:["You have not registered for any ECHO programs yet."," ",Object(D.jsx)(Gl,{to:"/programs",text:"Find your next ECHO"})]})})},hu=function(){return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)("img",{alt:"New Feature",src:"https://kodosurvey.com/sites/default/files/styles/resources_large/public/2018-10/new_feature_5795c1fa1aea7.jpg?itok=4wqJsv87",style:{width:"500px",height:"500px"}}),Object(D.jsx)("p",{children:Object(D.jsx)("b",{children:"This feature is in development"})})]})},Ou=Object(qe.a)(Pd||(Pd=Object(Me.a)(["\n  mutation UpdatePartner($partner: UpdatePartnerInput!) {\n    updatePartner(partner: $partner) {\n      id\n      name\n    }\n  }\n"]))),xu=Object(qe.a)(Rd||(Rd=Object(Me.a)(["\n  mutation AddPartner($partner: AddPartnerInput!) {\n    addPartner(partner: $partner) {\n      id\n      name\n    }\n  }\n"]))),mu=function(e){var t=e.open,n=e.partner,i=void 0===n?{__typename:"Partner",id:"",name:""}:n,c=e.onDrawerClose,s=Object(a.useState)(t),o=Object(L.a)(s,2),l=o[0],d=o[1],u=Object(a.useState)(i),j=Object(L.a)(u,2),b=j[0],h=j[1],O=Object(a.useState)(!1),x=Object(L.a)(O,2),m=x[0],p=x[1],v=Object(a.useState)(""),g=Object(L.a)(v,2),f=g[0],y=g[1],C=0===i.id.length;Object(a.useEffect)((function(){d(t)}),[t]);var S=Object(Ze.a)(xu,{refetchQueries:[At]}),I=Object(L.a)(S,1)[0],k=Object(Ze.a)(Ou,{refetchQueries:[At]}),A=Object(L.a)(k,1)[0],N=function(){p(!1),y("")};return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(Pt.a,{variant:"temporary",open:l,anchor:"right",onClose:function(){return d(!1)},children:Object(D.jsxs)(Q.a,{sx:{width:500,textAlign:"center"},children:[Object(D.jsx)(w.a,{variant:"h6",color:"primary",children:C?"Add New Partner":"Edit ".concat(null===b||void 0===b?void 0:b.name)}),Object(D.jsx)(It.a,{sx:{mt:3,mb:2,width:400},label:"Partner Name",value:null===b||void 0===b?void 0:b.name,onChange:function(e){b&&(N(),h(Object(r.a)(Object(r.a)({},b),{},{name:e.target.value})))},error:m,helperText:f}),Object(D.jsx)("br",{}),Object(D.jsx)(G.a,{onClick:function(){if(function(){N();var e=!0;return 0===b.name.length&&(e=!1,p(!0),y("Partner name is required")),e}())try{if(!b)return;C?I({variables:{partner:{name:b.name}}}):A({variables:{partner:{id:b.id,name:b.name}}}),c()}catch(m){console.error(m)}},sx:{width:125,mr:2},variant:"contained",color:"primary",children:"Save"}),Object(D.jsx)(G.a,{onClick:function(){return c()},sx:{width:125},variant:"outlined",color:"primary",children:"Cancel"})]})})})},pu=Object(pn.a)((function(e){return Object(mn.a)({plusIcon:{paddingRight:5}})})),vu=function(){var e=pu(),t=Object(a.useState)(!1),n=Object(L.a)(t,2),r=n[0],i=n[1];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Q.a,{sx:{textAlign:"left",mt:2,mb:2},children:Object(D.jsxs)(G.a,{onClick:function(){return i(!0)},sx:{textAlign:"left"},variant:"outlined",color:"primary",size:"small",children:[Object(D.jsx)(rr.c,{className:e.plusIcon}),"Add Partner"]})}),Object(D.jsx)(mu,{open:r,onDrawerClose:function(){i(!1)}})]})},gu=Object(pn.a)((function(e){return Object(mn.a)({iconLink:{cursor:"pointer",color:e.palette.primary.main,marginRight:6}})})),fu=function(e){var t=e.partner,n=gu(),r=Object(a.useState)(!1),i=Object(L.a)(r,2),c=i[0],s=i[1];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"Edit ".concat(t.name),children:Object(D.jsx)(qt.a,{className:n.iconLink,onClick:function(){return s(!0)}})}),Object(D.jsx)(mu,{open:c,partner:t,onDrawerClose:function(){s(!1)}})]})},yu=Object(pn.a)((function(e){return Object(mn.a)({iconLink:{cursor:"pointer",color:e.palette.primary.main,marginRight:6},accountLink:{color:e.palette.text.secondary}})})),Cu=function(e){var t=e.partnerName,n=yu(),r=Object(a.useState)(!1),i=Object(L.a)(r,2),c=i[0],s=i[1];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"View accounts for ".concat(t),children:Object(D.jsx)(Ns.a,{className:n.iconLink,onClick:function(){return s(!0)}})}),Object(D.jsx)(Pt.a,{variant:"temporary",open:c,anchor:"right",onClose:function(){return s(!1)},children:Object(D.jsxs)(Q.a,{sx:{width:700,textAlign:"center"},children:[Object(D.jsx)(w.a,{variant:"h6",color:"primary",children:"Partner Accounts"}),Object(D.jsx)(K.a,{sx:{mb:3},component:_.a,children:Object(D.jsxs)(X.a,{sx:{width:"100%"},"aria-label":"simple table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Name"}),Object(D.jsx)(ne.a,{children:"Email"}),Object(D.jsx)(ne.a,{children:"Phone"})]})}),Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:Object(D.jsx)(o.b,{className:n.accountLink,to:"/NotImplemented",children:"Doe, Jane"})}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Z.a,{href:"mailto:jane.doe@email.com",children:"jane.doe@email.com"})}),Object(D.jsx)(ne.a,{children:"303-555-1212"})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:Object(D.jsx)(o.b,{className:n.accountLink,to:"/NotImplemented",children:"Doe, Jane"})}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Z.a,{href:"mailto:jane.doe@email.com",children:"jane.doe@email.com"})}),Object(D.jsx)(ne.a,{children:"303-555-1212"})]}),Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:Object(D.jsx)(o.b,{className:n.accountLink,to:"/NotImplemented",children:"Doe, Jane"})}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(Z.a,{href:"mailto:jane.doe@email.com",children:"jane.doe@email.com"})}),Object(D.jsx)(ne.a,{children:"303-555-1212"})]})]})]})}),Object(D.jsx)(G.a,{onClick:function(){return s(!1)},sx:{width:125},variant:"outlined",color:"primary",children:"Close"})]})})]})},wu=Object(qe.a)(Ld||(Ld=Object(Me.a)(["\n  mutation DeletePartner($partnerId: String!) {\n    deletePartner(partnerId: $partnerId) {\n      id\n    }\n  }\n"]))),Su=function(){var e=Object(a.useState)([]),t=Object(L.a)(e,2),n=t[0],r=t[1],i=Object(B.b)(Nt),c=i.loading,s=i.data;Object(a.useEffect)((function(){!c&&s&&r(s.getPartners)}),[s,c]);var o=Object(Ze.a)(wu,{refetchQueries:[Nt]}),l=Object(L.a)(o,1)[0],d=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l({variables:{partnerId:t.id}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u=it(),j=function(){var e,t,n,r,a,i;return(null===(e=u.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=u.user)||void 0===t?void 0:t.isAdmin)||(null===(n=u.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=u.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=u.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=u.user)||void 0===i?void 0:i.isEvaluationStaff)};return j()&&j()?Object(D.jsx)(D.Fragment,{children:j()&&Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:16,mb:2},children:[Object(D.jsx)(vu,{}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},"aria-label":"simple table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Partner"}),Object(D.jsx)(ne.a,{align:"right"})]})}),Object(D.jsx)(ee.a,{children:n&&n.map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:e.name}),Object(D.jsxs)(ne.a,{align:"right",children:[Object(D.jsx)(J.a,{title:"Edit ".concat(e.name),children:Object(D.jsx)(fu,{partner:e})}),Object(D.jsx)(Cu,{partnerName:e.name}),Object(D.jsx)(tr,{iconTooltip:"Remove ".concat(e.name," from email partners?"),dialogTitle:"Remove Registration Question",dialogText:"Are you sure you want to remove the ".concat(e.name," email partner?"),confirmText:"Remove",onClose:function(){return d(e)}})]})]},e.name)}))})]})})]})}):Object(D.jsx)($e,{})},Iu=n(938),ku=n(939),Au=n(484),Nu=n.n(Au),Du="GetCohortsForProgram",Tu=Object(qe.a)(Fd||(Fd=Object(Me.a)(["\n  query GetCohortsForProgram($programId: String!) {\n    getCohortsForProgram(programId: $programId) {\n      id\n      startDate\n      endDate\n      archived\n      internalLabel\n      registrationCloseDate\n      isOngoing\n    }\n  }\n"]))),Eu=Object(qe.a)(Ud||(Ud=Object(Me.a)(["\n  mutation DuplicateCohort($cohort: DuplicateCohortInput!) {\n    duplicateCohort(cohort: $cohort) {\n      id\n    }\n  }\n"]))),Pu=function(e){var t=e.cohort,n=e.programName,r=e.onDuplicateSuccess,i=Object(a.useState)(!1),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)(t.internalLabel),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(!1),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)(!1),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)(!1),y=Object(L.a)(f,2),C=y[0],S=y[1],I=Object(a.useState)(!1),k=Object(L.a)(I,2),A=k[0],T=k[1],E=Object(a.useState)(!1),P=Object(L.a)(E,2),R=P[0],F=P[1],U=Object(a.useState)(!1),M=Object(L.a)(U,2),q=M[0],z=M[1],H=Object(Ze.a)(Eu),W=Object(L.a)(H,2),Y=W[0],B=W[1].loading,Q=function(){o(!1)},$=function(e){var t=e.target.name,n=e.target.checked;"waitlist"===t&&x(n),"sessions"===t&&g(n),"hubMembers"===t&&S(n)},V=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(T(!1),F(!1),z(!1),!u||0!==u.trim().length){e.next=6;break}return T(!0),e.abrupt("return");case 6:return e.prev=6,e.next=9,Y({variables:{cohort:{cohortIdToDuplicate:t.id,newCohortInternalLabel:u||"",transferWaitlist:O,copySessions:v,copyHubMembers:C}},refetchQueries:[Du]});case 9:null===r||void 0===r||r(),Q(),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(6),F(!0),z(e.t0.graphQLErrors[0].message);case 17:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"Duplicate ".concat(t.internalLabel),children:Object(D.jsx)(Nu.a,{onClick:function(){o(!0)},sx:{color:"primary.main",cursor:"pointer"}})}),Object(D.jsxs)(ie.a,{open:s,onClose:Q,children:[Object(D.jsxs)(ce.a,{children:["Duplicate ",t.internalLabel]}),Object(D.jsxs)(se.a,{children:[Object(D.jsx)(le,{isOpen:B,title:"Saving..."}),Object(D.jsxs)(Oe.a,{children:["Program: ",n]}),Object(D.jsx)(xe.a,{sx:{mb:1,mt:1}}),Object(D.jsx)(It.a,{sx:{mt:2},autoFocus:!0,margin:"dense",id:"internalTitle",label:"Internal Title",fullWidth:!0,variant:"outlined",color:"warning",value:u,onChange:function(e){var t=e.target.value;j(t)}}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsxs)(N.a,{xs:6,children:[Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{checked:O,name:"waitlist",onChange:$}),label:"Transfer Waitlist"}),Object(D.jsx)("br",{}),Object(D.jsx)(w.a,{sx:{mb:1},variant:"caption",children:"Copies over as new registrants"})]}),Object(D.jsxs)(N.a,{xs:6,children:[Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{checked:v,name:"sessions",onChange:$}),label:"Copy Sessions"}),Object(D.jsx)("br",{}),Object(D.jsx)(w.a,{sx:{mb:1},variant:"caption",children:"Copies all sessions without the session date"})]}),Object(D.jsxs)(N.a,{xs:6,children:[Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{checked:C,name:"hubMembers",onChange:$}),label:"Copy HubMember"}),Object(D.jsx)("br",{}),Object(D.jsx)(w.a,{sx:{mb:1},variant:"caption",children:"Copies all HubMembers as unassigned roles"})]})]}),A&&Object(D.jsx)(me.a,{severity:"error",sx:{mt:2},children:"An internal title is required"}),R&&Object(D.jsx)(me.a,{severity:"error",sx:{mt:2},children:q})]}),Object(D.jsxs)(he.a,{children:[Object(D.jsx)(G.a,{variant:"outlined",color:"warning",onClick:Q,children:"Cancel"}),Object(D.jsx)(G.a,{variant:"contained",color:"warning",onClick:V,children:"Duplicate Cohort"})]})]})]})},Ru=Object(qe.a)(Md||(Md=Object(Me.a)(["\n  mutation AddCohortToProgram($cohort: AddCohortToProgramInput!) {\n    addCohortToProgram(cohort: $cohort) {\n      id\n    }\n  }\n"]))),Lu=function(e){var t=e.programId,n=function(){return{programId:t,internalLabel:"",startDate:null,endDate:null}},i=Object(a.useState)(n()),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)(!1),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(!1),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)(!1),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useRef)(null),y=Object(a.useRef)(null),C=Object(Ze.a)(Ru,{refetchQueries:[Du,Ec]}),S=Object(L.a)(C,2),k=S[0],A=S[1],N=A.error,T=A.loading,E=s.startDate?s.startDate.split("T")[0]:"",P=s.endDate?s.endDate.split("T")[0]:"",R=Object(a.useState)(E),F=Object(L.a)(R,2),U=F[0],M=F[1],q=Object(a.useState)(P),z=Object(L.a)(q,2),H=z[0],W=z[1],Y=function(){x(!1);var e=!0;return 0===s.internalLabel.length&&(x(!0),e=!1),e},B=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t,r,a,i;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Y()){e.next=3;break}return e.abrupt("return");case 3:return a=(null===f||void 0===f||null===(t=f.current)||void 0===t?void 0:t.value)||"",i=(null===y||void 0===y||null===(r=y.current)||void 0===r?void 0:r.value)||"",s.startDate=a?"".concat(a,"T00:00:00.000Z"):null,s.endDate=i?"".concat(i,"T00:00:00.000Z"):null,e.next=9,k({variables:{cohort:s}});case 9:N||(o(n()),g(!0),j(!1)),e.next=14;break;case 12:e.prev=12,e.t0=e.catch(0);case 14:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(){return e.apply(this,arguments)}}(),$=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o(n()),x(!1),j(!1);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:T,title:"Saving"}),Object(D.jsxs)(G.a,{onClick:function(){return j(!0)},variant:"outlined",color:"primary",size:"small",children:[Object(D.jsx)(rr.c,{}),"\xa0 Add New Cohort"]}),Object(D.jsx)(yc,{error:N}),Object(D.jsxs)(Pt.a,{anchor:"right",open:u,onClose:function(){return j(!1)},children:[Object(D.jsx)(w.a,{sx:{marginTop:3,marginBottom:3,textAlign:"center"},variant:"h5",color:"primary",children:"Add New Cohort"}),Object(D.jsx)(Q.a,{sx:{width:400},children:Object(D.jsxs)(I.a,{sx:{ml:2,width:350},spacing:2,children:[Object(D.jsx)(It.a,{value:s.internalLabel,name:"internalLabel",label:"Cohort Name",variant:"outlined",color:"warning",onChange:function(e){var t=e.target.value,n=e.target.name;o(Object(r.a)(Object(r.a)({},s),{},Object(Tt.a)({},n,t)))},helperText:"Required",error:O}),Object(D.jsx)(It.a,{sx:{mb:3},type:"date",id:"startDate",name:"startDate",inputRef:f,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;M(t)}},value:U,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"Start Date",color:"warning"}),Object(D.jsx)(It.a,{sx:{mb:3},type:"date",id:"endDate",name:"endDate",inputRef:y,onChange:function(e){if(e.target.value&&""!==e.target.value){var t=e.target.value;W(t)}},value:H,style:{width:"100%",marginRight:"8px"},InputLabelProps:{shrink:!0},variant:"outlined",label:"End Date",color:"warning"}),Object(D.jsxs)(Q.a,{sx:{marginLeft:2,textAlign:"center"},children:[Object(D.jsx)(G.a,{onClick:B,color:"primary",variant:"contained",children:"Add"}),"\xa0\xa0\xa0",Object(D.jsx)(G.a,{onClick:$,color:"primary",variant:"outlined",children:"Cancel"})]})]})})]}),Object(D.jsx)(Nn,{isOpen:v,text:"Cohort has been created"})]})},Fu=(Object(pn.a)((function(e){return Object(mn.a)({editor:{height:"300px"},accountSelect:{width:"100%",marginBottom:2,textAlign:"left"}})})),function(e){var t,n,r,i,c,s=e.isOpen,o=e.onClose,l=e.cohortId,d=it(),u=(Object(F.h)(),Object(B.b)(Tn,{variables:{cohortId:l}})),j=u.data,b=u.loading,h=Object(B.b)(ro,{variables:{userId:null!==(t=null===(n=d.user)||void 0===n?void 0:n.id)&&void 0!==t?t:""}}),O=h.data,x=h.loading,m=null===j||void 0===j?void 0:j.getCohortDashboard,p=(null!==(r=null===O||void 0===O?void 0:O.getRegistrationsForUser)&&void 0!==r?r:[]).some((function(e){return e.cohortId===l})),v=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t="/registration/".concat(l),window.open(t,"_blank");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=function(e,t,n,r){return r?"Cohort is Ongoing":e?t?Ae(e,!t,!1):ke(e,n,!1):""},f=Object(a.useState)(),y=Object(L.a)(f,2),C=y[0],S=y[1],I=new Date;return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(ie.a,{open:s,PaperProps:{sx:{width:"80vw",height:"80vh",maxWidth:"none",maxHeight:"none","& ul, & ol":{marginLeft:"17px"}}},children:[Object(D.jsx)(ce.a,{sx:{m:0,p:2},id:"customized-dialog-title",children:"View as UnRegistered Learner"}),Object(D.jsx)(se.a,{children:Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:b||x,title:"Loading"}),m&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:null!==(i=m.externalTitle)&&void 0!==i?i:""}),Object(D.jsx)("br",{}),Object(D.jsx)("br",{}),Object(D.jsxs)(Q.a,{sx:{mt:2,mb:2},children:[Object(D.jsxs)(N.a,{container:!0,spacing:9,sx:{pb:2},children:[Object(D.jsxs)(N.a,{item:!0,xs:6,md:8,children:[Object(D.jsx)(kr,{label:"When This ECHO Meets",value:m.scheduleDescription}),Object(D.jsx)(kr,{label:"What This ECHO Will Focus On",value:m.evaluationGoal}),Object(D.jsx)(kr,{label:"Learning Objectives/Outcomes",value:m.learningObjectives})]}),Object(D.jsxs)(N.a,{item:!0,xs:6,md:4,sx:{pl:10},children:[Object(D.jsx)(w.a,{variant:"body1",children:Object(D.jsx)(kr,{label:"Start Date",value:g(m.startDate,!1,!1)})}),Object(D.jsx)("br",{}),Object(D.jsx)(w.a,{variant:"body1",children:Object(D.jsx)(kr,{label:"End Date",value:g(m.endDate,!1,!1,m.isOngoing)})})]})]}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{sx:{minWidth:650},"aria-label":"simple table",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(zr,{currentSort:null===C||void 0===C?void 0:C.prop,onSort:S,sortProperty:"number",headerText:"Session/Title",align:"left"}),Object(D.jsx)(zr,{currentSort:null===C||void 0===C?void 0:C.prop,onSort:S,sortProperty:"startDate",headerText:"Date",align:"left"}),Object(D.jsx)(zr,{currentSort:null===C||void 0===C?void 0:C.prop,onSort:S,sortProperty:"startDate",headerText:"Time",align:"left"})]})}),Object(D.jsx)(ee.a,{children:m.allSessions&&qr(m.allSessions,C).map((function(e){return Object(D.jsxs)(te.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[Object(D.jsx)(ne.a,{align:"left",children:"".concat(e.number," - ").concat(e.title)}),Object(D.jsx)(ne.a,{align:"left",children:g(e.startDate,!1,!1)}),Object(D.jsx)(ne.a,{align:"left",children:g(e.startDate,!0,!0)})]},e.id)}))})]})})]}),p&&Object(D.jsx)(me.a,{severity:"info",children:"You have already requested registration for this cohort"}),!p&&m.allowPreregistration&&(!m.registrationOpenDate||new Date(m.registrationOpenDate)>I)&&Object(D.jsx)(no,{cohortTitle:null!==(c=m.externalTitle)&&void 0!==c?c:"",cohortId:l}),!p&&m.registrationOpenDate&&new Date(m.registrationOpenDate)<=I&&Object(D.jsx)(G.a,{sx:{mb:3},onClick:v,variant:"contained",color:"primary",children:"Sign Up For This ECHO"})]})]})}),Object(D.jsx)(he.a,{children:Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(G.a,{sx:{width:"200px"},onClick:function(){o()},variant:"contained",color:"primary",children:"Close"})})})]})})}),Uu=(Object(pn.a)((function(e){return Object(mn.a)({editor:{height:"300px"},accountSelect:{width:"100%",marginBottom:2,textAlign:"left"}})})),function(e){var t,n=e.isOpen,r=e.onClose,a=e.cohortId,i=Object(B.b)($l,{variables:{cohortId:a}}),c=i.data,s=i.loading,o=null===c||void 0===c?void 0:c.getCohortDetailForLearner;return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(ie.a,{open:n,PaperProps:{sx:{width:"80vw",height:"80vh",maxWidth:"none",maxHeight:"none"}},children:[Object(D.jsx)(ce.a,{sx:{m:0,p:2},id:"customized-dialog-title",children:"View as Registered Learner"}),Object(D.jsx)(se.a,{children:Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:s,title:"Loading..."}),o&&o.id&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:null!==(t=null===o||void 0===o?void 0:o.externalLabel)&&void 0!==t?t:""}),Object(D.jsx)(Ql,{cohort:o})]})]})}),Object(D.jsx)(he.a,{children:Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(G.a,{sx:{width:"200px"},onClick:function(){r()},variant:"contained",color:"primary",children:"Close"})})})]})})}),Mu=Object(qe.a)(qd||(qd=Object(Me.a)(["\n  mutation ArchiveCohort($cohort: ArchiveCohortInput!) {\n    archiveCohort(cohort: $cohort) {\n      id\n    }\n  }\n"]))),qu=function(e){var t=e.cohorts,n=e.programId,r=e.programName,i=Object(gt.a)(Tu,{fetchPolicy:"no-cache"}),c=Object(L.a)(i,2),s=c[0],l=c[1],d=l.called,u=l.data,j=Object(a.useState)(!1),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(a.useState)(""),m=Object(L.a)(x,2),p=m[0],v=m[1],g=Object(a.useState)(""),f=Object(L.a)(g,2),y=f[0],C=f[1],S=Object(a.useState)(!1),I=Object(L.a)(S,2),k=I[0],A=I[1],N=Object(a.useState)(!1),T=Object(L.a)(N,2),E=T[0],P=T[1],R={prop:"startDate",order:"desc"},F=Object(a.useState)(R),U=Object(L.a)(F,2),M=U[0],q=U[1],z=Object(a.useState)(t||[]),H=Object(L.a)(z,2),W=H[0],Y=H[1],B=Object(Ze.a)(Mu),Q=Object(L.a)(B,2),$=Q[0],V=(Q[1].loading,function(){s({variables:{programId:n}})}),G=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t,n){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,$({variables:{cohort:{cohortIdToArchive:t}}});case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),console.log("There was an error with archiving",e.t0);case 8:return e.prev=8,console.log("i am here"),V(),e.finish(8);case 12:case"end":return e.stop()}}),e,null,[[0,5,8,12]])})));return function(t,n){return e.apply(this,arguments)}}();return Object(a.useEffect)((function(){Y(t||[])}),[t]),Object(a.useEffect)((function(){d&&Y((null===u||void 0===u?void 0:u.getCohortsForProgram)||[])}),[u]),Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{variant:"h6",children:"Cohorts"}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{checked:h,onChange:function(e){O(e.target.checked)},color:"primary",name:"checkedA"}),label:"Show Archived"}),Object(D.jsx)(Lu,{programId:n}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{"aria-label":"cohort list",size:"small",children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(zr,{currentSort:null===M||void 0===M?void 0:M.prop,onSort:q,sortProperty:"internalLabel",headerText:"Cohort",order:null===M||void 0===M?void 0:M.order}),Object(D.jsx)(zr,{currentSort:null===M||void 0===M?void 0:M.prop,onSort:q,sortProperty:"startDate",headerText:"Start",order:null===M||void 0===M?void 0:M.order}),Object(D.jsx)(zr,{currentSort:null===M||void 0===M?void 0:M.prop,onSort:q,sortProperty:"endDate",headerText:"End",order:null===M||void 0===M?void 0:M.order}),Object(D.jsx)(zr,{currentSort:null===M||void 0===M?void 0:M.prop,onSort:q,sortProperty:"registrationCloseDate",headerText:"Reg Close Date",order:null===M||void 0===M?void 0:M.order}),h&&Object(D.jsx)(zr,{currentSort:null===M||void 0===M?void 0:M.prop,onSort:q,sortProperty:"archived",headerText:"Archived",order:null===M||void 0===M?void 0:M.order}),Object(D.jsx)(ne.a,{align:"left",children:"\xa0"})]})}),Object(D.jsx)(ee.a,{children:W&&qr(W,M.order?M:R).map((function(e,t){return h||!e.archived?Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",style:{width:100},children:Object(D.jsx)(Z.a,{sx:{color:"primary.main"},component:o.b,to:"/admin/cohort/".concat(e.id),children:e.internalLabel})}),Object(D.jsx)(ne.a,{style:{width:80},children:ke(e.startDate)}),Object(D.jsx)(ne.a,{style:{width:80},children:e.isOngoing?"Ongoing":ke(e.endDate)}),Object(D.jsx)(ne.a,{style:{width:80},children:ke(e.registrationCloseDate)}),h&&Object(D.jsx)(ne.a,{style:{width:35},children:e.archived?"Yes":"No"}),Object(D.jsxs)(ne.a,{align:"center",style:{width:50},children:[Object(D.jsxs)("div",{children:[Object(D.jsx)(J.a,{title:"Registered View",children:Object(D.jsx)(Iu.a,{sx:{cursor:"pointer",color:"primary.main"},onClick:function(){return t=e.id,v(t),void P(!0);var t}})}),Object(D.jsx)(J.a,{title:"Un-Registered View",children:Object(D.jsx)(ku.a,{sx:{cursor:"pointer",color:"primary.main"},onClick:function(){return t=e.id,C(t),void A(!0);var t}})})]}),Object(D.jsxs)("div",{children:[Object(D.jsx)(Pu,{programName:r,cohort:e,onDuplicateSuccess:V}),e.archived?Object(D.jsx)(J.a,{title:"Restore Cohort",children:Object(D.jsx)(wd.a,{onClick:function(){return G(e.id,!1)},sx:{color:"primary.main",cursor:"pointer"}})}):Object(D.jsx)(J.a,{title:"Archive Cohort",children:Object(D.jsx)(yd.a,{onClick:function(){return G(e.id,!0)},sx:{color:"primary.main",cursor:"pointer"}})})]})]})]},t):null}))})]})}),Object(D.jsx)(Uu,{cohortId:p,isOpen:E,onClose:function(){P(!1)}}),Object(D.jsx)(Fu,{cohortId:y,isOpen:k,onClose:function(){A(!1)}})]})},zu=Object(qe.a)(zd||(zd=Object(Me.a)(["\n  mutation UpdateProgram($program: UpdateProgramInput!) {\n    updateProgram(program: $program) {\n      id\n      name\n      createdAt\n      updatedAt\n    }\n  }\n"]))),Hu="GetAllPrograms",Wu=Object(qe.a)(Hd||(Hd=Object(Me.a)(["\n  query GetAllPrograms {\n    getAllPrograms {\n      id\n      name\n      partnerId\n      partner {\n        name\n      }\n      isArchived\n      _count {\n        cohorts\n      }\n    }\n  }\n"]))),Yu=function(e){var t,n=e.program,i=Object(a.useState)(n),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)([]),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(!1),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(a.useState)(!1),p=Object(L.a)(m,2),v=p[0],g=p[1],f=Object(a.useState)(!1),y=Object(L.a)(f,2),C=y[0],w=y[1];Object(a.useEffect)((function(){o(n)}),[n]);var S=Object(B.b)(Nt),I=S.loading,k=S.data;Object(a.useEffect)((function(){!I&&k&&j(k.getPartners)}),[k,I]);var A=Object(Ze.a)(zu,{refetchQueries:[Hu,Ec]}),T=Object(L.a)(A,2),E=T[0],P=T[1],R=P.loading,F=P.error;Object(a.useEffect)((function(){g(I)}),[I,R]);var U=function(e){var t=e.target.name,n=e.target.value;o("isArchived"!==t?Object(r.a)(Object(r.a)({},s),{},Object(Tt.a)({},t,n)):Object(r.a)(Object(r.a)({},s),{},{isArchived:e.target.checked}))},M=function(){x(!1);var e=!0;return 0===s.name.length&&(x(!0),e=!1),e},q=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var t;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(M()){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,t={id:s.id,name:s.name,partnerId:s.partnerId,isArchived:s.isArchived},e.next=6,E({variables:{program:t}});case 6:w(!0),e.next=11;break;case 9:e.prev=9,e.t0=e.catch(2);case 11:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:v,title:"Loading"}),F&&Object(D.jsx)(me.a,{severity:"error",children:F}),Object(D.jsx)(ft.a,{variant:"outlined",children:Object(D.jsx)(yt.a,{children:Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{item:!0,xs:4,children:Object(D.jsx)(Ct.a,{sx:{width:"90%"},children:Object(D.jsx)(It.a,{name:"name",label:"Program Name",value:s.name,variant:"outlined",onChange:U,color:"warning",helperText:"Required",error:O})})}),Object(D.jsx)(N.a,{item:!0,xs:4,children:Object(D.jsxs)(Ct.a,{sx:{width:"90%"},children:[Object(D.jsx)(wt.a,{id:"partner-label",color:"warning",children:"Implementation Partner"}),Object(D.jsxs)(kt.a,{sx:{textAlign:"left"},value:null!==(t=s.partnerId)&&void 0!==t?t:"",name:"partnerId",onChange:function(e){var t=e.target.name,n=e.target.value;o(Object(r.a)(Object(r.a)({},s),{},Object(Tt.a)({},t,n)))},labelId:"partner-label",label:"Implementation Partner",color:"warning",children:[Object(D.jsx)(St.a,{value:""}),u&&u.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))]})]})}),Object(D.jsx)(N.a,{item:!0,xs:2,children:Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,{checked:s.isArchived,onChange:U,color:"primary",name:"isArchived"}),label:"Archived"})}),Object(D.jsx)(N.a,{item:!0,xs:2,children:Object(D.jsx)(G.a,{onClick:q,color:"primary",variant:"contained",children:"Save"})})]})})}),Object(D.jsx)(Nn,{isOpen:C,text:"Program has been updated"})]})},Bu=n(971),Qu=n(994),$u=n(959),Vu=n(1007);var Gu,Ju,Zu,Ku,_u,Xu=function(e){var t=e.dateAdded,n=e.displayName,r=e.name,a=e.url;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Vu.a,{children:Object(D.jsx)(Bu.a,{children:Object(D.jsx)(Z.a,{href:a,target:"_blank",children:Object(D.jsx)(Rl.a,{sx:{color:"warning.main"}})})})}),Object(D.jsx)(wc.a,{primary:Object(D.jsx)(Z.a,{href:a,target:"_blank",children:null!==n&&void 0!==n?n:r}),secondary:t})]})},ej=function(e){var t=e.dateAdded,n=e.displayName,r=e.name,a=e.programId,i=function(e,t){var n=t.trim().replace(/ /g,"+");return"".concat(x.k,"/").concat(x.g,"/").concat(Object(x.h)(),"/programs/").concat(e,"/").concat(n)}(null!==a&&void 0!==a?a:"",r);return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Vu.a,{children:Object(D.jsx)(Bu.a,{children:Object(D.jsx)(Z.a,{href:i,children:Object(D.jsx)(Kr.a,{sx:{color:"warning.main"}})})})}),Object(D.jsx)(wc.a,{primary:Object(D.jsx)(Z.a,{href:i,children:null!==n&&void 0!==n?n:r}),secondary:t})]})},tj=function(e){var t=e.programId,n=e.resources;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{variant:"h6",children:"Latest Resources"}),Object(D.jsx)(Qu.a,{children:n&&n.map((function(e){var n;return Object(D.jsx)($u.a,{children:e.resourceTypeId===Ie.j?Object(D.jsx)(Xu,{displayName:e.displayName,name:e.name,dateAdded:ke(e.createdAt),url:null!==(n=e.url)&&void 0!==n?n:""}):Object(D.jsx)(ej,{displayName:e.displayName,name:e.name,dateAdded:ke(e.createdAt),programId:t})},e.createdAt)}))})]})},nj=n(270),rj=n.n(nj),aj=function(e){var t=e.to,n=e.text,r=e.icon,a=e.color,i=void 0===a?"secondary":a;return Object(D.jsx)(Z.a,{component:o.b,to:t,children:Object(D.jsxs)(G.a,{sx:{mr:1},color:i,children:[r&&Object(D.jsx)(Q.a,{sx:{mr:1},children:r}),n]})})},ij=function(e){var t=e.programId;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(w.a,{variant:"h6",children:"Quick Links"}),Object(D.jsxs)(Q.a,{sx:{textAlign:"left",marginLeft:3,marginBottom:2},children:[Object(D.jsx)(aj,{to:"".concat(_s.href,"/").concat(t),text:"".concat(_s.text),icon:Object(D.jsx)(ae.a,{sx:{color:"warning.main",fontSize:18,marginRight:1,verticalAlign:"middle"}}),color:"primary"}),Object(D.jsx)(aj,{to:"".concat(Xs.href,"/").concat(t),text:"".concat(Xs.text),icon:Object(D.jsx)(rj.a,{sx:{color:"warning.main",fontSize:18,marginRight:1,verticalAlign:"middle"}}),color:"primary"})]})]})},cj=function(){var e,t,n=Object(F.j)().id,r=Object(B.b)(Pc,{variables:{id:n},fetchPolicy:"no-cache"}),a=r.loading,i=r.data,c=r.error,s=null===i||void 0===i?void 0:i.getProgramById,o=[{to:Zs.href,text:Zs.text,isActive:!0},{to:"",text:null!==(e=null===s||void 0===s?void 0:s.name)&&void 0!==e?e:"",isActive:!1}];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:a,title:"Loading..."}),Object(D.jsx)(S.a,{maxWidth:"xl",sx:{pt:10,mb:12},children:s&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(qs,{breadcrumbs:o}),c&&Object(D.jsx)(me.a,{severity:"error",children:c.graphQLErrors[0].message}),s&&Object(D.jsx)(T,{title:s.name}),Object(D.jsx)(Q.a,{sx:{mt:4},children:s&&Object(D.jsx)(Yu,{program:s})}),Object(D.jsxs)(N.a,{sx:{mt:4,textAlign:"left"},container:!0,children:[Object(D.jsx)(N.a,{item:!0,xs:9,children:Object(D.jsx)(qu,{programId:n,programName:null!==(t=null===s||void 0===s?void 0:s.name)&&void 0!==t?t:"",cohorts:s.cohorts})}),Object(D.jsxs)(N.a,{item:!0,xs:3,sx:{textAlign:"center"},children:[Object(D.jsx)(ij,{programId:n}),Object(D.jsx)(tj,{programId:n,resources:s.resources})]})]})]})})]})},sj=Object(qe.a)(Gu||(Gu=Object(Me.a)(["\n  mutation AddProgram($program: AddProgramInput!) {\n    addProgram(program: $program) {\n      id\n      name\n    }\n  }\n"]))),oj=function(){var e,t=i.a.useState(!1),n=Object(L.a)(t,2),c=n[0],s=n[1],o=Object(a.useState)({name:"",partnerId:null}),l=Object(L.a)(o,2),d=l[0],u=l[1],j=Object(a.useState)([]),b=Object(L.a)(j,2),h=b[0],O=b[1],x=Object(a.useState)(!1),m=Object(L.a)(x,2),p=m[0],v=m[1],g=Object(a.useState)(!1),f=Object(L.a)(g,2),y=f[0],C=f[1],S=Object(a.useState)(!1),I=Object(L.a)(S,2),k=I[0],A=I[1],N=Object(B.b)(Nt),T=N.loading,E=N.data;Object(a.useEffect)((function(){!T&&E&&O(E.getPartners)}),[E,T]);var P=Object(Ze.a)(sj,{variables:{program:d},refetchQueries:[Hu]}),R=Object(L.a)(P,2),F=R[0],U=R[1],M=U.error,q=U.loading;Object(a.useEffect)((function(){C(q)}),[q]);var z=function(){v(!1);var e=!0;return 0===d.name.length&&(v(!0),e=!1),e},H=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,z()){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,F();case 5:M||(u({name:"",partnerId:null}),A(!0),s(!1)),e.next=10;break;case 8:e.prev=8,e.t0=e.catch(0);case 10:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u({name:"",partnerId:null}),s(!1);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(G.a,{onClick:function(){return s(!0)},variant:"outlined",color:"primary",size:"small",children:[Object(D.jsx)(rr.c,{}),"\xa0 Add New Program"]}),Object(D.jsxs)(Pt.a,{anchor:"right",open:c,onClose:function(){return s(!1)},children:[Object(D.jsx)(le,{isOpen:y,title:"Saving"}),M&&Object(D.jsx)(me.a,{severity:"error",children:M.graphQLErrors[0].message}),Object(D.jsx)(w.a,{sx:{marginTop:3,marginBottom:3,textAlign:"center"},variant:"h5",color:"primary",children:"Add New Program"}),Object(D.jsxs)(Q.a,{sx:{width:400},children:[Object(D.jsx)(It.a,{sx:{width:350,marginLeft:2},value:d.name,name:"name",variant:"outlined",color:"warning",onChange:function(e){var t=e.target.name,n=e.target.value;u(Object(r.a)(Object(r.a)({},d),{},Object(Tt.a)({},t,n)))},helperText:"Required",error:p}),Object(D.jsxs)(Ct.a,{sx:{width:350,ml:2,mt:2},children:[Object(D.jsx)(wt.a,{id:"partner-label",color:"warning",children:"Implementation Partner"}),Object(D.jsxs)(kt.a,{value:null!==(e=d.partnerId)&&void 0!==e?e:"",name:"partnerId",onChange:function(e){var t=e.target.name,n=e.target.value;u(Object(r.a)(Object(r.a)({},d),{},Object(Tt.a)({},t,n)))},labelId:"partner-label",label:"Implementation Partner",color:"warning",children:[Object(D.jsx)(St.a,{value:""}),h&&h.map((function(e){return Object(D.jsx)(St.a,{value:e.id,children:e.name},e.id)}))]})]}),Object(D.jsxs)(Q.a,{sx:{ml:2,mt:2,textAlign:"center"},children:[Object(D.jsx)(G.a,{onClick:H,color:"primary",variant:"contained",children:"Add"}),"\xa0\xa0\xa0",Object(D.jsx)(G.a,{onClick:W,color:"primary",variant:"outlined",children:"Cancel"})]})]})]}),Object(D.jsx)(Nn,{isOpen:k,text:"Program has been created"})]})},lj=function(){var e,t=Object(B.b)(Wu,{fetchPolicy:"no-cache"}),n=t.loading,r=t.data,a=t.error,i=null!==(e=null===r||void 0===r?void 0:r.getAllPrograms)&&void 0!==e?e:[],c=it(),s=function(){var e,t,n,r,a,i,s;return(null===(e=c.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=c.user)||void 0===t?void 0:t.isAdmin)||(null===(n=c.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=c.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=c.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=c.user)||void 0===i?void 0:i.isEvaluationStaff)||(null===(s=c.user)||void 0===s?void 0:s.isPartner)};return a?Object(D.jsx)("h1",{children:a.graphQLErrors[0].message}):s()&&s()?Object(D.jsx)(D.Fragment,{children:s()&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:n,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:12},children:[Object(D.jsx)(T,{title:"ECHO Programs"}),Object(D.jsx)(Q.a,{sx:{textAlign:"left",mb:2},children:Object(D.jsx)(oj,{})}),Object(D.jsx)(K.a,{component:_.a,children:Object(D.jsxs)(X.a,{children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Program"}),Object(D.jsx)(ne.a,{children:"Partner"}),Object(D.jsx)(ne.a,{children:"# of Cohorts"}),Object(D.jsx)(ne.a,{children:"Archived"}),Object(D.jsx)(ne.a,{})]})}),Object(D.jsx)(ee.a,{children:i.map((function(e){var t,n;return Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",children:e.name}),Object(D.jsx)(ne.a,{children:null===(t=e.partner)||void 0===t?void 0:t.name}),Object(D.jsx)(ne.a,{align:"left",children:null===(n=e._count)||void 0===n?void 0:n.cohorts}),Object(D.jsx)(ne.a,{children:e.isArchived?"Yes":"No"}),Object(D.jsx)(ne.a,{children:Object(D.jsx)(J.a,{title:"Go to program dashboard",children:Object(D.jsx)(C.a,{component:o.b,to:"/admin/program/dashboard/".concat(e.id),children:Object(D.jsx)(Ps.a,{color:"primary"})})})})]},e.id)}))})]})})]})]})}):Object(D.jsx)($e,{})},dj=Object(qe.a)(Ju||(Ju=Object(Me.a)(["\n  mutation UpdateCurrentPassword($updateCredentials: ValidateUpdateCurrentPasswordInput!) {\n    updateCurrentPassword(updateCredentials: $updateCredentials) {\n      isValid\n      errorMessage\n    }\n  }\n"]))),uj=function(e){e.userId;var t=e.redirectToLogin,n=Object(F.h)(),i=Object(a.useState)(""),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)(!1),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)({currentPassword:"",newPassword:"",confirmPassword:""}),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(Ze.a)(dj),p=Object(L.a)(m,2),v=p[0],g=p[1],f=(g.error,g.loading),y=function(e){var t=e.target.name,n=e.target.value;x(Object(r.a)(Object(r.a)({},O),{},Object(Tt.a)({},t,n)))},C=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var r,a,i,c,s;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o(""),!(r=Object(Xe.b)(O.newPassword,O.confirmPassword)).isValid){e.next=34;break}return e.prev=3,i=Object(Xe.a)(O.currentPassword),c=Object(Xe.a)(O.newPassword),e.next=8,v({variables:{updateCredentials:{currentPassword:i,newPassword:c}}});case 8:if(e.t1=a=e.sent.data,e.t0=null===e.t1,e.t0){e.next=12;break}e.t0=void 0===a;case 12:if(!e.t0){e.next=16;break}e.t2=void 0,e.next=17;break;case 16:e.t2=a.updateCurrentPassword;case 17:if(null!==(s=e.t2)&&void 0!==s&&s.isValid){e.next=24;break}return j(!1),o((null===s||void 0===s?void 0:s.errorMessage)||"A valid current password is required"),e.abrupt("return");case 24:j(!0),t&&n.push(zs);case 26:e.next=32;break;case 28:e.prev=28,e.t3=e.catch(3),console.log(e.t3),o("An unexpected error occurred.");case 32:e.next=35;break;case 34:o(r.message);case 35:case"end":return e.stop()}}),e,null,[[3,28]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:f,title:"Saving..."}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{xs:3}),Object(D.jsx)(N.a,{xs:6,children:Object(D.jsxs)(I.a,{spacing:2,children:[u&&Object(D.jsx)(me.a,{severity:"success",children:"Password has been updated"}),Object(D.jsx)(It.a,{autoFocus:!0,margin:"dense",name:"currentPassword",label:"Current Password",type:"password",variant:"outlined",color:"warning",value:O.currentPassword,onChange:y,required:!0}),Object(D.jsx)(It.a,{autoFocus:!0,margin:"dense",name:"newPassword",label:"New Password",type:"password",variant:"outlined",color:"warning",value:O.newPassword,onChange:y,required:!0}),Object(D.jsx)(Et,{}),Object(D.jsx)(It.a,{sx:{mt:2},margin:"dense",name:"confirmPassword",label:"Confirm New Password",type:"password",variant:"outlined",color:"warning",value:O.confirmPassword,onChange:y,required:!0}),s.length>0&&Object(D.jsx)(me.a,{severity:"error",children:s}),Object(D.jsx)(Q.a,{sx:{textAlign:"right"},children:Object(D.jsx)(G.a,{onClick:C,variant:"contained",color:"primary",disabled:!(O.currentPassword&&O.newPassword&&O.confirmPassword),children:"Update"})})]})}),Object(D.jsx)(N.a,{xs:3})]})]})},jj=function(){var e,t,n=it();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:[Object(D.jsx)(T,{title:"Change Password"}),Object(D.jsx)(uj,{userId:null!==(e=null===(t=n.user)||void 0===t?void 0:t.id)&&void 0!==e?e:"",redirectToLogin:!1})]})})},bj=n(274),hj=n.n(bj),Oj=n(284),xj=n(940),mj=n(954),pj=function(e){var t,n,a=e.question,i=e.register,c=e.errors,s=Object(Si.a)(),o=Object.keys(c).some((function(e){return e.startsWith(a.name)}));return Object(D.jsxs)(Q.a,{children:[Object(D.jsxs)(I.a,{direction:"row",children:[Object(D.jsx)(w.a,{component:"div",dangerouslySetInnerHTML:{__html:hj.a.sanitize(null===a||void 0===a?void 0:a.title)}}),a.required&&Object(D.jsx)(w.a,{ml:1,color:"primary.main",children:"*"})]}),Object(D.jsxs)(X.a,{children:[Object(D.jsx)(je.a,{children:Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{}),null===(t=a.scale)||void 0===t?void 0:t.map((function(e,t){return Object(D.jsx)(ne.a,{align:"center",children:e.label},t)}))]})}),Object(D.jsx)(ee.a,{children:null===(n=a.statements)||void 0===n?void 0:n.map((function(e,t){var n,o=!!c["".concat(a.name,"-").concat(e.name)];return Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{component:"th",scope:"row",style:{color:o?s.palette.primary.main:"inherit"},children:e.statement}),Object(D.jsx)(xj.a,{row:!0,name:"".concat(a.name,"-").concat(e.name),defaultValue:"",style:{display:"contents"},children:null===(n=a.scale)||void 0===n?void 0:n.map((function(t,n){return Object(D.jsx)(ne.a,{align:"center",children:Object(D.jsx)($t.a,{value:t.label,control:Object(D.jsx)(mj.a,Object(r.a)({},i("".concat(a.name,"-").concat(e.name),{required:a.required}))),label:"",style:{margin:0}})},n)}))})]},t)}))})]}),o&&Object(D.jsx)(w.a,{color:"primary.main",sx:{mt:2},children:"All questions in this section are required."})]})},vj=function(e){var t=e.label,n=e.isRequired;return Object(D.jsxs)(I.a,{direction:"row",sx:{fontWeight:"bold",fontSize:"16px",mb:1},children:[Object(D.jsx)(w.a,{dangerouslySetInnerHTML:{__html:hj.a.sanitize(t)}}),n&&Object(D.jsx)(w.a,{ml:1,color:"red",children:"*"})]})},gj=function(e){var t=e.onSubmit,n=e.cohort,a=e.saveButtonText,i=null===n||void 0===n?void 0:n.registrationQuestions,c=Object(Oj.b)(),s=c.register,o=c.handleSubmit,l=c.watch,d=c.formState.errors,u=c.control,j=l();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)("form",{onSubmit:o(t),children:[i&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(Nl,{children:"Registration Questions"}),Object(D.jsx)(Q.a,{sx:{textAlign:"left",mt:2,width:"100%"},children:Object(D.jsx)(I.a,{spacing:2,children:function(e){return e.map((function(e){var t;return Object(D.jsxs)("div",{style:{width:"likert"===e.type?"100%":"600px"},children:["text"===e.type&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(vj,{label:e.title,isRequired:e.required}),Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({size:"small",id:e.name,variant:"outlined",color:"warning"},s(e.name,{required:e.required})),{},{sx:{width:"100%"}})),d[e.name]&&Object(D.jsx)(Sn.a,{error:!0,children:"Required"})]}),"select"===e.type&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(vj,{label:e.title,isRequired:e.required}),Object(D.jsx)(Ct.a,{fullWidth:!0,error:Boolean(d[e.name]),children:Object(D.jsx)(Oj.a,{name:e.name,control:u,rules:{required:!!e.required&&"Required"},render:function(t){var n,a=t.field,i=t.fieldState.error;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(kt.a,Object(r.a)(Object(r.a)({size:"small"},a),{},{multiple:e.isMultiSelect||!1,color:"warning",value:e.isMultiSelect?a.value||[]:a.value,onChange:function(e){var t=e.target.value;Array.isArray(t)&&t.includes("Other"),a.onChange(t)},renderValue:function(t){return Array.isArray(t)?t.map((function(t){var n,r;return(null===(n=e.options)||void 0===n||null===(r=n.find((function(e){return e.value===t})))||void 0===r?void 0:r.label)||t})).join(", "):t},children:[null===(n=e.options)||void 0===n?void 0:n.map((function(t,n){return Object(D.jsxs)(St.a,{value:(r=t.label,i=t.value,i&&0!==i.length?i:r),children:[e.isMultiSelect&&Object(D.jsx)(Vt.a,{checked:Array.isArray(a.value)?a.value.includes(t.value):a.value===t.value}),t.label]},n);var r,i})),e.hasOtherOption&&Object(D.jsxs)(St.a,{value:"Other",children:[e.isMultiSelect&&Object(D.jsx)(Vt.a,{checked:Array.isArray(a.value)?a.value.includes("Other"):"Other"===a.value}),"Other - Please Specify"]})]})),i&&Object(D.jsx)(Sn.a,{error:!0,children:"Required"})]})}})}),e.hasOtherOption&&(null===(t=j[e.name])||void 0===t?void 0:t.includes("Other"))&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(It.a,Object(r.a)(Object(r.a)({size:"small",label:"Other - Please Specify"},s("".concat(e.name,"Other"),{required:!0})),{},{margin:"normal",fullWidth:!0,error:!!d&&!!d["".concat(e.name,"Other")]})),d["".concat(e.name,"Other")]&&Object(D.jsx)(Sn.a,{error:!0,children:"Required"})]})]}),"yes/no"===e.type&&Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(Ct.a,{size:"small",children:[Object(D.jsx)(vj,{label:e.title,isRequired:e.required}),Object(D.jsx)(Oj.a,{name:e.name,control:u,rules:{required:!!e.required&&"Selection is required"},defaultValue:null,render:function(t){var n,a,i,c,s=t.field;return Object(D.jsxs)(xj.a,Object(r.a)(Object(r.a)({},s),{},{children:[Object(D.jsx)($t.a,{value:(null===(n=e.yesNo)||void 0===n?void 0:n.yesText)||"Yes",control:Object(D.jsx)(mj.a,{}),label:(null===(a=e.yesNo)||void 0===a?void 0:a.yesText)||"Yes"}),Object(D.jsx)($t.a,{value:(null===(i=e.yesNo)||void 0===i?void 0:i.noText)||"No",control:Object(D.jsx)(mj.a,{}),label:(null===(c=e.yesNo)||void 0===c?void 0:c.noText)||"No"})]}))}}),d[e.name]&&Object(D.jsx)(Sn.a,{error:!0,children:"Required"})]})}),"likert"===e.type&&Object(D.jsx)(pj,{question:e,register:s,errors:d})]},e.name)}))}(i)})})]}),(null===n||void 0===n?void 0:n.agreement)&&"<div><br></div>"!==n.agreement&&Object(D.jsxs)(Q.a,{mt:4,children:[Object(D.jsx)(Dl,{title:"Agreement For All Series Participants",text:n.agreement}),Object(D.jsx)($t.a,{control:Object(D.jsx)(Vt.a,Object(r.a)({},s("isAgreed",{required:!0}))),label:"Yes, I Agree"}),d.isAgreed&&Object(D.jsx)(Sn.a,{error:!0,children:"Required"})]}),Object(D.jsx)(G.a,{sx:{mt:4},type:"submit",color:"primary",variant:"contained",children:a})]})})},fj=Object(qe.a)(Zu||(Zu=Object(Me.a)(["\n  mutation AddCohortRegistration($cohortRegistration: AddCohortRegistrationInput!) {\n    addCohortRegistration(cohortRegistration: $cohortRegistration) {\n      id\n    }\n  }\n"]))),yj=function(){var e=Object(a.useState)(!1),t=Object(L.a)(e,2),n=t[0],r=t[1];return Object(a.useEffect)((function(){var e=setTimeout((function(){r(!0),window.location.href="/programs"}),9e3);return function(){return clearTimeout(e)}}),[]),Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:n,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:[Object(D.jsx)(T,{title:"Registration is currently unavailable for this ECHO"}),Object(D.jsxs)(N.a,{container:!0,sx:{mt:5},children:[Object(D.jsx)(N.a,{item:!0,xs:2}),Object(D.jsx)(N.a,{item:!0,xs:8,children:Object(D.jsx)(I.a,{spacing:5,children:Object(D.jsxs)(me.a,{severity:"info",children:["You will be redirected to ECHOs You Can Explore shortly. (Or ",Object(D.jsx)(Z.a,{color:"inherit",href:"/programs",children:"Click Here"})," to navigate to the available ECHOs now)"]})})}),Object(D.jsx)(N.a,{item:!0,xs:2})]})]})]})},Cj=["isAgreed"],wj=function(e){var t=e.title,n=e.firstName,r=Object(F.h)();return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:12,textAlign:"center"},children:[Object(D.jsx)(me.a,{sx:{mb:4},severity:"success",children:Object(D.jsxs)(w.a,{variant:"body1",children:[n,", your registration request has been received for ",t,". Please check your email for next steps."]})}),Object(D.jsx)(G.a,{variant:"contained",color:"primary",onClick:function(){return r.push("/programs")},children:"Browse ECHO Programs"})]})})},Sj=function(){var e,t=it(),n=Object(F.j)().cohortId,i=Object(a.useState)(!1),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)(!1),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(!0),h=Object(L.a)(b,2),O=h[0],x=h[1],m=Object(B.b)(Tn,{variables:{cohortId:n}}),p=m.data,v=m.loading,g=Object(Ze.a)(fj,{refetchQueries:["GetRegistrationsForUser"]}),f=Object(L.a)(g,2),y=f[0],C=f[1],w=C.loading,I=C.error,k=null===p||void 0===p?void 0:p.getCohortDashboard,A=null===k||void 0===k?void 0:k.registrationOpenDate,E=null===k||void 0===k?void 0:k.registrationCloseDate;if(Object(a.useEffect)((function(){if(!v&&!w&&p){var e=$r()();E&&E.length&&$r()(E).add(1,"day").isBefore(e)&&j(!0),A&&A.length&&$r()(A).isAfter(e)&&x(!1)}}),[v,A,E,w,p]),!O||u)return Object(D.jsx)(yj,{});var P,R,U,M=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(a){var i,c,s,l,d;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.isAgreed,c=Object(Y.a)(a,Cj),null===k||void 0===k||!k.registrationQuestions){e.next=13;break}return s=Object(r.a)({},c),k.registrationQuestions.forEach((function(e){var t=s[e.name];if(e.hasOtherOption)if(Array.isArray(t)&&t.includes("Other")){var n="".concat(e.name,"Other");if(n in s){var r=t.indexOf("Other");-1!==r&&(t[r]="Other Answer: ".concat(s[n])),s[e.name]=t}}else if("Other"===t){var a="".concat(e.name,"Other");a in s&&(s[e.name]="Other Answer: ".concat(s[a]))}var i=s[e.name];Array.isArray(i)&&i.length>1&&(s[e.name]=i.join("; "))})),e.prev=4,e.next=7,y({variables:{cohortRegistration:{cohortId:n,userId:null!==(l=null===(d=t.user)||void 0===d?void 0:d.id)&&void 0!==l?l:"",isActive:!0,isAgreed:i,copiedFromWaitlist:!1,registrationAnswers:s?JSON.stringify(s):void 0}}});case 7:o(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),console.log("error",I);case 13:case"end":return e.stop()}}),e,null,[[4,10]])})));return function(t){return e.apply(this,arguments)}}(),q=function(e,t,n){return n?"Cohort is Ongoing":e?ke(e,t,!1):""};return s?Object(D.jsx)(wj,{title:null!==(P=null===k||void 0===k?void 0:k.externalTitle)&&void 0!==P?P:"",firstName:null!==(R=null===(U=t.user)||void 0===U?void 0:U.fullName)&&void 0!==R?R:""}):Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:v,title:"Loading..."}),Object(D.jsx)(le,{isOpen:w,title:"Saving..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:12,"& ul, & ol":{marginLeft:"17px"}},children:[I&&Object(D.jsx)(me.a,{severity:"error",children:I.graphQLErrors[0].message}),k&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(T,{title:null!==(e=k.externalTitle)&&void 0!==e?e:""}),Object(D.jsxs)(Q.a,{sx:{mt:2,mb:2},children:[Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsxs)(N.a,{item:!0,xs:6,md:8,children:[Object(D.jsx)(kr,{label:"When This ECHO Meets",value:k.scheduleDescription}),Object(D.jsx)(kr,{label:"What This ECHO Will Focus On",value:k.evaluationGoal}),Object(D.jsx)(kr,{label:"Learning Objectives/Outcomes",value:k.learningObjectives}),Object(D.jsx)(kr,{label:"Audience",value:k.audience})]}),Object(D.jsxs)(N.a,{item:!0,xs:6,md:4,sx:{pl:2},children:[Object(D.jsx)(kr,{label:"Start Date",value:q(k.startDate,!1)}),Object(D.jsx)(kr,{label:"End Date",value:q(k.endDate,!1,k.isOngoing)})]})]}),Object(D.jsx)(gj,{onSubmit:M,cohort:k,saveButtonText:"Register for Cohort"})]})]})]})]})},Ij=n(500),kj=n(501),Aj=Object(qe.a)(Ku||(Ku=Object(Me.a)(["\n  mutation InitiateForgotPassword($forgotPassword: InitiateForgotPasswordInput!) {\n    initiateForgotPassword(forgotPassword: $forgotPassword) {\n      isSuccess\n      message\n    }\n  }\n"]))),Nj=function(){var e=Object(a.useState)(""),t=Object(L.a)(e,2),n=t[0],r=t[1],i=Object(a.useState)(!1),c=Object(L.a)(i,2),s=c[0],o=c[1],l=Object(a.useState)("A valid email address is required"),d=Object(L.a)(l,2),u=d[0],j=d[1],b=Object(a.useState)(!1),h=Object(L.a)(b,2),O=h[0],m=h[1],p=Object(a.useState)(null),v=Object(L.a)(p,2),g=v[0],f=v[1],y=Object(a.useState)(""),C=Object(L.a)(y,2),k=C[0],A=C[1],E=Object(Ze.a)(Aj),P=Object(L.a)(E,2),R=P[0],F=P[1],U=F.loading,M=F.data,q=F.error;Object(a.useEffect)((function(){if(M&&M.initiateForgotPassword){var e=M.initiateForgotPassword,t=e.isSuccess,n=e.message;t?m(!0):(o(!0),j(null!==n&&void 0!==n?n:"An unknown error occurred"))}}),[M]);var z=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(t){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("Enter"!==t.key){e.next=3;break}return e.next=3,W();case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),H=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o(!1),g){e.next=5;break}return o(!0),A("Please complete the reCAPTCHA"),e.abrupt("return",!1);case 5:if(0!==n.trim().length){e.next=8;break}return o(!0),e.abrupt("return",!1);case 8:if(Object(Ij.a)(n)){e.next=11;break}return o(!0),e.abrupt("return",!1);case 11:return e.abrupt("return",!0);case 12:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),W=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=g,!e.t0){e.next=5;break}return e.next=4,H();case 4:e.t0=e.sent;case 5:if(!e.t0){e.next=8;break}return e.next=8,R({variables:{forgotPassword:{email:n,recaptchaToken:g}}});case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:U,title:"Sending..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:[Object(D.jsx)(T,{title:"Reset Your Password"}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{item:!0,xs:3}),Object(D.jsxs)(N.a,{item:!0,xs:6,children:[!O&&Object(D.jsxs)(I.a,{spacing:2,alignItems:"center",children:[" ",Object(D.jsx)(w.a,{variant:"h6",children:"To reset your password, please enter your email address"}),s&&Object(D.jsx)(me.a,{severity:"error",children:u}),q&&Object(D.jsx)(me.a,{severity:"error",children:q.graphQLErrors[0].message}),k.length>0&&Object(D.jsx)(me.a,{severity:"error",children:k}),Object(D.jsx)(It.a,{label:"Email Address",value:n,onChange:function(e){r(e.target.value)},onKeyPress:z,color:"warning",fullWidth:!0}),Object(D.jsx)(kj.a,{sitekey:x.d,onChange:function(e){return f(e)},style:{marginBottom:"10px"}}),Object(D.jsx)(G.a,{variant:"contained",color:"primary",onClick:W,disabled:!g,fullWidth:!0,children:"Reset Password"})]}),O&&Object(D.jsx)(me.a,{severity:"info",children:"If an account with that email address exists, you will receive a password reset link shortly."})]}),Object(D.jsx)(N.a,{item:!0,xs:3})]})]})]})},Dj=function(e){var t=e.userId,n=e.redirectToLogin,i=Object(F.h)(),c=Object(a.useState)(""),s=Object(L.a)(c,2),o=s[0],l=s[1],d=Object(a.useState)(!1),u=Object(L.a)(d,2),j=u[0],b=u[1],h=Object(a.useState)({password:"",confirmPassword:""}),O=Object(L.a)(h,2),x=O[0],m=O[1],p=Object(Ze.a)(dn),v=Object(L.a)(p,2),g=v[0],f=v[1].loading,y=function(e){var t=e.target.name,n=e.target.value;m(Object(r.a)(Object(r.a)({},x),{},Object(Tt.a)({},t,n)))},C=function(){var e=Object(Ge.a)(Object(Ve.a)().mark((function e(){var r;return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l(""),!(r=Object(Xe.b)(x.password,x.confirmPassword)).isValid){e.next=16;break}return e.prev=3,e.next=6,g({variables:{userId:t,password:x.password}});case 6:m({password:"",confirmPassword:""}),b(!0),n&&i.push(zs),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),l(e.t0.graphQLErrors[0].message);case 14:e.next=17;break;case 16:l(r.message);case 17:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(){return e.apply(this,arguments)}}();return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:f,title:"Saving..."}),Object(D.jsxs)(N.a,{container:!0,children:[Object(D.jsx)(N.a,{xs:3}),Object(D.jsx)(N.a,{xs:6,children:Object(D.jsxs)(I.a,{spacing:2,children:[j&&Object(D.jsx)(me.a,{severity:"success",children:"Password has been updated"}),Object(D.jsx)(It.a,{autoFocus:!0,margin:"dense",name:"password",label:"Password",type:"password",variant:"outlined",color:"warning",value:x.password,onChange:y,required:!0}),Object(D.jsx)(Et,{}),Object(D.jsx)(It.a,{sx:{mt:2},margin:"dense",name:"confirmPassword",label:"Confirm Password",type:"password",variant:"outlined",color:"warning",value:x.confirmPassword,onChange:y,required:!0}),o.length>0&&Object(D.jsx)(me.a,{severity:"error",children:o}),Object(D.jsx)(Q.a,{sx:{textAlign:"right"},children:Object(D.jsx)(G.a,{onClick:C,variant:"contained",color:"primary",disabled:!(x.password&&x.confirmPassword),children:"Update"})})]})}),Object(D.jsx)(N.a,{xs:3})]})]})},Tj=Object(qe.a)(_u||(_u=Object(Me.a)(["\n  query ValidateForgotPassword($code: String!) {\n    validateForgotPassword(code: $code) {\n      isSuccess\n      codeExpired\n      message\n      user {\n        id\n        firstName\n        lastName\n        email\n      }\n    }\n  }\n"]))),Ej=n(162);var Pj=function(){var e=Object(F.j)().code,t=function(e,t){var n=Object(B.b)(e,t),a=n.error;if(a&&(null===t||void 0===t||!t.suppressErrors)){if(null!==t&&void 0!==t&&t.throwErrors)throw new Error(a.message);var i=Object(Ej.g)(e),c="Query: ".concat(i);console.error(c),console.error(a)}return Object(r.a)(Object(r.a)({},n),{},{waiting:!(null===t||void 0===t||!t.skip)})}(Tj,{variables:{code:decodeURIComponent(e)}}),n=t.data,a=t.loading,i=t.error,c=null===n||void 0===n?void 0:n.validateForgotPassword,s=null===c||void 0===c?void 0:c.user;return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:a,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:[Object(D.jsx)(T,{title:"Reset Password"}),i&&Object(D.jsx)(me.a,{severity:"error",children:i.message}),c&&!c.isSuccess&&Object(D.jsx)(me.a,{severity:"error",children:c.message}),c&&c.codeExpired&&Object(D.jsxs)(me.a,{severity:"info",children:["Your password reset link has expired. Please"," ",Object(D.jsx)(Gl,{to:Bs.href,text:"go here"})," to request another password reset."]}),s&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsxs)(w.a,{variant:"h6",children:["Reset Password for ",s.firstName," ",s.lastName]}),Object(D.jsx)(Dj,{userId:s.id,redirectToLogin:!0})]})]})]})},Rj=function(e){var t=e.onClick;return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(Kr.a,{onClick:t,sx:{cursor:"pointer",color:"primary.main"}})})},Lj=function(e){e.onExportStart;var t=Object(a.useState)(!1),n=Object(L.a)(t,2),r=n[0],i=n[1];return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:r,title:"Processing Global Excel export, takes a few minutes..."}),Object(D.jsx)(X.a,{size:"small",children:Object(D.jsxs)(ee.a,{children:[Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"User Accounts with No Registrations"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(Rj,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ra(i);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Export All Registrants"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(Rj,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ia(i);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{children:"Data Export with Variable Labels"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(Rj,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sa("label",i);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]}),Object(D.jsxs)(te.a,{children:[Object(D.jsx)(ne.a,{sx:{"&:last-child td, &:last-child th":{border:0}},children:"Data Export with Variable Values"}),Object(D.jsx)(ne.a,{align:"right",children:Object(D.jsx)(Rj,{onClick:Object(Ge.a)(Object(Ve.a)().mark((function e(){return Object(Ve.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,sa("value",i);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))})})]})]})})]})},Fj=function(){var e=Object(a.useState)(!1),t=Object(L.a)(e,2),n=(t[0],t[1],Object(a.useState)(!1)),r=Object(L.a)(n,2),i=r[0],c=r[1],s=it(),o=function(){var e,t,n,r,a,i;return(null===(e=s.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=s.user)||void 0===t?void 0:t.isAdmin)||(null===(n=s.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=s.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(a=s.user)||void 0===a?void 0:a.isImplementationStaff)||(null===(i=s.user)||void 0===i?void 0:i.isEvaluationStaff)};return o()&&o()?Object(D.jsx)(D.Fragment,{children:o()&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(le,{isOpen:i,title:"Loading..."}),Object(D.jsxs)(S.a,{maxWidth:"xl",sx:{p:10,mb:2},children:[Object(D.jsx)(T,{title:"Exports : All Programs"}),Object(D.jsxs)(N.a,{container:!0,sx:{mt:5},children:[Object(D.jsx)(N.a,{item:!0,xs:2}),Object(D.jsx)(N.a,{item:!0,xs:8,children:Object(D.jsx)(I.a,{spacing:5,children:Object(D.jsx)(Lj,{onExportStart:c})})}),Object(D.jsx)(N.a,{item:!0,xs:2})]})]})]})}):Object(D.jsx)($e,{})},Uj="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAABDCAIAAABIqC8kAAAACXBIWXMAAC4jAAAuIwF4pT92AAAM2klEQVRoge2ae6ym1VXGn2etvd/3+845c2FmeoYOBZFLy61QoBhAKA0dwczUlBSVJgYTy1+NgLZRk6rBeqlyMVhjmnqpl2oaaglGCqQVKoIZHUostVw6tJU7QofhNsw53/e9795rLf84ZUzMjKcfnKFUef5e37f3b1/WXvvZL687/jT8IMsJdWy8cIt8v3uyYnqD5PWnN0hef3qD5PWnqUnyQlFNHTyJSqAiKkKcSqVBAiRdGKoAxbUCRpICECApRlYge4JoR1SlgtmgFQDbyoqoWeDRaKrhZj4TaeVJfM2wKiOi9H2i5JQQIcpFL0gUEas9Jcb9yNWZrIVlL/Q+0RKN3mcvLWxRO9Ck7wbkqE66BGslIkwigbmGBiZdVwUyM9jj/bIdW571f2hkfdSYyy2i7603plDpShm2qXez8LbNmHTrm9bNx6UTHahqdatBAIQkUTNrURpIUu0mo2YwKOGCUMXEERHJkFVEUgi7fpK+hwGfmmRWcul7RG8IT1IZSVQktC8NSCa6AEOzPLaCwezaD7x302GHNrPDUiuAnFK/OH7q8Sd2f/amkdesg4YmnTWQSkOCQaAiTer6zro6bAcsMWjb3uoKk7hZm3JvvSfRtrFRpxGZqctIlW5cbJrDzj97/dmnnLR1c2kGg9pC4G6SFIBXE9ETHYsfvXzW6zduvO35r9z7zS/fMejGGoD7HPKo77oc0qgC9MiUvhQI//eOcdoKsiJyStWsMqT6HHOiLpRupuada9IZl3/wiPPOnX3zJqtUTbCIBJAOxFJ7S1szgkEAZlUzJrt2PvLlO7Z94tPzL/Q9+6Zpxtb3ijZln/SStCSm4vse2ZcrSP3J+UOmInHAzUKooqnGQPKuftytm1m7ZfNPXfWxjeeeHavWJiYJ8Yg+M5H0kICAAkgEAxRWIjxU1CgxO3vw2487dcv5/8ny5CPfKqNudW6tlCpwhIDuLtj3nAQhgbnjjp6aJLlkVa9VAg3SuJZu3cx5l37wtI9cKuvWAYlgdYiCsEQPCECSL08KgwShqEKAEoGgGBSr5448+/TDD1l/3/a721EZ5KaEkWycrYntZ9PvJZk6C+9p3Dza3E7UFMZ2eOa1v/tDF/0cPAeEgJo1MIO7JHj67kjGy793MIIeHgYShjBUgFa1CCKt3fr+911z1fMzba1FE0XEwUnWZTs2NclcIZV1NJ7Lsy+KnPVHVxx/5ulOhMKBYhWqEGVAPRAI78lqUjspndSJlk5qlRps0QuIlD2VUVZEhnmkgje/+/SLP33Nc3PKrmp1MFC6lSchGbXkthktdGdd8UvrzzlnESrJAwGAqgHAoRAnTUE28KSVrWtrHIS2kVG1dyADcIQ3WceoDtfgJAPgt++5f65oG6lPnIg1unw/p87C4xTDQrc4/CfOO/ynL0iRJwS8E+ZgeIBBBEJQvosOjfLg9u2Tnc+0mha7etgxb5s/7vgkGNOTejaBpIYIt0ieYff++efu/4PPrOvrwoAT1IEmg//3+lwpEngAMp6ZOfnDl0hkGAYByyJewUQjBD0jEG0t3Tce3nHd9f9y263teLIG4n1Jw9kHvZrkd/7CJcdv3WwHbywquUCBmtXRbf+tq//j729dXScLg7CcVteEghohy50nU6+uGRep6aRLL57btEkcUEBQEEVS13eiDEFItHXy+N/d/NmLP/T1L35xdtIl+ITFZnTBF0sdJSl3/eEn/2zrB569c1vAa0LNSKOFbR+75uHrvzBTRuNZ35NqN54ko7vn3CzbselrYcizmUe8f4tEC8G41qoYREPEIA/NbQJrze751Gdu/b1r104W86INPQ/TrEc77qlpdqads1G33tP87snNH7niW5+/IaHKwp4v/caVz11/i2qCM3pvkIbaQgWNmh2ACrLzeuzPXLBqzZsWiLnizFLhqUhWIICkCn/4S7ff86fXbaj1xWE3sGRuUjVTsop3k0Adtuzc6wzmF8Zf/fi12crDX31g9y3/lGTs/bApqWnz7q7TJpfRxIeEuPoygz41iTrnTzsjXIbSIzUCNHAoIApDBaLb9fi1fzwrViIGlhBp6VQMOACoAI0FwFCXxYzW7Gsf/wQAKCqaTJu0ANBqKlbQqjq+l7Uz9eoqWY449hjuTYt7yykACoXt+Ic7d+7cWbpJJBF57e6kU7e00Eg7v94DQkFACUQAqFYBpIidt99NiUHTRKKVZUrxFdTUq2v+2KPRZgQIwCECBCBIIgAmz73w7LZ/j9qnoLcpiSx3DKyYpp6T+aOPCAj3JvcAyAACcPfupYXh7nHTJCEdEfGagUxPUkUjAEMAUEQAgRpABMnSTQg3KwAEQi5f+a2UpiYJqgAkAhEEJAAIEREkhayDBICkOuI1dKGmryA9woEAweJGEGYARASBAMb0JSr4vm95B0hTk7z40A5G6QLsUifV4F3OWiqcHbF+06Y2mhnjWMa9INusLG0jj0RhMQlAZUKXcDXrJCypRENDQS/S7y9+5Umef+Chii4lIGMGmsxztcgJQtaCmeG6rT86ER32WFVsUbsCLwxThhBJPaJ2/UBS1WY8SENQSi/92LK0aGvh/uJXnmRmoe5+/jlxTDwUAlKgPQJumrIDbzrtHVWa0maXoHeh4oQTk1oqo2maJCrVrcZcxwlKC/ehJo+X1LO0+4tfeZIQvnTvDghyIiBjAQAJwmm1uOaTN5+fDt0UbHqrqQmaZ0emJFV3H9eeZFQbJixKv3aCl4Ce8kLCBm8qbH/xK0/SZ+66bbuhU8AAgYBOAkSjuUNg9czpl12SSjvnbfFomJpQjIpYpJQ8QpJqk8e2p81pwpQ5945fv+ywU07puq4J21/8sh2b2lsx95eeePrwC85tBmtAZgaIniTDSQEVsvrow2Nx/NCOB9eNYxGWU5KAV2OjTngEzAdAU9NiHp7427944oUXHPGeM1948juLjz45qXWf8eBKu0RZ1cbjVRs2bDj5ZBNKrRA4RcgONgxB9aq66YyT0vo1j959X9+i6ybD3CjFwoxgQMHdg9lxpHOv/OhR79syRuPN8KjNZz36zUde3PnUPuP3Y3e9CpKI0CSP3HXfoe/dnNauTULUqkwSyBR21rXadFZynj/hyCPfddqq0fjJx5+MrtekFU4VRijl5Mt+/pyrf2X9SSfIxBukTFbkH976Y8PHHt1n/P7Knr0kU7upUGDcRzs46Lx3//jVvwNJMCD50qaJJZPOA6S5QVXhmPTf3vYVe2G3mZWcZjfNH/3OUy0nItygythbidI7+P2/eu1jN960yEUXpoKsbaVI7Pva+Mrd1K7acDAMs52PP7Fu7ZqDjj9qrCkHi5iRRiEgHnAXZbW+QJnz6kPnN55wzPwJbzv4rUes3XSI5GTWJxERqVapEgDCCUmQTZt/pKb61L0PrOqoOY1gM9X3d2V85R5kO5ydTDoC89Vuu/Kqndv+WVAqQSQBW0A9IBISlSZJBxQBmIc904RSU6s5oSJT0FcEsiQNKBAileiBCfTQd52uvWBcuoSBWdUDkIW9TNrcBNjVbqPjhg//2vP/uC05UiAZ4QjhmNGLKjRVIEBDdjbmg5DkAQcEMETTjOmVQAAFalBDE9597d6/vejyAdnNNe2oeqN1WbfrFWRh2NhUwQQwqq8p8vU7tq1ZPXfQ24+BIAiC6sxLr4oqhQGGSCB86c2hZxhpKgCaoBpAWNRIUsWfvOWm2y/7zbWlq1FD0CNmiowTUqx0Fm4Ek0QGNFSa7G6zFg/+67bvPPb0W488zFe3YwlSNEBhCSQu2ZKELD2ZQIGAISQDBDpUV89qfGbXnX/xN/f//icFXaC+pKVlHprsabC2auW+p+WVkwize4iGeHhEJSA26xH3Prrt5puHM3njYZvysHU3hqqTDELDg5QwFypBXarZBJUuUvPinoduuPn6D/3y3PYdLH2JOprVmUrpvB+kbBFusR8P8lVkYWsy61jHrmz7LKndE+OBeGW0NUXHOrfq6C3nDU897pit76ntsAEJhkUSAgggAlx61zH/txu/kB99+q6//tya0lNqxyreSpZmz2jQDPdo1FoHKRVUiX1v6b1ZeHqSKbXhZy865C1vkTZXd3fPqup4ZufOJ/7kr1bk//eSTO9wT6ldf/n551PqrWpOEWGltinjADgVB5wkZbMoAQtXkhSzKAKueNMHnCRcSW00FzeSbWoiIsz3VxG+Yh14Emh1J0kQgWKIQJYcUVa2oQNOAi8JUFEBIsLC3T3Clv1SYFodcJKaIokWNw8PhIhIkhqu/oNGItCoER5ZlnyfigC58o7eASehBwARcQQilt4hDoTv/f/4m7vXrd4gef3pDZLXn/7vkKSVPmpfa5GM8NaZ9DV9eFp5RXgZ6Egjbbxwy/e7M69KrXOkcdBRx/0X7xRw1rJN2vMAAAAASUVORK5CYII=",Mj=function(){return Object(a.useEffect)((function(){var e=document.getElementById("favicon");e&&(e.href=Uj)}),[]),Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsx)(E,{title:"Join In and Help Make Health Knowledge ECHO",children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(w.a,{variant:"subtitle1",textAlign:"justify",children:"ECHO Colorado (Extension for Community Health Outcomes) leverages learning, training and practice support to give voice to health care knowledge across Colorado and beyond."}),Object(D.jsx)(w.a,{variant:"subtitle1",textAlign:"justify",children:"Working with specialists, generalists and a wide range of different organizations, ECHO Colorado builds virtual learning collaboratives where health care professionals can share knowledge, skills and experiences. The goal is to increase everyone's ability to manage complex health care problems."})]})})})},qj=function(){return Object(a.useEffect)((function(){var e=document.getElementById("favicon");e&&(e.href=Uj)}),[]),Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsx)(E,{title:"Join In and Help Make Health Knowledge ECHO",children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(w.a,{variant:"subtitle1",textAlign:"justify",children:"ECHO DEMO (Extension for Community Health Outcomes) leverages learning, training and practice support to give voice to health care knowledge across Colorado and beyond."}),Object(D.jsx)(w.a,{variant:"subtitle1",textAlign:"justify",children:"Working with specialists, generalists and a wide range of different organizations, ECHO Colorado builds virtual learning collaboratives where health care professionals can share knowledge, skills and experiences. The goal is to increase everyone's ability to manage complex health care problems."})]})})})},zj=function(){return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsx)(E,{title:"Join In and Help Make Health Knowledge ECHO",children:Object(D.jsxs)(I.a,{spacing:2,sx:{textAlign:"left"},children:[Object(D.jsxs)(w.a,{variant:"subtitle1",children:[Object(D.jsx)("strong",{children:"Oregon ECHO Network (Extension for Community Health Outcomes)"})," ","delivers and supports telementoring programs for clinicians and clinical teams to learn, share, and connect."]}),Object(D.jsx)(w.a,{variant:"subtitle1",children:"Using a simple webcam, specialists and healthcare experts connect with a group of remote participants in interactive video sessions to discuss their toughest cases and learn evidence-based approaches to manage complex conditions and improve quality of care in their communities."}),Object(D.jsx)(w.a,{variant:"subtitle1",children:"As a project housed within the Oregon Rural Practice Based Research Network at OHSU, the Oregon ECHO Network is committed to building and sustaining a diverse, equitable, inclusive and anti-racist organization. We do so by evaluating how we develop and support our workforce, the partnerships we uphold and how we engage in community-partnered dialogue, research, coaching and education throughout."})]})})})})},Hj=function(){return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsx)(E,{title:"Join In and Help Make Health Knowledge ECHO",children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(w.a,{variant:"subtitle1",children:"Virginia Project ECHO (Extension for Community Health Outcomes) is a unique platform that leverages learning, training and practice support to give voice to knowledge across Virginia and beyond."}),Object(D.jsx)(w.a,{variant:"subtitle1",children:"Working with specialists, generalists, and a wide range of different organizations, Virginia Project ECHO helps build learning collaboratives where healthcare professionals, community advocates, law enforcement, and university staff can share knowledge, skills, and experiences. The goal is to increase everyone's ability to manage complex health care problems, share best practices, and collaborate to best utilize resources to prevent disease and keep people safe in Virginia."})]})})})})},Wj=function(){return Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsx)(E,{title:"Join In and Help Make Health Knowledge ECHO",children:Object(D.jsxs)(I.a,{spacing:2,children:[Object(D.jsx)(w.a,{variant:"subtitle1",children:"Project ECHO at Dartmouth Health (Extension for Community Health Outcomes) leverages learning, training and practice support to give voice to health and healthcare knowledge across New Hampshire and beyond."}),Object(D.jsx)(w.a,{variant:"subtitle1",children:"Working with health care specialists and generalists and as well as a wide range of professionals and community members, Project ECHO at Dartmouth Health helps build learning communities where participants share knowledge, skills and experiences to improve the health and well being of the people and communities that we serve."}),Object(D.jsx)("img",{src:"/images/D-H-logo.jpg",alt:"Dartmouth-Hitchcoch logo"})]})})})})},Yj=function(){return Object(D.jsx)(S.a,{maxWidth:"xl",sx:{p:14,mb:2},children:Object(D.jsx)(E,{title:"Join In and Help Make Health Knowledge ECHO",children:Object(D.jsx)(I.a,{spacing:2,children:Object(D.jsx)(w.a,{variant:"subtitle1",children:"Production Testing Tenant for Campbell Software, LLC"})})})})},Bj=function(){var e=Object(x.h)();return e===Ie.a?Object(D.jsx)(Mj,{}):e===Ie.g?Object(D.jsx)(zj,{}):e===Ie.u?Object(D.jsx)(Hj,{}):e===Ie.c?Object(D.jsx)(Wj,{}):e===Ie.e?Object(D.jsx)(qj,{}):e===Ie.b?Object(D.jsx)(Yj,{}):Object(D.jsx)(D.Fragment,{})},Qj=function(){return Object(D.jsx)(Bj,{})},$j=[{key:"route-change-password",path:Ws.href,component:jj,protected:!0}],Vj=[{key:"route-learner-program",path:"/programs",component:Zl,protected:!1},{key:"route-registration-unavailable",path:"/registrationUnavailable",component:yj,protected:!1},{key:"route-access-denied",path:"/PermissionDeniedSplash",component:$e,protected:!1},{key:"route-logout",path:"/logout",component:bd,protected:!1}],Gj=[{key:"route-manage-resources",path:"".concat(Xs.href,"/:id"),component:Jd,protected:!0},{key:"route-program-dashboard",path:"".concat(eo.href,"/:id"),component:cj,protected:!0},{key:"route-program-email-templates",path:"".concat(_s.href,"/:id"),component:vd,protected:!0}],Jj=[].concat($j,Vj,Gj,[{key:"route-reset-password",path:"".concat(Qs.href,"/:code"),component:Pj,protected:!1},{key:"route-cohort-registration",path:"/registration/:cohortId",component:Sj,protected:!0},{key:"route-forgot-password",path:Bs.href,component:Nj,protected:!1},{key:"route-edit-account",path:"/admin/account/edit/:userId",component:ml,protected:!0},{key:"route-my-account",path:"/my-account",component:Xd,protected:!0},{key:"route-accounts",path:"/admin/account/detail/:id",component:vt,protected:!0},{key:"route-my-echos",path:"/cohort-roster/:cohortId",component:co,protected:!0},{key:"route-email-templates",path:"/admin/emailTemplates",component:Al,protected:!0},{key:"route-my-echos",path:"/my-echos",component:bu,protected:!0},{key:"route-learner-cohort-dashboard",path:"/program-dashboard/:cohortId",component:Vl,protected:!0},{key:"route-accounts",path:"/admin/accounts",component:xn,protected:!0},{key:"route-current-projects",path:"/admin/current-projects",component:bl,protected:!0},{key:"route-my-current-projects",path:"/admin/my-current-projects",component:tu,protected:!0},{key:"route-cohort",path:"/admin/cohort/:cohortId",component:Ms,protected:!0},{key:"route-index",path:"/",component:Qj,protected:!1},{key:"route-create-account",path:"/createAccount",component:il,protected:!1},{key:"route-cohort-details",path:"/cohortDetails/:cohortId",component:ao,protected:!1},{key:"route-login",path:"/login",component:jd,protected:!1},{key:"route-logout",path:"/logout",component:bd,protected:!1},{key:"route-notimplemented",path:"/NotImplemented",component:hu,protected:!1},{key:"route-partner",path:"/admin/partners",component:Su,protected:!0},{key:"route-program",path:"/admin/programs",component:lj,protected:!0},{key:"route-global-export",path:"/admin/exports",component:Fj,protected:!0}]),Zj=n(941),Kj=n(487),_j=n.n(Kj),Xj=n(486),eb=n.n(Xj),tb=n(488),nb=n.n(tb),rb=n(485),ab=n.n(rb),ib=n(276),cb=n.n(ib),sb=function(e){var t=e.title;return Object(D.jsx)(Q.a,{sx:{fontWeight:"bold",color:"primary.main",ml:1,mt:2,mb:1},children:t})},ob=function(e){var t=e.path,n=e.icon,r=e.menuText,a=Object(F.i)(),i=t.toLowerCase()===a.pathname.toLowerCase();return Object(D.jsx)(o.c,{to:t,style:{textDecoration:"none"},children:Object(D.jsxs)(St.a,{selected:i,children:[Object(D.jsx)(Zj.a,{sx:{color:"warning.main"},children:n}),Object(D.jsx)(wc.a,{sx:{color:"warning.main"},primary:r})]})})},lb=function(e){var t,n=e.isDrawerOpen,r=e.toggleDrawer,a=it(),i=function(){var e,t,n,r,i,c;return(null===(e=a.user)||void 0===e?void 0:e.isAlbatross)||(null===(t=a.user)||void 0===t?void 0:t.isAdmin)||(null===(n=a.user)||void 0===n?void 0:n.isEchoStaff)||(null===(r=a.user)||void 0===r?void 0:r.isDevelopmentStaff)||(null===(i=a.user)||void 0===i?void 0:i.isImplementationStaff)||(null===(c=a.user)||void 0===c?void 0:c.isEvaluationStaff)};return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(Pt.a,{sx:{width:"300px","& .MuiDrawer-paper":{width:"300px !important"}},onClick:r(!1),variant:"temporary",open:n,onClose:r(!1),children:[Object(D.jsx)(sb,{title:"HOME"}),Object(D.jsxs)(I.a,{spacing:1,children:[Object(D.jsx)(ob,{path:"/",menuText:"Home",icon:Object(D.jsx)(ab.a,{})}),Object(D.jsx)(ob,{path:"/programs",menuText:"ECHO Programs",icon:Object(D.jsx)(cb.a,{})}),(null===(t=a.user)||void 0===t?void 0:t.isAuthenticated)&&Object(D.jsx)(ob,{path:"/my-echos",menuText:"My ECHOs",icon:Object(D.jsx)(ic.a,{})})]}),(i()||function(){var e;return null===(e=a.user)||void 0===e?void 0:e.isPartner}())&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(xe.a,{sx:{mt:2}}),Object(D.jsx)(sb,{title:"PROGRAM MANAGEMENT"}),Object(D.jsxs)(I.a,{spacing:1,children:[Object(D.jsx)(ob,{path:"/admin/current-projects",menuText:"All Current Projects",icon:Object(D.jsx)(W.a,{})}),Object(D.jsx)(ob,{path:"/admin/my-current-projects",menuText:"My Current Projects",icon:Object(D.jsx)(eb.a,{})}),Object(D.jsx)(ob,{path:"/admin/programs",menuText:"All Programs",icon:Object(D.jsx)(_j.a,{})})]}),i()&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(xe.a,{sx:{mt:2}}),Object(D.jsx)(sb,{title:"ADMIN"}),Object(D.jsxs)(I.a,{spacing:1,children:[Object(D.jsx)(ob,{path:"/admin/accounts",menuText:"Accounts",icon:Object(D.jsx)(Ns.a,{})}),Object(D.jsx)(ob,{path:"/admin/partners",menuText:"Implementation Partners",icon:Object(D.jsx)(nb.a,{})}),Object(D.jsx)(ob,{path:"/admin/emailTemplates",menuText:"Manage Email Templates",icon:Object(D.jsx)(ae.a,{})})]}),Object(D.jsx)(xe.a,{sx:{mt:2}}),Object(D.jsx)(sb,{title:"REPORTS"}),Object(D.jsx)(I.a,{spacing:1,children:Object(D.jsx)(ob,{path:"/admin/exports",menuText:"Global Exports",icon:Object(D.jsx)(Ns.a,{})})})]})]})]})})},db=function(e){var t,n=e.key,r=e.path,a=e.component,i=it(),c=Object(F.i)();return i.isLoading?Object(D.jsx)(le,{isOpen:!0,title:"Loading..."}):null!==(t=i.user)&&void 0!==t&&t.isAuthenticated?Object(D.jsx)(F.c,{path:r,component:a,exact:!0},n):Object(D.jsx)(F.b,{to:"/login?redirectTo=".concat(c.pathname)})},ub=n(499),jb=n(490),bb=n.n(jb),hb=n(489),Ob=n.n(hb),xb=Object(pn.a)((function(e){return Object(mn.a)({dropdownLink:{textDecoration:"none",color:e.palette.warning.main}})})),mb=function(){var e,t=xb(),n=Object(F.h)(),r=it(),a=i.a.useState(null),c=Object(L.a)(a,2),s=c[0],l=c[1],d=Boolean(s),u=function(){l(null)};return Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(J.a,{title:"Account settings",children:Object(D.jsx)(C.a,{onClick:function(e){l(e.currentTarget)},size:"small",sx:{ml:2},"aria-controls":d?"account-menu":void 0,"aria-haspopup":"true","aria-expanded":d?"true":void 0,children:Object(D.jsx)(Bu.a,{sx:{color:"secondary.main"},children:Object(D.jsx)(Ob.a,{})})})}),Object(D.jsxs)(ub.a,{anchorEl:s,id:"account-menu",open:d,onClose:u,onClick:u,PaperProps:{elevation:0,sx:{overflow:"visible",filter:"drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",mt:1.5,"& .MuiAvatar-root":{width:32,height:32,ml:-.5,mr:1},"&:before":{content:'""',display:"block",position:"absolute",top:0,right:14,width:10,height:10,bgcolor:"background.paper",transform:"translateY(-50%) rotate(45deg)",zIndex:0}}},transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},children:[Object(D.jsx)(St.a,{disabled:!0,children:null===(e=r.user)||void 0===e?void 0:e.fullName}),Object(D.jsx)(xe.a,{}),Object(D.jsx)(St.a,{sx:{color:"warning.main",textDecoration:"none"},children:Object(D.jsxs)(o.b,{className:t.dropdownLink,to:"/my-echos",children:[Object(D.jsx)(Zj.a,{children:Object(D.jsx)(cb.a,{sx:{color:"primary.main"}})})," ","My ECHOs"]})}),Object(D.jsx)(St.a,{sx:{color:"warning.main",textDecoration:"none"},children:Object(D.jsxs)(o.b,{className:t.dropdownLink,to:"/my-account",children:[Object(D.jsx)(ic.a,{sx:{color:"primary.main",fontSize:"20px",mr:1}}),"My Account"]})}),Object(D.jsx)(St.a,{sx:{color:"warning.main",textDecoration:"none"},children:Object(D.jsxs)(o.b,{className:t.dropdownLink,to:"/change-password",children:[Object(D.jsx)(Zj.a,{children:Object(D.jsx)(Bt.a,{sx:{color:"primary.main"}})})," ","Change Password"]})}),Object(D.jsxs)(St.a,{onClick:function(){return n.push("/login"),void r.signOut()},sx:{color:"warning.main",textDecoration:"none"},children:[Object(D.jsx)(Zj.a,{sx:{mr:1},children:Object(D.jsx)(bb.a,{sx:{color:"primary.main"}})})," ","Logout"]})]})]})},pb=Object(F.k)((function(){var e=it(),t=Object(a.useState)(!1),n=Object(L.a)(t,2),r=n[0],i=n[1];return Object(D.jsx)(D.Fragment,{children:Object(D.jsxs)(o.a,{children:[Object(D.jsx)(f.a,{position:"static",sx:{mb:10,position:"fixed",top:0,zIndex:100},children:Object(D.jsxs)(y.a,{children:[Object(D.jsx)(C.a,{onClick:function(){return i(!0)},edge:"start",color:"inherit","aria-label":"menu",children:Object(D.jsx)(A.a,{})}),Object(D.jsx)(lb,{isDrawerOpen:r,toggleDrawer:function(e){return function(t){("keydown"!==t.type||"Tab"!==t.key&&"Shift"!==t.key)&&i(e)}}}),Object(D.jsx)(w.a,{variant:"h6",sx:{flexGrow:1,textAlign:"left"},children:"ECHO Connect"}),Object(D.jsx)(aj,{to:Js.href,text:Js.text,icon:Object(D.jsx)(W.a,{})}),(!e.user||!e.user.isAuthenticated)&&Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(aj,{to:Ys.href,text:Ys.text,icon:Object(D.jsx)(z.a,{})}),Object(D.jsx)(aj,{to:zs,text:Hs,icon:Object(D.jsx)(M.a,{})})]}),e.user&&e.user.isAuthenticated&&Object(D.jsx)(mb,{})]})}),Object(D.jsx)(F.e,{children:Jj.map((function(e){return e.protected?Object(D.jsx)(db,{path:e.path,component:e.component},e.key):Object(D.jsx)(F.c,{path:e.path,component:e.component,exact:!0},e.key)}))})]})})})),vb=function(){var e=function(e){var t={logoUrl:"/images/CO-logo.jpg",height:"60px",width:"79px"},n={logoUrl:"/images/OEN-logo.jpg",height:"60px",width:"79px"},r={logoUrl:"/images/ECHO-logo.jpg",height:"60px",width:"122px"},a={logoUrl:"/images/ECHO-logo.jpg",height:"60px",width:"122px"};return e===Ie.a?t:e===Ie.g?n:e===Ie.u?r:e===Ie.c||e===Ie.c?a:t}(Object(x.h)()),t=e.logoUrl,n=e.height,r=e.width;return Object(D.jsx)("div",{className:"footer",children:Object(D.jsx)("p",{children:Object(D.jsx)(gb,{logoUrl:t,height:n,width:r})})})},gb=function(e){var t=e.logoUrl,n=e.height,r=e.width;return Object(D.jsx)("img",{src:t,height:n,width:r,alt:"ECHO Logo"})};var fb=function(){var e=it().user,t=Object(a.useState)(!1),n=Object(L.a)(t,2),r=n[0],i=n[1];Object(a.useEffect)((function(){null!==e&&void 0!==e&&e.id&&(i(!1),_e.a.get("cookie-consent-".concat(e.id))||i(!0))}),[null===e||void 0===e?void 0:e.id]);return null!==e&&void 0!==e&&e.id&&r?Object(D.jsx)(_.a,{elevation:3,sx:{position:"fixed",bottom:0,left:0,right:0,p:4,backgroundColor:"#2B373B",borderTop:1,borderColor:"divider",zIndex:1300},children:Object(D.jsxs)(Q.a,{sx:{maxWidth:"1200px",mx:"auto",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:2},children:[Object(D.jsx)(w.a,{variant:"body1",sx:{flex:1,color:"white"},children:"By using this site, you agree with our use of cookies. Please feel free to contact support for more information"}),Object(D.jsx)(G.a,{variant:"contained",onClick:function(){null!==e&&void 0!==e&&e.id&&(_e.a.set("cookie-consent-".concat(e.id),"true",{expires:365}),i(!1))},sx:{whiteSpace:"nowrap",background:"#f5f05f",color:"#2B373B","&:hover":{backgroundColor:"#f5f05f"}},children:"I Understand"})]})}):null};var yb=function(){var e=Object(x.h)(),t=Ie.g,n=x.a,r=x.c,i=x.e,c=x.b;Object(a.useEffect)((function(){var n=document.getElementById("favicon");n&&e===t&&(n.href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAXZJREFUOE/Nk0sowwEcxz9/bJYkV2TjtouTZ1tq7TIOLuQgj+WkqMXBAXkVEmlIDkhbColcHDjIWwiFAwfPiUiaeS17/bW/kHLZXPwuv/r2+31+j34/oRFlg0BIHSAnMHOJ+FqFJhLegkj+LOXyA8TACv+M/k8AAeI1KcgjIzhf3JD6VGamSt55/4DP48F+YsP96iQmOYnb/UN8bg9fI2T3NRMqk/F8c0eiXsNUgQnj4hi7g+M8nF2izs3izfHETFmtpE/kleO8t38AQuUyTMdLmFVaEEWK5qxs9lgwdDew3T/C9c4BqRUlRKviWOscIN1k/AVwsoxZqZEAhbNWtnot6Nuqma/pwH5qQ9dcJWmG7nrCoyIZ1uZ/d+CfM2eoHdHj5fHqhkS9luniSowL4+wMjOK4uEada2ClpQ9ZhILS1Um6YtJ+AgRBQKVLJ0yh4Gx+HQRI0GV8LdHrdktLdD2/EJuSxO3eEX7tP91BkPf892f66zu/A9uDqu3C9HYwAAAAAElFTkSuQmCC");var r="";switch(e){case Ie.a:r="lobh7ixx33";break;case Ie.g:r="lobqcoirjw";break;case Ie.u:case Ie.c:r=""}r.trim().length&&g.clarity.init(r)}),[e,t,n,r,i,c]);var s=window.navigator.userAgent.toLowerCase(),o=!0,l=P.find((function(e){return s.includes(e.name)}));if(l){var d=s.match("".concat(l.name,"/([0-9]+\\.[0-9]+)"));if(d)o=parseInt(d[1])>=l.minVersion;else o=!1}return o?Object(D.jsx)(D.Fragment,{children:Object(D.jsx)(at,{children:Object(D.jsxs)(v.a,{theme:p,children:[Object(D.jsx)(pb,{}),"\xa0",Object(D.jsx)(fb,{}),Object(D.jsx)(vb,{})]})})}):Object(D.jsx)(R,{})},Cb=Object(O.a)((function(e){var t=e.graphQLErrors,n=e.networkError;t&&(console.error(t),t.forEach((function(e){e.extensions&&("INTERNAL_SERVER_ERROR"===e.extensions.code||"Not authenticated"===e.extensions.code)&&(e.message.includes("Context creation failed")||e.message.includes("Unauthorizied"))&&(e.message.includes("Invalid token")||e.message.includes("expired token")||e.message.includes("Unauthorizied"))?(console.error("GraphQL error: Context creation failed - Invalid token"),window.location.href="/logout"):console.error("GraphQL error:",e)}))),n&&console.error("Network error:",n)})),wb=Object(l.a)({uri:x.i,credentials:"include",fetchOptions:{mode:"cors"}}),Sb=Object(x.h)(),Ib=Object(h.a)((function(e,t){var n=t.headers;return{headers:Object(r.a)(Object(r.a)({},n),{},{tenant:Sb})}})),kb=new d.a((function(e,t){return e.setContext((function(e){var t=e.headers,n=void 0===t?{}:t;return{headers:Object(r.a)(Object(r.a)({},n),{},{"Cache-Control":"no-store"})}})),t(e)})),Ab=new u.a({link:d.a.from([Cb,kb,Ib,wb]),cache:new j.a});s.a.render(Object(D.jsx)(b.a,{client:Ab,children:Object(D.jsx)(i.a.StrictMode,{children:Object(D.jsx)(o.a,{children:Object(D.jsx)(yb,{})})})}),document.getElementById("root"))},88:function(e,t,n){"use strict";(function(e){n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return s}));var r=n(330),a=n.n(r),i=n(30),c=function(e,t){var n=!1,r="";return(n=new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})").test(e.trim()))||(r="Password must be at least 8 characters, have at least 1 lowercase character, at least 1 uppercase character, at least 1 number, and at least one special character."),e!==t&&(n=!1,r="Password and Confirm Password do not match"),{isValid:n,message:r}},s=function(t){try{var n=e.from(i.f,"hex"),r=a.a.randomBytes(16),c=(n.toString("hex"),r.toString("hex")),s=a.a.createCipheriv("aes-256-cbc",n,r),o=s.update(t,"utf8","hex");return o+=s.final("hex"),"".concat(o,"::").concat(c)}catch(l){console.error("Encryption error:",l)}return t}}).call(this,n(67).Buffer)}},[[833,1,2]]]);
//# sourceMappingURL=main.2d8defaa.chunk.js.map