@apolitical/component-library 8.3.14 → 8.3.15

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.
Files changed (3) hide show
  1. package/index.js +1 -1
  2. package/index.mjs +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -568,4 +568,4 @@ and limitations under the License.
568
568
  .Toastify__toast-body {
569
569
  padding: 0px;
570
570
  }
571
- `]))),Ege={storeData:{},unseenCount:0,hasNext:!1,initialLoading:!1,fetchMoreLoading:!1};E.createContext({notificationsData:Ege});function _ge(e){var t=e.workspaceKey,n=t===void 0?"":t,r=e.tenantId,i=r===void 0?"":r,a=e.distinctId,o=a===void 0?"":a,s=e.subscriberId,l=s===void 0?"":s,u=e.inboxId,c=u===void 0?"":u,d=e.stores,f=e.toastProps,h=e.notificationClickHandler,m=e.primaryActionClickHandler,p=e.secondaryActionClickHandler,y=e.bellComponent,v=e.badgeComponent,b=e.notificationComponent,_=e.noNotificationsComponent,T=e.loaderComponent,C=e.tabBadgeComponent,x=e.headerRightComponent,w=e.hideAvatar,P=w===void 0?!1:w,O=e.hideInbox,M=e.hideToast,R=e.theme,D=e.themeType,S=D===void 0?"light":D,B=e.pagination,H=B===void 0?!0:B,$=e.pageSize,F=e.popperPosition,ne=F===void 0?"bottom":F,J=e.showUnreadCountOnTabs,I=J===void 0?!0:J,A=e.host;c&&(l=c);var Y=E.useState(!1),L=Y[0],U=Y[1],V=E.useState(),z=V[0],j=V[1],ue=E.useState({storeData:{},count:0}),Q=ue[0],ie=ue[1],le=E.useState(""),te=le[0],Ae=le[1],Oe=E.useState(!1),Te=Oe[0],se=Oe[1];E.useEffect(function(){var ke=new oQ(n,{pageSize:$,tenantID:i,stores:d,host:A});return j(ke),ke.emitter.on("sync_notif_store",function(){var Fe=ke.feed.data;ie({storeData:(Fe==null?void 0:Fe.stores)||{},count:(Fe==null?void 0:Fe.unseenCount)||0,hasNext:Fe==null?void 0:Fe.hasNext,initialLoading:Fe==null?void 0:Fe.initialLoading,activeStoreId:Fe==null?void 0:Fe.activeStoreId}),Ae(Fe==null?void 0:Fe.activeStoreId)}),ke.emitter.on("new_notification",function(Fe){yge({notificationsData:Fe,toastProps:f})}),function(){ke.emitter.all.clear()}},[]),E.useEffect(function(){L&&l&&z&&z.feed.markAllSeen()},[L,l,z]),E.useEffect(function(){if(!(!l||!z))return ie({storeData:{},count:0}),z.identifyUser(o,l),z.feed.fetchNotifications(),function(){z.resetUser()}},[l,z]);var ve=S==="dark"?rD(Jme,R):R||{};return E.createElement(tD.Provider,{value:ve},E.createElement(eD.Provider,{value:{workspaceKey:n,notificationsData:Q,setNotificationsData:ie,notificationClickHandler:h,primaryActionClickHandler:m,secondaryActionClickHandler:p,bellComponent:y,badgeComponent:v,notificationComponent:b,noNotificationsComponent:_,tabBadgeComponent:C,headerRightComponent:x,toggleInbox:U,inbox:z,loaderComponent:T,pagination:H,hideAvatar:P,activeStore:te,setActiveStore:Ae,changingActiveStore:Te,setChangingActiveStore:se,showUnreadCountOnTabs:I,themeType:S}},!O&&E.createElement(lge,{openInbox:L,toggleInbox:U,popperPosition:ne}),!M&&E.createElement(vge,f)))}const Lt={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const o=`logged${e?"In":"Out"}`;return t>=n[a][o]};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===vr.ACCOUNT&&t===!1&&n[vr.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Lt.handlerCalled[e]&&a-Lt.handlerCalled[e]<500)return;Lt.handlerCalled[e]=a;let o=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(s=>{s===e||n[s]===!1||o.push({type:`menus.${s}`,value:!1})});else{let s=null;switch(e){case vr.SITE:s=document.querySelector("#header .menu-button"),s||(s=document.querySelector("#navigation .navigation-button"));break;case vr.SEARCH:s=document.querySelector("#header .toggle-search-button");break;case vr.ACCOUNT:s=document.querySelector("#header .account-button");break;default:return}s&&s.focus()}r(o)},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=OC(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?Lt.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 o,s;switch(e){case vr.SITE:if(n){const u=Lt.findFirstChild(t.current.children,"className","has-submenu parent"),c=Lt.findFirstChild(u.children,"id",vr.SITE);o=Lt.findFirstChild(c.children,"href")}else o=Lt.findFirstChild(t.current.children,"href");break;case vr.ACCOUNT:if(s=Lt.findFirstChild(t.current.children,"className","account"),!s||!s.children)return;o=Lt.findFirstChild(s.children,"href");break;default:return}o&&(i([{type:`focusElements.${e}.${a}`,value:o.attributes.href.value}]),o.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Lt.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Lt.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Lt.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Lt.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},zc={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},topics:{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:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","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:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},dh=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const o=me.useIntl(),s=OC(zc,e);if(!s||s.onlyShow&&(s.onlyShow==="logged-in"&&!t||s.onlyShow==="logged-out"&&t))return null;const l="doTrack"in s,u=a===null?l?s.doTrack:!0:a,c=e.includes("buttons.");let d=`header_${e.replaceAll(".","_")}`;s.hasVariantText&&(d+=`_logged${t?"In":"Out"}`);let f=!1;if(s.href){let _=s.gtmType||`${e}-click`;if(_.includes(".")){const T=_.split("."),C=T[T.length-2];_=`${C==="topics"?`${C}-`:""}${T[T.length-1]}`}f={href:s.withReturnTo?`${s.href}?returnTo=${window.location.pathname}`:s.href},u&&(f={...f,className:"gtm-trackable","data-gtm-event-type":_,"data-gtm-event-context":"HeaderButtons"}),c&&(f={...f,variant:"secondary",size:{mobile:"small",881:"large"},...s.props||{}})}const h=s.order&&s.order[0]&&s[s.order[0]],m=h&&s[s.order[0]].order,p=f&&window.location.pathname===s.href;let y={},v={},b={};if(p&&(y={...y,"aria-current":"page"}),h){const _=s.menuId||e,T={onClick:C=>Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]}),onFocus:()=>Lt.events.onFocus({id:_}),onBlur:()=>Lt.events.onBlur({id:_,callback:i}),onMouseLeave:()=>Lt.events.onBlur({id:_,callback:i}),onMouseEnter:()=>Lt.events.onMouseEnter({id:_,callback:i})};v={...T,id:_===vr.SITE?vr.SITE:vr.ACCOUNT},n&&(m&&(b={...T,className:"navigation-button",onKeyPress:C=>{C.key==="Enter"&&Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]})},"aria-haspopup":!0,"aria-expanded":r[_],"aria-controls":_}),v={...v,hidden:_ in r?!r[_]:!0}),m||(v={...v})}return g.jsxs("li",{className:ee({[s.className]:s.className,"has-submenu":h,parent:m,active:p}),...y,children:[f?E.createElement(c?Ke:"a",f,o.formatMessage({id:d})):n&&s.order&&m?g.jsxs("button",{...b,children:[o.formatMessage({id:d}),g.jsx(xt,{children:o.formatMessage({id:`header_menu_${r[vr.SITE]?"hide":"show"}`})})]}):o.formatMessage({id:d}),s.order&&g.jsx("ul",{...v,children:s.order.map(_=>{if(!s[_])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return s[_].order?g.jsxs("li",{className:ee({[s[_].className]:s[_].className}),children:[o.formatMessage({id:`${d}_${_}`}),g.jsx("ul",{children:s[_].order.map(C=>g.jsx(dh,{id:`${e}.${_}.${C}`,...T},C))})]},_):g.jsx(dh,{id:`${e}.${_}`,...T},_)})})]},e)};const Tge=({headerIsVisible:e,locale:t})=>{const n=me.useIntl();return g.jsx("div",{id:"language-unavailable-message",className:ee({visible:e}),children:g.jsx("p",{className:"text",children:n.formatMessage({id:`header_language_unavailable_${t}`},{link:r=>g.jsx("a",{href:"/home",children:r})})})})};const q0={height:67,height_desktop:83,additional_message_height:40};var vr=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(vr||{});const l5=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!0,showLanguageSwitcher:n=!0,onLanguageSwitcherClick:r,suprSendWorkspaceKey:i,novuApplicationIdentifier:a})=>{var B,H;const o=me.useIntl(),s=E.useContext(fn),l=lo(!0,!0),u=s&&typeof s.id=="string",c=E.useMemo(()=>Lt.getIsDesktopVersion(u,l),[u,l]),d=Op("suprsend-notifications")&&i,f=(H=(B=s==null?void 0:s.externalsMetadata)==null?void 0:B.suprsend)==null?void 0:H.subscriberId,h=Op("novu-notifications")&&a,m=Op("language-switcher")&&n,[p,y]=E.useState(!1);E.useEffect(()=>{t&&m&&(s!=null&&s.id)&&(s==null?void 0:s.locale)!==yl&&y(!0)},[t,m,s]);const[v,b]=E.useReducer(Rl,{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:_,menus:T,focusElements:C}=v,x=E.useRef(v);E.useEffect(()=>{x.current=v},[v]),LC({scrollPosition:p?q0[`height${c.navigation?"_desktop":""}`]+q0.additional_message_height:q0[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!0,$,b)},scrollDown:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!1,$,b)}}});const w=($,F,ne=!1)=>{Lt.handleMenus({id:$,value:F,menus:x.current.menus,dispatch:b,forceHandle:ne})},P=E.useRef(null),O=$=>{$.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(F=>{x.current.menus[F]&&w(F,!1,!0)})};E.useEffect(()=>{var $;return($=document.getElementById("header"))==null||$.addEventListener("keydown",O),()=>{var F;(F=document.getElementById("header"))==null||F.removeEventListener("keydown",O)}},[]),ml(()=>{T["site-navigation"]&&Lt.autoFocus({menu:"site-navigation",navigationRef:P,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["site-navigation"]]),ml(()=>{T["account-navigation"]&&Lt.autoFocus({menu:"account-navigation",navigationRef:P,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["account-navigation"]]);const M=g.jsxs(g.Fragment,{children:[!c.search&&g.jsx("button",{className:"search toggle-search-button",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("search",!T.search)},children:g.jsx(xt,{children:o.formatMessage({id:`header_search_${T.search?"hide":"show"}`})})}),g.jsx(Nw,{id:"global-search",handleToggle:{searchIsOpen:T.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),R=g.jsx("button",{className:"earth icon language-switcher-button","aria-label":"Language switcher",onClick:$=>{$.preventDefault(),$.stopPropagation(),r?r():y(!p)},children:g.jsx(xt,{children:o.formatMessage({id:"header_language_switcher"})})}),D=[d&&f&&g.jsx("div",{id:"suprsend-notifications",children:g.jsx(_ge,{workspaceKey:i,distinctId:(s==null?void 0:s.id)??"",subscriberId:f,theme:{badge:{backgroundColor:"#C34141"},header:{markAllReadText:{color:"#4F43BA"}},notification:{unseenDot:{backgroundColor:"#C34141"},container:{unreadBackgroundColor:"white",readBackgroundColor:"white",hoverBackgroundColor:"#F0F5FF",borderColor:"#D7E0EF"},headerText:{color:"#151921"},bodyText:{color:"#151921"},subtext:{color:"#404A61"},actions:[{container:{backgroundColor:"#4F43BA"}},{container:{borderColor:"#4F43BA",color:"#4F43BA",backgroundColor:"white"}}]}}})}),h&&(s==null?void 0:s.id)&&g.jsx("div",{className:"novu-notifications",children:g.jsx(AZ,{applicationIdentifier:a,subscriberId:s==null?void 0:s.id,routerPush:$=>window.location.href=$,backendUrl:"https://eu.api.novu.co",socketUrl:"https://eu.ws.novu.co",appearance:{variables:{colorBackground:"#FFFFFF",colorForeground:"#151921",colorPrimary:"#4F43BA",fontSize:"24px"},elements:{notificationPrimaryAction__button:{borderRadius:"16px"}}}})})],S=g.jsxs(g.Fragment,{children:[!c.navigation&&g.jsx("button",{className:"menu-button gtm-trackable",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("site-navigation",!T["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":T["site-navigation"],"aria-controls":"site-navigation",children:g.jsx(xt,{children:o.formatMessage({id:`header_menu_${T["site-navigation"]?"hide":"show"}`})})}),g.jsx("ul",{ref:P,id:"navigation",hidden:c.navigation||T["account-navigation"]?!1:!T["site-navigation"],"data-showing":!c.navigation&&T["account-navigation"]?"account":"default",children:zc.order.map($=>g.jsx(dh,{id:$,isLoggedIn:u,isDesktopVersion:c.navigation,menus:{"site-navigation":T["site-navigation"],"account-navigation":T["account-navigation"]},callback:w},$))})]});return s&&s.isLoading?null:g.jsxs(g.Fragment,{children:[g.jsxs("nav",{id:"header",className:ee({"logged-in":u,"logged-out":!u,visible:_}),children:[g.jsx(xt,{element:"a",href:"#content-of-page",children:o.formatMessage({id:"header_skip"})}),g.jsx(Xv,{variant:"monochrome"}),e?g.jsxs(g.Fragment,{children:[c.navigation?g.jsxs(g.Fragment,{children:[S,M,m&&R,D]}):g.jsxs(g.Fragment,{children:[M,m&&R,D,S]}),u?g.jsxs("button",{className:"account-button",onClick:$=>Lt.events.onClick($,{id:"account-navigation",callback:w,isOpen:T["account-navigation"]}),onMouseEnter:()=>Lt.events.onMouseEnter({id:"account-navigation",callback:w}),onMouseLeave:()=>Lt.events.onBlur({id:"account-navigation",callback:w}),"aria-haspopup":"true","aria-expanded":T["account-navigation"],"aria-controls":"account-navigation",children:[g.jsx(xt,{children:o.formatMessage({id:`header_account_${T["account-navigation"]?"hide":"show"}`})}),g.jsx(ka,{name:s&&s.name||"",src:s&&s.image&&s.image.thumbnail||""})]}):g.jsx("ul",{className:"sign-in-buttons",children:zc.buttons.order.map($=>g.jsx(dh,{id:`buttons.${$}`},$))})]}):m&&R]}),p&&g.jsx(Tge,{headerIsVisible:_,locale:(s==null?void 0:s.locale)||yl}),g.jsx("hr",{id:"content-of-page"}),g.jsx("div",{className:ee("overlay",{open:T["site-navigation"]||T["account-navigation"]||!c.search&&T.search})})]})};const Cge=()=>{const e=me.useIntl();return g.jsxs(g.Fragment,{children:[g.jsx(l5,{}),g.jsx("div",{id:"content",children:g.jsx(Ui,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),g.jsx(Sy,{})]})},sD=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:o="",locale:s="en",suprSendWorkspaceKey:l,novuApplicationIdentifier:u})=>{const c=me.useIntl(),{navigation:d=!0,footer:f=!0}=i,{background:h="default",variant:m="default",circle:p="default",modal:y="default"}=a,v=MC(),[b,_]=E.useState(""),T=O=>{const{detail:{message:M}}=O;_(M)};E.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",T),()=>{document.removeEventListener("ariaLive",T)}),[v]);const C=Ed(e,{locale:s}),x=Ed(t,{locale:s}),w=Ed(n,{locale:s}),P={};return h!=="default"&&(P[h]=!0),m!=="default"&&(P[m]=!0),p!=="default"&&(P[p]=!0),g.jsx(DD.ErrorBoundary,{onError:r,fallback:g.jsx(Cge,{}),children:g.jsxs(E.Suspense,{fallback:null,children:[g.jsxs("div",{id:"wrapper",className:ee(o,P,{"has-footer":f}),"data-too-small":c.formatMessage({id:"pageLayout_browserTooSmall"}),children:[g.jsx(l5,{suprSendWorkspaceKey:l,novuApplicationIdentifier:u,showNavigation:d}),g.jsxs("main",{id:"content-wrapper",children:[x&&g.jsx("div",{className:ee("additional-content prepended",{"large-modal":y==="large"}),children:x}),E.createElement(h==="bold"?Lv:"div",{id:"content",children:C,className:ee({"large-modal":y==="large"})})]}),w&&g.jsx("div",{className:"additional-content appended",children:w}),f&&g.jsx(Sy,{}),g.jsx(Pw,{})]}),b&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:b})]})})},AC={default:"tags_",headerTopics:"header_topics_topics_"},W0={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"},xge={getTagDetails:e=>{if(e.includes("topic_")){if(e=W0.topic[e.replace("topic_","")],e){const t=zc.topics.topics[e].href;return t?{id:e,href:t,text:`${AC.headerTopics}${e}`}:null}return null}return W0[e]?(e=W0[e],{id:e,text:`${AC.default}${e}`}):null}};const wge=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:o="tags"})=>{const s=me.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=xge.getTagDetails(u);c&&l.push(c)}),l.length<1?null:g.jsx("ul",{className:ee("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const c=s.formatMessage({id:u.text});return g.jsx("li",{children:u.href&&r?g.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":o,children:c}):c},u.id)})})};const lD=25,Age=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:o,gtmContext:s="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:c=!1,className:d=""})=>{const f=me.useIntl(),h="membersList",m=E.useContext(fn),[p,y]=E.useState(!1);return e.length===0&&!c?null:g.jsxs("div",{className:ee("members-list",d),children:[u?g.jsxs("h1",{children:[f.formatMessage({id:h}),g.jsx("span",{className:"count",children:t})]}):g.jsx(g.Fragment,{}),g.jsxs("ul",{children:[r?g.jsxs("li",{children:[g.jsx(Ea,{member:m,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:n||""},{scope:Fn.Platform,area:"all"}]}}),g.jsx(fo,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),y(!0)},children:f.formatMessage({id:`${h}_profile`})})]}):g.jsx(g.Fragment,{}),e.map((v,b)=>m&&v.id===m.id?g.jsx(g.Fragment,{}):g.jsxs("li",{children:[g.jsx(Ea,{member:v,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:n||""},{scope:Fn.Platform,area:"all"}]}}),v.isAdmin&&g.jsx(Fi,{children:f.formatMessage({id:`${h}_admin`})})]},b)),c&&e.length===0&&t>0?[...new Array(Math.min(t,lD))].map((v,b)=>g.jsx("li",{children:g.jsx(bh,{layout:"member"})},b)):g.jsx(g.Fragment,{})]}),i&&g.jsx(Vc,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),o?g.jsx(xp,{form:o,showModal:p,content:{title:f.formatMessage({id:`${h}_modal_title`})},functions:{onClose:()=>{y(!1)}}}):g.jsx(g.Fragment,{})]})},uD=Age,kge=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=me.useIntl();return t?g.jsx("small",{children:oi(i.formatMessage,`${e}explainer`,n,"action",{a:a=>g.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})})}):g.jsx(g.Fragment,{})},Sge=({intlPath:e,type:t,...n})=>{const r=me.useIntl();return g.jsx(Af,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:oi(r.formatMessage,`${e}label_action`,t,"action")},...n})},kC=5,SC=2,Dge=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}}};let Rs=null;const nn="discussion_form_",l1=({id:e,parentId:t,content:n={type:at.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:o=0,buttons:s,forceShow:l={cancel:!1,error:!1},functions:u,data:c={},gtmContext:d="DiscussionForm"})=>{var re,ge,Ne;const f=me.useIntl(),h=E.useContext(fn),[m,p]=E.useState(n.type),[y,v]=E.useState(""),{isLoading:b=!1,isInWrapper:_=!1,isInOverlay:T=!1,isAutoFocused:C=!1,isEditing:x=!1,hasTitleField:w=!1,canBePrepopulated:P=!1,isPrepopulated:O=!1,showTitle:M=!1,showGuidelines:R=!0,showDivider:D=!1,showSuccessMessage:S=!0,showPostType:B=!1,postCategories:H=[]}=i||{},{onChange:$=()=>{},create:F=()=>{},createPoll:ne=()=>Promise,handleSaveEdit:J=()=>{},handleCancel:I=()=>{},callback:A=()=>{},onMention:Y=()=>{},listMembers:L=()=>Promise.resolve([]),clickMentionFallback:U=()=>{},getLinkPreview:V=()=>Promise.resolve({}),props:z={create:{projectNames:["questions-answers"]}}}=u,[j,ue]=E.useState({body:x&&x.text||O&&O.text||"",data:c!=null&&c.link?{link:c==null?void 0:c.link}:{}}),[Q,ie]=E.useState(l.error||!1),le={status:!1,title:w&&w.text||"",polls:0},[te,Ae]=E.useState(le);E.useEffect(()=>{P&&!x&&O&&O!==j.body&&ue(ye=>({...ye,body:O.text||""}))},[O]),E.useEffect(()=>{p(n.type)},[n.type]);const Oe=mc((ye,X)=>{ue(xe=>({...xe,body:ye,data:{link:X}})),$({body:ye});let he;!h||!h.id?he=oi(f.formatMessage,`${nn}error_loggedOut`,m,"action"):r?o>0&&ye.length>=o&&(he=`${nn}error_tooLong`):he=oi(f.formatMessage,`${nn}error_noPermission`,m,"action"),he?ie(he):Q&&ie(!1)},50);let Te=`${m}-form`;if(m===at.Response||m===at.Reply){const ye=((re=n.slugs)==null?void 0:re.reply)||((ge=n.slugs)==null?void 0:ge.answer)||((Ne=n.slugs)==null?void 0:Ne.question)||"";ye&&(Te=`${Te}-${ye.slice(-15)}`)}e&&(Te=`${e}-${Te}`);const se=async ye=>{if(!h||!h.id||!r||gt)throw new Error("You do not have permission to post.");Rs&&clearTimeout(Rs),Ae(he=>({...he,status:"submitting"}));const X=window.location.pathname;try{let he;switch(m){case at.Post:he=await F({title:ye.title,content:ye.body,categories:ye.postType,data:ye.data});break;case at.Poll:he=await ne(Dge(ye));break;case at.Question:he=await F({title:ye.body,authorId:h&&h.id,data:ye.data,...z==null?void 0:z.create});break;case at.Response:he=await F({questionSlug:n.slugs.question},{body:ye.body,authorId:h&&h.id,contentPath:X,data:ye.data});break;case at.Reply:he=await F({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ye.body,authorId:h&&h.id,contentPath:X,data:ye.data});break;default:break}return await WD(1e3),A&&await A(he),Rs=setTimeout(()=>{ue({body:"",data:{}}),p(at.Post),Ae(Ue=>({...Ue,status:"submitted"})),v(oi(f.formatMessage,`${nn}success`,m,"action"));const xe=new Event(bn.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(xe),ve()},850),he}catch(he){const xe=he;let Ue=`${nn}error`;xe!=null&&xe.message.includes("entry already exists")&&(Ue=oi(f.formatMessage,`${nn}error_alreadyExists`,m,"action")),xe!=null&&xe.message.includes("429")?Ue=oi(f.formatMessage,`${nn}error_tooMany`,m,"action"):xe!=null&&xe.message.includes("400")&&(Ue=`${nn}error`),ie(Ue),ve()}},ve=()=>{Rs=setTimeout(()=>{ie(!1),Ae(le),v("")},5e3)},ke=mc(async ye=>{const X={...j,...ye};if(x){Ae(he=>({...he,status:"submitting"})),J(X);return}try{if(!await se(X))throw Error("No response from handleSubmit")}catch{Rs&&clearTimeout(Rs)}},100);if(b)return g.jsx(qr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Fe=!j.body||!yc(j.body),ht=!te.title||!yc(te.title);let gt=!1;m!==at.Poll&&(gt=Fe),w&&(gt=gt&&ht);const nt=te.status==="submitting",ot=[];m===at.Poll?ot.push({id:"poll-options",label:f.formatMessage({id:`${nn}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:f.formatMessage({id:`${nn}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:SC,maxInputs:kC,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:f.formatMessage({id:`${nn}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:ye=>{var he;let X=0;ye&&Array.isArray(ye)&&(X=((he=ye==null?void 0:ye.filter(xe=>xe!==""))==null?void 0:he.length)||0),te.polls!==X&&Ae(xe=>({...xe,polls:X})),$({polls:ye})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:f.formatMessage({id:`${nn}multiplePollAnswers`}),className:"text-medium"}):ot.push({component:Sge,props:{formID:Te,intlPath:nn,showLabel:w!==!1,type:m}},{component:ky,props:{id:`${Te}-input`,value:te.status==="submitting"&&!Q?"":j.body,placeholder:a||oi(f.formatMessage,`${nn}placeholder`,m,"action"),maxLength:o,meta:{isInOverlay:T},functions:{onChange:Oe,onChangeData:ye=>{ue(X=>({...X,data:ye}))},onMention:Y,listMembers:L,clickMentionFallback:U,getLinkPreview:V},data:c,autoFocus:x!==!1||C&&!w,"aria-invalid":!!Q,"aria-errormessage":"error-message"}},{component:kge,props:{intlPath:nn,showGuidelines:R,type:m,gtmContext:d}}),D&&ot.push({component:fi}),w&&ot.unshift({id:"title",type:"textarea",value:w.text,limit:250,label:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:ye=>{Ae(X=>({...X,title:ye})),$({title:ye})}},validation:m===at.Poll?[{condition:"required"}]:[]}),B&&ot.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:f.formatMessage({id:`${nn}postType_label`}),options:H.map(ye=>({id:ye.slug,label:ye.name})),validation:[{condition:"required"}],functions:{onChange:ye=>{$({postType:ye}),ye.includes(at.Poll)?p(at.Poll):m!==at.Post&&p(at.Post)}}});let je=!h||!h.id||!r||nt;if(m===at.Poll){const ye=te.polls;je=je||ht||ye<SC||ye>kC}else je=je||gt,x&&(w?je=je||j.body===x.text&&te.title===w.text:je=je||j.body===x.text);return g.jsxs(g.Fragment,{children:[g.jsxs(Zi,{id:Te,className:ee("discussion-card discussion-form",{"no-styling":_&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!nt||l.cancel},functions:{onSuccess:async ye=>{await ke(ye)},onCancel:I},fields:ot,intlPath:nn,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`${x?"save":"submit"}-${m}-click`,"data-testid":"save-button",disabled:je,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:f.formatMessage({id:`${nn}${x?"save":"post"}`}),submitting:f.formatMessage({id:`${nn}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`cancel-${m}-click`,disabled:!l.cancel&&(!h||!h.id||!j.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:f.formatMessage({id:`${nn}cancel`})},gtm:{context:d,event:`${m}-form`},"data-testid":`discussion-${m}-form`,children:[M&&!x&&m===at.Question&&g.jsx("h2",{children:oi(f.formatMessage,`${nn}title`,m,"action")}),g.jsx(Ea,{member:h?{...h,link:!1}:"community",gtmContext:d,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:t||""},{scope:Fn.Platform,area:"all"}]}})]}),te.status==="submitted"&&S&&g.jsx(gl,{className:"success","data-testid":"success",children:oi(f.formatMessage,`${nn}success`,m,"action")}),Q&&g.jsx(gl,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Q=="string"?Q.includes(" ")?Q:f.formatMessage({id:Q},{action:f.formatMessage({id:`discussion_action_${m}`}),maxLength:o}):Q}),y&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:y})]})},Oge=Object.freeze(Object.defineProperty({__proto__:null,default:l1},Symbol.toStringTag,{value:"Module"}));const Nge={showForm:!1},Cp=E.createContext(Nge),cD=({children:e})=>{const[t,n]=E.useState({showForm:!1});return g.jsx(Cp.Provider,{value:{...t,updateConversation:n},children:e})};function Ige({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:o}){var d;const s="discussion_",l=me.useIntl(),u=(d=i==null?void 0:i.componentProps)==null?void 0:d.member.additionalContent,c=u?u.customMessage:void 0;return g.jsxs("div",{className:"author-section",children:[g.jsx(Ea,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:c},className:ee({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!c},gtmContext:a,gtmType:"profile-click",badges:o}),i.pinned&&g.jsx(Fi,{variant:"naked",size:"xlarge",icon:"pin",children:g.jsx(xt,{children:l.formatMessage({id:`${s}pinned_post`})})})]})}const K0=({children:e,class:t,...n})=>{const r={...n,class:ee("subtle",t)};return g.jsx("blockquote",{...r,children:e})};function Pge({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?g.jsx(g.Fragment,{}):g.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?g.jsx(g.Fragment,{}):g.jsx(Fi,{size:"small",element:"li",children:n.name},n.slug))})}var fh=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(fh||{});const Rge=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,Fge=(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 o=e.parentElement;if(o)for(i=n==="next"?o.firstElementChild:o.lastElementChild,a=n==="next"?0:o.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 Mge=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:o=!1,isTabbable:s=!1,functions:l})=>{var y;const[u,c]=E.useState(t.hasUserVoted);let d=0,f={};const h=(i||!o)&&!t.hasUserVoted;a&&(d=Math.round(t.numVotes/r*100)||0,f={"--vote-perc":`${d}%`});const m=v=>{v.stopPropagation(),h&&(l==null||l.createVote(t),c(!0))},p={htmlFor:t.id,className:ee({"can-vote":h}),tabIndex:s&&h?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:m,onKeyDown:v=>{var b;if(v.code!=="Tab")switch(v.code){case"Enter":case"Space":v.preventDefault(),v.stopPropagation(),m(v),c(!0);break;case"ArrowUp":case"ArrowDown":v.stopPropagation(),v.preventDefault();const _=v.code==="ArrowUp"?"prev":"next",{nextElement:T,nextIndex:C}=Fge(v.currentTarget.parentElement,"selected",_,n);T&&((b=T.querySelector("label"))==null||b.focus(),l==null||l.setTabbableOption(C));break}}};return g.jsxs("li",{"data-testid":"poll-option",style:f,className:ee("poll-option text-small",{selected:t.hasUserVoted}),children:[g.jsx("label",{...p,children:g.jsx("span",{children:t.label})}),a&&g.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&g.jsx(ka,{className:"author-profile-picture",name:e.name,src:(y=e==null?void 0:e.image)==null?void 0:y.thumbnail}),g.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[d,"%"]})]}),g.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const dD=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=me.useIntl(),o=E.useContext(fn),{showRemoveVote:s=!1,allowMultipleVotes:l=!1,resultsVisibility:u=fh.AfterVoting}=n||{},[c,d]=E.useState(Rge(t,l,o==null?void 0:o.id)),f=t.reduce((v,b)=>v+b.numVotes,0),h=t.filter(v=>v.hasUserVoted).length,m=t.filter(v=>v.hasUserVoted),p=E.useCallback(async v=>{await r.createVote({reactionId:v.id})},[]),y=E.useCallback(async()=>{t.forEach(async v=>{v.hasUserVoted&&v.userVote&&r.removeVote({reactionId:v.userVote.id})})},[t]);return g.jsxs("div",{className:"poll-wrapper",children:[g.jsx("p",{className:"poll-title",children:e}),g.jsxs("aside",{className:"poll-info",children:[g.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:g.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),g.jsx("p",{className:"poll-num-votes",children:g.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:f})})}),s&&g.jsx("p",{className:"poll-remove-vote",children:g.jsx(Ke,{variant:"tertiary",onClick:y,"data-testid":"remove-votes-button",disabled:h===0,children:g.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:h})})})})]}),t&&g.jsx("form",{children:g.jsx("fieldset",{children:g.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((v,b)=>g.jsx(Mge,{isTabbable:c===b,user:o,option:v,optionIndex:b,totalPollVotes:f,showResults:u==fh.Always||!!h,allowMultipleVotes:l,hasVotedOnPoll:!!h,functions:{createVote:p,setTabbableOption:d}},v.id))})})}),g.jsxs(xt,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:h}),!!h&&g.jsx("ul",{children:m.map(v=>g.jsx("li",{children:v.label}))})]})]})};function Bge({content:e,contentData:t,functions:n}){return g.jsx(dD,{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 Lge({links:e={},contentData:t,postCutOff:n,content:r}){var i;return g.jsxs(g.Fragment,{children:[e.post?g.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?g.jsx(e3,{text:t.postBody,markdownOptions:{overrides:{a:ng,blockquote:{component:K0}}}}):g.jsx(Xo,{options:{overrides:{a:ng,blockquote:{component:K0}}},children:t.postBody})]}):g.jsxs(g.Fragment,{children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),g.jsx(Xo,{options:{wrapper:r.type===at.Question?"h1":E.Fragment,forceWrapper:r.type===at.Question,forceInline:r.type===at.Question,forceBlock:r.type!==at.Question,overrides:{blockquote:{component:K0}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?g.jsx(Qv,{data:t.data.link}):g.jsx(g.Fragment,{})]})}const ti="discussion_",$ge=195;let gd=null;const u1=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:o,functions:s,links:l={},className:u,gtmContext:c="DiscussionAnswer",children:d,isTruncated:f=!1,setFocus:h=!1,isCommunity:m=!1,badges:p,basePath:y,parentId:v,locale:b="en",disableMentions:_})=>{var je,re,ge,Ne,ye,X;const T=me.useIntl(),C=E.useContext(Cp),x=E.useContext(fn),{createContent:w=async()=>{},deleteContent:P=async()=>{},updateContent:O=async()=>{}}=s.content||{},{createLike:M=()=>{},deleteLike:R=()=>{},listLikes:D=async()=>({})}=s.likes||{},{openComments:S=()=>{}}=s.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:H=()=>{}}=s.form||{},{createVote:$=()=>{},removeVote:F=()=>{},removePoll:ne=()=>{}}=s.polls||{},{author:J,createdAt:I,id:A,likes:Y=0,userLiked:L,comments:U=0,data:V}=t,z=fI(t.title,b),j=x&&x.id&&typeof J!="string"&&J.id&&J.id===x.id||!1,ue=j&&(!t.createdAt||VD(t.createdAt,10,"seconds")),Q=E.useRef(null),[ie,le]=E.useState({title:t.body!==z&&z||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[te,Ae]=E.useState(!1),[Oe,Te]=E.useState(ue?"highlighted":"default"),[se,ve]=E.useState("");E.useEffect(()=>{const he=Q.current;if(!(!he||Oe==="default"))return document.addEventListener(bn.DISCUSSION_FORM_SUBMITTED,ke),he.addEventListener("transitionend",Fe),()=>{document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,ke),he.removeEventListener("transitionend",Fe)}},[]),E.useEffect(()=>{le(he=>({...he,title:t&&z||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),E.useEffect(()=>{(async()=>{const xe=await Yv(ie.body,f,V==null?void 0:V.mentions,B);le(Ue=>({...Ue,postBody:xe}))})()},[ie.body,V==null?void 0:V.mentions]);const ke=()=>{setTimeout(()=>{Te("fading")},1e3)},Fe=({propertyName:he})=>{he==="background-color"&&Te(xe=>(xe==="default"&&(document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,ke),Q.current&&Q.current.removeEventListener("transitionend",Fe)),xe==="fading"?"default":xe))};if(i||!t||t.type===at.Answer&&(!t.slugs||!t.slugs.question)||ie.postBody===""&&t.title==="")return g.jsx(qr,{className:"discussion-card"});const ht=async({title:he,body:xe,data:Ue})=>{he||(he=""),xe||(xe=""),ve("");try{if(!cf(he,ie.title)||!cf(xe,ie.body)){const St=t.type===at.Question?{title:xe}:{title:he,body:xe,data:Ue};await O(sg(t.slugs),St)}le(St=>({...St,title:he||"",body:xe||"",data:{...St.data,...Ue},isEditing:!1,didEdit:!0}))}catch{ve(`${ti}form_error`)}},gt=()=>{if(C&&C.updateConversation){const he={showForm:!0},xe=t.author;xe&&xe.id&&!_&&(m&&(he.prepopulateForm=`@{{${xe.id}}}`),he.mentionData={id:xe.id,name:xe.name}),C.updateConversation(he)}setTimeout(()=>{var vt,kt,sn;const xe=`reply-form-${(t.type===at.Answer?t.slug:((vt=t.slugs)==null?void 0:vt.reply)||((kt=t.slugs)==null?void 0:kt.answer)||((sn=t.slugs)==null?void 0:sn.question)||"").toLowerCase().slice(-15)}`,Ue=document.getElementById(xe),St=document.getElementById(`${xe}-input`);St&&St.focus(),Ue&&Ue.scrollIntoView({behavior:"smooth"})},0)},nt=async()=>{Ae(!1);try{t.type===at.Poll?(await ne(),window.location.href=`${y}/${v}`):await P(sg(t.slugs))}catch{ve("delete-error")}},ot=[];return n&&j&&(t.type!==at.Poll&&ot.push({text:T.formatMessage({id:`${ti}moreMenu_edit`}),onClick:()=>le(he=>({...he,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),ot.push({text:T.formatMessage({id:`${ti}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),Ae(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`delete-${t.type}-click`,...D3(`delete-${t.slug}-modal`,te)})),r&&s.pins&&ot.push({text:T.formatMessage({id:`${ti}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?s.pins.deletePin:s.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),h&&((je=Q==null?void 0:Q.current)==null||je.focus(),(re=Q==null?void 0:Q.current)==null||re.scrollIntoView({behavior:"smooth"})),E.createElement(e,{className:ee("discussion-post",u,{[Oe]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!ie.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Q,tabIndex:h?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${c}-post-click`,onClick:he=>{if(!l.post||ie.isEditing||t.type===at.Poll&&dI(he,["poll-options","poll-info"],"discussion-post"))return;he.preventDefault(),he.stopPropagation(),gd&&clearTimeout(gd),gd=setTimeout(()=>{window.location.href=l.post},150);const xe=new CustomEvent(bn.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:gd}});document.dispatchEvent(xe)},children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{id:A||t.slug,className:ee("discussion-card text-medium",t.type,{editing:ie.isEditing,"has-link":l.post&&!ie.isEditing}),children:[!ie.isEditing&&g.jsx(Ige,{author:J,originalAuthorId:a,createdAt:I,contentData:{didEdit:ie.didEdit},content:t,gtmContext:c,badges:p}),ie.isEditing?g.jsx(l1,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:ie.title!==""?{text:ie.title}:!1,isEditing:{text:ie.body,categories:[]},canBePrepopulated:m,isPrepopulated:!1},maxLength:t.type===at.Question?250:5e4,forceShow:{error:se!==""&&se!=="delete-error"?T.formatMessage({id:se},{action:T.formatMessage({id:`${ti}action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:ht,handleCancel:()=>{ve(""),le(he=>({...he,isEditing:!1}))},listMembers:B,clickMentionFallback:H},gtmContext:`${c}Form`,data:V}):g.jsxs(g.Fragment,{children:[t.type===at.Poll?g.jsx(Bge,{content:t,contentData:ie,functions:{createVote:$,removeVote:F}}):g.jsx(Lge,{links:l,contentData:ie,postCutOff:$ge,content:t}),g.jsx(Pge,{content:t})]}),!ie.isEditing&&!(o!=null&&o.actionBar)&&g.jsx(V3,{className:t.type,gtmContext:c,contentType:t.type,likes:o!=null&&o.likes?!1:{count:Y||0,userLiked:L||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:M,deleteLike:R,listLikes:D},basePath:y,parentId:v},comments:!(o!=null&&o.comments)&&([at.Question,at.Post].includes(t.type)||l.comments)?{count:U||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof S=="function"&&S()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:gt}}:!1,shareLink:!(o!=null&&o.shareLink)&&{url:`${window.location.origin}${(ge=t.slugs)==null?void 0:ge.question}/${(Ne=t.slugs)==null?void 0:Ne.answer}${(ye=t.slugs)!=null&&ye.reply?`#${(X=t.slugs)==null?void 0:X.reply}`:""}`},moreMenu:!(o!=null&&o.moreMenu)&&{options:ot,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),d,g.jsx(Sa,{id:`delete-${t.slug}-modal`,isOpen:te,functions:{onOpen:()=>{},onClose:()=>Ae(!1)},forceShow:{error:se==="delete-error"?T.formatMessage({id:"${intlPath}delete_error"},{action:T.formatMessage({id:`${ti}action_${t.type}`})}):!1},title:T.formatMessage({id:`${ti}delete_title`},{action:T.formatMessage({id:`${ti}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>Ae(!1),children:T.formatMessage({id:`${ti}delete_cancel`})},{variant:"primary",className:"destructive",onClick:nt,children:T.formatMessage({id:`${ti}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:g.jsx(me.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>g.jsx("p",{children:he}),action:T.formatMessage({id:`${ti}action_${t.type}`})}})})]})})};const jge=E.lazy(()=>Promise.resolve().then(()=>eve)),Hge=65,fD=({forceShow:e,form:t,className:n})=>{const r=me.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",s=E.useContext(fn)||"community",l=Eh(s);l.name||(l.name=r.formatMessage({id:`member_${typeof s=="string"?s:"community"}`}));const u=lo(!0,!1),c=u?u<768:0,{modal:d=!1}=e||{},[f,h]=E.useState({form:d||YC("showPost")==="true"||!1,warning:!1}),[m,p]=E.useState({showCachedText:!1});E.useEffect(()=>{if(!m.showCachedText)return;(async()=>{const _=await Yv(m.title||m.body||"",Hge,m.mentions);p(T=>({...T,prettifiedText:_}))})()},[m.showCachedText,m.title,m.body]);const y=b=>{if(!m.showCachedText||typeof f.warning=="string")return;let _;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),_=b.detail.link;else{const T=b;T.preventDefault(),T.stopPropagation();const x=T.target.closest("a");_=x&&x.getAttribute("href")}h(T=>({...T,warning:_||!1}))};E.useEffect(()=>{if(!m.showCachedText){document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y);return}return document.addEventListener(bn.DISCUSSION_POST_CLICKED,y),document.addEventListener(bn.MEMBER_CLICKED,y),document.addEventListener("click",y),()=>{document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y)}},[m.showCachedText]),E.useEffect(()=>{const b=_=>{if(!(!m.showCachedText||f.warning!==!1))return _.preventDefault(),_.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[m.showCachedText,f.warning]);let v=r.formatMessage({id:`${i}placeholder${c?"":"_long"}`});return m.showCachedText&&(m.title||m.body)&&(v=m.prettifiedText||v),g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:ee("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(_=>({..._,form:!0}))},"data-testid":"discussion-form-card",children:[g.jsx(ka,{name:l.name,src:l.image,alt:""}),g.jsx(Xo,{className:ee("input",{placeholder:!m.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Pr,blockquote:Pr,br:Pr,em:Pr,li:Pr,ol:Pr,p:Pr,s:Pr,span:Pr,strong:Pr,ul:Pr}},children:v})]}),g.jsxs(Ml,{children:[g.jsx(jge,{showModal:f.form,functions:{cacheText:p,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:m,className:"in-portal"}),g.jsx(Sa,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:f.warning!==!1,functions:{onClose:()=>{h(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:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:g.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},Uge=E.lazy(()=>Promise.resolve().then(()=>Oge)),u5=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:o,leave:s,notMemberStateText:l},locale:u=yl})=>{if(a&&!i)return g.jsx(Ui,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:g.jsx(Uv,{isShort:!0,functions:{join:o,leave:s}})}});const{content:c,functions:d,meta:f,...h}=t,m={content:{type:(c==null?void 0:c.type)||"reply",slugs:(c==null?void 0:c.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...f,isEditing:(f==null?void 0:f.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...h,id:`add-post-${h.id||""}`};return e?g.jsx(fD,{form:m}):g.jsx(Uge,{...m})},c5=({form:e})=>{const t=E.useContext(fn),n=me.useIntl(),[r,i]=E.useState(!1),a=()=>{eO(t)||i(!0)};E.useEffect(()=>{if(e&&!(e!=null&&e.isDisabled)||(e==null?void 0:e.isDisabled)===void 0)return document.addEventListener(bn.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(bn.DISCUSSION_POST_ADDED,a)}});const o={};return["successMessage","title","text"].forEach(s=>{o[s]=n.formatMessage({id:`profileModalLauncher_${s}`})}),g.jsx(xp,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:o})};const G0="discussion_responses_",hD=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=me.useIntl();return t=parseInt(t),g.jsxs("div",{className:"responses-heading",children:[g.jsx("h4",{children:r.formatMessage({id:`${G0}title`},{action:r.formatMessage({id:`${G0}${e}`}),count:t})}),!n&&t===0&&g.jsx("p",{children:oi(r.formatMessage,`${G0}empty`,e,e)})]})};const pD=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=me.useIntl(),o=E.useContext(Cp),s=Ed(i,{element:"li"});if(o.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:o.prepopulateForm},o.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=o.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:o.mentionData},r.data=l,r.meta.isAutoFocused=!0}return g.jsxs("div",{className:ee("thread-wrapper",{"empty-thread":!s}),children:[!Object.is(s,null)&&g.jsx("ul",{className:"thread",children:s}),!e&&g.jsx(Vc,{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&&o.showForm&&g.jsx(l1,{...r})]})};function zge(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,o;(o=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&o.length&&(t=!0)}),t}function Vge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:o}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:s})=>t(l=>(N3({activity:l,reactionId:s,user:a}),l)),onError:n,onSuccess:(s,{reactionId:l},u)=>{u&&I3({activity:u,reactionId:l,correctReactionId:s.body.id,user:a}),r.setQueryData(i,u)}});return o}function qge({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Rt.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(o=>(o&&(i!=null&&(o.content=i),a!=null&&(o.title=a)),o)),onError:n});return r}function Wge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&vf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&vf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function Kge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&yf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&yf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function Gge({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Rt.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function Yge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(o=>(P3({activity:o,reactionId:a}),o)),onError:n});return i}function Zge({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:o,removeVote:s},queryKey:l}){const u=Rt.useQueryClient(),c=yh(),d={queryClient:u,queryKey:l},f={mutationHandlers:{error:zv(d),mutate:Vv(d)},user:c,...d},h=qge({...f,mutationFn:t}),m=Wge({...f,mutationFn:n}),p=Qge({...f,mutationFn:r}),y=Kge({...f,mutationFn:i}),v=Xge({...f,mutationFn:a}),b=Vge({...f,mutationFn:o}),_=Yge({...f,mutationFn:s}),{activity:T,...C}=Gge({queryKey:l,queryFn:e});return{activity:T,mutations:{edit:h,like:m,unlike:p,pin:y,unpin:v,createVote:b,removeVote:_},user:c,...C}}function Qge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>t(o=>(o&&R3({activity:o,user:r}),o)),onError:n});return i}function Xge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(o=>(o&&F3({activity:o,user:r}),o))),onError:n});return i}const Jge=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...o},likes:s,reactions:l,form:u,join:c,leave:d,polls:f},profile:h,categories:m,locale:p=yl,type:y=Cn.Communities})=>{var U,V,z,j,ue,Q,ie,le,te,Ae,Oe,Te;const v=me.useIntl(),b=E.useContext(fn),_={...o,...f},{activity:T,error:C,isLoading:x,mutations:{edit:w,like:P,unlike:O,pin:M,unpin:R,createVote:D,removeVote:S}}=Zge({queryFns:_,queryKey:[e,t,n]});if(x)return g.jsx(qr,{style:{height:"400px"}});if(C||!T)return g.jsx(Ui,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:B,verb:H,latest_reactions:$,mentioned_users:F,additional_data:ne}=T,J=(((U=$==null?void 0:$.like)==null?void 0:U.length)||0)>0,I=!!((V=B==null?void 0:B.like)!=null&&V.find(se=>{var ve;return((ve=se.user)==null?void 0:ve.id)===(b==null?void 0:b.id)})),A=I?B==null?void 0:B.like[0].id:"",Y=J?(z=$==null?void 0:$.like)==null?void 0:z.map(se=>{var ve,ke,Fe;return{id:(ve=se==null?void 0:se.user)==null?void 0:ve.id,name:(Fe=(ke=se==null?void 0:se.user)==null?void 0:ke.data)==null?void 0:Fe.name}}):!1,L=T==null?void 0:T.actor;return g.jsxs("section",{className:"activity-section",children:[g.jsx(u1,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:H,title:T==null?void 0:T.title,body:y===Cn.Courses?zN({content:T.content,locale:p}):T==null?void 0:T.content,categories:Zv((T==null?void 0:T.categories)||[],m||[]),createdAt:(T==null?void 0:T.time)||"",slugs:{question:`${e}/${t}`,answer:T==null?void 0:T.id},slug:n,author:Ll(L),userLiked:I,likes:((j=T==null?void 0:T.reaction_counts)==null?void 0:j.like)||0,comments:(T==null?void 0:T.total_replies)||0,peopleWhoLiked:y===Cn.Courses?!1:Y,data:{mentions:F,...ne||{}},pinned:((ue=T==null?void 0:T.reaction_counts)==null?void 0:ue.pin)&&((Q=T==null?void 0:T.reaction_counts)==null?void 0:Q.pin)>0||!1,pollOptions:O3(T,p),pollSettings:{showRemoveVote:(ie=T==null?void 0:T.settings)==null?void 0:ie.show_remove_vote,allowMultipleVotes:(le=T==null?void 0:T.settings)==null?void 0:le.allow_multiple_votes,deadlineAt:(te=T==null?void 0:T.settings)==null?void 0:te.deadline_at,hideParticipants:(Ae=T==null?void 0:T.settings)==null?void 0:Ae.hide_participants,numberOfWinners:(Oe=T==null?void 0:T.settings)==null?void 0:Oe.number_of_winners,resultsVisibility:(Te=T==null?void 0:T.settings)==null?void 0:Te.results_visibility}},originalAuthorId:L==null?void 0:L.id,forceHide:{comments:!0,shareLink:y===Cn.Courses},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(se,{title:ve,body:ke})=>w({title:ve,content:ke})},likes:{createLike:()=>P({activityId:n}),deleteLike:()=>O({activityId:n,reactionId:A}),listLikes:se=>s.list({activityId:n,...se})},comments:{openComments:()=>{}},pins:{createPin:()=>M({activityId:n}),deletePin:()=>{var se;return R({activityId:n,reactionId:(se=$==null?void 0:$.pin)==null?void 0:se[0].id})}},polls:{createVote:({reactionId:se})=>D({reactionId:se}),removeVote:({reactionId:se})=>S({reactionId:se}),removePoll:()=>f.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:t||""},{scope:Fn.Platform,area:"all"}]},basePath:e,parentId:t},n),g.jsx(j3,{basePath:e,parentId:t,activityId:n,showReplies:H===at.Poll?zge(T):!0,activityTotalReplies:(T==null?void 0:T.total_replies)||0,isMember:r,functions:{reactions:l,likes:s,form:u,join:c,leave:d},profile:h,type:y})]})};const mD=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=me.useIntl(),o="discussionFormModal_",{onClose:s=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:d}=n,{title:f="",body:h="",mentions:m}=r||{},p="discussion-form-modal";return g.jsx(Sa,{id:p,title:a.formatMessage({id:`${o}title`}),isOpen:e,functions:{onClose:()=>{(f!==""||h!=="")&&l(y=>({...y,showCachedText:!0})),s()}},className:ee("discussion-form-modal",i),children:g.jsx(l1,{...n,data:{...u,mentions:m||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${p}-overlay`,hasTitleField:{text:f},isPrepopulated:{text:h||(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:`${o}cta`})},functions:{...d,onChange:y=>{l(v=>({...v,...y}))},onMention:({id:y,name:v}={})=>{if(!y||!v)return;const b=m||{};b[y]={created_at:"",updated_at:"",id:y,data:{name:v}},l(_=>({..._,mentions:b}))},create:async y=>{s(),d.create&&await d.create(y),l({showCachedText:!1})},createPoll:async y=>{const v=()=>{s(),l({showCachedText:!1})};if(d.createPoll)try{const b=await d.createPoll(y);return new Promise(_=>(v(),_(b)))}catch{return new Promise((_,T)=>T())}else return v(),new Promise(b=>b({}))},handleSaveEdit:async y=>{s(),d.handleSaveEdit&&await d.handleSaveEdit(y),l({showCachedText:!1})}}})})},eve=Object.freeze(Object.defineProperty({__proto__:null,default:mD},Symbol.toStringTag,{value:"Module"}));const tve=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:o,showIcon:s,onClose:l,reportError:u=()=>{},sendInvites:c})=>{const d=me.useIntl();return i||(i=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),o||(o=d.formatMessage({id:"inviteModal_cta"})),g.jsx(Sa,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:l},className:ee("invite-modal",e,{success:!!n}),children:g.jsx(Sw,{title:i,label:a,messagePlaceholder:r,ctaMessage:o,onClose:l,sendInvites:c,reportError:u})})};const nve=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:o})=>{const s=me.useIntl(),[l,u]=E.useState(YC("showProfile")==="true"||e);E.useEffect(()=>{u(e)},[e]);const{onClose:c=()=>{}}=i;return g.jsx(Sa,{id:"profile-form-modal",title:t||n||s.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:c},className:ee("profile-modal",o,{success:!!t}),maxWidth:700,children:g.jsxs(g.Fragment,{children:[t&&n||r?g.jsxs("div",{className:"intro",children:[t&&n?g.jsx("h3",{children:n}):"",r?g.jsx("p",{children:r}):""]}):null,g.jsx(Dw,{...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()}}}})]})})},xp=nve,rve=Object.freeze(Object.defineProperty({__proto__:null,default:xp},Symbol.toStringTag,{value:"Module"}));const ive=({members:e})=>{const[t,n]=E.useState(!1),r=i=>{const{fullName:a,jobTitle:o,organisation:s,photo:l}=i||{};return g.jsxs(g.Fragment,{children:[g.jsx(ka,{name:a,src:l}),g.jsx("p",{children:a}),g.jsx("small",{className:"text-medium",children:s?`${o}, ${s}`:o})]})};return g.jsxs("div",{className:"directory-wrapper",children:[g.jsx("ul",{className:"directory",children:e.map(i=>g.jsx("li",{children:g.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),g.jsx(Sa,{isOpen:t!==!1,children:t===!1?"":g.jsxs(g.Fragment,{children:[r(t),g.jsx(Xo,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const ave=({email:e,settings:t={}})=>{const{formatMessage:n}=me.useIntl(),r=E.useContext(fn),{myProfile:i,isConnected:a,cannotConnect:o}=t,[s,l]=E.useState(!1),[u,c]=E.useState(!1);return r?e&&i?g.jsx(Ke,{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}):o?g.jsx(Ke,{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?g.jsx(g.Fragment,{children:s?g.jsx(Ke,{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}):g.jsx(Ke,{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"})})}):g.jsx(g.Fragment,{}):g.jsx(Ke,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},className:"show-email fake-button",children:n({id:"member_show_email_hide"})}):g.jsx(g.Fragment,{})};const ove=({author:e,authorCite:t,content:n,member:r,className:i=""})=>g.jsxs("blockquote",{className:ee("testimonial-block",i),children:[g.jsx(Ri,{className:"testimonial",children:n}),r?g.jsx(Ea,{member:r,styling:{size:"large"}}):g.jsxs(g.Fragment,{children:[e&&g.jsx("p",{className:ee("author",{"text-small":!i.includes("new")}),children:e}),t&&g.jsx("p",{className:ee("author-cite",{"text-small":!i.includes("new")}),children:g.jsx("cite",{children:t})})]})]}),sve=E.memo(ove);const lve=({items:e=[],selector:t="",className:n=""})=>{const r=me.useIntl(),[i,a]=E.useState(e);return E.useEffect(()=>{if(e.length)return;let o="";Array(6).fill(0).forEach((u,c)=>{o+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(o)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));a(l)},[]),i&&i.length>0&&g.jsxs(Er,{variant:"subtle",className:ee("table-of-contents",n),children:[g.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),g.jsx("nav",{children:g.jsx("ul",{children:i.map(({id:o,text:s})=>g.jsx("li",{children:g.jsx("a",{href:`#${o}`,children:s})},o))})})]})};const wp=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=me.useIntl(),o="timeToComplete_";if(!e||typeof e!="number")return null;const s=c=>{const d=c/60,f=Math.floor(d),h=(d-f)*60,m=Math.round(h),p=`${a.formatMessage({id:`${o}hours`},{time:f})}${f>0&&m>0?", ":""}${a.formatMessage({id:`${o}minutes`},{time:m})}`;return{text:`${f>0?`${a.formatMessage({id:`${o}hours_short`},{time:f})} `:""}${m>0?a.formatMessage({id:`${o}minutes_short`},{time:m}):""}`,ariaText:p}};let{text:l,ariaText:u}=s(e);if(t){const{text:c,ariaText:d}=s(e+t);l=a.formatMessage({id:`${o}range`},{early:l,late:c}),u=a.formatMessage({id:`${o}range_aria`},{early:u,late:d})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),g.jsx("span",{className:ee("time-to-complete",i),"aria-label":u,children:l})};const uve=({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",g.jsx(co,{...n,className:ee("banner",e),image:{...t,aspect:"banner"}})):null;const cve=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],dve=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:o={eyebrow:!1,title:!1,text:!1},cta:s,children:l})=>{var m,p;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(y=>{if(!t[y]){f[y]=!1;return}if(!o[y]){if(typeof t[y]=="object"){f[y]=t[y];const{text:v,element:b}=t[y];if(b&&cve.includes(b.toLowerCase()))return;f[y]={text:v,element:d[y]};return}f[y]={text:t[y],element:d[y]}}});const h=s&&s.text&&s.link;return h&&s.link[0]==="#"&&(s.props||(s.props={}),s.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(s.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),g.jsx(mo,{className:ee("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&i==="normal"&&f.eyebrow&&f.title}),children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(f[y]&&typeof f[y]=="object"){const{text:v,element:b=""}=f[y];return y==="text"?g.jsx(Xo,{overrideType:"text-only",className:"text",children:v},y):E.createElement(b,{key:y,className:y},v)}return null}),l,h&&g.jsx(Ke,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:s.link,...s.props,className:ee({new:r==="subtle",[(m=s.props)==null?void 0:m.className]:(p=s.props)==null?void 0:p.className}),children:s.text})]}),n&&g.jsx(co,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},fve=E.memo(dve);const hve=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),g.jsx(mo,{className:ee("custom-content-banner",t,r,{"has-image":e}),style:i,children:g.jsx("div",{className:"content-slim",children:n})})};const pve=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?g.jsx(Xo,{children:n}):n;return g.jsxs(mo,{className:ee("highlight-section",t),children:[r&&g.jsx("div",{className:ee("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:g.jsx(co,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),g.jsx("div",{className:ee("highlight-container highlight-content-wrapper",{"no-image":!r}),children:g.jsx("div",{className:ee("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:g.jsx("div",{className:"content-default",children:i})})})]})},mve=E.memo(pve);const gve=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:g.jsxs("aside",{className:ee("marketing-block",e),children:[n&&g.jsx("p",{className:"title",children:n}),r&&g.jsx("p",{children:r}),t&&g.jsx(Ke,{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})]}),vve=({type:e,data:t})=>{const n=me.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:o,pill:s,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const d=i&&J0(i);return g.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&g.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||o)return g.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):Dv(c)});if(s)return g.jsx(Fi,{variant:s==="free"?"subtle":"highlighted",className:s,"data-testid":"course-type",children:s});if(l||u){const d=u&&J0(u);return g.jsxs("ul",{className:"details",children:[l&&g.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&g.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},yve={title:66,text:3e3,secondaryText:1e3,partner:34},hh={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"}},bve=({data:e,cta:t,link:n,gtmContext:r})=>{var p,y;const i=me.useIntl(),[a,o]=E.useState({loading:!1,registered:e.registered||!1});E.useEffect(()=>{e.registered&&o(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:s,startDate:l,dateHasPassed:u,pill:c,slug:d}=e,f=e.contentType;let h="";if((p=hh[f])!=null&&p.gtmEvent&&(h=hh[f].gtmEvent),l&&u)return n?g.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_watch"})}):null;if(f==="people")return n?g.jsx(Ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_cta_people"})}):null;const m=["communityPage","microcourse","event"];if(t&&t.onClick&&m.includes(f)&&c!=="premium"){const v=a.loading||a.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),b=async _=>{var T;if(_.preventDefault(),_.stopPropagation(),window&&((T=window.dataLayer)==null||T.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)){o(C=>({...C,loading:!0}));try{const C=await t.onClick(e);o(C==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{o(x=>({...x,loading:!1}))}}};return g.jsx("p",{className:ee("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:g.jsx(Ke,{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:s||i.formatMessage({id:`card_cta_${f}${v?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Eve({buildMemberData:e,communitySlug:t}){const n=me.useIntl(),r=E.useContext(fn),[i,a]=E.useState({count:"...",isMember:!1,memberType:""});return E.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(o=>{if(!o)return;const{membersCount:s,role:l="",pagination:u}=o;let c=0;s?c=s:u!=null&&u.total&&(c=u==null?void 0:u.total),a({count:c.toString(),isMember:!!l,memberType:l})})},[t,e]),g.jsxs("span",{className:"member-information",children:[i.isMember&&g.jsx(Fi,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),g.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const d5=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:o="Carousel",handleCardClick:s,meta:l})=>{var S,B;const u=me.useIntl(),c=E.useContext(fn),d=!!(c!=null&&c.id),{isTabbable:f=!0,setFocus:h=!1}=l||{},m=E.useRef(null),[p,y]=E.useState({data:null,isLoading:!0});E.useEffect(()=>{n(i,d).then(H=>{y({data:H,isLoading:!1})}).catch(()=>y(H=>({...H,isLoading:!1})))},[i,d,n]);const{data:v,isLoading:b}=p;if(b||!v)return g.jsx(qr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:s});const{contentType:_}=v;if(!_||!hh[_])return g.jsx(qr,{element:"li",className:"card-wrapper"});const{basePath:T="",className:C,length:x,gtmEvent:w}=hh[_];let P=f&&v.slug?`${v.locale||""}${T}${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")&&(P=v.slug);const O=H=>{if(P){H.preventDefault(),H.stopPropagation();const $=H.currentTarget.getAttribute("data-url");window&&window.dataLayer.push({event:"gtm.click","gtm.element":$,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":$,EventType:`${o}-CarouselCard`,EventContext:`${w}-click`}),window.location.href=$}},M={...yve,...x};let R={className:"card"},D={};return P&&(D={href:P,className:"gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},v.openInNewTab&&(D.target="_blank"),R={onClick:O,className:"card gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),h&&(R={...R,tabIndex:"0"},(S=m==null?void 0:m.current)==null||S.focus(),(B=m==null?void 0:m.current)==null||B.scrollIntoView({behavior:"smooth"})),g.jsx("li",{className:ee("card-wrapper text-medium",C,t,{"has-link":P,"no-link":!P,"has-image":v.banner}),"data-testid":`${_}-card`,children:g.jsxs("div",{...R,ref:m,"data-url":P,children:[g.jsx(QC,{className:"card-label",contentType:_,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),_==="communityPage"&&(v==null?void 0:v.createdAt)&&qD(v==null?void 0:v.createdAt,60)&&g.jsx(Fi,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&g.jsx(Fi,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?u.formatMessage({id:"card_ended"}):WC(v.startDate)}),v.banner?g.jsxs("p",{className:"img",children:[v.registered&&g.jsx(Fi,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),g.jsx(co,{image:{...v.banner,description:""}})]}):C==="people"?g.jsx(ka,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&g.jsx(Bv,{contributors:{data:v.contributors},styling:{size:"small",showGap:C!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(_)?u.formatMessage({id:`card_contributors_${_}`}):void 0,"data-testid":"contributors"}),v.partner&&g.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}):pl(v.partner[0],M.partner)}),["title","text","secondaryText"].map(H=>{const $=v[H];if(!$)return null;const F=HC(H),ne={key:H,className:F,"data-testid":F},J={wrapper:"p",forceWrapper:!0,forceInline:!0},I=pl($,M[H]);return["title","text"].includes(H)&&P?(J.wrapper="a",g.jsx("p",{...ne,children:g.jsx(Ri,{options:J,...D,children:I})})):g.jsx(Ri,{options:J,...ne,children:I})}),i.contentType==="communityPage"&&(i.slug||v.slug)&&r&&g.jsx(Eve,{communitySlug:i.slug||v.slug,buildMemberData:r}),g.jsx(vve,{type:C||"",data:v}),g.jsx(bve,{data:v,cta:a,link:P||"",gtmContext:o})]})})};const gD=({cards:e,cardTypes:t,className:n="",gtmContext:r="",...i})=>g.jsx("ul",{className:ee("card-block",n),children:e.map((a,o)=>{const s=a.slug?`${a.slug}-${t[o]}`:`${t[o]}-${o}`;return g.jsx(d5,{id:s,card:{...a,contentType:t[o]},meta:{setFocus:o===(i==null?void 0:i.focusCardIndex)},...i},`${s}-${r}-${a.title}`)})}),_ve=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),o=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:o}},Tve=({id:e,title:t})=>{const n=me.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:o="medium",link:s}=t;return E.createElement(i,{className:ee("title",a,o,{"highlighted-title":a==="highlighted"}),children:g.jsxs(g.Fragment,{children:[r,s&&g.jsx("a",{href:s,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Y0={fourCards:1024,threeCards:769,twoCards:480};let vd=null,Z0=null;const Cve=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:o,...s})=>{const l=me.useIntl(),u="carousel_pagination_",[c,d]=E.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:h}=c,[m,p]=E.useState({currentPage:0,loadedPages:[0]}),{currentPage:y,loadedPages:v}=m,[b,_]=E.useState(""),T=t.length,C=Math.ceil(T/f),x=E.useRef(null),w=lo(!0,!0,x==null?void 0:x.current);E.useEffect(()=>{let S=1;w&&(w>=Y0.fourCards?S=4:w>=Y0.threeCards?S=3:w>=Y0.twoCards&&(S=2),S>T&&(S=T)),d(B=>({...B,cardsPerPage:S,isLoading:!1}))},[w,T]);const P=(S="next")=>{Z0&&clearTimeout(Z0);let B=y;if(typeof S=="string")if(S==="next")if(y<C-1)B=y+1;else return;else if(y>0)B=y-1;else return;else B=S;_(""),p($=>({...$,currentPage:B,loadedPages:[...new Set([...v,B])]}));const H=()=>{const $=B*c.cardsPerPage,F=$+c.cardsPerPage;return t.slice($,F).length};Z0=setTimeout(()=>{_(l.formatMessage({id:`${u}ariaLive${typeof S=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof S=="string"?S:"next"}`}),slide:typeof S=="string"?1:S+1,count:H()}))},500)},O=S=>{vd=S.touches[0].clientX},M=S=>{if(vd===null)return;const B=S.touches[0].clientX,H=vd-B;H>5?P("next"):H<-5&&P("previous"),vd=null},R={"--width":`${w||0}px`,"--total-cards":T,"--cards-per-page":f,"--page":y};if(h)return g.jsx(bh,{layout:`carousel${i?"-with-title":""}`});const D=(S,B)=>{var $;let H=null;return($=S==null?void 0:S.sys)!=null&&$.id?H=`card-${S.sys.id}`:S!=null&&S.slug?H=`card-${S.slug}`:[n[B],S.contentType].includes("customCard")&&(H=`card-${window.btoa(`${S.title} ${S.createdAt}`)}-${B}`),H};return g.jsxs("section",{ref:x,className:ee("carousel-wrapper",a),"data-testid":"carousel",children:[g.jsx(Tve,{id:e,title:i}),g.jsx("ul",{className:"carousel",onTouchStart:O,onTouchMove:M,style:R,"data-testid":"carousel-list",children:t.map((S,B)=>{let H=D(S,B);const{inView:$,isLoaded:F}=_ve(B,f,y,v);return H&&($||F)?g.jsx(d5,{id:H,card:{...S,contentType:n[B]},buildCardData:r,gtmContext:o,meta:{isTabbable:$},...s},H):(H=H||`${e}-card-${B}`,g.jsx(qr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},H))})}),C<=1?null:g.jsxs(g.Fragment,{children:[g.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[g.jsx("li",{className:"arrow previous",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:S=>{S.preventDefault(),S.stopPropagation(),P("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:y<=0})}),[...Array(C)].map((S,B)=>g.jsx("li",{"data-testid":"carousel-controls-button",children:g.jsx("button",{className:ee("page-indicator",{selected:B===y}),onClick:H=>{H.preventDefault(),H.stopPropagation(),P(B)},children:g.jsx(xt,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:B+1,total:C})})})},`page-indicator-${B}`)),g.jsx("li",{className:"arrow next",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:S=>{S.preventDefault(),S.stopPropagation(),P("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:y>=C-1})})]}),g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},xve=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:o,cards:s,cardsTypes:l},u)=>{const c=a?window.btoa(a):`carousel-${u}`,d=u===e.length-1;return t?g.jsxs(E.Fragment,{children:[g.jsx(bh,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),d?null:g.jsx(fi,{})]},`placeholder-${c}`):g.jsxs(E.Fragment,{children:[g.jsx(Cve,{cards:s,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:o},...i}),d?null:g.jsx(fi,{})]},`carousel-${c}`)});const wve=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:o,isPrivate:s,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`}),E.createElement(e,{className:ee("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:g.jsxs(g.Fragment,{children:[g.jsx("div",{className:ee("img",{private:s,"no-image":!i}),children:i&&g.jsx(co,{image:i})}),g.jsxs("div",{className:"content",children:[a&&g.jsx("p",{className:"title text-medium",children:a}),o&&g.jsx("p",{className:"text text-medium",children:o})]})]})})};const Ave=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:o={},className:s=""})=>{const l=me.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=o;return E.createElement(e,{className:ee("course-progression",s,{"highlight-percentage":c,"has-circle-graph":a==="circle"}),children:g.jsxs(g.Fragment,{children:[g.jsx(Mv,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}}),g.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:d=>g.jsx("strong",{children:d}),number:u})}),u<100&&i&&g.jsx(wp,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})})]})})};const vD=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>E.createElement(e,{className:ee("lesson-name",i),"data-number":`${t}.${n}`,children:r});const yD=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const o=me.useIntl(),s=gh(`lessonType_${i}`)?o.formatMessage({id:`lessonType_${i}`}):zC(i||"");return g.jsxs("small",{className:ee("content-type",{[e]:e!=="default"}),children:[g.jsx("span",{className:ee("type",n),children:s})," ",t>0&&!r&&g.jsx(wp,{time:t})," ",a?g.jsx("span",{className:"additional",children:a}):null]})};const kve=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:o,slug:s,timeLeft:l,title:u},quizScores:c})=>{const d=me.useIntl(),f="courseStructure_",h=u.toLowerCase().includes("course conclusion");return g.jsxs(vh,{className:"course-structure",label:g.jsxs(g.Fragment,{children:[g.jsxs("small",{children:[d.formatMessage({id:`${f}section${h?"_end":""}`},{number:a})," ",!r&&o>=0&&g.jsx("span",{className:"time",children:i&&l===0?d.formatMessage({id:`${f}time_completed`}):g.jsx(wp,{time:o,appendedText:i?d.formatMessage({id:`${f}time_left`}):""})})]}),g.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[g.jsx("p",{children:n}),g.jsx("ol",{children:e&&e.length>0&&e.map(({completed:m,completionTime:p,contentType:y,icon:v,image:b,isIntroduction:_,optional:T,slug:C,subsectionId:x,title:w,type:P})=>{const O=i&&t||_,M={};return b&&(M.style={"--image":`url(${b})`}),g.jsx("li",{className:ee({article:y===Du.ARTICLE,discussion:y===Du.DISCUSSION,quiz:y===Du.QUIZ,completed:m&&y===Du.ARTICLE,locked:!O}),...M,children:g.jsx(fo,{href:O?`/microcourses/en/${s}/${C}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${UC(w)}`,gtmType:"article-click",children:g.jsxs(g.Fragment,{children:[g.jsx(vD,{sectionId:a,subsectionId:x,title:w,className:"course-title"})," ",g.jsx(yD,{completionTime:p,icon:v,optional:T,type:P,children:c&&c[C]&&g.jsx("span",{className:"quiz-score",children:`${c[C]}%`})})]})})},C)})})]})};const Sve=({isComplete:e=!1,onClick:t,...n})=>{const r=me.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),g.jsx(Ke,{...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:ee("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Dve=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),DC=[{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 yd="notFoundError_",Ove=()=>{const e=me.useIntl(),t=[];return DC.forEach((n,r)=>{n.title=e.formatMessage({id:`${yd}post_${r+1}`}),t.push("solutionArticle")}),g.jsxs(sD,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:g.jsxs(mo,{children:[g.jsx(gD,{cards:DC,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),g.jsx(Ke,{href:"/solution-articles/",children:e.formatMessage({id:`${yd}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[g.jsx("h1",{children:e.formatMessage({id:`${yd}title`})}),g.jsx("p",{children:e.formatMessage({id:`${yd}text`})})]})};exports.ASSETS_URL=Hi;exports.ActionBar=V3;exports.ActionButton=bc;exports.ActivitiesFeed=hI;exports.ActivitySection=Jge;exports.ActivityType=Bl;exports.AddPost=u5;exports.Badge=f3;exports.BadgeScope=Fn;exports.Badges=h3;exports.BadgesContext=Nv;exports.BadgesProvider=n3;exports.Banner=uve;exports.BannerSection=fve;exports.Breadcrumbs=RI;exports.Buckets=lO;exports.Button=Ke;exports.ButtonWrapper=Fl;exports.COURSE_CONTENT_TYPES=Du;exports.CacheProvider=r3;exports.Card=d5;exports.CardBlock=gD;exports.Carousel=xve;exports.CharacterLimit=Jv;exports.Checkbox=ey;exports.CollapsibleSection=vh;exports.Columns=K3;exports.CommunityDetails=NN;exports.ConnectionCta=p3;exports.ConnectionDirectionType=Fv;exports.ConnectionStatusType=Rv;exports.ContactFooter=LU;exports.ContactForm=kw;exports.ContentTypeLabel=QC;exports.Contributors=Bv;exports.ConversationContext=Cp;exports.CookieBanner=Pw;exports.CourseProgression=Ave;exports.CourseStructure=kve;exports.CustomContentBanner=hve;exports.CustomEvents=bn;exports.DELETED_USER_ID=gc;exports.Directory=ive;exports.DiscussionContentType=at;exports.DiscussionConversation=cD;exports.DiscussionForm=l1;exports.DiscussionFormCard=fD;exports.DiscussionFormModal=mD;exports.DiscussionPost=u1;exports.DiscussionThread=pD;exports.DiscussionType=Cn;exports.Divider=fi;exports.DownloadSection=RU;exports.EMAILS=zs;exports.EditSection=MU;exports.EmailHelperTextBox=Y3;exports.EmptyStateBox=Ui;exports.EnrichedUrl=Qv;exports.FeatureFlags=o3;exports.Filters=q3;exports.FlagsProvider=a3;exports.Footer=Sy;exports.Form=Zi;exports.Formatting=ae;exports.Fragment=Pr;exports.FullWidthSection=mo;exports.GET_STREAM_USER_PREFIX=X0;exports.GlobalProviders=EO;exports.Header=l5;exports.HelperTextBox=JC;exports.HiddenFromScreenReaders=mh;exports.HideShowTextBox=e3;exports.HighlightSection=mve;exports.HighlightedTextBox=Er;exports.INVALID_TOKEN=VC;exports.IconBulletedList=dO;exports.ImageContainer=iO;exports.IntlProvider=s3;exports.InviteForm=Sw;exports.InviteModal=tve;exports.JoinButton=Uv;exports.Label=Af;exports.LanguageContext=Iv;exports.LanguageSwitcher=MI;exports.LessonName=vD;exports.LessonType=yD;exports.LikesButton=L3;exports.LikesFeed=H3;exports.LikesModal=U3;exports.Link=fo;exports.LoadMore=Vc;exports.LoadingBlock=m3;exports.LoadingPlaceholder=qr;exports.LoadingState=bh;exports.Logo=Xv;exports.LogoSection=BU;exports.MEMBERS_PER_PAGE=lD;exports.MENTION_REGEX=qC;exports.MarkCompleteButton=Sve;exports.MarkdownText=Xo;exports.MarketingBlock=gve;exports.Marks=Pi;exports.Member=Ea;exports.MembersList=uD;exports.Modal=Lv;exports.MoreMenu=bf;exports.NUMBER_OF_COUNTRIES=UD;exports.NUMBER_OF_USERS=HD;exports.NarrowCard=wve;exports.NavigationMenu=W3;exports.NotFoundError=Ove;exports.Overlay=Sa;exports.OverlayContext=Pv;exports.OverlayProvider=c3;exports.PageHeading=d3;exports.PageLayout=sD;exports.Password=Z3;exports.PasswordForm=xU;exports.PasswordRules=tx;exports.Pill=Fi;exports.Poll=dD;exports.Popover=ZC;exports.Portal=Ml;exports.ProfileForm=Dw;exports.ProfileImageChange=Aw;exports.ProfileModal=xp;exports.ProfileModalLauncher=c5;exports.ProfilePicture=ka;exports.ProgressBar=Mv;exports.ProgressTracker=oO;exports.PublishArticleForm=kU;exports.Rating=JI;exports.RepliesFeed=j3;exports.ResponsesHeading=hD;exports.ResponsiveImage=co;exports.ResultsVisibility=fh;exports.ReturnToNavButton=sO;exports.RichTextEditor=ky;exports.STORAGE_KEYS=Sv;exports.SearchForm=Nw;exports.ShareLink=z3;exports.ShareLinks=UI;exports.ShowEmail=ave;exports.SignupForm=PU;exports.Span=ng;exports.StatusBanner=gl;exports.TableOfContents=lve;exports.Tabs=zI;exports.Tags=wge;exports.TestimonialBlock=sve;exports.TimeToComplete=wp;exports.Toggle=TU;exports.Tooltip=ss;exports.TopLevelPage=$U;exports.UUID_V4_REGEX=vc;exports.UserContext=fn;exports.UserProvider=l3;exports.VisuallyHidden=xt;exports.addAriaProps=D3;exports.basicReducer=Rl;exports.camelCaseToDashCase=HC;exports.checkIntlPathExists=gh;exports.courseDiscussionRepliesFeedMock=mI;exports.enrichPostCategories=Zv;exports.generateConditions=Dd;exports.generateCssIcon=zD;exports.getAuthorData=Ll;exports.getCharacterLimitProps=G3;exports.getLongDate=Dv;exports.getMember=Eh;exports.getPostBody=Yv;exports.getShortDate=WC;exports.getValueLength=_h;exports.headerData=zc;exports.likesResponseMock=II;exports.mapGetStreamData=Dve;exports.pageReady=KC;exports.passwordValidator=eg;exports.repliesFeedMock=pI;exports.supportedLanguages=_d;exports.toCamelCase=UC;exports.toCapitalisedCase=jD;exports.toSentenceCase=zC;exports.transformSlugs=sg;exports.useAutoResize=FC;exports.useBadges=t3;exports.useCurrentPath=MC;exports.useEffectAfterMount=ml;exports.useElementWidth=lo;exports.useOverlay=u3;exports.useScrollListener=LC;exports.useScrollToHash=Av;exports.useTooltips=kv;exports.useUser=yh;
571
+ `]))),Ege={storeData:{},unseenCount:0,hasNext:!1,initialLoading:!1,fetchMoreLoading:!1};E.createContext({notificationsData:Ege});function _ge(e){var t=e.workspaceKey,n=t===void 0?"":t,r=e.tenantId,i=r===void 0?"":r,a=e.distinctId,o=a===void 0?"":a,s=e.subscriberId,l=s===void 0?"":s,u=e.inboxId,c=u===void 0?"":u,d=e.stores,f=e.toastProps,h=e.notificationClickHandler,m=e.primaryActionClickHandler,p=e.secondaryActionClickHandler,y=e.bellComponent,v=e.badgeComponent,b=e.notificationComponent,_=e.noNotificationsComponent,T=e.loaderComponent,C=e.tabBadgeComponent,x=e.headerRightComponent,w=e.hideAvatar,P=w===void 0?!1:w,O=e.hideInbox,M=e.hideToast,R=e.theme,D=e.themeType,S=D===void 0?"light":D,B=e.pagination,H=B===void 0?!0:B,$=e.pageSize,F=e.popperPosition,ne=F===void 0?"bottom":F,J=e.showUnreadCountOnTabs,I=J===void 0?!0:J,A=e.host;c&&(l=c);var Y=E.useState(!1),L=Y[0],U=Y[1],V=E.useState(),z=V[0],j=V[1],ue=E.useState({storeData:{},count:0}),Q=ue[0],ie=ue[1],le=E.useState(""),te=le[0],Ae=le[1],Oe=E.useState(!1),Te=Oe[0],se=Oe[1];E.useEffect(function(){var ke=new oQ(n,{pageSize:$,tenantID:i,stores:d,host:A});return j(ke),ke.emitter.on("sync_notif_store",function(){var Fe=ke.feed.data;ie({storeData:(Fe==null?void 0:Fe.stores)||{},count:(Fe==null?void 0:Fe.unseenCount)||0,hasNext:Fe==null?void 0:Fe.hasNext,initialLoading:Fe==null?void 0:Fe.initialLoading,activeStoreId:Fe==null?void 0:Fe.activeStoreId}),Ae(Fe==null?void 0:Fe.activeStoreId)}),ke.emitter.on("new_notification",function(Fe){yge({notificationsData:Fe,toastProps:f})}),function(){ke.emitter.all.clear()}},[]),E.useEffect(function(){L&&l&&z&&z.feed.markAllSeen()},[L,l,z]),E.useEffect(function(){if(!(!l||!z))return ie({storeData:{},count:0}),z.identifyUser(o,l),z.feed.fetchNotifications(),function(){z.resetUser()}},[l,z]);var ve=S==="dark"?rD(Jme,R):R||{};return E.createElement(tD.Provider,{value:ve},E.createElement(eD.Provider,{value:{workspaceKey:n,notificationsData:Q,setNotificationsData:ie,notificationClickHandler:h,primaryActionClickHandler:m,secondaryActionClickHandler:p,bellComponent:y,badgeComponent:v,notificationComponent:b,noNotificationsComponent:_,tabBadgeComponent:C,headerRightComponent:x,toggleInbox:U,inbox:z,loaderComponent:T,pagination:H,hideAvatar:P,activeStore:te,setActiveStore:Ae,changingActiveStore:Te,setChangingActiveStore:se,showUnreadCountOnTabs:I,themeType:S}},!O&&E.createElement(lge,{openInbox:L,toggleInbox:U,popperPosition:ne}),!M&&E.createElement(vge,f)))}const Lt={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const o=`logged${e?"In":"Out"}`;return t>=n[a][o]};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===vr.ACCOUNT&&t===!1&&n[vr.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Lt.handlerCalled[e]&&a-Lt.handlerCalled[e]<500)return;Lt.handlerCalled[e]=a;let o=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(s=>{s===e||n[s]===!1||o.push({type:`menus.${s}`,value:!1})});else{let s=null;switch(e){case vr.SITE:s=document.querySelector("#header .menu-button"),s||(s=document.querySelector("#navigation .navigation-button"));break;case vr.SEARCH:s=document.querySelector("#header .toggle-search-button");break;case vr.ACCOUNT:s=document.querySelector("#header .account-button");break;default:return}s&&s.focus()}r(o)},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=OC(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?Lt.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 o,s;switch(e){case vr.SITE:if(n){const u=Lt.findFirstChild(t.current.children,"className","has-submenu parent"),c=Lt.findFirstChild(u.children,"id",vr.SITE);o=Lt.findFirstChild(c.children,"href")}else o=Lt.findFirstChild(t.current.children,"href");break;case vr.ACCOUNT:if(s=Lt.findFirstChild(t.current.children,"className","account"),!s||!s.children)return;o=Lt.findFirstChild(s.children,"href");break;default:return}o&&(i([{type:`focusElements.${e}.${a}`,value:o.attributes.href.value}]),o.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Lt.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Lt.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Lt.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Lt.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},zc={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},topics:{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:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","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:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},dh=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const o=me.useIntl(),s=OC(zc,e);if(!s||s.onlyShow&&(s.onlyShow==="logged-in"&&!t||s.onlyShow==="logged-out"&&t))return null;const l="doTrack"in s,u=a===null?l?s.doTrack:!0:a,c=e.includes("buttons.");let d=`header_${e.replaceAll(".","_")}`;s.hasVariantText&&(d+=`_logged${t?"In":"Out"}`);let f=!1;if(s.href){let _=s.gtmType||`${e}-click`;if(_.includes(".")){const T=_.split("."),C=T[T.length-2];_=`${C==="topics"?`${C}-`:""}${T[T.length-1]}`}f={href:s.withReturnTo?`${s.href}?returnTo=${window.location.pathname}`:s.href},u&&(f={...f,className:"gtm-trackable","data-gtm-event-type":_,"data-gtm-event-context":"HeaderButtons"}),c&&(f={...f,variant:"secondary",size:{mobile:"small",881:"large"},...s.props||{}})}const h=s.order&&s.order[0]&&s[s.order[0]],m=h&&s[s.order[0]].order,p=f&&window.location.pathname===s.href;let y={},v={},b={};if(p&&(y={...y,"aria-current":"page"}),h){const _=s.menuId||e,T={onClick:C=>Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]}),onFocus:()=>Lt.events.onFocus({id:_}),onBlur:()=>Lt.events.onBlur({id:_,callback:i}),onMouseLeave:()=>Lt.events.onBlur({id:_,callback:i}),onMouseEnter:()=>Lt.events.onMouseEnter({id:_,callback:i})};v={...T,id:_===vr.SITE?vr.SITE:vr.ACCOUNT},n&&(m&&(b={...T,className:"navigation-button",onKeyPress:C=>{C.key==="Enter"&&Lt.events.onClick(C,{id:_,callback:i,isOpen:r[_]})},"aria-haspopup":!0,"aria-expanded":r[_],"aria-controls":_}),v={...v,hidden:_ in r?!r[_]:!0}),m||(v={...v})}return g.jsxs("li",{className:ee({[s.className]:s.className,"has-submenu":h,parent:m,active:p}),...y,children:[f?E.createElement(c?Ke:"a",f,o.formatMessage({id:d})):n&&s.order&&m?g.jsxs("button",{...b,children:[o.formatMessage({id:d}),g.jsx(xt,{children:o.formatMessage({id:`header_menu_${r[vr.SITE]?"hide":"show"}`})})]}):o.formatMessage({id:d}),s.order&&g.jsx("ul",{...v,children:s.order.map(_=>{if(!s[_])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return s[_].order?g.jsxs("li",{className:ee({[s[_].className]:s[_].className}),children:[o.formatMessage({id:`${d}_${_}`}),g.jsx("ul",{children:s[_].order.map(C=>g.jsx(dh,{id:`${e}.${_}.${C}`,...T},C))})]},_):g.jsx(dh,{id:`${e}.${_}`,...T},_)})})]},e)};const Tge=({headerIsVisible:e,locale:t})=>{const n=me.useIntl();return g.jsx("div",{id:"language-unavailable-message",className:ee({visible:e}),children:g.jsx("p",{className:"text",children:n.formatMessage({id:`header_language_unavailable_${t}`},{link:r=>g.jsx("a",{href:"/home",children:r})})})})};const q0={height:67,height_desktop:83,additional_message_height:40};var vr=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(vr||{});const l5=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!0,showLanguageSwitcher:n=!0,onLanguageSwitcherClick:r,suprSendWorkspaceKey:i,novuApplicationIdentifier:a})=>{var B,H;const o=me.useIntl(),s=E.useContext(fn),l=lo(!0,!0),u=s&&typeof s.id=="string",c=E.useMemo(()=>Lt.getIsDesktopVersion(u,l),[u,l]),d=Op("suprsend-notifications")&&i,f=(H=(B=s==null?void 0:s.externalsMetadata)==null?void 0:B.suprsend)==null?void 0:H.subscriberId,h=Op("novu-notifications")&&a,m=Op("language-switcher")&&n,[p,y]=E.useState(!1);E.useEffect(()=>{t&&m&&(s!=null&&s.id)&&(s==null?void 0:s.locale)!==yl&&y(!0)},[t,m,s]);const[v,b]=E.useReducer(Rl,{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:_,menus:T,focusElements:C}=v,x=E.useRef(v);E.useEffect(()=>{x.current=v},[v]),LC({scrollPosition:p?q0[`height${c.navigation?"_desktop":""}`]+q0.additional_message_height:q0[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!0,$,b)},scrollDown:()=>{const $=x.current.menus;!c&&$["site-navigation"]||Lt.shouldChangeHeaderIsVisible(!1,$,b)}}});const w=($,F,ne=!1)=>{Lt.handleMenus({id:$,value:F,menus:x.current.menus,dispatch:b,forceHandle:ne})},P=E.useRef(null),O=$=>{$.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(F=>{x.current.menus[F]&&w(F,!1,!0)})};E.useEffect(()=>{var $;return($=document.getElementById("header"))==null||$.addEventListener("keydown",O),()=>{var F;(F=document.getElementById("header"))==null||F.removeEventListener("keydown",O)}},[]),ml(()=>{T["site-navigation"]&&Lt.autoFocus({menu:"site-navigation",navigationRef:P,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["site-navigation"]]),ml(()=>{T["account-navigation"]&&Lt.autoFocus({menu:"account-navigation",navigationRef:P,isDesktopVersion:c.navigation,focusElements:C,dispatch:b})},[T["account-navigation"]]);const M=g.jsxs(g.Fragment,{children:[!c.search&&g.jsx("button",{className:"search toggle-search-button",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("search",!T.search)},children:g.jsx(xt,{children:o.formatMessage({id:`header_search_${T.search?"hide":"show"}`})})}),g.jsx(Nw,{id:"global-search",handleToggle:{searchIsOpen:T.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),R=g.jsx("button",{className:"earth icon language-switcher-button","aria-label":"Language switcher",onClick:$=>{$.preventDefault(),$.stopPropagation(),r?r():y(!p)},children:g.jsx(xt,{children:o.formatMessage({id:"header_language_switcher"})})}),D=[d&&f&&g.jsx("div",{id:"suprsend-notifications",children:g.jsx(_ge,{workspaceKey:i,distinctId:(s==null?void 0:s.id)??"",subscriberId:f,theme:{badge:{backgroundColor:"#C34141"},header:{markAllReadText:{color:"#4F43BA"}},notification:{unseenDot:{backgroundColor:"#C34141"},container:{unreadBackgroundColor:"white",readBackgroundColor:"white",hoverBackgroundColor:"#F0F5FF",borderColor:"#D7E0EF"},headerText:{color:"#151921"},bodyText:{color:"#151921"},subtext:{color:"#404A61"},actions:[{container:{backgroundColor:"#4F43BA"}},{container:{borderColor:"#4F43BA",color:"#4F43BA",backgroundColor:"white"}}]}}})}),h&&(s==null?void 0:s.id)&&g.jsx("div",{className:"novu-notifications",children:g.jsx(AZ,{applicationIdentifier:a,subscriberId:s==null?void 0:s.id,routerPush:$=>window.location.href=$,backendUrl:"https://eu.api.novu.co",socketUrl:"https://eu.ws.novu.co",appearance:{variables:{colorBackground:"#FFFFFF",colorForeground:"#151921",colorPrimary:"#4F43BA",fontSize:"24px"},elements:{notificationPrimaryAction__button:{borderRadius:"16px"}}}})})],S=g.jsxs(g.Fragment,{children:[!c.navigation&&g.jsx("button",{className:"menu-button gtm-trackable",onClick:$=>{$.preventDefault(),$.stopPropagation(),w("site-navigation",!T["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":T["site-navigation"],"aria-controls":"site-navigation",children:g.jsx(xt,{children:o.formatMessage({id:`header_menu_${T["site-navigation"]?"hide":"show"}`})})}),g.jsx("ul",{ref:P,id:"navigation",hidden:c.navigation||T["account-navigation"]?!1:!T["site-navigation"],"data-showing":!c.navigation&&T["account-navigation"]?"account":"default",children:zc.order.map($=>g.jsx(dh,{id:$,isLoggedIn:u,isDesktopVersion:c.navigation,menus:{"site-navigation":T["site-navigation"],"account-navigation":T["account-navigation"]},callback:w},$))})]});return s&&s.isLoading?null:g.jsxs(g.Fragment,{children:[g.jsxs("nav",{id:"header",className:ee({"logged-in":u,"logged-out":!u,visible:_}),children:[g.jsx(xt,{element:"a",href:"#content-of-page",children:o.formatMessage({id:"header_skip"})}),g.jsx(Xv,{variant:"monochrome"}),e?g.jsxs(g.Fragment,{children:[c.navigation?g.jsxs(g.Fragment,{children:[S,M,m&&R,D]}):g.jsxs(g.Fragment,{children:[M,m&&R,D,S]}),u?g.jsxs("button",{className:"account-button",onClick:$=>Lt.events.onClick($,{id:"account-navigation",callback:w,isOpen:T["account-navigation"]}),onMouseEnter:()=>Lt.events.onMouseEnter({id:"account-navigation",callback:w}),onMouseLeave:()=>Lt.events.onBlur({id:"account-navigation",callback:w}),"aria-haspopup":"true","aria-expanded":T["account-navigation"],"aria-controls":"account-navigation",children:[g.jsx(xt,{children:o.formatMessage({id:`header_account_${T["account-navigation"]?"hide":"show"}`})}),g.jsx(ka,{name:s&&s.name||"",src:s&&s.image&&s.image.thumbnail||""})]}):g.jsx("ul",{className:"sign-in-buttons",children:zc.buttons.order.map($=>g.jsx(dh,{id:`buttons.${$}`},$))})]}):m&&R]}),p&&g.jsx(Tge,{headerIsVisible:_,locale:(s==null?void 0:s.locale)||yl}),g.jsx("hr",{id:"content-of-page"}),g.jsx("div",{className:ee("overlay",{open:T["site-navigation"]||T["account-navigation"]||!c.search&&T.search})})]})};const Cge=()=>{const e=me.useIntl();return g.jsxs(g.Fragment,{children:[g.jsx(l5,{}),g.jsx("div",{id:"content",children:g.jsx(Ui,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),g.jsx(Sy,{})]})},sD=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:o="",locale:s="en",suprSendWorkspaceKey:l,novuApplicationIdentifier:u})=>{const c=me.useIntl(),{navigation:d=!0,footer:f=!0}=i,{background:h="default",variant:m="default",circle:p="default",modal:y="default"}=a,v=MC(),[b,_]=E.useState(""),T=O=>{const{detail:{message:M}}=O;_(M)};E.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",T),()=>{document.removeEventListener("ariaLive",T)}),[v]);const C=Ed(e,{locale:s}),x=Ed(t,{locale:s}),w=Ed(n,{locale:s}),P={};return h!=="default"&&(P[h]=!0),m!=="default"&&(P[m]=!0),p!=="default"&&(P[p]=!0),g.jsx(DD.ErrorBoundary,{onError:r,fallback:g.jsx(Cge,{}),children:g.jsxs(E.Suspense,{fallback:null,children:[g.jsxs("div",{id:"wrapper",className:ee(o,P,{"has-footer":f}),"data-too-small":c.formatMessage({id:"pageLayout_browserTooSmall"}),children:[g.jsx(l5,{suprSendWorkspaceKey:l,novuApplicationIdentifier:u,showNavigation:d}),g.jsxs("main",{id:"content-wrapper",children:[x&&g.jsx("div",{className:ee("additional-content prepended",{"large-modal":y==="large"}),children:x}),E.createElement(h==="bold"?Lv:"div",{id:"content",children:C,className:ee({"large-modal":y==="large"})})]}),w&&g.jsx("div",{className:"additional-content appended",children:w}),f&&g.jsx(Sy,{}),g.jsx(Pw,{})]}),b&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:b})]})})},AC={default:"tags_",headerTopics:"header_topics_topics_"},W0={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"},xge={getTagDetails:e=>{if(e.includes("topic_")){if(e=W0.topic[e.replace("topic_","")],e){const t=zc.topics.topics[e].href;return t?{id:e,href:t,text:`${AC.headerTopics}${e}`}:null}return null}return W0[e]?(e=W0[e],{id:e,text:`${AC.default}${e}`}):null}};const wge=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:o="tags"})=>{const s=me.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=xge.getTagDetails(u);c&&l.push(c)}),l.length<1?null:g.jsx("ul",{className:ee("tags text-small",t,i,{"one-line":n}),children:l.map(u=>{const c=s.formatMessage({id:u.text});return g.jsx("li",{children:u.href&&r?g.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":o,children:c}):c},u.id)})})};const lD=25,Age=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:o,gtmContext:s="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:c=!1,className:d=""})=>{const f=me.useIntl(),h="membersList",m=E.useContext(fn),[p,y]=E.useState(!1);return e.length===0&&!c?null:g.jsxs("div",{className:ee("members-list",d),children:[u?g.jsxs("h1",{children:[f.formatMessage({id:h}),g.jsx("span",{className:"count",children:t})]}):g.jsx(g.Fragment,{}),g.jsxs("ul",{children:[r?g.jsxs("li",{children:[g.jsx(Ea,{member:m,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:n||""},{scope:Fn.Platform,area:"all"}]}}),g.jsx(fo,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),y(!0)},children:f.formatMessage({id:`${h}_profile`})})]}):g.jsx(g.Fragment,{}),e.map((v,b)=>m&&v.id===m.id?g.jsx(g.Fragment,{}):g.jsxs("li",{children:[g.jsx(Ea,{member:v,gtmContext:s,gtmType:l,badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:n||""},{scope:Fn.Platform,area:"all"}]}}),v.isAdmin&&g.jsx(Fi,{children:f.formatMessage({id:`${h}_admin`})})]},b)),c&&e.length===0&&t>0?[...new Array(Math.min(t,lD))].map((v,b)=>g.jsx("li",{children:g.jsx(bh,{layout:"member"})},b)):g.jsx(g.Fragment,{})]}),i&&g.jsx(Vc,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),o?g.jsx(xp,{form:o,showModal:p,content:{title:f.formatMessage({id:`${h}_modal_title`})},functions:{onClose:()=>{y(!1)}}}):g.jsx(g.Fragment,{})]})},uD=Age,kge=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=me.useIntl();return t?g.jsx("small",{children:oi(i.formatMessage,`${e}explainer`,n,"action",{a:a=>g.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})})}):g.jsx(g.Fragment,{})},Sge=({intlPath:e,type:t,...n})=>{const r=me.useIntl();return g.jsx(Af,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:oi(r.formatMessage,`${e}label_action`,t,"action")},...n})},kC=5,SC=2,Dge=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}}};let Rs=null;const nn="discussion_form_",l1=({id:e,parentId:t,content:n={type:at.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:o=0,buttons:s,forceShow:l={cancel:!1,error:!1},functions:u,data:c={},gtmContext:d="DiscussionForm"})=>{var re,ge,Ne;const f=me.useIntl(),h=E.useContext(fn),[m,p]=E.useState(n.type),[y,v]=E.useState(""),{isLoading:b=!1,isInWrapper:_=!1,isInOverlay:T=!1,isAutoFocused:C=!1,isEditing:x=!1,hasTitleField:w=!1,canBePrepopulated:P=!1,isPrepopulated:O=!1,showTitle:M=!1,showGuidelines:R=!0,showDivider:D=!1,showSuccessMessage:S=!0,showPostType:B=!1,postCategories:H=[]}=i||{},{onChange:$=()=>{},create:F=()=>{},createPoll:ne=()=>Promise,handleSaveEdit:J=()=>{},handleCancel:I=()=>{},callback:A=()=>{},onMention:Y=()=>{},listMembers:L=()=>Promise.resolve([]),clickMentionFallback:U=()=>{},getLinkPreview:V=()=>Promise.resolve({}),props:z={create:{projectNames:["questions-answers"]}}}=u,[j,ue]=E.useState({body:x&&x.text||O&&O.text||"",data:c!=null&&c.link?{link:c==null?void 0:c.link}:{}}),[Q,ie]=E.useState(l.error||!1),le={status:!1,title:w&&w.text||"",polls:0},[te,Ae]=E.useState(le);E.useEffect(()=>{P&&!x&&O&&O!==j.body&&ue(ye=>({...ye,body:O.text||""}))},[O]),E.useEffect(()=>{p(n.type)},[n.type]);const Oe=mc((ye,X)=>{ue(xe=>({...xe,body:ye,data:{link:X}})),$({body:ye});let he;!h||!h.id?he=oi(f.formatMessage,`${nn}error_loggedOut`,m,"action"):r?o>0&&ye.length>=o&&(he=`${nn}error_tooLong`):he=oi(f.formatMessage,`${nn}error_noPermission`,m,"action"),he?ie(he):Q&&ie(!1)},50);let Te=`${m}-form`;if(m===at.Response||m===at.Reply){const ye=((re=n.slugs)==null?void 0:re.reply)||((ge=n.slugs)==null?void 0:ge.answer)||((Ne=n.slugs)==null?void 0:Ne.question)||"";ye&&(Te=`${Te}-${ye.slice(-15)}`)}e&&(Te=`${e}-${Te}`);const se=async ye=>{if(!h||!h.id||!r||gt)throw new Error("You do not have permission to post.");Rs&&clearTimeout(Rs),Ae(he=>({...he,status:"submitting"}));const X=window.location.pathname;try{let he;switch(m){case at.Post:he=await F({title:ye.title,content:ye.body,categories:ye.postType,data:ye.data});break;case at.Poll:he=await ne(Dge(ye));break;case at.Question:he=await F({title:ye.body,authorId:h&&h.id,data:ye.data,...z==null?void 0:z.create});break;case at.Response:he=await F({questionSlug:n.slugs.question},{body:ye.body,authorId:h&&h.id,contentPath:X,data:ye.data});break;case at.Reply:he=await F({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ye.body,authorId:h&&h.id,contentPath:X,data:ye.data});break;default:break}return await WD(1e3),A&&await A(he),Rs=setTimeout(()=>{ue({body:"",data:{}}),p(at.Post),Ae(Ue=>({...Ue,status:"submitted"})),v(oi(f.formatMessage,`${nn}success`,m,"action"));const xe=new Event(bn.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(xe),ve()},850),he}catch(he){const xe=he;let Ue=`${nn}error`;xe!=null&&xe.message.includes("entry already exists")&&(Ue=oi(f.formatMessage,`${nn}error_alreadyExists`,m,"action")),xe!=null&&xe.message.includes("429")?Ue=oi(f.formatMessage,`${nn}error_tooMany`,m,"action"):xe!=null&&xe.message.includes("400")&&(Ue=`${nn}error`),ie(Ue),ve()}},ve=()=>{Rs=setTimeout(()=>{ie(!1),Ae(le),v("")},5e3)},ke=mc(async ye=>{const X={...j,...ye};if(x){Ae(he=>({...he,status:"submitting"})),J(X);return}try{if(!await se(X))throw Error("No response from handleSubmit")}catch{Rs&&clearTimeout(Rs)}},100);if(b)return g.jsx(qr,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const Fe=!j.body||!yc(j.body),ht=!te.title||!yc(te.title);let gt=!1;m!==at.Poll&&(gt=Fe),w&&(gt=gt&&ht);const nt=te.status==="submitting",ot=[];m===at.Poll?ot.push({id:"poll-options",label:f.formatMessage({id:`${nn}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:f.formatMessage({id:`${nn}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:SC,maxInputs:kC,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:f.formatMessage({id:`${nn}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:ye=>{var he;let X=0;ye&&Array.isArray(ye)&&(X=((he=ye==null?void 0:ye.filter(xe=>xe!==""))==null?void 0:he.length)||0),te.polls!==X&&Ae(xe=>({...xe,polls:X})),$({polls:ye})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:f.formatMessage({id:`${nn}multiplePollAnswers`}),className:"text-medium"}):ot.push({component:Sge,props:{formID:Te,intlPath:nn,showLabel:w!==!1,type:m}},{component:ky,props:{id:`${Te}-input`,value:te.status==="submitting"&&!Q?"":j.body,placeholder:a||oi(f.formatMessage,`${nn}placeholder`,m,"action"),maxLength:o,meta:{isInOverlay:T},functions:{onChange:Oe,onChangeData:ye=>{ue(X=>({...X,data:ye}))},onMention:Y,listMembers:L,clickMentionFallback:U,getLinkPreview:V},data:c,autoFocus:x!==!1||C&&!w,"aria-invalid":!!Q,"aria-errormessage":"error-message"}},{component:kge,props:{intlPath:nn,showGuidelines:R,type:m,gtmContext:d}}),D&&ot.push({component:fi}),w&&ot.unshift({id:"title",type:"textarea",value:w.text,limit:250,label:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:f.formatMessage({id:`${nn}${m===at.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:ye=>{Ae(X=>({...X,title:ye})),$({title:ye})}},validation:m===at.Poll?[{condition:"required"}]:[]}),B&&ot.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:f.formatMessage({id:`${nn}postType_label`}),options:H.map(ye=>({id:ye.slug,label:ye.name})),validation:[{condition:"required"}],functions:{onChange:ye=>{$({postType:ye}),ye.includes(at.Poll)?p(at.Poll):m!==at.Post&&p(at.Post)}}});let je=!h||!h.id||!r||nt;if(m===at.Poll){const ye=te.polls;je=je||ht||ye<SC||ye>kC}else je=je||gt,x&&(w?je=je||j.body===x.text&&te.title===w.text:je=je||j.body===x.text);return g.jsxs(g.Fragment,{children:[g.jsxs(Zi,{id:Te,className:ee("discussion-card discussion-form",{"no-styling":_&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!nt||l.cancel},functions:{onSuccess:async ye=>{await ke(ye)},onCancel:I},fields:ot,intlPath:nn,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`${x?"save":"submit"}-${m}-click`,"data-testid":"save-button",disabled:je,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:f.formatMessage({id:`${nn}${x?"save":"post"}`}),submitting:f.formatMessage({id:`${nn}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":d,"data-gtm-event-type":`cancel-${m}-click`,disabled:!l.cancel&&(!h||!h.id||!j.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:f.formatMessage({id:`${nn}cancel`})},gtm:{context:d,event:`${m}-form`},"data-testid":`discussion-${m}-form`,children:[M&&!x&&m===at.Question&&g.jsx("h2",{children:oi(f.formatMessage,`${nn}title`,m,"action")}),g.jsx(Ea,{member:h?{...h,link:!1}:"community",gtmContext:d,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:t||""},{scope:Fn.Platform,area:"all"}]}})]}),te.status==="submitted"&&S&&g.jsx(gl,{className:"success","data-testid":"success",children:oi(f.formatMessage,`${nn}success`,m,"action")}),Q&&g.jsx(gl,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Q=="string"?Q.includes(" ")?Q:f.formatMessage({id:Q},{action:f.formatMessage({id:`discussion_action_${m}`}),maxLength:o}):Q}),y&&g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:y})]})},Oge=Object.freeze(Object.defineProperty({__proto__:null,default:l1},Symbol.toStringTag,{value:"Module"}));const Nge={showForm:!1},Cp=E.createContext(Nge),cD=({children:e})=>{const[t,n]=E.useState({showForm:!1});return g.jsx(Cp.Provider,{value:{...t,updateConversation:n},children:e})};function Ige({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:o}){var d;const s="discussion_",l=me.useIntl(),u=(d=i==null?void 0:i.componentProps)==null?void 0:d.member.additionalContent,c=u?u.customMessage:void 0;return g.jsxs("div",{className:"author-section",children:[g.jsx(Ea,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:c},className:ee({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!c},gtmContext:a,gtmType:"profile-click",badges:o}),i.pinned&&g.jsx(Fi,{variant:"naked",size:"xlarge",icon:"pin",children:g.jsx(xt,{children:l.formatMessage({id:`${s}pinned_post`})})})]})}const K0=({children:e,class:t,...n})=>{const r={...n,class:ee("subtle",t)};return g.jsx("blockquote",{...r,children:e})};function Pge({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?g.jsx(g.Fragment,{}):g.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?g.jsx(g.Fragment,{}):g.jsx(Fi,{size:"small",element:"li",children:n.name},n.slug))})}var fh=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(fh||{});const Rge=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,Fge=(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 o=e.parentElement;if(o)for(i=n==="next"?o.firstElementChild:o.lastElementChild,a=n==="next"?0:o.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 Mge=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:o=!1,isTabbable:s=!1,functions:l})=>{var y;const[u,c]=E.useState(t.hasUserVoted);let d=0,f={};const h=(i||!o)&&!t.hasUserVoted;a&&(d=Math.round(t.numVotes/r*100)||0,f={"--vote-perc":`${d}%`});const m=v=>{v.stopPropagation(),h&&(l==null||l.createVote(t),c(!0))},p={htmlFor:t.id,className:ee({"can-vote":h}),tabIndex:s&&h?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:m,onKeyDown:v=>{var b;if(v.code!=="Tab")switch(v.code){case"Enter":case"Space":v.preventDefault(),v.stopPropagation(),m(v),c(!0);break;case"ArrowUp":case"ArrowDown":v.stopPropagation(),v.preventDefault();const _=v.code==="ArrowUp"?"prev":"next",{nextElement:T,nextIndex:C}=Fge(v.currentTarget.parentElement,"selected",_,n);T&&((b=T.querySelector("label"))==null||b.focus(),l==null||l.setTabbableOption(C));break}}};return g.jsxs("li",{"data-testid":"poll-option",style:f,className:ee("poll-option text-small",{selected:t.hasUserVoted}),children:[g.jsx("label",{...p,children:g.jsx("span",{children:t.label})}),a&&g.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&g.jsx(ka,{className:"author-profile-picture",name:e.name,src:(y=e==null?void 0:e.image)==null?void 0:y.thumbnail}),g.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[d,"%"]})]}),g.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const dD=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=me.useIntl(),o=E.useContext(fn),{showRemoveVote:s=!1,allowMultipleVotes:l=!1,resultsVisibility:u=fh.AfterVoting}=n||{},[c,d]=E.useState(Rge(t,l,o==null?void 0:o.id)),f=t.reduce((v,b)=>v+b.numVotes,0),h=t.filter(v=>v.hasUserVoted).length,m=t.filter(v=>v.hasUserVoted),p=E.useCallback(async v=>{await r.createVote({reactionId:v.id})},[]),y=E.useCallback(async()=>{t.forEach(async v=>{v.hasUserVoted&&v.userVote&&r.removeVote({reactionId:v.userVote.id})})},[t]);return g.jsxs("div",{className:"poll-wrapper",children:[g.jsx("p",{className:"poll-title",children:e}),g.jsxs("aside",{className:"poll-info",children:[g.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:g.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),g.jsx("p",{className:"poll-num-votes",children:g.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:f})})}),s&&g.jsx("p",{className:"poll-remove-vote",children:g.jsx(Ke,{variant:"tertiary",onClick:y,"data-testid":"remove-votes-button",disabled:h===0,children:g.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:h})})})})]}),t&&g.jsx("form",{children:g.jsx("fieldset",{children:g.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((v,b)=>g.jsx(Mge,{isTabbable:c===b,user:o,option:v,optionIndex:b,totalPollVotes:f,showResults:u==fh.Always||!!h,allowMultipleVotes:l,hasVotedOnPoll:!!h,functions:{createVote:p,setTabbableOption:d}},v.id))})})}),g.jsxs(xt,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:h}),!!h&&g.jsx("ul",{children:m.map(v=>g.jsx("li",{children:v.label}))})]})]})};function Bge({content:e,contentData:t,functions:n}){return g.jsx(dD,{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 Lge({links:e={},contentData:t,postCutOff:n,content:r}){var i;return g.jsxs(g.Fragment,{children:[e.post?g.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?g.jsx(e3,{text:t.postBody,markdownOptions:{overrides:{a:ng,blockquote:{component:K0}}}}):g.jsx(Xo,{options:{overrides:{a:ng,blockquote:{component:K0}}},children:t.postBody})]}):g.jsxs(g.Fragment,{children:[(t==null?void 0:t.title)&&g.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),g.jsx(Xo,{options:{wrapper:r.type===at.Question?"h1":E.Fragment,forceWrapper:r.type===at.Question,forceInline:r.type===at.Question,forceBlock:r.type!==at.Question,overrides:{blockquote:{component:K0}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?g.jsx(Qv,{data:t.data.link}):g.jsx(g.Fragment,{})]})}const ti="discussion_",$ge=195;let gd=null;const u1=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:o,functions:s,links:l={},className:u,gtmContext:c="DiscussionAnswer",children:d,isTruncated:f=!1,setFocus:h=!1,isCommunity:m=!1,badges:p,basePath:y,parentId:v,locale:b="en",disableMentions:_})=>{var je,re,ge,Ne,ye,X;const T=me.useIntl(),C=E.useContext(Cp),x=E.useContext(fn),{createContent:w=async()=>{},deleteContent:P=async()=>{},updateContent:O=async()=>{}}=s.content||{},{createLike:M=()=>{},deleteLike:R=()=>{},listLikes:D=async()=>({})}=s.likes||{},{openComments:S=()=>{}}=s.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:H=()=>{}}=s.form||{},{createVote:$=()=>{},removeVote:F=()=>{},removePoll:ne=()=>{}}=s.polls||{},{author:J,createdAt:I,id:A,likes:Y=0,userLiked:L,comments:U=0,data:V}=t,z=fI(t.title,b),j=x&&x.id&&typeof J!="string"&&J.id&&J.id===x.id||!1,ue=j&&(!t.createdAt||VD(t.createdAt,10,"seconds")),Q=E.useRef(null),[ie,le]=E.useState({title:t.body!==z&&z||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[te,Ae]=E.useState(!1),[Oe,Te]=E.useState(ue?"highlighted":"default"),[se,ve]=E.useState("");E.useEffect(()=>{const he=Q.current;if(!(!he||Oe==="default"))return document.addEventListener(bn.DISCUSSION_FORM_SUBMITTED,ke),he.addEventListener("transitionend",Fe),()=>{document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,ke),he.removeEventListener("transitionend",Fe)}},[]),E.useEffect(()=>{le(he=>({...he,title:t&&z||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),E.useEffect(()=>{(async()=>{const xe=await Yv(ie.body,f,V==null?void 0:V.mentions,B);le(Ue=>({...Ue,postBody:xe}))})()},[ie.body,V==null?void 0:V.mentions]);const ke=()=>{setTimeout(()=>{Te("fading")},1e3)},Fe=({propertyName:he})=>{he==="background-color"&&Te(xe=>(xe==="default"&&(document.removeEventListener(bn.DISCUSSION_FORM_SUBMITTED,ke),Q.current&&Q.current.removeEventListener("transitionend",Fe)),xe==="fading"?"default":xe))};if(i||!t||t.type===at.Answer&&(!t.slugs||!t.slugs.question)||ie.postBody===""&&t.title==="")return g.jsx(qr,{className:"discussion-card"});const ht=async({title:he,body:xe,data:Ue})=>{he||(he=""),xe||(xe=""),ve("");try{if(!cf(he,ie.title)||!cf(xe,ie.body)){const St=t.type===at.Question?{title:xe}:{title:he,body:xe,data:Ue};await O(sg(t.slugs),St)}le(St=>({...St,title:he||"",body:xe||"",data:{...St.data,...Ue},isEditing:!1,didEdit:!0}))}catch{ve(`${ti}form_error`)}},gt=()=>{if(C&&C.updateConversation){const he={showForm:!0},xe=t.author;xe&&xe.id&&!_&&(m&&(he.prepopulateForm=`@{{${xe.id}}}`),he.mentionData={id:xe.id,name:xe.name}),C.updateConversation(he)}setTimeout(()=>{var vt,kt,sn;const xe=`reply-form-${(t.type===at.Answer?t.slug:((vt=t.slugs)==null?void 0:vt.reply)||((kt=t.slugs)==null?void 0:kt.answer)||((sn=t.slugs)==null?void 0:sn.question)||"").toLowerCase().slice(-15)}`,Ue=document.getElementById(xe),St=document.getElementById(`${xe}-input`);St&&St.focus(),Ue&&Ue.scrollIntoView({behavior:"smooth"})},0)},nt=async()=>{Ae(!1);try{t.type===at.Poll?(await ne(),window.location.href=`${y}/${v}`):await P(sg(t.slugs))}catch{ve("delete-error")}},ot=[];return n&&j&&(t.type!==at.Poll&&ot.push({text:T.formatMessage({id:`${ti}moreMenu_edit`}),onClick:()=>le(he=>({...he,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),ot.push({text:T.formatMessage({id:`${ti}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),Ae(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`delete-${t.type}-click`,...D3(`delete-${t.slug}-modal`,te)})),r&&s.pins&&ot.push({text:T.formatMessage({id:`${ti}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?s.pins.deletePin:s.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":`edit-${t.type}-click`}),h&&((je=Q==null?void 0:Q.current)==null||je.focus(),(re=Q==null?void 0:Q.current)==null||re.scrollIntoView({behavior:"smooth"})),E.createElement(e,{className:ee("discussion-post",u,{[Oe]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!ie.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:Q,tabIndex:h?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${c}-post-click`,onClick:he=>{if(!l.post||ie.isEditing||t.type===at.Poll&&dI(he,["poll-options","poll-info"],"discussion-post"))return;he.preventDefault(),he.stopPropagation(),gd&&clearTimeout(gd),gd=setTimeout(()=>{window.location.href=l.post},150);const xe=new CustomEvent(bn.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:gd}});document.dispatchEvent(xe)},children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{id:A||t.slug,className:ee("discussion-card text-medium",t.type,{editing:ie.isEditing,"has-link":l.post&&!ie.isEditing}),children:[!ie.isEditing&&g.jsx(Ige,{author:J,originalAuthorId:a,createdAt:I,contentData:{didEdit:ie.didEdit},content:t,gtmContext:c,badges:p}),ie.isEditing?g.jsx(l1,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:ie.title!==""?{text:ie.title}:!1,isEditing:{text:ie.body,categories:[]},canBePrepopulated:m,isPrepopulated:!1},maxLength:t.type===at.Question?250:5e4,forceShow:{error:se!==""&&se!=="delete-error"?T.formatMessage({id:se},{action:T.formatMessage({id:`${ti}action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:ht,handleCancel:()=>{ve(""),le(he=>({...he,isEditing:!1}))},listMembers:B,clickMentionFallback:H},gtmContext:`${c}Form`,data:V}):g.jsxs(g.Fragment,{children:[t.type===at.Poll?g.jsx(Bge,{content:t,contentData:ie,functions:{createVote:$,removeVote:F}}):g.jsx(Lge,{links:l,contentData:ie,postCutOff:$ge,content:t}),g.jsx(Pge,{content:t})]}),!ie.isEditing&&!(o!=null&&o.actionBar)&&g.jsx(V3,{className:t.type,gtmContext:c,contentType:t.type,likes:o!=null&&o.likes?!1:{count:Y||0,userLiked:L||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:M,deleteLike:R,listLikes:D},basePath:y,parentId:v},comments:!(o!=null&&o.comments)&&([at.Question,at.Post].includes(t.type)||l.comments)?{count:U||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof S=="function"&&S()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:gt}}:!1,shareLink:!(o!=null&&o.shareLink)&&{url:`${window.location.origin}${(ge=t.slugs)==null?void 0:ge.question}/${(Ne=t.slugs)==null?void 0:Ne.answer}${(ye=t.slugs)!=null&&ye.reply?`#${(X=t.slugs)==null?void 0:X.reply}`:""}`},moreMenu:!(o!=null&&o.moreMenu)&&{options:ot,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),d,g.jsx(Sa,{id:`delete-${t.slug}-modal`,isOpen:te,functions:{onOpen:()=>{},onClose:()=>Ae(!1)},forceShow:{error:se==="delete-error"?T.formatMessage({id:"${intlPath}delete_error"},{action:T.formatMessage({id:`${ti}action_${t.type}`})}):!1},title:T.formatMessage({id:`${ti}delete_title`},{action:T.formatMessage({id:`${ti}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>Ae(!1),children:T.formatMessage({id:`${ti}delete_cancel`})},{variant:"primary",className:"destructive",onClick:nt,children:T.formatMessage({id:`${ti}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:g.jsx(me.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>g.jsx("p",{children:he}),action:T.formatMessage({id:`${ti}action_${t.type}`})}})})]})})};const jge=E.lazy(()=>Promise.resolve().then(()=>eve)),Hge=65,fD=({forceShow:e,form:t,className:n})=>{const r=me.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",s=E.useContext(fn)||"community",l=Eh(s);l.name||(l.name=r.formatMessage({id:`member_${typeof s=="string"?s:"community"}`}));const u=lo(!0,!1),c=u?u<768:0,{modal:d=!1}=e||{},[f,h]=E.useState({form:d||YC("showPost")==="true"||!1,warning:!1}),[m,p]=E.useState({showCachedText:!1});E.useEffect(()=>{if(!m.showCachedText)return;(async()=>{const _=await Yv(m.title||m.body||"",Hge,m.mentions);p(T=>({...T,prettifiedText:_}))})()},[m.showCachedText,m.title,m.body]);const y=b=>{if(!m.showCachedText||typeof f.warning=="string")return;let _;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),_=b.detail.link;else{const T=b;T.preventDefault(),T.stopPropagation();const x=T.target.closest("a");_=x&&x.getAttribute("href")}h(T=>({...T,warning:_||!1}))};E.useEffect(()=>{if(!m.showCachedText){document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y);return}return document.addEventListener(bn.DISCUSSION_POST_CLICKED,y),document.addEventListener(bn.MEMBER_CLICKED,y),document.addEventListener("click",y),()=>{document.removeEventListener(bn.DISCUSSION_POST_CLICKED,y),document.removeEventListener(bn.MEMBER_CLICKED,y),document.removeEventListener("click",y)}},[m.showCachedText]),E.useEffect(()=>{const b=_=>{if(!(!m.showCachedText||f.warning!==!1))return _.preventDefault(),_.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[m.showCachedText,f.warning]);let v=r.formatMessage({id:`${i}placeholder${c?"":"_long"}`});return m.showCachedText&&(m.title||m.body)&&(v=m.prettifiedText||v),g.jsxs(g.Fragment,{children:[g.jsxs("button",{className:ee("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(_=>({..._,form:!0}))},"data-testid":"discussion-form-card",children:[g.jsx(ka,{name:l.name,src:l.image,alt:""}),g.jsx(Xo,{className:ee("input",{placeholder:!m.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Pr,blockquote:Pr,br:Pr,em:Pr,li:Pr,ol:Pr,p:Pr,s:Pr,span:Pr,strong:Pr,ul:Pr}},children:v})]}),g.jsxs(Ml,{children:[g.jsx(jge,{showModal:f.form,functions:{cacheText:p,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:m,className:"in-portal"}),g.jsx(Sa,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:f.warning!==!1,functions:{onClose:()=>{h(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:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:g.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},Uge=E.lazy(()=>Promise.resolve().then(()=>Oge)),u5=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:o,leave:s,notMemberStateText:l},locale:u=yl})=>{if(a&&!i)return g.jsx(Ui,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:g.jsx(Uv,{isShort:!0,functions:{join:o,leave:s}})}});const{content:c,functions:d,meta:f,...h}=t,m={content:{type:(c==null?void 0:c.type)||"reply",slugs:(c==null?void 0:c.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...f,isEditing:(f==null?void 0:f.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...h,id:`add-post-${h.id||""}`};return e?g.jsx(fD,{form:m}):g.jsx(Uge,{...m})},c5=({form:e})=>{const t=E.useContext(fn),n=me.useIntl(),[r,i]=E.useState(!1),a=()=>{eO(t)||i(!0)};E.useEffect(()=>{if(e&&!(e!=null&&e.isDisabled)||(e==null?void 0:e.isDisabled)===void 0)return document.addEventListener(bn.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(bn.DISCUSSION_POST_ADDED,a)}});const o={};return["successMessage","title","text"].forEach(s=>{o[s]=n.formatMessage({id:`profileModalLauncher_${s}`})}),g.jsx(xp,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:o})};const G0="discussion_responses_",hD=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=me.useIntl();return t=parseInt(t),g.jsxs("div",{className:"responses-heading",children:[g.jsx("h4",{children:r.formatMessage({id:`${G0}title`},{action:r.formatMessage({id:`${G0}${e}`}),count:t})}),!n&&t===0&&g.jsx("p",{children:oi(r.formatMessage,`${G0}empty`,e,e)})]})};const pD=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=me.useIntl(),o=E.useContext(Cp),s=Ed(i,{element:"li"});if(o.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:o.prepopulateForm},o.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=o.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:o.mentionData},r.data=l,r.meta.isAutoFocused=!0}return g.jsxs("div",{className:ee("thread-wrapper",{"empty-thread":!s}),children:[!Object.is(s,null)&&g.jsx("ul",{className:"thread",children:s}),!e&&g.jsx(Vc,{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&&o.showForm&&g.jsx(l1,{...r})]})};function zge(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,o;(o=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&o.length&&(t=!0)}),t}function Vge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:o}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:s})=>t(l=>(N3({activity:l,reactionId:s,user:a}),l)),onError:n,onSuccess:(s,{reactionId:l},u)=>{u&&I3({activity:u,reactionId:l,correctReactionId:s.body.id,user:a}),r.setQueryData(i,u)}});return o}function qge({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Rt.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(o=>(o&&(i!=null&&(o.content=i),a!=null&&(o.title=a)),o)),onError:n});return r}function Wge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&vf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&vf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function Kge({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Rt.useMutation({mutationFn:e,onMutate:o=>t(s=>(s&&yf({activity:s}),s)),onError:n,onSuccess:(o,s,l)=>{l&&yf({activity:l,reaction:o}),r.setQueryData(i,l)}});return a}function Gge({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Rt.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function Yge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(o=>(P3({activity:o,reactionId:a}),o)),onError:n});return i}function Zge({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:o,removeVote:s},queryKey:l}){const u=Rt.useQueryClient(),c=yh(),d={queryClient:u,queryKey:l},f={mutationHandlers:{error:zv(d),mutate:Vv(d)},user:c,...d},h=qge({...f,mutationFn:t}),m=Wge({...f,mutationFn:n}),p=Qge({...f,mutationFn:r}),y=Kge({...f,mutationFn:i}),v=Xge({...f,mutationFn:a}),b=Vge({...f,mutationFn:o}),_=Yge({...f,mutationFn:s}),{activity:T,...C}=Gge({queryKey:l,queryFn:e});return{activity:T,mutations:{edit:h,like:m,unlike:p,pin:y,unpin:v,createVote:b,removeVote:_},user:c,...C}}function Qge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>t(o=>(o&&R3({activity:o,user:r}),o)),onError:n});return i}function Xge({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Rt.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(o=>(o&&F3({activity:o,user:r}),o))),onError:n});return i}const Jge=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...o},likes:s,reactions:l,form:u,join:c,leave:d,polls:f},profile:h,categories:m,locale:p=yl,type:y=Cn.Communities})=>{var U,V,z,j,ue,Q,ie,le,te,Ae,Oe,Te;const v=me.useIntl(),b=E.useContext(fn),_={...o,...f},{activity:T,error:C,isLoading:x,mutations:{edit:w,like:P,unlike:O,pin:M,unpin:R,createVote:D,removeVote:S}}=Zge({queryFns:_,queryKey:[e,t,n]});if(x)return g.jsx(qr,{style:{height:"400px"}});if(C||!T)return g.jsx(Ui,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:B,verb:H,latest_reactions:$,mentioned_users:F,additional_data:ne}=T,J=(((U=$==null?void 0:$.like)==null?void 0:U.length)||0)>0,I=!!((V=B==null?void 0:B.like)!=null&&V.find(se=>{var ve;return((ve=se.user)==null?void 0:ve.id)===(b==null?void 0:b.id)})),A=I?B==null?void 0:B.like[0].id:"",Y=J?(z=$==null?void 0:$.like)==null?void 0:z.map(se=>{var ve,ke,Fe;return{id:(ve=se==null?void 0:se.user)==null?void 0:ve.id,name:(Fe=(ke=se==null?void 0:se.user)==null?void 0:ke.data)==null?void 0:Fe.name}}):!1,L=T==null?void 0:T.actor;return g.jsxs("section",{className:"activity-section",children:[g.jsx(u1,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:H,title:T==null?void 0:T.title,body:y===Cn.Courses?zN({content:T.content,locale:p}):T==null?void 0:T.content,categories:Zv((T==null?void 0:T.categories)||[],m||[]),createdAt:(T==null?void 0:T.time)||"",slugs:{question:`${e}/${t}`,answer:T==null?void 0:T.id},slug:n,author:Ll(L),userLiked:I,likes:((j=T==null?void 0:T.reaction_counts)==null?void 0:j.like)||0,comments:(T==null?void 0:T.total_replies)||0,peopleWhoLiked:y===Cn.Courses?!1:Y,data:{mentions:F,...ne||{}},pinned:((ue=T==null?void 0:T.reaction_counts)==null?void 0:ue.pin)&&((Q=T==null?void 0:T.reaction_counts)==null?void 0:Q.pin)>0||!1,pollOptions:O3(T,p),pollSettings:{showRemoveVote:(ie=T==null?void 0:T.settings)==null?void 0:ie.show_remove_vote,allowMultipleVotes:(le=T==null?void 0:T.settings)==null?void 0:le.allow_multiple_votes,deadlineAt:(te=T==null?void 0:T.settings)==null?void 0:te.deadline_at,hideParticipants:(Ae=T==null?void 0:T.settings)==null?void 0:Ae.hide_participants,numberOfWinners:(Oe=T==null?void 0:T.settings)==null?void 0:Oe.number_of_winners,resultsVisibility:(Te=T==null?void 0:T.settings)==null?void 0:Te.results_visibility}},originalAuthorId:L==null?void 0:L.id,forceHide:{comments:!0,shareLink:y===Cn.Courses},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(se,{title:ve,body:ke})=>w({title:ve,content:ke})},likes:{createLike:()=>P({activityId:n}),deleteLike:()=>O({activityId:n,reactionId:A}),listLikes:se=>s.list({activityId:n,...se})},comments:{openComments:()=>{}},pins:{createPin:()=>M({activityId:n}),deletePin:()=>{var se;return R({activityId:n,reactionId:(se=$==null?void 0:$.pin)==null?void 0:se[0].id})}},polls:{createVote:({reactionId:se})=>D({reactionId:se}),removeVote:({reactionId:se})=>S({reactionId:se}),removePoll:()=>f.removePoll({activityId:n})},form:u},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:Fn.Communities,area:t||""},{scope:Fn.Platform,area:"all"}]},basePath:e,parentId:t},n),g.jsx(j3,{basePath:e,parentId:t,activityId:n,showReplies:H===at.Poll?zge(T):!0,activityTotalReplies:(T==null?void 0:T.total_replies)||0,isMember:r,functions:{reactions:l,likes:s,form:u,join:c,leave:d},profile:h,type:y})]})};const mD=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=me.useIntl(),o="discussionFormModal_",{onClose:s=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:d}=n,{title:f="",body:h="",mentions:m}=r||{},p="discussion-form-modal";return g.jsx(Sa,{id:p,title:a.formatMessage({id:`${o}title`}),isOpen:e,functions:{onClose:()=>{(f!==""||h!=="")&&l(y=>({...y,showCachedText:!0})),s()}},className:ee("discussion-form-modal",i),children:g.jsx(l1,{...n,data:{...u,mentions:m||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${p}-overlay`,hasTitleField:{text:f},isPrepopulated:{text:h||(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:`${o}cta`})},functions:{...d,onChange:y=>{l(v=>({...v,...y}))},onMention:({id:y,name:v}={})=>{if(!y||!v)return;const b=m||{};b[y]={created_at:"",updated_at:"",id:y,data:{name:v}},l(_=>({..._,mentions:b}))},create:async y=>{s(),d.create&&await d.create(y),l({showCachedText:!1})},createPoll:async y=>{const v=()=>{s(),l({showCachedText:!1})};if(d.createPoll)try{const b=await d.createPoll(y);return new Promise(_=>(v(),_(b)))}catch{return new Promise((_,T)=>T())}else return v(),new Promise(b=>b({}))},handleSaveEdit:async y=>{s(),d.handleSaveEdit&&await d.handleSaveEdit(y),l({showCachedText:!1})}}})})},eve=Object.freeze(Object.defineProperty({__proto__:null,default:mD},Symbol.toStringTag,{value:"Module"}));const tve=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:o,showIcon:s,onClose:l,reportError:u=()=>{},sendInvites:c})=>{const d=me.useIntl();return i||(i=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),o||(o=d.formatMessage({id:"inviteModal_cta"})),g.jsx(Sa,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:l},className:ee("invite-modal",e,{success:!!n}),children:g.jsx(Sw,{title:i,label:a,messagePlaceholder:r,ctaMessage:o,onClose:l,sendInvites:c,reportError:u})})};const nve=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:o})=>{const s=me.useIntl(),[l,u]=E.useState(YC("showProfile")==="true"||e);E.useEffect(()=>{u(e)},[e]);const{onClose:c=()=>{}}=i;return g.jsx(Sa,{id:"profile-form-modal",title:t||n||s.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:c},className:ee("profile-modal",o,{success:!!t}),maxWidth:700,children:g.jsxs(g.Fragment,{children:[t&&n||r?g.jsxs("div",{className:"intro",children:[t&&n?g.jsx("h3",{children:n}):"",r?g.jsx("p",{children:r}):""]}):null,g.jsx(Dw,{...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()}}}})]})})},xp=nve,rve=Object.freeze(Object.defineProperty({__proto__:null,default:xp},Symbol.toStringTag,{value:"Module"}));const ive=({members:e})=>{const[t,n]=E.useState(!1),r=i=>{const{fullName:a,jobTitle:o,organisation:s,photo:l}=i||{};return g.jsxs(g.Fragment,{children:[g.jsx(ka,{name:a,src:l}),g.jsx("p",{children:a}),g.jsx("small",{className:"text-medium",children:s?`${o}, ${s}`:o})]})};return g.jsxs("div",{className:"directory-wrapper",children:[g.jsx("ul",{className:"directory",children:e.map(i=>g.jsx("li",{children:g.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),g.jsx(Sa,{isOpen:t!==!1,children:t===!1?"":g.jsxs(g.Fragment,{children:[r(t),g.jsx(Xo,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const ave=({email:e,settings:t={}})=>{const{formatMessage:n}=me.useIntl(),r=E.useContext(fn),{myProfile:i,isConnected:a,cannotConnect:o}=t,[s,l]=E.useState(!1),[u,c]=E.useState(!1);return r?e&&i?g.jsx(Ke,{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}):o?g.jsx(Ke,{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?g.jsx(g.Fragment,{children:s?g.jsx(Ke,{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}):g.jsx(Ke,{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"})})}):g.jsx(g.Fragment,{}):g.jsx(Ke,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},className:"show-email fake-button",children:n({id:"member_show_email_hide"})}):g.jsx(g.Fragment,{})};const ove=({author:e,authorCite:t,content:n,member:r,className:i=""})=>g.jsxs("blockquote",{className:ee("testimonial-block",i),children:[g.jsx(Ri,{className:"testimonial",children:n}),r?g.jsx(Ea,{member:r,styling:{size:"large"}}):g.jsxs(g.Fragment,{children:[e&&g.jsx("p",{className:ee("author",{"text-small":!i.includes("new")}),children:e}),t&&g.jsx("p",{className:ee("author-cite",{"text-small":!i.includes("new")}),children:g.jsx("cite",{children:t})})]})]}),sve=E.memo(ove);const lve=({items:e=[],selector:t="",className:n=""})=>{const r=me.useIntl(),[i,a]=E.useState(e);return E.useEffect(()=>{if(e.length)return;let o="";Array(6).fill(0).forEach((u,c)=>{o+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(o)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));a(l)},[]),i&&i.length>0&&g.jsxs(Er,{variant:"subtle",className:ee("table-of-contents",n),children:[g.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),g.jsx("nav",{children:g.jsx("ul",{children:i.map(({id:o,text:s})=>g.jsx("li",{children:g.jsx("a",{href:`#${o}`,children:s})},o))})})]})};const wp=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=me.useIntl(),o="timeToComplete_";if(!e||typeof e!="number")return null;const s=c=>{const d=c/60,f=Math.floor(d),h=(d-f)*60,m=Math.round(h),p=`${a.formatMessage({id:`${o}hours`},{time:f})}${f>0&&m>0?", ":""}${a.formatMessage({id:`${o}minutes`},{time:m})}`;return{text:`${f>0?`${a.formatMessage({id:`${o}hours_short`},{time:f})} `:""}${m>0?a.formatMessage({id:`${o}minutes_short`},{time:m}):""}`,ariaText:p}};let{text:l,ariaText:u}=s(e);if(t){const{text:c,ariaText:d}=s(e+t);l=a.formatMessage({id:`${o}range`},{early:l,late:c}),u=a.formatMessage({id:`${o}range_aria`},{early:u,late:d})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),g.jsx("span",{className:ee("time-to-complete",i),"aria-label":u,children:l})};const uve=({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",g.jsx(co,{...n,className:ee("banner",e),image:{...t,aspect:"banner"}})):null;const cve=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],dve=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:o={eyebrow:!1,title:!1,text:!1},cta:s,children:l})=>{var m,p;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(y=>{if(!t[y]){f[y]=!1;return}if(!o[y]){if(typeof t[y]=="object"){f[y]=t[y];const{text:v,element:b}=t[y];if(b&&cve.includes(b.toLowerCase()))return;f[y]={text:v,element:d[y]};return}f[y]={text:t[y],element:d[y]}}});const h=s&&s.text&&s.link;return h&&s.link[0]==="#"&&(s.props||(s.props={}),s.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(s.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),g.jsx(mo,{className:ee("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&i==="normal"&&f.eyebrow&&f.title}),children:g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(f[y]&&typeof f[y]=="object"){const{text:v,element:b=""}=f[y];return y==="text"?g.jsx(Xo,{overrideType:"text-only",className:"text",children:v},y):E.createElement(b,{key:y,className:y},v)}return null}),l,h&&g.jsx(Ke,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:s.link,...s.props,className:ee({new:r==="subtle",[(m=s.props)==null?void 0:m.className]:(p=s.props)==null?void 0:p.className}),children:s.text})]}),n&&g.jsx(co,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},fve=E.memo(dve);const hve=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),g.jsx(mo,{className:ee("custom-content-banner",t,r,{"has-image":e}),style:i,children:g.jsx("div",{className:"content-slim",children:n})})};const pve=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?g.jsx(Xo,{children:n}):n;return g.jsxs(mo,{className:ee("highlight-section",t),children:[r&&g.jsx("div",{className:ee("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:g.jsx(co,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),g.jsx("div",{className:ee("highlight-container highlight-content-wrapper",{"no-image":!r}),children:g.jsx("div",{className:ee("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:g.jsx("div",{className:"content-default",children:i})})})]})},mve=E.memo(pve);const gve=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:g.jsxs("aside",{className:ee("marketing-block",e),children:[n&&g.jsx("p",{className:"title",children:n}),r&&g.jsx("p",{children:r}),t&&g.jsx(Ke,{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})]}),vve=({type:e,data:t})=>{const n=me.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:o,pill:s,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const d=i&&J0(i);return g.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&g.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||o)return g.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):Dv(c)});if(s)return g.jsx(Fi,{variant:s==="free"?"subtle":"highlighted",className:s,"data-testid":"course-type",children:s});if(l||u){const d=u&&J0(u);return g.jsxs("ul",{className:"details",children:[l&&g.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&g.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},yve={title:66,text:3e3,secondaryText:1e3,partner:34},hh={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"}},bve=({data:e,cta:t,link:n,gtmContext:r})=>{var p,y;const i=me.useIntl(),[a,o]=E.useState({loading:!1,registered:e.registered||!1});E.useEffect(()=>{e.registered&&o(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:s,startDate:l,dateHasPassed:u,pill:c,slug:d}=e,f=e.contentType;let h="";if((p=hh[f])!=null&&p.gtmEvent&&(h=hh[f].gtmEvent),l&&u)return n?g.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_watch"})}):null;if(f==="people")return n?g.jsx(Ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:s||i.formatMessage({id:"card_cta_people"})}):null;const m=["communityPage","microcourse","event"];if(t&&t.onClick&&m.includes(f)&&c!=="premium"){const v=a.loading||a.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),b=async _=>{var T;if(_.preventDefault(),_.stopPropagation(),window&&((T=window.dataLayer)==null||T.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)){o(C=>({...C,loading:!0}));try{const C=await t.onClick(e);o(C==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{o(x=>({...x,loading:!1}))}}};return g.jsx("p",{className:ee("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:g.jsx(Ke,{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:s||i.formatMessage({id:`card_cta_${f}${v?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Eve({buildMemberData:e,communitySlug:t}){const n=me.useIntl(),r=E.useContext(fn),[i,a]=E.useState({count:"...",isMember:!1,memberType:""});return E.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(o=>{if(!o)return;const{membersCount:s,role:l="",pagination:u}=o;let c=0;s?c=s:u!=null&&u.total&&(c=u==null?void 0:u.total),a({count:c.toString(),isMember:!!l,memberType:l})})},[t,e]),g.jsxs("span",{className:"member-information",children:[i.isMember&&g.jsx(Fi,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),g.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const d5=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:o="Carousel",handleCardClick:s,meta:l})=>{var S,B;const u=me.useIntl(),c=E.useContext(fn),d=!!(c!=null&&c.id),{isTabbable:f=!0,setFocus:h=!1}=l||{},m=E.useRef(null),[p,y]=E.useState({data:null,isLoading:!0});E.useEffect(()=>{n(i,d).then(H=>{y({data:H,isLoading:!1})}).catch(()=>y(H=>({...H,isLoading:!1})))},[i,d,n]);const{data:v,isLoading:b}=p;if(b||!v)return g.jsx(qr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:s});const{contentType:_}=v;if(!_||!hh[_])return g.jsx(qr,{element:"li",className:"card-wrapper"});const{basePath:T="",className:C,length:x,gtmEvent:w}=hh[_];let P=f&&v.slug?`${v.locale?`/${v.locale}`:""}${T}${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")&&(P=v.slug);const O=H=>{if(P){H.preventDefault(),H.stopPropagation();const $=H.currentTarget.getAttribute("data-url");window&&window.dataLayer.push({event:"gtm.click","gtm.element":$,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":$,EventType:`${o}-CarouselCard`,EventContext:`${w}-click`}),window.location.href=$}},M={...yve,...x};let R={className:"card"},D={};return P&&(D={href:P,className:"gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},v.openInNewTab&&(D.target="_blank"),R={onClick:O,className:"card gtm-trackable","data-gtm-event-context":`${o}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),h&&(R={...R,tabIndex:"0"},(S=m==null?void 0:m.current)==null||S.focus(),(B=m==null?void 0:m.current)==null||B.scrollIntoView({behavior:"smooth"})),g.jsx("li",{className:ee("card-wrapper text-medium",C,t,{"has-link":P,"no-link":!P,"has-image":v.banner}),"data-testid":`${_}-card`,children:g.jsxs("div",{...R,ref:m,"data-url":P,children:[g.jsx(QC,{className:"card-label",contentType:_,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),_==="communityPage"&&(v==null?void 0:v.createdAt)&&qD(v==null?void 0:v.createdAt,60)&&g.jsx(Fi,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&g.jsx(Fi,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?u.formatMessage({id:"card_ended"}):WC(v.startDate)}),v.banner?g.jsxs("p",{className:"img",children:[v.registered&&g.jsx(Fi,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),g.jsx(co,{image:{...v.banner,description:""}})]}):C==="people"?g.jsx(ka,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&g.jsx(Bv,{contributors:{data:v.contributors},styling:{size:"small",showGap:C!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(_)?u.formatMessage({id:`card_contributors_${_}`}):void 0,"data-testid":"contributors"}),v.partner&&g.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}):pl(v.partner[0],M.partner)}),["title","text","secondaryText"].map(H=>{const $=v[H];if(!$)return null;const F=HC(H),ne={key:H,className:F,"data-testid":F},J={wrapper:"p",forceWrapper:!0,forceInline:!0},I=pl($,M[H]);return["title","text"].includes(H)&&P?(J.wrapper="a",g.jsx("p",{...ne,children:g.jsx(Ri,{options:J,...D,children:I})})):g.jsx(Ri,{options:J,...ne,children:I})}),i.contentType==="communityPage"&&(i.slug||v.slug)&&r&&g.jsx(Eve,{communitySlug:i.slug||v.slug,buildMemberData:r}),g.jsx(vve,{type:C||"",data:v}),g.jsx(bve,{data:v,cta:a,link:P||"",gtmContext:o})]})})};const gD=({cards:e,cardTypes:t,className:n="",gtmContext:r="",...i})=>g.jsx("ul",{className:ee("card-block",n),children:e.map((a,o)=>{const s=a.slug?`${a.slug}-${t[o]}`:`${t[o]}-${o}`;return g.jsx(d5,{id:s,card:{...a,contentType:t[o]},meta:{setFocus:o===(i==null?void 0:i.focusCardIndex)},...i},`${s}-${r}-${a.title}`)})}),_ve=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),o=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:o}},Tve=({id:e,title:t})=>{const n=me.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:o="medium",link:s}=t;return E.createElement(i,{className:ee("title",a,o,{"highlighted-title":a==="highlighted"}),children:g.jsxs(g.Fragment,{children:[r,s&&g.jsx("a",{href:s,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Y0={fourCards:1024,threeCards:769,twoCards:480};let vd=null,Z0=null;const Cve=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:o,...s})=>{const l=me.useIntl(),u="carousel_pagination_",[c,d]=E.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:h}=c,[m,p]=E.useState({currentPage:0,loadedPages:[0]}),{currentPage:y,loadedPages:v}=m,[b,_]=E.useState(""),T=t.length,C=Math.ceil(T/f),x=E.useRef(null),w=lo(!0,!0,x==null?void 0:x.current);E.useEffect(()=>{let S=1;w&&(w>=Y0.fourCards?S=4:w>=Y0.threeCards?S=3:w>=Y0.twoCards&&(S=2),S>T&&(S=T)),d(B=>({...B,cardsPerPage:S,isLoading:!1}))},[w,T]);const P=(S="next")=>{Z0&&clearTimeout(Z0);let B=y;if(typeof S=="string")if(S==="next")if(y<C-1)B=y+1;else return;else if(y>0)B=y-1;else return;else B=S;_(""),p($=>({...$,currentPage:B,loadedPages:[...new Set([...v,B])]}));const H=()=>{const $=B*c.cardsPerPage,F=$+c.cardsPerPage;return t.slice($,F).length};Z0=setTimeout(()=>{_(l.formatMessage({id:`${u}ariaLive${typeof S=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof S=="string"?S:"next"}`}),slide:typeof S=="string"?1:S+1,count:H()}))},500)},O=S=>{vd=S.touches[0].clientX},M=S=>{if(vd===null)return;const B=S.touches[0].clientX,H=vd-B;H>5?P("next"):H<-5&&P("previous"),vd=null},R={"--width":`${w||0}px`,"--total-cards":T,"--cards-per-page":f,"--page":y};if(h)return g.jsx(bh,{layout:`carousel${i?"-with-title":""}`});const D=(S,B)=>{var $;let H=null;return($=S==null?void 0:S.sys)!=null&&$.id?H=`card-${S.sys.id}`:S!=null&&S.slug?H=`card-${S.slug}`:[n[B],S.contentType].includes("customCard")&&(H=`card-${window.btoa(`${S.title} ${S.createdAt}`)}-${B}`),H};return g.jsxs("section",{ref:x,className:ee("carousel-wrapper",a),"data-testid":"carousel",children:[g.jsx(Tve,{id:e,title:i}),g.jsx("ul",{className:"carousel",onTouchStart:O,onTouchMove:M,style:R,"data-testid":"carousel-list",children:t.map((S,B)=>{let H=D(S,B);const{inView:$,isLoaded:F}=_ve(B,f,y,v);return H&&($||F)?g.jsx(d5,{id:H,card:{...S,contentType:n[B]},buildCardData:r,gtmContext:o,meta:{isTabbable:$},...s},H):(H=H||`${e}-card-${B}`,g.jsx(qr,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},H))})}),C<=1?null:g.jsxs(g.Fragment,{children:[g.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[g.jsx("li",{className:"arrow previous",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:S=>{S.preventDefault(),S.stopPropagation(),P("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:y<=0})}),[...Array(C)].map((S,B)=>g.jsx("li",{"data-testid":"carousel-controls-button",children:g.jsx("button",{className:ee("page-indicator",{selected:B===y}),onClick:H=>{H.preventDefault(),H.stopPropagation(),P(B)},children:g.jsx(xt,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:B+1,total:C})})})},`page-indicator-${B}`)),g.jsx("li",{className:"arrow next",children:g.jsx(Ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:S=>{S.preventDefault(),S.stopPropagation(),P("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:y>=C-1})})]}),g.jsx(xt,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},xve=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:o,cards:s,cardsTypes:l},u)=>{const c=a?window.btoa(a):`carousel-${u}`,d=u===e.length-1;return t?g.jsxs(E.Fragment,{children:[g.jsx(bh,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),d?null:g.jsx(fi,{})]},`placeholder-${c}`):g.jsxs(E.Fragment,{children:[g.jsx(Cve,{cards:s,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:o},...i}),d?null:g.jsx(fi,{})]},`carousel-${c}`)});const wve=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:o,isPrivate:s,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`}),E.createElement(e,{className:ee("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:g.jsxs(g.Fragment,{children:[g.jsx("div",{className:ee("img",{private:s,"no-image":!i}),children:i&&g.jsx(co,{image:i})}),g.jsxs("div",{className:"content",children:[a&&g.jsx("p",{className:"title text-medium",children:a}),o&&g.jsx("p",{className:"text text-medium",children:o})]})]})})};const Ave=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:o={},className:s=""})=>{const l=me.useIntl();let u=i?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=o;return E.createElement(e,{className:ee("course-progression",s,{"highlight-percentage":c,"has-circle-graph":a==="circle"}),children:g.jsxs(g.Fragment,{children:[g.jsx(Mv,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}}),g.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:d=>g.jsx("strong",{children:d}),number:u})}),u<100&&i&&g.jsx(wp,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})})]})})};const vD=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>E.createElement(e,{className:ee("lesson-name",i),"data-number":`${t}.${n}`,children:r});const yD=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const o=me.useIntl(),s=gh(`lessonType_${i}`)?o.formatMessage({id:`lessonType_${i}`}):zC(i||"");return g.jsxs("small",{className:ee("content-type",{[e]:e!=="default"}),children:[g.jsx("span",{className:ee("type",n),children:s})," ",t>0&&!r&&g.jsx(wp,{time:t})," ",a?g.jsx("span",{className:"additional",children:a}):null]})};const kve=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:o,slug:s,timeLeft:l,title:u},quizScores:c})=>{const d=me.useIntl(),f="courseStructure_",h=u.toLowerCase().includes("course conclusion");return g.jsxs(vh,{className:"course-structure",label:g.jsxs(g.Fragment,{children:[g.jsxs("small",{children:[d.formatMessage({id:`${f}section${h?"_end":""}`},{number:a})," ",!r&&o>=0&&g.jsx("span",{className:"time",children:i&&l===0?d.formatMessage({id:`${f}time_completed`}):g.jsx(wp,{time:o,appendedText:i?d.formatMessage({id:`${f}time_left`}):""})})]}),g.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[g.jsx("p",{children:n}),g.jsx("ol",{children:e&&e.length>0&&e.map(({completed:m,completionTime:p,contentType:y,icon:v,image:b,isIntroduction:_,optional:T,slug:C,subsectionId:x,title:w,type:P})=>{const O=i&&t||_,M={};return b&&(M.style={"--image":`url(${b})`}),g.jsx("li",{className:ee({article:y===Du.ARTICLE,discussion:y===Du.DISCUSSION,quiz:y===Du.QUIZ,completed:m&&y===Du.ARTICLE,locked:!O}),...M,children:g.jsx(fo,{href:O?`/microcourses/en/${s}/${C}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${UC(w)}`,gtmType:"article-click",children:g.jsxs(g.Fragment,{children:[g.jsx(vD,{sectionId:a,subsectionId:x,title:w,className:"course-title"})," ",g.jsx(yD,{completionTime:p,icon:v,optional:T,type:P,children:c&&c[C]&&g.jsx("span",{className:"quiz-score",children:`${c[C]}%`})})]})})},C)})})]})};const Sve=({isComplete:e=!1,onClick:t,...n})=>{const r=me.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),g.jsx(Ke,{...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:ee("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},Dve=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),DC=[{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 yd="notFoundError_",Ove=()=>{const e=me.useIntl(),t=[];return DC.forEach((n,r)=>{n.title=e.formatMessage({id:`${yd}post_${r+1}`}),t.push("solutionArticle")}),g.jsxs(sD,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:g.jsxs(mo,{children:[g.jsx(gD,{cards:DC,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),g.jsx(Ke,{href:"/solution-articles/",children:e.formatMessage({id:`${yd}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[g.jsx("h1",{children:e.formatMessage({id:`${yd}title`})}),g.jsx("p",{children:e.formatMessage({id:`${yd}text`})})]})};exports.ASSETS_URL=Hi;exports.ActionBar=V3;exports.ActionButton=bc;exports.ActivitiesFeed=hI;exports.ActivitySection=Jge;exports.ActivityType=Bl;exports.AddPost=u5;exports.Badge=f3;exports.BadgeScope=Fn;exports.Badges=h3;exports.BadgesContext=Nv;exports.BadgesProvider=n3;exports.Banner=uve;exports.BannerSection=fve;exports.Breadcrumbs=RI;exports.Buckets=lO;exports.Button=Ke;exports.ButtonWrapper=Fl;exports.COURSE_CONTENT_TYPES=Du;exports.CacheProvider=r3;exports.Card=d5;exports.CardBlock=gD;exports.Carousel=xve;exports.CharacterLimit=Jv;exports.Checkbox=ey;exports.CollapsibleSection=vh;exports.Columns=K3;exports.CommunityDetails=NN;exports.ConnectionCta=p3;exports.ConnectionDirectionType=Fv;exports.ConnectionStatusType=Rv;exports.ContactFooter=LU;exports.ContactForm=kw;exports.ContentTypeLabel=QC;exports.Contributors=Bv;exports.ConversationContext=Cp;exports.CookieBanner=Pw;exports.CourseProgression=Ave;exports.CourseStructure=kve;exports.CustomContentBanner=hve;exports.CustomEvents=bn;exports.DELETED_USER_ID=gc;exports.Directory=ive;exports.DiscussionContentType=at;exports.DiscussionConversation=cD;exports.DiscussionForm=l1;exports.DiscussionFormCard=fD;exports.DiscussionFormModal=mD;exports.DiscussionPost=u1;exports.DiscussionThread=pD;exports.DiscussionType=Cn;exports.Divider=fi;exports.DownloadSection=RU;exports.EMAILS=zs;exports.EditSection=MU;exports.EmailHelperTextBox=Y3;exports.EmptyStateBox=Ui;exports.EnrichedUrl=Qv;exports.FeatureFlags=o3;exports.Filters=q3;exports.FlagsProvider=a3;exports.Footer=Sy;exports.Form=Zi;exports.Formatting=ae;exports.Fragment=Pr;exports.FullWidthSection=mo;exports.GET_STREAM_USER_PREFIX=X0;exports.GlobalProviders=EO;exports.Header=l5;exports.HelperTextBox=JC;exports.HiddenFromScreenReaders=mh;exports.HideShowTextBox=e3;exports.HighlightSection=mve;exports.HighlightedTextBox=Er;exports.INVALID_TOKEN=VC;exports.IconBulletedList=dO;exports.ImageContainer=iO;exports.IntlProvider=s3;exports.InviteForm=Sw;exports.InviteModal=tve;exports.JoinButton=Uv;exports.Label=Af;exports.LanguageContext=Iv;exports.LanguageSwitcher=MI;exports.LessonName=vD;exports.LessonType=yD;exports.LikesButton=L3;exports.LikesFeed=H3;exports.LikesModal=U3;exports.Link=fo;exports.LoadMore=Vc;exports.LoadingBlock=m3;exports.LoadingPlaceholder=qr;exports.LoadingState=bh;exports.Logo=Xv;exports.LogoSection=BU;exports.MEMBERS_PER_PAGE=lD;exports.MENTION_REGEX=qC;exports.MarkCompleteButton=Sve;exports.MarkdownText=Xo;exports.MarketingBlock=gve;exports.Marks=Pi;exports.Member=Ea;exports.MembersList=uD;exports.Modal=Lv;exports.MoreMenu=bf;exports.NUMBER_OF_COUNTRIES=UD;exports.NUMBER_OF_USERS=HD;exports.NarrowCard=wve;exports.NavigationMenu=W3;exports.NotFoundError=Ove;exports.Overlay=Sa;exports.OverlayContext=Pv;exports.OverlayProvider=c3;exports.PageHeading=d3;exports.PageLayout=sD;exports.Password=Z3;exports.PasswordForm=xU;exports.PasswordRules=tx;exports.Pill=Fi;exports.Poll=dD;exports.Popover=ZC;exports.Portal=Ml;exports.ProfileForm=Dw;exports.ProfileImageChange=Aw;exports.ProfileModal=xp;exports.ProfileModalLauncher=c5;exports.ProfilePicture=ka;exports.ProgressBar=Mv;exports.ProgressTracker=oO;exports.PublishArticleForm=kU;exports.Rating=JI;exports.RepliesFeed=j3;exports.ResponsesHeading=hD;exports.ResponsiveImage=co;exports.ResultsVisibility=fh;exports.ReturnToNavButton=sO;exports.RichTextEditor=ky;exports.STORAGE_KEYS=Sv;exports.SearchForm=Nw;exports.ShareLink=z3;exports.ShareLinks=UI;exports.ShowEmail=ave;exports.SignupForm=PU;exports.Span=ng;exports.StatusBanner=gl;exports.TableOfContents=lve;exports.Tabs=zI;exports.Tags=wge;exports.TestimonialBlock=sve;exports.TimeToComplete=wp;exports.Toggle=TU;exports.Tooltip=ss;exports.TopLevelPage=$U;exports.UUID_V4_REGEX=vc;exports.UserContext=fn;exports.UserProvider=l3;exports.VisuallyHidden=xt;exports.addAriaProps=D3;exports.basicReducer=Rl;exports.camelCaseToDashCase=HC;exports.checkIntlPathExists=gh;exports.courseDiscussionRepliesFeedMock=mI;exports.enrichPostCategories=Zv;exports.generateConditions=Dd;exports.generateCssIcon=zD;exports.getAuthorData=Ll;exports.getCharacterLimitProps=G3;exports.getLongDate=Dv;exports.getMember=Eh;exports.getPostBody=Yv;exports.getShortDate=WC;exports.getValueLength=_h;exports.headerData=zc;exports.likesResponseMock=II;exports.mapGetStreamData=Dve;exports.pageReady=KC;exports.passwordValidator=eg;exports.repliesFeedMock=pI;exports.supportedLanguages=_d;exports.toCamelCase=UC;exports.toCapitalisedCase=jD;exports.toSentenceCase=zC;exports.transformSlugs=sg;exports.useAutoResize=FC;exports.useBadges=t3;exports.useCurrentPath=MC;exports.useEffectAfterMount=ml;exports.useElementWidth=lo;exports.useOverlay=u3;exports.useScrollListener=LC;exports.useScrollToHash=Av;exports.useTooltips=kv;exports.useUser=yh;
package/index.mjs CHANGED
@@ -61261,7 +61261,7 @@ const IS = ({
61261
61261
  length: C,
61262
61262
  gtmEvent: x
61263
61263
  } = Eh[E];
61264
- let P = f && v.slug ? `${v.locale || ""}${_}${v.slug}` : !1;
61264
+ let P = f && v.slug ? `${v.locale ? `/${v.locale}` : ""}${_}${v.slug}` : !1;
61265
61265
  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") && (P = v.slug);
61266
61266
  const D = (H) => {
61267
61267
  if (P) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/component-library",
3
- "version": "8.3.14",
3
+ "version": "8.3.15",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {