@apolitical/component-library 8.7.6-RR.2 → 8.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +2 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -567,6 +567,6 @@ and limitations under the License.
|
|
|
567
567
|
.Toastify__toast-body {
|
|
568
568
|
padding: 0px;
|
|
569
569
|
}
|
|
570
|
-
`]))),wre={storeData:{},unseenCount:0,hasNext:!1,initialLoading:!1,fetchMoreLoading:!1};y.createContext({notificationsData:wre});function Are(e){var t=e.workspaceKey,n=t===void 0?"":t,r=e.tenantId,i=r===void 0?"":r,a=e.distinctId,s=a===void 0?"":a,o=e.subscriberId,l=o===void 0?"":o,u=e.inboxId,c=u===void 0?"":u,d=e.stores,f=e.toastProps,p=e.notificationClickHandler,g=e.primaryActionClickHandler,m=e.secondaryActionClickHandler,E=e.bellComponent,v=e.badgeComponent,b=e.notificationComponent,T=e.noNotificationsComponent,C=e.loaderComponent,_=e.tabBadgeComponent,w=e.headerRightComponent,S=e.hideAvatar,F=S===void 0?!1:S,R=e.hideInbox,L=e.hideToast,P=e.theme,N=e.themeType,k=N===void 0?"light":N,B=e.pagination,H=B===void 0?!0:B,q=e.pageSize,I=e.popperPosition,Q=I===void 0?"bottom":I,J=e.showUnreadCountOnTabs,O=J===void 0?!0:J,x=e.host;c&&(l=c);var Z=y.useState(!1),M=Z[0],j=Z[1],z=y.useState(),U=z[0],$=z[1],ae=y.useState({storeData:{},count:0}),Y=ae[0],ee=ae[1],se=y.useState(""),re=se[0],xe=se[1],ke=y.useState(!1),Te=ke[0],ue=ke[1];y.useEffect(function(){var we=new dB(n,{pageSize:q,tenantID:i,stores:d,host:x});return $(we),we.emitter.on("sync_notif_store",function(){var Pe=we.feed.data;ee({storeData:(Pe==null?void 0:Pe.stores)||{},count:(Pe==null?void 0:Pe.unseenCount)||0,hasNext:Pe==null?void 0:Pe.hasNext,initialLoading:Pe==null?void 0:Pe.initialLoading,activeStoreId:Pe==null?void 0:Pe.activeStoreId}),xe(Pe==null?void 0:Pe.activeStoreId)}),we.emitter.on("new_notification",function(Pe){Cre({notificationsData:Pe,toastProps:f})}),function(){we.emitter.all.clear()}},[]),y.useEffect(function(){M&&l&&U&&U.feed.markAllSeen()},[M,l,U]),y.useEffect(function(){if(!(!l||!U))return ee({storeData:{},count:0}),U.identifyUser(s,l),U.feed.fetchNotifications(),function(){U.resetUser()}},[l,U]);var fe=k==="dark"?C3(ine,P):P||{};return y.createElement(T3.Provider,{value:fe},y.createElement(b3.Provider,{value:{workspaceKey:n,notificationsData:Y,setNotificationsData:ee,notificationClickHandler:p,primaryActionClickHandler:g,secondaryActionClickHandler:m,bellComponent:E,badgeComponent:v,notificationComponent:b,noNotificationsComponent:T,tabBadgeComponent:_,headerRightComponent:w,toggleInbox:j,inbox:U,loaderComponent:C,pagination:H,hideAvatar:F,activeStore:re,setActiveStore:xe,changingActiveStore:Te,setChangingActiveStore:ue,showUnreadCountOnTabs:O,themeType:k}},!R&&y.createElement(hre,{openInbox:M,toggleInbox:j,popperPosition:Q}),!L&&y.createElement(_re,f)))}const bt={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===Mn.ACCOUNT&&t===!1&&n[Mn.SITE]===!0)return;const a=Date.now();if(!i&&!t&&bt.handlerCalled[e]&&a-bt.handlerCalled[e]<500)return;bt.handlerCalled[e]=a;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case Mn.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Mn.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Mn.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=Vy(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?bt.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case Mn.SITE:if(n){const u=bt.findFirstChild(t.current.children,"className","has-submenu parent"),c=bt.findFirstChild(u.children,"id",Mn.SITE);s=bt.findFirstChild(c.children,"href")}else s=bt.findFirstChild(t.current.children,"href");break;case Mn.ACCOUNT:if(o=bt.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=bt.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(bt.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(bt.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(bt.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{bt.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}},readLocaleFromCookie:()=>{if(!document||!document.cookie||!document.cookie.length)return null;const e=document.cookie.match(new RegExp("(^|;\\s*)apolitical_locale=([^;]*)"));return e?decodeURIComponent(e[2]):null}},ks={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},topics:{onlyShow:"logged-in",order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["cities-and-local-government","digital-and-data","education","climate","health-and-social-care","equity-justice-and-inclusion","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Kc=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null,getHref:s})=>{const o=de.useIntl(),l=Vy(ks,e);if(!l||l.onlyShow&&(l.onlyShow==="logged-in"&&!t||l.onlyShow==="logged-out"&&t))return null;const u="doTrack"in l,c=a===null?u?l.doTrack:!0:a,d=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;l.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(l.href){let C=l.gtmType||`${e}-click`;if(C.includes(".")){const _=C.split("."),w=_[_.length-2];C=`${w==="topics"?`${w}-`:""}${_[_.length-1]}`}p={href:s?s(l.href):l.withReturnTo?`${l.href}?returnTo=${window.location.pathname+window.location.search}`:l.href},c&&(p={...p,className:"gtm-trackable","data-gtm-event-type":C,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...l.props||{}})}const g=l.order&&l.order[0]&&l[l.order[0]],m=g&&l[l.order[0]].order,E=p&&window.location.pathname===l.href;let v={},b={},T={};if(E&&(v={...v,"aria-current":"page"}),g){const C=l.menuId||e,_={onClick:w=>bt.events.onClick(w,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>bt.events.onFocus({id:C}),onBlur:()=>bt.events.onBlur({id:C,callback:i}),onMouseLeave:()=>bt.events.onBlur({id:C,callback:i}),onMouseEnter:()=>bt.events.onMouseEnter({id:C,callback:i})};b={..._,id:C===Mn.SITE?Mn.SITE:Mn.ACCOUNT},n&&(m&&(T={..._,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&bt.events.onClick(w,{id:C,callback:i,isOpen:r[C]})},"aria-haspopup":!0,"aria-expanded":r[C],"aria-controls":C}),b={...b,hidden:C in r?!r[C]:!0}),m||(b={...b})}return h.jsxs("li",{className:te({[l.className]:l.className,"has-submenu":g,parent:m,active:E}),...v,children:[p?y.createElement(d?Me:"a",p,o.formatMessage({id:f})):n&&l.order&&m?h.jsxs("button",{...T,children:[o.formatMessage({id:f}),h.jsx(ot,{children:o.formatMessage({id:`header_menu_${r[Mn.SITE]?"hide":"show"}`})})]}):o.formatMessage({id:f}),l.order&&h.jsx("ul",{...b,children:l.order.map(C=>{if(!l[C])return null;const _={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:u?c:null};return l[C].order?h.jsxs("li",{className:te({[l[C].className]:l[C].className}),children:[o.formatMessage({id:`${f}_${C}`}),h.jsx("ul",{children:l[C].order.map(w=>h.jsx(Kc,{id:`${e}.${C}.${w}`,..._},w))})]},C):h.jsx(Kc,{id:`${e}.${C}`,..._},C)})})]},e)};const Sre=({headerIsVisible:e,locale:t})=>{const n=de.useIntl();return h.jsx("div",{id:"language-unavailable-message",className:te({visible:e}),children:h.jsx("p",{className:"text",children:n.formatMessage({id:`header_language_unavailable_${t}`},{link:r=>h.jsx("a",{href:"/pages/multilingual-transition",children:r})})})})},kre={colors:{primary:"#4F43BA",primaryHover:"#7C72E1",error:"#C34141",icon:"#000000",text:{primary:"#151921",secondary:"#64748B"},background:{primary:"#FFFFFF",hover:"#F8FAFC"},border:"#E2E8F0"},typography:{fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"24px"},fontWeights:{medium:"medium",bold:"bold"}},spacing:{xs:"8px",sm:"12px",md:"16px"},borderRadius:{sm:"8px",md:"12px",full:"9999px"},shadows:{sm:"0px 4px 6px rgba(0, 0, 0, 0.1)"},circleSizes:{avatar:"40px",dot:"10px"}},{colors:{primary:Do,primaryHover:Dre,error:$y,text:oi,background:li,border:Yf,icon:Ore},typography:{fontSizes:ui,fontWeights:ma},spacing:ga,borderRadius:zu,shadows:jy,circleSizes:Hy}=kre,Nre={bell:{color:Ore},badge:{backgroundColor:$y,color:li.primary},header:{container:{backgroundColor:li.primary,borderBottom:`1px solid ${Yf}`},headerText:{color:oi.primary,fontSize:ui.lg,fontWeight:ma.bold},markAllReadText:{color:Do,fontWeight:ma.medium,fontSize:ui.sm}},notificationsContainer:{container:{borderRadius:zu.md,overflow:"auto",backgroundColor:li.primary,boxShadow:jy.sm,border:"none"},loader:{color:Do},noNotificationsText:{color:oi.primary,fontSize:ui.md,fontWeight:ma.medium},noNotificationsSubtext:{color:oi.secondary,fontSize:ui.sm}},notification:{unseenDot:{backgroundColor:$y,width:Hy.dot,height:Hy.dot,right:ga.md,top:ga.md},container:{unreadBackgroundColor:li.primary,readBackgroundColor:li.primary,hoverBackgroundColor:li.hover,borderBottom:`1px solid ${Yf}`,padding:ga.md},headerText:{color:oi.primary,fontSize:ui.md,fontWeight:ma.medium},bodyText:{color:oi.primary,fontSize:ui.md},subtext:{color:oi.secondary,fontSize:ui.sm},actions:[{container:{backgroundColor:Do,color:li.primary,borderRadius:zu.full,padding:`${ga.xs} ${ga.md}`,fontSize:ui.sm,fontWeight:ma.medium,hoverBackgroundColor:Dre}},{container:{borderColor:Do,color:oi.secondary,backgroundColor:li.primary,borderRadius:zu.full,padding:`${ga.xs} ${ga.md}`,fontSize:ui.sm,fontWeight:ma.medium},text:{color:Do}}]},toast:{container:{backgroundColor:li.primary,borderRadius:zu.sm,boxShadow:jy.sm,border:`1px solid ${Yf}`},headerText:{color:oi.primary,fontWeight:ma.medium},bodyText:{color:oi.secondary}}};const Zf={height:67,height_desktop:83,additional_message_height:40};var Mn=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Mn||{});const T0=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!0,showLanguageSwitcher:n=!0,onLanguageSwitcherClick:r,suprSendWorkspaceKey:i})=>{var q,I;const a=de.useIntl(),s=y.useContext(Mt),o=Qc();o&&(ks.home.href=o);const l=Yi(!0,!0),u=s&&typeof s.id=="string",c=y.useMemo(()=>bt.getIsDesktopVersion(u,l),[u,l]),d=U0("suprsend-notifications")&&i,f=(I=(q=s==null?void 0:s.externalsMetadata)==null?void 0:q.suprsend)==null?void 0:I.subscriberId,p=t&&!u,g=U0("language-switcher")&&n&&p,[m,E]=y.useState(!1);y.useEffect(()=>{let Q=null;try{Q=bt.readLocaleFromCookie()}catch{Q=null}t&&g&&(Q!==null&&Q!==Is)&&E(!0)},[t,g,s]);const[v,b]=y.useReducer(zs,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:T,menus:C,focusElements:_}=v,w=y.useRef(v);y.useEffect(()=>{w.current=v},[v]),Jy({scrollPosition:m?Zf[`height${c.navigation?"_desktop":""}`]+Zf.additional_message_height:Zf[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const Q=w.current.menus;!c&&Q["site-navigation"]||bt.shouldChangeHeaderIsVisible(!0,Q,b)},scrollDown:()=>{const Q=w.current.menus;!c&&Q["site-navigation"]||bt.shouldChangeHeaderIsVisible(!1,Q,b)}}});const S=(Q,J,O=!1)=>{bt.handleMenus({id:Q,value:J,menus:w.current.menus,dispatch:b,forceHandle:O})},F=y.useRef(null),R=Q=>{Q.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(J=>{w.current.menus[J]&&S(J,!1,!0)})};y.useEffect(()=>{var Q;return(Q=document.getElementById("header"))==null||Q.addEventListener("keydown",R),()=>{var J;(J=document.getElementById("header"))==null||J.removeEventListener("keydown",R)}},[]),Ds(()=>{C["site-navigation"]&&bt.autoFocus({menu:"site-navigation",navigationRef:F,isDesktopVersion:c.navigation,focusElements:_,dispatch:b})},[C["site-navigation"]]),Ds(()=>{C["account-navigation"]&&bt.autoFocus({menu:"account-navigation",navigationRef:F,isDesktopVersion:c.navigation,focusElements:_,dispatch:b})},[C["account-navigation"]]);const L=u&&h.jsxs(h.Fragment,{children:[!c.search&&h.jsx("button",{className:"search toggle-search-button",onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),S("search",!C.search)},children:h.jsx(ot,{children:a.formatMessage({id:`header_search_${C.search?"hide":"show"}`})})}),h.jsx(LT,{id:"global-search",handleToggle:{searchIsOpen:C.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),P=h.jsx("button",{className:"language icon language-switcher-button","aria-label":"Language switcher",onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),r?r():E(!m)},children:h.jsx(ot,{children:a.formatMessage({id:"header_language_switcher"})})}),N=[d&&f&&h.jsx("div",{id:"suprsend-notifications",children:h.jsx(Are,{workspaceKey:i,distinctId:(s==null?void 0:s.id)??"",subscriberId:f,theme:Nre,bellComponent:()=>h.jsx("button",{className:"bell icon bell-button"})})})],k=h.jsxs(h.Fragment,{children:[!c.navigation&&h.jsx("button",{className:"menu-button gtm-trackable",onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),S("site-navigation",!C["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":C["site-navigation"],"aria-controls":"site-navigation",children:h.jsx(ot,{children:a.formatMessage({id:`header_menu_${C["site-navigation"]?"hide":"show"}`})})}),h.jsx("ul",{ref:F,id:"navigation",hidden:c.navigation||C["account-navigation"]?!1:!C["site-navigation"],"data-showing":!c.navigation&&C["account-navigation"]?"account":"default",children:ks.order.map(Q=>h.jsx(Kc,{id:Q,isLoggedIn:u,isDesktopVersion:c.navigation,menus:{"site-navigation":C["site-navigation"],"account-navigation":C["account-navigation"]},callback:S},Q))})]}),B=window.location.pathname.match(new RegExp("(courses/[^/]+/[^/]+|microcourses/[^/]+/[^/]+)")),H=Q=>{var U;const[J,O]=Q.split("?"),x=new URLSearchParams(O||""),M=new URLSearchParams(window.location.search).get("ref");if(x.set("ref",M||"course-overview"),window.location.pathname){const $=window.location.pathname.match(new RegExp("(courses/([^/]+)/([^/]+)|microcourses/[^/]+/([^/]+))"));if($){const[,,ae,Y,ee]=$;ee?x.set("courseSlug",ee):(x.set("courseSlug",ae),x.set("journeySlug",Y)),x.set("signupRedirectUrl",window.location.pathname+(window.location.search||""))}}const j=((U=window.location.pathname.match(/^\/([^/]+)\/courses/))==null?void 0:U[1])||"";return`${j?`/${j}`:""}${J}?${x.toString()}`};return s&&s.isLoading?null:h.jsxs(h.Fragment,{children:[h.jsxs("nav",{id:"header",className:te({"logged-in":u,"logged-out":!u,visible:T}),children:[h.jsx(ot,{element:"a",href:"#content-of-page",children:a.formatMessage({id:"header_skip"})}),h.jsx(dm,{variant:"monochrome"}),e?h.jsxs(h.Fragment,{children:[c.navigation?h.jsxs(h.Fragment,{children:[k,L,g&&P,N]}):h.jsxs(h.Fragment,{children:[L,g&&P,N,k]}),u?h.jsxs("button",{className:"account-button",onClick:Q=>bt.events.onClick(Q,{id:"account-navigation",callback:S,isOpen:C["account-navigation"]}),onMouseEnter:()=>bt.events.onMouseEnter({id:"account-navigation",callback:S}),onMouseLeave:()=>bt.events.onBlur({id:"account-navigation",callback:S}),"aria-haspopup":"true","aria-expanded":C["account-navigation"],"aria-controls":"account-navigation",children:[h.jsx(ot,{children:a.formatMessage({id:`header_account_${C["account-navigation"]?"hide":"show"}`})}),h.jsx(bi,{name:s&&s.name||"",src:s&&s.image&&s.image.thumbnail||""})]}):h.jsx("ul",{className:"sign-in-buttons",children:ks.buttons.order.map(Q=>h.jsx(Kc,{id:`buttons.${Q}`,getHref:Q==="signup"&&B?H:void 0},Q))})]}):g&&P]}),m&&h.jsx(Sre,{headerIsVisible:T,locale:(s==null?void 0:s.locale)||Is}),h.jsx("hr",{id:"content-of-page"}),h.jsx("div",{className:te("overlay",{open:C["site-navigation"]||C["account-navigation"]||!c.search&&C.search})})]})};const Ire=()=>{const e=de.useIntl();return h.jsxs(h.Fragment,{children:[h.jsx(T0,{}),h.jsx("div",{id:"content",children:h.jsx(Wr,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),h.jsx(fm,{})]})},S3=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en",suprSendWorkspaceKey:l})=>{const u=de.useIntl(),{navigation:c=!0,footer:d=!0}=i,{background:f="default",variant:p="default",circle:g="default",modal:m="default"}=a,E=Qy(),[v,b]=y.useState(""),T=F=>{const{detail:{message:R}}=F;b(R)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",T),()=>{document.removeEventListener("ariaLive",T)}),[E]);const C=Gu(e,{locale:o}),_=Gu(t,{locale:o}),w=Gu(n,{locale:o}),S={};return f!=="default"&&(S[f]=!0),p!=="default"&&(S[p]=!0),g!=="default"&&(S[g]=!0),h.jsx(Q3.ErrorBoundary,{onError:r,fallback:h.jsx(Ire,{}),children:h.jsxs(y.Suspense,{fallback:null,children:[h.jsxs("div",{id:"wrapper",className:te(s,S,{"has-footer":d}),"data-too-small":u.formatMessage({id:"pageLayout_browserTooSmall"}),children:[h.jsx(T0,{suprSendWorkspaceKey:l,showNavigation:c}),h.jsxs("main",{id:"content-wrapper",children:[_&&h.jsx("div",{className:te("additional-content prepended",{"large-modal":m==="large"}),children:_}),y.createElement(f==="bold"?Cp:"div",{id:"content",children:C,className:te({"large-modal":m==="large"})})]}),w&&h.jsx("div",{className:"additional-content appended",children:w}),d&&h.jsx(fm,{}),h.jsx(YT,{})]}),v&&h.jsx(ot,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:v})]})})},Uy={default:"tags_",headerTopics:"header_topics_topics_"},Qf={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},Pre={getTagDetails:e=>{if(e.includes("topic_")){if(e=Qf.topic[e.replace("topic_","")],e){const t=ks.topics.topics[e].href;return t?{id:e,href:t,text:`${Uy.headerTopics}${e}`}:null}return null}return Qf[e]?(e=Qf[e],{id:e,text:`${Uy.default}${e}`}):null}};const Rre=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=de.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Pre.getTagDetails(u);c&&l.push(c)}),l.length<1?null:h.jsx("ul",{className:te("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return h.jsx("li",{children:u.href&&r?h.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":s,children:c}):c},u.id)})})};const k3=25,Fre=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:c=!1,className:d=""})=>{const f=de.useIntl(),p="membersList",g=y.useContext(Mt),[m,E]=y.useState(!1);return e.length===0&&!c?null:h.jsxs("div",{className:te("members-list",d),children:[u?h.jsxs("h1",{children:[f.formatMessage({id:p}),h.jsx("span",{className:"count",children:t})]}):h.jsx(h.Fragment,{}),h.jsxs("ul",{children:[r?h.jsxs("li",{children:[h.jsx(pi,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:un.Communities,area:n||""},{scope:un.Platform,area:"all"}]}}),h.jsx(Xi,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),E(!0)},children:f.formatMessage({id:`${p}_profile`})})]}):h.jsx(h.Fragment,{}),e.map((v,b)=>g&&v.id===g.id?h.jsx(h.Fragment,{}):h.jsxs("li",{children:[h.jsx(pi,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:un.Communities,area:n||""},{scope:un.Platform,area:"all"}]}}),v.isAdmin&&h.jsx($r,{children:f.formatMessage({id:`${p}_admin`})})]},b)),c&&e.length===0&&t>0?[...new Array(Math.min(t,k3))].map((v,b)=>h.jsx("li",{children:h.jsx(t1,{layout:"member"})},b)):h.jsx(h.Fragment,{})]}),i&&h.jsx(wl,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:f.formatMessage({id:"loadMore_button"}),error:f.formatMessage({id:"loadMore_error"})},gtmContext:o}),s?h.jsx(H1,{form:s,showModal:m,content:{title:f.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{E(!1)}}}):h.jsx(h.Fragment,{})]})},D3=Fre,Bre=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=de.useIntl();return t?h.jsx("small",{children:vr(i.formatMessage,`${e}explainer`,n,"action",{a:a=>h.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:a})})}):h.jsx(h.Fragment,{})},Mre=({intlPath:e,type:t,...n})=>{const r=de.useIntl();return h.jsx(Pc,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:vr(r.formatMessage,`${e}label_action`,t,"action")},...n})},zy=5,qy=2,Lre=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};const Ft="discussion_form_",Ll=({id:e,parentId:t,content:n={type:Ge.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:c={},gtmContext:d="DiscussionForm"})=>{var ie,pe,Ne;const f=de.useIntl(),p=y.useContext(Mt),[g,m]=y.useState(n.type),[E,v]=y.useState(""),{isLoading:b=!1,isInWrapper:T=!1,isInOverlay:C=!1,isAutoFocused:_=!1,isEditing:w=!1,hasTitleField:S=!1,canBePrepopulated:F=!1,isPrepopulated:R=!1,showTitle:L=!1,showGuidelines:P=!0,showDivider:N=!1,showSuccessMessage:k=!0,showPostType:B=!1,postCategories:H=[]}=i||{},{onChange:q=()=>{},create:I=()=>{},createPoll:Q=()=>Promise,handleSaveEdit:J=()=>{},handleCancel:O=()=>{},callback:x=()=>{},onMention:Z=()=>{},listMembers:M=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:z=()=>Promise.resolve({}),props:U={create:{projectNames:["questions-answers"]}}}=u,[$,ae]=y.useState({body:w&&w.text||R&&R.text||"",data:c!=null&&c.link?{link:c==null?void 0:c.link}:{}}),[Y,ee]=y.useState(l.error||!1),se={status:!1,title:S&&S.text||"",polls:0},[re,xe]=y.useState(se);y.useEffect(()=>{F&&!w&&R&&R!==$.body&&ae(me=>({...me,body:R.text||""}))},[R]),y.useEffect(()=>{m(n.type)},[n.type]);const ke=al((me,X)=>{ae(ge=>({...ge,body:me,data:{link:X}})),q({body:me});let _e;!p||!p.id?_e=vr(f.formatMessage,`${Ft}error_loggedOut`,g,"action"):r?s>0&&me.length>=s&&(_e=`${Ft}error_tooLong`):_e=vr(f.formatMessage,`${Ft}error_noPermission`,g,"action"),_e?ee(_e):Y&&ee(!1)},50);let Te=`${g}-form`;if(g===Ge.Response||g===Ge.Reply){const me=((ie=n.slugs)==null?void 0:ie.reply)||((pe=n.slugs)==null?void 0:pe.answer)||((Ne=n.slugs)==null?void 0:Ne.question)||"";me&&(Te=`${Te}-${me.slice(-15)}`)}e&&(Te=`${e}-${Te}`);const ue=async me=>{if(!p||!p.id||!r||ct)throw new Error("You do not have permission to post.");xe(_e=>({..._e,status:"submitting"}));const X=window.location.pathname;try{let _e;switch(g){case Ge.Post:_e=await I({title:me.title,content:me.body,categories:me.postType,data:me.data});break;case Ge.Poll:_e=await Q(Lre(me));break;case Ge.Question:_e=await I({title:me.body,authorId:p&&p.id,data:me.data,...U==null?void 0:U.create});break;case Ge.Response:_e=await I({questionSlug:n.slugs.question},{body:me.body,authorId:p&&p.id,contentPath:X,data:me.data});break;case Ge.Reply:_e=await I({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:me.body,authorId:p&&p.id,contentPath:X,data:me.data});break;default:break}await B0(1e3),x&&await x(_e),ae({body:"",data:{}}),m(n.type),xe(De=>({...De,status:"submitted"})),v(vr(f.formatMessage,`${Ft}success`,g,"action"));const ge=new Event(Yt.DISCUSSION_FORM_SUBMITTED);return document.dispatchEvent(ge),await fe(),_e}catch(_e){const ge=_e;let De=`${Ft}error`;ge!=null&&ge.message.includes("entry already exists")&&(De=vr(f.formatMessage,`${Ft}error_alreadyExists`,g,"action")),ge!=null&&ge.message.includes("429")?De=vr(f.formatMessage,`${Ft}error_tooMany`,g,"action"):ge!=null&&ge.message.includes("400")&&(De=`${Ft}error`),ee(De),await fe()}},fe=async()=>{await B0(5e3),ee(!1),xe(se),v("")},we=al(async me=>{const X={...$,...me};if(w){xe(_e=>({..._e,status:"submitting"})),J(X);return}try{if(!await ue(X))throw Error("No response from handleSubmit")}catch{}},100);if(b)return h.jsx(sr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Pe=!$.body||!ol($.body),Xe=!re.title||!ol(re.title);let ct=!1;g!==Ge.Poll&&(ct=Pe),S&&(ct=ct&&Xe);const Ve=re.status==="submitting",Je=[];g===Ge.Poll?Je.push({id:"poll-options",label:f.formatMessage({id:`${Ft}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:f.formatMessage({id:`${Ft}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:qy,maxInputs:zy,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:f.formatMessage({id:`${Ft}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:me=>{var _e;let X=0;me&&Array.isArray(me)&&(X=((_e=me==null?void 0:me.filter(ge=>ge!==""))==null?void 0:_e.length)||0),re.polls!==X&&xe(ge=>({...ge,polls:X})),q({polls:me})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:f.formatMessage({id:`${Ft}multiplePollAnswers`}),className:"text-medium"}):Je.push({component:Mre,props:{formID:Te,intlPath:Ft,showLabel:S!==!1,type:g}},{component:um,props:{id:`${Te}-input`,value:re.status==="submitting"&&!Y?"":$.body,placeholder:a||vr(f.formatMessage,`${Ft}placeholder`,g,"action"),maxLength:s,meta:{isInOverlay:C},functions:{onChange:ke,onChangeData:me=>{ae(X=>({...X,data:me}))},onMention:Z,listMembers:M,clickMentionFallback:j,getLinkPreview:z},data:c,autoFocus:w!==!1||_&&!S,"aria-invalid":!!Y,"aria-errormessage":"error-message"}},{component:Bre,props:{intlPath:Ft,showGuidelines:P,type:g,gtmContext:d}}),N&&Je.push({component:Tr}),S&&Je.unshift({id:"title",type:"textarea",value:S.text,limit:250,label:f.formatMessage({id:`${Ft}${g===Ge.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:f.formatMessage({id:`${Ft}${g===Ge.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:me=>{xe(X=>({...X,title:me})),q({title:me})}},validation:g===Ge.Poll?[{condition:"required"}]:[]}),B&&Je.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:f.formatMessage({id:`${Ft}postType_label`}),options:H.map(me=>({id:me.slug,label:me.name})),validation:[{condition:"required"}],functions:{onChange:me=>{q({postType:me}),me.includes(Ge.Poll)?m(Ge.Poll):g!==Ge.Post&&m(Ge.Post)}}});let Ke=!p||!p.id||!r||Ve;if(g===Ge.Poll){const me=re.polls;Ke=Ke||Xe||me<qy||me>zy}else Ke=Ke||ct,w&&(S?Ke=Ke||$.body===w.text&&re.title===S.text:Ke=Ke||$.body===w.text);return h.jsxs(h.Fragment,{children:[h.jsxs(Cr,{id:Te,className:te("discussion-card discussion-form",{"no-styling":T&&w}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:w&&!Ve||l.cancel},functions:{onSuccess:async me=>{await we(me)},onCancel:O},fields:Je,intlPath:Ft,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`${w?"save":"submit"}-${g}-click`,"data-testid":"save-button",disabled:Ke,text:{default:!w&&(o!=null&&o.submit)?o==null?void 0:o.submit:f.formatMessage({id:`${Ft}${w?"save":"post"}`}),submitting:f.formatMessage({id:`${Ft}${w?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`cancel-${g}-click`,disabled:!l.cancel&&(!p||!p.id||!$.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:f.formatMessage({id:`${Ft}cancel`})},gtm:{context:d,event:`${g}-form`},"data-testid":`discussion-${g}-form`,children:[L&&!w&&g===Ge.Question&&h.jsx("h2",{children:vr(f.formatMessage,`${Ft}title`,g,"action")}),h.jsx(pi,{member:p?{...p,link:!1}:"community",gtmContext:d,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:un.Communities,area:t||""},{scope:un.Platform,area:"all"}]}})]}),re.status==="submitted"&&k&&h.jsx(Os,{className:"success","data-testid":"success",children:vr(f.formatMessage,`${Ft}success`,g,"action")}),Y&&h.jsx(Os,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Y=="string"?Y.includes(" ")?Y:f.formatMessage({id:Y},{action:f.formatMessage({id:`discussion_action_${g}`}),maxLength:s}):Y}),E&&h.jsx(ot,{"aria-live":"polite",showOnFocus:!1,children:E})]})},$re=Object.freeze(Object.defineProperty({__proto__:null,default:Ll},Symbol.toStringTag,{value:"Module"}));function O3(e,t){let n=t;const r=e.matchAll(Da),i=e.matchAll(/\[([^\]]+)\]\(([^)]+)\)/g);for(const a of[r,i])for(const s of a)if(s.index!==void 0){if(s.index>=n)break;if(s.index+s[0].length<=n)continue;n=s.index}return e.length>n?e.slice(0,n).trim()+"…":e}const N3=280,jre=(e,t,n)=>{let r=t?O3(e,typeof t=="number"?t:N3):e;return r=r.trim(),r=r.replaceAll(Da,(i,a)=>{var s,o;return`[@${((o=(s=n==null?void 0:n[a])==null?void 0:s.data)==null?void 0:o.name)||a}](/profiles/${a})`}),r},_0=async(e,t,n,r=()=>Promise.resolve([]))=>{let i=t?O3(e,typeof t=="number"?t:N3):e;i=i.trim();const a=`<br>
|
|
570
|
+
`]))),wre={storeData:{},unseenCount:0,hasNext:!1,initialLoading:!1,fetchMoreLoading:!1};y.createContext({notificationsData:wre});function Are(e){var t=e.workspaceKey,n=t===void 0?"":t,r=e.tenantId,i=r===void 0?"":r,a=e.distinctId,s=a===void 0?"":a,o=e.subscriberId,l=o===void 0?"":o,u=e.inboxId,c=u===void 0?"":u,d=e.stores,f=e.toastProps,p=e.notificationClickHandler,g=e.primaryActionClickHandler,m=e.secondaryActionClickHandler,E=e.bellComponent,v=e.badgeComponent,b=e.notificationComponent,T=e.noNotificationsComponent,C=e.loaderComponent,_=e.tabBadgeComponent,w=e.headerRightComponent,S=e.hideAvatar,F=S===void 0?!1:S,R=e.hideInbox,L=e.hideToast,P=e.theme,N=e.themeType,k=N===void 0?"light":N,B=e.pagination,H=B===void 0?!0:B,q=e.pageSize,I=e.popperPosition,Q=I===void 0?"bottom":I,J=e.showUnreadCountOnTabs,O=J===void 0?!0:J,x=e.host;c&&(l=c);var Z=y.useState(!1),M=Z[0],j=Z[1],z=y.useState(),U=z[0],$=z[1],ae=y.useState({storeData:{},count:0}),Y=ae[0],ee=ae[1],se=y.useState(""),re=se[0],xe=se[1],ke=y.useState(!1),Te=ke[0],ue=ke[1];y.useEffect(function(){var we=new dB(n,{pageSize:q,tenantID:i,stores:d,host:x});return $(we),we.emitter.on("sync_notif_store",function(){var Pe=we.feed.data;ee({storeData:(Pe==null?void 0:Pe.stores)||{},count:(Pe==null?void 0:Pe.unseenCount)||0,hasNext:Pe==null?void 0:Pe.hasNext,initialLoading:Pe==null?void 0:Pe.initialLoading,activeStoreId:Pe==null?void 0:Pe.activeStoreId}),xe(Pe==null?void 0:Pe.activeStoreId)}),we.emitter.on("new_notification",function(Pe){Cre({notificationsData:Pe,toastProps:f})}),function(){we.emitter.all.clear()}},[]),y.useEffect(function(){M&&l&&U&&U.feed.markAllSeen()},[M,l,U]),y.useEffect(function(){if(!(!l||!U))return ee({storeData:{},count:0}),U.identifyUser(s,l),U.feed.fetchNotifications(),function(){U.resetUser()}},[l,U]);var fe=k==="dark"?C3(ine,P):P||{};return y.createElement(T3.Provider,{value:fe},y.createElement(b3.Provider,{value:{workspaceKey:n,notificationsData:Y,setNotificationsData:ee,notificationClickHandler:p,primaryActionClickHandler:g,secondaryActionClickHandler:m,bellComponent:E,badgeComponent:v,notificationComponent:b,noNotificationsComponent:T,tabBadgeComponent:_,headerRightComponent:w,toggleInbox:j,inbox:U,loaderComponent:C,pagination:H,hideAvatar:F,activeStore:re,setActiveStore:xe,changingActiveStore:Te,setChangingActiveStore:ue,showUnreadCountOnTabs:O,themeType:k}},!R&&y.createElement(hre,{openInbox:M,toggleInbox:j,popperPosition:Q}),!L&&y.createElement(_re,f)))}const bt={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===Mn.ACCOUNT&&t===!1&&n[Mn.SITE]===!0)return;const a=Date.now();if(!i&&!t&&bt.handlerCalled[e]&&a-bt.handlerCalled[e]<500)return;bt.handlerCalled[e]=a;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case Mn.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Mn.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Mn.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=Vy(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?bt.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case Mn.SITE:if(n){const u=bt.findFirstChild(t.current.children,"className","has-submenu parent"),c=bt.findFirstChild(u.children,"id",Mn.SITE);s=bt.findFirstChild(c.children,"href")}else s=bt.findFirstChild(t.current.children,"href");break;case Mn.ACCOUNT:if(o=bt.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=bt.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(bt.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(bt.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(bt.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{bt.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}},readLocaleFromCookie:()=>{if(!document||!document.cookie||!document.cookie.length)return null;const e=document.cookie.match(new RegExp("(^|;\\s*)apolitical_locale=([^;]*)"));return e?decodeURIComponent(e[2]):null}},ks={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},topics:{onlyShow:"logged-in",order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["cities-and-local-government","digital-and-data","education","climate","health-and-social-care","equity-justice-and-inclusion","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Kc=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null,getHref:s})=>{const o=de.useIntl(),l=Vy(ks,e);if(!l||l.onlyShow&&(l.onlyShow==="logged-in"&&!t||l.onlyShow==="logged-out"&&t))return null;const u="doTrack"in l,c=a===null?u?l.doTrack:!0:a,d=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;l.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(l.href){let C=l.gtmType||`${e}-click`;if(C.includes(".")){const _=C.split("."),w=_[_.length-2];C=`${w==="topics"?`${w}-`:""}${_[_.length-1]}`}p={href:s?s(l.href):l.withReturnTo?`${l.href}?returnTo=${window.location.pathname+window.location.search}`:l.href},c&&(p={...p,className:"gtm-trackable","data-gtm-event-type":C,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...l.props||{}})}const g=l.order&&l.order[0]&&l[l.order[0]],m=g&&l[l.order[0]].order,E=p&&window.location.pathname===l.href;let v={},b={},T={};if(E&&(v={...v,"aria-current":"page"}),g){const C=l.menuId||e,_={onClick:w=>bt.events.onClick(w,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>bt.events.onFocus({id:C}),onBlur:()=>bt.events.onBlur({id:C,callback:i}),onMouseLeave:()=>bt.events.onBlur({id:C,callback:i}),onMouseEnter:()=>bt.events.onMouseEnter({id:C,callback:i})};b={..._,id:C===Mn.SITE?Mn.SITE:Mn.ACCOUNT},n&&(m&&(T={..._,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&bt.events.onClick(w,{id:C,callback:i,isOpen:r[C]})},"aria-haspopup":!0,"aria-expanded":r[C],"aria-controls":C}),b={...b,hidden:C in r?!r[C]:!0}),m||(b={...b})}return h.jsxs("li",{className:te({[l.className]:l.className,"has-submenu":g,parent:m,active:E}),...v,children:[p?y.createElement(d?Me:"a",p,o.formatMessage({id:f})):n&&l.order&&m?h.jsxs("button",{...T,children:[o.formatMessage({id:f}),h.jsx(ot,{children:o.formatMessage({id:`header_menu_${r[Mn.SITE]?"hide":"show"}`})})]}):o.formatMessage({id:f}),l.order&&h.jsx("ul",{...b,children:l.order.map(C=>{if(!l[C])return null;const _={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:u?c:null};return l[C].order?h.jsxs("li",{className:te({[l[C].className]:l[C].className}),children:[o.formatMessage({id:`${f}_${C}`}),h.jsx("ul",{children:l[C].order.map(w=>h.jsx(Kc,{id:`${e}.${C}.${w}`,..._},w))})]},C):h.jsx(Kc,{id:`${e}.${C}`,..._},C)})})]},e)};const Sre=({headerIsVisible:e,locale:t})=>{const n=de.useIntl();return h.jsx("div",{id:"language-unavailable-message",className:te({visible:e}),children:h.jsx("p",{className:"text",children:n.formatMessage({id:`header_language_unavailable_${t}`},{link:r=>h.jsx("a",{href:"/pages/multilingual-transition",children:r})})})})},kre={colors:{primary:"#4F43BA",primaryHover:"#7C72E1",error:"#C34141",icon:"#000000",text:{primary:"#151921",secondary:"#64748B"},background:{primary:"#FFFFFF",hover:"#F8FAFC"},border:"#E2E8F0"},typography:{fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"24px"},fontWeights:{medium:"medium",bold:"bold"}},spacing:{xs:"8px",sm:"12px",md:"16px"},borderRadius:{sm:"8px",md:"12px",full:"9999px"},shadows:{sm:"0px 4px 6px rgba(0, 0, 0, 0.1)"},circleSizes:{avatar:"40px",dot:"10px"}},{colors:{primary:Do,primaryHover:Dre,error:$y,text:oi,background:li,border:Yf,icon:Ore},typography:{fontSizes:ui,fontWeights:ma},spacing:ga,borderRadius:zu,shadows:jy,circleSizes:Hy}=kre,Nre={bell:{color:Ore},badge:{backgroundColor:$y,color:li.primary},header:{container:{backgroundColor:li.primary,borderBottom:`1px solid ${Yf}`},headerText:{color:oi.primary,fontSize:ui.lg,fontWeight:ma.bold},markAllReadText:{color:Do,fontWeight:ma.medium,fontSize:ui.sm}},notificationsContainer:{container:{borderRadius:zu.md,overflow:"auto",backgroundColor:li.primary,boxShadow:jy.sm,border:"none"},loader:{color:Do},noNotificationsText:{color:oi.primary,fontSize:ui.md,fontWeight:ma.medium},noNotificationsSubtext:{color:oi.secondary,fontSize:ui.sm}},notification:{unseenDot:{backgroundColor:$y,width:Hy.dot,height:Hy.dot,right:ga.md,top:ga.md},container:{unreadBackgroundColor:li.primary,readBackgroundColor:li.primary,hoverBackgroundColor:li.hover,borderBottom:`1px solid ${Yf}`,padding:ga.md},headerText:{color:oi.primary,fontSize:ui.md,fontWeight:ma.medium},bodyText:{color:oi.primary,fontSize:ui.md},subtext:{color:oi.secondary,fontSize:ui.sm},actions:[{container:{backgroundColor:Do,color:li.primary,borderRadius:zu.full,padding:`${ga.xs} ${ga.md}`,fontSize:ui.sm,fontWeight:ma.medium,hoverBackgroundColor:Dre}},{container:{borderColor:Do,color:oi.secondary,backgroundColor:li.primary,borderRadius:zu.full,padding:`${ga.xs} ${ga.md}`,fontSize:ui.sm,fontWeight:ma.medium},text:{color:Do}}]},toast:{container:{backgroundColor:li.primary,borderRadius:zu.sm,boxShadow:jy.sm,border:`1px solid ${Yf}`},headerText:{color:oi.primary,fontWeight:ma.medium},bodyText:{color:oi.secondary}}};const Zf={height:67,height_desktop:83,additional_message_height:40};var Mn=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Mn||{});const T0=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!0,showLanguageSwitcher:n=!0,onLanguageSwitcherClick:r,suprSendWorkspaceKey:i})=>{var q,I;const a=de.useIntl(),s=y.useContext(Mt),o=Qc();o&&(ks.home.href=o);const l=Yi(!0,!0),u=s&&typeof s.id=="string",c=y.useMemo(()=>bt.getIsDesktopVersion(u,l),[u,l]),d=U0("suprsend-notifications")&&i,f=(I=(q=s==null?void 0:s.externalsMetadata)==null?void 0:q.suprsend)==null?void 0:I.subscriberId,p=t&&!u,g=U0("language-switcher")&&n&&!p,[m,E]=y.useState(!1);y.useEffect(()=>{let Q=null;try{Q=bt.readLocaleFromCookie()}catch{Q=null}t&&g&&(Q!==null&&Q!==Is)&&E(!0)},[t,g,s]);const[v,b]=y.useReducer(zs,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:T,menus:C,focusElements:_}=v,w=y.useRef(v);y.useEffect(()=>{w.current=v},[v]),Jy({scrollPosition:m?Zf[`height${c.navigation?"_desktop":""}`]+Zf.additional_message_height:Zf[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const Q=w.current.menus;!c&&Q["site-navigation"]||bt.shouldChangeHeaderIsVisible(!0,Q,b)},scrollDown:()=>{const Q=w.current.menus;!c&&Q["site-navigation"]||bt.shouldChangeHeaderIsVisible(!1,Q,b)}}});const S=(Q,J,O=!1)=>{bt.handleMenus({id:Q,value:J,menus:w.current.menus,dispatch:b,forceHandle:O})},F=y.useRef(null),R=Q=>{Q.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(J=>{w.current.menus[J]&&S(J,!1,!0)})};y.useEffect(()=>{var Q;return(Q=document.getElementById("header"))==null||Q.addEventListener("keydown",R),()=>{var J;(J=document.getElementById("header"))==null||J.removeEventListener("keydown",R)}},[]),Ds(()=>{C["site-navigation"]&&bt.autoFocus({menu:"site-navigation",navigationRef:F,isDesktopVersion:c.navigation,focusElements:_,dispatch:b})},[C["site-navigation"]]),Ds(()=>{C["account-navigation"]&&bt.autoFocus({menu:"account-navigation",navigationRef:F,isDesktopVersion:c.navigation,focusElements:_,dispatch:b})},[C["account-navigation"]]);const L=u&&h.jsxs(h.Fragment,{children:[!c.search&&h.jsx("button",{className:"search toggle-search-button",onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),S("search",!C.search)},children:h.jsx(ot,{children:a.formatMessage({id:`header_search_${C.search?"hide":"show"}`})})}),h.jsx(LT,{id:"global-search",handleToggle:{searchIsOpen:C.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),P=h.jsx("button",{className:"language icon language-switcher-button","aria-label":"Language switcher",onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),r?r():E(!m)},children:h.jsx(ot,{children:a.formatMessage({id:"header_language_switcher"})})}),N=[d&&f&&h.jsx("div",{id:"suprsend-notifications",children:h.jsx(Are,{workspaceKey:i,distinctId:(s==null?void 0:s.id)??"",subscriberId:f,theme:Nre,bellComponent:()=>h.jsx("button",{className:"bell icon bell-button"})})})],k=h.jsxs(h.Fragment,{children:[!c.navigation&&h.jsx("button",{className:"menu-button gtm-trackable",onClick:Q=>{Q.preventDefault(),Q.stopPropagation(),S("site-navigation",!C["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":C["site-navigation"],"aria-controls":"site-navigation",children:h.jsx(ot,{children:a.formatMessage({id:`header_menu_${C["site-navigation"]?"hide":"show"}`})})}),h.jsx("ul",{ref:F,id:"navigation",hidden:c.navigation||C["account-navigation"]?!1:!C["site-navigation"],"data-showing":!c.navigation&&C["account-navigation"]?"account":"default",children:ks.order.map(Q=>h.jsx(Kc,{id:Q,isLoggedIn:u,isDesktopVersion:c.navigation,menus:{"site-navigation":C["site-navigation"],"account-navigation":C["account-navigation"]},callback:S},Q))})]}),B=window.location.pathname.match(new RegExp("(courses/[^/]+/[^/]+|microcourses/[^/]+/[^/]+)")),H=Q=>{var U;const[J,O]=Q.split("?"),x=new URLSearchParams(O||""),M=new URLSearchParams(window.location.search).get("ref");if(x.set("ref",M||"course-overview"),window.location.pathname){const $=window.location.pathname.match(new RegExp("(courses/([^/]+)/([^/]+)|microcourses/[^/]+/([^/]+))"));if($){const[,,ae,Y,ee]=$;ee?x.set("courseSlug",ee):(x.set("courseSlug",ae),x.set("journeySlug",Y)),x.set("signupRedirectUrl",window.location.pathname+(window.location.search||""))}}const j=((U=window.location.pathname.match(/^\/([^/]+)\/courses/))==null?void 0:U[1])||"";return`${j?`/${j}`:""}${J}?${x.toString()}`};return s&&s.isLoading?null:h.jsxs(h.Fragment,{children:[h.jsxs("nav",{id:"header",className:te({"logged-in":u,"logged-out":!u,visible:T}),children:[h.jsx(ot,{element:"a",href:"#content-of-page",children:a.formatMessage({id:"header_skip"})}),h.jsx(dm,{variant:"monochrome"}),e?h.jsxs(h.Fragment,{children:[c.navigation?h.jsxs(h.Fragment,{children:[k,L,g&&P,N]}):h.jsxs(h.Fragment,{children:[L,g&&P,N,k]}),u?h.jsxs("button",{className:"account-button",onClick:Q=>bt.events.onClick(Q,{id:"account-navigation",callback:S,isOpen:C["account-navigation"]}),onMouseEnter:()=>bt.events.onMouseEnter({id:"account-navigation",callback:S}),onMouseLeave:()=>bt.events.onBlur({id:"account-navigation",callback:S}),"aria-haspopup":"true","aria-expanded":C["account-navigation"],"aria-controls":"account-navigation",children:[h.jsx(ot,{children:a.formatMessage({id:`header_account_${C["account-navigation"]?"hide":"show"}`})}),h.jsx(bi,{name:s&&s.name||"",src:s&&s.image&&s.image.thumbnail||""})]}):h.jsx("ul",{className:"sign-in-buttons",children:ks.buttons.order.map(Q=>h.jsx(Kc,{id:`buttons.${Q}`,getHref:Q==="signup"&&B?H:void 0},Q))})]}):g&&P]}),m&&h.jsx(Sre,{headerIsVisible:T,locale:(s==null?void 0:s.locale)||Is}),h.jsx("hr",{id:"content-of-page"}),h.jsx("div",{className:te("overlay",{open:C["site-navigation"]||C["account-navigation"]||!c.search&&C.search})})]})};const Ire=()=>{const e=de.useIntl();return h.jsxs(h.Fragment,{children:[h.jsx(T0,{}),h.jsx("div",{id:"content",children:h.jsx(Wr,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),h.jsx(fm,{})]})},S3=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en",suprSendWorkspaceKey:l})=>{const u=de.useIntl(),{navigation:c=!0,footer:d=!0}=i,{background:f="default",variant:p="default",circle:g="default",modal:m="default"}=a,E=Qy(),[v,b]=y.useState(""),T=F=>{const{detail:{message:R}}=F;b(R)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",T),()=>{document.removeEventListener("ariaLive",T)}),[E]);const C=Gu(e,{locale:o}),_=Gu(t,{locale:o}),w=Gu(n,{locale:o}),S={};return f!=="default"&&(S[f]=!0),p!=="default"&&(S[p]=!0),g!=="default"&&(S[g]=!0),h.jsx(Q3.ErrorBoundary,{onError:r,fallback:h.jsx(Ire,{}),children:h.jsxs(y.Suspense,{fallback:null,children:[h.jsxs("div",{id:"wrapper",className:te(s,S,{"has-footer":d}),"data-too-small":u.formatMessage({id:"pageLayout_browserTooSmall"}),children:[h.jsx(T0,{suprSendWorkspaceKey:l,showNavigation:c}),h.jsxs("main",{id:"content-wrapper",children:[_&&h.jsx("div",{className:te("additional-content prepended",{"large-modal":m==="large"}),children:_}),y.createElement(f==="bold"?Cp:"div",{id:"content",children:C,className:te({"large-modal":m==="large"})})]}),w&&h.jsx("div",{className:"additional-content appended",children:w}),d&&h.jsx(fm,{}),h.jsx(YT,{})]}),v&&h.jsx(ot,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:v})]})})},Uy={default:"tags_",headerTopics:"header_topics_topics_"},Qf={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},Pre={getTagDetails:e=>{if(e.includes("topic_")){if(e=Qf.topic[e.replace("topic_","")],e){const t=ks.topics.topics[e].href;return t?{id:e,href:t,text:`${Uy.headerTopics}${e}`}:null}return null}return Qf[e]?(e=Qf[e],{id:e,text:`${Uy.default}${e}`}):null}};const Rre=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=de.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Pre.getTagDetails(u);c&&l.push(c)}),l.length<1?null:h.jsx("ul",{className:te("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return h.jsx("li",{children:u.href&&r?h.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":s,children:c}):c},u.id)})})};const k3=25,Fre=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:c=!1,className:d=""})=>{const f=de.useIntl(),p="membersList",g=y.useContext(Mt),[m,E]=y.useState(!1);return e.length===0&&!c?null:h.jsxs("div",{className:te("members-list",d),children:[u?h.jsxs("h1",{children:[f.formatMessage({id:p}),h.jsx("span",{className:"count",children:t})]}):h.jsx(h.Fragment,{}),h.jsxs("ul",{children:[r?h.jsxs("li",{children:[h.jsx(pi,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:un.Communities,area:n||""},{scope:un.Platform,area:"all"}]}}),h.jsx(Xi,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),E(!0)},children:f.formatMessage({id:`${p}_profile`})})]}):h.jsx(h.Fragment,{}),e.map((v,b)=>g&&v.id===g.id?h.jsx(h.Fragment,{}):h.jsxs("li",{children:[h.jsx(pi,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:un.Communities,area:n||""},{scope:un.Platform,area:"all"}]}}),v.isAdmin&&h.jsx($r,{children:f.formatMessage({id:`${p}_admin`})})]},b)),c&&e.length===0&&t>0?[...new Array(Math.min(t,k3))].map((v,b)=>h.jsx("li",{children:h.jsx(t1,{layout:"member"})},b)):h.jsx(h.Fragment,{})]}),i&&h.jsx(wl,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:f.formatMessage({id:"loadMore_button"}),error:f.formatMessage({id:"loadMore_error"})},gtmContext:o}),s?h.jsx(H1,{form:s,showModal:m,content:{title:f.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{E(!1)}}}):h.jsx(h.Fragment,{})]})},D3=Fre,Bre=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=de.useIntl();return t?h.jsx("small",{children:vr(i.formatMessage,`${e}explainer`,n,"action",{a:a=>h.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:a})})}):h.jsx(h.Fragment,{})},Mre=({intlPath:e,type:t,...n})=>{const r=de.useIntl();return h.jsx(Pc,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:vr(r.formatMessage,`${e}label_action`,t,"action")},...n})},zy=5,qy=2,Lre=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};const Ft="discussion_form_",Ll=({id:e,parentId:t,content:n={type:Ge.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:c={},gtmContext:d="DiscussionForm"})=>{var ie,pe,Ne;const f=de.useIntl(),p=y.useContext(Mt),[g,m]=y.useState(n.type),[E,v]=y.useState(""),{isLoading:b=!1,isInWrapper:T=!1,isInOverlay:C=!1,isAutoFocused:_=!1,isEditing:w=!1,hasTitleField:S=!1,canBePrepopulated:F=!1,isPrepopulated:R=!1,showTitle:L=!1,showGuidelines:P=!0,showDivider:N=!1,showSuccessMessage:k=!0,showPostType:B=!1,postCategories:H=[]}=i||{},{onChange:q=()=>{},create:I=()=>{},createPoll:Q=()=>Promise,handleSaveEdit:J=()=>{},handleCancel:O=()=>{},callback:x=()=>{},onMention:Z=()=>{},listMembers:M=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:z=()=>Promise.resolve({}),props:U={create:{projectNames:["questions-answers"]}}}=u,[$,ae]=y.useState({body:w&&w.text||R&&R.text||"",data:c!=null&&c.link?{link:c==null?void 0:c.link}:{}}),[Y,ee]=y.useState(l.error||!1),se={status:!1,title:S&&S.text||"",polls:0},[re,xe]=y.useState(se);y.useEffect(()=>{F&&!w&&R&&R!==$.body&&ae(me=>({...me,body:R.text||""}))},[R]),y.useEffect(()=>{m(n.type)},[n.type]);const ke=al((me,X)=>{ae(ge=>({...ge,body:me,data:{link:X}})),q({body:me});let _e;!p||!p.id?_e=vr(f.formatMessage,`${Ft}error_loggedOut`,g,"action"):r?s>0&&me.length>=s&&(_e=`${Ft}error_tooLong`):_e=vr(f.formatMessage,`${Ft}error_noPermission`,g,"action"),_e?ee(_e):Y&&ee(!1)},50);let Te=`${g}-form`;if(g===Ge.Response||g===Ge.Reply){const me=((ie=n.slugs)==null?void 0:ie.reply)||((pe=n.slugs)==null?void 0:pe.answer)||((Ne=n.slugs)==null?void 0:Ne.question)||"";me&&(Te=`${Te}-${me.slice(-15)}`)}e&&(Te=`${e}-${Te}`);const ue=async me=>{if(!p||!p.id||!r||ct)throw new Error("You do not have permission to post.");xe(_e=>({..._e,status:"submitting"}));const X=window.location.pathname;try{let _e;switch(g){case Ge.Post:_e=await I({title:me.title,content:me.body,categories:me.postType,data:me.data});break;case Ge.Poll:_e=await Q(Lre(me));break;case Ge.Question:_e=await I({title:me.body,authorId:p&&p.id,data:me.data,...U==null?void 0:U.create});break;case Ge.Response:_e=await I({questionSlug:n.slugs.question},{body:me.body,authorId:p&&p.id,contentPath:X,data:me.data});break;case Ge.Reply:_e=await I({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:me.body,authorId:p&&p.id,contentPath:X,data:me.data});break;default:break}await B0(1e3),x&&await x(_e),ae({body:"",data:{}}),m(n.type),xe(De=>({...De,status:"submitted"})),v(vr(f.formatMessage,`${Ft}success`,g,"action"));const ge=new Event(Yt.DISCUSSION_FORM_SUBMITTED);return document.dispatchEvent(ge),await fe(),_e}catch(_e){const ge=_e;let De=`${Ft}error`;ge!=null&&ge.message.includes("entry already exists")&&(De=vr(f.formatMessage,`${Ft}error_alreadyExists`,g,"action")),ge!=null&&ge.message.includes("429")?De=vr(f.formatMessage,`${Ft}error_tooMany`,g,"action"):ge!=null&&ge.message.includes("400")&&(De=`${Ft}error`),ee(De),await fe()}},fe=async()=>{await B0(5e3),ee(!1),xe(se),v("")},we=al(async me=>{const X={...$,...me};if(w){xe(_e=>({..._e,status:"submitting"})),J(X);return}try{if(!await ue(X))throw Error("No response from handleSubmit")}catch{}},100);if(b)return h.jsx(sr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Pe=!$.body||!ol($.body),Xe=!re.title||!ol(re.title);let ct=!1;g!==Ge.Poll&&(ct=Pe),S&&(ct=ct&&Xe);const Ve=re.status==="submitting",Je=[];g===Ge.Poll?Je.push({id:"poll-options",label:f.formatMessage({id:`${Ft}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:f.formatMessage({id:`${Ft}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:qy,maxInputs:zy,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:f.formatMessage({id:`${Ft}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:me=>{var _e;let X=0;me&&Array.isArray(me)&&(X=((_e=me==null?void 0:me.filter(ge=>ge!==""))==null?void 0:_e.length)||0),re.polls!==X&&xe(ge=>({...ge,polls:X})),q({polls:me})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:f.formatMessage({id:`${Ft}multiplePollAnswers`}),className:"text-medium"}):Je.push({component:Mre,props:{formID:Te,intlPath:Ft,showLabel:S!==!1,type:g}},{component:um,props:{id:`${Te}-input`,value:re.status==="submitting"&&!Y?"":$.body,placeholder:a||vr(f.formatMessage,`${Ft}placeholder`,g,"action"),maxLength:s,meta:{isInOverlay:C},functions:{onChange:ke,onChangeData:me=>{ae(X=>({...X,data:me}))},onMention:Z,listMembers:M,clickMentionFallback:j,getLinkPreview:z},data:c,autoFocus:w!==!1||_&&!S,"aria-invalid":!!Y,"aria-errormessage":"error-message"}},{component:Bre,props:{intlPath:Ft,showGuidelines:P,type:g,gtmContext:d}}),N&&Je.push({component:Tr}),S&&Je.unshift({id:"title",type:"textarea",value:S.text,limit:250,label:f.formatMessage({id:`${Ft}${g===Ge.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:f.formatMessage({id:`${Ft}${g===Ge.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:me=>{xe(X=>({...X,title:me})),q({title:me})}},validation:g===Ge.Poll?[{condition:"required"}]:[]}),B&&Je.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:f.formatMessage({id:`${Ft}postType_label`}),options:H.map(me=>({id:me.slug,label:me.name})),validation:[{condition:"required"}],functions:{onChange:me=>{q({postType:me}),me.includes(Ge.Poll)?m(Ge.Poll):g!==Ge.Post&&m(Ge.Post)}}});let Ke=!p||!p.id||!r||Ve;if(g===Ge.Poll){const me=re.polls;Ke=Ke||Xe||me<qy||me>zy}else Ke=Ke||ct,w&&(S?Ke=Ke||$.body===w.text&&re.title===S.text:Ke=Ke||$.body===w.text);return h.jsxs(h.Fragment,{children:[h.jsxs(Cr,{id:Te,className:te("discussion-card discussion-form",{"no-styling":T&&w}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:w&&!Ve||l.cancel},functions:{onSuccess:async me=>{await we(me)},onCancel:O},fields:Je,intlPath:Ft,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`${w?"save":"submit"}-${g}-click`,"data-testid":"save-button",disabled:Ke,text:{default:!w&&(o!=null&&o.submit)?o==null?void 0:o.submit:f.formatMessage({id:`${Ft}${w?"save":"post"}`}),submitting:f.formatMessage({id:`${Ft}${w?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`cancel-${g}-click`,disabled:!l.cancel&&(!p||!p.id||!$.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:f.formatMessage({id:`${Ft}cancel`})},gtm:{context:d,event:`${g}-form`},"data-testid":`discussion-${g}-form`,children:[L&&!w&&g===Ge.Question&&h.jsx("h2",{children:vr(f.formatMessage,`${Ft}title`,g,"action")}),h.jsx(pi,{member:p?{...p,link:!1}:"community",gtmContext:d,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:un.Communities,area:t||""},{scope:un.Platform,area:"all"}]}})]}),re.status==="submitted"&&k&&h.jsx(Os,{className:"success","data-testid":"success",children:vr(f.formatMessage,`${Ft}success`,g,"action")}),Y&&h.jsx(Os,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Y=="string"?Y.includes(" ")?Y:f.formatMessage({id:Y},{action:f.formatMessage({id:`discussion_action_${g}`}),maxLength:s}):Y}),E&&h.jsx(ot,{"aria-live":"polite",showOnFocus:!1,children:E})]})},$re=Object.freeze(Object.defineProperty({__proto__:null,default:Ll},Symbol.toStringTag,{value:"Module"}));function O3(e,t){let n=t;const r=e.matchAll(Da),i=e.matchAll(/\[([^\]]+)\]\(([^)]+)\)/g);for(const a of[r,i])for(const s of a)if(s.index!==void 0){if(s.index>=n)break;if(s.index+s[0].length<=n)continue;n=s.index}return e.length>n?e.slice(0,n).trim()+"…":e}const N3=280,jre=(e,t,n)=>{let r=t?O3(e,typeof t=="number"?t:N3):e;return r=r.trim(),r=r.replaceAll(Da,(i,a)=>{var s,o;return`[@${((o=(s=n==null?void 0:n[a])==null?void 0:s.data)==null?void 0:o.name)||a}](/profiles/${a})`}),r},_0=async(e,t,n,r=()=>Promise.resolve([]))=>{let i=t?O3(e,typeof t=="number"?t:N3):e;i=i.trim();const a=`<br>
|
|
571
571
|
|
|
572
572
|
`;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await u4({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},C0=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)).filter(n=>n!==void 0),Hre=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},Ure=(e,t)=>e?typeof e=="string"?e:e[t]:"";const zre={showForm:!1},j1=y.createContext(zre),I3=({children:e})=>{const[t,n]=y.useState({showForm:!1});return h.jsx(j1.Provider,{value:{...t,updateConversation:n},children:e})};function qre({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var d;const o="discussion_",l=de.useIntl(),u=(d=i==null?void 0:i.componentProps)==null?void 0:d.member.additionalContent,c=u?u.customMessage:void 0;return h.jsxs("div",{className:"author-section",children:[h.jsx(pi,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:c},className:te({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!c},gtmContext:a,gtmType:"profile-click",badges:s}),i.pinned&&h.jsx($r,{variant:"naked",size:"xlarge",icon:"pin",children:h.jsx(ot,{children:l.formatMessage({id:`${o}pinned_post`})})})]})}const Xf=({children:e,class:t,...n})=>{const r={...n,class:te("subtle",t)};return h.jsx("blockquote",{...r,children:e})};function Wre({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?h.jsx(h.Fragment,{}):h.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?h.jsx(h.Fragment,{}):h.jsx($r,{size:"small",element:"li",children:n.name},n.slug))})}var Gc=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(Gc||{});const Vre=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,Kre=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(i=n==="next"?s.firstElementChild:s.lastElementChild,a=n==="next"?0:s.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const Gre=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var E;const[u,c]=y.useState(t.hasUserVoted);let d=0,f={};const p=(i||!s)&&!t.hasUserVoted;a&&(d=Math.round(t.numVotes/r*100)||0,f={"--vote-perc":`${d}%`});const g=v=>{v.stopPropagation(),p&&(l==null||l.createVote(t),c(!0))},m={htmlFor:t.id,className:te({"can-vote":p}),tabIndex:o&&p?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:g,onKeyDown:v=>{var b;if(v.code!=="Tab")switch(v.code){case"Enter":case"Space":v.preventDefault(),v.stopPropagation(),g(v),c(!0);break;case"ArrowUp":case"ArrowDown":v.stopPropagation(),v.preventDefault();const T=v.code==="ArrowUp"?"prev":"next",{nextElement:C,nextIndex:_}=Kre(v.currentTarget.parentElement,"selected",T,n);C&&((b=C.querySelector("label"))==null||b.focus(),l==null||l.setTabbableOption(_));break}}};return h.jsxs("li",{"data-testid":"poll-option",style:f,className:te("poll-option text-small",{selected:t.hasUserVoted}),children:[h.jsx("label",{...m,children:h.jsx("span",{children:t.label})}),a&&h.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&h.jsx(bi,{className:"author-profile-picture",name:e.name,src:(E=e==null?void 0:e.image)==null?void 0:E.thumbnail}),h.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[d,"%"]})]}),h.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const P3=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=de.useIntl(),s=y.useContext(Mt),{showRemoveVote:o=!1,allowMultipleVotes:l=!1,resultsVisibility:u=Gc.AfterVoting}=n||{},[c,d]=y.useState(Vre(t,l,s==null?void 0:s.id)),f=t.reduce((v,b)=>v+b.numVotes,0),p=t.filter(v=>v.hasUserVoted).length,g=t.filter(v=>v.hasUserVoted),m=y.useCallback(async v=>{await r.createVote({reactionId:v.id})},[]),E=y.useCallback(async()=>{t.forEach(async v=>{v.hasUserVoted&&v.userVote&&r.removeVote({reactionId:v.userVote.id})})},[t]);return h.jsxs("div",{className:"poll-wrapper",children:[h.jsx("p",{className:"poll-title",children:e}),h.jsxs("aside",{className:"poll-info",children:[h.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:h.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),h.jsx("p",{className:"poll-num-votes",children:h.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:f})})}),o&&h.jsx("p",{className:"poll-remove-vote",children:h.jsx(Me,{variant:"tertiary",onClick:E,"data-testid":"remove-votes-button",disabled:p===0,children:h.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:p})})})})]}),t&&h.jsx("form",{children:h.jsx("fieldset",{children:h.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((v,b)=>h.jsx(Gre,{isTabbable:c===b,user:s,option:v,optionIndex:b,totalPollVotes:f,showResults:u==Gc.Always||!!p,allowMultipleVotes:l,hasVotedOnPoll:!!p,functions:{createVote:m,setTabbableOption:d}},v.id))})})}),h.jsxs(ot,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:p}),!!p&&h.jsx("ul",{children:g.map(v=>h.jsx("li",{children:v.label}))})]})]})};function Yre({content:e,contentData:t,functions:n}){return h.jsx(P3,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function Zre({links:e={},contentData:t,postCutOff:n,content:r,gtmContext:i}){var a;return h.jsxs(h.Fragment,{children:[e.post?h.jsxs("a",{href:e.post,className:"gtm-trackable gtm-visible","data-gtm-event-type":`discussion-${r.type}`,"data-gtm-event-context":i,children:[(t==null?void 0:t.title)&&h.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?h.jsx(m4,{text:t.postBody,markdownOptions:{overrides:{a:oh,blockquote:{component:Xf}}}}):h.jsx(Oa,{options:{overrides:{a:oh,blockquote:{component:Xf}}},children:t.postBody})]}):h.jsxs(h.Fragment,{children:[(t==null?void 0:t.title)&&h.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),h.jsx(Oa,{options:{wrapper:r.type===Ge.Question?"h1":y.Fragment,forceWrapper:r.type===Ge.Question,forceInline:r.type===Ge.Question,forceBlock:r.type!==Ge.Question,overrides:{blockquote:{component:Xf}}},children:t.postBody})]}),(a=t.data)!=null&&a.link?h.jsx(cm,{data:t.data.link}):h.jsx(h.Fragment,{})]})}const pr="discussion_",Qre=195;let qu=null;const $l=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:s,functions:o,links:l={},className:u,gtmContext:c="DiscussionAnswer",children:d,isTruncated:f=!1,setFocus:p=!1,isCommunity:g=!1,badges:m,basePath:E,parentId:v,locale:b="en",disableMentions:T})=>{var Ke,ie,pe,Ne,me,X,_e;const C=de.useIntl(),_=y.useContext(j1),w=y.useContext(Mt),{createContent:S=async()=>{},deleteContent:F=async()=>{},updateContent:R=async()=>{}}=o.content||{},{createLike:L=()=>{},deleteLike:P=()=>{},listLikes:N=async()=>({})}=o.likes||{},{openComments:k=()=>{}}=o.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:H=()=>{}}=o.form||{},{createVote:q=()=>{},removeVote:I=()=>{},removePoll:Q=()=>{}}=o.polls||{},{author:J,createdAt:O,id:x,likes:Z=0,userLiked:M,comments:j=0,data:z}=t,U=Ure(t.title,b),$=w&&w.id&&typeof J!="string"&&J.id&&J.id===w.id||!1,ae=$&&(!t.createdAt||hx(t.createdAt,10,"seconds")),Y=y.useRef(null),[ee,se]=y.useState({title:t.body!==U&&U||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:t&&t.body?jre(t.body,f,(Ke=t.data)==null?void 0:Ke.mentions):"",data:t&&t.data||{}}),[re,xe]=y.useState(!1),[ke,Te]=y.useState(ae?"highlighted":"default"),[ue,fe]=y.useState("");y.useEffect(()=>{const ge=Y.current;if(!(!ge||ke==="default"))return document.addEventListener(Yt.DISCUSSION_FORM_SUBMITTED,we),ge.addEventListener("transitionend",Pe),()=>{document.removeEventListener(Yt.DISCUSSION_FORM_SUBMITTED,we),ge.removeEventListener("transitionend",Pe)}},[]),y.useEffect(()=>{se(ge=>({...ge,title:t&&U||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const De=await _0(ee.body,f,z==null?void 0:z.mentions,B);se(vt=>({...vt,postBody:De}))})()},[ee.body,z==null?void 0:z.mentions]);const we=()=>{setTimeout(()=>{Te("fading")},1e3)},Pe=({propertyName:ge})=>{ge==="background-color"&&Te(De=>(De==="default"&&(document.removeEventListener(Yt.DISCUSSION_FORM_SUBMITTED,we),Y.current&&Y.current.removeEventListener("transitionend",Pe)),De==="fading"?"default":De))};if(i||!t||t.type===Ge.Answer&&(!t.slugs||!t.slugs.question)||ee.postBody===""&&t.title==="")return h.jsx(sr,{className:"discussion-card"});const Xe=async({title:ge,body:De,data:vt})=>{ge||(ge=""),De||(De=""),fe("");try{if(!Ec(ge,ee.title)||!Ec(De,ee.body)){const qe=t.type===Ge.Question?{title:De}:{title:ge,body:De,data:vt};await R(fh(t.slugs),qe)}se(qe=>({...qe,title:ge||"",body:De||"",data:{...qe.data,...vt},isEditing:!1,didEdit:!0}))}catch{fe(`${pr}form_error`)}},ct=()=>{if(_&&_.updateConversation){const ge={showForm:!0},De=t.author;De&&De.id&&!T&&(g&&(ge.prepopulateForm=`@{{${De.id}}}`),ge.mentionData={id:De.id,name:De.name}),_.updateConversation(ge)}setTimeout(()=>{var dt,jt,Tt;const De=`reply-form-${(t.type===Ge.Answer?t.slug:((dt=t.slugs)==null?void 0:dt.reply)||((jt=t.slugs)==null?void 0:jt.answer)||((Tt=t.slugs)==null?void 0:Tt.question)||"").toLowerCase().slice(-15)}`,vt=document.getElementById(De),qe=document.getElementById(`${De}-input`);qe&&qe.focus(),vt&&vt.scrollIntoView({behavior:"smooth"})},0)},Ve=async()=>{xe(!1);try{t.type===Ge.Poll?(await Q(),window.location.href=`${E}/${v}`):await F(fh(t.slugs))}catch{fe("delete-error")}},Je=[];return n&&$&&(t.type!==Ge.Poll&&Je.push({text:C.formatMessage({id:`${pr}moreMenu_edit`}),onClick:()=>se(ge=>({...ge,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),Je.push({text:C.formatMessage({id:`${pr}moreMenu_delete`}),onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),xe(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`delete-${t.type}-click`,...q4(`delete-${t.slug}-modal`,re)})),r&&o.pins&&Je.push({text:C.formatMessage({id:`${pr}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),p&&((ie=Y==null?void 0:Y.current)==null||ie.focus(),(pe=Y==null?void 0:Y.current)==null||pe.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:te("discussion-post",u,{[ke]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!ee.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Y,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${c}-post-click`,onClick:ge=>{if(!l.post||ee.isEditing||t.type===Ge.Poll&&Hre(ge,["poll-options","poll-info"],"discussion-post"))return;ge.preventDefault(),ge.stopPropagation(),qu&&clearTimeout(qu),qu=setTimeout(()=>{window.location.href=l.post},150);const De=new CustomEvent(Yt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:qu}});document.dispatchEvent(De)},children:h.jsxs(h.Fragment,{children:[h.jsxs("div",{id:x||t.slug,className:te("discussion-card text-medium",t.type,{editing:ee.isEditing,"has-link":l.post&&!ee.isEditing}),children:[!ee.isEditing&&h.jsx(qre,{author:J,originalAuthorId:a,createdAt:O,contentData:{didEdit:ee.didEdit},content:t,gtmContext:c,badges:m}),ee.isEditing?h.jsx(Ll,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:ee.title!==""?{text:ee.title}:!1,isEditing:{text:ee.body,categories:[]},canBePrepopulated:g,isPrepopulated:!1},maxLength:t.type===Ge.Question?250:5e4,forceShow:{error:ue!==""&&ue!=="delete-error"?C.formatMessage({id:ue},{action:C.formatMessage({id:`${pr}action_${t.type}`})}):!1},functions:{create:S,handleSaveEdit:Xe,handleCancel:()=>{fe(""),se(ge=>({...ge,isEditing:!1}))},listMembers:B,clickMentionFallback:H},gtmContext:`${c}Form`,data:z}):h.jsxs(h.Fragment,{children:[t.type===Ge.Poll?h.jsx(Yre,{content:t,contentData:ee,functions:{createVote:q,removeVote:I}}):h.jsx(Zre,{links:l,contentData:ee,postCutOff:Qre,content:t,gtmContext:c}),h.jsx(Wre,{content:t})]}),!ee.isEditing&&!(s!=null&&s.actionBar)&&h.jsx(qT,{className:t.type,gtmContext:c,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Z||0,userLiked:M||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:L,deleteLike:P,listLikes:N},basePath:E,parentId:v},comments:!(s!=null&&s.comments)&&([Ge.Question,Ge.Post].includes(t.type)||l.comments)?{count:j||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof k=="function"&&k()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:ct}}:!1,shareLink:!(s!=null&&s.shareLink)&&{url:`${window.location.origin}${(Ne=t.slugs)==null?void 0:Ne.question}/${(me=t.slugs)==null?void 0:me.answer}${(X=t.slugs)!=null&&X.reply?`#${(_e=t.slugs)==null?void 0:_e.reply}`:""}`},moreMenu:!(s!=null&&s.moreMenu)&&{options:Je,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),d,h.jsx(Ti,{id:`delete-${t.slug}-modal`,isOpen:re,functions:{onOpen:()=>{},onClose:()=>xe(!1)},forceShow:{error:ue==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${pr}action_${t.type}`})}):!1},title:C.formatMessage({id:`${pr}delete_title`},{action:C.formatMessage({id:`${pr}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>xe(!1),children:C.formatMessage({id:`${pr}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ve,children:C.formatMessage({id:`${pr}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:h.jsx(de.FormattedMessage,{id:"discussion_delete_text",values:{p:ge=>h.jsx("p",{children:ge}),action:C.formatMessage({id:`${pr}action_${t.type}`})}})})]})})};const Xre=y.lazy(()=>Promise.resolve().then(()=>fie)),Jre=65,R3=({forceShow:e,form:t,className:n})=>{const r=de.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=y.useContext(Mt)||"community",l=n1(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const u=Yi(!0,!1),c=u?u<768:0,{modal:d=!1}=e||{},[f,p]=y.useState({form:d||c4("showPost")==="true"||!1,warning:!1}),[g,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!g.showCachedText)return;(async()=>{const T=await _0(g.title||g.body||"",Jre,g.mentions);m(C=>({...C,prettifiedText:T}))})()},[g.showCachedText,g.title,g.body]);const E=b=>{if(!g.showCachedText||typeof f.warning=="string")return;let T;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),T=b.detail.link;else{const C=b;C.preventDefault(),C.stopPropagation();const w=C.target.closest("a");T=w&&w.getAttribute("href")}p(C=>({...C,warning:T||!1}))};y.useEffect(()=>{if(!g.showCachedText){document.removeEventListener(Yt.DISCUSSION_POST_CLICKED,E),document.removeEventListener(Yt.MEMBER_CLICKED,E),document.removeEventListener("click",E);return}return document.addEventListener(Yt.DISCUSSION_POST_CLICKED,E),document.addEventListener(Yt.MEMBER_CLICKED,E),document.addEventListener("click",E),()=>{document.removeEventListener(Yt.DISCUSSION_POST_CLICKED,E),document.removeEventListener(Yt.MEMBER_CLICKED,E),document.removeEventListener("click",E)}},[g.showCachedText]),y.useEffect(()=>{const b=T=>{if(!(!g.showCachedText||f.warning!==!1))return T.preventDefault(),T.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[g.showCachedText,f.warning]);let v=r.formatMessage({id:`${i}placeholder${c?"":"_long"}`});return g.showCachedText&&(g.title||g.body)&&(v=g.prettifiedText||v),h.jsxs(h.Fragment,{children:[h.jsxs("button",{className:te("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),p(T=>({...T,form:!0}))},"data-testid":"discussion-form-card",children:[h.jsx(bi,{name:l.name,src:l.image,alt:""}),h.jsx(Oa,{className:te("input",{placeholder:!g.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Zn,blockquote:Zn,br:Zn,em:Zn,li:Zn,ol:Zn,p:Zn,s:Zn,span:Zn,strong:Zn,ul:Zn}},children:v})]}),h.jsxs(Ws,{children:[h.jsx(Xre,{showModal:f.form,functions:{cacheText:m,onClose:()=>{p(b=>({...b,form:!1}))}},form:t,cachedText:g,className:"in-portal"}),h.jsx(Ti,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:f.warning!==!1,functions:{onClose:()=>{p(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof f.warning=="string"&&(window.location.href=f.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{p({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:h.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},eie=y.lazy(()=>Promise.resolve().then(()=>$re)),x0=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:l},locale:u=Is})=>{const c=de.useIntl();if(a&&!i)return h.jsx(Wr,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:h.jsx(Sp,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:f,meta:p,...g}=t,m={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...f,create:(f==null?void 0:f.create)||(()=>{})},parentId:n,meta:{...p,isEditing:(p==null?void 0:p.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:c.formatMessage({id:"discussion_form__postType_no-category",defaultMessage:"Post"}),slug:"no-category"},...r||[]]},...g,id:`add-post-${g.id||""}`};return e?h.jsx(R3,{form:m}):h.jsx(eie,{...m})},w0=({form:e})=>{const t=y.useContext(Mt),n=de.useIntl(),[r,i]=y.useState(!1),a=()=>{Nx(t)||i(!0)};y.useEffect(()=>{if(e&&!(e!=null&&e.isDisabled)||(e==null?void 0:e.isDisabled)===void 0)return document.addEventListener(Yt.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(Yt.DISCUSSION_POST_ADDED,a)}});const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),h.jsx(H1,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const Jf="discussion_responses_",F3=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=de.useIntl();return t=parseInt(t),h.jsxs("div",{className:"responses-heading",children:[h.jsx("h4",{children:r.formatMessage({id:`${Jf}title`},{action:r.formatMessage({id:`${Jf}${e}`}),count:t})}),!n&&t===0&&h.jsx("p",{children:vr(r.formatMessage,`${Jf}empty`,e,e)})]})};const B3=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=de.useIntl(),s=y.useContext(j1),o=Gu(i,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return h.jsxs("div",{className:te("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&h.jsx("ul",{className:"thread",children:o}),!e&&h.jsx(wl,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&h.jsx(Ll,{...r})]})};function tie(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,s;(s=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&s.length&&(t=!0)}),t}function nie({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=gt.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(l=>(W4({activity:l,reactionId:o,user:a}),l)),onError:n,onSuccess:(o,{reactionId:l},u)=>{u&&V4({activity:u,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,u)}});return s}function rie({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=gt.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(s=>(s&&(i!=null&&(s.content=i),a!=null&&(s.title=a)),s)),onError:n});return r}function iie({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=gt.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&wc({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&wc({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function aie({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=gt.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ac({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ac({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function sie({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=gt.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function oie({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=gt.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(K4({activity:s,reactionId:a}),s)),onError:n});return i}function lie({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:l}){const u=gt.useQueryClient(),c=e1(),d={queryClient:u,queryKey:l},f={mutationHandlers:{error:kp(d),mutate:Dp(d)},user:c,...d},p=rie({...f,mutationFn:t}),g=iie({...f,mutationFn:n}),m=uie({...f,mutationFn:r}),E=aie({...f,mutationFn:i}),v=cie({...f,mutationFn:a}),b=nie({...f,mutationFn:s}),T=oie({...f,mutationFn:o}),{activity:C,..._}=sie({queryKey:l,queryFn:e});return{activity:C,mutations:{edit:p,like:g,unlike:m,pin:E,unpin:v,createVote:b,removeVote:T},user:c,..._}}function uie({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=gt.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&G4({activity:s,user:r}),s)),onError:n});return i}function cie({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=gt.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&Y4({activity:s,user:r}),s))),onError:n});return i}const die=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:l,form:u,join:c,leave:d,polls:f},profile:p,categories:g,locale:m=Is,type:E=$t.Communities,repliesFilters:v})=>{var z,U,$,ae,Y,ee,se,re,xe,ke,Te,ue;const b=de.useIntl(),T=y.useContext(Mt),C={...s,...f},{activity:_,error:w,isLoading:S,mutations:{edit:F,like:R,unlike:L,pin:P,unpin:N,createVote:k,removeVote:B}}=lie({queryFns:C,queryKey:[e,t,n]});if(S)return h.jsx(sr,{style:{height:"400px",width:E===$t.Courses?"100%":"initial"}});if(w||!_)return h.jsx(Wr,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:H,verb:q,latest_reactions:I,mentioned_users:Q,additional_data:J}=_,O=(((z=I==null?void 0:I.like)==null?void 0:z.length)||0)>0,x=!!((U=H==null?void 0:H.like)!=null&&U.find(fe=>{var we;return((we=fe.user)==null?void 0:we.id)===(T==null?void 0:T.id)})),Z=x?H==null?void 0:H.like[0].id:"",M=O?($=I==null?void 0:I.like)==null?void 0:$.map(fe=>{var we,Pe,Xe;return{id:(we=fe==null?void 0:fe.user)==null?void 0:we.id,name:(Xe=(Pe=fe==null?void 0:fe.user)==null?void 0:Pe.data)==null?void 0:Xe.name}}):!1,j=_==null?void 0:_.actor;return h.jsxs("section",{className:"activity-section",children:[h.jsx($l,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:q,title:_==null?void 0:_.title,body:E===$t.Courses?T6({content:_.content,locale:m}):_==null?void 0:_.content,categories:C0((_==null?void 0:_.categories)||[],g||[]),createdAt:(_==null?void 0:_.time)||"",slugs:{question:`${e}/${t}`,answer:_==null?void 0:_.id},slug:n,author:Ks(j),userLiked:x,likes:((ae=_==null?void 0:_.reaction_counts)==null?void 0:ae.like)||0,comments:(_==null?void 0:_.total_replies)||0,peopleWhoLiked:E===$t.Courses?!1:M,data:{mentions:Q,...J||{}},pinned:((Y=_==null?void 0:_.reaction_counts)==null?void 0:Y.pin)&&((ee=_==null?void 0:_.reaction_counts)==null?void 0:ee.pin)>0||!1,pollOptions:Op(_,m),pollSettings:{showRemoveVote:(se=_==null?void 0:_.settings)==null?void 0:se.show_remove_vote,allowMultipleVotes:(re=_==null?void 0:_.settings)==null?void 0:re.allow_multiple_votes,deadlineAt:(xe=_==null?void 0:_.settings)==null?void 0:xe.deadline_at,hideParticipants:(ke=_==null?void 0:_.settings)==null?void 0:ke.hide_participants,numberOfWinners:(Te=_==null?void 0:_.settings)==null?void 0:Te.number_of_winners,resultsVisibility:(ue=_==null?void 0:_.settings)==null?void 0:ue.results_visibility}},originalAuthorId:j==null?void 0:j.id,forceHide:{comments:!0,shareLink:E===$t.Courses},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(fe,{title:we,body:Pe})=>F({title:we,content:Pe})},likes:{createLike:()=>R({activityId:n}),deleteLike:()=>L({activityId:n,reactionId:Z}),listLikes:fe=>o.list({activityId:n,...fe})},comments:{openComments:()=>{}},pins:{createPin:()=>P({activityId:n}),deletePin:()=>{var fe;return N({activityId:n,reactionId:(fe=I==null?void 0:I.pin)==null?void 0:fe[0].id})}},polls:{createVote:({reactionId:fe})=>k({reactionId:fe}),removeVote:({reactionId:fe})=>B({reactionId:fe}),removePoll:()=>f.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:un.Communities,area:t||""},{scope:un.Platform,area:"all"}]},basePath:e,parentId:t},n),h.jsx(jT,{basePath:e,parentId:t,activityId:n,showReplies:q===Ge.Poll?tie(_):!0,activityTotalReplies:(_==null?void 0:_.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:c,leave:d},profile:p,type:E,repliesFilters:v})]})};const M3=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=de.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:d}=n,{title:f="",body:p="",mentions:g}=r||{},m="discussion-form-modal";return h.jsx(Ti,{id:m,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(f!==""||p!=="")&&l(E=>({...E,showCachedText:!0})),o()}},className:te("discussion-form-modal",i),children:h.jsx(Ll,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${m}-overlay`,hasTitleField:{text:f},isPrepopulated:{text:p||(c==null?void 0:c.isPrepopulated)!==!1&&(c==null?void 0:c.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${s}cta`})},functions:{...d,onChange:E=>{l(v=>({...v,...E}))},onMention:({id:E,name:v}={})=>{if(!E||!v)return;const b=g||{};b[E]={created_at:"",updated_at:"",id:E,data:{name:v}},l(T=>({...T,mentions:b}))},create:async E=>{o(),d.create&&await d.create(E),l({showCachedText:!1})},createPoll:async E=>{const v=()=>{o(),l({showCachedText:!1})};if(d.createPoll)try{const b=await d.createPoll(E);return new Promise(T=>(v(),T(b)))}catch{return new Promise((T,C)=>C())}else return v(),new Promise(b=>b({}))},handleSaveEdit:async E=>{o(),d.handleSaveEdit&&await d.handleSaveEdit(E),l({showCachedText:!1})}}})})},fie=Object.freeze(Object.defineProperty({__proto__:null,default:M3},Symbol.toStringTag,{value:"Module"}));const hie=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:c})=>{const d=de.useIntl();return i||(i=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),s||(s=d.formatMessage({id:"inviteModal_cta"})),h.jsx(Ti,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:l},className:te("invite-modal",e,{success:!!n}),children:h.jsx(FT,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:c,reportError:u})})};const pie=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=de.useIntl(),[l,u]=y.useState(c4("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:c=()=>{}}=i;return h.jsx(Ti,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:c},className:te("profile-modal",s,{success:!!t}),maxWidth:700,children:h.jsxs(h.Fragment,{children:[t&&n||r?h.jsxs("div",{className:"intro",children:[t&&n?h.jsx("h3",{children:n}):"",r?h.jsx("p",{children:r}):""]}):null,h.jsx(BT,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async d=>{var f;try{(f=a==null?void 0:a.functions)!=null&&f.onSuccess&&await a.functions.onSuccess(d)}finally{c()}}}})]})})},H1=pie,mie=Object.freeze(Object.defineProperty({__proto__:null,default:H1},Symbol.toStringTag,{value:"Module"}));const gie=({members:e})=>{const[t,n]=y.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:l}=i||{};return h.jsxs(h.Fragment,{children:[h.jsx(bi,{name:a,src:l}),h.jsx("p",{children:a}),h.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return h.jsxs("div",{className:"directory-wrapper",children:[h.jsx("ul",{className:"directory",children:e.map(i=>h.jsx("li",{children:h.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),h.jsx(Ti,{isOpen:t!==!1,children:t===!1?"":h.jsxs(h.Fragment,{children:[r(t),h.jsx(Oa,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const vie=({email:e,settings:t={}})=>{const{formatMessage:n}=de.useIntl(),r=y.useContext(Mt),{myProfile:i,isConnected:a,cannotConnect:s}=t,[o,l]=y.useState(!1),[u,c]=y.useState(!1);return r?e&&i?h.jsx(Me,{icon:{icon:"info-inside-circle",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_mine"}),forceTooltip:!0,className:"show-email fake-button",children:e}):s?h.jsx(Me,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_private"}),forceTooltip:!0,className:"show-email fake-button",children:n({id:"member_show_email_private"})}):a?e&&a?h.jsx(h.Fragment,{children:o?h.jsx(Me,{icon:{icon:"copy",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},className:"show-email copy-button",tooltip:n({id:`member_show_email_tooltip${u?"_copied":""}`}),forceTooltip:!0,"data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"copy-email-click",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{c(!0),setTimeout(()=>{c(!1)},2e3)})},children:e}):h.jsx(Me,{icon:"email",size:"small","data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"show-email-click",onClick:()=>l(!0),children:n({id:"member_show_email_show"})})}):h.jsx(h.Fragment,{}):h.jsx(Me,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},className:"show-email fake-button",children:n({id:"member_show_email_hide"})}):h.jsx(h.Fragment,{})};const Eie=({author:e,authorCite:t,content:n,member:r,className:i=""})=>h.jsxs("blockquote",{className:te("testimonial-block",i),children:[h.jsx(Lr,{className:"testimonial",children:n}),r?h.jsx(pi,{member:r,styling:{size:"large"}}):h.jsxs(h.Fragment,{children:[e&&h.jsx("p",{className:te("author",{"text-small":!i.includes("new")}),children:e}),t&&h.jsx("p",{className:te("author-cite",{"text-small":!i.includes("new")}),children:h.jsx("cite",{children:t})})]})]}),yie=y.memo(Eie);const bie=({items:e=[],selector:t="",className:n=""})=>{const r=de.useIntl(),[i,a]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));a(l)},[]),i&&i.length>0&&h.jsxs($n,{variant:"subtle",className:te("table-of-contents",n),children:[h.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),h.jsx("nav",{children:h.jsx("ul",{children:i.map(({id:s,text:o})=>h.jsx("li",{children:h.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const U1=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=de.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const d=c/60,f=Math.floor(d),p=(d-f)*60,g=Math.round(p),m=`${a.formatMessage({id:`${s}hours`},{time:f})}${f>0&&g>0?", ":""}${a.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${f>0?`${a.formatMessage({id:`${s}hours_short`},{time:f})} `:""}${g>0?a.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:m}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:d}=o(e+t);l=a.formatMessage({id:`${s}range`},{early:l,late:c}),u=a.formatMessage({id:`${s}range_aria`},{early:u,late:d})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),h.jsx("span",{className:te("time-to-complete",i),"aria-label":u,children:l})};const Tie=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",h.jsx(Qi,{...n,className:te("banner",e),image:{...t,aspect:"banner"}})):null;const _ie=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Cie=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,m;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],d={eyebrow:"small",title:"h1",text:"p"},f={};c.forEach(E=>{if(!t[E]){f[E]=!1;return}if(!s[E]){if(typeof t[E]=="object"){f[E]=t[E];const{text:v,element:b}=t[E];if(b&&_ie.includes(b.toLowerCase()))return;f[E]={text:v,element:d[E]};return}f[E]={text:t[E],element:d[E]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=E=>{E.preventDefault(),E.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),h.jsx(ta,{className:te("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&i==="normal"&&f.eyebrow&&f.title}),children:h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"content-wrapper",children:[c.map(E=>{if(f[E]&&typeof f[E]=="object"){const{text:v,element:b=""}=f[E];return E==="text"?h.jsx(Oa,{overrideType:"text-only",className:"text",children:v},E):y.createElement(b,{key:E,className:E},v)}return null}),l,p&&h.jsx(Me,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:te({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(m=o.props)==null?void 0:m.className}),children:o.text})]}),n&&h.jsx(Qi,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},xie=y.memo(Cie);const wie=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),h.jsx(ta,{className:te("custom-content-banner",t,r,{"has-image":e}),style:i,children:h.jsx("div",{className:"content-slim",children:n})})};const Aie=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?h.jsx(Oa,{children:n}):n;return h.jsxs(ta,{className:te("highlight-section",t),children:[r&&h.jsx("div",{className:te("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:h.jsx(Qi,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),h.jsx("div",{className:te("highlight-container highlight-content-wrapper",{"no-image":!r}),children:h.jsx("div",{className:te("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:h.jsx("div",{className:"content-default",children:i})})})]})},Sie=y.memo(Aie);const kie=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:h.jsxs("aside",{className:te("marketing-block",e),children:[n&&h.jsx("p",{className:"title",children:n}),r&&h.jsx("p",{children:r}),t&&h.jsx(Me,{variant:t.variant||"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Die=({type:e,data:t})=>{const n=de.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const d=i&&ih(i);return h.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&h.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})]})]})}if(c&&!a||s)return h.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):pp(c)});if(o)return h.jsx($r,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const d=u&&ih(u);return h.jsxs("ul",{className:"details",children:[l&&h.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&h.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})})]})}return null},Oie={title:66,text:3e3,secondaryText:1e3,partner:34},Yc={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},courseJourney:{basePath:"/courses/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Nie=({data:e,cta:t,link:n,gtmContext:r})=>{var m,E;const i=de.useIntl(),[a,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:d}=e,f=e.contentType;let p="";if((m=Yc[f])!=null&&m.gtmEvent&&(p=Yc[f].gtmEvent),l&&u)return n?h.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_watch"})}):null;if(f==="people")return n?h.jsx(Me,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(f)&&c!=="premium"){const v=a.loading||a.registered||((E=e==null?void 0:e.members)==null?void 0:E.isMember),b=async T=>{var C;if(T.preventDefault(),T.stopPropagation(),window&&((C=window.dataLayer)==null||C.push({event:"gtm.click","gtm.element":n,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":n,EventType:`${r}-${f}-register-click`,EventContext:`${r}Page-${f}: ${d}`})),!(v||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return h.jsx("p",{className:te("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:h.jsx(Me,{onClick:b,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${f}: ${d}`,"data-gtm-event-type":`${r}-${f}-register-click`,"data-testid":"in-card-button",children:o||i.formatMessage({id:`card_cta_${f}${v?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Iie({buildMemberData:e,communitySlug:t}){const n=de.useIntl(),r=y.useContext(Mt),[i,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let c=0;o?c=o:u!=null&&u.total&&(c=u==null?void 0:u.total),a({count:c.toString(),isMember:!!l,memberType:l})})},[t,e]),h.jsxs("span",{className:"member-information",children:[i.isMember&&h.jsx($r,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),h.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const A0=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var k,B;const u=de.useIntl(),c=y.useContext(Mt),d=!!(c!=null&&c.id),{isTabbable:f=!0,setFocus:p=!1}=l||{},g=y.useRef(null),[m,E]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(i,d).then(H=>{E({data:H,isLoading:!1})}).catch(()=>E(H=>({...H,isLoading:!1})))},[i,d,n]);const{data:v,isLoading:b}=m;if(b||!v)return h.jsx(sr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:o});const{contentType:T}=v;if(!T||!Yc[T])return h.jsx(sr,{element:"li",className:"card-wrapper"});const{basePath:C="",className:_,length:w,gtmEvent:S}=Yc[T];let F=f&&v.slug?`${v.locale?`/${v.locale}`:""}${C}${v.slug}`:!1;f&&v.slug&&(v.slug.slice(0,4)==="http"||v.slug.slice(0,2)==="//"||v.slug.slice(0,6)==="mailto"||v.slug.slice(0,3)==="tel")&&(F=v.slug);const R=H=>{if(F){H.preventDefault(),H.stopPropagation();const q=H.currentTarget.getAttribute("data-url");window&&window.dataLayer.push({event:"gtm.click","gtm.element":q,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":q,EventType:`${s}-CarouselCard`,EventContext:`${S}-click`}),window.location.href=q}},L={...Oie,...w};let P={className:"card"},N={};return F&&(N={href:F,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${S}-click`,"data-testid":"link"},v.openInNewTab&&(N.target="_blank"),P={onClick:R,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${S}-click`}),p&&(P={...P,tabIndex:"0"},(k=g==null?void 0:g.current)==null||k.focus(),(B=g==null?void 0:g.current)==null||B.scrollIntoView({behavior:"smooth"})),h.jsx("li",{className:te("card-wrapper text-medium",_,t,{"has-link":F,"no-link":!F,"has-image":v.banner}),"data-testid":`${T}-card`,children:h.jsxs("div",{...P,ref:g,"data-url":F,children:[h.jsx(f4,{className:"card-label",contentType:T,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),T==="communityPage"&&(v==null?void 0:v.createdAt)&&px(v==null?void 0:v.createdAt,60)&&h.jsx($r,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&h.jsx($r,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?u.formatMessage({id:"card_ended"}):o4(v.startDate)}),v.banner?h.jsxs("p",{className:"img",children:[v.registered&&h.jsx($r,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),h.jsx(Qi,{image:{...v.banner,description:""}})]}):_==="people"?h.jsx(bi,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&h.jsx(_p,{contributors:{data:v.contributors},styling:{size:"small",showGap:_!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(T)?u.formatMessage({id:`card_contributors_${T}`}):void 0,"data-testid":"contributors"}),v.partner&&h.jsx("p",{className:"partners","data-testid":"partners",children:v.partner.length>1?u.formatMessage({id:"card_partner"},{partner:v.partner[0],number:v.partner.length-1}):il(v.partner[0],L.partner)}),["title","text","secondaryText"].map(H=>{const q=v[H];if(!q)return null;const I=n4(H),Q={key:H,className:I,"data-testid":I},J={wrapper:"p",forceWrapper:!0,forceInline:!0},O=il(q,L[H]);return["title","text"].includes(H)&&F?(J.wrapper="a",h.jsx("p",{...Q,children:h.jsx(Lr,{options:J,...N,children:O})})):h.jsx(Lr,{options:J,...Q,children:O})}),i.contentType==="communityPage"&&(i.slug||v.slug)&&r&&h.jsx(Iie,{communitySlug:i.slug||v.slug,buildMemberData:r}),h.jsx(Die,{type:_||"",data:v}),h.jsx(Nie,{data:v,cta:a,link:F||"",gtmContext:s})]})})};const L3=({cards:e,cardTypes:t,className:n="",gtmContext:r="",...i})=>h.jsx("ul",{className:te("card-block",n),children:e.map((a,s)=>{const o=a.slug?`${a.slug}-${t[s]}`:`${t[s]}-${s}`;return h.jsx(A0,{id:o,card:{...a,contentType:t[s]},meta:{setFocus:s===(i==null?void 0:i.focusCardIndex)},...i},`${o}-${r}-${a.title}`)})}),Pie=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:s}},Rie=({id:e,title:t})=>{const n=de.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return y.createElement(i,{className:te("title",a,s,{"highlighted-title":a==="highlighted"}),children:h.jsxs(h.Fragment,{children:[r,o&&h.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||Zi(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const eh={fourCards:1024,threeCards:769,twoCards:480};let Wu=null,th=null;const Fie=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const l=de.useIntl(),u="carousel_pagination_",[c,d]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:p}=c,[g,m]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:E,loadedPages:v}=g,[b,T]=y.useState(""),C=t.length,_=Math.ceil(C/f),w=y.useRef(null),S=Yi(!0,!0,w==null?void 0:w.current);y.useEffect(()=>{let k=1;S&&(S>=eh.fourCards?k=4:S>=eh.threeCards?k=3:S>=eh.twoCards&&(k=2),k>C&&(k=C)),d(B=>({...B,cardsPerPage:k,isLoading:!1}))},[S,C]);const F=(k="next")=>{th&&clearTimeout(th);let B=E;if(typeof k=="string")if(k==="next")if(E<_-1)B=E+1;else return;else if(E>0)B=E-1;else return;else B=k;T(""),m(q=>({...q,currentPage:B,loadedPages:[...new Set([...v,B])]}));const H=()=>{const q=B*c.cardsPerPage,I=q+c.cardsPerPage;return t.slice(q,I).length};th=setTimeout(()=>{T(l.formatMessage({id:`${u}ariaLive${typeof k=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof k=="string"?k:"next"}`}),slide:typeof k=="string"?1:k+1,count:H()}))},500)},R=k=>{Wu=k.touches[0].clientX},L=k=>{if(Wu===null)return;const B=k.touches[0].clientX,H=Wu-B;H>5?F("next"):H<-5&&F("previous"),Wu=null},P={"--width":`${S||0}px`,"--total-cards":C,"--cards-per-page":f,"--page":E};if(p)return h.jsx(t1,{layout:`carousel${i?"-with-title":""}`});const N=(k,B)=>{var q;let H=null;return(q=k==null?void 0:k.sys)!=null&&q.id?H=`card-${k.sys.id}`:k!=null&&k.slug?H=`card-${k.slug}`:[n[B],k.contentType].includes("customCard")&&(H=`card-${Zi(`${k.title} ${k.createdAt}`)}-${B}`),H};return h.jsxs("section",{ref:w,className:te("carousel-wrapper",a),"data-testid":"carousel",children:[h.jsx(Rie,{id:e,title:i}),h.jsx("ul",{className:"carousel",onTouchStart:R,onTouchMove:L,style:P,"data-testid":"carousel-list",children:t.map((k,B)=>{let H=N(k,B);const{inView:q,isLoaded:I}=Pie(B,f,E,v);return H&&(q||I)?h.jsx(A0,{id:H,card:{...k,contentType:n[B]},buildCardData:r,gtmContext:s,meta:{isTabbable:q},...o},H):(H=H||`${e}-card-${B}`,h.jsx(sr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},H))})}),_<=1?null:h.jsxs(h.Fragment,{children:[h.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[h.jsx("li",{className:"arrow previous",children:h.jsx(Me,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:k=>{k.preventDefault(),k.stopPropagation(),F("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:E<=0})}),[...Array(_)].map((k,B)=>h.jsx("li",{"data-testid":"carousel-controls-button",children:h.jsx("button",{className:te("page-indicator",{selected:B===E}),onClick:H=>{H.preventDefault(),H.stopPropagation(),F(B)},children:h.jsx(ot,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:B+1,total:_})})})},`page-indicator-${B}`)),h.jsx("li",{className:"arrow next",children:h.jsx(Me,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:k=>{k.preventDefault(),k.stopPropagation(),F("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:E>=_-1})})]}),h.jsx(ot,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},Bie=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=a?Zi(a):`carousel-${u}`,d=u===e.length-1;return t?h.jsxs(y.Fragment,{children:[h.jsx(t1,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),d?null:h.jsx(Tr,{})]},`placeholder-${c}`):h.jsxs(y.Fragment,{children:[h.jsx(Fie,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),d?null:h.jsx(Tr,{})]},`carousel-${c}`)});const Mie=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:d=>{l&&(d.preventDefault(),d.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:te("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:te("img",{private:o,"no-image":!i}),children:i&&h.jsx(Qi,{image:i})}),h.jsxs("div",{className:"content",children:[a&&h.jsx("p",{className:"title text-medium",children:a}),s&&h.jsx("p",{className:"text text-medium",children:s})]})]})})};const Lie=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const l=de.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return y.createElement(e,{className:te("course-progression",o,{"highlight-percentage":c,"has-circle-graph":a==="circle"}),children:h.jsxs(h.Fragment,{children:[h.jsx(Tp,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}}),h.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:d=>h.jsx("strong",{children:d}),number:u})}),u<100&&i&&h.jsx(U1,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})})]})})};const $3=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>y.createElement(e,{className:te("lesson-name",i),"data-number":`${t}.${n}`,children:r});const j3=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=de.useIntl(),o=Xc(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):i4(i||"");return h.jsxs("small",{className:te("content-type",{[e]:e!=="default"}),children:[h.jsx("span",{className:te("type",n),children:o})," ",t>0&&!r&&h.jsx(U1,{time:t})," ",a?h.jsx("span",{className:"additional",children:a}):null]})};const $ie=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const d=de.useIntl(),f="courseStructure_",p=u.toLowerCase().includes("course conclusion");return h.jsxs(Jc,{className:"course-structure",label:h.jsxs(h.Fragment,{children:[h.jsxs("small",{children:[d.formatMessage({id:`${f}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&h.jsx("span",{className:"time",children:i&&l===0?d.formatMessage({id:`${f}time_completed`}):h.jsx(U1,{time:s,appendedText:i?d.formatMessage({id:`${f}time_left`}):""})})]}),h.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[h.jsx("p",{children:n}),h.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:m,contentType:E,icon:v,image:b,isIntroduction:T,optional:C,slug:_,subsectionId:w,title:S,type:F})=>{const R=i&&t||T,L={};return b&&(L.style={"--image":`url(${b})`}),h.jsx("li",{className:te({article:E===Oo.ARTICLE,discussion:E===Oo.DISCUSSION,quiz:E===Oo.QUIZ,completed:g&&E===Oo.ARTICLE,locked:!R}),...L,children:h.jsx(Xi,{href:R?`/microcourses/en/${o}/${_}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${r4(S)}`,gtmType:"article-click",children:h.jsxs(h.Fragment,{children:[h.jsx($3,{sectionId:a,subsectionId:w,title:S,className:"course-title"})," ",h.jsx(j3,{completionTime:m,icon:v,optional:C,type:F,children:c&&c[_]&&h.jsx("span",{className:"quiz-score",children:`${c[_]}%`})})]})})},_)})})]})};const jie=({isComplete:e=!1,onClick:t,...n})=>{const r=de.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),h.jsx(Me,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:te("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Hie=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),Wy=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const Vu="notFoundError_",Uie=()=>{const e=de.useIntl(),t=[];return Wy.forEach((n,r)=>{n.title=e.formatMessage({id:`${Vu}post_${r+1}`}),t.push("solutionArticle")}),h.jsxs(S3,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:h.jsxs(ta,{children:[h.jsx(L3,{cards:Wy,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),h.jsx(Me,{href:"/solution-articles/",children:e.formatMessage({id:`${Vu}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[h.jsx("h1",{children:e.formatMessage({id:`${Vu}title`})}),h.jsx("p",{children:e.formatMessage({id:`${Vu}text`})})]})};exports.ASSETS_URL=qr;exports.ActionBar=qT;exports.ActionButton=bs;exports.ActivitiesFeed=U6;exports.ActivitySection=die;exports.ActivityType=Vs;exports.AddPost=x0;exports.Badge=S4;exports.BadgeScope=un;exports.Badges=k4;exports.BadgesContext=gp;exports.BadgesProvider=v4;exports.Banner=Tie;exports.BannerSection=xie;exports.Breadcrumbs=XR;exports.Buckets=$x;exports.Button=Me;exports.ButtonWrapper=qs;exports.COURSE_CONTENT_TYPES=Oo;exports.CacheProvider=E4;exports.Card=A0;exports.CardBlock=L3;exports.Carousel=Bie;exports.CharacterLimit=Fp;exports.Checkbox=Bp;exports.CollapsibleSection=Jc;exports.Columns=KT;exports.CommunityDetails=u6;exports.ConnectionCta=D4;exports.ConnectionDirectionType=bp;exports.ConnectionStatusType=yp;exports.ContactFooter=fF;exports.ContactForm=RT;exports.ContentTypeLabel=f4;exports.Contributors=_p;exports.ConversationContext=j1;exports.CookieBanner=YT;exports.CourseProgression=Lie;exports.CourseStructure=$ie;exports.CustomContentBanner=wie;exports.CustomEvents=Yt;exports.DELETED_USER_ID=sl;exports.Directory=gie;exports.DiscussionContentType=Ge;exports.DiscussionConversation=I3;exports.DiscussionForm=Ll;exports.DiscussionFormCard=R3;exports.DiscussionFormModal=M3;exports.DiscussionPost=$l;exports.DiscussionThread=B3;exports.DiscussionType=$t;exports.Divider=Tr;exports.DownloadSection=lF;exports.EMAILS=ds;exports.EditSection=cF;exports.EmailHelperTextBox=nb;exports.EmptyStateBox=Wr;exports.EnrichedUrl=cm;exports.FeatureFlags=T4;exports.Filters=WT;exports.FlagsProvider=b4;exports.Footer=fm;exports.Form=Cr;exports.Formatting=ne;exports.Fragment=Zn;exports.FullWidthSection=ta;exports.GET_STREAM_USER_PREFIX=rh;exports.GlobalProviders=Qx;exports.Header=T0;exports.HelperTextBox=p4;exports.HiddenFromScreenReaders=Zc;exports.HideShowTextBox=m4;exports.HighlightSection=Sie;exports.HighlightedTextBox=$n;exports.INVALID_TOKEN=a4;exports.IconBulletedList=Ux;exports.ImageContainer=Fx;exports.IntlProvider=_4;exports.InviteForm=FT;exports.InviteModal=hie;exports.JoinButton=Sp;exports.Label=Pc;exports.LanguageContext=vp;exports.LanguageSwitcher=eF;exports.LessonName=$3;exports.LessonType=j3;exports.LikesButton=J4;exports.LikesFeed=HT;exports.LikesModal=UT;exports.Link=Xi;exports.LoadMore=wl;exports.LoadingBlock=O4;exports.LoadingPlaceholder=sr;exports.LoadingState=t1;exports.Logo=dm;exports.LogoSection=dF;exports.MEMBERS_PER_PAGE=k3;exports.MENTION_REGEX=s4;exports.MarkCompleteButton=jie;exports.MarkdownText=Oa;exports.MarketingBlock=kie;exports.Marks=Mr;exports.Member=pi;exports.MembersList=D3;exports.Modal=Cp;exports.MoreMenu=Fc;exports.NUMBER_OF_COUNTRIES=dx;exports.NUMBER_OF_USERS=cx;exports.NarrowCard=Mie;exports.NavigationMenu=VT;exports.NotFoundError=Uie;exports.Overlay=Ti;exports.OverlayContext=Ep;exports.OverlayProvider=w4;exports.PageHeading=A4;exports.PageLayout=S3;exports.Password=rb;exports.PasswordForm=xR;exports.PasswordRules=lb;exports.Pill=$r;exports.Poll=P3;exports.Popover=d4;exports.Portal=Ws;exports.ProfileForm=BT;exports.ProfileImageChange=PT;exports.ProfileModal=H1;exports.ProfileModalLauncher=w0;exports.ProfilePicture=bi;exports.ProgressBar=Tp;exports.ProgressTracker=Mx;exports.PublishArticleForm=SR;exports.Rating=J6;exports.RepliesFeed=jT;exports.ResponsesHeading=F3;exports.ResponsiveImage=Qi;exports.ResultsVisibility=Gc;exports.ReturnToNavButton=Lx;exports.RichTextEditor=um;exports.STORAGE_KEYS=hp;exports.SearchForm=LT;exports.ShareLink=zT;exports.ShareLinks=aF;exports.ShowEmail=vie;exports.SignupForm=PR;exports.Span=oh;exports.StatusBanner=Os;exports.TableOfContents=bie;exports.Tabs=sF;exports.Tags=Rre;exports.TestimonialBlock=yie;exports.TimeToComplete=U1;exports.Toggle=_R;exports.Tooltip=Ma;exports.TopLevelPage=hF;exports.UUID_V4_REGEX=Da;exports.UserContext=Mt;exports.UserProvider=C4;exports.VisuallyHidden=ot;exports.addAriaProps=q4;exports.basicReducer=zs;exports.camelCaseToDashCase=n4;exports.checkIntlPathExists=Xc;exports.constructActivityContent=Z4;exports.courseDiscussionRepliesFeedMock=q6;exports.enrichPostCategories=C0;exports.generateConditions=nc;exports.generateCssIcon=fx;exports.getActivityPollOptions=Op;exports.getAuthorData=Ks;exports.getCharacterLimitProps=tb;exports.getLongDate=pp;exports.getMember=n1;exports.getPostBody=_0;exports.getShortDate=o4;exports.getValueLength=r1;exports.headerData=ks;exports.likesResponseMock=ZR;exports.mapGetStreamData=Hie;exports.pageReady=l4;exports.passwordValidator=ah;exports.repliesFeedMock=z6;exports.toCamelCase=r4;exports.toCapitalisedCase=ux;exports.toSentenceCase=i4;exports.transformSlugs=fh;exports.useActivitiesFeed=eb;exports.useAutoResize=Zy;exports.useBadges=g4;exports.useCurrentPath=Qy;exports.useEffectAfterMount=Ds;exports.useElementWidth=Yi;exports.useHomepagePath=Qc;exports.useOverlay=x4;exports.useScrollListener=Jy;exports.useScrollToHash=dp;exports.useTooltips=fp;exports.useUser=e1;
|
package/index.mjs
CHANGED
|
@@ -46499,8 +46499,8 @@ const VC = ({
|
|
|
46499
46499
|
const l = Ua(!0, !0), u = s && typeof s.id == "string", c = Vn(
|
|
46500
46500
|
() => xt.getIsDesktopVersion(u, l),
|
|
46501
46501
|
[u, l]
|
|
46502
|
-
), d = O0("suprsend-notifications") && i, f = (N = (q = s == null ? void 0 : s.externalsMetadata) == null ? void 0 : q.suprsend) == null ? void 0 : N.subscriberId, p = t && !u, g = O0("language-switcher") && n && // Prevent the language switcher from being shown if the user is
|
|
46503
|
-
p, [m, y] = de(!1);
|
|
46502
|
+
), d = O0("suprsend-notifications") && i, f = (N = (q = s == null ? void 0 : s.externalsMetadata) == null ? void 0 : q.suprsend) == null ? void 0 : N.subscriberId, p = t && !u, g = O0("language-switcher") && n && // Prevent the language switcher from being shown if the user is logged out in v1 UIs
|
|
46503
|
+
!p, [m, y] = de(!1);
|
|
46504
46504
|
pe(() => {
|
|
46505
46505
|
let Q = null;
|
|
46506
46506
|
try {
|