import{a as d,l as re,j as e,x as I,J as E,$ as m,_ as ce,a0 as _,au as S,R as $,Z as L,a8 as H,B as C,U as J,V as oe,p as de,bM as xe,bN as me}from"./vendor-33cfc369.js";import{S as Z,p as V,t as K,a as ue,g as he}from"./times-9be85982.js";import{q as we,B as O,I as Y,g as Q,T as h,U as f,v as je,m as j,c8 as fe,ar as q,aA as Ie,O as D,F as ge,cT as be,A as pe,d9 as Ae,k as Ee,da as _e,L as Pe,a5 as Ce,d7 as Ne,db as Re}from"./main-546e2ec5.js";import"./chart-chunk-b08e11a0.js";import"./pdf-chunk-3c30def4.js";import"./translation-en-us-ce949e70.js";import"./pintura-chunk-e334b20d.js";const Be=()=>{const{isEdit:t}=d.useContext(w),s=re(),{toast:l}=we(),i=()=>{let r=window.location.href;r.startsWith("capacitor")&&(r=r.replace("capacitor","https")),navigator.clipboard.writeText(r).then(()=>{l.success("PUBLIC_PROFILE_DETAILS_COPY_LINK")}).catch(()=>{l.error("PUBLIC_PROGRAM_DETAILS_COPY_LINK_ERROR")})};return e.jsxs(I,{gap:"md",className:"mobile:tw-flex-1",children:[!!t&&e.jsx(O,{variant:"outline",messageId:"PUBLIC_PROGRAM_HEADING_EDIT_PROFILE",leftSection:e.jsx(Y,{type:"EDIT"}),onClick:()=>s.push("/profile"),className:"mobile:tw-flex-1"}),e.jsx(O,{variant:"outline",messageId:"PUBLIC_PROGRAM_HEADING_SHARE",leftSection:e.jsx(Y,{type:"SHARE"}),onClick:i,className:"mobile:tw-flex-1"})]})},Le=()=>{const{user:t}=d.useContext(w),{areasOfExpertise:s}=t||{},[{isMobile:l}]=Q(),[i,r]=d.useState(!1);if((s==null?void 0:s.length)===0)return;const c=l?1:2;return e.jsxs(E,{bg:"primary.4",p:"sm",gap:"sm",align:"center",wrap:"wrap",className:"mobile:tw-mb-[1rem] mobile:tw-min-w-[100%]",children:[e.jsx(h,{messageId:"PUBLIC_PROGRAM_HEADING_EXPERTISE_IN",size:"md",fw:500}),e.jsx(I,{gap:"sm",wrap:"wrap",children:(s==null?void 0:s.length)>c?e.jsxs(e.Fragment,{children:[s.slice(0,c).map(({expertiseId:a,name:o})=>e.jsx(f,{enableTootltip:!0,children:o},a)),!l&&e.jsx(je,{multiline:!0,label:e.jsx(e.Fragment,{children:s.slice(c).map(a=>e.jsx(h,{size:"sm",c:"neutral.0",children:a.name}))}),children:e.jsx(f,{onClick:()=>r(a=>!a),className:"tw-cursor-pointer",children:`+ ${(s==null?void 0:s.length)-c}`})}),l&&e.jsxs(I,{gap:"sm",wrap:"wrap",children:[e.jsx(f,{onClick:()=>r(a=>!a),className:"tw-cursor-pointer",children:`+ ${(s==null?void 0:s.length)-c}`}),s.slice(c).map(a=>e.jsx(f,{className:`${i?"":"tw-hidden"}`,enableTootltip:!0,children:a.name},a.expertiseId))]})]}):s==null?void 0:s.map(a=>e.jsx(f,{enableTootltip:!0,children:a.name},a==null?void 0:a.expertiseId))})]})},Oe=()=>{const{user:t}=d.useContext(w),{firstName:s,lastName:l,countryFlagCode:i,pronoun:r,salutation:c}=t||{},a=o=>{const g=o.toUpperCase().split("").map(N=>127397+N.charCodeAt(0));return String.fromCodePoint(...g)};return e.jsxs(I,{gap:"xs",align:"center",children:[e.jsxs(j,{order:4,fw:600,tt:"capitalize",children:[c&&c!=="OTHER"&&c.toLowerCase(),"Â ",s," ",l]}),r&&r!=="SELECT"&&e.jsxs(h,{size:"sm",c:"neutral.8",children:["(",r,")"]}),i&&e.jsx(h,{size:"md",c:"neutral.8",children:a(i)})]})},De=()=>{const{user:t}=d.useContext(w),{credentials:s,designation:l,organization:i}=t||{};return e.jsxs(m,{gap:"5px",children:[e.jsx(h,{size:"sm",c:"neutral.8",fw:600,children:s==null?void 0:s.join(", ")}),e.jsxs(h,{size:"sm",c:"neutral.8",children:[l&&e.jsx(e.Fragment,{children:e.jsxs(h,{c:"neutral.8",fw:600,span:!0,children:[l,"Â ",e.jsx(h,{span:!0,c:"neutral.8",fw:600,messageId:"PUBLIC_PROFILE_ORGANIZATION_AT"}),"Â "]})}),e.jsx(h,{span:!0,c:"neutral.8",fw:600,children:i==null?void 0:i.name})]})]})},Se=()=>{const{isHub:t}=d.useContext(w),[{isMobile:s}]=Q();return e.jsxs(m,{gap:"lg",mt:ce(100),mb:"lg",mx:"lg",className:"mobile:tw-mt-[7rem]",children:[e.jsxs(I,{gap:"md",justify:"space-between",align:"flex-start",children:[e.jsxs(m,{gap:"xs",children:[s&&e.jsxs(fe,{href:"/",space:!1,children:[q("BATCH_DETAILS_BACK"),"Â ",q("COMMON_DASHBOARD")]}),e.jsx(Oe,{}),t&&e.jsx(Ie,{size:"md",c:"neutral.0",bg:"primary.8",messageId:"ADD_HUB_MEMBER_SELECT_ROLES_ID_13",classNames:{label:"tw-leading-9"},w:"fit-content"}),e.jsx(De,{})]}),e.jsx(_,{w:"140",h:"75px",src:Z,className:"mobile:tw-hidden",alt:"An image depicting the words 'Sustainable Development Goals' written in bold text."})]}),e.jsxs(I,{justify:"space-between",align:"flex-end",children:[e.jsx(Le,{}),e.jsx(Be,{})]})]})},ye="/static/media/badge-4.svg",Ge=()=>{const{badgeList:t,isEdit:s}=d.useContext(w),l=t.filter(i=>i.isEarned).length;return e.jsx(S,{radius:"md",withBorder:!0,my:"xl",variant:"compact",children:e.jsxs(m,{gap:"lg",p:"xs",children:[e.jsx(j,{messageId:"PUBLIC_PROGRAM_HEADING_BADGES",order:2,fw:600,values:{badges:l}}),e.jsx(E,{wrap:"wrap",justify:"flex-start",flex:"1",gap:"xs",children:t==null?void 0:t.map(({badgeIcon:i,isEarned:r,badgeName:c},a)=>e.jsx(e.Fragment,{children:i&&e.jsx(_,{w:"110px",fit:"cover",className:"tw-cursor-pointer tw-flex-[0.333] mobile:tw-flex-[0.5]",src:i+D.i512||ye,title:c,alt:`Image for ${c}`,opacity:r?"1":"0.3"},a)}))})]})})},Te=()=>{const{user:t}=d.useContext(w),{focusAreas:s}=t||{};return e.jsx(S,{radius:"md",withBorder:!0,my:"lg",variant:"compact",children:e.jsxs(m,{gap:"lg",p:"xs",children:[e.jsx(j,{messageId:"INVITE_HUB_TEXTFIELDCONTROLLED_LABEL_FOCUS_AREAS",order:2,fw:600}),e.jsx(I,{wrap:"wrap",gap:"sm",children:s.map((l,i)=>e.jsx(f,{maw:"100%",children:l==null?void 0:l.name},i))})]})})},Ue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAllJREFUSEvFls9PE0EUx79bii1YKKRCAmbRA9D4KyF4Ai4onLSE9KIx8axJ/wNveumNowdN9IJAehLSJlwoKRrxYgmJYkJ/JEChaUparVaaurbjzEJXtmw7u3DwJZtOMm/e5/1OBULIPIBJ+umW3XQG+UIhduWy2Md7JFAA4SlV3zPA3n4GdlszF3ImAAPzIJqAKd8yIrvpE4HZmiyY8rhRlCR8jm+jVCrLOhfsLfO9YrdbKxOnikDD0DNBEJ7WBUQSaYTWY3XL0dJsgWvoOuaCYVTO7JeKXkC0LsDWZMXEMAN8QuWsG2C0k6r0+RH4V7+AfUaEFfy/REA8ngEIwiU0Nq4oXRTeTCAcSaDL0YqbThGB1Q1uMK7ha+h22FVFJs/vTeNrx8OjxyEF8POgCNZJLOQu+oidecIcORK5BmTp1hNIZi/e9wA5q3ylAJKZHFKZHzybqvvB/n8ABG8XqTlvmc5e9lsJjvVeCCayWJWiHUMAF21ZOUUb3iBSwTFm/PsvCdIfgoayudhxP2Q9+yRvzQLxVzhu3GI2Rdvd7/pVKWItGvhYu00fuUbopEflHcWmmQ0ctqnxWG3jKoCh3DDlrRnq+Wu15+eo55OHnldESRFvF6l2j1ZaNIyrIjgE1N5Fyu4xHYDEp0GSC9jP/ZYdtZxvy7bfCTi0smC4yCS1BpLdRH4vgEJuB9Y2EfbxWf27yCl2YnSgDy/8H1QOPZ4YkSd8xvcGD240yHf5pB+t47TQeta13iK/9L3F3aGruNjjPP6EH4FeQA29ugDDf1s0IG66i5idE/IXNSJkEVxyfTsAAAAASUVORK5CYII=",Fe="/static/media/qa.svg",ve=()=>{var c;const{userImpact:t,sdgBadgeList:s}=d.useContext(w);let l;const i={"Questions Answered":Fe,"Programs Offered":V,"Hrs Of Mentorship":K,"Hrs Of Learning":K,"Programs Joined":ue,"Certificates Earned":V,"Cases Presented":Ue},r=a=>{l=i[a]||"default-image.svg"};return e.jsx(S,{radius:"md",withBorder:!0,my:"lg",variant:"compact",children:e.jsxs(m,{gap:"lg",p:"xs",children:[e.jsx(j,{messageId:"PUBLIC_PROGRAM_HEADING_IMPACT",order:2,fw:600}),(c=Object.keys(t))==null?void 0:c.map((a,o)=>(r(a),e.jsx(e.Fragment,{children:t[a]!==0&&e.jsxs($.Fragment,{children:[e.jsxs(E,{gap:"md",align:"center",children:[e.jsx(L,{bg:"primary.4",w:"54px",h:"54px",className:"tw-rounded-full",children:e.jsx(_,{w:"30px",h:"30px",src:l,alt:`Icon for ${a}`})}),e.jsxs(m,{gap:"5",flex:1,children:[e.jsx(j,{order:4,fw:600,children:t[a]}),e.jsx(j,{c:"neutral.8",order:6,fw:500,children:a})]})]}),e.jsxs(E,{gap:"md",align:"center",children:[e.jsx(L,{w:"54px",h:"12px",className:"tw-invisible"}),e.jsx(m,{gap:"5",flex:1,children:e.jsx(H,{})})]})]},o)}))),(s==null?void 0:s.length)>0&&e.jsxs(m,{gap:"lg",p:"xs",mt:"lg",children:[e.jsx(j,{messageId:"PUBLIC_PROGRAM_HEADING_SUSTAINABLE_DEVELOPMENT_GOAL",order:5,fw:700}),s.map((a,o)=>e.jsxs(E,{gap:"md",align:"center",children:[e.jsx(_,{w:"88px",h:"88px",src:a.badgeIcon+D.i512,alt:`Icon for ${a.badgeName}`}),e.jsx(j,{order:5,fw:500,children:a.badgeName})]},o))]})]})})},He=()=>{const{user:t,expanded:s,updateValue:l}=d.useContext(w),{description:i}=t||{},r=350,c=()=>{l(!s,"expanded")};function a(){return i?i.length>r&&!s?`${i.substring(0,r)}...`:i:""}if(i)return e.jsxs(m,{my:"md",gap:"md",children:[e.jsx(j,{messageId:"PUBLIC_PROGRAM_HEADING_OVERVIEW",order:2,fw:600}),e.jsxs(C,{children:[e.jsx(h,{c:"neutral.8",className:"tw-inline",children:a()}),i.length>r&&e.jsx(O,{messageId:s?"PUBLIC_PROFILE_READ_LESS":"PUBLIC_PROFILE_READ_MORE",variant:"transparent",m:"0",p:"0",mx:"5",h:"auto",className:"tw-inline",onClick:c})]})]})},Me="/static/media/Banner.png",ke=()=>{const{profileImage:t}=d.useContext(w);return e.jsxs(C,{pos:"relative",display:"inline-block",w:"100%",children:[e.jsx(_,{className:"mobile:tw-min-h-[7.8rem] ",src:Me,alt:""}),e.jsx(L,{pos:"absolute",w:"10rem",h:"10rem",bg:"neutral.0",mx:"lg",className:`mobile:tw-h-[10rem] mobile:tw-left-0 mobile:tw-top-13 tw-rounded-full tw-translate-y-[-50%] mobile:tw-w-[10rem]`,children:t?e.jsx(_,{p:"4px",fit:"cover",className:"tw-rounded-full tw-aspect-square",src:t+D.i256,alt:"User Profile image"}):e.jsx("i",{className:"fas fa-user tw-text-[10rem] tw-p-14 tw-text-neutral-80 mobile:tw-p-[2rem] mobile:tw-text-[7rem]"})}),e.jsx(_,{pos:"absolute",w:"110",h:"65",mx:"xl",right:0,className:"tw-hidden mobile:tw-block mobile:tw-top-20",src:Z,alt:"An image depicting the words 'Sustainable Development Goals' written in bold text."}),e.jsx(C,{pos:"absolute",top:"7rem",className:"tw-inset-x-2/3 tw-transform tw-translate-x-[-50%] tw-translate-y-[-50%] mobile:tw-hidden tw-flex tw-flex-wrap tw-items-end tw-flex-col tw-w-3/5 ",children:e.jsx("q",{className:"tw-text-5xl tw-ml-5 tw-text-white tw-left-14 tw-bottom-3 tw-text-right",children:e.jsx(ge,{id:"PUBLIC_PROFILE_HEADER"})})})]})},ze=()=>{var R;const{programList:t,isHub:s,isSpoke:l}=d.useContext(w),[i,r]=d.useState(!1),[c,a]=d.useState(3),o=()=>{r(!i),a(t==null?void 0:t.length)},g=()=>{r(!i),a(3)},N=()=>{let n="";return s?n="PUBLIC_PROFILE_PROGRAM_HEADING_PROGRAM_OFFERED":l&&(n="PUBLIC_PROFILE_PROGRAM_HEADING_PROGRAM_JOINED"),n};function M(n,b,p,x){return!!(b===3&&!p&&(x==null?void 0:x.length)<3&&n===(x==null?void 0:x.length)-1||b===3&&!p&&(x!=null&&x.slice(0,3))&&n===2||b!==3&&n===(x==null?void 0:x.length)-1&&p)}return e.jsxs(S,{radius:"md",withBorder:!0,my:"lg",variant:"compact",pb:"0",children:[e.jsxs(m,{gap:"xl",p:"xs",pb:"0",children:[e.jsx(j,{messageId:N(),order:2,fw:600}),e.jsx(m,{gap:"lg",children:(R=t==null?void 0:t.slice(0,c))==null?void 0:R.map((n,b)=>{var p,x;return e.jsxs(E,{gap:"lg",className:"mobile:tw-flex-col",children:[e.jsx(C,{children:e.jsx(_,{w:"140px",h:"70px",fit:"fill",className:"tw-aspect-square tw-rounded mobile:tw-h-[15rem] mobile:tw-mb-3 mobile:tw-w-full",src:n!=null&&n.logo?(n==null?void 0:n.logo)+D.i256:be,alt:n!=null&&n.logo?`Logo for Program ${n.name}`:"Default Program Banner"})}),e.jsxs(m,{flex:1,gap:"xs",children:[e.jsx(j,{c:"primary.8",className:"tw-break-word",order:6,fw:600,children:n==null?void 0:n.name}),e.jsxs(I,{gap:"xs",children:[n!=null&&n.organizationLogo?e.jsx(J,{size:30,src:(n==null?void 0:n.organizationLogo)+D.i64,alt:`Logo for organizationLogo ${n.organizationName}`}):e.jsx(J,{size:30,children:e.jsx("i",{className:"fa fa-buildings tw-p-5"})}),e.jsxs(h,{size:"xs",children:[n.organizationLogo&&e.jsx(h,{span:!0,messageId:"PUBLIC_PROFILE_ORGANIZATION_BY"}),"Â ",e.jsx(h,{span:!0,c:"primary.8",children:n==null?void 0:n.organizationName})]})]}),e.jsxs(E,{wrap:"wrap",gap:"xs",align:"center",className:"mobile:tw-items-center",children:[((p=n==null?void 0:n.focusAreas)==null?void 0:p.length)>3?e.jsxs(e.Fragment,{children:[n==null?void 0:n.focusAreas.slice(0,2).map(u=>e.jsx(f,{maw:"100%",children:u==null?void 0:u.name},u==null?void 0:u.focusAreaId)),e.jsx(f,{maw:"100%",children:`+ ${((x=n==null?void 0:n.focusAreas)==null?void 0:x.length)-2}`})]}):n==null?void 0:n.focusAreas.map(u=>e.jsx(f,{maw:"100%",children:u==null?void 0:u.name},u==null?void 0:u.focusAreaId)),(n==null?void 0:n.isCertificationProgram)&&e.jsx(L,{bg:"neutral.8",c:"neutral.0",w:"25",h:"25",className:"tw-rounded-full",children:e.jsx("i",{className:"fal fa-award fa-1x"})})]}),M(b,c,i,t)?e.jsx(e.Fragment,{}):e.jsx(H,{mt:"sm"})]})]},b)})})]}),e.jsx(H,{mt:"xl"}),!i&&(t==null?void 0:t.length)>3&&e.jsx(O,{fullWidth:!0,size:"md",messageId:"MANAGE_PROGRAM_BUTTON_VIEW_ALL",onClick:o,variant:"transparent"}),i&&(t==null?void 0:t.length)>3&&e.jsx(O,{messageId:"PUBLIC_PROFILE_VIEW_LESS_BUTTON",fullWidth:!0,size:"md",onClick:g,variant:"transparent"})]})},We=()=>{const{user:t}=d.useContext(w),{linkedinLink:s,twitterLink:l,websiteLink:i}=t||{};if(!(!s.trim()&&!l.trim()&&!i.trim()))return e.jsxs(m,{my:"md",gap:"md",children:[e.jsx(j,{messageId:"PUBLIC_PROGRAM_HEADING_SOCIAL_MEDIA",order:2,fw:600}),e.jsxs(I,{gap:"md",children:[s.trim().length>0&&e.jsx(v,{link:s,text:"LinkedIn Link",icon:"fa-brands fa-linkedin"}),l.trim().length>0&&e.jsx(v,{link:l,text:"Twitter Link",icon:"fa-brands fa-square-x-twitter"}),i.trim().length>0&&e.jsx(v,{link:i,text:"Website Link",icon:"fa-light fa-globe"})]})]})},v=({link:t,icon:s,text:l})=>{function i(r){return!r.startsWith("https://")&&!r.startsWith("http://")?`https://${r}`:r.startsWith("http://")?`https://${r.substring(7)}`:r}return e.jsx(pe,{href:i(t),children:e.jsx(L,{bg:"neutral.4",h:"40px",w:"40px",className:"tw-rounded-md",children:e.jsxs(h,{size:"xl",children:[e.jsx("i",{className:s}),e.jsx(oe,{children:l})]})})})},Je=()=>{const{secondarySpeakingLanguages:t}=d.useContext(w);return e.jsx(S,{radius:"md",withBorder:!0,my:"lg",variant:"compact",children:e.jsxs(m,{gap:"lg",p:"xs",children:[e.jsx(j,{messageId:"PUBLIC_PROGRAM_HEADING_LANGUAGE_SPEAK",order:2,fw:600}),e.jsx(I,{gap:"sm",wrap:"wrap",children:t.map((s,l)=>e.jsx(f,{maw:"100%",children:s==null?void 0:s.name},l))})]})})},w=$.createContext({}),Xe=()=>{var W;const[{data:t,error:s,isLoading:l,expanded:i,isEdit:r,badgeData:c},a]=d.useReducer(Ae,{data:{},error:"",isLoading:!1,expanded:!1,isEdit:!1,badgeData:{},badgeError:""}),{updateValue:o}=Re({},a),{userId:g}=de(),N=window.location.href,R=Ee()[0].authenticated;d.useEffect(()=>{g&&(X(g,x),ee(g),u(),o(!0,"isLoading"))},[g]);const b=(B=>{const A=B.split("/");return A[A.length-1]})(N),p=localStorage.getItem("user_id"),x=p===b?"SELF":"OTHER",u=()=>{o(b===p,"isEdit")},X=async(B,A)=>{const P=await _e(B,A);if(o(!0,"isLoading"),P.ok||(o(P.error.message,"error"),o(!1,"isLoading")),P.ok){const{result:le}=P;o(le,"data"),o(!1,"isLoading")}else o(P.error.message,"error")},ee=async B=>{const A=await he(B);if(A.ok||o(A.error.message,"error"),A.ok){const{result:P}=A;o(P.resultBody,"badgeData")}else o(!0,"badgeError")},{sdgBadgeList:se,badgeList:y}=c||{},{isHub:te,user:G,userImpact:k,programList:T,isSpoke:ne}=(t==null?void 0:t.resultBody)||{},{profileImage:ie,secondarySpeakingLanguages:U,focusAreas:F,firstName:z="",lastName:ae=""}=G||{};return xe(`${z} ${ae} ${z?"| iECHO":""}`),l?e.jsx(Pe,{}):s?e.jsx(Ce,{message:s}):e.jsxs(C,{className:"tw-box-border",children:[!R&&e.jsx("div",{className:"tw-mt-5 tw-mb-3",children:e.jsx(me,{className:"tw-mt-5",to:"/home",children:e.jsx(Ne,{})})}),e.jsxs(w.Provider,{value:{profileImage:ie,user:G,expanded:i,isHub:te,userId:g,updateValue:o,isEdit:r,secondarySpeakingLanguages:U,userImpact:k,data:t,programList:T,isSpoke:ne,sdgBadgeList:se,badgeList:y,isAuthenticated:R},children:[e.jsx(ke,{}),e.jsx(Se,{}),e.jsxs(E,{justify:"space-between",wrap:"wrap",mx:"lg",children:[e.jsxs(m,{flex:.5,className:"mobile:tw-max-w-full mobile:tw-flex-1 mobile:tw-min-w-fit mobile:tw-w-full",children:[G&&e.jsx(He,{}),G&&e.jsx(We,{}),(T==null?void 0:T.length)>0&&e.jsx(ze,{}),(F==null?void 0:F.length)>0&&e.jsx(Te,{})]}),e.jsxs(C,{flex:.4,className:"mobile:tw-top-0 mobile:tw-static mobile:tw-m-0 mobile:tw-min-w-fit mobile:tw-w-full",children:[((W=Object.keys(k||{}))==null?void 0:W.length)>0&&e.jsx(ve,{}),(y==null?void 0:y.length)>0&&e.jsx(Ge,{}),(U==null?void 0:U.length)>0&&e.jsx(Je,{})]})]})]})]})};export{w as PublicProfileContext,Xe as default};