@apolitical/component-library 3.0.3-ac.0 → 3.0.3-ac.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cards/cards.types.d.ts +1 -1
- package/index.js +4 -4
- package/index.mjs +565 -554
- package/layout/page-layout/components/header/header.data.d.ts +14 -6
- package/package.json +1 -1
- package/style.css +1 -1
package/index.js
CHANGED
|
@@ -28,11 +28,11 @@ Check the render method of \``+h+"`."}return""}}function yi(h){{if(h!==void 0){v
|
|
|
28
28
|
|
|
29
29
|
Check your code at `+P+":"+B+"."}return""}}var ur={};function _i(h){{var P=lr();if(!P){var B=typeof h=="string"?h:h.displayName||h.name;B&&(P=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+B+">.")}return P}}function dr(h,P){{if(!h._store||h._store.validated||h.key!=null)return;h._store.validated=!0;var B=_i(P);if(ur[B])return;ur[B]=!0;var te="";h&&h._owner&&h._owner!==rn.current&&(te=" It was passed a child from "+w(h._owner.type)+"."),qe(h),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',B,te),qe(null)}}function fr(h,P){{if(typeof h!="object")return;if(tn(h))for(var B=0;B<h.length;B++){var te=h[B];sn(te)&&dr(te,P)}else if(sn(h))h._store&&(h._store.validated=!0);else if(h){var oe=x(h);if(typeof oe=="function"&&oe!==h.entries)for(var de=oe.call(h),se;!(se=de.next()).done;)sn(se.value)&&dr(se.value,P)}}}function xi(h){{var P=h.type;if(P==null||typeof P=="string")return;var B;if(typeof P=="function")B=P.propTypes;else if(typeof P=="object"&&(P.$$typeof===f||P.$$typeof===l))B=P.propTypes;else return;if(B){var te=w(P);oi(B,h.props,"prop",te,h)}else if(P.PropTypes!==void 0&&!an){an=!0;var oe=w(P);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",oe||"Unknown")}typeof P.getDefaultProps=="function"&&!P.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function wi(h){{for(var P=Object.keys(h.props),B=0;B<P.length;B++){var te=P[B];if(te!=="children"&&te!=="key"){qe(h),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),qe(null);break}}h.ref!==null&&(qe(h),y("Invalid attribute `ref` supplied to `React.Fragment`."),qe(null))}}function mr(h,P,B,te,oe,de){{var se=D(h);if(!se){var ae="";(h===void 0||typeof h=="object"&&h!==null&&Object.keys(h).length===0)&&(ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var be=yi(oe);be?ae+=be:ae+=lr();var fe;h===null?fe="null":tn(h)?fe="array":h!==void 0&&h.$$typeof===e?(fe="<"+(w(h.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):fe=typeof h,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",fe,ae)}var pe=bi(h,P,B,oe,de);if(pe==null)return pe;if(se){var _e=P.children;if(_e!==void 0)if(te)if(tn(_e)){for(var Ue=0;Ue<_e.length;Ue++)fr(_e[Ue],h);Object.freeze&&Object.freeze(_e)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else fr(_e,h)}return h===r?wi(pe):xi(pe),pe}}function ki(h,P,B){return mr(h,P,B,!0)}function ji(h,P,B){return mr(h,P,B,!1)}var Ti=ji,Ei=ki;it.Fragment=r,it.jsx=Ti,it.jsxs=Ei}()),it}process.env.NODE_ENV==="production"?Pn.exports=Di():Pn.exports=Ai();var a=Pn.exports;const Xr=()=>{const[t,e]=g.useState(window.location.pathname),n=()=>{const r=window.location.pathname;e(r)};return g.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),t},Ke=(t,e)=>{const n=g.useRef(!1);g.useEffect(()=>{n.current?t():n.current=!0},e)};function Ii(t,e,n){var r=this,i=g.useRef(null),s=g.useRef(0),o=g.useRef(null),c=g.useRef([]),f=g.useRef(),u=g.useRef(),d=g.useRef(t),l=g.useRef(!0);d.current=t;var m=typeof window<"u",p=!e&&e!==0&&m;if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var b=!!(n=n||{}).leading,_=!("trailing"in n)||!!n.trailing,x="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,y=x?Math.max(+n.maxWait||0,e):null;g.useEffect(function(){return l.current=!0,function(){l.current=!1}},[]);var S=g.useMemo(function(){var T=function(D){var C=c.current,E=f.current;return c.current=f.current=null,s.current=D,u.current=d.current.apply(E,C)},k=function(D,C){p&&cancelAnimationFrame(o.current),o.current=p?requestAnimationFrame(D):setTimeout(D,C)},Z=function(D){if(!l.current)return!1;var C=D-i.current;return!i.current||C>=e||C<0||x&&D-s.current>=y},O=function(D){return o.current=null,_&&c.current?T(D):(c.current=f.current=null,u.current)},Y=function D(){var C=Date.now();if(Z(C))return O(C);if(l.current){var E=e-(C-i.current),w=x?Math.min(E,y-(C-s.current)):E;k(D,w)}},R=function(){if(m||v){var D=Date.now(),C=Z(D);if(c.current=[].slice.call(arguments),f.current=r,i.current=D,C){if(!o.current&&l.current)return s.current=i.current,k(Y,e),b?T(i.current):u.current;if(x)return k(Y,e),T(i.current)}return o.current||k(Y,e),u.current}};return R.cancel=function(){o.current&&(p?cancelAnimationFrame(o.current):clearTimeout(o.current)),s.current=0,c.current=i.current=f.current=o.current=null},R.isPending=function(){return!!o.current},R.flush=function(){return o.current?O(Date.now()):u.current},R},[b,x,e,y,_,p,m,v]);return S}function ea(t,e,n){var r=n===void 0?{}:n,i=r.leading,s=r.trailing;return Ii(t,e,{maxWait:e,leading:i===void 0||i,trailing:s===void 0||s})}let on;const Xe=(t=!0,e=!1,n="window")=>{if(!t)return;const[r,i]=g.useState(0)||[!1,()=>{}],s=n==="window"?[]:[n];g.useEffect(()=>(c(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",f),()=>{clearTimeout(on),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",f)}),s);const o=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},c=()=>{i(o())},f=({detail:d})=>{const{id:l}=d;n==="window"||!n.closest(`#${l}`)||o()===r||c()},u=ea(()=>{o()!==r&&(e&&(clearTimeout(on),document.body.classList.add("is-resizing"),on=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),c())},500,{leading:!0});return r},ta=({scrollPosition:t=0,offset:e={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,s]=g.useState({current:0,past:0})||[!1,()=>{}],[o,c]=g.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];g.useEffect(()=>(f(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const f=()=>{const d=window.scrollY,l=i.current,m=d-l,p=m>0?"down":"up";if(s({current:d,past:l}),p==="down"){d>=t+e.down&&!o.scrollDown&&(!o.scrollUp||m>e.up)&&(n(),c({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=e.up&&!o.scrollUp&&(r(),c({scrollUp:!0,scrollDown:!1}))},u=ea(()=>{f()},250);return i},na=(t=[],e=!0)=>{t=Array.isArray(t)?t:[t];const n=g.useRef(!1);Ke(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(e?{behavior:"smooth"}:null),n.current=!0)}},t)},ra=(t,e)=>{Array.isArray(e)||(e=[e]);const n=dt(t);return e.forEach(({type:r,value:i})=>{Si(n,r,i)}),n},aa=t=>{const e=[];return t.forEach(n=>{const r=parseInt(n);isNaN(r)||e.push(r)}),e.sort((n,r)=>n-r)},ia=(t,e,n)=>{let r=n.mobile;for(const i in e){const s=parseInt(String(e[i]));if(t>=s)r=n[s];else if(t<s)break}return r},Li=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ae="https://storage.googleapis.com/apolitical-assets/",We={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Bi="200,000+";function sa(t){return t?{"--icon":`url(${Ae}icons/${t}.svg)`}:{}}const De={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},qi=(t,e="en")=>new Date(t).toLocaleString(e,{day:"numeric",month:"short"}),oa=(t,e="en")=>new Date(t).toLocaleString(e,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Rn=t=>{let e;const n=Dt(),r=Dt(new Date(t));try{e=n.getTime()-r.getTime()}catch{return""}const i=e/De.milliseconds.inHour,s=Math.floor(e/De.milliseconds.inDay);if(s<1)return i<1?{path:"now"}:{path:"hours",number:Math.floor(i)};if(s<7)return{path:"days",number:s};const o=Math.floor(s/7);return o<=De.year.weeks?{path:"weeks",number:o}:{path:"years",number:Math.floor(s/De.year.days)}},Dt=t=>{const n=(t||new Date).toUTCString();return new Date(n)},Ui=(t,e,n)=>{let r;const i=Dt(),s=Dt(new Date(t));try{r=i.getTime()-s.getTime()}catch{return!1}switch(n){case"seconds":return r/De.milliseconds.inSecond<=e;case"minutes":return r/De.milliseconds.inMinute<=e;case"hours":return r/De.milliseconds.inHour<=e}return!1},zi=t=>new Promise(e=>setTimeout(e,t)),Bn={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_community:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_registered:"Registered",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_cta_people:"View profile",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
31
|
+
Check the top-level render call using <`+B+">.")}return P}}function dr(h,P){{if(!h._store||h._store.validated||h.key!=null)return;h._store.validated=!0;var B=_i(P);if(ur[B])return;ur[B]=!0;var te="";h&&h._owner&&h._owner!==rn.current&&(te=" It was passed a child from "+w(h._owner.type)+"."),qe(h),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',B,te),qe(null)}}function fr(h,P){{if(typeof h!="object")return;if(tn(h))for(var B=0;B<h.length;B++){var te=h[B];sn(te)&&dr(te,P)}else if(sn(h))h._store&&(h._store.validated=!0);else if(h){var oe=x(h);if(typeof oe=="function"&&oe!==h.entries)for(var de=oe.call(h),se;!(se=de.next()).done;)sn(se.value)&&dr(se.value,P)}}}function xi(h){{var P=h.type;if(P==null||typeof P=="string")return;var B;if(typeof P=="function")B=P.propTypes;else if(typeof P=="object"&&(P.$$typeof===f||P.$$typeof===l))B=P.propTypes;else return;if(B){var te=w(P);oi(B,h.props,"prop",te,h)}else if(P.PropTypes!==void 0&&!an){an=!0;var oe=w(P);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",oe||"Unknown")}typeof P.getDefaultProps=="function"&&!P.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function wi(h){{for(var P=Object.keys(h.props),B=0;B<P.length;B++){var te=P[B];if(te!=="children"&&te!=="key"){qe(h),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),qe(null);break}}h.ref!==null&&(qe(h),y("Invalid attribute `ref` supplied to `React.Fragment`."),qe(null))}}function mr(h,P,B,te,oe,de){{var se=D(h);if(!se){var ae="";(h===void 0||typeof h=="object"&&h!==null&&Object.keys(h).length===0)&&(ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var be=yi(oe);be?ae+=be:ae+=lr();var fe;h===null?fe="null":tn(h)?fe="array":h!==void 0&&h.$$typeof===e?(fe="<"+(w(h.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):fe=typeof h,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",fe,ae)}var pe=bi(h,P,B,oe,de);if(pe==null)return pe;if(se){var _e=P.children;if(_e!==void 0)if(te)if(tn(_e)){for(var Ue=0;Ue<_e.length;Ue++)fr(_e[Ue],h);Object.freeze&&Object.freeze(_e)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else fr(_e,h)}return h===r?wi(pe):xi(pe),pe}}function ki(h,P,B){return mr(h,P,B,!0)}function ji(h,P,B){return mr(h,P,B,!1)}var Ti=ji,Ei=ki;it.Fragment=r,it.jsx=Ti,it.jsxs=Ei}()),it}process.env.NODE_ENV==="production"?Pn.exports=Di():Pn.exports=Ai();var a=Pn.exports;const Xr=()=>{const[t,e]=g.useState(window.location.pathname),n=()=>{const r=window.location.pathname;e(r)};return g.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),t},Ke=(t,e)=>{const n=g.useRef(!1);g.useEffect(()=>{n.current?t():n.current=!0},e)};function Ii(t,e,n){var r=this,i=g.useRef(null),s=g.useRef(0),o=g.useRef(null),c=g.useRef([]),f=g.useRef(),u=g.useRef(),d=g.useRef(t),l=g.useRef(!0);d.current=t;var m=typeof window<"u",p=!e&&e!==0&&m;if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var b=!!(n=n||{}).leading,_=!("trailing"in n)||!!n.trailing,x="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,y=x?Math.max(+n.maxWait||0,e):null;g.useEffect(function(){return l.current=!0,function(){l.current=!1}},[]);var S=g.useMemo(function(){var T=function(D){var C=c.current,E=f.current;return c.current=f.current=null,s.current=D,u.current=d.current.apply(E,C)},k=function(D,C){p&&cancelAnimationFrame(o.current),o.current=p?requestAnimationFrame(D):setTimeout(D,C)},Z=function(D){if(!l.current)return!1;var C=D-i.current;return!i.current||C>=e||C<0||x&&D-s.current>=y},O=function(D){return o.current=null,_&&c.current?T(D):(c.current=f.current=null,u.current)},Y=function D(){var C=Date.now();if(Z(C))return O(C);if(l.current){var E=e-(C-i.current),w=x?Math.min(E,y-(C-s.current)):E;k(D,w)}},R=function(){if(m||v){var D=Date.now(),C=Z(D);if(c.current=[].slice.call(arguments),f.current=r,i.current=D,C){if(!o.current&&l.current)return s.current=i.current,k(Y,e),b?T(i.current):u.current;if(x)return k(Y,e),T(i.current)}return o.current||k(Y,e),u.current}};return R.cancel=function(){o.current&&(p?cancelAnimationFrame(o.current):clearTimeout(o.current)),s.current=0,c.current=i.current=f.current=o.current=null},R.isPending=function(){return!!o.current},R.flush=function(){return o.current?O(Date.now()):u.current},R},[b,x,e,y,_,p,m,v]);return S}function ea(t,e,n){var r=n===void 0?{}:n,i=r.leading,s=r.trailing;return Ii(t,e,{maxWait:e,leading:i===void 0||i,trailing:s===void 0||s})}let on;const Xe=(t=!0,e=!1,n="window")=>{if(!t)return;const[r,i]=g.useState(0)||[!1,()=>{}],s=n==="window"?[]:[n];g.useEffect(()=>(c(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",f),()=>{clearTimeout(on),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",f)}),s);const o=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},c=()=>{i(o())},f=({detail:d})=>{const{id:l}=d;n==="window"||!n.closest(`#${l}`)||o()===r||c()},u=ea(()=>{o()!==r&&(e&&(clearTimeout(on),document.body.classList.add("is-resizing"),on=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),c())},500,{leading:!0});return r},ta=({scrollPosition:t=0,offset:e={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,s]=g.useState({current:0,past:0})||[!1,()=>{}],[o,c]=g.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];g.useEffect(()=>(f(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const f=()=>{const d=window.scrollY,l=i.current,m=d-l,p=m>0?"down":"up";if(s({current:d,past:l}),p==="down"){d>=t+e.down&&!o.scrollDown&&(!o.scrollUp||m>e.up)&&(n(),c({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=e.up&&!o.scrollUp&&(r(),c({scrollUp:!0,scrollDown:!1}))},u=ea(()=>{f()},250);return i},na=(t=[],e=!0)=>{t=Array.isArray(t)?t:[t];const n=g.useRef(!1);Ke(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(e?{behavior:"smooth"}:null),n.current=!0)}},t)},ra=(t,e)=>{Array.isArray(e)||(e=[e]);const n=dt(t);return e.forEach(({type:r,value:i})=>{Si(n,r,i)}),n},aa=t=>{const e=[];return t.forEach(n=>{const r=parseInt(n);isNaN(r)||e.push(r)}),e.sort((n,r)=>n-r)},ia=(t,e,n)=>{let r=n.mobile;for(const i in e){const s=parseInt(String(e[i]));if(t>=s)r=n[s];else if(t<s)break}return r},Li=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ae="https://storage.googleapis.com/apolitical-assets/",We={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Bi="200,000+";function sa(t){return t?{"--icon":`url(${Ae}icons/${t}.svg)`}:{}}const De={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},qi=(t,e="en")=>new Date(t).toLocaleString(e,{day:"numeric",month:"short"}),oa=(t,e="en")=>new Date(t).toLocaleString(e,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Rn=t=>{let e;const n=Dt(),r=Dt(new Date(t));try{e=n.getTime()-r.getTime()}catch{return""}const i=e/De.milliseconds.inHour,s=Math.floor(e/De.milliseconds.inDay);if(s<1)return i<1?{path:"now"}:{path:"hours",number:Math.floor(i)};if(s<7)return{path:"days",number:s};const o=Math.floor(s/7);return o<=De.year.weeks?{path:"weeks",number:o}:{path:"years",number:Math.floor(s/De.year.days)}},Dt=t=>{const n=(t||new Date).toUTCString();return new Date(n)},Ui=(t,e,n)=>{let r;const i=Dt(),s=Dt(new Date(t));try{r=i.getTime()-s.getTime()}catch{return!1}switch(n){case"seconds":return r/De.milliseconds.inSecond<=e;case"minutes":return r/De.milliseconds.inMinute<=e;case"hours":return r/De.milliseconds.inHour<=e}return!1},zi=t=>new Promise(e=>setTimeout(e,t)),Bn={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_registered:"Registered",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_cta_people:"View profile",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
|
-
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Zi={languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},Wi={languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Hi={languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Vi=Object.freeze(Object.defineProperty({__proto__:null,en:Bn,es:Zi,fr:Wi,pt:Hi},Symbol.toStringTag,{value:"Module"})),ca=t=>t in Bn,ke=(t,e,n,r,i={})=>{let s="";return ca(`${e}_${n}`)?s=t({id:`${e}_${n}`},i):s=t({id:e},{[r]:n,...i}),s},Yi=(t,e,n)=>{if(!t||t===0)return"0";e||(e=0),n||(n=["k","m","b","t"]);let r=t.toString();e=Math.pow(10,e);for(let i=n.length-1;i>=0;i--){const s=Math.pow(10,(i+1)*3);if(s<=t){t=Math.round(t*e/s)/e,t===1e3&&i<n.length-1&&(t=1,i++),r=`${t}${n[i]}`;break}}return r},Ft=(t,e)=>g.Children.map(t,n=>Object.is(n,null)?n:g.cloneElement(n,{...e})),la=(t=0)=>{setTimeout(()=>{const e=document.querySelector(".splash-screen");e&&e.remove(),window.prerenderReady=!0},t)},Ki=t=>t.replace(/\s+/g,"").length>0,Gi=t=>{const e=t.length>8,n=/[0-9]/.test(t)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(t),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(t);return{isValid:e&&n&&r,matchingRules:{isMoreThanEightCharacters:e,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}},re=({variant:t="primary",size:e="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:s="button",onClick:o=!1,className:c="",disabled:f=!1,screenreaderText:u=!1,children:d=!1,...l})=>{const p=Xe(typeof e=="object");if(typeof e=="object"&&typeof p=="number"){const x=Object.assign({},e),v=aa(Object.keys(x));e=ia(p,v,x)}const b=[];typeof e=="string"&&b.push(e),r&&(b.push("icon"),typeof r=="object"?(b.push(r.icon),r.position?b.push(r.position):b.push("left"),r.hover&&b.push(`hover_${r.hover}`),r.animate&&(b.push("animate"),typeof r.animate=="string"&&b.push(r.animate))):(b.push(r),!r.includes("right")&&!r.includes("left")&&b.push("left"))),n.muted&&b.push("muted"),n.fullWidth&&b.push("full-width");const _={...l,className:M(t,c,b,{"no-text":!d,disabled:f,button:i}),onClick:x=>{(!i||i[0]==="#")&&o&&(x.preventDefault(),x.stopPropagation()),o&&o(x)},disabled:typeof f=="object"&&"isClickable"in f?!f.isClickable:f};return i&&(s="a",_.href=i),g.createElement(s,_,d||(u?a.jsx(ge,{showOnFocus:!1,children:u}):null))},et=({buttons:t,className:e="",...n})=>{const r=t.length>1?"ul":"p",i=t.map((s,o)=>r==="p"?a.jsx(re,{...s},o):a.jsx("li",{children:a.jsx(re,{...s})},o));return g.createElement(r,{className:M("button-wrapper",e),...n,children:i})};const je=({className:t="",maxWidth:e=!1})=>{const n=e?{"--max-width":`${e/16}rem`}:{};return a.jsx("hr",{className:M(t,{"has-max-width":e}),style:n})},vr={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},Qi=({aspect:t,range:e,sizes:n})=>{const{range:r,sizes:i}=t?vr[t]:vr.fallback;return{range:e&&e.length>0?e:r,sizes:n||i}},Ji=({format:t,height:e,query:n,width:r})=>{let i=`w=${r}&h=${e}`;return i=t?`${i}&fm=${t}`:i,i=n?`${i}&${n}`:i,i},cn=({format:t,range:e,url:n,query:r})=>e.map(({height:i,width:s})=>`${n}?${Ji({format:t,height:i,query:r,width:s})} ${s}w`).join(", ");const tt=({image:t,className:e,testId:n})=>{const{description:r,height:i,type:s,query:o,url:c,width:f,loading:u,decoding:d,fetchPriority:l}=t,{range:m,sizes:p}=Qi(t),b=cn({format:"avif",query:o,range:m,url:c}),_=cn({format:"webp",query:o,range:m,url:c}),x=cn({format:"",query:o,range:m,url:c});return a.jsxs("picture",{className:e,children:[s!=="image/gif"&&a.jsx("source",{type:"image/avif",srcSet:b,sizes:p,"data-testid":"source"}),a.jsx("source",{type:"image/webp",srcSet:_,sizes:p,"data-testid":"source"}),a.jsx("img",{srcSet:x,sizes:p,src:c,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:l||"auto",width:f,height:i,"data-testid":n||"image"})]})};const Xi=({image:t,className:e,testId:n})=>a.jsx("div",{className:`image-container ${e}`,"data-testid":n||"image-container",children:t&&a.jsx(tt,{image:{...t},className:"image"})}),nt=({href:t,children:e,fallbackElement:n,className:r="",onClick:i,gtmContext:s,gtmType:o,...c})=>{if(t){const f={...c};return i&&(f.onClick=i),s&&(f["data-gtm-event-context"]=s),o&&(f["data-gtm-event-type"]=o),a.jsx("a",{href:t,className:M("gtm-trackable",r),...f,children:e})}return n?g.createElement(n,{children:e,className:r,...c}):e};const es=({elementId:t,offset:e=20})=>{const n=q.useIntl(),r=()=>{const i=document.getElementById(t);if(!i)return;const s=document.getElementById("header");s&&window.scrollTo({top:i.offsetTop-s.clientHeight-e})};return a.jsx(re,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};let st=!1;const ua=({isOpen:t=!1,isLoading:e=!1,children:n})=>{const r=q.useIntl(),i=g.useRef(null),[s,o]=g.useState("hidden");g.useEffect(()=>{const f=i.current;if(f)return f.addEventListener("transitionend",c),()=>{f.removeEventListener("transitionend",c)}},[]);const c=({propertyName:f})=>{f==="opacity"&&(st!==!1&&clearTimeout(st),o(u=>u==="opening"?"open":u==="closing"?"closed":u==="closed"?"hidden":u))};return Ke(()=>{st!==!1&&clearTimeout(st);let f="open";t?o("opening"):(o("closing"),f="hidden"),st=setTimeout(()=>{o(f)},300)},[t]),a.jsx("aside",{ref:i,className:M("tooltip text-medium",s,{loading:e}),hidden:s==="hidden",children:e?a.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?a.jsx("p",{children:n}):n})};const ts=({className:t="",image:e,...n})=>e?(typeof e=="string"&&(e={width:1080,height:200,type:"image/png",url:e}),e.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],e.query="fit=thumb&f=center",a.jsx(tt,{...n,className:M("banner",t),image:{...e,aspect:"banner"}})):null;const Le=({children:t,className:e="",styling:n={},...r})=>{const{background:i="default"}=n;return a.jsx("section",{className:M("full-width-section",e,{[i]:i!=="default"}),...r,children:t})};const ns=({text:t,buttons:e,className:n=""})=>{const r=[];return e.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),a.jsx(Le,{className:M("download-section",n),children:a.jsxs(a.Fragment,{children:[g.createElement(typeof t=="string"?"h2":t.element,{className:"text"},typeof t=="string"?t:t.text),a.jsx(et,{buttons:r})]})})};function da({href:t,setShowModal:e}){typeof t!="string"&&e(!0)}const rs=({icon:t,description:e,ctaMessage:n,href:r,showEditButton:i,setShowModal:s})=>{const{formatMessage:o}=q.useIntl();return a.jsxs("div",{className:M("edit-section-placeholder",{"has-icon":!!t}),style:sa(t),children:[a.jsx("p",{children:e||o({id:"edit_section_placeholder_description"})}),i&&a.jsx(re,{href:r,variant:"secondary",size:"small",onClick:()=>da({href:r,setShowModal:s}),children:n||o({id:"edit_section_placeholder_cta"})})]})},as=({children:t,className:e="",formProps:n,href:r,title:i,modalTitle:s,placeholder:o,showDivider:c=!0})=>{const[f,u]=g.useState(!1),d=typeof r=="string"||!!n,l=()=>u(!1);return a.jsxs("section",{className:M("edit-section",e),children:[n&&a.jsx(bt,{title:s||`Edit ${i}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:l},className:M("edit-section-modal"),children:a.jsx(Qt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async m=>{var p,b;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((b=n==null?void 0:n.functions)==null?void 0:b.onSuccess(m)),u(!1)},onCancel:l}})}),a.jsxs("div",{className:"edit-section-header",children:[a.jsx("h2",{className:"edit-section-header-title",children:i}),d&&a.jsx(re,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>da({href:r,setShowModal:u}),children:"Edit"})]}),t||a.jsx(rs,{...o,href:r,setShowModal:u,showEditButton:d}),c&&a.jsx(je,{})]})};const is=({title:t=!1,logos:e=[],className:n=""})=>{const r=e.length;if(r===0)return null;const i={element:typeof t=="object"?t.element:"h2",text:typeof t=="string"?t:typeof t=="object"?t.text:""};return a.jsxs("div",{className:M("logos",n),children:[t&&g.createElement(i.element,{className:"title"},i.text),a.jsx("ul",{className:M({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:e.map(({logo:s,nameOfBusiness:o,link:c=!1,description:f=!1},u)=>{if(!s||!s.url)return null;const d=a.jsx("img",{src:s.url,width:s.width||"auto",height:s.height||"auto",alt:o});return a.jsxs("li",{children:[a.jsx("p",{className:"img-wrapper",children:c?a.jsx("a",{href:c,target:"_blank",rel:"nofollow noreferrer noopener",children:d}):d}),f&&a.jsx("small",{children:f})]},window.btoa(`${s.url}_${u}`))})})]})};const ss=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],os=({className:t="",content:e,image:n,variant:r="default",spacing:i="normal",hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:c})=>{const f=["eyebrow","title","text"],u={eyebrow:"small",title:"h1",text:"p"},d={};return f.forEach(l=>{if(!e[l]){d[l]=!1;return}if(!s[l]){if(typeof e[l]=="object"){d[l]=e[l];const{text:m,element:p}=e[l];if(p&&ss.includes(p.toLowerCase()))return;d[l]={text:m,element:u[l]};return}d[l]={text:e[l],element:u[l]}}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=l=>{l.preventDefault(),l.stopPropagation();const m=document.getElementById(o.link.substring(1));m&&m.scrollIntoView({behavior:"smooth"})}),a.jsx(Le,{className:M("banner-section",r,i,t,{"has-image":n,"has-extra-spacing":i==="normal"&&d.eyebrow&&d.title}),children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"content-wrapper",children:[f.map(l=>{if(d[l]&&typeof d[l]=="object"){const{text:m,element:p=""}=d[l];return l==="text"?a.jsx(ht,{overrideType:"text-only",className:"text",children:m},l):g.createElement(p,{key:l,className:l},m)}return null}),c,o&&o.text&&o.link&&a.jsx(re,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),n&&a.jsx(tt,{image:{...n,aspect:"banner"}})]})})},cs=g.memo(os);const ls=({alignImage:t="left",className:e,content:n,image:r})=>{const i=()=>typeof n=="string"?a.jsx(Je,{children:n}):n;return a.jsxs(Le,{className:M("highlight-section",e),children:[r&&a.jsx("div",{className:M("highlight-container highlight-image",{[`highlight-image-${t}`]:t==="right"}),children:a.jsx(tt,{image:r})}),a.jsx("div",{className:M("highlight-container highlight-content-wrapper",{"no-image":!r}),children:a.jsx("div",{className:M("highlight-content",{"highlight-content-right":t==="left"}),children:i()})})]})},us=g.memo(ls);const ds=({variant:t="primary",button:e=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:a.jsxs("aside",{className:M("marketing-block",t),children:[n&&a.jsx("p",{className:"title",children:n}),r&&a.jsx("p",{children:r}),e&&a.jsx(re,{variant:"secondary",size:"medium",href:e.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:e.text})]}),fa=({showDevTools:t=!0,children:e})=>{const n=new me.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return a.jsxs(me.QueryClientProvider,{client:n,children:[e,t&&a.jsx(Ci.ReactQueryDevtools,{initialIsOpen:!1})]})};var fs=g.createContext({client:Rt});function ms(t){var e=t.children,n=t.client,r=t.apiKey,i=t.options,s=g.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Rt.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Rt.init(r,i)),Rt)},[n,r]);return g.createElement(fs.Provider,{value:{client:s}},e)}const ma=({children:t,user:e})=>e.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(ms,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:e.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!e.id}},children:t}):t,pa=({children:t,locale:e,messages:n})=>{const r=e||"en",i={...Vi[r],...n||{}};return a.jsx(q.IntlProvider,{locale:r,messages:i,children:t})},Te=g.createContext({isLoading:!0});function Kt(){return g.useContext(Te)}const ha=({children:t,user:e})=>a.jsx(Te.Provider,{value:e,children:t}),ps=({bootstrap:t,children:e,intl:n,showDevTools:r})=>{const[i,s]=g.useState({isLoading:!0});return g.useEffect(()=>{t().then(o=>{s({...o,isLoading:!1}),la(5e3)}).catch(()=>s({isLoading:!1}))},[]),a.jsx(pa,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:a.jsx(Ln.CookiesProvider,{children:a.jsx(ha,{user:i,children:a.jsx(fa,{showDevTools:r,children:a.jsx(ma,{user:i,children:e})})})})})};const qn=({label:t=!1,className:e="",children:n})=>{const r=q.useIntl();return a.jsxs("details",{className:M("collapsible-section",e),children:[a.jsx("summary",{children:t||r.formatMessage({id:"collapsibleSection_summary"})}),a.jsx("div",{className:"content",children:n})]})};const Ne=({variant:t="primary",icon:e,className:n="",children:r,...i})=>{const s=e?{"--icon":`url(${Ae}icons/${e}.svg)`}:{};return a.jsx("div",{className:M("highlighted-text-box",t,n,{"has-icon":e}),style:s,...i,children:r})};const Be=({variant:t="empty",text:e=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const s=typeof n=="object"&&"breakpoints"in n,o=Xe(s);if(s&&typeof n=="object"&&typeof o=="number"){const l=Object.assign({},n.breakpoints),m=aa(Object.keys(l));i=ia(o,m,l)}const{breakpoints:c,text:f="",component:u,...d}=n;return a.jsx(Ne,{variant:"subtle",className:M("empty-state-box",t,r),children:a.jsxs(a.Fragment,{children:[e&&typeof e=="string"?a.jsx(Je,{options:{forceBlock:!0},children:e}):e,i&&typeof n=="object"&&(u||a.jsx(re,{...d,variant:n.variant?n.variant:"secondary",children:f}))]})})};const Fn=({children:t,...e})=>a.jsx("p",{...e,children:t}),ga={q:Fn,blockquote:Fn};for(let t=1;t<=6;t++)ga[`h${t}`]={component:Fn,props:{className:"title"}};const va=({type:t="default",className:e="",heading:n=!1,children:r})=>a.jsxs("div",{className:M("helper-text-box text-small",t,e),children:[n&&a.jsx("p",{className:"title",children:n}),typeof r=="string"?a.jsx(Je,{options:{wrapper:g.Fragment,forceBlock:!0,overrides:ga},children:r}):a.jsx("p",{children:r})]});const hs=({className:t="",show:e=!1,hide:n=!1,text:r,children:i})=>{const s=q.useIntl(),o=g.useRef(null),[c,f]=g.useState(""),[u,d]=g.useState("closed");g.useEffect(()=>{const p=o.current;if(p)return p.addEventListener("transitionend",l),()=>{p.removeEventListener("transitionend",l)}},[]),g.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Zi={languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},Wi={languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Hi={languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Vi=Object.freeze(Object.defineProperty({__proto__:null,en:Bn,es:Zi,fr:Wi,pt:Hi},Symbol.toStringTag,{value:"Module"})),ca=t=>t in Bn,ke=(t,e,n,r,i={})=>{let s="";return ca(`${e}_${n}`)?s=t({id:`${e}_${n}`},i):s=t({id:e},{[r]:n,...i}),s},Yi=(t,e,n)=>{if(!t||t===0)return"0";e||(e=0),n||(n=["k","m","b","t"]);let r=t.toString();e=Math.pow(10,e);for(let i=n.length-1;i>=0;i--){const s=Math.pow(10,(i+1)*3);if(s<=t){t=Math.round(t*e/s)/e,t===1e3&&i<n.length-1&&(t=1,i++),r=`${t}${n[i]}`;break}}return r},Ft=(t,e)=>g.Children.map(t,n=>Object.is(n,null)?n:g.cloneElement(n,{...e})),la=(t=0)=>{setTimeout(()=>{const e=document.querySelector(".splash-screen");e&&e.remove(),window.prerenderReady=!0},t)},Ki=t=>t.replace(/\s+/g,"").length>0,Gi=t=>{const e=t.length>8,n=/[0-9]/.test(t)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(t),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(t);return{isValid:e&&n&&r,matchingRules:{isMoreThanEightCharacters:e,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}},re=({variant:t="primary",size:e="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:s="button",onClick:o=!1,className:c="",disabled:f=!1,screenreaderText:u=!1,children:d=!1,...l})=>{const p=Xe(typeof e=="object");if(typeof e=="object"&&typeof p=="number"){const x=Object.assign({},e),v=aa(Object.keys(x));e=ia(p,v,x)}const b=[];typeof e=="string"&&b.push(e),r&&(b.push("icon"),typeof r=="object"?(b.push(r.icon),r.position?b.push(r.position):b.push("left"),r.hover&&b.push(`hover_${r.hover}`),r.animate&&(b.push("animate"),typeof r.animate=="string"&&b.push(r.animate))):(b.push(r),!r.includes("right")&&!r.includes("left")&&b.push("left"))),n.muted&&b.push("muted"),n.fullWidth&&b.push("full-width");const _={...l,className:M(t,c,b,{"no-text":!d,disabled:f,button:i}),onClick:x=>{(!i||i[0]==="#")&&o&&(x.preventDefault(),x.stopPropagation()),o&&o(x)},disabled:typeof f=="object"&&"isClickable"in f?!f.isClickable:f};return i&&(s="a",_.href=i),g.createElement(s,_,d||(u?a.jsx(ge,{showOnFocus:!1,children:u}):null))},et=({buttons:t,className:e="",...n})=>{const r=t.length>1?"ul":"p",i=t.map((s,o)=>r==="p"?a.jsx(re,{...s},o):a.jsx("li",{children:a.jsx(re,{...s})},o));return g.createElement(r,{className:M("button-wrapper",e),...n,children:i})};const je=({className:t="",maxWidth:e=!1})=>{const n=e?{"--max-width":`${e/16}rem`}:{};return a.jsx("hr",{className:M(t,{"has-max-width":e}),style:n})},vr={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},Qi=({aspect:t,range:e,sizes:n})=>{const{range:r,sizes:i}=t?vr[t]:vr.fallback;return{range:e&&e.length>0?e:r,sizes:n||i}},Ji=({format:t,height:e,query:n,width:r})=>{let i=`w=${r}&h=${e}`;return i=t?`${i}&fm=${t}`:i,i=n?`${i}&${n}`:i,i},cn=({format:t,range:e,url:n,query:r})=>e.map(({height:i,width:s})=>`${n}?${Ji({format:t,height:i,query:r,width:s})} ${s}w`).join(", ");const tt=({image:t,className:e,testId:n})=>{const{description:r,height:i,type:s,query:o,url:c,width:f,loading:u,decoding:d,fetchPriority:l}=t,{range:m,sizes:p}=Qi(t),b=cn({format:"avif",query:o,range:m,url:c}),_=cn({format:"webp",query:o,range:m,url:c}),x=cn({format:"",query:o,range:m,url:c});return a.jsxs("picture",{className:e,children:[s!=="image/gif"&&a.jsx("source",{type:"image/avif",srcSet:b,sizes:p,"data-testid":"source"}),a.jsx("source",{type:"image/webp",srcSet:_,sizes:p,"data-testid":"source"}),a.jsx("img",{srcSet:x,sizes:p,src:c,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:l||"auto",width:f,height:i,"data-testid":n||"image"})]})};const Xi=({image:t,className:e,testId:n})=>a.jsx("div",{className:`image-container ${e}`,"data-testid":n||"image-container",children:t&&a.jsx(tt,{image:{...t},className:"image"})}),nt=({href:t,children:e,fallbackElement:n,className:r="",onClick:i,gtmContext:s,gtmType:o,...c})=>{if(t){const f={...c};return i&&(f.onClick=i),s&&(f["data-gtm-event-context"]=s),o&&(f["data-gtm-event-type"]=o),a.jsx("a",{href:t,className:M("gtm-trackable",r),...f,children:e})}return n?g.createElement(n,{children:e,className:r,...c}):e};const es=({elementId:t,offset:e=20})=>{const n=q.useIntl(),r=()=>{const i=document.getElementById(t);if(!i)return;const s=document.getElementById("header");s&&window.scrollTo({top:i.offsetTop-s.clientHeight-e})};return a.jsx(re,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};let st=!1;const ua=({isOpen:t=!1,isLoading:e=!1,children:n})=>{const r=q.useIntl(),i=g.useRef(null),[s,o]=g.useState("hidden");g.useEffect(()=>{const f=i.current;if(f)return f.addEventListener("transitionend",c),()=>{f.removeEventListener("transitionend",c)}},[]);const c=({propertyName:f})=>{f==="opacity"&&(st!==!1&&clearTimeout(st),o(u=>u==="opening"?"open":u==="closing"?"closed":u==="closed"?"hidden":u))};return Ke(()=>{st!==!1&&clearTimeout(st);let f="open";t?o("opening"):(o("closing"),f="hidden"),st=setTimeout(()=>{o(f)},300)},[t]),a.jsx("aside",{ref:i,className:M("tooltip text-medium",s,{loading:e}),hidden:s==="hidden",children:e?a.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?a.jsx("p",{children:n}):n})};const ts=({className:t="",image:e,...n})=>e?(typeof e=="string"&&(e={width:1080,height:200,type:"image/png",url:e}),e.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],e.query="fit=thumb&f=center",a.jsx(tt,{...n,className:M("banner",t),image:{...e,aspect:"banner"}})):null;const Le=({children:t,className:e="",styling:n={},...r})=>{const{background:i="default"}=n;return a.jsx("section",{className:M("full-width-section",e,{[i]:i!=="default"}),...r,children:t})};const ns=({text:t,buttons:e,className:n=""})=>{const r=[];return e.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),a.jsx(Le,{className:M("download-section",n),children:a.jsxs(a.Fragment,{children:[g.createElement(typeof t=="string"?"h2":t.element,{className:"text"},typeof t=="string"?t:t.text),a.jsx(et,{buttons:r})]})})};function da({href:t,setShowModal:e}){typeof t!="string"&&e(!0)}const rs=({icon:t,description:e,ctaMessage:n,href:r,showEditButton:i,setShowModal:s})=>{const{formatMessage:o}=q.useIntl();return a.jsxs("div",{className:M("edit-section-placeholder",{"has-icon":!!t}),style:sa(t),children:[a.jsx("p",{children:e||o({id:"edit_section_placeholder_description"})}),i&&a.jsx(re,{href:r,variant:"secondary",size:"small",onClick:()=>da({href:r,setShowModal:s}),children:n||o({id:"edit_section_placeholder_cta"})})]})},as=({children:t,className:e="",formProps:n,href:r,title:i,modalTitle:s,placeholder:o,showDivider:c=!0})=>{const[f,u]=g.useState(!1),d=typeof r=="string"||!!n,l=()=>u(!1);return a.jsxs("section",{className:M("edit-section",e),children:[n&&a.jsx(bt,{title:s||`Edit ${i}`,isOpen:f,showDivider:!1,showIcon:!1,functions:{onClose:l},className:M("edit-section-modal"),children:a.jsx(Qt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async m=>{var p,b;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((b=n==null?void 0:n.functions)==null?void 0:b.onSuccess(m)),u(!1)},onCancel:l}})}),a.jsxs("div",{className:"edit-section-header",children:[a.jsx("h2",{className:"edit-section-header-title",children:i}),d&&a.jsx(re,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>da({href:r,setShowModal:u}),children:"Edit"})]}),t||a.jsx(rs,{...o,href:r,setShowModal:u,showEditButton:d}),c&&a.jsx(je,{})]})};const is=({title:t=!1,logos:e=[],className:n=""})=>{const r=e.length;if(r===0)return null;const i={element:typeof t=="object"?t.element:"h2",text:typeof t=="string"?t:typeof t=="object"?t.text:""};return a.jsxs("div",{className:M("logos",n),children:[t&&g.createElement(i.element,{className:"title"},i.text),a.jsx("ul",{className:M({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:e.map(({logo:s,nameOfBusiness:o,link:c=!1,description:f=!1},u)=>{if(!s||!s.url)return null;const d=a.jsx("img",{src:s.url,width:s.width||"auto",height:s.height||"auto",alt:o});return a.jsxs("li",{children:[a.jsx("p",{className:"img-wrapper",children:c?a.jsx("a",{href:c,target:"_blank",rel:"nofollow noreferrer noopener",children:d}):d}),f&&a.jsx("small",{children:f})]},window.btoa(`${s.url}_${u}`))})})]})};const ss=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],os=({className:t="",content:e,image:n,variant:r="default",spacing:i="normal",hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:c})=>{const f=["eyebrow","title","text"],u={eyebrow:"small",title:"h1",text:"p"},d={};return f.forEach(l=>{if(!e[l]){d[l]=!1;return}if(!s[l]){if(typeof e[l]=="object"){d[l]=e[l];const{text:m,element:p}=e[l];if(p&&ss.includes(p.toLowerCase()))return;d[l]={text:m,element:u[l]};return}d[l]={text:e[l],element:u[l]}}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=l=>{l.preventDefault(),l.stopPropagation();const m=document.getElementById(o.link.substring(1));m&&m.scrollIntoView({behavior:"smooth"})}),a.jsx(Le,{className:M("banner-section",r,i,t,{"has-image":n,"has-extra-spacing":i==="normal"&&d.eyebrow&&d.title}),children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"content-wrapper",children:[f.map(l=>{if(d[l]&&typeof d[l]=="object"){const{text:m,element:p=""}=d[l];return l==="text"?a.jsx(ht,{overrideType:"text-only",className:"text",children:m},l):g.createElement(p,{key:l,className:l},m)}return null}),c,o&&o.text&&o.link&&a.jsx(re,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),n&&a.jsx(tt,{image:{...n,aspect:"banner"}})]})})},cs=g.memo(os);const ls=({alignImage:t="left",className:e,content:n,image:r})=>{const i=()=>typeof n=="string"?a.jsx(Je,{children:n}):n;return a.jsxs(Le,{className:M("highlight-section",e),children:[r&&a.jsx("div",{className:M("highlight-container highlight-image",{[`highlight-image-${t}`]:t==="right"}),children:a.jsx(tt,{image:r})}),a.jsx("div",{className:M("highlight-container highlight-content-wrapper",{"no-image":!r}),children:a.jsx("div",{className:M("highlight-content",{"highlight-content-right":t==="left"}),children:i()})})]})},us=g.memo(ls);const ds=({variant:t="primary",button:e=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:a.jsxs("aside",{className:M("marketing-block",t),children:[n&&a.jsx("p",{className:"title",children:n}),r&&a.jsx("p",{children:r}),e&&a.jsx(re,{variant:"secondary",size:"medium",href:e.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:e.text})]}),fa=({showDevTools:t=!0,children:e})=>{const n=new me.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return a.jsxs(me.QueryClientProvider,{client:n,children:[e,t&&a.jsx(Ci.ReactQueryDevtools,{initialIsOpen:!1})]})};var fs=g.createContext({client:Rt});function ms(t){var e=t.children,n=t.client,r=t.apiKey,i=t.options,s=g.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Rt.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Rt.init(r,i)),Rt)},[n,r]);return g.createElement(fs.Provider,{value:{client:s}},e)}const ma=({children:t,user:e})=>e.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(ms,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:e.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!e.id}},children:t}):t,pa=({children:t,locale:e,messages:n})=>{const r=e||"en",i={...Vi[r],...n||{}};return a.jsx(q.IntlProvider,{locale:r,messages:i,children:t})},Te=g.createContext({isLoading:!0});function Kt(){return g.useContext(Te)}const ha=({children:t,user:e})=>a.jsx(Te.Provider,{value:e,children:t}),ps=({bootstrap:t,children:e,intl:n,showDevTools:r})=>{const[i,s]=g.useState({isLoading:!0});return g.useEffect(()=>{t().then(o=>{s({...o,isLoading:!1}),la(5e3)}).catch(()=>s({isLoading:!1}))},[]),a.jsx(pa,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:a.jsx(Ln.CookiesProvider,{children:a.jsx(ha,{user:i,children:a.jsx(fa,{showDevTools:r,children:a.jsx(ma,{user:i,children:e})})})})})};const qn=({label:t=!1,className:e="",children:n})=>{const r=q.useIntl();return a.jsxs("details",{className:M("collapsible-section",e),children:[a.jsx("summary",{children:t||r.formatMessage({id:"collapsibleSection_summary"})}),a.jsx("div",{className:"content",children:n})]})};const Ne=({variant:t="primary",icon:e,className:n="",children:r,...i})=>{const s=e?{"--icon":`url(${Ae}icons/${e}.svg)`}:{};return a.jsx("div",{className:M("highlighted-text-box",t,n,{"has-icon":e}),style:s,...i,children:r})};const Be=({variant:t="empty",text:e=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const s=typeof n=="object"&&"breakpoints"in n,o=Xe(s);if(s&&typeof n=="object"&&typeof o=="number"){const l=Object.assign({},n.breakpoints),m=aa(Object.keys(l));i=ia(o,m,l)}const{breakpoints:c,text:f="",component:u,...d}=n;return a.jsx(Ne,{variant:"subtle",className:M("empty-state-box",t,r),children:a.jsxs(a.Fragment,{children:[e&&typeof e=="string"?a.jsx(Je,{options:{forceBlock:!0},children:e}):e,i&&typeof n=="object"&&(u||a.jsx(re,{...d,variant:n.variant?n.variant:"secondary",children:f}))]})})};const Fn=({children:t,...e})=>a.jsx("p",{...e,children:t}),ga={q:Fn,blockquote:Fn};for(let t=1;t<=6;t++)ga[`h${t}`]={component:Fn,props:{className:"title"}};const va=({type:t="default",className:e="",heading:n=!1,children:r})=>a.jsxs("div",{className:M("helper-text-box text-small",t,e),children:[n&&a.jsx("p",{className:"title",children:n}),typeof r=="string"?a.jsx(Je,{options:{wrapper:g.Fragment,forceBlock:!0,overrides:ga},children:r}):a.jsx("p",{children:r})]});const hs=({className:t="",show:e=!1,hide:n=!1,text:r,children:i})=>{const s=q.useIntl(),o=g.useRef(null),[c,f]=g.useState(""),[u,d]=g.useState("closed");g.useEffect(()=>{const p=o.current;if(p)return p.addEventListener("transitionend",l),()=>{p.removeEventListener("transitionend",l)}},[]),g.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
|
|
36
36
|
`);f(p.length<3?`${r.substring(0,400)}...`:p.slice(0,3).join(`
|
|
37
37
|
`))},[r]),g.useEffect(()=>{u==="ready-to-close"&&d("closing")},[u]);const l=({propertyName:p})=>{p==="max-height"&&d(b=>b==="opening"?"open":b==="closing"?"closed":b)};if(!r)return null;const m=["opening","open"].includes(u);return a.jsxs(Ne,{variant:"subtle",className:M("hide-show-text-box",t),children:[a.jsxs("div",{ref:o,className:M("content",u),children:[a.jsx(Je,{options:{forceBlock:!0},children:u==="closed"?c:r}),u!=="closed"&&i]}),a.jsx("p",{className:"cta",children:a.jsx(re,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:M({"rotate-180":m}),onClick:()=>{d(m?"ready-to-close":"opening")},children:m?n||s.formatMessage({id:"hideShowTextBox_hide"}):e||s.formatMessage({id:"hideShowTextBox_show"})})})]})},ve=()=>g.Fragment,gs=({children:t})=>a.jsx(Ne,{variant:"secondary",children:t}),vs=["span","strong","h1","h2","h3","h4","h5","h6","p"],bs=({children:t})=>{const e=q.useIntl();if(!t)return null;let n=e.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const s of g.Children.toArray(t))if(!(!s||typeof s=="string"||typeof s=="number"))if(g.isValidElement(s)&&s.type==="summary"){if(s.props&&s.props.children){for(const o of g.Children.toArray(s.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&g.isValidElement(o)){const c=o.type;if(vs.includes(c)){for(n=o.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(s);const i=n?n.toString():"";return a.jsx(qn,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(s=>s)})},ys=({children:t,...e})=>{if(e.class)switch(e.class){case"casestudy":return a.jsx(Ne,{variant:"secondary",children:t});case"general-textbox":case"highlight-box":return a.jsx(Ne,{variant:"primary",children:t});case"pink-textbox":return a.jsx(Ne,{variant:"tertiary",children:t});default:return a.jsx("div",{...e,children:t})}return a.jsx("div",{...e,children:t})},_s=t=>{const e=q.useIntl(),n=Date.now().toString();let r="default";const i=t.src;return i.includes("youtube")||i.includes("vimeo")?r="video":i.includes("riddle")||i.includes("sli.do")?r="poll":i.includes("padlet")&&(r="padlet"),a.jsxs(a.Fragment,{children:[a.jsx(ge,{children:a.jsx("a",{href:`#content-after-iframe-${n}`,children:e.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),a.jsx("iframe",{...t,title:e.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),a.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},br=t=>{let e="";return t&&typeof t!="string"&&typeof t!="number"&&typeof t!="boolean"&&"type"in t&&(e=t.type),e},xs=({children:t,...e})=>{let n={...e};e.href&&(e.href.includes("http:")||e.href.includes("https:"))&&!e.target&&(n.target="_blank");let r=t,i=!1;for(const s of g.Children.toArray(t))if(!(!s||typeof s=="string"||typeof s=="number")&&g.isValidElement(s)){const o=s.type;if(["button","center","span","strong"].includes(o)&&s.props&&s.props.children&&s.props.children[0])for((o==="button"||br(s.props.children[0])==="button")&&(i=!0),r=s.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!g.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&br(r)==="button"&&(i=!0);else break}return i?(n={...n,className:"button primary medium"},a.jsx("p",{className:"center",children:a.jsx(re,{variant:"primary",size:"medium",...n,children:r})})):a.jsx("a",{...n,children:r})},ba=({children:t})=>a.jsx("span",{children:t});const ws={default:{a:xs,CollapsibleSection:qn,TextBox:Ne,CaseStudy:gs,style:ve,details:bs,div:ys,iframe:_s},"text-only":{h1:ve,h2:ve,h3:ve,h4:ve,h5:ve,h6:ve,style:ve,details:ve,div:ve,TextBox:ve,CollapsibleSection:ve,CaseStudy:ve,blockquote:ve,iframe:ve,button:ve}},ht=({className:t="",options:e={},children:n,overrideType:r="default"})=>{n=n.replace(/^<br\/?>/,"");const i={wrapper:g.Fragment,forceBlock:!0,overrides:ws[r]};return a.jsx("div",{className:M("markdown-text",t),children:a.jsx(Je,{options:{...i,...e},children:n})})};const ya=({maxWidth:t=!1,title:e,subtitle:n,children:r,className:i=""})=>{const s=t?{"--max-width":`${t/16}rem`}:{};return a.jsxs("section",{className:M("page-heading",i),children:[a.jsxs("div",{className:M("content",{"has-max-width":t}),style:s,children:[e&&e.text&&g.createElement(e.element||"h1",{className:"title"},e.text),n&&n.text&&g.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Ve=({size:t="medium",variant:e="default",className:n="",children:r,...i})=>a.jsx("span",{className:M("pill",t,e,n),...i,children:r});const gt=({element:t="p",children:e=null,className:n="",...r})=>g.createElement(t,{...r,className:M("status-banner text-small",n),"aria-live":"assertive"},e);const ks=({author:t,authorCite:e,content:n})=>a.jsxs("blockquote",{className:"testimonial-block",children:[a.jsx(Je,{className:"testimonial",children:n}),t&&a.jsx("p",{className:"author text-small",children:t}),e&&a.jsx("p",{className:"author-cite text-small",children:a.jsx("cite",{children:e})})]}),js=g.memo(ks);const Ts=({progress:t=0,text:e=!1,className:n=""})=>{const r=q.useIntl(),i=t>75?100:t>50?75:t>25?50:t>5?25:0,s={"--progress":`${t}%`};return a.jsx("span",{className:M(`progress-bar section-${i}`,n),style:s,children:a.jsx(ge,{children:e?`${t} ${e}`:r.formatMessage({id:"progressBar"},{number:t})})})},_a=g.memo(Ts);const ln="loadingBlock_",Es=({progress:t=0,steps:e=!1,className:n=""})=>{const r=q.useIntl();e||(e={0:{text:r.formatMessage({id:`${ln}loading`})},75:{text:r.formatMessage({id:`${ln}almostDone`})},100:{text:r.formatMessage({id:`${ln}complete`})}});let i=null;const s=Object.keys(e);for(let c=0;c<s.length&&!(t<parseInt(s[c]));c++)i=s[c];const o=i&&e[i].icon?{"--icon":`url(${Ae}icons/${e[i].icon}.svg)`}:{};return a.jsxs(Ne,{className:M("loading-block",n,{"has-icon":i&&e[i].icon}),variant:"subtle",style:o,children:[i&&a.jsx("span",{className:"step",children:e[i].text}),a.jsx(_a,{progress:t})]})},Ss=g.memo(Es);const xe=({element:t="div",className:e="",...n})=>a.jsx(Yt,{element:t,className:M("loading-placeholder",e),...n});const On={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],"general-website-page":["banner","title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},xa=(t,e)=>t in On?a.jsx("div",{className:t,children:On[t].map((n,r)=>xa(n,r))},e):a.jsx(xe,{className:t},e),Un=({layout:t="overview-page",...e})=>a.jsx("div",{className:M("loading-state",t),...e,children:On[t].map((n,r)=>xa(n,r))}),wa=t=>{const e=t&&t.toUpperCase().split(" ");return Array.isArray(e)&&e.length>1&&e[0]!==""?e[1]===""?e[0][0]:e[0][0]+e[e.length-1][0]:t?t.substr(0,1):""},wt=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Cs=t=>{const e=Math.ceil(26/wt.length),n=wa(t).toLowerCase();if(n==="")return wt[0];const r=n.charCodeAt(0)-96;for(let i=0;i<wt.length;i++)if(r<=e*(i+1))return wt[i]};const yr=256,Re=({className:t="",src:e="",name:n,alt:r,width:i=yr,height:s=yr,...o})=>{const[c,f]=g.useState(!1),u=g.useRef(null);g.useEffect(()=>{const l=u.current;if(!l)return;const m=l.getContext("2d");if(!m)return;const p=i,b=s;typeof window<"u"&&window.devicePixelRatio&&(l.width=p*window.devicePixelRatio,l.height=b*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=Cs(n),m.fillRect(0,0,p,b),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(wa(n),p/2,b/1.6)},[n]);let d=!1;return e&&e!==""&&!c&&(e.includes("http")||e.includes("//"))&&(d=!0),a.jsx("figure",{className:M("profile-picture",t,{error:c}),...o,children:d?a.jsx("img",{src:e,alt:r||n,onError:()=>{f(!0)},width:i,height:s}):a.jsx("canvas",{ref:u})})},zn=t=>t==="apolitical"?{image:`${Ae}logos/member_apolitical.svg`}:t==="community"||typeof t=="object"&&!t.name?{image:`${Ae}logos/member_community.svg`}:{name:t.name,role:t.jobTitle||"",organisation:t.organization||"",country:t.location&&t.location.country||"",url:`/profiles/${t.id}`,image:t.image&&t.image.thumbnail},Ms=({role:t="",organisation:e="",country:n="",maximumCharacters:r=80})=>{const i=t!=="",s=e!=="",o=n!=="";if(!i&&!s&&!o)return"";const c=`${t}${i&&s?` — ${e}`:e}`;let f=`${c}${(i||s)&&o?`, ${n}`:n}`;return f.length>r&&(f=c),f.length>r&&(f=Ye(f,r)),f};const Gt=({element:t="div",member:e="community",additionalContent:n=!1,gtmContext:r="member",gtmType:i="member-click",className:s=""})=>{const o=q.useIntl(),c=zn(e);c.name||(c.name=o.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:f,url:u,image:d}=c,l=Ms(c),m=n&&n.createdAt?Rn(n.createdAt):!1,p=n&&n.createdAt?oa(n.createdAt):"";return g.createElement(t,{className:M("member text-medium",s),children:a.jsxs(nt,{href:u,gtmType:i,gtmContext:r,onClick:b=>{b==null||b.stopPropagation()},children:[a.jsx(Re,{name:f,src:d}),a.jsxs("p",{className:"details",children:[a.jsx("strong",{children:f}),n&&a.jsxs("span",{className:"additional-content",children:[n.createdAt&&m&&a.jsx("span",{className:"date",title:p,"aria-label":p,children:o.formatMessage({id:`dates_${m.path}`},{number:m.number})}),n.didEdit&&a.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),l&&a.jsx("small",{children:l})]})]})})};const _r={small:24,medium:48},Zn=({element:t="div",contributors:{total:e,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:s,showPlaceholders:o}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:c=2,className:f="",...u})=>{const d=q.useIntl();return!n||n.length===0?null:g.createElement(t,{...u,className:M("contributors",f,i,{"has-gap":s}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((l,m)=>{let p,b="";if(m<c){const{name:_="",image:x=""}=zn(l);if(o)return a.jsx(xe,{element:"li",className:"contributor"},m);p=a.jsx(Re,{name:_,src:x,width:_r[i||"medium"],height:_r[i||"medium"]})}else if(m===c){const _=(e||n.length)-c;p=a.jsxs("small",{className:M({"large-number":_>99}),children:["+",Yi(_,0)]}),b="number-left"}return p?a.jsx("li",{className:M("contributor",b),children:p},m):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?d.formatMessage({id:`member_${n[0]}`}):Ye(n[0].name||"",20):null})]})})};var Dn={exports:{}},kt={exports:{}},ce={};/** @license React v16.13.1
|
|
38
38
|
* react-is.production.min.js
|
|
@@ -59,6 +59,6 @@ Valid keys: `+JSON.stringify(Object.keys(j),null," "));var A=ie(K,F,V,ee,G+"."+
|
|
|
59
59
|
*/var Ta=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],At=Ta.join(","),Ea=typeof Element>"u",Ie=Ea?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,It=!Ea&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},Lt=function t(e,n){var r;n===void 0&&(n=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",o=s||n&&e&&t(e.parentNode);return o},Ls=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},Sa=function(e,n,r){if(Lt(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(At));return n&&Ie.call(e,At)&&i.unshift(e),i=i.filter(r),i},Ca=function t(e,n,r){for(var i=[],s=Array.from(e);s.length;){var o=s.shift();if(!Lt(o,!1))if(o.tagName==="SLOT"){var c=o.assignedElements(),f=c.length?c:o.children,u=t(f,!0,r);r.flatten?i.push.apply(i,u):i.push({scopeParent:o,candidates:u})}else{var d=Ie.call(o,At);d&&r.filter(o)&&(n||!e.includes(o))&&i.push(o);var l=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),m=!Lt(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(l&&m){var p=t(l===!0?o.children:l.children,!0,r);r.flatten?i.push.apply(i,p):i.push({scopeParent:o,candidates:p})}else s.unshift.apply(s,o.children)}}return i},Ma=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},$e=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Ls(e))&&!Ma(e)?0:e.tabIndex},Bs=function(e,n){var r=$e(e);return r<0&&n&&!Ma(e)?0:r},qs=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Na=function(e){return e.tagName==="INPUT"},Us=function(e){return Na(e)&&e.type==="hidden"},zs=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},Zs=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},Ws=function(e){if(!e.name)return!0;var n=e.form||It(e),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(o){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",o.message),!1}var s=Zs(i,e.form);return!s||s===e},Hs=function(e){return Na(e)&&e.type==="radio"},Vs=function(e){return Hs(e)&&!Ws(e)},Ys=function(e){var n,r=e&&It(e),i=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==e){var o,c,f;for(s=!!((o=i)!==null&&o!==void 0&&(c=o.ownerDocument)!==null&&c!==void 0&&c.contains(i)||e!=null&&(f=e.ownerDocument)!==null&&f!==void 0&&f.contains(e));!s&&i;){var u,d,l;r=It(i),i=(u=r)===null||u===void 0?void 0:u.host,s=!!((d=i)!==null&&d!==void 0&&(l=d.ownerDocument)!==null&&l!==void 0&&l.contains(i))}}return s},Nr=function(e){var n=e.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},Ks=function(e,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var s=Ie.call(e,"details>summary:first-of-type"),o=s?e.parentElement:e;if(Ie.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var f=e.parentElement,u=It(e);if(f&&!f.shadowRoot&&i(f)===!0)return Nr(e);e.assignedSlot?e=e.assignedSlot:!f&&u!==e.ownerDocument?e=u.host:e=f}e=c}if(Ys(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Nr(e);return!1},Gs=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return Ie.call(n,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}n=n.parentElement}return!1},Bt=function(e,n){return!(n.disabled||Lt(n)||Us(n)||Ks(n,e)||zs(n)||Gs(n))},An=function(e,n){return!(Vs(n)||$e(n)<0||!Bt(e,n))},Qs=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Js=function t(e){var n=[],r=[];return e.forEach(function(i,s){var o=!!i.scopeParent,c=o?i.scopeParent:i,f=Bs(c,o),u=o?t(i.candidates):c;f===0?o?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:f,item:i,isScope:o,content:u})}),r.sort(qs).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(n)},$a=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Ca([e],n.includeContainer,{filter:An.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Qs}):r=Sa(e,n.includeContainer,An.bind(null,n)),Js(r)},Pa=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Ca([e],n.includeContainer,{filter:Bt.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Sa(e,n.includeContainer,Bt.bind(null,n)),r},Oe=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Ie.call(e,At)===!1?!1:An(n,e)},Xs=Ta.concat("iframe").join(","),Ot=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Ie.call(e,Xs)===!1?!1:Bt(n,e)};const eo=Object.freeze(Object.defineProperty({__proto__:null,focusable:Pa,getTabIndex:$e,isFocusable:Ot,isTabbable:Oe,tabbable:$a},Symbol.toStringTag,{value:"Module"}));/*!
|
|
60
60
|
* focus-trap 7.5.4
|
|
61
61
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
62
|
-
*/function $r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Pr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$r(Object(n),!0).forEach(function(r){to(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$r(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function to(t,e,n){return e=ro(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function no(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ro(t){var e=no(t,"string");return typeof e=="symbol"?e:String(e)}var Rr={activateTrap:function(e,n){if(e.length>0){var r=e[e.length-1];r!==n&&r.pause()}var i=e.indexOf(n);i===-1||e.splice(i,1),e.push(n)},deactivateTrap:function(e,n){var r=e.indexOf(n);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},ao=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},io=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},ft=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},so=function(e){return ft(e)&&!e.shiftKey},oo=function(e){return ft(e)&&e.shiftKey},Fr=function(e){return setTimeout(e,0)},Or=function(e,n){var r=-1;return e.every(function(i,s){return n(i)?(r=s,!1):!0}),r},ot=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof e=="function"?e.apply(void 0,r):e},jt=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},co=[],lo=function(e,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||co,s=Pr({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:so,isKeyBackward:oo},n),o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},c,f=function(E,w,N){return E&&E[w]!==void 0?E[w]:s[N||w]},u=function(E,w){var N=typeof(w==null?void 0:w.composedPath)=="function"?w.composedPath():void 0;return o.containerGroups.findIndex(function(L){var z=L.container,I=L.tabbableNodes;return z.contains(E)||(N==null?void 0:N.includes(z))||I.find(function(H){return H===E})})},d=function(E){var w=s[E];if(typeof w=="function"){for(var N=arguments.length,L=new Array(N>1?N-1:0),z=1;z<N;z++)L[z-1]=arguments[z];w=w.apply(void 0,L)}if(w===!0&&(w=void 0),!w){if(w===void 0||w===!1)return w;throw new Error("`".concat(E,"` was specified but was not a node, or did not return a node"))}var I=w;if(typeof w=="string"&&(I=r.querySelector(w),!I))throw new Error("`".concat(E,"` as selector refers to no known node"));return I},l=function(){var E=d("initialFocus");if(E===!1)return!1;if(E===void 0||!Ot(E,s.tabbableOptions))if(u(r.activeElement)>=0)E=r.activeElement;else{var w=o.tabbableGroups[0],N=w&&w.firstTabbableNode;E=N||d("fallbackFocus")}if(!E)throw new Error("Your focus-trap needs to have at least one focusable element");return E},m=function(){if(o.containerGroups=o.containers.map(function(E){var w=$a(E,s.tabbableOptions),N=Pa(E,s.tabbableOptions),L=w.length>0?w[0]:void 0,z=w.length>0?w[w.length-1]:void 0,I=N.find(function(j){return Oe(j)}),H=N.slice().reverse().find(function(j){return Oe(j)}),J=!!w.find(function(j){return $e(j)>0});return{container:E,tabbableNodes:w,focusableNodes:N,posTabIndexesFound:J,firstTabbableNode:L,lastTabbableNode:z,firstDomTabbableNode:I,lastDomTabbableNode:H,nextTabbableNode:function($){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,U=w.indexOf($);return U<0?W?N.slice(N.indexOf($)+1).find(function(V){return Oe(V)}):N.slice(0,N.indexOf($)).reverse().find(function(V){return Oe(V)}):w[U+(W?1:-1)]}}}),o.tabbableGroups=o.containerGroups.filter(function(E){return E.tabbableNodes.length>0}),o.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find(function(E){return E.posTabIndexesFound})&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function C(E){var w=E.activeElement;if(w)return w.shadowRoot&&w.shadowRoot.activeElement!==null?C(w.shadowRoot):w},b=function C(E){if(E!==!1&&E!==p(document)){if(!E||!E.focus){C(l());return}E.focus({preventScroll:!!s.preventScroll}),o.mostRecentlyFocusedNode=E,ao(E)&&E.select()}},_=function(E){var w=d("setReturnFocus",E);return w||(w===!1?!1:E)},x=function(E){var w=E.target,N=E.event,L=E.isBackward,z=L===void 0?!1:L;w=w||jt(N),m();var I=null;if(o.tabbableGroups.length>0){var H=u(w,N),J=H>=0?o.containerGroups[H]:void 0;if(H<0)z?I=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:I=o.tabbableGroups[0].firstTabbableNode;else if(z){var j=Or(o.tabbableGroups,function(G){var K=G.firstTabbableNode;return w===K});if(j<0&&(J.container===w||Ot(w,s.tabbableOptions)&&!Oe(w,s.tabbableOptions)&&!J.nextTabbableNode(w,!1))&&(j=H),j>=0){var $=j===0?o.tabbableGroups.length-1:j-1,W=o.tabbableGroups[$];I=$e(w)>=0?W.lastTabbableNode:W.lastDomTabbableNode}else ft(N)||(I=J.nextTabbableNode(w,!1))}else{var U=Or(o.tabbableGroups,function(G){var K=G.lastTabbableNode;return w===K});if(U<0&&(J.container===w||Ot(w,s.tabbableOptions)&&!Oe(w,s.tabbableOptions)&&!J.nextTabbableNode(w))&&(U=H),U>=0){var V=U===o.tabbableGroups.length-1?0:U+1,ee=o.tabbableGroups[V];I=$e(w)>=0?ee.firstTabbableNode:ee.firstDomTabbableNode}else ft(N)||(I=J.nextTabbableNode(w))}}else I=d("fallbackFocus");return I},v=function(E){var w=jt(E);if(!(u(w,E)>=0)){if(ot(s.clickOutsideDeactivates,E)){c.deactivate({returnFocus:s.returnFocusOnDeactivate});return}ot(s.allowOutsideClick,E)||E.preventDefault()}},y=function(E){var w=jt(E),N=u(w,E)>=0;if(N||w instanceof Document)N&&(o.mostRecentlyFocusedNode=w);else{E.stopImmediatePropagation();var L,z=!0;if(o.mostRecentlyFocusedNode)if($e(o.mostRecentlyFocusedNode)>0){var I=u(o.mostRecentlyFocusedNode),H=o.containerGroups[I].tabbableNodes;if(H.length>0){var J=H.findIndex(function(j){return j===o.mostRecentlyFocusedNode});J>=0&&(s.isKeyForward(o.recentNavEvent)?J+1<H.length&&(L=H[J+1],z=!1):J-1>=0&&(L=H[J-1],z=!1))}}else o.containerGroups.some(function(j){return j.tabbableNodes.some(function($){return $e($)>0})})||(z=!1);else z=!1;z&&(L=x({target:o.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(o.recentNavEvent)})),b(L||o.mostRecentlyFocusedNode||l())}o.recentNavEvent=void 0},S=function(E){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;o.recentNavEvent=E;var N=x({event:E,isBackward:w});N&&(ft(E)&&E.preventDefault(),b(N))},T=function(E){if(io(E)&&ot(s.escapeDeactivates,E)!==!1){E.preventDefault(),c.deactivate();return}(s.isKeyForward(E)||s.isKeyBackward(E))&&S(E,s.isKeyBackward(E))},k=function(E){var w=jt(E);u(w,E)>=0||ot(s.clickOutsideDeactivates,E)||ot(s.allowOutsideClick,E)||(E.preventDefault(),E.stopImmediatePropagation())},Z=function(){if(o.active)return Rr.activateTrap(i,c),o.delayInitialFocusTimer=s.delayInitialFocus?Fr(function(){b(l())}):b(l()),r.addEventListener("focusin",y,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",k,{capture:!0,passive:!1}),r.addEventListener("keydown",T,{capture:!0,passive:!1}),c},O=function(){if(o.active)return r.removeEventListener("focusin",y,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",k,!0),r.removeEventListener("keydown",T,!0),c},Y=function(E){var w=E.some(function(N){var L=Array.from(N.removedNodes);return L.some(function(z){return z===o.mostRecentlyFocusedNode})});w&&b(l())},R=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(Y):void 0,D=function(){R&&(R.disconnect(),o.active&&!o.paused&&o.containers.map(function(E){R.observe(E,{subtree:!0,childList:!0})}))};return c={get active(){return o.active},get paused(){return o.paused},activate:function(E){if(o.active)return this;var w=f(E,"onActivate"),N=f(E,"onPostActivate"),L=f(E,"checkCanFocusTrap");L||m(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,w==null||w();var z=function(){L&&m(),Z(),D(),N==null||N()};return L?(L(o.containers.concat()).then(z,z),this):(z(),this)},deactivate:function(E){if(!o.active)return this;var w=Pr({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},E);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,O(),o.active=!1,o.paused=!1,D(),Rr.deactivateTrap(i,c);var N=f(w,"onDeactivate"),L=f(w,"onPostDeactivate"),z=f(w,"checkCanReturnFocus"),I=f(w,"returnFocus","returnFocusOnDeactivate");N==null||N();var H=function(){Fr(function(){I&&b(_(o.nodeFocusedBeforeActivation)),L==null||L()})};return I&&z?(z(_(o.nodeFocusedBeforeActivation)).then(H,H),this):(H(),this)},pause:function(E){if(o.paused||!o.active)return this;var w=f(E,"onPause"),N=f(E,"onPostPause");return o.paused=!0,w==null||w(),O(),D(),N==null||N(),this},unpause:function(E){if(!o.paused||!o.active)return this;var w=f(E,"onUnpause"),N=f(E,"onPostUnpause");return o.paused=!1,w==null||w(),m(),Z(),D(),N==null||N(),this},updateContainerElements:function(E){var w=[].concat(E).filter(Boolean);return o.containers=w.map(function(N){return typeof N=="string"?r.querySelector(N):N}),o.active&&m(),D(),this}},c.updateContainerElements(e),c};const uo=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:lo},Symbol.toStringTag,{value:"Module"})),fo=Qr(uo),mo=Qr(eo);function Ge(t){"@babel/helpers - typeof";return Ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ge(t)}function po(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ra(r.key),r)}}function ho(t,e,n){return e&&Dr(t.prototype,e),n&&Dr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function go(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&In(t,e)}function In(t,e){return In=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},In(t,e)}function vo(t){var e=yo();return function(){var r=qt(t),i;if(e){var s=qt(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return bo(this,i)}}function bo(t,e){if(e&&(Ge(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}function ut(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yo(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},qt(t)}function _o(t,e,n){return e=Ra(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ra(t){var e=xo(t,"string");return Ge(e)==="symbol"?e:String(e)}function xo(t,e){if(Ge(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Ge(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tt=g,Q=Is,wo=fo,ko=wo.createFocusTrap,jo=mo,To=jo.isFocusable,Hn=function(t){go(n,t);var e=vo(n);function n(r){var i;po(this,n),i=e.call(this,r),_o(ut(i),"getNodeForOption",function(c){var f,u=(f=this.internalOptions[c])!==null&&f!==void 0?f:this.originalOptions[c];if(typeof u=="function"){for(var d=arguments.length,l=new Array(d>1?d-1:0),m=1;m<d;m++)l[m-1]=arguments[m];u=u.apply(void 0,l)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(c,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var b;if(p=(b=this.getDocument())===null||b===void 0?void 0:b.querySelector(u),!p)throw new Error("`".concat(c,"` as selector refers to no known node"))}return p}),i.handleDeactivate=i.handleDeactivate.bind(ut(i)),i.handlePostDeactivate=i.handlePostDeactivate.bind(ut(i)),i.handleClickOutsideDeactivates=i.handleClickOutsideDeactivates.bind(ut(i)),i.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:i.handleDeactivate,onPostDeactivate:i.handlePostDeactivate,clickOutsideDeactivates:i.handleClickOutsideDeactivates},i.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var s=r.focusTrapOptions;for(var o in s)if(Object.prototype.hasOwnProperty.call(s,o)){if(o==="returnFocusOnDeactivate"||o==="onDeactivate"||o==="onPostDeactivate"||o==="checkCanReturnFocus"||o==="clickOutsideDeactivates"){i.originalOptions[o]=s[o];continue}i.internalOptions[o]=s[o]}return i.outsideClick=null,i.focusTrapElements=r.containerElements||[],i.updatePreviousElement(),i}return ho(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var i=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return i||(i===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var i=this.getDocument();i&&(this.previouslyFocusedElement=i.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(i){var s=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,i):this.originalOptions.clickOutsideDeactivates;return s&&(this.outsideClick={target:i.target,allowDeactivation:s}),s}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var i=this,s=function(){var c=i.getReturnFocusNode(),f=!!(i.originalOptions.returnFocusOnDeactivate&&c!==null&&c!==void 0&&c.focus&&(!i.outsideClick||i.outsideClick.allowDeactivation&&!To(i.outsideClick.target,i.internalOptions.tabbableOptions))),u=i.internalOptions.preventScroll,d=u===void 0?!1:u;f&&c.focus({preventScroll:d}),i.originalOptions.onPostDeactivate&&i.originalOptions.onPostDeactivate.call(null),i.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(s,s):s()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var i=this.focusTrapElements.some(Boolean);i&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(i){if(this.focusTrap){i.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var s=!i.active&&this.props.active,o=i.active&&!this.props.active,c=!i.paused&&this.props.paused,f=i.paused&&!this.props.paused;if(s&&(this.updatePreviousElement(),this.focusTrap.activate()),o){this.deactivateTrap();return}c&&this.focusTrap.pause(),f&&this.focusTrap.unpause()}else i.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var i=this,s=this.props.children?Tt.Children.only(this.props.children):void 0;if(s){if(s.type&&s.type===Tt.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var o=function(u){var d=i.props.containerElements;s&&(typeof s.ref=="function"?s.ref(u):s.ref&&(s.ref.current=u)),i.focusTrapElements=d||[u]},c=Tt.cloneElement(s,{ref:o});return c}return null}}]),n}(Tt.Component),ct=typeof Element>"u"?Function:Element;Hn.propTypes={active:Q.bool,paused:Q.bool,focusTrapOptions:Q.shape({document:Q.object,onActivate:Q.func,onPostActivate:Q.func,checkCanFocusTrap:Q.func,onPause:Q.func,onPostPause:Q.func,onUnpause:Q.func,onPostUnpause:Q.func,onDeactivate:Q.func,onPostDeactivate:Q.func,checkCanReturnFocus:Q.func,initialFocus:Q.oneOfType([Q.instanceOf(ct),Q.string,Q.bool,Q.func]),fallbackFocus:Q.oneOfType([Q.instanceOf(ct),Q.string,Q.func]),escapeDeactivates:Q.oneOfType([Q.bool,Q.func]),clickOutsideDeactivates:Q.oneOfType([Q.bool,Q.func]),returnFocusOnDeactivate:Q.bool,setReturnFocus:Q.oneOfType([Q.instanceOf(ct),Q.string,Q.bool,Q.func]),allowOutsideClick:Q.oneOfType([Q.bool,Q.func]),preventScroll:Q.bool,tabbableOptions:Q.shape({displayCheck:Q.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:Q.oneOfType([Q.bool,Q.func])}),trapStack:Q.array,isKeyForward:Q.func,isKeyBackward:Q.func}),containerElements:Q.arrayOf(Q.instanceOf(ct)),children:Q.oneOfType([Q.element,Q.instanceOf(ct)])};Hn.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:ko};var Eo=Hn;const So=Gr(Eo);const Vn=({element:t="section",children:e,className:n,...r})=>g.createElement(t,{className:M("modal",n),children:typeof e=="string"?a.jsx("p",{children:e}):e,...r});const bt=({id:t="content-overlay",isOpen:e=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:s=()=>{}}={},forceShow:{error:o=!1}={},title:c,children:f,buttons:u,className:d="",gtmContext:l="Modal"})=>{const m=q.useIntl(),[p,b]=g.useState(e),_=y=>{y.key==="Escape"&&x(!1)};g.useEffect(()=>(window.addEventListener("keyup",_),()=>{window.removeEventListener("keyup",_)}));const x=y=>{b(y),y?(i(),document.body.classList.add("has-overlay")):(s(),document.body.classList.remove("has-overlay"))};g.useEffect(()=>{x(e)},[e]);const v=r?{"--max-width":`${r/16}rem`}:{};return a.jsx("div",{className:M("overlay",{open:p}),role:"dialog",children:a.jsx(Vn,{id:t,className:M("overlay-modal",d,{"has-max-width":r}),hidden:!p,style:v,children:e&&a.jsx(So,{children:a.jsxs("div",{className:"overlay-content",children:[a.jsxs("div",{className:"top",children:[c&&a.jsx("h2",{className:"modal-title",children:c}),a.jsx(re,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":l,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&a.jsx(je,{}),f,u&&a.jsxs("div",{className:"bottom",children:[a.jsx(je,{}),a.jsx(et,{buttons:u})]}),o&&a.jsx(gt,{className:"error",children:o})]})})})})},Fa=(t,e)=>({"aria-haspopup":!0,"aria-expanded":e,"aria-controls":t});const Et="emailHelperTextBox_",Oa=({type:t,email:e,redirectPath:n,resendVerificationCode:r})=>{const i=q.useIntl(),[s,o]=g.useState({path:`${Et}default`,type:"default",link:{},mail:{},error:""}),[c,f]=g.useState(!1),u=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const b=_=>{o({path:`${Et}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>u(x),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:_})};if(typeof r!="function"){b(i.formatMessage({id:`${Et}error_noFunction`}));return}f(!0),r(e).then(()=>{localStorage.setItem("email",e),window.location.href=n||"/signup/verify-email"}).catch(_=>{b(_.message)}).finally(()=>{f(!1)})},[e,n,r]);g.useEffect(()=>{let p=Et,b="default",_={},x={};switch(t){case"gov":p+="autoApproved",b="success";break;case"nonGov":p+="unrecognisedEmail",b="error",_={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",b="error",x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",b="error",_={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",b="error",_={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",_={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:p,type:b,link:_,mail:x})},[t]);const d={};return["link","mail"].forEach(p=>{d[p]=Object.keys(s[p]).length?b=>a.jsx("a",{...s[p],children:b}):b=>b}),a.jsx(va,{type:s.type,heading:c?!1:i.formatMessage({id:`${s.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(xe,{element:"span"}),a.jsx(xe,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...d,strong:p=>a.jsx("strong",{children:p}),em:p=>a.jsx("em",{children:p}),br:a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("br",{})]}),error:s.error})})},mt=({className:t="",element:e="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:s=n,placeholder:o,type:c="text",value:f,...u})=>{const d=g.useRef(),l=r||d;return g.createElement(e,{ref:l,...u,type:c,id:n,name:s,className:M(t,e,{"has-scrollbar":c==="textarea"&&l.current&&l.current.clientHeight<l.current.scrollHeight}),value:f,placeholder:o,...i,onChange:m=>{const p=m.target;i.onChange(p.value)}})};const ze={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Co=500,Mo=({value:t,placeholder:e,functions:n={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})}})=>{const{onChange:r=()=>{},onKeyInput:i=async()=>{}}=n,[{input:s,displayInput:o,debouncedInput:c},f]=g.useState({input:t,displayInput:t,debouncedInput:t}),[{predictions:u,activePredictionIndex:d,isPredictionSelected:l},m]=g.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!t}),{formatMessage:p}=q.useIntl();e||(e=p({id:"inputAutocomplete_placeholder"})),g.useEffect(()=>{const v=setTimeout(()=>{l||f(y=>({...y,debouncedInput:s}))},Co);return()=>{clearTimeout(v)}},[s,l]),g.useEffect(()=>{c&&!l?(async()=>{try{const y=await i(c)||[];m(S=>({...S,predictions:y}))}catch(y){console.error("Error fetching predictions:",y),m(S=>({...S,predictions:[]}))}})():m(v=>({...v,predictions:[]}))},[c,l]),g.useEffect(()=>{d>=0&&u[d]&&f(v=>({...v,displayInput:u[d].description}))},[d,u]);const b=v=>{[ze.DOWN,ze.UP,ze.ENTER].includes(v.key)&&(v.preventDefault(),v.key===ze.DOWN&&d<u.length-1?m(y=>({...y,activePredictionIndex:d+1})):v.key===ze.UP&&d>0?m(y=>({...y,activePredictionIndex:d-1})):v.key===ze.ENTER&&d>-1&&(r(u[d].description),f(y=>({...y,input:u[d].description})),m(y=>({...y,predictions:[],isPredictionSelected:!0}))))},_=v=>{r(v.target.value),f(y=>({...y,input:v.target.value,displayInput:v.target.value})),m(y=>({...y,activePredictionIndex:-1,isPredictionSelected:!1}))},x=v=>{r(v.description),f(y=>({...y,input:v.description,displayInput:v.description})),m(y=>({...y,isPredictionSelected:!0,predictions:[]}))};return a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:o,onChange:_,onKeyDown:b,placeholder:e}),a.jsx("ul",{className:"predictions-list",children:u.map((v,y)=>a.jsx("li",{onClick:()=>x(v),onMouseEnter:()=>m(S=>({...S,activePredictionIndex:y})),className:M("predictions-list-item",{active:y===d}),children:v.description},y))})]})};const Da=({className:t="",disabled:e,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:s,intlPath:o=!1,label:c,shownValue:f=!0,type:u="checkbox",value:d,...l})=>{const m=q.useIntl(),{onChange:p,...b}=r,_=()=>{e||p(d?null:f)},x=a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:s,id:i,name:i,type:u,value:f,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),_())},readOnly:!0,disabled:e}),a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("label",{htmlFor:i,children:c||m.formatMessage({id:o?`${o}_${i}`:i})})]});return g.createElement(n,{onClick:v=>{const y=v.target;y.nodeName.toLowerCase()==="a"||y.parentNode&&y.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),_())},className:M("checkbox-wrapper",t),...l,...b},x)};const No=g.memo(function({direction:e="down"}){return a.jsx(Yt,{className:M("rotating-chevron",`direction-${e}`)})});const $o=({className:t,options:e,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:s}={context:""},placeholder:o,multiSelect:c,multiSelectOptions:f,id:u})=>{const d=q.useIntl(),[l,m]=g.useState(!1),p=r||n,b=Array.isArray(p)?[...p]:p?[p]:[],[_,x]=g.useState(b);let v;Array.isArray(_)&&_.length===1&&typeof _[0]=="string"?v=e&&_?e.find(O=>O.id===_[0]):e?e[0]:{id:"",label:""}:Array.isArray(_)&&_.length===1&&typeof _[0]!="string"?v=_[0]:v={id:"",label:""},g.useEffect(()=>{x(b)},[r,n]);const{onChange:y,onMultiSelectSubmit:S,...T}=i,k=O=>{if(c){let Y=[];_!=null&&_.includes(O.id)?Y=_.filter(R=>R!==O.id):Y=[..._,O.id],x([...Y]),y&&y([...Y])}else x([O]),y&&y(O.id),m(!1)},Z=O=>{if(O==="all"){const Y=(e==null?void 0:e.map(R=>R.id))||[];x(Y),y&&y(Y)}else x([]),y&&y([])};return a.jsxs("div",{className:M("dropdown-wrapper",t),children:[a.jsxs("button",{className:"input","aria-expanded":l,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:O=>{O.preventDefault(),O.stopPropagation(),m(!l)},"data-testid":"dropdown-selector",...T,children:[c?`${o} · ${_.length}`:v.label,a.jsx(No,{direction:l?"up":"down"})]}),a.jsx("select",{defaultValue:v.id,onChange:O=>{O.preventDefault(),O.stopPropagation();const Y=e&&e.find(R=>R.id===O.target.value);k(Y)},hidden:!l,...T,children:e==null?void 0:e.map(O=>a.jsx("option",{value:O.id,children:O.label},O.id))}),a.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!l,children:[a.jsxs("div",{className:"dropdown-menu-list",children:[(f==null?void 0:f.topbar)&&a.jsxs("div",{className:"action-bar",children:[a.jsx("p",{children:`${_==null?void 0:_.length} selected`}),a.jsxs("ul",{children:[a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>Z("all"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>Z("none"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),a.jsx("ul",{children:e==null?void 0:e.map(O=>{const Y=O.id===v.id||(_==null?void 0:_.includes(O))||(_==null?void 0:_.includes(O.id));return a.jsx("li",{"data-testid":"dropdown-options",children:a.jsxs("button",{className:M("gtm-trackable",{selected:Y,"selected-single":Y&&!c}),"data-gtm-event-type":`${O}-click`,"data-gtm-event-context":s,onClick:R=>{R.preventDefault(),R.stopPropagation(),k(O)},role:"menuitem","aria-current":Y,"data-testid":Y?"current-selection":"",children:[c&&a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("span",{className:M({"menu-option-label":c}),children:O.label})]})},O.id)})})]}),(f==null?void 0:f.submitSection)&&a.jsx("p",{className:"submit",children:a.jsx(re,{variant:"secondary",onClick:()=>{S&&S(_),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:_}})),m(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const Po=({className:t="",functions:e={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:s=!1,name:o,options:c,required:f,type:u="checkboxes",value:d,...l})=>{const m=q.useIntl(),p=s?d:[],b=d;return a.jsx("ul",{...l,className:M("options-wrapper",t),"data-testid":`ul-${r}`,children:c==null?void 0:c.map(({id:_,label:x=!1,value:v=_,disabled:y=!1})=>{const S=`${r}_${_}`,T=()=>{if(y)return;let k;if(s){const Z=p==null?void 0:p.indexOf(v);Array.isArray(p)&&Z>=0?(k=p,k.splice(Z,1)):(!p||p.length===0?k=[]:k=p,k.push(v))}else k=b===v?void 0:v;e.onChange(k)};return a.jsx(Da,{element:"li",id:S,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:s?p==null?void 0:p.includes(v):b===v,functions:{...e,onChange:T},intlPath:n,label:x||m.formatMessage({id:n?`${n}_${_}`:_}),disabled:y},S)})})};const Ro=({inputRef:t,type:e="password",gtm:{context:n}={context:void 0},...r})=>{const i=q.useIntl(),s=g.useRef(),o=t||s,[c,f]=g.useState(!1),[u,d]=g.useState(e),l=()=>{var m;f(!c),d(c?"password":"text"),(m=o.current)==null||m.focus()};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:M("show-password gtm-trackable",{"password-visible":c}),"data-gtm-event-context":n,"data-gtm-event-type":`${c?"hide":"show"}-password-click`,onClick:l,"aria-label":i.formatMessage({id:`showpassword_aria_${c?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${c?"hide":"show"}`})}),a.jsx(mt,{inputRef:o,type:u,...r})]})};const Ze={text:{component:mt},email:{component:mt},textarea:{component:mt,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Da},checkboxes:{component:Po,props:{multiSelect:!0}},select:{component:$o},password:{component:Ro},autocomplete:{component:Mo}},Fo=({id:t,intlPath:e=!1,className:n="",error:r,functions:i={onChange:()=>{}},limit:s=0,showRequiredLabels:o=!0,type:c,validation:f,value:u,...d})=>{const l=q.useIntl(),m=f&&f.some(({condition:T})=>T==="required"),p=(u==null?void 0:u.toString().length)||0,b=c&&Ze[c]&&Ze[c].component?Ze[c].component:mt,_={};c&&["checkboxes"].includes(c)?_.element="span":_.htmlFor=t;let x={...d,id:t,name:t,className:r?"error":"",type:c,required:m,"aria-required":m,functions:dt(i),value:u};s>0&&(x["data-character-limit"]=s,x.functions&&(x.functions.onChange=T=>{((T==null?void 0:T.toString().length)||0)>s&&(T=T==null?void 0:T.toString().slice(0,s)),i.onChange(T)})),c&&Ze[c]&&Ze[c].props&&(x={...x,...Ze[c].props}),c&&["checkboxes"].includes(c)&&(x.intlPath=`${e}_${t}`),r&&(x["aria-invalid"]=!0,x["aria-describedby"]=`error-${t}`);const v=d.label||l.formatMessage({id:e?`${e}_${t}`:t}),y=({...T})=>r?g.createElement(T.as||"dd",{id:`error-${t}`,className:"error text-small",role:"alert","aria-live":"assertive",...T},r):null;if(c&&["checkbox"].includes(c))return a.jsxs(a.Fragment,{children:[a.jsx(b,{...x,label:v,className:M("field-wrapper",n)}),a.jsx(y,{as:"p"})]});const S=T=>g.createElement(T.element||"label",{...T,className:"checkboxes-label text-small","data-testid":`label-${t}`});return a.jsxs("dl",{className:M("field-wrapper text-medium",n),children:[a.jsx("dt",{children:a.jsxs(S,{..._,children:[v,m&&o&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("small",{children:["(",l.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),a.jsxs("dd",{children:[a.jsx(b,{...x}),s>0?a.jsxs("small",{className:M("character-limit",{"near-limit":p>=.99*s,"approaching-limit":p>=.9*s&&p<.99*s}),children:[a.jsx("span",{className:"hidden",children:l.formatMessage({id:"form_fieldWrapper_characterLimit"})}),p," / ",s]}):null]}),a.jsx(y,{})]})},Oo=(t,e)=>{const{type:n,payload:r}=e,i=t.errors?dt(t.errors):{},s=t.values?dt(t.values):{};switch(n){case"toggleSubmitting":return{...t,isSubmitting:!t.isSubmitting};case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...t,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};s[r==null?void 0:r.key]=r==null?void 0:r.value}return{...t,errors:i,values:s};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...t,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...t,errors:i};case"submitForm":{const{fields:o=[],dispatch:c=()=>{},onSuccess:f=()=>{},onFailure:u=()=>{},intl:d}=r,l=dt(Object.keys(i));for(const m of o)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:b="required",error:_=!1}=m.validation[p];let x=!1;if(typeof b=="function"){const v=b(s);v&&(x=_||v)}else{const v=s[m.id];switch(b){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(x){c({type:"addError",payload:{key:m.id,value:x}}),l.push(m.id);break}}return l.length===0?f(s):u(s,l),{...t,isSubmitting:!1}}case"formSubmitted":return{...t,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return t}};let gn=null;const Qt=({fields:t,className:e="",id:n=t.length?`form__${t[0].id}`:"form",formRef:r,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:{shouldShowCancelButton:c=!1,shouldReset:f=!0,showRequiredLabels:u=!0,showSuccessMessage:d=!1}={shouldShowCancelButton:!1,shouldReset:!0,showRequiredLabels:!0,showSuccessMessage:!1},gtm:l={context:"Form",event:"form-submit-click"},functions:{onSuccess:m=async()=>{},onCancel:p=()=>{},onCatch:b=()=>{},onFailure:_=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...x})=>{const{customOnSubmit:v,hideButton:y,...S}=s,T=40,k=q.useIntl(),Z={};t.length&&t.forEach(I=>{const H=I.id||I.name;H&&(Z[H]=I.value||"")});const[O,Y]=g.useReducer(Oo,{isSubmitting:!1,formSubmitted:!1,errors:{},values:Z}),{errors:R,isSubmitting:D,formSubmitted:C,values:E}=O;g.useEffect(()=>{f&&C&&(gn=setTimeout(()=>{Y({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[C]),g.useEffect(()=>()=>{gn&&clearTimeout(gn)},[]),g.useEffect(()=>{const I=H=>{Y({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",I),()=>{document.removeEventListener("dropdownMultiSelectSubmit",I)}},[]);const w=g.useRef(null),N=r||w;if(!t.length)return null;s.text||(s.text=k.formatMessage({id:"form_submit"}));const z=[{...S,icon:C?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:I=>{var j;if(I.preventDefault(),I.stopPropagation(),D)return;let H=0;if((j=N==null?void 0:N.current)!=null&&j.id){const $=document.getElementById(N.current.id);$&&(H=$.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");if(J&&(H=H-J.offsetHeight-T),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),Y({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&Y({type:"submitForm",payload:{fields:t,dispatch:Y,intl:k}});return}Y({type:"submitForm",payload:{fields:t,dispatch:Y,onSuccess:async $=>{try{await m($),Y({type:f?"formSubmittedAndReset":"formSubmitted"})}catch(W){b(W),Y({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:($,W)=>{_($,W),Y({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:k}})},disabled:D||C||s.disabled,"data-gtm-event-context":l.context,"data-gtm-event-type":l.event,children:D||C?k.formatMessage({id:`form_${D?"submitting":"submitted"}`}):s.text}];return c&&z.unshift({...o,className:"gtm-trackable","data-gtm-event-context":l.context,"data-gtm-event-type":l.event,disabled:D||C,onClick:p,children:o.text||k.formatMessage({id:"form_cancel"})}),a.jsxs(a.Fragment,{children:[a.jsxs("form",{...x,id:n,className:M("form",e),ref:N,children:[R!=null&&R.general?a.jsx(Be,{variant:"error",text:k.formatMessage({id:"form_error_generalError"})}):null,(!D&&!C||v)&&t.map((I,H)=>{const{id:J=I.name||H,component:j,functions:$={onChange:()=>{}}}=I;if(j)return a.jsx(j,{...I.props||{}},`component-${J}-${H}`);const W=E?E[J]:"";return a.jsx(Fo,{intlPath:i,...I,showRequiredLabels:u,value:W,error:R==null?void 0:R[J],functions:{...$,onChange:U=>{Y({type:"updateValue",payload:{key:J,value:U}}),$.onChange(U&&U.toString(),Y)}}},J)}),y?null:(D||C)&&v?v:a.jsx(et,{className:M("cta",{center:D||C,submitted:C}),buttons:z})]}),d&&C&&a.jsx(gt,{className:"success",children:typeof d=="string"?d:k.formatMessage({id:"form_success"})})]})};const St="passwordRules_",Aa="isMoreThanEightCharacters",Ia="includesNumberAndSymbol",La="includesLowerAndUppercase",Do={[Aa]:"8Characters",[Ia]:"numberSymbol",[La]:"lowercaseUppercase"},Ao=({matchingRules:t={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:e=""})=>{const n=q.useIntl();return a.jsxs("aside",{className:M("password-rules",e),children:[a.jsx("small",{children:n.formatMessage({id:`${St}intro`})}),a.jsx("ul",{children:[Aa,Ia,La].map(r=>a.jsxs("li",{className:M({matches:t[r]}),children:[a.jsxs(ge,{children:[n.formatMessage({id:`${St}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${St}rule_${Do[r]}`})}),!t[r]&&a.jsxs(ge,{element:"strong",children:[" ",n.formatMessage({id:`${St}notMet`})]})]},`rule-${r}`))})]})},Io=g.memo(Ao);const Lo=({text:t={},topRating:e=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:s="",hasLoaded:o=!1})=>{const c=q.useIntl(),[f,u]=g.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(y=>({...y,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(y=>({...y,setUp:!0,disabled:!0})),i(v)}};if(g.useEffect(()=>{o&&!f.setUp&&d()},[o]),!o)return a.jsx(xe,{className:"rating-placeholder"});const{id:l,rating:m,disabled:p}=f,b="ratings_",_={text:c.formatMessage({id:`${b}text`}),low:c.formatMessage({id:`${b}low`}),high:c.formatMessage({id:`${b}high`}),success:c.formatMessage({id:`${b}success`}),...t},x=async v=>{if(!(!l||p))try{u(y=>({...y,rating:v,disabled:!0})),await r({id:l,value:v})}catch(y){u(S=>({...S,rating:null})),i(y)}finally{u(y=>({...y,disabled:!1}))}};return a.jsxs("div",{className:M("rating",s),children:[a.jsx("span",{className:"label",children:_[m?"success":"text"]}),a.jsx("ol",{children:Array.from(new Array(e).keys()).map(v=>{const y=v+1;return a.jsx("li",{className:M({selected:m&&y<=m}),children:a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:`star${!m||y>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${c.formatMessage({id:`${b}stars`},{number:y,total:e})}${y===1||y===e?` - ${_[y===1?"low":"high"]}`:""}`,onClick:S=>{S.preventDefault(),S.stopPropagation(),x(y)},disabled:p})},`rating-${y}`)})})]})};const Bo=({id:t="form-toggle",label:e,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:s=!1,className:o=""})=>{const[c,f]=g.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);g.useEffect(()=>{r&&f(r)},[r]);const u=d=>{s||(f(d),i(d))};return a.jsxs("div",{className:M("toggle",o),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(c===n[0].value?n[1].value:n[0].value)},children:[a.jsx("p",{children:e}),a.jsx("ul",{className:M("toggle-options",{disabled:s,on:c===n[1].value}),children:n.map(d=>{const l=`${t}-${d.value}`;return a.jsxs("li",{className:"hidden",children:[a.jsx("input",{type:"radio",id:l,name:t,value:d.value,checked:c===d.value,onChange:()=>u(d.value),disabled:s}),a.jsx("label",{htmlFor:l,children:d.label})]},l)})})]})};function qo({className:t="",userId:e,userName:n,src:r,setUserImage:i,uploadImage:s}){const[o,c]=g.useState(!1),[f,u]=g.useState(!1),d=g.useRef(null),l=async m=>{c(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!e)throw c(!1),new Error("Image file or userID is missing");const b=await s({fileObject:p,userId:e});i(_=>({..._,image:{thumbnail:b.thumbnailURL,full:b.originalURL}}))}catch{u(!0)}finally{c(!1)}c(!1)};return a.jsxs("div",{className:M("profile-image-change-figure",t),children:[a.jsx(Re,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),f&&a.jsx("p",{className:"error text-small",children:a.jsx(q.FormattedMessage,{id:"profile_image_change_error"})}),a.jsx("input",{id:"file",type:"file",accept:"image/*",ref:d,onChange:l,hidden:!0,"data-testid":"file-input"}),a.jsx(re,{onClick:()=>d.current&&d.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:o,children:a.jsx(q.FormattedMessage,{id:o?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Ba=({gtm:t,functions:{onSuccess:e=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=t||{};return a.jsx(Qt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:i},functions:{onSuccess:e,onFailure:n}})};const qa=({title:t,label:e,ctaMessage:n,titleColor:r,labelColor:i,backgroundColor:s,onClose:o,reportError:c,sendInvites:f,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,l]=g.useState([]),[m,p]=g.useState(!0),[b,_]=g.useState(u),{formatMessage:x}=q.useIntl(),v=async T=>{T.preventDefault();try{await f(d),l([]),_("SUCCESS")}catch(k){_("ERROR"),c(k)}},y=T=>{T.preventDefault(),_("NOT_SUBMITTED"),p(!0),l([])},S=T=>{T.preventDefault(),o(),_("CLOSED")};return b==="CLOSED"?null:b==="ERROR"||b==="SUCCESS"?a.jsxs("div",{className:"invite-form-wrapper",children:[a.jsx("div",{className:"content centred",children:b==="SUCCESS"?a.jsx("h2",{className:"success-title",children:x({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",x({id:"inviteForm_error"})]})}),a.jsx(je,{}),a.jsx("div",{className:"footer",children:b==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"secondary",onClick:y,children:x({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(re,{onClick:S,children:x({id:"inviteForm_ctaDone"})})]}):a.jsx(re,{onClick:y,children:x({id:"inviteForm_ctaTryAgain"})})})]}):a.jsx("div",{className:"invite-form-wrapper",children:a.jsxs("form",{style:{backgroundColor:s},onSubmit:v,className:M("invite-form gtm-trackable"),children:[a.jsxs("fieldset",{className:"content",children:[a.jsx("h2",{className:"title",style:{color:r},children:t}),a.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:e}),a.jsx(Mi.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:x({id:"inviteForm_email_placeholder"}),emails:d,onChange:T=>{l(T),p(!T.length)},autoFocus:!1,getLabel:(T,k,Z)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:T}),a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{Z(k),p(!d.length)},className:"remove-email-button",screenreaderText:x({id:"overlay_close"})})]},k)})]}),a.jsx(je,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(re,{className:"sendEmailsButton",disabled:m,children:n})})]})})};const Ua=({id:t="search",className:e="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:s="form-submission"})=>{const{searchIsOpen:o=!0,isDesktopVersion:c=!1}=n||{},f=q.useIntl(),u=g.useRef(null);Ke(()=>{!n||c||!o||u.current&&u.current.focus()},[o]);const d=l=>{l.preventDefault(),l.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return a.jsx("form",{onSubmit:d,className:M("search-form gtm-trackable",e),"data-gtm-event-context":i,"data-gtm-event-type":s,children:a.jsx("fieldset",{id:`${t}-form`,hidden:n?!o:!1,role:"search",children:a.jsxs("p",{children:[a.jsx(ge,{element:"label",htmlFor:t,children:f.formatMessage({id:"search_label"})}),a.jsx("input",{ref:u,type:"search",id:t,name:t,defaultValue:r,placeholder:f.formatMessage({id:"search_placeholder"}),onKeyDown:l=>{l.key==="Enter"&&d(l)}}),a.jsx("button",{className:"clear",onClick:l=>{l.preventDefault(),l.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:a.jsx(ge,{children:f.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:d,children:a.jsx(ge,{children:f.formatMessage({id:"search_cta"})})})]})})})},Ar=async({ref:t,validateEmail:e,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!t.current.validity.valid||!r.test(t.current.value))return n([{type:"validFields.email",value:!1}]);const i=t.current.value.toString().toLowerCase().trim(),s={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let o=Object.assign({},s);try{o=await e(i),o===void 0&&(o=s)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:c=!1,autoApproved:f=!1,exists:u}=o;let d="";return c?d=f?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldManuallyApprove",value:!f},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},Uo=t=>{const e={};for(const n of t.entries())e[n[0]]=n[1];return{name:e.full_name,email:e.email_address.toString().toLowerCase().trim(),jobTitle:e.job_title,organization:e.organization,bioLink:e.url,optIn:!0,expectation:e.expectation,page:window.location.pathname,"g-recaptcha-response":e["g-recaptcha-response"]}},zo=async({refs:t,dataToSubmit:e,createAccount:n,onSuccess:r,dispatch:i,state:s})=>{if(!t.form||!t.form.current)throw new Error("No refs.form");if(!t.form.current.checkValidity()){t.hiddenValidation&&t.hiddenValidation.current&&t.hiddenValidation.current.click();return}const o=Uo(new FormData(t.form.current)),c=Object.assign(o,e);await n(c),localStorage.setItem("email",o.email),r&&r({...o,...s.values}),i([{type:"showSuccessMessage",value:!0}])},Zo=({shouldShow:t,functions:{validateEmail:e,resendVerificationCode:n},refs:r,state:i,dispatch:s,dataToSubmit:o,intl:c})=>{const{emailDetails:f}=i,u=(l,m)=>{l.current&&i.validFields[m]!==l.current.validity.valid&&s([{type:`validFields.${m}`,value:l.current.validity.valid}])},d=[{id:"full_name",type:"text",inputRef:r.name,placeholder:c.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>u(r.name,"name"),onFocus:()=>s([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:r.email,placeholder:c.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Ar({ref:r.email,validateEmail:e,dispatch:s})},onChange:(l,m)=>{m&&m({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>s([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Oa,props:{email:f.email,type:f.boxType,resendVerificationCode:n}}];return i.shouldManuallyApprove&&(d.push({id:"job_title",type:"text",inputRef:r.jobTitle,placeholder:c.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>u(r.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:r.organisation,placeholder:c.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{u(r.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),t.url&&d.push({id:"url",type:"text",label:c.formatMessage({id:"signup_url"},{small:l=>a.jsx("small",{children:l})}),placeholder:c.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),t.expectation&&d.push({id:"expectation",className:"expectation",type:"text",label:c.formatMessage({id:"signup_expectation"},{small:l=>a.jsx("small",{className:"notes text-small",children:l})}),placeholder:c.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),d.push({id:"terms",className:"text-small",type:"checkbox",inputRef:r.tc,label:c.formatMessage({id:"signup_terms"},{terms:l=>a.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:l}),privacy:l=>a.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:l})}),shownValue:"accepted",functions:{onChange:l=>{if(!l)return;const m=[];["name","email"].forEach(p=>{i.validFields[p]!==r[p].current.validity.valid&&(m.push({type:`validFields.${p}`,value:r[p].current.validity.valid}),p==="email"&&Ar({ref:r.email,validateEmail:e,dispatch:s}))}),m.length&&s(m)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),d};const Wo=({className:t=""})=>a.jsxs("div",{className:M("success-message",t),"data-testid":"success-message",children:[a.jsx("p",{className:"success-title",children:a.jsx(q.FormattedMessage,{id:"signup_success_title"})}),a.jsx(q.FormattedMessage,{id:"signup_success_text",values:{p:e=>a.jsx("p",{children:e})}})]});const Ho={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Vo=({className:t="",functions:e={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:n={title:!0,expectation:!1,url:!0,logInButton:!0,successMessage:!0},submitButton:r,dataToSubmit:i={ref:"sign-up-form"},...s})=>{const o=q.useIntl(),[c,f]=g.useReducer(ra,Ho),{validFields:u,emailDetails:d,shouldManuallyApprove:l,showSuccessMessage:m,showError:p}=c,[b,_]=Ln.useCookies(["signup-this-session","functional-cookie-consent"]),x={form:g.createRef(),name:g.createRef(),email:g.createRef(),jobTitle:g.createRef(),organisation:g.createRef(),tc:g.createRef(),hiddenValidation:g.createRef()};g.useEffect(()=>{l===!0&&x.jobTitle.current&&x.jobTitle.current.focus()},[l]),g.useEffect(()=>{(s.showSuccessMessage||b["signup-this-session"])&&f([{type:"showSuccessMessage",value:!0}])},[b]),g.useEffect(()=>{if(m&&b["functional-cookie-consent"]){const S={path:"/",maxAge:3600};s.showSuccessMessage||_("signup-this-session","true",S)}},[m]);const v=g.useMemo(()=>Zo({shouldShow:n,functions:e,refs:x,state:c,dispatch:f,dataToSubmit:i,intl:o}),[i,e,o,x,n,c]),y=l?!Object.values(u).every(S=>S===!0):!u.name||!u.email||["exists","pending","verify"].includes(d.boxType);return n.successMessage&&m?a.jsx(Wo,{className:t}):a.jsxs("fieldset",{className:M("signup-form-fieldset",t),"data-testid":"signup-form",children:[n.title&&a.jsx("p",{className:"signup-title",children:a.jsx(q.FormattedMessage,{id:"signup_title"})}),p&&a.jsx(Be,{variant:"error",text:o.formatMessage({id:"signup_error"})}),a.jsx(Qt,{className:"signup-form",formRef:x.form,id:"sign-up-form",fields:v,intlPath:"signup",button:{variant:"primary",size:"medium",text:r||o.formatMessage({id:"signup_button_join"}),disabled:y?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},meta:{shouldReset:!1,showRequiredLabels:!1},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{zo({refs:x,dataToSubmit:i,createAccount:e.createAccount,onSuccess:e.onSuccess,dispatch:f,state:c})},onCatch:S=>{e.handleError(S),f([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),a.jsx("button",{className:"validation-button",ref:x.hiddenValidation}),n.logInButton&&a.jsx(re,{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",children:o.formatMessage({id:"signup_button_login"})})]})};const Yo=({className:t,showModal:e=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:i="Invite your colleagues by typing or pasting their emails below.",ctaMessage:s="Send",showIcon:o,onClose:c,reportError:f=()=>{},sendInvites:u})=>a.jsx(bt,{title:n,isOpen:e,showDivider:!1,showIcon:o,functions:{onClose:c},className:M("invite-modal",t,{success:!!n}),children:a.jsx(qa,{title:r,label:i,ctaMessage:s,onClose:c,sendInvites:u,reportError:f})});const Ko=({members:t})=>{const[e,n]=g.useState(!1),r=i=>{const{fullName:s,jobTitle:o,organisation:c,photo:f}=i||{};return a.jsxs(a.Fragment,{children:[a.jsx(Re,{name:s,src:f}),a.jsx("p",{children:s}),a.jsx("small",{className:"text-medium",children:c?`${o}, ${c}`:o})]})};return a.jsxs("div",{className:"directory-wrapper",children:[a.jsx("ul",{className:"directory",children:t.map(i=>a.jsx("li",{children:a.jsx("button",{onClick:s=>{s.preventDefault(),s.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),a.jsx(bt,{isOpen:e!==!1,children:e===!1?"":a.jsxs(a.Fragment,{children:[r(e),a.jsx(ht,{children:e.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})},Go=({type:t,data:e})=>{const n=q.useIntl(),{answers:r,createdAt:i,dateHasPassed:s,isOngoingEvent:o,pill:c,readingTime:f,publishedDate:u,startDate:d}=e;if(t==="question"){const l=i&&Rn(i);return a.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&a.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:l?n.formatMessage({id:`dates_${l.path}`},{number:l.number}):0})]})]})}if(d&&!s||o)return a.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):oa(d)});if(c)return a.jsx(Ve,{variant:c==="free"?"subtle":"highlighted",className:c,"data-testid":"course-type",children:c});if(f||u){const l=u&&Rn(u);return a.jsxs("ul",{className:"details",children:[f&&a.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:f})}),u&&a.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:l?n.formatMessage({id:`dates_${l.path}`},{number:l.number}):0})})]})}return null},Ut={community:{basePath:"/community/",className:"community",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"},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"}},Qo=({data:t,cta:e,link:n,gtmContext:r})=>{var b;const i=q.useIntl(),[s,o]=g.useState({loading:!1,registered:t.registered||!1});g.useEffect(()=>{t.registered&&o(_=>({..._,registered:!0}))},[t.registered]);const{startDate:c,dateHasPassed:f,pill:u,slug:d}=t,l=t.contentType;let m="";if((b=Ut[l])!=null&&b.gtmEvent&&(m=Ut[l].gtmEvent),c&&f)return a.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:i.formatMessage({id:"card_watch"})});if(l==="people")return a.jsx(re,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:i.formatMessage({id:"card_cta_people"})});const p=["microcourse","event"];if(e&&e.onClick&&p.includes(l)&&u!=="premium"){const _=s.loading||s.registered,x=async v=>{if(v.preventDefault(),v.stopPropagation(),!(_||!e||!e.onClick)){o(y=>({...y,loading:!0}));try{const y=await e.onClick(t);o(y==="success"?()=>({registered:!0,loading:!1}):S=>({...S,loading:!1}))}catch{o(S=>({...S,loading:!1}))}}};return a.jsx(re,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:_,"data-gtm-event-context":`${r}Page-${l}: ${d}`,"data-gtm-event-type":`${r}-${l}-register-click`,"data-testid":"in-card-button",children:i.formatMessage({id:`card_cta_${l}${_?`_${s.loading?"loading":"done"}`:""}`})})}return null},Ir={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Jo=t=>{let e=t;return Object.keys(Ir).includes(t)&&(e=Ir[t]),`url(${Ae}icons/${e}.svg)`};const Xo={title:66,text:3e3,secondaryText:1e3,partner:25},Yn=({id:t="",card:e,buildCardData:n,cta:r,gtmContext:i="Carousel",className:s=""})=>{var Y;const o=q.useIntl(),c=g.useContext(Te),f=c&&typeof c.id=="string",[u,d]=g.useState({data:null,isLoading:!0}),{data:l,isLoading:m}=u,p=g.useCallback(()=>{n(e,f).then(R=>{d(()=>({data:R,isLoading:!1}))}).catch(()=>d(R=>({...R,isLoading:!1})))},[t]);if(g.useEffect(()=>{p()},[]),m||!l)return a.jsx(xe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:b}=l;if(!b||!Ut[b])return a.jsx(xe,{element:"li",className:"card-wrapper"});const{basePath:_="",className:x,length:v,gtmEvent:y}=Ut[b],S=ca(`card_label_${b}`)?o.formatMessage({id:`card_label_${b}`}):!1,T=l.slug?`${_}${l.slug}`:!1,k={...Xo,...v};let Z={className:"card"};T&&(Z={href:T,className:"card gtm-trackable","data-gtm-event-context":`${i}-CarouselCard`,"data-gtm-event-type":`${y}-click`,"data-testid":"link"},l.openInNewTab&&(Z.target="_blank"));const O=l.customIcon?{"--custom-icon":Jo(l.customIcon)}:{};return a.jsx("li",{className:M("card-wrapper text-medium",x,s,{"has-link":T,"no-link":!T,"has-custom-icon":l.customIcon,"has-image":l.banner}),style:O,"data-testid":`${b}-card`,children:g.createElement(T?"a":"div",Z,a.jsxs(a.Fragment,{children:[(l.customLabel||S)&&a.jsx("small",{className:M("card-label text-small",x),children:l.customLabel||S}),l.startDate&&!l.isOngoingEvent&&a.jsx(Ve,{size:"small",variant:l.dateHasPassed?"default":"information","data-testid":"date",children:l.dateHasPassed?o.formatMessage({id:"card_ended"}):qi(l.startDate)}),l.banner?a.jsxs("p",{className:"img",children:[l.registered&&a.jsx(Ve,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),a.jsx(tt,{image:l.banner})]}):x==="people"?a.jsx(Re,{name:l.title||"",src:l.profile,"data-testid":"people-profile-picture"}):null,l.contributors&&a.jsx(Zn,{contributors:{data:l.contributors},styling:{size:"small",showGap:x!=="question",showText:!0},"data-testid":"contributors"}),l.partner&&a.jsx("p",{className:"partners","data-testid":"partners",children:Ye(l.partner.title,k.partner)}),["title","text","secondaryText"].map(R=>{const D=l[R];if(!D)return null;const C=Li(R);return a.jsx("p",{className:C,"data-testid":C,children:Ye(D,k[R])},R)}),(l==null?void 0:l.members)&&a.jsxs("span",{className:"member-information",children:[((Y=l==null?void 0:l.members)==null?void 0:Y.isMember)&&a.jsx(Ve,{size:"small",variant:"registered",children:"Member"}),a.jsx("br",{}),a.jsx("span",{className:"label",children:`${l==null?void 0:l.members.count} Members`})]}),a.jsx(Go,{type:x||"",data:l}),a.jsx(Qo,{data:l,cta:r,link:T||"",gtmContext:i})]}))})};const za=({cards:t,cardTypes:e,className:n="",...r})=>a.jsx("ul",{className:M("card-block",n),children:t.map((i,s)=>{const o=i.slug?`${i.slug}-${e[s]}`:`${e[s]}-${s}`;return a.jsx(Yn,{id:o,card:{...i,contentType:e[s]},...r},o)})}),ec=(t,e,n,r)=>{const i=e*n<=t,s=t<e*(n+1),o=r.includes(Math.floor(t/e));return i&&s||o},tc=({id:t,title:e})=>{const n=q.useIntl();if(!e||!e.text)return null;const{text:r,element:i="h2",variant:s="default",size:o="medium",link:c}=e;return g.createElement(i,{className:M("title",s,o,{"highlighted-title":s==="highlighted"}),children:a.jsxs(a.Fragment,{children:[r,c&&a.jsx("a",{href:c,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${t||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const vn={fourCards:1024,threeCards:769,twoCards:480};let Ct=null;const nc=({id:t,cards:e,cardTypes:n,buildCardData:r,title:i,className:s,gtmContext:o})=>{const c=q.useIntl(),[f,u]=g.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:d,isLoading:l}=f,[m,p]=g.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:_}=m,x=e.length,v=Math.ceil(x/d),y=g.useRef(null),S=Xe(!0,!0,y==null?void 0:y.current);g.useEffect(()=>{let R=1;S&&(S>=vn.fourCards?R=4:S>=vn.threeCards?R=3:S>=vn.twoCards&&(R=2),R>x&&(R=x)),u(D=>({...D,cardsPerPage:R,isLoading:!1}))},[S,x]);const T=(R="next")=>{let D=b;if(typeof R=="string")if(R==="next")if(b<v-1)D=b+1;else return;else if(b>0)D=b-1;else return;else D=R;p(C=>({...C,currentPage:D,loadedPages:[...new Set([..._,D])]}))},k=R=>{Ct=R.touches[0].clientX},Z=R=>{if(Ct===null)return;const D=R.touches[0].clientX,C=Ct-D;C>5?T("next"):C<-5&&T("previous"),Ct=null},O={"--width":`${S||0}px`,"--total-cards":x,"--cards-per-page":d,"--page":b};if(l)return a.jsx(Un,{layout:`carousel${i?"-with-title":""}`});const Y=(R,D)=>{var E;let C=null;return(E=R==null?void 0:R.sys)!=null&&E.id?C=`card-${R.sys.id}`:R!=null&&R.slug?C=`card-${R.slug}`:[n[D],R.contentType].includes("customCard")&&(C=`card-${window.btoa(`${R.title} ${R.createdAt}`)}-${D}`),C};return a.jsxs("section",{ref:y,className:M("carousel-wrapper",s),"data-testid":"carousel",children:[a.jsx(tc,{id:t,title:i}),a.jsx("ul",{className:"carousel",onTouchStart:k,onTouchMove:Z,style:O,"data-testid":"carousel-list",children:e.map((R,D)=>{let C=Y(R,D);return C&&ec(D,d,b,_)?a.jsx(Yn,{id:C,card:{...R,contentType:n[D]},buildCardData:r,gtmContext:o},C):(C=C||`${t}-card-${D}`,a.jsx(xe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},C))})}),v<=1?null:a.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[a.jsx("li",{className:"arrow previous",children:a.jsx(re,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:R=>{R.preventDefault(),R.stopPropagation(),T("previous")},screenreaderText:c.formatMessage({id:"carousel_pagination_previous"}),disabled:b<=0})}),[...Array(v)].map((R,D)=>a.jsx("li",{"data-testid":"carousel-controls-button",children:a.jsx("button",{className:M("page-indicator",{selected:D===b}),onClick:C=>{C.preventDefault(),C.stopPropagation(),T(D)},children:a.jsx(ge,{showOnFocus:!1,children:c.formatMessage({id:"carousel_pagination_page"},{number:D+1,total:v})})})},`page-indicator-${D}`)),a.jsx("li",{className:"arrow next",children:a.jsx(re,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:R=>{R.preventDefault(),R.stopPropagation(),T("next")},screenreaderText:c.formatMessage({id:"carousel_pagination_next"}),disabled:b>=v-1})})]})]})},rc=({carousels:t=[],isLoading:e,title:n,className:r="",...i})=>!t||!t.length?null:t.map(({title:s,viewAllUrl:o,cards:c,cardsTypes:f},u)=>{const d=s?window.btoa(s):`carousel-${u}`,l=u===t.length-1;return e?a.jsxs(g.Fragment,{children:[a.jsx(Un,{layout:`carousel${s?"-with-title":""}`,"data-testid":"carousel-placeholder"}),l?null:a.jsx(je,{})]},`placeholder-${d}`):a.jsxs(g.Fragment,{children:[a.jsx(nc,{cards:c,cardTypes:f,title:{...n,text:s,link:o},...i}),l?null:a.jsx(je,{})]},`carousel-${d}`)});const bn="joinCommunityButton",Kn=({isMember:t=!1,isShort:e=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const i=q.useIntl(),s=g.useContext(Te),o=s&&typeof s.id=="string",[c,f]=g.useState(t),[u,d]=g.useState(t?"joined":"notJoined");g.useEffect(()=>{u==="joining"?d("joined"):u==="leaving"&&d("notJoined")},[c]);const l={},m={};return c&&u!=="leaving"&&(l["data-hover-text"]=i.formatMessage({id:`${bn}_leave`}),l["aria-label"]=i.formatMessage({id:`${bn}_member_aria`}),m["aria-hidden"]="true"),a.jsx(re,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&u!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{o&&(p.currentTarget.blur(),c?(d("leaving"),typeof r=="function"&&await r()):(d("joining"),typeof n=="function"&&await n()),f(!c))},className:M("join-community-button",u,{active:u==="joining"}),disabled:!o,...l,children:a.jsx("span",{className:"text",...m,children:i.formatMessage({id:`${bn}${["joining","leaving"].includes(u)?`_${u}`:c?"_member":e?"_short":""}`})})})};const yn="communityDetails_",ac=({className:t="",isMember:e=!1,slug:n,members:{number:r=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const c=q.useIntl(),f=5,u=r||i.length,d=i.length?i:Array(f).fill({}),l=`/communities/${n}/members`===window.location.pathname;return a.jsxs("div",{className:M("community-details",t),children:[a.jsx(je,{}),a.jsxs("div",{className:"member-details",children:[a.jsxs("div",{className:"top",children:[a.jsxs("h4",{children:[c.formatMessage({id:`${yn}members`}),a.jsx("span",{className:"count",children:u})]}),!l&&a.jsx("p",{className:"text-small",children:a.jsx("a",{href:`/communities/${n}/members`,children:c.formatMessage({id:`${yn}viewAll`})})})]}),a.jsx(Zn,{contributors:{total:r,data:d},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:f})]}),a.jsx(Kn,{isMember:e,functions:{...o}}),e&&a.jsx(re,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:c.formatMessage({id:`${yn}invite`})})]})};const ic=({breadcrumbs:t,cutoff:e=20,className:n=""})=>{const r=q.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(ge,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),a.jsx("ul",{className:M("breadcrumbs text-small",n),children:t.map(({text:i,href:s,current:o=!1},c)=>a.jsxs("li",{children:[o&&a.jsx(ge,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),a.jsx(nt,{href:o?void 0:s,children:Ye(i,e)})]},`${window.btoa(i)}_${c}`))})]})};const sc=({options:t,allOption:e=!1,allowMultiple:n=!0,onChange:r=()=>{},className:i=""})=>{const s=q.useIntl(),o=e?[{id:"all",text:typeof e!="boolean"&&e.text||s.formatMessage({id:"filters_all"})},...t]:t,[c,f]=g.useState(e?["all"]:[]),u=(d,l)=>{let m=[];c.includes(d)?m=c.filter(p=>p!==d):d==="all"?m=["all"]:n?m=[...c.filter(p=>p!=="all"),d]:m=[d],f(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),l&&typeof l=="function"&&l()};return a.jsx("ul",{className:M("filters",i),children:o.map(({id:d,text:l,disabled:m=!1,callback:p=()=>{}})=>{let b={};return m&&(b={disabled:!0,"aria-label":s.formatMessage({id:"filters_disabled"},{name:l})}),a.jsx("li",{children:a.jsx("button",{className:M(d,{selected:c.includes(d)}),onClick:_=>{_.preventDefault(),_.stopPropagation(),u(d,p)},...b,children:l})},d)})})},oc=(t,e)=>{const n=String(t);if(!e||!e.length)return`/${n}`;let r="";return e.forEach(({url:i,position:s})=>{s==="before-lang"?r+=`/${i}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${i}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const _n={en:"English",es:"Español",fr:"Français",pt:"Português"},Mt="languageSwitcher_",cc=({currentLanguage:t,isOriginalLanguage:e=!1,isHumanTranslation:n=!1,translations:r,onChange:i=()=>{},urlParts:s,variant:o="default",label:c,className:f=""})=>{const u=q.useIntl(),[d,l]=g.useState(t);if(g.useEffect(()=>{t!==d&&l(t)},[t]),!r||!Object.values(r).some(_=>_&&_.post_name))return null;const p=Object.keys(r),b=d!==t;return a.jsxs("div",{className:M("language-switcher text-small",o,f),children:[a.jsxs("nav",{children:[o!=="short"&&a.jsx("p",{children:c||u.formatMessage({id:`${Mt}label`})}),a.jsx("ul",{children:p.map(_=>{if(!_n[_])return null;let x={className:_};return d===_?x["aria-label"]=u.formatMessage({id:`${Mt}selected`},{language:_n[_]}):x={...x,href:oc(_,s),onClick:v=>{v.preventDefault(),v.stopPropagation(),l(_),i(_)}},a.jsx("li",{children:a.jsx(nt,{...x,fallbackElement:"span",children:_n[_]})},_)})}),o!=="short"&&!b&&a.jsx("p",{children:u.formatMessage({id:`${Mt}translation_${e?"original":n?"human":"machine"}`})})]}),o!=="short"&&!b&&!e&&!n&&a.jsx("small",{children:u.formatMessage({id:`${Mt}disclaimer`},{email:We.support,link:_=>{const x=`mailto:${_}`;return a.jsx("a",{href:x,children:_})}})})]})};const xn=q.createIntl({locale:"en",messages:Bn}),yt=({hasNextPage:t=!0,loadNextPage:e=()=>{},variant:n="secondary",size:r="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:xn.formatMessage({id:"loadMore_button"}),endOfFeed:xn.formatMessage({id:"loadMore_endOfFeed"}),error:xn.formatMessage({id:"loadMore_error"})},className:c="",gtmContext:f="LoadMore"})=>{const[u,d]=g.useState(""),l=async m=>{try{await e(m)}catch(p){p instanceof Error?d(p.message):d("Unknown error")}};return!u&&!t&&!o.endOfFeed?null:a.jsx("footer",{className:M("load-more",c),children:!u&&t?a.jsx(re,{variant:n,size:r,styling:i,icon:s,onClick:l,"data-gtm-event-context":f,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!u||u!=null&&u.includes("Cannot read items"))?a.jsx("p",{children:o.endOfFeed}):u&&a.jsx("p",{className:"error",children:o.error})})};const Gn=({variant:t="default",version:e="default",className:n="",...r})=>a.jsx("p",{className:"logo-wrapper",children:a.jsx("a",{href:"/home/",className:M("logo",t,e,n),...r,children:a.jsx(ge,{children:a.jsx(q.FormattedMessage,{id:"apolitical"})})})});let Nt=!1;const Za=({element:t="div",id:e="more-menu",options:n,className:r=""})=>{const i=q.useIntl(),s=g.useRef(null),[o,c]=g.useState(!1),f=u=>{s.current&&u.target instanceof HTMLElement&&!s.current.contains(u.target)&&c(!1)};return g.useEffect(()=>(document.addEventListener("click",f,!0),()=>{document.removeEventListener("click",f,!0)})),g.createElement(t,{ref:s,className:M("more-menu text-medium",r),children:a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>c(!o),"aria-haspopup":"true","aria-expanded":o,"aria-controls":e,screenreaderText:i.formatMessage({id:"moreMenu"})}),a.jsx("ul",{id:e,hidden:!o,children:n.map(({href:u,onClick:d,text:l,icon:m,...p},b)=>{const _={...p,onClick:x=>{c(!1),typeof d=="function"&&d(x)},onFocus:()=>{Nt&&(clearTimeout(Nt),Nt=!1)},onBlur:()=>{Nt=setTimeout(()=>{c(!1)},100)}};return u&&(_.href=u),a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,..._,children:l})},`${window.btoa(l)}_${b}`)})})]})})},lc=(t,e=!1)=>e?t.replaceAll("/","")===e:typeof window<"u"&&window.location&&window.location.pathname===t;const uc=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"}],Wa=({activeLink:t})=>{const e=q.useIntl(),n=g.useContext(Te),r=n&&typeof n.id=="string";return a.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[uc.map(({key:i,href:s})=>a.jsx("li",{className:M(i,{active:lc(s,t)}),children:a.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:e.formatMessage({id:`navigationMenu_links_${i}`})})},i)),r&&a.jsx("li",{className:"profile","data-testid":"profile-link",children:a.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[a.jsx(Re,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),a.jsx("span",{children:e.formatMessage({id:"navigationMenu_profile"})})]})})]})},lt=(t,e,n)=>`${t}?share=${e}${n?`&uuid=${n}`:""}`,dc=({title:t,link:e,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${lt(e,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(t)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${lt(e,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(t)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${lt(e,"facebook",n)}`)}&t=${t}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(`${t}
|
|
62
|
+
*/function $r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Pr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$r(Object(n),!0).forEach(function(r){to(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$r(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function to(t,e,n){return e=ro(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function no(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ro(t){var e=no(t,"string");return typeof e=="symbol"?e:String(e)}var Rr={activateTrap:function(e,n){if(e.length>0){var r=e[e.length-1];r!==n&&r.pause()}var i=e.indexOf(n);i===-1||e.splice(i,1),e.push(n)},deactivateTrap:function(e,n){var r=e.indexOf(n);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},ao=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},io=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},ft=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},so=function(e){return ft(e)&&!e.shiftKey},oo=function(e){return ft(e)&&e.shiftKey},Fr=function(e){return setTimeout(e,0)},Or=function(e,n){var r=-1;return e.every(function(i,s){return n(i)?(r=s,!1):!0}),r},ot=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof e=="function"?e.apply(void 0,r):e},jt=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},co=[],lo=function(e,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||co,s=Pr({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:so,isKeyBackward:oo},n),o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},c,f=function(E,w,N){return E&&E[w]!==void 0?E[w]:s[N||w]},u=function(E,w){var N=typeof(w==null?void 0:w.composedPath)=="function"?w.composedPath():void 0;return o.containerGroups.findIndex(function(L){var z=L.container,I=L.tabbableNodes;return z.contains(E)||(N==null?void 0:N.includes(z))||I.find(function(H){return H===E})})},d=function(E){var w=s[E];if(typeof w=="function"){for(var N=arguments.length,L=new Array(N>1?N-1:0),z=1;z<N;z++)L[z-1]=arguments[z];w=w.apply(void 0,L)}if(w===!0&&(w=void 0),!w){if(w===void 0||w===!1)return w;throw new Error("`".concat(E,"` was specified but was not a node, or did not return a node"))}var I=w;if(typeof w=="string"&&(I=r.querySelector(w),!I))throw new Error("`".concat(E,"` as selector refers to no known node"));return I},l=function(){var E=d("initialFocus");if(E===!1)return!1;if(E===void 0||!Ot(E,s.tabbableOptions))if(u(r.activeElement)>=0)E=r.activeElement;else{var w=o.tabbableGroups[0],N=w&&w.firstTabbableNode;E=N||d("fallbackFocus")}if(!E)throw new Error("Your focus-trap needs to have at least one focusable element");return E},m=function(){if(o.containerGroups=o.containers.map(function(E){var w=$a(E,s.tabbableOptions),N=Pa(E,s.tabbableOptions),L=w.length>0?w[0]:void 0,z=w.length>0?w[w.length-1]:void 0,I=N.find(function(j){return Oe(j)}),H=N.slice().reverse().find(function(j){return Oe(j)}),J=!!w.find(function(j){return $e(j)>0});return{container:E,tabbableNodes:w,focusableNodes:N,posTabIndexesFound:J,firstTabbableNode:L,lastTabbableNode:z,firstDomTabbableNode:I,lastDomTabbableNode:H,nextTabbableNode:function($){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,U=w.indexOf($);return U<0?W?N.slice(N.indexOf($)+1).find(function(V){return Oe(V)}):N.slice(0,N.indexOf($)).reverse().find(function(V){return Oe(V)}):w[U+(W?1:-1)]}}}),o.tabbableGroups=o.containerGroups.filter(function(E){return E.tabbableNodes.length>0}),o.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find(function(E){return E.posTabIndexesFound})&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function C(E){var w=E.activeElement;if(w)return w.shadowRoot&&w.shadowRoot.activeElement!==null?C(w.shadowRoot):w},b=function C(E){if(E!==!1&&E!==p(document)){if(!E||!E.focus){C(l());return}E.focus({preventScroll:!!s.preventScroll}),o.mostRecentlyFocusedNode=E,ao(E)&&E.select()}},_=function(E){var w=d("setReturnFocus",E);return w||(w===!1?!1:E)},x=function(E){var w=E.target,N=E.event,L=E.isBackward,z=L===void 0?!1:L;w=w||jt(N),m();var I=null;if(o.tabbableGroups.length>0){var H=u(w,N),J=H>=0?o.containerGroups[H]:void 0;if(H<0)z?I=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:I=o.tabbableGroups[0].firstTabbableNode;else if(z){var j=Or(o.tabbableGroups,function(G){var K=G.firstTabbableNode;return w===K});if(j<0&&(J.container===w||Ot(w,s.tabbableOptions)&&!Oe(w,s.tabbableOptions)&&!J.nextTabbableNode(w,!1))&&(j=H),j>=0){var $=j===0?o.tabbableGroups.length-1:j-1,W=o.tabbableGroups[$];I=$e(w)>=0?W.lastTabbableNode:W.lastDomTabbableNode}else ft(N)||(I=J.nextTabbableNode(w,!1))}else{var U=Or(o.tabbableGroups,function(G){var K=G.lastTabbableNode;return w===K});if(U<0&&(J.container===w||Ot(w,s.tabbableOptions)&&!Oe(w,s.tabbableOptions)&&!J.nextTabbableNode(w))&&(U=H),U>=0){var V=U===o.tabbableGroups.length-1?0:U+1,ee=o.tabbableGroups[V];I=$e(w)>=0?ee.firstTabbableNode:ee.firstDomTabbableNode}else ft(N)||(I=J.nextTabbableNode(w))}}else I=d("fallbackFocus");return I},v=function(E){var w=jt(E);if(!(u(w,E)>=0)){if(ot(s.clickOutsideDeactivates,E)){c.deactivate({returnFocus:s.returnFocusOnDeactivate});return}ot(s.allowOutsideClick,E)||E.preventDefault()}},y=function(E){var w=jt(E),N=u(w,E)>=0;if(N||w instanceof Document)N&&(o.mostRecentlyFocusedNode=w);else{E.stopImmediatePropagation();var L,z=!0;if(o.mostRecentlyFocusedNode)if($e(o.mostRecentlyFocusedNode)>0){var I=u(o.mostRecentlyFocusedNode),H=o.containerGroups[I].tabbableNodes;if(H.length>0){var J=H.findIndex(function(j){return j===o.mostRecentlyFocusedNode});J>=0&&(s.isKeyForward(o.recentNavEvent)?J+1<H.length&&(L=H[J+1],z=!1):J-1>=0&&(L=H[J-1],z=!1))}}else o.containerGroups.some(function(j){return j.tabbableNodes.some(function($){return $e($)>0})})||(z=!1);else z=!1;z&&(L=x({target:o.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(o.recentNavEvent)})),b(L||o.mostRecentlyFocusedNode||l())}o.recentNavEvent=void 0},S=function(E){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;o.recentNavEvent=E;var N=x({event:E,isBackward:w});N&&(ft(E)&&E.preventDefault(),b(N))},T=function(E){if(io(E)&&ot(s.escapeDeactivates,E)!==!1){E.preventDefault(),c.deactivate();return}(s.isKeyForward(E)||s.isKeyBackward(E))&&S(E,s.isKeyBackward(E))},k=function(E){var w=jt(E);u(w,E)>=0||ot(s.clickOutsideDeactivates,E)||ot(s.allowOutsideClick,E)||(E.preventDefault(),E.stopImmediatePropagation())},Z=function(){if(o.active)return Rr.activateTrap(i,c),o.delayInitialFocusTimer=s.delayInitialFocus?Fr(function(){b(l())}):b(l()),r.addEventListener("focusin",y,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",k,{capture:!0,passive:!1}),r.addEventListener("keydown",T,{capture:!0,passive:!1}),c},O=function(){if(o.active)return r.removeEventListener("focusin",y,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",k,!0),r.removeEventListener("keydown",T,!0),c},Y=function(E){var w=E.some(function(N){var L=Array.from(N.removedNodes);return L.some(function(z){return z===o.mostRecentlyFocusedNode})});w&&b(l())},R=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(Y):void 0,D=function(){R&&(R.disconnect(),o.active&&!o.paused&&o.containers.map(function(E){R.observe(E,{subtree:!0,childList:!0})}))};return c={get active(){return o.active},get paused(){return o.paused},activate:function(E){if(o.active)return this;var w=f(E,"onActivate"),N=f(E,"onPostActivate"),L=f(E,"checkCanFocusTrap");L||m(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,w==null||w();var z=function(){L&&m(),Z(),D(),N==null||N()};return L?(L(o.containers.concat()).then(z,z),this):(z(),this)},deactivate:function(E){if(!o.active)return this;var w=Pr({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},E);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,O(),o.active=!1,o.paused=!1,D(),Rr.deactivateTrap(i,c);var N=f(w,"onDeactivate"),L=f(w,"onPostDeactivate"),z=f(w,"checkCanReturnFocus"),I=f(w,"returnFocus","returnFocusOnDeactivate");N==null||N();var H=function(){Fr(function(){I&&b(_(o.nodeFocusedBeforeActivation)),L==null||L()})};return I&&z?(z(_(o.nodeFocusedBeforeActivation)).then(H,H),this):(H(),this)},pause:function(E){if(o.paused||!o.active)return this;var w=f(E,"onPause"),N=f(E,"onPostPause");return o.paused=!0,w==null||w(),O(),D(),N==null||N(),this},unpause:function(E){if(!o.paused||!o.active)return this;var w=f(E,"onUnpause"),N=f(E,"onPostUnpause");return o.paused=!1,w==null||w(),m(),Z(),D(),N==null||N(),this},updateContainerElements:function(E){var w=[].concat(E).filter(Boolean);return o.containers=w.map(function(N){return typeof N=="string"?r.querySelector(N):N}),o.active&&m(),D(),this}},c.updateContainerElements(e),c};const uo=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:lo},Symbol.toStringTag,{value:"Module"})),fo=Qr(uo),mo=Qr(eo);function Ge(t){"@babel/helpers - typeof";return Ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ge(t)}function po(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ra(r.key),r)}}function ho(t,e,n){return e&&Dr(t.prototype,e),n&&Dr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function go(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&In(t,e)}function In(t,e){return In=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},In(t,e)}function vo(t){var e=yo();return function(){var r=qt(t),i;if(e){var s=qt(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return bo(this,i)}}function bo(t,e){if(e&&(Ge(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}function ut(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yo(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},qt(t)}function _o(t,e,n){return e=Ra(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ra(t){var e=xo(t,"string");return Ge(e)==="symbol"?e:String(e)}function xo(t,e){if(Ge(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Ge(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tt=g,Q=Is,wo=fo,ko=wo.createFocusTrap,jo=mo,To=jo.isFocusable,Hn=function(t){go(n,t);var e=vo(n);function n(r){var i;po(this,n),i=e.call(this,r),_o(ut(i),"getNodeForOption",function(c){var f,u=(f=this.internalOptions[c])!==null&&f!==void 0?f:this.originalOptions[c];if(typeof u=="function"){for(var d=arguments.length,l=new Array(d>1?d-1:0),m=1;m<d;m++)l[m-1]=arguments[m];u=u.apply(void 0,l)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(c,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var b;if(p=(b=this.getDocument())===null||b===void 0?void 0:b.querySelector(u),!p)throw new Error("`".concat(c,"` as selector refers to no known node"))}return p}),i.handleDeactivate=i.handleDeactivate.bind(ut(i)),i.handlePostDeactivate=i.handlePostDeactivate.bind(ut(i)),i.handleClickOutsideDeactivates=i.handleClickOutsideDeactivates.bind(ut(i)),i.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:i.handleDeactivate,onPostDeactivate:i.handlePostDeactivate,clickOutsideDeactivates:i.handleClickOutsideDeactivates},i.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var s=r.focusTrapOptions;for(var o in s)if(Object.prototype.hasOwnProperty.call(s,o)){if(o==="returnFocusOnDeactivate"||o==="onDeactivate"||o==="onPostDeactivate"||o==="checkCanReturnFocus"||o==="clickOutsideDeactivates"){i.originalOptions[o]=s[o];continue}i.internalOptions[o]=s[o]}return i.outsideClick=null,i.focusTrapElements=r.containerElements||[],i.updatePreviousElement(),i}return ho(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var i=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return i||(i===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var i=this.getDocument();i&&(this.previouslyFocusedElement=i.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(i){var s=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,i):this.originalOptions.clickOutsideDeactivates;return s&&(this.outsideClick={target:i.target,allowDeactivation:s}),s}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var i=this,s=function(){var c=i.getReturnFocusNode(),f=!!(i.originalOptions.returnFocusOnDeactivate&&c!==null&&c!==void 0&&c.focus&&(!i.outsideClick||i.outsideClick.allowDeactivation&&!To(i.outsideClick.target,i.internalOptions.tabbableOptions))),u=i.internalOptions.preventScroll,d=u===void 0?!1:u;f&&c.focus({preventScroll:d}),i.originalOptions.onPostDeactivate&&i.originalOptions.onPostDeactivate.call(null),i.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(s,s):s()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var i=this.focusTrapElements.some(Boolean);i&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(i){if(this.focusTrap){i.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var s=!i.active&&this.props.active,o=i.active&&!this.props.active,c=!i.paused&&this.props.paused,f=i.paused&&!this.props.paused;if(s&&(this.updatePreviousElement(),this.focusTrap.activate()),o){this.deactivateTrap();return}c&&this.focusTrap.pause(),f&&this.focusTrap.unpause()}else i.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var i=this,s=this.props.children?Tt.Children.only(this.props.children):void 0;if(s){if(s.type&&s.type===Tt.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var o=function(u){var d=i.props.containerElements;s&&(typeof s.ref=="function"?s.ref(u):s.ref&&(s.ref.current=u)),i.focusTrapElements=d||[u]},c=Tt.cloneElement(s,{ref:o});return c}return null}}]),n}(Tt.Component),ct=typeof Element>"u"?Function:Element;Hn.propTypes={active:Q.bool,paused:Q.bool,focusTrapOptions:Q.shape({document:Q.object,onActivate:Q.func,onPostActivate:Q.func,checkCanFocusTrap:Q.func,onPause:Q.func,onPostPause:Q.func,onUnpause:Q.func,onPostUnpause:Q.func,onDeactivate:Q.func,onPostDeactivate:Q.func,checkCanReturnFocus:Q.func,initialFocus:Q.oneOfType([Q.instanceOf(ct),Q.string,Q.bool,Q.func]),fallbackFocus:Q.oneOfType([Q.instanceOf(ct),Q.string,Q.func]),escapeDeactivates:Q.oneOfType([Q.bool,Q.func]),clickOutsideDeactivates:Q.oneOfType([Q.bool,Q.func]),returnFocusOnDeactivate:Q.bool,setReturnFocus:Q.oneOfType([Q.instanceOf(ct),Q.string,Q.bool,Q.func]),allowOutsideClick:Q.oneOfType([Q.bool,Q.func]),preventScroll:Q.bool,tabbableOptions:Q.shape({displayCheck:Q.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:Q.oneOfType([Q.bool,Q.func])}),trapStack:Q.array,isKeyForward:Q.func,isKeyBackward:Q.func}),containerElements:Q.arrayOf(Q.instanceOf(ct)),children:Q.oneOfType([Q.element,Q.instanceOf(ct)])};Hn.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:ko};var Eo=Hn;const So=Gr(Eo);const Vn=({element:t="section",children:e,className:n,...r})=>g.createElement(t,{className:M("modal",n),children:typeof e=="string"?a.jsx("p",{children:e}):e,...r});const bt=({id:t="content-overlay",isOpen:e=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:s=()=>{}}={},forceShow:{error:o=!1}={},title:c,children:f,buttons:u,className:d="",gtmContext:l="Modal"})=>{const m=q.useIntl(),[p,b]=g.useState(e),_=y=>{y.key==="Escape"&&x(!1)};g.useEffect(()=>(window.addEventListener("keyup",_),()=>{window.removeEventListener("keyup",_)}));const x=y=>{b(y),y?(i(),document.body.classList.add("has-overlay")):(s(),document.body.classList.remove("has-overlay"))};g.useEffect(()=>{x(e)},[e]);const v=r?{"--max-width":`${r/16}rem`}:{};return a.jsx("div",{className:M("overlay",{open:p}),role:"dialog",children:a.jsx(Vn,{id:t,className:M("overlay-modal",d,{"has-max-width":r}),hidden:!p,style:v,children:e&&a.jsx(So,{children:a.jsxs("div",{className:"overlay-content",children:[a.jsxs("div",{className:"top",children:[c&&a.jsx("h2",{className:"modal-title",children:c}),a.jsx(re,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":l,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&a.jsx(je,{}),f,u&&a.jsxs("div",{className:"bottom",children:[a.jsx(je,{}),a.jsx(et,{buttons:u})]}),o&&a.jsx(gt,{className:"error",children:o})]})})})})},Fa=(t,e)=>({"aria-haspopup":!0,"aria-expanded":e,"aria-controls":t});const Et="emailHelperTextBox_",Oa=({type:t,email:e,redirectPath:n,resendVerificationCode:r})=>{const i=q.useIntl(),[s,o]=g.useState({path:`${Et}default`,type:"default",link:{},mail:{},error:""}),[c,f]=g.useState(!1),u=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const b=_=>{o({path:`${Et}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>u(x),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:_})};if(typeof r!="function"){b(i.formatMessage({id:`${Et}error_noFunction`}));return}f(!0),r(e).then(()=>{localStorage.setItem("email",e),window.location.href=n||"/signup/verify-email"}).catch(_=>{b(_.message)}).finally(()=>{f(!1)})},[e,n,r]);g.useEffect(()=>{let p=Et,b="default",_={},x={};switch(t){case"gov":p+="autoApproved",b="success";break;case"nonGov":p+="unrecognisedEmail",b="error",_={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",b="error",x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",b="error",_={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",b="error",_={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",_={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:p,type:b,link:_,mail:x})},[t]);const d={};return["link","mail"].forEach(p=>{d[p]=Object.keys(s[p]).length?b=>a.jsx("a",{...s[p],children:b}):b=>b}),a.jsx(va,{type:s.type,heading:c?!1:i.formatMessage({id:`${s.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(xe,{element:"span"}),a.jsx(xe,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...d,strong:p=>a.jsx("strong",{children:p}),em:p=>a.jsx("em",{children:p}),br:a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("br",{})]}),error:s.error})})},mt=({className:t="",element:e="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:s=n,placeholder:o,type:c="text",value:f,...u})=>{const d=g.useRef(),l=r||d;return g.createElement(e,{ref:l,...u,type:c,id:n,name:s,className:M(t,e,{"has-scrollbar":c==="textarea"&&l.current&&l.current.clientHeight<l.current.scrollHeight}),value:f,placeholder:o,...i,onChange:m=>{const p=m.target;i.onChange(p.value)}})};const ze={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Co=500,Mo=({value:t,placeholder:e,functions:n={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})}})=>{const{onChange:r=()=>{},onKeyInput:i=async()=>{}}=n,[{input:s,displayInput:o,debouncedInput:c},f]=g.useState({input:t,displayInput:t,debouncedInput:t}),[{predictions:u,activePredictionIndex:d,isPredictionSelected:l},m]=g.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!t}),{formatMessage:p}=q.useIntl();e||(e=p({id:"inputAutocomplete_placeholder"})),g.useEffect(()=>{const v=setTimeout(()=>{l||f(y=>({...y,debouncedInput:s}))},Co);return()=>{clearTimeout(v)}},[s,l]),g.useEffect(()=>{c&&!l?(async()=>{try{const y=await i(c)||[];m(S=>({...S,predictions:y}))}catch(y){console.error("Error fetching predictions:",y),m(S=>({...S,predictions:[]}))}})():m(v=>({...v,predictions:[]}))},[c,l]),g.useEffect(()=>{d>=0&&u[d]&&f(v=>({...v,displayInput:u[d].description}))},[d,u]);const b=v=>{[ze.DOWN,ze.UP,ze.ENTER].includes(v.key)&&(v.preventDefault(),v.key===ze.DOWN&&d<u.length-1?m(y=>({...y,activePredictionIndex:d+1})):v.key===ze.UP&&d>0?m(y=>({...y,activePredictionIndex:d-1})):v.key===ze.ENTER&&d>-1&&(r(u[d].description),f(y=>({...y,input:u[d].description})),m(y=>({...y,predictions:[],isPredictionSelected:!0}))))},_=v=>{r(v.target.value),f(y=>({...y,input:v.target.value,displayInput:v.target.value})),m(y=>({...y,activePredictionIndex:-1,isPredictionSelected:!1}))},x=v=>{r(v.description),f(y=>({...y,input:v.description,displayInput:v.description})),m(y=>({...y,isPredictionSelected:!0,predictions:[]}))};return a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:o,onChange:_,onKeyDown:b,placeholder:e}),a.jsx("ul",{className:"predictions-list",children:u.map((v,y)=>a.jsx("li",{onClick:()=>x(v),onMouseEnter:()=>m(S=>({...S,activePredictionIndex:y})),className:M("predictions-list-item",{active:y===d}),children:v.description},y))})]})};const Da=({className:t="",disabled:e,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:s,intlPath:o=!1,label:c,shownValue:f=!0,type:u="checkbox",value:d,...l})=>{const m=q.useIntl(),{onChange:p,...b}=r,_=()=>{e||p(d?null:f)},x=a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:s,id:i,name:i,type:u,value:f,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),_())},readOnly:!0,disabled:e}),a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("label",{htmlFor:i,children:c||m.formatMessage({id:o?`${o}_${i}`:i})})]});return g.createElement(n,{onClick:v=>{const y=v.target;y.nodeName.toLowerCase()==="a"||y.parentNode&&y.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),_())},className:M("checkbox-wrapper",t),...l,...b},x)};const No=g.memo(function({direction:e="down"}){return a.jsx(Yt,{className:M("rotating-chevron",`direction-${e}`)})});const $o=({className:t,options:e,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:s}={context:""},placeholder:o,multiSelect:c,multiSelectOptions:f,id:u})=>{const d=q.useIntl(),[l,m]=g.useState(!1),p=r||n,b=Array.isArray(p)?[...p]:p?[p]:[],[_,x]=g.useState(b);let v;Array.isArray(_)&&_.length===1&&typeof _[0]=="string"?v=e&&_?e.find(O=>O.id===_[0]):e?e[0]:{id:"",label:""}:Array.isArray(_)&&_.length===1&&typeof _[0]!="string"?v=_[0]:v={id:"",label:""},g.useEffect(()=>{x(b)},[r,n]);const{onChange:y,onMultiSelectSubmit:S,...T}=i,k=O=>{if(c){let Y=[];_!=null&&_.includes(O.id)?Y=_.filter(R=>R!==O.id):Y=[..._,O.id],x([...Y]),y&&y([...Y])}else x([O]),y&&y(O.id),m(!1)},Z=O=>{if(O==="all"){const Y=(e==null?void 0:e.map(R=>R.id))||[];x(Y),y&&y(Y)}else x([]),y&&y([])};return a.jsxs("div",{className:M("dropdown-wrapper",t),children:[a.jsxs("button",{className:"input","aria-expanded":l,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:O=>{O.preventDefault(),O.stopPropagation(),m(!l)},"data-testid":"dropdown-selector",...T,children:[c?`${o} · ${_.length}`:v.label,a.jsx(No,{direction:l?"up":"down"})]}),a.jsx("select",{defaultValue:v.id,onChange:O=>{O.preventDefault(),O.stopPropagation();const Y=e&&e.find(R=>R.id===O.target.value);k(Y)},hidden:!l,...T,children:e==null?void 0:e.map(O=>a.jsx("option",{value:O.id,children:O.label},O.id))}),a.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!l,children:[a.jsxs("div",{className:"dropdown-menu-list",children:[(f==null?void 0:f.topbar)&&a.jsxs("div",{className:"action-bar",children:[a.jsx("p",{children:`${_==null?void 0:_.length} selected`}),a.jsxs("ul",{children:[a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>Z("all"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"small",onClick:()=>Z("none"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),a.jsx("ul",{children:e==null?void 0:e.map(O=>{const Y=O.id===v.id||(_==null?void 0:_.includes(O))||(_==null?void 0:_.includes(O.id));return a.jsx("li",{"data-testid":"dropdown-options",children:a.jsxs("button",{className:M("gtm-trackable",{selected:Y,"selected-single":Y&&!c}),"data-gtm-event-type":`${O}-click`,"data-gtm-event-context":s,onClick:R=>{R.preventDefault(),R.stopPropagation(),k(O)},role:"menuitem","aria-current":Y,"data-testid":Y?"current-selection":"",children:[c&&a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("span",{className:M({"menu-option-label":c}),children:O.label})]})},O.id)})})]}),(f==null?void 0:f.submitSection)&&a.jsx("p",{className:"submit",children:a.jsx(re,{variant:"secondary",onClick:()=>{S&&S(_),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:_}})),m(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const Po=({className:t="",functions:e={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:s=!1,name:o,options:c,required:f,type:u="checkboxes",value:d,...l})=>{const m=q.useIntl(),p=s?d:[],b=d;return a.jsx("ul",{...l,className:M("options-wrapper",t),"data-testid":`ul-${r}`,children:c==null?void 0:c.map(({id:_,label:x=!1,value:v=_,disabled:y=!1})=>{const S=`${r}_${_}`,T=()=>{if(y)return;let k;if(s){const Z=p==null?void 0:p.indexOf(v);Array.isArray(p)&&Z>=0?(k=p,k.splice(Z,1)):(!p||p.length===0?k=[]:k=p,k.push(v))}else k=b===v?void 0:v;e.onChange(k)};return a.jsx(Da,{element:"li",id:S,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:s?p==null?void 0:p.includes(v):b===v,functions:{...e,onChange:T},intlPath:n,label:x||m.formatMessage({id:n?`${n}_${_}`:_}),disabled:y},S)})})};const Ro=({inputRef:t,type:e="password",gtm:{context:n}={context:void 0},...r})=>{const i=q.useIntl(),s=g.useRef(),o=t||s,[c,f]=g.useState(!1),[u,d]=g.useState(e),l=()=>{var m;f(!c),d(c?"password":"text"),(m=o.current)==null||m.focus()};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:M("show-password gtm-trackable",{"password-visible":c}),"data-gtm-event-context":n,"data-gtm-event-type":`${c?"hide":"show"}-password-click`,onClick:l,"aria-label":i.formatMessage({id:`showpassword_aria_${c?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${c?"hide":"show"}`})}),a.jsx(mt,{inputRef:o,type:u,...r})]})};const Ze={text:{component:mt},email:{component:mt},textarea:{component:mt,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Da},checkboxes:{component:Po,props:{multiSelect:!0}},select:{component:$o},password:{component:Ro},autocomplete:{component:Mo}},Fo=({id:t,intlPath:e=!1,className:n="",error:r,functions:i={onChange:()=>{}},limit:s=0,showRequiredLabels:o=!0,type:c,validation:f,value:u,...d})=>{const l=q.useIntl(),m=f&&f.some(({condition:T})=>T==="required"),p=(u==null?void 0:u.toString().length)||0,b=c&&Ze[c]&&Ze[c].component?Ze[c].component:mt,_={};c&&["checkboxes"].includes(c)?_.element="span":_.htmlFor=t;let x={...d,id:t,name:t,className:r?"error":"",type:c,required:m,"aria-required":m,functions:dt(i),value:u};s>0&&(x["data-character-limit"]=s,x.functions&&(x.functions.onChange=T=>{((T==null?void 0:T.toString().length)||0)>s&&(T=T==null?void 0:T.toString().slice(0,s)),i.onChange(T)})),c&&Ze[c]&&Ze[c].props&&(x={...x,...Ze[c].props}),c&&["checkboxes"].includes(c)&&(x.intlPath=`${e}_${t}`),r&&(x["aria-invalid"]=!0,x["aria-describedby"]=`error-${t}`);const v=d.label||l.formatMessage({id:e?`${e}_${t}`:t}),y=({...T})=>r?g.createElement(T.as||"dd",{id:`error-${t}`,className:"error text-small",role:"alert","aria-live":"assertive",...T},r):null;if(c&&["checkbox"].includes(c))return a.jsxs(a.Fragment,{children:[a.jsx(b,{...x,label:v,className:M("field-wrapper",n)}),a.jsx(y,{as:"p"})]});const S=T=>g.createElement(T.element||"label",{...T,className:"checkboxes-label text-small","data-testid":`label-${t}`});return a.jsxs("dl",{className:M("field-wrapper text-medium",n),children:[a.jsx("dt",{children:a.jsxs(S,{..._,children:[v,m&&o&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("small",{children:["(",l.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),a.jsxs("dd",{children:[a.jsx(b,{...x}),s>0?a.jsxs("small",{className:M("character-limit",{"near-limit":p>=.99*s,"approaching-limit":p>=.9*s&&p<.99*s}),children:[a.jsx("span",{className:"hidden",children:l.formatMessage({id:"form_fieldWrapper_characterLimit"})}),p," / ",s]}):null]}),a.jsx(y,{})]})},Oo=(t,e)=>{const{type:n,payload:r}=e,i=t.errors?dt(t.errors):{},s=t.values?dt(t.values):{};switch(n){case"toggleSubmitting":return{...t,isSubmitting:!t.isSubmitting};case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...t,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};s[r==null?void 0:r.key]=r==null?void 0:r.value}return{...t,errors:i,values:s};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...t,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...t,errors:i};case"submitForm":{const{fields:o=[],dispatch:c=()=>{},onSuccess:f=()=>{},onFailure:u=()=>{},intl:d}=r,l=dt(Object.keys(i));for(const m of o)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:b="required",error:_=!1}=m.validation[p];let x=!1;if(typeof b=="function"){const v=b(s);v&&(x=_||v)}else{const v=s[m.id];switch(b){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(x=_||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(x){c({type:"addError",payload:{key:m.id,value:x}}),l.push(m.id);break}}return l.length===0?f(s):u(s,l),{...t,isSubmitting:!1}}case"formSubmitted":return{...t,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return t}};let gn=null;const Qt=({fields:t,className:e="",id:n=t.length?`form__${t[0].id}`:"form",formRef:r,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:{shouldShowCancelButton:c=!1,shouldReset:f=!0,showRequiredLabels:u=!0,showSuccessMessage:d=!1}={shouldShowCancelButton:!1,shouldReset:!0,showRequiredLabels:!0,showSuccessMessage:!1},gtm:l={context:"Form",event:"form-submit-click"},functions:{onSuccess:m=async()=>{},onCancel:p=()=>{},onCatch:b=()=>{},onFailure:_=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...x})=>{const{customOnSubmit:v,hideButton:y,...S}=s,T=40,k=q.useIntl(),Z={};t.length&&t.forEach(I=>{const H=I.id||I.name;H&&(Z[H]=I.value||"")});const[O,Y]=g.useReducer(Oo,{isSubmitting:!1,formSubmitted:!1,errors:{},values:Z}),{errors:R,isSubmitting:D,formSubmitted:C,values:E}=O;g.useEffect(()=>{f&&C&&(gn=setTimeout(()=>{Y({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[C]),g.useEffect(()=>()=>{gn&&clearTimeout(gn)},[]),g.useEffect(()=>{const I=H=>{Y({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",I),()=>{document.removeEventListener("dropdownMultiSelectSubmit",I)}},[]);const w=g.useRef(null),N=r||w;if(!t.length)return null;s.text||(s.text=k.formatMessage({id:"form_submit"}));const z=[{...S,icon:C?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:I=>{var j;if(I.preventDefault(),I.stopPropagation(),D)return;let H=0;if((j=N==null?void 0:N.current)!=null&&j.id){const $=document.getElementById(N.current.id);$&&(H=$.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");if(J&&(H=H-J.offsetHeight-T),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),Y({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&Y({type:"submitForm",payload:{fields:t,dispatch:Y,intl:k}});return}Y({type:"submitForm",payload:{fields:t,dispatch:Y,onSuccess:async $=>{try{await m($),Y({type:f?"formSubmittedAndReset":"formSubmitted"})}catch(W){b(W),Y({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:($,W)=>{_($,W),Y({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:k}})},disabled:D||C||s.disabled,"data-gtm-event-context":l.context,"data-gtm-event-type":l.event,children:D||C?k.formatMessage({id:`form_${D?"submitting":"submitted"}`}):s.text}];return c&&z.unshift({...o,className:"gtm-trackable","data-gtm-event-context":l.context,"data-gtm-event-type":l.event,disabled:D||C,onClick:p,children:o.text||k.formatMessage({id:"form_cancel"})}),a.jsxs(a.Fragment,{children:[a.jsxs("form",{...x,id:n,className:M("form",e),ref:N,children:[R!=null&&R.general?a.jsx(Be,{variant:"error",text:k.formatMessage({id:"form_error_generalError"})}):null,(!D&&!C||v)&&t.map((I,H)=>{const{id:J=I.name||H,component:j,functions:$={onChange:()=>{}}}=I;if(j)return a.jsx(j,{...I.props||{}},`component-${J}-${H}`);const W=E?E[J]:"";return a.jsx(Fo,{intlPath:i,...I,showRequiredLabels:u,value:W,error:R==null?void 0:R[J],functions:{...$,onChange:U=>{Y({type:"updateValue",payload:{key:J,value:U}}),$.onChange(U&&U.toString(),Y)}}},J)}),y?null:(D||C)&&v?v:a.jsx(et,{className:M("cta",{center:D||C,submitted:C}),buttons:z})]}),d&&C&&a.jsx(gt,{className:"success",children:typeof d=="string"?d:k.formatMessage({id:"form_success"})})]})};const St="passwordRules_",Aa="isMoreThanEightCharacters",Ia="includesNumberAndSymbol",La="includesLowerAndUppercase",Do={[Aa]:"8Characters",[Ia]:"numberSymbol",[La]:"lowercaseUppercase"},Ao=({matchingRules:t={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:e=""})=>{const n=q.useIntl();return a.jsxs("aside",{className:M("password-rules",e),children:[a.jsx("small",{children:n.formatMessage({id:`${St}intro`})}),a.jsx("ul",{children:[Aa,Ia,La].map(r=>a.jsxs("li",{className:M({matches:t[r]}),children:[a.jsxs(ge,{children:[n.formatMessage({id:`${St}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${St}rule_${Do[r]}`})}),!t[r]&&a.jsxs(ge,{element:"strong",children:[" ",n.formatMessage({id:`${St}notMet`})]})]},`rule-${r}`))})]})},Io=g.memo(Ao);const Lo=({text:t={},topRating:e=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:s="",hasLoaded:o=!1})=>{const c=q.useIntl(),[f,u]=g.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(y=>({...y,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(y=>({...y,setUp:!0,disabled:!0})),i(v)}};if(g.useEffect(()=>{o&&!f.setUp&&d()},[o]),!o)return a.jsx(xe,{className:"rating-placeholder"});const{id:l,rating:m,disabled:p}=f,b="ratings_",_={text:c.formatMessage({id:`${b}text`}),low:c.formatMessage({id:`${b}low`}),high:c.formatMessage({id:`${b}high`}),success:c.formatMessage({id:`${b}success`}),...t},x=async v=>{if(!(!l||p))try{u(y=>({...y,rating:v,disabled:!0})),await r({id:l,value:v})}catch(y){u(S=>({...S,rating:null})),i(y)}finally{u(y=>({...y,disabled:!1}))}};return a.jsxs("div",{className:M("rating",s),children:[a.jsx("span",{className:"label",children:_[m?"success":"text"]}),a.jsx("ol",{children:Array.from(new Array(e).keys()).map(v=>{const y=v+1;return a.jsx("li",{className:M({selected:m&&y<=m}),children:a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:`star${!m||y>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${c.formatMessage({id:`${b}stars`},{number:y,total:e})}${y===1||y===e?` - ${_[y===1?"low":"high"]}`:""}`,onClick:S=>{S.preventDefault(),S.stopPropagation(),x(y)},disabled:p})},`rating-${y}`)})})]})};const Bo=({id:t="form-toggle",label:e,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:s=!1,className:o=""})=>{const[c,f]=g.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);g.useEffect(()=>{r&&f(r)},[r]);const u=d=>{s||(f(d),i(d))};return a.jsxs("div",{className:M("toggle",o),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(c===n[0].value?n[1].value:n[0].value)},children:[a.jsx("p",{children:e}),a.jsx("ul",{className:M("toggle-options",{disabled:s,on:c===n[1].value}),children:n.map(d=>{const l=`${t}-${d.value}`;return a.jsxs("li",{className:"hidden",children:[a.jsx("input",{type:"radio",id:l,name:t,value:d.value,checked:c===d.value,onChange:()=>u(d.value),disabled:s}),a.jsx("label",{htmlFor:l,children:d.label})]},l)})})]})};function qo({className:t="",userId:e,userName:n,src:r,setUserImage:i,uploadImage:s}){const[o,c]=g.useState(!1),[f,u]=g.useState(!1),d=g.useRef(null),l=async m=>{c(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!e)throw c(!1),new Error("Image file or userID is missing");const b=await s({fileObject:p,userId:e});i(_=>({..._,image:{thumbnail:b.thumbnailURL,full:b.originalURL}}))}catch{u(!0)}finally{c(!1)}c(!1)};return a.jsxs("div",{className:M("profile-image-change-figure",t),children:[a.jsx(Re,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),f&&a.jsx("p",{className:"error text-small",children:a.jsx(q.FormattedMessage,{id:"profile_image_change_error"})}),a.jsx("input",{id:"file",type:"file",accept:"image/*",ref:d,onChange:l,hidden:!0,"data-testid":"file-input"}),a.jsx(re,{onClick:()=>d.current&&d.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:o,children:a.jsx(q.FormattedMessage,{id:o?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Ba=({gtm:t,functions:{onSuccess:e=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=t||{};return a.jsx(Qt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:i},functions:{onSuccess:e,onFailure:n}})};const qa=({title:t,label:e,ctaMessage:n,titleColor:r,labelColor:i,backgroundColor:s,onClose:o,reportError:c,sendInvites:f,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,l]=g.useState([]),[m,p]=g.useState(!0),[b,_]=g.useState(u),{formatMessage:x}=q.useIntl(),v=async T=>{T.preventDefault();try{await f(d),l([]),_("SUCCESS")}catch(k){_("ERROR"),c(k)}},y=T=>{T.preventDefault(),_("NOT_SUBMITTED"),p(!0),l([])},S=T=>{T.preventDefault(),o(),_("CLOSED")};return b==="CLOSED"?null:b==="ERROR"||b==="SUCCESS"?a.jsxs("div",{className:"invite-form-wrapper",children:[a.jsx("div",{className:"content centred",children:b==="SUCCESS"?a.jsx("h2",{className:"success-title",children:x({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",x({id:"inviteForm_error"})]})}),a.jsx(je,{}),a.jsx("div",{className:"footer",children:b==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"secondary",onClick:y,children:x({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(re,{onClick:S,children:x({id:"inviteForm_ctaDone"})})]}):a.jsx(re,{onClick:y,children:x({id:"inviteForm_ctaTryAgain"})})})]}):a.jsx("div",{className:"invite-form-wrapper",children:a.jsxs("form",{style:{backgroundColor:s},onSubmit:v,className:M("invite-form gtm-trackable"),children:[a.jsxs("fieldset",{className:"content",children:[a.jsx("h2",{className:"title",style:{color:r},children:t}),a.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:e}),a.jsx(Mi.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:x({id:"inviteForm_email_placeholder"}),emails:d,onChange:T=>{l(T),p(!T.length)},autoFocus:!1,getLabel:(T,k,Z)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:T}),a.jsx(re,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{Z(k),p(!d.length)},className:"remove-email-button",screenreaderText:x({id:"overlay_close"})})]},k)})]}),a.jsx(je,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(re,{className:"sendEmailsButton",disabled:m,children:n})})]})})};const Ua=({id:t="search",className:e="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:s="form-submission"})=>{const{searchIsOpen:o=!0,isDesktopVersion:c=!1}=n||{},f=q.useIntl(),u=g.useRef(null);Ke(()=>{!n||c||!o||u.current&&u.current.focus()},[o]);const d=l=>{l.preventDefault(),l.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return a.jsx("form",{onSubmit:d,className:M("search-form gtm-trackable",e),"data-gtm-event-context":i,"data-gtm-event-type":s,children:a.jsx("fieldset",{id:`${t}-form`,hidden:n?!o:!1,role:"search",children:a.jsxs("p",{children:[a.jsx(ge,{element:"label",htmlFor:t,children:f.formatMessage({id:"search_label"})}),a.jsx("input",{ref:u,type:"search",id:t,name:t,defaultValue:r,placeholder:f.formatMessage({id:"search_placeholder"}),onKeyDown:l=>{l.key==="Enter"&&d(l)}}),a.jsx("button",{className:"clear",onClick:l=>{l.preventDefault(),l.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:a.jsx(ge,{children:f.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:d,children:a.jsx(ge,{children:f.formatMessage({id:"search_cta"})})})]})})})},Ar=async({ref:t,validateEmail:e,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!t.current.validity.valid||!r.test(t.current.value))return n([{type:"validFields.email",value:!1}]);const i=t.current.value.toString().toLowerCase().trim(),s={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let o=Object.assign({},s);try{o=await e(i),o===void 0&&(o=s)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:c=!1,autoApproved:f=!1,exists:u}=o;let d="";return c?d=f?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldManuallyApprove",value:!f},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},Uo=t=>{const e={};for(const n of t.entries())e[n[0]]=n[1];return{name:e.full_name,email:e.email_address.toString().toLowerCase().trim(),jobTitle:e.job_title,organization:e.organization,bioLink:e.url,optIn:!0,expectation:e.expectation,page:window.location.pathname,"g-recaptcha-response":e["g-recaptcha-response"]}},zo=async({refs:t,dataToSubmit:e,createAccount:n,onSuccess:r,dispatch:i,state:s})=>{if(!t.form||!t.form.current)throw new Error("No refs.form");if(!t.form.current.checkValidity()){t.hiddenValidation&&t.hiddenValidation.current&&t.hiddenValidation.current.click();return}const o=Uo(new FormData(t.form.current)),c=Object.assign(o,e);await n(c),localStorage.setItem("email",o.email),r&&r({...o,...s.values}),i([{type:"showSuccessMessage",value:!0}])},Zo=({shouldShow:t,functions:{validateEmail:e,resendVerificationCode:n},refs:r,state:i,dispatch:s,dataToSubmit:o,intl:c})=>{const{emailDetails:f}=i,u=(l,m)=>{l.current&&i.validFields[m]!==l.current.validity.valid&&s([{type:`validFields.${m}`,value:l.current.validity.valid}])},d=[{id:"full_name",type:"text",inputRef:r.name,placeholder:c.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>u(r.name,"name"),onFocus:()=>s([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:r.email,placeholder:c.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Ar({ref:r.email,validateEmail:e,dispatch:s})},onChange:(l,m)=>{m&&m({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>s([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Oa,props:{email:f.email,type:f.boxType,resendVerificationCode:n}}];return i.shouldManuallyApprove&&(d.push({id:"job_title",type:"text",inputRef:r.jobTitle,placeholder:c.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>u(r.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:r.organisation,placeholder:c.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{u(r.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),t.url&&d.push({id:"url",type:"text",label:c.formatMessage({id:"signup_url"},{small:l=>a.jsx("small",{children:l})}),placeholder:c.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),t.expectation&&d.push({id:"expectation",className:"expectation",type:"text",label:c.formatMessage({id:"signup_expectation"},{small:l=>a.jsx("small",{className:"notes text-small",children:l})}),placeholder:c.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),d.push({id:"terms",className:"text-small",type:"checkbox",inputRef:r.tc,label:c.formatMessage({id:"signup_terms"},{terms:l=>a.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:l}),privacy:l=>a.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:l})}),shownValue:"accepted",functions:{onChange:l=>{if(!l)return;const m=[];["name","email"].forEach(p=>{i.validFields[p]!==r[p].current.validity.valid&&(m.push({type:`validFields.${p}`,value:r[p].current.validity.valid}),p==="email"&&Ar({ref:r.email,validateEmail:e,dispatch:s}))}),m.length&&s(m)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),d};const Wo=({className:t=""})=>a.jsxs("div",{className:M("success-message",t),"data-testid":"success-message",children:[a.jsx("p",{className:"success-title",children:a.jsx(q.FormattedMessage,{id:"signup_success_title"})}),a.jsx(q.FormattedMessage,{id:"signup_success_text",values:{p:e=>a.jsx("p",{children:e})}})]});const Ho={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Vo=({className:t="",functions:e={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:n={title:!0,expectation:!1,url:!0,logInButton:!0,successMessage:!0},submitButton:r,dataToSubmit:i={ref:"sign-up-form"},...s})=>{const o=q.useIntl(),[c,f]=g.useReducer(ra,Ho),{validFields:u,emailDetails:d,shouldManuallyApprove:l,showSuccessMessage:m,showError:p}=c,[b,_]=Ln.useCookies(["signup-this-session","functional-cookie-consent"]),x={form:g.createRef(),name:g.createRef(),email:g.createRef(),jobTitle:g.createRef(),organisation:g.createRef(),tc:g.createRef(),hiddenValidation:g.createRef()};g.useEffect(()=>{l===!0&&x.jobTitle.current&&x.jobTitle.current.focus()},[l]),g.useEffect(()=>{(s.showSuccessMessage||b["signup-this-session"])&&f([{type:"showSuccessMessage",value:!0}])},[b]),g.useEffect(()=>{if(m&&b["functional-cookie-consent"]){const S={path:"/",maxAge:3600};s.showSuccessMessage||_("signup-this-session","true",S)}},[m]);const v=g.useMemo(()=>Zo({shouldShow:n,functions:e,refs:x,state:c,dispatch:f,dataToSubmit:i,intl:o}),[i,e,o,x,n,c]),y=l?!Object.values(u).every(S=>S===!0):!u.name||!u.email||["exists","pending","verify"].includes(d.boxType);return n.successMessage&&m?a.jsx(Wo,{className:t}):a.jsxs("fieldset",{className:M("signup-form-fieldset",t),"data-testid":"signup-form",children:[n.title&&a.jsx("p",{className:"signup-title",children:a.jsx(q.FormattedMessage,{id:"signup_title"})}),p&&a.jsx(Be,{variant:"error",text:o.formatMessage({id:"signup_error"})}),a.jsx(Qt,{className:"signup-form",formRef:x.form,id:"sign-up-form",fields:v,intlPath:"signup",button:{variant:"primary",size:"medium",text:r||o.formatMessage({id:"signup_button_join"}),disabled:y?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},meta:{shouldReset:!1,showRequiredLabels:!1},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{zo({refs:x,dataToSubmit:i,createAccount:e.createAccount,onSuccess:e.onSuccess,dispatch:f,state:c})},onCatch:S=>{e.handleError(S),f([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),a.jsx("button",{className:"validation-button",ref:x.hiddenValidation}),n.logInButton&&a.jsx(re,{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",children:o.formatMessage({id:"signup_button_login"})})]})};const Yo=({className:t,showModal:e=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:i="Invite your colleagues by typing or pasting their emails below.",ctaMessage:s="Send",showIcon:o,onClose:c,reportError:f=()=>{},sendInvites:u})=>a.jsx(bt,{title:n,isOpen:e,showDivider:!1,showIcon:o,functions:{onClose:c},className:M("invite-modal",t,{success:!!n}),children:a.jsx(qa,{title:r,label:i,ctaMessage:s,onClose:c,sendInvites:u,reportError:f})});const Ko=({members:t})=>{const[e,n]=g.useState(!1),r=i=>{const{fullName:s,jobTitle:o,organisation:c,photo:f}=i||{};return a.jsxs(a.Fragment,{children:[a.jsx(Re,{name:s,src:f}),a.jsx("p",{children:s}),a.jsx("small",{className:"text-medium",children:c?`${o}, ${c}`:o})]})};return a.jsxs("div",{className:"directory-wrapper",children:[a.jsx("ul",{className:"directory",children:t.map(i=>a.jsx("li",{children:a.jsx("button",{onClick:s=>{s.preventDefault(),s.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),a.jsx(bt,{isOpen:e!==!1,children:e===!1?"":a.jsxs(a.Fragment,{children:[r(e),a.jsx(ht,{children:e.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})},Go=({type:t,data:e})=>{const n=q.useIntl(),{answers:r,createdAt:i,dateHasPassed:s,isOngoingEvent:o,pill:c,readingTime:f,publishedDate:u,startDate:d}=e;if(t==="question"){const l=i&&Rn(i);return a.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&a.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:l?n.formatMessage({id:`dates_${l.path}`},{number:l.number}):0})]})]})}if(d&&!s||o)return a.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):oa(d)});if(c)return a.jsx(Ve,{variant:c==="free"?"subtle":"highlighted",className:c,"data-testid":"course-type",children:c});if(f||u){const l=u&&Rn(u);return a.jsxs("ul",{className:"details",children:[f&&a.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:f})}),u&&a.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:l?n.formatMessage({id:`dates_${l.path}`},{number:l.number}):0})})]})}return null},Ut={communityPage:{basePath:"/communities/",className:"community",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"},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"}},Qo=({data:t,cta:e,link:n,gtmContext:r})=>{var b;const i=q.useIntl(),[s,o]=g.useState({loading:!1,registered:t.registered||!1});g.useEffect(()=>{t.registered&&o(_=>({..._,registered:!0}))},[t.registered]);const{startDate:c,dateHasPassed:f,pill:u,slug:d}=t,l=t.contentType;let m="";if((b=Ut[l])!=null&&b.gtmEvent&&(m=Ut[l].gtmEvent),c&&f)return a.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:i.formatMessage({id:"card_watch"})});if(l==="people")return a.jsx(re,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:i.formatMessage({id:"card_cta_people"})});const p=["microcourse","event"];if(e&&e.onClick&&p.includes(l)&&u!=="premium"){const _=s.loading||s.registered,x=async v=>{if(v.preventDefault(),v.stopPropagation(),!(_||!e||!e.onClick)){o(y=>({...y,loading:!0}));try{const y=await e.onClick(t);o(y==="success"?()=>({registered:!0,loading:!1}):S=>({...S,loading:!1}))}catch{o(S=>({...S,loading:!1}))}}};return a.jsx(re,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:_,"data-gtm-event-context":`${r}Page-${l}: ${d}`,"data-gtm-event-type":`${r}-${l}-register-click`,"data-testid":"in-card-button",children:i.formatMessage({id:`card_cta_${l}${_?`_${s.loading?"loading":"done"}`:""}`})})}return null},Ir={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Jo=t=>{let e=t;return Object.keys(Ir).includes(t)&&(e=Ir[t]),`url(${Ae}icons/${e}.svg)`};const Xo={title:66,text:3e3,secondaryText:1e3,partner:25},Yn=({id:t="",card:e,buildCardData:n,cta:r,gtmContext:i="Carousel",className:s=""})=>{var Y;const o=q.useIntl(),c=g.useContext(Te),f=c&&typeof c.id=="string",[u,d]=g.useState({data:null,isLoading:!0}),{data:l,isLoading:m}=u,p=g.useCallback(()=>{n(e,f).then(R=>{d(()=>({data:R,isLoading:!1}))}).catch(()=>d(R=>({...R,isLoading:!1})))},[t]);if(g.useEffect(()=>{p()},[]),m||!l)return a.jsx(xe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:b}=l;if(!b||!Ut[b])return a.jsx(xe,{element:"li",className:"card-wrapper"});const{basePath:_="",className:x,length:v,gtmEvent:y}=Ut[b],S=ca(`card_label_${b}`)?o.formatMessage({id:`card_label_${b}`}):!1,T=l.slug?`${_}${l.slug}`:!1,k={...Xo,...v};let Z={className:"card"};T&&(Z={href:T,className:"card gtm-trackable","data-gtm-event-context":`${i}-CarouselCard`,"data-gtm-event-type":`${y}-click`,"data-testid":"link"},l.openInNewTab&&(Z.target="_blank"));const O=l.customIcon?{"--custom-icon":Jo(l.customIcon)}:{};return a.jsx("li",{className:M("card-wrapper text-medium",x,s,{"has-link":T,"no-link":!T,"has-custom-icon":l.customIcon,"has-image":l.banner}),style:O,"data-testid":`${b}-card`,children:g.createElement(T?"a":"div",Z,a.jsxs(a.Fragment,{children:[(l.customLabel||S)&&a.jsx("small",{className:M("card-label text-small",x),children:l.customLabel||S}),l.startDate&&!l.isOngoingEvent&&a.jsx(Ve,{size:"small",variant:l.dateHasPassed?"default":"information","data-testid":"date",children:l.dateHasPassed?o.formatMessage({id:"card_ended"}):qi(l.startDate)}),l.banner?a.jsxs("p",{className:"img",children:[l.registered&&a.jsx(Ve,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),a.jsx(tt,{image:l.banner})]}):x==="people"?a.jsx(Re,{name:l.title||"",src:l.profile,"data-testid":"people-profile-picture"}):null,l.contributors&&a.jsx(Zn,{contributors:{data:l.contributors},styling:{size:"small",showGap:x!=="question",showText:!0},"data-testid":"contributors"}),l.partner&&a.jsx("p",{className:"partners","data-testid":"partners",children:Ye(l.partner.title,k.partner)}),["title","text","secondaryText"].map(R=>{const D=l[R];if(!D)return null;const C=Li(R);return a.jsx("p",{className:C,"data-testid":C,children:Ye(D,k[R])},R)}),(l==null?void 0:l.members)&&a.jsxs("span",{className:"member-information",children:[((Y=l==null?void 0:l.members)==null?void 0:Y.isMember)&&a.jsx(Ve,{size:"small",variant:"registered",children:"Member"}),a.jsx("br",{}),a.jsx("span",{className:"label",children:`${l==null?void 0:l.members.count} Members`})]}),a.jsx(Go,{type:x||"",data:l}),a.jsx(Qo,{data:l,cta:r,link:T||"",gtmContext:i})]}))})};const za=({cards:t,cardTypes:e,className:n="",...r})=>a.jsx("ul",{className:M("card-block",n),children:t.map((i,s)=>{const o=i.slug?`${i.slug}-${e[s]}`:`${e[s]}-${s}`;return a.jsx(Yn,{id:o,card:{...i,contentType:e[s]},...r},o)})}),ec=(t,e,n,r)=>{const i=e*n<=t,s=t<e*(n+1),o=r.includes(Math.floor(t/e));return i&&s||o},tc=({id:t,title:e})=>{const n=q.useIntl();if(!e||!e.text)return null;const{text:r,element:i="h2",variant:s="default",size:o="medium",link:c}=e;return g.createElement(i,{className:M("title",s,o,{"highlighted-title":s==="highlighted"}),children:a.jsxs(a.Fragment,{children:[r,c&&a.jsx("a",{href:c,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${t||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const vn={fourCards:1024,threeCards:769,twoCards:480};let Ct=null;const nc=({id:t,cards:e,cardTypes:n,buildCardData:r,title:i,className:s,gtmContext:o})=>{const c=q.useIntl(),[f,u]=g.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:d,isLoading:l}=f,[m,p]=g.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:_}=m,x=e.length,v=Math.ceil(x/d),y=g.useRef(null),S=Xe(!0,!0,y==null?void 0:y.current);g.useEffect(()=>{let R=1;S&&(S>=vn.fourCards?R=4:S>=vn.threeCards?R=3:S>=vn.twoCards&&(R=2),R>x&&(R=x)),u(D=>({...D,cardsPerPage:R,isLoading:!1}))},[S,x]);const T=(R="next")=>{let D=b;if(typeof R=="string")if(R==="next")if(b<v-1)D=b+1;else return;else if(b>0)D=b-1;else return;else D=R;p(C=>({...C,currentPage:D,loadedPages:[...new Set([..._,D])]}))},k=R=>{Ct=R.touches[0].clientX},Z=R=>{if(Ct===null)return;const D=R.touches[0].clientX,C=Ct-D;C>5?T("next"):C<-5&&T("previous"),Ct=null},O={"--width":`${S||0}px`,"--total-cards":x,"--cards-per-page":d,"--page":b};if(l)return a.jsx(Un,{layout:`carousel${i?"-with-title":""}`});const Y=(R,D)=>{var E;let C=null;return(E=R==null?void 0:R.sys)!=null&&E.id?C=`card-${R.sys.id}`:R!=null&&R.slug?C=`card-${R.slug}`:[n[D],R.contentType].includes("customCard")&&(C=`card-${window.btoa(`${R.title} ${R.createdAt}`)}-${D}`),C};return a.jsxs("section",{ref:y,className:M("carousel-wrapper",s),"data-testid":"carousel",children:[a.jsx(tc,{id:t,title:i}),a.jsx("ul",{className:"carousel",onTouchStart:k,onTouchMove:Z,style:O,"data-testid":"carousel-list",children:e.map((R,D)=>{let C=Y(R,D);return C&&ec(D,d,b,_)?a.jsx(Yn,{id:C,card:{...R,contentType:n[D]},buildCardData:r,gtmContext:o},C):(C=C||`${t}-card-${D}`,a.jsx(xe,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},C))})}),v<=1?null:a.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[a.jsx("li",{className:"arrow previous",children:a.jsx(re,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:R=>{R.preventDefault(),R.stopPropagation(),T("previous")},screenreaderText:c.formatMessage({id:"carousel_pagination_previous"}),disabled:b<=0})}),[...Array(v)].map((R,D)=>a.jsx("li",{"data-testid":"carousel-controls-button",children:a.jsx("button",{className:M("page-indicator",{selected:D===b}),onClick:C=>{C.preventDefault(),C.stopPropagation(),T(D)},children:a.jsx(ge,{showOnFocus:!1,children:c.formatMessage({id:"carousel_pagination_page"},{number:D+1,total:v})})})},`page-indicator-${D}`)),a.jsx("li",{className:"arrow next",children:a.jsx(re,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:R=>{R.preventDefault(),R.stopPropagation(),T("next")},screenreaderText:c.formatMessage({id:"carousel_pagination_next"}),disabled:b>=v-1})})]})]})},rc=({carousels:t=[],isLoading:e,title:n,className:r="",...i})=>!t||!t.length?null:t.map(({title:s,viewAllUrl:o,cards:c,cardsTypes:f},u)=>{const d=s?window.btoa(s):`carousel-${u}`,l=u===t.length-1;return e?a.jsxs(g.Fragment,{children:[a.jsx(Un,{layout:`carousel${s?"-with-title":""}`,"data-testid":"carousel-placeholder"}),l?null:a.jsx(je,{})]},`placeholder-${d}`):a.jsxs(g.Fragment,{children:[a.jsx(nc,{cards:c,cardTypes:f,title:{...n,text:s,link:o},...i}),l?null:a.jsx(je,{})]},`carousel-${d}`)});const bn="joinCommunityButton",Kn=({isMember:t=!1,isShort:e=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const i=q.useIntl(),s=g.useContext(Te),o=s&&typeof s.id=="string",[c,f]=g.useState(t),[u,d]=g.useState(t?"joined":"notJoined");g.useEffect(()=>{u==="joining"?d("joined"):u==="leaving"&&d("notJoined")},[c]);const l={},m={};return c&&u!=="leaving"&&(l["data-hover-text"]=i.formatMessage({id:`${bn}_leave`}),l["aria-label"]=i.formatMessage({id:`${bn}_member_aria`}),m["aria-hidden"]="true"),a.jsx(re,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&u!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{o&&(p.currentTarget.blur(),c?(d("leaving"),typeof r=="function"&&await r()):(d("joining"),typeof n=="function"&&await n()),f(!c))},className:M("join-community-button",u,{active:u==="joining"}),disabled:!o,...l,children:a.jsx("span",{className:"text",...m,children:i.formatMessage({id:`${bn}${["joining","leaving"].includes(u)?`_${u}`:c?"_member":e?"_short":""}`})})})};const yn="communityDetails_",ac=({className:t="",isMember:e=!1,slug:n,members:{number:r=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const c=q.useIntl(),f=5,u=r||i.length,d=i.length?i:Array(f).fill({}),l=`/communities/${n}/members`===window.location.pathname;return a.jsxs("div",{className:M("community-details",t),children:[a.jsx(je,{}),a.jsxs("div",{className:"member-details",children:[a.jsxs("div",{className:"top",children:[a.jsxs("h4",{children:[c.formatMessage({id:`${yn}members`}),a.jsx("span",{className:"count",children:u})]}),!l&&a.jsx("p",{className:"text-small",children:a.jsx("a",{href:`/communities/${n}/members`,children:c.formatMessage({id:`${yn}viewAll`})})})]}),a.jsx(Zn,{contributors:{total:r,data:d},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:f})]}),a.jsx(Kn,{isMember:e,functions:{...o}}),e&&a.jsx(re,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:c.formatMessage({id:`${yn}invite`})})]})};const ic=({breadcrumbs:t,cutoff:e=20,className:n=""})=>{const r=q.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(ge,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),a.jsx("ul",{className:M("breadcrumbs text-small",n),children:t.map(({text:i,href:s,current:o=!1},c)=>a.jsxs("li",{children:[o&&a.jsx(ge,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),a.jsx(nt,{href:o?void 0:s,children:Ye(i,e)})]},`${window.btoa(i)}_${c}`))})]})};const sc=({options:t,allOption:e=!1,allowMultiple:n=!0,onChange:r=()=>{},className:i=""})=>{const s=q.useIntl(),o=e?[{id:"all",text:typeof e!="boolean"&&e.text||s.formatMessage({id:"filters_all"})},...t]:t,[c,f]=g.useState(e?["all"]:[]),u=(d,l)=>{let m=[];c.includes(d)?m=c.filter(p=>p!==d):d==="all"?m=["all"]:n?m=[...c.filter(p=>p!=="all"),d]:m=[d],f(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),l&&typeof l=="function"&&l()};return a.jsx("ul",{className:M("filters",i),children:o.map(({id:d,text:l,disabled:m=!1,callback:p=()=>{}})=>{let b={};return m&&(b={disabled:!0,"aria-label":s.formatMessage({id:"filters_disabled"},{name:l})}),a.jsx("li",{children:a.jsx("button",{className:M(d,{selected:c.includes(d)}),onClick:_=>{_.preventDefault(),_.stopPropagation(),u(d,p)},...b,children:l})},d)})})},oc=(t,e)=>{const n=String(t);if(!e||!e.length)return`/${n}`;let r="";return e.forEach(({url:i,position:s})=>{s==="before-lang"?r+=`/${i}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${i}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const _n={en:"English",es:"Español",fr:"Français",pt:"Português"},Mt="languageSwitcher_",cc=({currentLanguage:t,isOriginalLanguage:e=!1,isHumanTranslation:n=!1,translations:r,onChange:i=()=>{},urlParts:s,variant:o="default",label:c,className:f=""})=>{const u=q.useIntl(),[d,l]=g.useState(t);if(g.useEffect(()=>{t!==d&&l(t)},[t]),!r||!Object.values(r).some(_=>_&&_.post_name))return null;const p=Object.keys(r),b=d!==t;return a.jsxs("div",{className:M("language-switcher text-small",o,f),children:[a.jsxs("nav",{children:[o!=="short"&&a.jsx("p",{children:c||u.formatMessage({id:`${Mt}label`})}),a.jsx("ul",{children:p.map(_=>{if(!_n[_])return null;let x={className:_};return d===_?x["aria-label"]=u.formatMessage({id:`${Mt}selected`},{language:_n[_]}):x={...x,href:oc(_,s),onClick:v=>{v.preventDefault(),v.stopPropagation(),l(_),i(_)}},a.jsx("li",{children:a.jsx(nt,{...x,fallbackElement:"span",children:_n[_]})},_)})}),o!=="short"&&!b&&a.jsx("p",{children:u.formatMessage({id:`${Mt}translation_${e?"original":n?"human":"machine"}`})})]}),o!=="short"&&!b&&!e&&!n&&a.jsx("small",{children:u.formatMessage({id:`${Mt}disclaimer`},{email:We.support,link:_=>{const x=`mailto:${_}`;return a.jsx("a",{href:x,children:_})}})})]})};const xn=q.createIntl({locale:"en",messages:Bn}),yt=({hasNextPage:t=!0,loadNextPage:e=()=>{},variant:n="secondary",size:r="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:xn.formatMessage({id:"loadMore_button"}),endOfFeed:xn.formatMessage({id:"loadMore_endOfFeed"}),error:xn.formatMessage({id:"loadMore_error"})},className:c="",gtmContext:f="LoadMore"})=>{const[u,d]=g.useState(""),l=async m=>{try{await e(m)}catch(p){p instanceof Error?d(p.message):d("Unknown error")}};return!u&&!t&&!o.endOfFeed?null:a.jsx("footer",{className:M("load-more",c),children:!u&&t?a.jsx(re,{variant:n,size:r,styling:i,icon:s,onClick:l,"data-gtm-event-context":f,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!u||u!=null&&u.includes("Cannot read items"))?a.jsx("p",{children:o.endOfFeed}):u&&a.jsx("p",{className:"error",children:o.error})})};const Gn=({variant:t="default",version:e="default",className:n="",...r})=>a.jsx("p",{className:"logo-wrapper",children:a.jsx("a",{href:"/home/",className:M("logo",t,e,n),...r,children:a.jsx(ge,{children:a.jsx(q.FormattedMessage,{id:"apolitical"})})})});let Nt=!1;const Za=({element:t="div",id:e="more-menu",options:n,className:r=""})=>{const i=q.useIntl(),s=g.useRef(null),[o,c]=g.useState(!1),f=u=>{s.current&&u.target instanceof HTMLElement&&!s.current.contains(u.target)&&c(!1)};return g.useEffect(()=>(document.addEventListener("click",f,!0),()=>{document.removeEventListener("click",f,!0)})),g.createElement(t,{ref:s,className:M("more-menu text-medium",r),children:a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>c(!o),"aria-haspopup":"true","aria-expanded":o,"aria-controls":e,screenreaderText:i.formatMessage({id:"moreMenu"})}),a.jsx("ul",{id:e,hidden:!o,children:n.map(({href:u,onClick:d,text:l,icon:m,...p},b)=>{const _={...p,onClick:x=>{c(!1),typeof d=="function"&&d(x)},onFocus:()=>{Nt&&(clearTimeout(Nt),Nt=!1)},onBlur:()=>{Nt=setTimeout(()=>{c(!1)},100)}};return u&&(_.href=u),a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,..._,children:l})},`${window.btoa(l)}_${b}`)})})]})})},lc=(t,e=!1)=>e?t.replaceAll("/","")===e:typeof window<"u"&&window.location&&window.location.pathname===t;const uc=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Wa=({activeLink:t})=>{const e=q.useIntl(),n=g.useContext(Te),r=n&&typeof n.id=="string";return a.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[uc.map(({key:i,href:s})=>a.jsx("li",{className:M(i,{active:lc(s,t)}),children:a.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:e.formatMessage({id:`navigationMenu_links_${i}`})})},i)),r&&a.jsx("li",{className:"profile","data-testid":"profile-link",children:a.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[a.jsx(Re,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),a.jsx("span",{children:e.formatMessage({id:"navigationMenu_profile"})})]})})]})},lt=(t,e,n)=>`${t}?share=${e}${n?`&uuid=${n}`:""}`,dc=({title:t,link:e,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${lt(e,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(t)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${lt(e,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(t)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${lt(e,"facebook",n)}`)}&t=${t}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(`${t}
|
|
63
63
|
|
|
64
|
-
${lt(e,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:lt(e,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const fc="shareLinks_",mc=({title:t,link:e,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:s="default",className:o=""})=>{const c=q.useIntl(),f=dc({title:t,link:e,referrer:n});return a.jsxs("aside",{className:M("share-links",i,s,o),children:[a.jsx("p",{className:"text-small",children:c.formatMessage({id:"shareLinks_label"})}),a.jsx("ul",{children:f.map(({key:u,icon:d,url:l,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const b={};return p&&(b.onClick=_=>p(_,l)),a.jsx("li",{children:a.jsx(re,{size:i,variant:"tertiary",icon:{icon:d||u},href:l,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:c.formatMessage({id:`${fc}link_${u}`}),...b})},u)})})]})};const pc=({tabs:t,className:e="",preventLocationChange:n})=>{var u;const r=(d,l,m)=>(d||(d=`panel-${window.btoa(l)}-${m}`),d);let i=t.findIndex(d=>d.current===!0);if(i<0&&(i=0),window.location.hash){const d=window.location.hash.replace("#","");if(t.find(m=>m.id===d)){for(let m=0;m<t.length;m++)if(r(t[m].id,t[m].text,m)===d){i=m;break}}}const[s,o]=g.useState((u=t[i])!=null&&u.id?t[i].id:r(t[i].id,t[i].text,i));g.useEffect(()=>{if(t[i].hasCarousel){const d=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(d)}},[s]);const c=[],f=[];return t.forEach(({id:d,text:l,content:m,href:p,hasCarousel:b},_)=>{d=r(d,l,_);const x=s===d,v={};p||(v["aria-controls"]=d,v.onClick=y=>{y.preventDefault(),y.stopPropagation(),o(d),!n&&(window.location.hash=`#${d}`)},f.push(a.jsx("section",{id:d,hidden:!x,role:"tabpanel","aria-labelledby":`tab-${d}`,"aria-live":x?"assertive":"off",children:typeof m=="string"?a.jsx("p",{children:m}):m},`section-${d}`))),c.push(a.jsx("li",{"data-testid":"navigation-tab",children:a.jsx("a",{href:p||`#${d}`,id:`tab-${d}`,className:M({selected:x}),role:"tab","aria-selected":x,...v,children:l})},`tab-${d}`))}),a.jsxs("div",{className:M("tabs-wrapper",e),children:[a.jsx("ul",{className:"tabs",role:"tablist",children:c}),a.jsx("div",{className:"tab-content",children:f})]})};const hc={"2-1":901,"1-3":769,"1-1":769},Ha=({layout:t="2-1",hideOnMobile:e=!1,className:n="",children:r})=>{const i=Xe(!0);let s=r;return g.Children.count(r)===1&&(s=g.Children.toArray(r)[0],s.props&&(s=s.props.children)),a.jsx("section",{className:M("columns",`layout-${t}`,n),children:g.Children.map(s,(o,c)=>e!==!1&&c===e&&i&&i<hc[t]?null:o)})};let wn;const kn="contactFooter_",gc=({onSuccess:t=async()=>{},onFailure:e=()=>{}})=>{const n=g.useRef(null),[r,i]=g.useState(0),[s,o]=g.useState(!1),c=()=>{n.current&&i(n.current.clientHeight)},f=()=>{s||(o(!0),clearTimeout(wn),wn=setTimeout(()=>{c(),o(!1)},500))};return g.useEffect(()=>(c(),window.addEventListener("resize",f),()=>{clearTimeout(wn),window.removeEventListener("resize",f)}),[]),a.jsx(Le,{id:"contactForm",className:"contact-footer",children:a.jsxs("div",{className:"inner-wrapper",children:[a.jsx("h2",{children:a.jsx(q.FormattedMessage,{id:`${kn}title`})}),a.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:s?{}:{minHeight:r},children:[a.jsxs("aside",{children:[a.jsx("p",{children:a.jsx(q.FormattedMessage,{id:`${kn}text`})}),a.jsx(nt,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:a.jsx(q.FormattedMessage,{id:`${kn}email`})})]}),a.jsx(Ba,{functions:{onSuccess:t,onFailure:e},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},vc=({activeLink:t,...e})=>a.jsx(Le,{children:a.jsx(Ha,{layout:"1-3",children:a.jsxs(a.Fragment,{children:[a.jsx(Wa,{activeLink:t}),a.jsx(ya,{...e})]})})});const jn="cookieBanner_",Tn=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],En=new Date(Date.now()+12*30*24*60*60*1e3),Va=()=>{const t=q.useIntl(),[e,n,r]=Ln.useCookies(Tn),[i,s]=g.useState(!e["apol-cookie-banner"]),o=()=>{Tn.forEach(d=>{n(d,!0,{path:"/",expires:En,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),s(!1),window.location.reload()},c=()=>{n("apol-cookie-banner",!0,{path:"/",expires:En}),Tn.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:En});return}r(d)}),s(!1)};if(!i)return null;const f=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:c,gtmType:"reject-all"},{id:"accept",onClick:o,gtmType:"accepted-all"}],u=[];return f.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:t.formatMessage({id:`${jn}buttons_${d.id}`})})}),a.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[a.jsx("h6",{children:t.formatMessage({id:`${jn}title`})}),a.jsx("p",{children:t.formatMessage({id:`${jn}text`})}),a.jsx(et,{buttons:u})]})},Me={platform:{order:["events","courses","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:We["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:We["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:We.support,gtmType:"concierge-email-click"},business:{email:We.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const He="footer_",zt="SiteFooter",Lr=({group:t})=>{const e=Me[t].order||[];let n=!1;return"text"in Me[t]&&(n=Me[t].text),a.jsxs(g.Fragment,{children:[a.jsx("p",{className:"pre-title",children:a.jsx(q.FormattedMessage,{id:`${He}${t}`})}),Array.isArray(e)&&e.length>0&&a.jsx("ul",{className:"text-medium",children:e.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:s}=Me[t][r],o={};return["legal"].includes(t)&&(o.target="_blank",o.rel="noopener"),a.jsx("li",{children:a.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":s,...o,children:a.jsx(q.FormattedMessage,{id:`${He}${t}_${r}`})})},`${t}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&a.jsx("dl",{className:"text-medium",children:n.order.map(r=>a.jsxs(g.Fragment,{children:[a.jsx("dt",{children:a.jsx(q.FormattedMessage,{id:`${He}${t}_${r}`})}),a.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&a.jsx("address",{children:a.jsx(q.FormattedMessage,{id:`${He}${t}_${r}_address`,values:{br:a.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&a.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${t}-${r}`))})]},t)},Qn=()=>a.jsx("div",{id:"footer",children:a.jsxs("div",{className:"wrapper",children:[a.jsx(Yt,{element:"hr"}),a.jsx(Gn,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":"logo-homepage-link"}),a.jsx("footer",{children:["platform","community","company","contact"].map(t=>a.jsxs("div",{className:"group",children:[a.jsx(Lr,{group:t}),Object.keys(Me[t]).includes("child")&&a.jsx(Lr,{group:Me[t].child})]},t))}),a.jsx("hr",{}),a.jsxs("div",{className:"sub-footer",children:[a.jsx("ul",{children:Array.isArray(Me.social.order)&&Me.social.order.map(t=>{const e=Me.social[t];return a.jsx("li",{className:t,children:a.jsx("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":"social-click",children:a.jsx("span",{className:"hidden",children:a.jsx(q.FormattedMessage,{id:`${He}social_${t}`})})})},t)})}),a.jsx("small",{children:a.jsx(q.FormattedMessage,{id:`${He}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),ue={timeouts:{},handlerCalled:{},getIsDesktopVersion:(t,e)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=s=>{const o=`logged${t?"In":"Out"}`;return e>=n[s][o]};let i={};return["navigation","search"].forEach(s=>{i[s]=r(s)}),i},shouldChangeHeaderIsVisible:(t,e,n)=>{Object.values(e).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:t}])},handleMenus:({id:t,value:e,menus:n,dispatch:r})=>{if(n[t]===e||t==="account"&&e===!1&&n.navigation===!0)return;const i=Date.now();if(!e&&ue.handlerCalled[t]&&i-ue.handlerCalled[t]<500)return;ue.handlerCalled[t]=i;let s=[{type:`menus.${t}`,value:e}];e===!0&&Object.keys(n).forEach(o=>{o===t||n[o]===!1||s.push({type:`menus.${o}`,value:!1})}),r(s)},findFirstChild:(t,e,n=!1)=>{if(!t||!t[0])return!1;for(let r=0;r<=t.length;r++){if(!t[r])continue;if(t[r][e]&&(!n||t[r][e].includes(n)))return t[r];if(!e.includes("."))continue;const i=Kr(t[r],e);if(!(typeof i>"u")&&(!n||i[e]&&i[e].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return t[r]}return t[0].children?ue.findFirstChild(t[0].children,e,n):!1},autoFocus:({menu:t,navigationRef:e,isDesktopVersion:n,focusElements:r,dispatch:i})=>{if(!e.current||!e.current.children)return;const s=n?"desktop":"default";if(r[t][s]){r[t][s].focus();return}let o,c;switch(t){case"navigation":if(n){const f=ue.findFirstChild(e.current.children,"attributes.aria-controls","navigation");o=ue.findFirstChild(f.children,"href")}else o=ue.findFirstChild(e.current.children,"href");o||(o=e.current);break;case"account":if(c=ue.findFirstChild(e.current.children,"className","account"),!c||!c.children)return;o=ue.findFirstChild(c.children,"href");break;default:return}o&&(i([{type:`focusElements.${t}.${s}`,value:o}]),o.focus())},events:{onClick:(t,{id:e,callback:n,isOpen:r})=>{t.target&&t.target.attributes&&t.target.attributes.href||(t.preventDefault(),t.stopPropagation(),clearTimeout(ue.timeouts[e]),n(e,!r))},onFocus:({id:t})=>{clearTimeout(ue.timeouts[t])},onMouseEnter:({id:t,callback:e})=>{clearTimeout(ue.timeouts[t]),e(t,!0)},onBlur:({id:t,callback:e})=>{ue.timeouts[t]=setTimeout(()=>{e(t,!1)},250)}}},vt={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles"],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"}},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:{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:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Zt=({id:t,isLoggedIn:e=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:s=null})=>{const o=q.useIntl(),c=Kr(vt,t);if(!c||c.onlyShow&&(c.onlyShow==="logged-in"&&!e||c.onlyShow==="logged-out"&&e))return null;const f="doTrack"in c,u=s===null?f?c.doTrack:!0:s,d=t.includes("buttons.");let l=`header_${t.replaceAll(".","_")}`;c.hasVariantText&&(l+=`_logged${e?"In":"Out"}`);let m=!1;if(c.href){let y=c.gtmType||`${t}-click`;if(y.includes(".")){const S=y.split("."),T=S[S.length-2];y=`${T==="topics"?`${T}-`:""}${S[S.length-1]}`}m={href:c.href,role:"menuitem"},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":y,"data-gtm-event-context":"HeaderButtons"}),d&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...c.props||{}})}const p=c.order&&c.order[0]&&c[c.order[0]],b=p&&c[c.order[0]].order,_=m&&window.location.pathname===c.href;let x={},v={};if(p){const y=c.menuId||t,S={onClick:T=>ue.events.onClick(T,{id:y,callback:i,isOpen:r[y]}),onFocus:()=>ue.events.onFocus({id:y}),onBlur:()=>ue.events.onBlur({id:y,callback:i}),onMouseLeave:()=>ue.events.onBlur({id:y,callback:i}),onMouseEnter:()=>ue.events.onMouseEnter({id:y,callback:i})};n&&(b&&(x={...S,onKeyPress:T=>{T.key==="Enter"&&ue.events.onClick(T,{id:y,callback:i,isOpen:r[y]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[y],"aria-controls":y}),v={hidden:y in r?!r[y]:!0}),b||(v={...v,...S})}return a.jsxs("li",{className:M({[c.className]:c.className,"has-submenu":p,parent:b,active:_}),role:"none",...x,children:[m?g.createElement(d?re:"a",m,o.formatMessage({id:l})):o.formatMessage({id:l}),c.order&&a.jsx("ul",{...v,children:c.order.map(y=>{if(!c[y])return null;const S={isLoggedIn:e,isDesktopVersion:n,menus:r,callback:i,doTrack:f?u:null};return c[y].order?a.jsxs("li",{className:M({[c[y].className]:c[y].className}),children:[o.formatMessage({id:`${l}_${y}`}),a.jsx("ul",{children:c[y].order.map(T=>a.jsx(Zt,{id:`${t}.${y}.${T}`,...S},T))})]},y):a.jsx(Zt,{id:`${t}.${y}`,...S},y)})})]},t)};const bc={height:67,height_desktop:83},Jn=({showNavigation:t=!0})=>{const e=q.useIntl(),n=g.useContext(Te),r=Xe(!0,!0),i=n&&typeof n.id=="string",s=g.useMemo(()=>ue.getIsDesktopVersion(i,r),[i,r]),[o,c]=g.useReducer(ra,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:f,menus:u,focusElements:d}=o;ta({scrollPosition:bc[`height${s.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!s&&u.navigation||ue.shouldChangeHeaderIsVisible(!0,u,c)},scrollDown:()=>{!s&&u.navigation||ue.shouldChangeHeaderIsVisible(!1,u,c)}}});const l=(p,b)=>{ue.handleMenus({id:p,value:b,menus:u,dispatch:c})},m=g.useRef(null);return Ke(()=>{u.navigation&&ue.autoFocus({menu:"navigation",navigationRef:m,isDesktopVersion:s.navigation,focusElements:d,dispatch:c})},[u.navigation]),Ke(()=>{u.account&&ue.autoFocus({menu:"account",navigationRef:m,isDesktopVersion:s.navigation,focusElements:d,dispatch:c})},[u.account]),n&&n.isLoading?null:a.jsxs(a.Fragment,{children:[a.jsxs("nav",{id:"header",className:M({"logged-in":i,"logged-out":!i,visible:f}),children:[a.jsx(ge,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),a.jsx(Gn,{}),t&&a.jsxs(a.Fragment,{children:[!s.navigation&&a.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),l("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:a.jsx(ge,{children:e.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),a.jsx("ul",{ref:m,id:"navigation",hidden:s.navigation||u.account?!1:!u.navigation,role:"menu","data-showing":!s.navigation&&u.account?"account":"default",children:vt.order.map(p=>a.jsx(Zt,{id:p,isLoggedIn:i,isDesktopVersion:s.navigation,menus:{navigation:u.navigation,account:u.account},callback:l},p))}),!s.search&&a.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),l("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:a.jsx(ge,{children:e.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),a.jsx(Ua,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:s.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),i?a.jsxs("button",{className:"account-button",onClick:p=>ue.events.onClick(p,{id:"account",callback:l,isOpen:u.account}),onMouseEnter:()=>ue.events.onMouseEnter({id:"account",callback:l}),onMouseLeave:()=>ue.events.onBlur({id:"account",callback:l}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[a.jsx(ge,{children:e.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),a.jsx(Re,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):a.jsx("ul",{className:"sign-in-buttons",children:vt.buttons.order.map(p=>a.jsx(Zt,{id:`buttons.${p}`},p))})]})]}),a.jsx("hr",{id:"content-of-page"}),a.jsx("div",{className:M("overlay",{open:u.navigation||u.account||!s.search&&u.search})})]})};const yc=()=>{const t=q.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(Jn,{}),a.jsx("div",{id:"content",children:a.jsx(Be,{variant:"error",text:t.formatMessage({id:"pageLayout_error"})})}),a.jsx(Qn,{})]})},Ya=({children:t,additionalContent:{prepended:e,appended:n}={},reportError:r,forceShow:i={},styling:s={},className:o="",locale:c="en"})=>{const{navigation:f=!0,footer:u=!0}=i,{background:d="default",variant:l="default",circle:m="default"}=s,p=Xr();g.useEffect(()=>{window.scrollTo(0,0)},[p]);const b=Ft(t,{locale:c}),_=Ft(e,{locale:c}),x=Ft(n,{locale:c}),v={};return d!=="default"&&(v[d]=!0),l!=="default"&&(v[l]=!0),m!=="default"&&(v[m]=!0),a.jsx(Ni.ErrorBoundary,{onError:r,fallback:a.jsx(yc,{}),children:a.jsx(g.Suspense,{fallback:null,children:a.jsxs("div",{id:"wrapper",className:M(o,v,{"has-footer":u}),children:[a.jsx(Jn,{showNavigation:f}),a.jsxs("section",{id:"content-wrapper",children:[_&&a.jsx("div",{className:"additional-content prepended",children:_}),g.createElement(d==="bold"?Vn:"div",{id:"content",children:b})]}),x&&a.jsx("div",{className:"additional-content appended",children:x}),u&&a.jsx(Qn,{}),a.jsx(Va,{})]})})})},Br={default:"tags_",headerTopics:"header_topics_topics_"},Sn={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"},_c={getTagDetails:t=>{if(t.includes("topic_")){if(t=Sn.topic[t.replace("topic_","")],t){const e=vt.topics.topics[t].href;return e?{id:t,href:e,text:`${Br.headerTopics}${t}`}:null}return null}return Sn[t]?(t=Sn[t],{id:t,text:`${Br.default}${t}`}):null}};const xc=({tags:t=[],color:e="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:s="tag-click",gtmContext:o="tags"})=>{const c=q.useIntl();if(!t||t.length<1)return null;const f=[];return t.forEach(u=>{if(!u)return;const d=_c.getTagDetails(u);d&&f.push(d)}),f.length<1?null:a.jsx("ul",{className:M("tags text-small",e,i,{"one-line":n}),children:f.map(u=>{const d=c.formatMessage({id:u.text});return a.jsx("li",{children:u.href&&r?a.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":s,"data-gtm-event-context":o,children:d}):d},u.id)})})};const wc=({members:{data:t=[],total:e=t.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:i="member",gtmType:s="member-click",className:o=""})=>{const c=q.useIntl();return t.length===0?null:a.jsxs("div",{className:M("members-list",o),children:[a.jsxs("h1",{children:[c.formatMessage({id:"membersList"}),a.jsx("span",{className:"count",children:e})]}),a.jsx("ul",{children:t.map((f,u)=>a.jsxs("li",{children:[a.jsx(Gt,{member:f,gtmContext:i,gtmType:s}),f.isAdmin&&a.jsx(Ve,{children:c.formatMessage({id:"membersList_admin"})})]},u))}),n&&a.jsx(yt,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:i})]})};let $t=null;const ye="discussion_form_",Jt=({content:t={type:"response",slugs:{}},userHasPermissions:e=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},inputRef:r,placeholder:i,maxLength:s=5e4,minRows:o=4,forceShow:c={cancel:!1,error:!1},functions:f={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:u="DiscussionForm"})=>{var D,C,E;const d=q.useIntl(),l=g.useContext(Te),[m,p]=g.useState(n.isEditing&&n.isEditing.text||""),[b,_]=g.useState(c.error||!1),[x,v]=g.useState(!1),y=g.useRef(null);if(r||(r=y),n.isLoading)return a.jsx(xe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const S=w=>{const N=w.target.value;p(N);let L;!l||!l.id?L=ke(d.formatMessage,`${ye}error_loggedOut`,t.type,"action"):e?N.length>=s&&(L=`${ye}error_tooLong`):L=ke(d.formatMessage,`${ye}error_noPermission`,t.type,"action"),L?_(L):b&&_(!1)};let T=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const w=((D=t.slugs)==null?void 0:D.reply)||((C=t.slugs)==null?void 0:C.answer)||((E=t.slugs)==null?void 0:E.question)||"";w&&(T=`${T}-${w.slice(-15)}`)}const k=async w=>{var L;if(w.preventDefault(),w.stopPropagation(),!l||!l.id||!e||O)return;$t&&clearTimeout($t),v("submitting");const N=window.location.pathname;try{let z;switch(t.type){case"post":z=await f.create({content:m});break;case"question":z=await f.create({title:m,authorId:l&&l.id,...(L=f.props)==null?void 0:L.create});break;case"response":z=await f.create({questionSlug:t.slugs.question},{body:m,authorId:l&&l.id,contentPath:N});break;case"reply":z=await f.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:m,authorId:l&&l.id,contentPath:N});break;default:break}await zi(1e3),f.callback&&await f.callback(z),$t=setTimeout(()=>{p(""),v("submitted");const I=new Event("discussionFormSubmitted");document.dispatchEvent(I),Z()},500)}catch(z){const I=z;let H=`${ye}error`;I!=null&&I.message.includes("entry already exists")&&(H=ke(d.formatMessage,`${ye}error_alreadyExists`,t.type,"action")),I!=null&&I.message.includes("429")?H=ke(d.formatMessage,`${ye}error_tooMany`,t.type,"action"):I!=null&&I.message.includes("400")&&(H=`${ye}error`),_(H),Z()}},Z=()=>{$t=setTimeout(()=>{_(!1),v(!1)},5e3)},O=!m||!Ki(m),Y=x==="submitting",R=[];return(n.isEditing&&!Y||c.cancel)&&R.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:f.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!c.cancel&&(!l||!l.id||!m),children:d.formatMessage({id:`${ye}cancel`})}),R.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:w=>{if(n.isEditing){v("submitting"),f.handleSaveEdit&&f.handleSaveEdit(y.current&&"value"in y.current?y.current.value:"");return}k(w)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!l||!l.id||!e||O||Y||n.isEditing&&m===n.isEditing.text,children:d.formatMessage({id:`${ye}${Y?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),a.jsxs("form",{id:T,className:M("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(t.type)&&a.jsx("h2",{children:ke(d.formatMessage,`${ye}title`,t.type,"action")}),a.jsx(Gt,{member:l||"community",gtmContext:u,gtmType:"profile-click"}),a.jsx(ge,{element:"label",showOnFocus:!1,htmlFor:`${T}-input`,children:ke(d.formatMessage,`${ye}label`,t.type,"action")}),a.jsx($i,{ref:r,id:`${T}-input`,name:t.type,placeholder:i||ke(d.formatMessage,`${ye}placeholder`,t.type,"action"),onChange:S,value:x==="submitting"&&!b?"":m,maxLength:s,"aria-invalid":!!b,"aria-errormessage":"error-message",minRows:o,autoFocus:!!n.isEditing}),a.jsx("small",{children:ke(d.formatMessage,`${ye}explainer`,t.type,"action",{a:w=>a.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:w})})}),a.jsx(et,{buttons:R}),x==="submitted"&&n.showSuccessMessage&&a.jsx(gt,{className:"success","data-testid":"success",children:ke(d.formatMessage,`${ye}success`,t.type,"action")}),b&&a.jsx(gt,{id:"error-message",className:"error","data-testid":"error",children:c.error?c.error:typeof b=="string"?b.includes(" ")?b:d.formatMessage({id:b},{action:d.formatMessage({id:`discussion_action_${t.type}`}),maxLength:s}):b})]})},Xn=({form:t,membershipRequiredToPost:{isMember:e,required:n,join:r,leave:i,notMemberStateText:s}})=>{if(n&&!e)return a.jsx(Be,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:a.jsx(Kn,{isShort:!0,functions:{join:r,leave:i}})}});const{content:o,functions:c,meta:f,...u}=t;return a.jsx(Jt,{content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...c,create:(c==null?void 0:c.create)||(()=>{})},meta:{...f,isEditing:(f==null?void 0:f.isEditing)||!1,showSuccessMessage:!1},...u})},kc={showForm:!1},Xt=g.createContext(kc),Ka=({children:t})=>{const[e,n]=g.useState({showForm:!1});return a.jsx(Xt.Provider,{value:{...e,updateConversation:n},children:t})},jc=({question:t,answer:e,reply:n})=>({...t&&{questionSlug:t},...e&&{answerSlug:e},...n&&{replySlug:n}}),Tc=(t,e=10)=>!t||t.length===0?[]:t.slice(0,e);let pt=!1;const Cn=()=>{pt!==!1&&(clearTimeout(pt),pt=!1)},Mn=5,Ga=({element:t="div",likes:e=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:s={type:"reply",slugs:{}},canLike:o=!0,functions:{createLike:c=()=>{},deleteLike:f=()=>{}}={}})=>{const u=q.useIntl();g.useEffect(()=>{p(i)},[i]);const[d,l]=g.useState(e),[m,p]=g.useState(i),[b,_]=g.useState(!1),[x,v]=g.useState(!1),y=g.useMemo(()=>Tc(n,Mn),[n]),S=k=>{if(k.preventDefault(),k.stopPropagation(),v(!1),pt)return Cn(),!1;if(Cn(),b||!o)return!1;pt=setTimeout(T,350)},T=async()=>{if(Cn(),b||!o)return!1;let k=m?d-1:d+1;k<0&&(k=0),_(!0),l(k),p(!m);try{if(s&&s.slugs){const Z=jc(s.slugs);m?await f(Z):await c({...Z,payload:{contentPath:window.location.pathname}})}}catch{l(e),p(i)}finally{_(!1)}};return g.createElement(t,{className:M("likes-wrapper text-medium action-button",{"show-spinner":b,"is-liked":m,disabled:!o}),onClick:S,onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onFocus:()=>{v(!0)},onBlur:()=>{v(!1)},children:a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"tertiary",size:"medium",icon:{icon:m?"heart":"heart_empty",animate:"bounce"},className:M({"do-animation":m&&!i}),screenreaderText:o?u.formatMessage({id:`discussion_likes_${m?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${s.type}`})}):!1,onClick:S,disabled:!o,"aria-hidden":!o,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${s.type}-click`}),a.jsx("span",{className:M("number-of-likes",{"no-likes":d===0}),"data-testid":"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:d})}),n&&a.jsx(ua,{isOpen:x,isLoading:n.length===0,children:n.length&&a.jsxs("ul",{children:[y.map(k=>typeof k=="string"||!k.name?null:a.jsx("li",{children:a.jsx(nt,{href:k.id?`/profiles/${k.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:Z=>Z==null?void 0:Z.stopPropagation(),children:k.name})},k.id||window.btoa(k.name))),e>Mn&&a.jsx("li",{children:u.formatMessage({id:"discussion_likes_more"},{number:e-Mn})})]})})]})})},qr=t=>{const e={};return Object.keys(t).forEach(n=>n.includes("Id")?e[n]=t[n]:e[`${n}Slug`]=t[n]),e},en=(t,e)=>t&&!e;const Ce="discussion_",Ec=280,_t=({element:t="div",content:e,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:i,forceHide:s={comments:!1,likes:!1},functions:{content:{createContent:o,deleteContent:c,updateContent:f}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:d}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:l}={openComments:()=>{}}},links:m={},className:p,gtmContext:b="DiscussionAnswer",children:_,isTruncated:x=!1})=>{const v=q.useIntl(),y=g.useContext(Te),S=g.useContext(Xt),{author:T,canLike:k,createdAt:Z,id:O,likes:Y=0,userLiked:R,comments:D=0}=e,C=y&&y.id&&typeof T!="string"&&T.id&&T.id===y.id||!1,E=typeof k=="boolean"?k:n?!C:!1,w=C&&(!e.createdAt||Ui(e.createdAt,10,"seconds")),N=g.useRef(null),[L,z]=g.useState({body:e&&e.body||"",isEditing:!1,didEdit:e&&e.isEdited||!1}),[I,H]=g.useState(!1),[J,j]=g.useState(w?"highlighted":"default"),[$,W]=g.useState("");g.useEffect(()=>{const F=N.current;if(!(!F||J==="default"))return document.addEventListener("discussionFormSubmitted",U),F.addEventListener("transitionend",V),()=>{document.removeEventListener("discussionFormSubmitted",U),F.removeEventListener("transitionend",V)}},[]),g.useEffect(()=>{z({...L,body:e&&e.body||"",didEdit:e&&e.isEdited||!1})},[e.isEdited]);const U=()=>{setTimeout(()=>{j("fading")},1e3)},V=({propertyName:F})=>{F==="background-color"&&j(ie=>(ie==="default"&&(document.removeEventListener("discussionFormSubmitted",U),N.current&&N.current.removeEventListener("transitionend",V)),ie==="fading"?"default":ie))};if(r||!e||e.type==="answer"&&(!e.slugs||!e.slugs.question))return a.jsx(xe,{className:"discussion-card discussion-post"});const ee=x?Ye(L.body,Ec):L.body,G=async F=>{F||(F=""),W("");try{if(!Pi(F,L.body)){const ie=e.type==="question"?{title:F}:{body:F};await f(qr(e.slugs),ie)}z({body:F,isEditing:!1,didEdit:!0})}catch{W(`${Ce}form_error`)}},K=()=>{S&&S.updateConversation&&S.updateConversation({showForm:!0}),setTimeout(()=>{var Ee,we,Fe;const ie=`reply-form-${(e.type==="answer"?e.slug:((Ee=e.slugs)==null?void 0:Ee.reply)||((we=e.slugs)==null?void 0:we.answer)||((Fe=e.slugs)==null?void 0:Fe.question)||"").toLowerCase().slice(-15)}`,A=document.getElementById(ie),he=document.getElementById(`${ie}-input`);he&&he.focus(),A&&A.scrollIntoView({behavior:"smooth"})},0)},X=async()=>{H(!1);try{await c(qr(e.slugs))}catch{W("delete-error")}},ne=[{text:v.formatMessage({id:`${Ce}moreMenu_report`}),onClick:F=>{F.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Ce}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${Ce}report_body`},{contentType:e.type||"",contentSlug:e.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${e.slugs.question||""}`}))}`,icon:"flag"}];return n&&C&&ne.push({text:v.formatMessage({id:`${Ce}moreMenu_edit`}),onClick:()=>z({...L,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`edit-${e.type}-click`},{text:v.formatMessage({id:`${Ce}moreMenu_delete`}),onClick:F=>{F.preventDefault(),F.stopPropagation(),H(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`delete-${e.type}-click`,...Fa(`delete-${e.slug}-modal`,I)}),g.createElement(t,{className:M("discussion-post",p,{[J]:!p||!p.includes("highlighted-text-box")}),ref:N,"data-testid":`discussion-${e.type}-thread`,children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{id:O||e.slug,className:M("discussion-card",e.type,{editing:L.isEditing,"has-link":m.post&&!L.isEditing}),onClick:F=>{!m.post||L.isEditing||(F.preventDefault(),F.stopPropagation(),window.location.href=m.post)},children:[!L.isEditing&&a.jsx(Gt,{member:T,additionalContent:{createdAt:Z,didEdit:L.didEdit},className:typeof T!="string"&&T.id===i?"highlighted":"",gtmContext:b,gtmType:"profile-click"}),L.isEditing?a.jsx(Jt,{content:{type:e.type,slugs:e.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:L.body}},maxLength:e.type==="question"?250:5e4,forceShow:{error:$!==""&&$!=="delete-error"?v.formatMessage({id:$},{action:v.formatMessage({id:`discussion_action_${e.type}`})}):!1},functions:{create:o,handleSaveEdit:G,handleCancel:()=>{W(""),z({...L,isEditing:!1})}},gtmContext:`${b}Form`}):m.post?a.jsx("a",{href:m.post,className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":"title-click",children:a.jsx(ht,{options:{overrides:{a:ba}},children:ee})}):a.jsx(ht,{options:{wrapper:e.type==="question"?"h1":g.Fragment,forceWrapper:e.type==="question",forceInline:e.type==="question",forceBlock:e.type!=="question"},children:ee}),!L.isEditing&&a.jsxs("ul",{className:M("actions text-medium",e.type),"data-testid":`${e.type}-actions`,children:[!s.likes&&a.jsx(Ga,{element:"li",likes:Y,isShort:!1,userLiked:R,content:{type:e.type,slugs:e.slugs},canLike:E,peopleWhoLiked:e.peopleWhoLiked,functions:{createLike:u,deleteLike:d}}),!s.comments&&(["question","post"].includes(e.type)||m.comments||typeof l=="function")&&a.jsxs("li",{className:"action-button",onClick:F=>{F.preventDefault(),F.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof l=="function"&&l()},children:[a.jsx(re,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:m.comments?m.comments:!1,onClick:m.comments||typeof l!="function"?!1:l,className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`answer-${e.type}-click`,screenreaderText:v.formatMessage({id:`${Ce}comments_screenReader`},{count:D})}),a.jsx("span",{children:v.formatMessage({id:`${Ce}comments`},{count:D})})]}),(e.type==="answer"||e.type==="reply")&&a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:K,children:v.formatMessage({id:`${Ce}reply`})})}),a.jsx(Za,{element:"li",id:`more-${e.slug}`,options:ne})]})]}),_,a.jsx(bt,{id:`delete-${e.slug}-modal`,isOpen:I,functions:{onOpen:()=>{},onClose:()=>H(!1)},forceShow:{error:$==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${e.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${e.type}`})}),buttons:[{variant:"secondary",onClick:()=>H(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:X,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}:${e.slug}`,children:a.jsx(q.FormattedMessage,{id:"discussion_delete_text",values:{p:F=>a.jsx("p",{children:F}),action:v.formatMessage({id:`discussion_action_${e.type}`})}})})]})})};const Nn="discussion_responses_",Qa=({type:t="answer",responses:e=0})=>{const n=q.useIntl();return e=parseInt(e),a.jsxs("div",{className:"responses-heading",children:[a.jsx("h4",{children:n.formatMessage({id:`${Nn}title`},{action:n.formatMessage({id:`${Nn}${t}`}),count:e})}),e===0&&a.jsx("p",{children:ke(n.formatMessage,`${Nn}empty`,t,t)})]})};const Ja=({loadMore:{isLoading:t,hasNextPage:e,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const s=q.useIntl(),o=g.useContext(Xt),c=Ft(i,{element:"li"});return a.jsxs("div",{className:"thread-wrapper",children:[!Object.is(c,null)&&a.jsx("ul",{className:"thread",children:c}),!t&&a.jsx(yt,{hasNextPage:e,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:s.formatMessage({id:"discussion_thread_loadMore"}),error:s.formatMessage({id:"loadMore_error"})}}),r&&o.showForm&&a.jsx(Jt,{...r})]})},Sc="post",Cc="reply",Xa="00000000-0000-0000-0000-000000000000";function er({queryClient:t,queryKey:e}){function n(r,i,s){t.setQueryData(e,s)}return n}function tr({queryClient:t,queryKey:e}){async function n(r){await t.cancelQueries({queryKey:e});const i=t.getQueryData(e);return t.setQueryData(e,r),i}return n}function Mc(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Nc(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function ei(t){const{id:e="",name:n="",organization:r="",jobTitle:i="",image:s={}}=t,{thumbnail:o=""}=s;return{id:e,data:{name:n,organization:r,jobTitle:i,thumbnail:o}}}function $c({content:t}){return{content:t,id:Xa,time:new Date().toISOString(),verb:Sc}}function Ur({activity:t,user:e}){return{...t,actor:ei(e),...Mc()}}function Wt({activity:t,reaction:e}){var n,r,i;e?(t.latest_reactions={...t.latest_reactions||{},like:[...((r=t.latest_reactions)==null?void 0:r.like)||[],e]},t.own_reactions={...t.own_reactions||{},like:[...((i=t.own_reactions)==null?void 0:i.like)||[],e]}):t.reaction_counts={...t.reaction_counts||{},like:(n=t.reaction_counts)!=null&&n.like?t.reaction_counts.like+1:1}}function ti({activity:t,user:e}){var n,r,i;t.reaction_counts={...t.reaction_counts||{},like:(n=t.reaction_counts)!=null&&n.like?t.reaction_counts.like-1:0},e!=null&&e.id&&(t.latest_reactions={...t.latest_reactions||{},like:(((r=t.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:s})=>s!==e.id)},t.own_reactions={...t.own_reactions||{},like:(((i=t.own_reactions)==null?void 0:i.like)||[]).filter(({user_id:s})=>s!==e.id)})}function Pc({activityId:t,replyId:e,content:n}){return{activity_id:t,data:{content:n},id:Xa,kind:Cc,parent:e||""}}function zr({reply:t,user:e}){const n=ei(e);return{...t,user_id:n.id,user:n,...Nc()}}function Zr({reply:t,reaction:e}){var n,r,i;e?(t.latest_children={...t.latest_children||{},like:[...((r=t.latest_children)==null?void 0:r.like)||[],e]},t.own_children={...t.own_children||{},like:[...((i=t.own_children)==null?void 0:i.like)||[],e]}):t.children_counts={...t.children_counts||{},like:(n=t.children_counts)!=null&&n.like?t.children_counts.like+1:1}}function Rc({reply:t,user:e}){var n,r,i;t.children_counts={...t.children_counts||{},like:(n=t.children_counts)!=null&&n.like?t.children_counts.like-1:0},e!=null&&e.id&&(t.latest_children={...t.latest_children||{},like:(((r=t.latest_children)==null?void 0:r.like)||[]).filter(({user_id:s})=>s!==e.id)},t.own_children={...t.own_children||{},like:(((i=t.own_children)==null?void 0:i.like)||[]).filter(({user_id:s})=>s!==e.id)})}const ni=t=>{const e=new CustomEvent("discussionPostAdded",{detail:t});document.dispatchEvent(e)};let Wr,$n=0;const ri=()=>{g.useEffect(()=>(document.addEventListener("discussionPostAdded",t),()=>{document.removeEventListener("discussionPostAdded",t)}),[]);const t=e=>{const n=e.detail;if(!n)return;clearTimeout(Wr);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),$n=0;return}$n++,!($n>10)&&(Wr=setTimeout(()=>{t(e)},50))}},Qe=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),Pe=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),ai=Object.freeze({actor:`SU:${Qe.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),Fc=Object.freeze({actor:`SU:${Pe.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Oc=Object.freeze({actor:`SU:${Qe.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),Dc=Object.freeze({actor:`SU:${Pe.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:ai.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Pe.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Pe.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:Pe.id,user:{id:Pe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ai.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Qe.id,user:{id:Qe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Fc.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Pe.id,user:{id:Pe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Oc.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Qe.id,user:{id:Qe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Dc.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Ac({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i,user:s}){const{mutate:o}=me.useMutation({mutationFn:t,onMutate:c=>e(f=>{const u=Ur({activity:$c(c),user:s});return Hr(u,f)}),onError:n,onSuccess:(c,f,u)=>{const d=Ur({activity:c,user:s});r.setQueryData(i,Hr(d,u,!0)),setTimeout(()=>{ni(d.id)},0)}});return o}function Ic({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({activityId:i,content:s})=>e(o=>{const c=Ht(i,o);return c&&(c.content=s),o}),onError:n});return r}function Lc({queryFns:{create:t,edit:e,like:n,list:r,remove:i,unlike:s},queryKey:o}){const c=me.useQueryClient(),f=Kt(),u={queryClient:c,queryKey:o},d={mutationHandlers:{error:er(u),mutate:tr(u)},user:f,...u},l=Ac({...d,mutationFn:t}),m=Ic({...d,mutationFn:e}),p=Bc({...d,mutationFn:n}),b=Uc({...d,mutationFn:i}),_=zc({...d,mutationFn:s}),{activities:x,...v}=qc({queryKey:o,queryFn:r});return{activities:x,mutations:{create:l,edit:m,remove:b,like:p,unlike:_},user:f,...v}}function Bc({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i}){const{mutate:s}=me.useMutation({mutationFn:t,onMutate:({activityId:o})=>e(c=>{const f=Ht(o,c);return f&&Wt({activity:f}),c}),onError:n,onSuccess:(o,{activityId:c},f)=>{const u=Ht(c,f);u&&Wt({activity:u,reaction:o}),r.setQueryData(i,f)}});return s}function qc({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}=me.useInfiniteQuery({queryKey:e,queryFn:t,initialPageParam:{next:null},getNextPageParam:c=>(c==null?void 0:c.next)||null});return{activities:Wc(n),error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Uc({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({activityId:i})=>e(s=>Zc(i,s)),onError:n});return r}function zc({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:i}=me.useMutation({mutationFn:t,onMutate:({activityId:s})=>e(o=>{const c=Ht(s,o);return c&&ti({activity:c,user:r}),o}),onError:n});return i}function Hr(t,e,n=!1){return e?(n?e.pages[0].results[0]=t:e.pages[0].results=[t,...e.pages[0].results],e):{pages:[{next:"",results:[t]}],pageParams:[""]}}function Ht(t,e){if(e)for(const{results:n}of e.pages){const r=n.find(({id:i})=>i===t);if(r)return r}}function Zc(t,e){for(const{results:n}of e.pages){const r=n.findIndex(({id:i})=>i===t);if(r!==-1){n.splice(r,1);break}}return e}function Wc(t){var e;return((e=t==null?void 0:t.pages)==null?void 0:e.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Hc=({basePath:t,parentId:e,isMember:n,functions:{activities:r,join:i,leave:s}})=>{const o=q.useIntl(),{activities:c,error:f,fetchNextPage:u,hasNextPage:d,isLoading:l,mutations:{create:m,edit:p,remove:b,like:_,unlike:x},user:v}=Lc({queryKey:[t,e,"activities"],queryFns:r});if(ri(),f)return a.jsx(Be,{variant:"error",text:f.message});const y=(c==null?void 0:c.length)||0;return a.jsxs("section",{children:[a.jsx(Xn,{form:{content:{type:"post",slugs:{}},functions:{create:m},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),c==null?void 0:c.map((S,T)=>{var L,z,I,H,J,j,$,W;const{id:k,own_reactions:Z,latest_reactions:O,reaction_counts:Y}=S,R=(((L=O==null?void 0:O.like)==null?void 0:L.length)||0)>0,D=(((z=Z==null?void 0:Z.like)==null?void 0:z.length)||0)>0,C=D?Z==null?void 0:Z.like[0].id:"",E=R?(I=O==null?void 0:O.like)==null?void 0:I.map(U=>{var V,ee,G;return{id:(V=U==null?void 0:U.user)==null?void 0:V.id,name:(G=(ee=U==null?void 0:U.user)==null?void 0:ee.data)==null?void 0:G.name}}):!1,w=S==null?void 0:S.actor,N=(w==null?void 0:w.id)===(v==null?void 0:v.id);return a.jsxs(g.Fragment,{children:[a.jsx(_t,{content:{type:"post",body:S==null?void 0:S.content,canLike:en(n,N),createdAt:(S==null?void 0:S.time)||"",slugs:{question:`${t}/${e}`,answer:k},slug:k,author:{id:w==null?void 0:w.id,name:(H=w==null?void 0:w.data)==null?void 0:H.name,organization:(J=w==null?void 0:w.data)==null?void 0:J.organization,jobTitle:(j=w==null?void 0:w.data)==null?void 0:j.jobTitle,location:($=w==null?void 0:w.data)==null?void 0:$.location,image:{thumbnail:((W=w==null?void 0:w.data)==null?void 0:W.thumbnail)||void 0}},userLiked:D,likes:(Y==null?void 0:Y.like)||0,comments:(Y==null?void 0:Y.reply)||0,peopleWhoLiked:E},links:{post:`${t}/${e}/${k}`,comments:`${t}/${e}/${k}`},functions:{content:{createContent:()=>null,deleteContent:()=>b({activityId:k}),updateContent:(U,{body:V})=>p({activityId:k,content:V})},likes:{createLike:()=>_({activityId:k}),deleteLike:()=>x({activityId:k,reactionId:C})},comments:{openComments:()=>null}},isTruncated:!0}),y>T+1&&a.jsx(je,{})]},k)}),!l&&a.jsx(yt,{hasNextPage:d,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},Vc={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Yc({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i,user:s}){const{mutate:o}=me.useMutation({mutationFn:t,onMutate:c=>e(f=>{const u=zr({reply:Pc(c),user:s});return Vr(u,f,{replace:!1,append:(c==null?void 0:c.replyId)!==void 0})}),onError:n,onSuccess:(c,f,u)=>{const d=zr({reply:c,user:s});r.setQueryData(i,Vr(d,u,{replace:!0,append:(f==null?void 0:f.replyId)!==void 0})),setTimeout(()=>{ni(d.id)},0)}});return o}function Kc({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({replyId:i,content:s})=>e(o=>{const c=Vt(i,o);return c&&(c.data.content=s),o}),onError:n});return r}function ii({queryFns:{create:t,edit:e,like:n,list:r,remove:i,unlike:s},queryKey:o}){const c=me.useQueryClient(),f=Kt(),u={queryClient:c,queryKey:o},d={mutationHandlers:{error:er(u),mutate:tr(u)},user:f,...u},l=Yc({...d,mutationFn:t}),m=Kc({...d,mutationFn:e}),p=Gc({...d,mutationFn:n}),b=Jc({...d,mutationFn:i}),_=Xc({...d,mutationFn:s}),{replies:x,...v}=Qc({queryKey:o,queryFn:r});return{replies:x,mutations:{create:l,edit:m,remove:b,like:p,unlike:_},user:f,...v}}function Gc({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i}){const{mutate:s}=me.useMutation({mutationFn:t,onMutate:({replyId:o})=>e(c=>{const f=Vt(o,c);return f&&Zr({reply:f}),c}),onError:n,onSuccess:(o,{replyId:c},f)=>{const u=Vt(c,f);u&&Zr({reply:u,reaction:o}),r.setQueryData(i,f)}});return s}function Qc({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}=me.useInfiniteQuery({queryKey:e,queryFn:t,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),c=al(n),f=`${c.length||0}${s?"+":""}`;return{replies:c,repliesCount:f,error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Jc({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({replyId:i})=>e(s=>rl(i,s)),onError:n});return r}function Xc({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:i}=me.useMutation({mutationFn:t,onMutate:({replyId:s})=>e(o=>{const c=Vt(s,o);return c&&Rc({reply:c,user:r}),o}),onError:n});return i}function el(t){return{pages:[{next:"",results:[t]}],pageParams:[""]}}function tl(t,e,n){const r=e.pages.length-1,i=e.pages[r].results.length-1;return n!=null&&n.replace?e.pages[r].results[i]=t:e.pages[r].results.push(t),e}function nl(t,e,n){return n!=null&&n.replace?e.pages[0].results[0]=t:e.pages[0].results=[t,...e.pages[0].results],e}function Vr(t,e,n){return e?n!=null&&n.append?tl(t,e,n):nl(t,e,n):el(t)}function Vt(t,e){if(e)for(const{results:n}of e.pages){const r=n.find(({id:i})=>i===t);if(r)return r}}function rl(t,e){for(const{results:n}of e.pages){const r=n.findIndex(({id:i})=>i===t);if(r!==-1){n.splice(r,1);break}}return e}function al(t){var e;return((e=t==null?void 0:t.pages)==null?void 0:e.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const il=({basePath:t,parentId:e,activityId:n,replyId:r,isMember:i,functions:s})=>{const{replies:o,fetchNextPage:c,hasNextPage:f,isLoading:u,mutations:{create:d,edit:l,like:m,remove:p,unlike:b},user:_}=ii({queryKey:[t,e,n,r,"replies"],queryFns:{...s,list:x=>s.list({...x,reactionId:r})}});return a.jsx(Ja,{loadMore:{isLoading:u,hasNextPage:f,loadNextPage:()=>c()},form:{content:{type:"reply",slugs:{question:`${t}/${e}`,answer:n,reply:r}},functions:{create:(x,{body:v})=>d({activityId:n,replyId:r,content:v})},meta:{isEditing:!1,showSuccessMessage:!1}},children:o&&o.length>0?o==null?void 0:o.map(x=>{var L,z,I,H,J,j,$,W,U,V,ee,G;const{id:v,own_children:y,latest_children:S,children_counts:T}=x,Z=(((L=y==null?void 0:y.like)==null?void 0:L.length)||0)>0?(z=y==null?void 0:y.like)==null?void 0:z.find(K=>{var X;return((X=K==null?void 0:K.user)==null?void 0:X.id)===(_==null?void 0:_.id)}):!1,O=Z?Z==null?void 0:Z.id:"",Y=!!Z,D=(((I=S==null?void 0:S.like)==null?void 0:I.length)||0)>0?(H=S==null?void 0:S.like)==null?void 0:H.map(K=>{var X,ne,F;return{id:(X=K==null?void 0:K.user)==null?void 0:X.id,name:(F=(ne=K==null?void 0:K.user)==null?void 0:ne.data)==null?void 0:F.name}}):!1,C=x==null?void 0:x.user,E=(C==null?void 0:C.id)===(_==null?void 0:_.id),w=en(i,E),N=typeof x.data.content=="string"?(J=x==null?void 0:x.data)==null?void 0:J.content:(($=(j=x==null?void 0:x.data)==null?void 0:j.content)==null?void 0:$.text)||"";return a.jsx(_t,{content:{id:v,type:"reply",body:N,canLike:w,createdAt:x==null?void 0:x.created_at,slugs:{question:`${t}/${e}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:C==null?void 0:C.id,name:(W=C.data)==null?void 0:W.name,organization:(U=C.data)==null?void 0:U.organization,jobTitle:(V=C.data)==null?void 0:V.jobTitle,location:(ee=C.data)==null?void 0:ee.location,image:{thumbnail:((G=C.data)==null?void 0:G.thumbnail)||void 0}},userLiked:Y,likes:(T==null?void 0:T.like)||0,peopleWhoLiked:D},functions:{content:{createContent:()=>null,deleteContent:()=>p({replyId:v}),updateContent:(K,{body:X})=>l({replyId:v,content:X})},likes:{createLike:()=>m({replyId:v}),deleteLike:()=>b({replyId:v,reactionId:O})},comments:{}}},v)}):null})},si=({basePath:t,parentId:e,activityId:n,isMember:r,functions:{reactions:i,join:s,leave:o}})=>{const c=q.useIntl(),{replies:f,repliesCount:u,fetchNextPage:d,hasNextPage:l,isLoading:m,mutations:{create:p,edit:b,like:_,remove:x,unlike:v},user:y}=ii({queryKey:[t,e,n,"replies"],queryFns:i});return na(),ri(),a.jsxs("section",{children:[a.jsx(Qa,{type:"comment",responses:u}),a.jsx(Xn,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:T})=>p({activityId:n,content:T})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:c.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),f==null?void 0:f.map(S=>{var H,J,j,$,W,U,V,ee,G,K,X,ne;const{id:T,own_children:k,latest_children:Z,children_counts:O}=S,R=(((H=k==null?void 0:k.like)==null?void 0:H.length)||0)>0?(J=k==null?void 0:k.like)==null?void 0:J.find(F=>{var ie;return((ie=F==null?void 0:F.user)==null?void 0:ie.id)===(y==null?void 0:y.id)}):!1,D=R?R==null?void 0:R.id:"",C=!!R,w=(((j=Z==null?void 0:Z.like)==null?void 0:j.length)||0)>0?($=Z==null?void 0:Z.like)==null?void 0:$.map(F=>{var ie,A,he;return{id:(ie=F==null?void 0:F.user)==null?void 0:ie.id,name:(he=(A=F==null?void 0:F.user)==null?void 0:A.data)==null?void 0:he.name}}):!1,N=S==null?void 0:S.user,L=(N==null?void 0:N.id)===(y==null?void 0:y.id),z=en(r,L),I=typeof S.data.content=="string"?(W=S==null?void 0:S.data)==null?void 0:W.content:((V=(U=S==null?void 0:S.data)==null?void 0:U.content)==null?void 0:V.text)||"";return a.jsx(Ka,{children:a.jsx(_t,{content:{id:T,type:"reply",body:I,canLike:z,createdAt:S==null?void 0:S.created_at,slugs:{question:`${t}/${e}`,answer:n,reply:T},slug:T,author:{id:N==null?void 0:N.id,name:(ee=N.data)==null?void 0:ee.name,organization:(G=N.data)==null?void 0:G.organization,jobTitle:(K=N.data)==null?void 0:K.jobTitle,location:(X=N.data)==null?void 0:X.location,image:{thumbnail:((ne=N.data)==null?void 0:ne.thumbnail)||void 0}},userLiked:C,likes:(O==null?void 0:O.like)||0,peopleWhoLiked:w},functions:{content:{createContent:()=>null,deleteContent:()=>x({replyId:T}),updateContent:(F,{body:ie})=>b({replyId:T,content:ie})},likes:{createLike:()=>_({replyId:T}),deleteLike:()=>v({replyId:T,reactionId:D})},comments:{}},children:a.jsx(il,{basePath:t,parentId:e,activityId:n,replyId:T,isMember:r,functions:{...i}})},T)},T)}),!m&&a.jsx(yt,{hasNextPage:l,loadNextPage:()=>d(),icon:{icon:"arrow-down",position:"right"},messages:{button:c.formatMessage({id:"loadMore_button"}),error:c.formatMessage({id:"loadMore_error"})}})]})};function sl({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({content:i})=>e(s=>(s&&(s.content=i),s)),onError:n});return r}function ol({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:i,isFetching:s}=me.useQuery({queryFn:t,queryKey:e});return{activity:n,error:r,isLoading:i,isFetching:s}}function cl({queryFns:{read:t,edit:e,like:n,unlike:r},queryKey:i}){const s=me.useQueryClient(),o=Kt(),c={queryClient:s,queryKey:i},f={mutationHandlers:{error:er(c),mutate:tr(c)},user:o,...c},u=sl({...f,mutationFn:e}),d=ll({...f,mutationFn:n}),l=ul({...f,mutationFn:r}),{activity:m,...p}=ol({queryKey:i,queryFn:t});return{activity:m,mutations:{edit:u,like:d,unlike:l},user:o,...p}}function ll({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i}){const{mutate:s}=me.useMutation({mutationFn:t,onMutate:o=>e(c=>(c&&Wt({activity:c}),c)),onError:n,onSuccess:(o,c,f)=>{f&&Wt({activity:f,reaction:o}),r.setQueryData(i,f)}});return s}function ul({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:i}=me.useMutation({mutationFn:t,onMutate:s=>e(o=>(o&&ti({activity:o,user:r}),o)),onError:n});return i}const dl=({basePath:t,parentId:e,activityId:n,isMember:r,functions:{activities:{remove:i,...s},reactions:o,join:c,leave:f}})=>{var R,D,C,E,w,N,L,z,I,H;const u=q.useIntl(),d=g.useContext(Te),{activity:l,error:m,isLoading:p,mutations:{edit:b,like:_,unlike:x}}=cl({queryFns:s,queryKey:[t,e,n]});if(p)return a.jsx(xe,{style:{height:"400px"}});if(m||!l)return a.jsx(Be,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:y}=l,S=(((R=y==null?void 0:y.like)==null?void 0:R.length)||0)>0,T=(((D=v==null?void 0:v.like)==null?void 0:D.length)||0)>0,k=T?v==null?void 0:v.like[0].id:"",Z=S?(C=y==null?void 0:y.like)==null?void 0:C.map(J=>{var j,$,W;return{id:(j=J==null?void 0:J.user)==null?void 0:j.id,name:(W=($=J==null?void 0:J.user)==null?void 0:$.data)==null?void 0:W.name}}):!1,O=l==null?void 0:l.actor,Y=(O==null?void 0:O.id)===(d==null?void 0:d.id);return a.jsxs("section",{className:"activity-section",children:[a.jsx(_t,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:l==null?void 0:l.content,canLike:en(r,Y),createdAt:(l==null?void 0:l.time)||"",slugs:{question:`${t}/${e}`,answer:l==null?void 0:l.id},slug:n,author:{id:O.id,name:(E=O.data)==null?void 0:E.name,organization:(w=O.data)==null?void 0:w.organization,jobTitle:(N=O.data)==null?void 0:N.jobTitle,location:(L=O.data)==null?void 0:L.location,image:{thumbnail:((z=O.data)==null?void 0:z.thumbnail)||void 0}},userLiked:T,likes:((I=l==null?void 0:l.reaction_counts)==null?void 0:I.like)||0,comments:((H=l==null?void 0:l.reaction_counts)==null?void 0:H.reply)||0,peopleWhoLiked:Z},originalAuthorId:O==null?void 0:O.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(J,{body:j})=>b({content:j})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>x({activityId:n,reactionId:k})},comments:{openComments:()=>{}}}},n),a.jsx(si,{basePath:t,parentId:e,activityId:n,isMember:r,functions:{reactions:o,join:c,leave:f}})]})},fl=({id:t,data:{jobTitle:e,name:n,organization:r,thumbnail:i}})=>({id:t,name:n,jobTitle:e,organization:r,image:{thumbnail:i}}),Yr=[{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 Pt="notFoundError_",ml=()=>{const t=q.useIntl(),e=[];return Yr.forEach((n,r)=>{n.title=t.formatMessage({id:`${Pt}post_${r+1}`}),e.push("solutionArticle")}),a.jsxs(Ya,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:a.jsxs(Le,{children:[a.jsx(za,{cards:Yr,cardTypes:e,buildCardData:n=>new Promise((r,i)=>{r(n)})}),a.jsx(re,{href:"/solution-articles/",children:t.formatMessage({id:`${Pt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[a.jsx("h1",{children:t.formatMessage({id:`${Pt}title`})}),a.jsx("p",{children:t.formatMessage({id:`${Pt}text`})})]})};exports.ASSETS_BUCKET=Ae;exports.ActivitiesFeed=Hc;exports.ActivitySection=dl;exports.AddPost=Xn;exports.Banner=ts;exports.BannerSection=cs;exports.Breadcrumbs=ic;exports.Button=re;exports.ButtonWrapper=et;exports.CacheProvider=fa;exports.Card=Yn;exports.CardBlock=za;exports.Carousel=rc;exports.CollapsibleSection=qn;exports.Columns=Ha;exports.CommunityDetails=ac;exports.ContactFooter=gc;exports.ContactForm=Ba;exports.Contributors=Zn;exports.ConversationContext=Xt;exports.CookieBanner=Va;exports.Directory=Ko;exports.DiscussionConversation=Ka;exports.DiscussionForm=Jt;exports.DiscussionLikes=Ga;exports.DiscussionPost=_t;exports.DiscussionThread=Ja;exports.Divider=je;exports.DownloadSection=ns;exports.EMAILS=We;exports.EditSection=as;exports.EmailHelperTextBox=Oa;exports.EmptyStateBox=Be;exports.Filters=sc;exports.FlagsProvider=ma;exports.Footer=Qn;exports.Form=Qt;exports.FullWidthSection=Le;exports.GlobalProviders=ps;exports.Header=Jn;exports.HelperTextBox=va;exports.HiddenFromScreenReaders=Yt;exports.HideShowTextBox=hs;exports.HighlightSection=us;exports.HighlightedTextBox=Ne;exports.ImageContainer=Xi;exports.IntlProvider=pa;exports.InviteForm=qa;exports.InviteModal=Yo;exports.JoinButton=Kn;exports.LanguageSwitcher=cc;exports.Link=nt;exports.LoadMore=yt;exports.LoadingBlock=Ss;exports.LoadingPlaceholder=xe;exports.LoadingState=Un;exports.Logo=Gn;exports.LogoSection=is;exports.MarkdownText=ht;exports.MarketingBlock=ds;exports.Member=Gt;exports.MembersList=wc;exports.Modal=Vn;exports.MoreMenu=Za;exports.NUMBER_OF_USERS=Bi;exports.NavigationMenu=Wa;exports.NotFoundError=ml;exports.Overlay=bt;exports.PageHeading=ya;exports.PageLayout=Ya;exports.PasswordRules=Io;exports.Pill=Ve;exports.ProfileImageChange=qo;exports.ProfilePicture=Re;exports.ProgressBar=_a;exports.Rating=Lo;exports.RepliesFeed=si;exports.ResponsesHeading=Qa;exports.ResponsiveImage=tt;exports.ReturnToNavButton=es;exports.SearchForm=Ua;exports.ShareLinks=mc;exports.SignupForm=Vo;exports.Span=ba;exports.StatusBanner=gt;exports.Tabs=pc;exports.Tags=xc;exports.TestimonialBlock=js;exports.Toggle=Bo;exports.Tooltip=ua;exports.TopLevelPage=vc;exports.UserContext=Te;exports.UserProvider=ha;exports.VisuallyHidden=ge;exports.addAriaProps=Fa;exports.generateCssIcon=sa;exports.getMember=zn;exports.headerData=vt;exports.mapGetStreamData=fl;exports.pageReady=la;exports.passwordValidator=Gi;exports.repliesFeedMock=Vc;exports.useCurrentPath=Xr;exports.useEffectAfterMount=Ke;exports.useElementWidth=Xe;exports.useScrollListener=ta;exports.useScrollToHash=na;exports.useUser=Kt;
|
|
64
|
+
${lt(e,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:lt(e,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const fc="shareLinks_",mc=({title:t,link:e,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:s="default",className:o=""})=>{const c=q.useIntl(),f=dc({title:t,link:e,referrer:n});return a.jsxs("aside",{className:M("share-links",i,s,o),children:[a.jsx("p",{className:"text-small",children:c.formatMessage({id:"shareLinks_label"})}),a.jsx("ul",{children:f.map(({key:u,icon:d,url:l,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const b={};return p&&(b.onClick=_=>p(_,l)),a.jsx("li",{children:a.jsx(re,{size:i,variant:"tertiary",icon:{icon:d||u},href:l,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:c.formatMessage({id:`${fc}link_${u}`}),...b})},u)})})]})};const pc=({tabs:t,className:e="",preventLocationChange:n})=>{var u;const r=(d,l,m)=>(d||(d=`panel-${window.btoa(l)}-${m}`),d);let i=t.findIndex(d=>d.current===!0);if(i<0&&(i=0),window.location.hash){const d=window.location.hash.replace("#","");if(t.find(m=>m.id===d)){for(let m=0;m<t.length;m++)if(r(t[m].id,t[m].text,m)===d){i=m;break}}}const[s,o]=g.useState((u=t[i])!=null&&u.id?t[i].id:r(t[i].id,t[i].text,i));g.useEffect(()=>{if(t[i].hasCarousel){const d=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(d)}},[s]);const c=[],f=[];return t.forEach(({id:d,text:l,content:m,href:p,hasCarousel:b},_)=>{d=r(d,l,_);const x=s===d,v={};p||(v["aria-controls"]=d,v.onClick=y=>{y.preventDefault(),y.stopPropagation(),o(d),!n&&(window.location.hash=`#${d}`)},f.push(a.jsx("section",{id:d,hidden:!x,role:"tabpanel","aria-labelledby":`tab-${d}`,"aria-live":x?"assertive":"off",children:typeof m=="string"?a.jsx("p",{children:m}):m},`section-${d}`))),c.push(a.jsx("li",{"data-testid":"navigation-tab",children:a.jsx("a",{href:p||`#${d}`,id:`tab-${d}`,className:M({selected:x}),role:"tab","aria-selected":x,...v,children:l})},`tab-${d}`))}),a.jsxs("div",{className:M("tabs-wrapper",e),children:[a.jsx("ul",{className:"tabs",role:"tablist",children:c}),a.jsx("div",{className:"tab-content",children:f})]})};const hc={"2-1":901,"1-3":769,"1-1":769},Ha=({layout:t="2-1",hideOnMobile:e=!1,className:n="",children:r})=>{const i=Xe(!0);let s=r;return g.Children.count(r)===1&&(s=g.Children.toArray(r)[0],s.props&&(s=s.props.children)),a.jsx("section",{className:M("columns",`layout-${t}`,n),children:g.Children.map(s,(o,c)=>e!==!1&&c===e&&i&&i<hc[t]?null:o)})};let wn;const kn="contactFooter_",gc=({onSuccess:t=async()=>{},onFailure:e=()=>{}})=>{const n=g.useRef(null),[r,i]=g.useState(0),[s,o]=g.useState(!1),c=()=>{n.current&&i(n.current.clientHeight)},f=()=>{s||(o(!0),clearTimeout(wn),wn=setTimeout(()=>{c(),o(!1)},500))};return g.useEffect(()=>(c(),window.addEventListener("resize",f),()=>{clearTimeout(wn),window.removeEventListener("resize",f)}),[]),a.jsx(Le,{id:"contactForm",className:"contact-footer",children:a.jsxs("div",{className:"inner-wrapper",children:[a.jsx("h2",{children:a.jsx(q.FormattedMessage,{id:`${kn}title`})}),a.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:s?{}:{minHeight:r},children:[a.jsxs("aside",{children:[a.jsx("p",{children:a.jsx(q.FormattedMessage,{id:`${kn}text`})}),a.jsx(nt,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:a.jsx(q.FormattedMessage,{id:`${kn}email`})})]}),a.jsx(Ba,{functions:{onSuccess:t,onFailure:e},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},vc=({activeLink:t,...e})=>a.jsx(Le,{children:a.jsx(Ha,{layout:"1-3",children:a.jsxs(a.Fragment,{children:[a.jsx(Wa,{activeLink:t}),a.jsx(ya,{...e})]})})});const jn="cookieBanner_",Tn=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],En=new Date(Date.now()+12*30*24*60*60*1e3),Va=()=>{const t=q.useIntl(),[e,n,r]=Ln.useCookies(Tn),[i,s]=g.useState(!e["apol-cookie-banner"]),o=()=>{Tn.forEach(d=>{n(d,!0,{path:"/",expires:En,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),s(!1),window.location.reload()},c=()=>{n("apol-cookie-banner",!0,{path:"/",expires:En}),Tn.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:En});return}r(d)}),s(!1)};if(!i)return null;const f=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:c,gtmType:"reject-all"},{id:"accept",onClick:o,gtmType:"accepted-all"}],u=[];return f.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:t.formatMessage({id:`${jn}buttons_${d.id}`})})}),a.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[a.jsx("h6",{children:t.formatMessage({id:`${jn}title`})}),a.jsx("p",{children:t.formatMessage({id:`${jn}text`})}),a.jsx(et,{buttons:u})]})},Me={platform:{order:["events","courses","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:We["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:We["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:We.support,gtmType:"concierge-email-click"},business:{email:We.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const He="footer_",zt="SiteFooter",Lr=({group:t})=>{const e=Me[t].order||[];let n=!1;return"text"in Me[t]&&(n=Me[t].text),a.jsxs(g.Fragment,{children:[a.jsx("p",{className:"pre-title",children:a.jsx(q.FormattedMessage,{id:`${He}${t}`})}),Array.isArray(e)&&e.length>0&&a.jsx("ul",{className:"text-medium",children:e.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:s}=Me[t][r],o={};return["legal"].includes(t)&&(o.target="_blank",o.rel="noopener"),a.jsx("li",{children:a.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":s,...o,children:a.jsx(q.FormattedMessage,{id:`${He}${t}_${r}`})})},`${t}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&a.jsx("dl",{className:"text-medium",children:n.order.map(r=>a.jsxs(g.Fragment,{children:[a.jsx("dt",{children:a.jsx(q.FormattedMessage,{id:`${He}${t}_${r}`})}),a.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&a.jsx("address",{children:a.jsx(q.FormattedMessage,{id:`${He}${t}_${r}_address`,values:{br:a.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&a.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${t}-${r}`))})]},t)},Qn=()=>a.jsx("div",{id:"footer",children:a.jsxs("div",{className:"wrapper",children:[a.jsx(Yt,{element:"hr"}),a.jsx(Gn,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":"logo-homepage-link"}),a.jsx("footer",{children:["platform","community","company","contact"].map(t=>a.jsxs("div",{className:"group",children:[a.jsx(Lr,{group:t}),Object.keys(Me[t]).includes("child")&&a.jsx(Lr,{group:Me[t].child})]},t))}),a.jsx("hr",{}),a.jsxs("div",{className:"sub-footer",children:[a.jsx("ul",{children:Array.isArray(Me.social.order)&&Me.social.order.map(t=>{const e=Me.social[t];return a.jsx("li",{className:t,children:a.jsx("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":zt,"data-gtm-event-type":"social-click",children:a.jsx("span",{className:"hidden",children:a.jsx(q.FormattedMessage,{id:`${He}social_${t}`})})})},t)})}),a.jsx("small",{children:a.jsx(q.FormattedMessage,{id:`${He}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),ue={timeouts:{},handlerCalled:{},getIsDesktopVersion:(t,e)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=s=>{const o=`logged${t?"In":"Out"}`;return e>=n[s][o]};let i={};return["navigation","search"].forEach(s=>{i[s]=r(s)}),i},shouldChangeHeaderIsVisible:(t,e,n)=>{Object.values(e).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:t}])},handleMenus:({id:t,value:e,menus:n,dispatch:r})=>{if(n[t]===e||t==="account"&&e===!1&&n.navigation===!0)return;const i=Date.now();if(!e&&ue.handlerCalled[t]&&i-ue.handlerCalled[t]<500)return;ue.handlerCalled[t]=i;let s=[{type:`menus.${t}`,value:e}];e===!0&&Object.keys(n).forEach(o=>{o===t||n[o]===!1||s.push({type:`menus.${o}`,value:!1})}),r(s)},findFirstChild:(t,e,n=!1)=>{if(!t||!t[0])return!1;for(let r=0;r<=t.length;r++){if(!t[r])continue;if(t[r][e]&&(!n||t[r][e].includes(n)))return t[r];if(!e.includes("."))continue;const i=Kr(t[r],e);if(!(typeof i>"u")&&(!n||i[e]&&i[e].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return t[r]}return t[0].children?ue.findFirstChild(t[0].children,e,n):!1},autoFocus:({menu:t,navigationRef:e,isDesktopVersion:n,focusElements:r,dispatch:i})=>{if(!e.current||!e.current.children)return;const s=n?"desktop":"default";if(r[t][s]){r[t][s].focus();return}let o,c;switch(t){case"navigation":if(n){const f=ue.findFirstChild(e.current.children,"attributes.aria-controls","navigation");o=ue.findFirstChild(f.children,"href")}else o=ue.findFirstChild(e.current.children,"href");o||(o=e.current);break;case"account":if(c=ue.findFirstChild(e.current.children,"className","account"),!c||!c.children)return;o=ue.findFirstChild(c.children,"href");break;default:return}o&&(i([{type:`focusElements.${t}.${s}`,value:o}]),o.focus())},events:{onClick:(t,{id:e,callback:n,isOpen:r})=>{t.target&&t.target.attributes&&t.target.attributes.href||(t.preventDefault(),t.stopPropagation(),clearTimeout(ue.timeouts[e]),n(e,!r))},onFocus:({id:t})=>{clearTimeout(ue.timeouts[t])},onMouseEnter:({id:t,callback:e})=>{clearTimeout(ue.timeouts[t]),e(t,!0)},onBlur:({id:t,callback:e})=>{ue.timeouts[t]=setTimeout(()=>{e(t,!1)},250)}}},vt={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"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:{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:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Zt=({id:t,isLoggedIn:e=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:s=null})=>{const o=q.useIntl(),c=Kr(vt,t);if(!c||c.onlyShow&&(c.onlyShow==="logged-in"&&!e||c.onlyShow==="logged-out"&&e))return null;const f="doTrack"in c,u=s===null?f?c.doTrack:!0:s,d=t.includes("buttons.");let l=`header_${t.replaceAll(".","_")}`;c.hasVariantText&&(l+=`_logged${e?"In":"Out"}`);let m=!1;if(c.href){let y=c.gtmType||`${t}-click`;if(y.includes(".")){const S=y.split("."),T=S[S.length-2];y=`${T==="topics"?`${T}-`:""}${S[S.length-1]}`}m={href:c.href,role:"menuitem"},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":y,"data-gtm-event-context":"HeaderButtons"}),d&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...c.props||{}})}const p=c.order&&c.order[0]&&c[c.order[0]],b=p&&c[c.order[0]].order,_=m&&window.location.pathname===c.href;let x={},v={};if(p){const y=c.menuId||t,S={onClick:T=>ue.events.onClick(T,{id:y,callback:i,isOpen:r[y]}),onFocus:()=>ue.events.onFocus({id:y}),onBlur:()=>ue.events.onBlur({id:y,callback:i}),onMouseLeave:()=>ue.events.onBlur({id:y,callback:i}),onMouseEnter:()=>ue.events.onMouseEnter({id:y,callback:i})};n&&(b&&(x={...S,onKeyPress:T=>{T.key==="Enter"&&ue.events.onClick(T,{id:y,callback:i,isOpen:r[y]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[y],"aria-controls":y}),v={hidden:y in r?!r[y]:!0}),b||(v={...v,...S})}return a.jsxs("li",{className:M({[c.className]:c.className,"has-submenu":p,parent:b,active:_}),role:"none",...x,children:[m?g.createElement(d?re:"a",m,o.formatMessage({id:l})):o.formatMessage({id:l}),c.order&&a.jsx("ul",{...v,children:c.order.map(y=>{if(!c[y])return null;const S={isLoggedIn:e,isDesktopVersion:n,menus:r,callback:i,doTrack:f?u:null};return c[y].order?a.jsxs("li",{className:M({[c[y].className]:c[y].className}),children:[o.formatMessage({id:`${l}_${y}`}),a.jsx("ul",{children:c[y].order.map(T=>a.jsx(Zt,{id:`${t}.${y}.${T}`,...S},T))})]},y):a.jsx(Zt,{id:`${t}.${y}`,...S},y)})})]},t)};const bc={height:67,height_desktop:83},Jn=({showNavigation:t=!0})=>{const e=q.useIntl(),n=g.useContext(Te),r=Xe(!0,!0),i=n&&typeof n.id=="string",s=g.useMemo(()=>ue.getIsDesktopVersion(i,r),[i,r]),[o,c]=g.useReducer(ra,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:f,menus:u,focusElements:d}=o;ta({scrollPosition:bc[`height${s.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!s&&u.navigation||ue.shouldChangeHeaderIsVisible(!0,u,c)},scrollDown:()=>{!s&&u.navigation||ue.shouldChangeHeaderIsVisible(!1,u,c)}}});const l=(p,b)=>{ue.handleMenus({id:p,value:b,menus:u,dispatch:c})},m=g.useRef(null);return Ke(()=>{u.navigation&&ue.autoFocus({menu:"navigation",navigationRef:m,isDesktopVersion:s.navigation,focusElements:d,dispatch:c})},[u.navigation]),Ke(()=>{u.account&&ue.autoFocus({menu:"account",navigationRef:m,isDesktopVersion:s.navigation,focusElements:d,dispatch:c})},[u.account]),n&&n.isLoading?null:a.jsxs(a.Fragment,{children:[a.jsxs("nav",{id:"header",className:M({"logged-in":i,"logged-out":!i,visible:f}),children:[a.jsx(ge,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),a.jsx(Gn,{}),t&&a.jsxs(a.Fragment,{children:[!s.navigation&&a.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),l("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:a.jsx(ge,{children:e.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),a.jsx("ul",{ref:m,id:"navigation",hidden:s.navigation||u.account?!1:!u.navigation,role:"menu","data-showing":!s.navigation&&u.account?"account":"default",children:vt.order.map(p=>a.jsx(Zt,{id:p,isLoggedIn:i,isDesktopVersion:s.navigation,menus:{navigation:u.navigation,account:u.account},callback:l},p))}),!s.search&&a.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),l("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:a.jsx(ge,{children:e.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),a.jsx(Ua,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:s.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),i?a.jsxs("button",{className:"account-button",onClick:p=>ue.events.onClick(p,{id:"account",callback:l,isOpen:u.account}),onMouseEnter:()=>ue.events.onMouseEnter({id:"account",callback:l}),onMouseLeave:()=>ue.events.onBlur({id:"account",callback:l}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[a.jsx(ge,{children:e.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),a.jsx(Re,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):a.jsx("ul",{className:"sign-in-buttons",children:vt.buttons.order.map(p=>a.jsx(Zt,{id:`buttons.${p}`},p))})]})]}),a.jsx("hr",{id:"content-of-page"}),a.jsx("div",{className:M("overlay",{open:u.navigation||u.account||!s.search&&u.search})})]})};const yc=()=>{const t=q.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(Jn,{}),a.jsx("div",{id:"content",children:a.jsx(Be,{variant:"error",text:t.formatMessage({id:"pageLayout_error"})})}),a.jsx(Qn,{})]})},Ya=({children:t,additionalContent:{prepended:e,appended:n}={},reportError:r,forceShow:i={},styling:s={},className:o="",locale:c="en"})=>{const{navigation:f=!0,footer:u=!0}=i,{background:d="default",variant:l="default",circle:m="default"}=s,p=Xr();g.useEffect(()=>{window.scrollTo(0,0)},[p]);const b=Ft(t,{locale:c}),_=Ft(e,{locale:c}),x=Ft(n,{locale:c}),v={};return d!=="default"&&(v[d]=!0),l!=="default"&&(v[l]=!0),m!=="default"&&(v[m]=!0),a.jsx(Ni.ErrorBoundary,{onError:r,fallback:a.jsx(yc,{}),children:a.jsx(g.Suspense,{fallback:null,children:a.jsxs("div",{id:"wrapper",className:M(o,v,{"has-footer":u}),children:[a.jsx(Jn,{showNavigation:f}),a.jsxs("section",{id:"content-wrapper",children:[_&&a.jsx("div",{className:"additional-content prepended",children:_}),g.createElement(d==="bold"?Vn:"div",{id:"content",children:b})]}),x&&a.jsx("div",{className:"additional-content appended",children:x}),u&&a.jsx(Qn,{}),a.jsx(Va,{})]})})})},Br={default:"tags_",headerTopics:"header_topics_topics_"},Sn={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"},_c={getTagDetails:t=>{if(t.includes("topic_")){if(t=Sn.topic[t.replace("topic_","")],t){const e=vt.topics.topics[t].href;return e?{id:t,href:e,text:`${Br.headerTopics}${t}`}:null}return null}return Sn[t]?(t=Sn[t],{id:t,text:`${Br.default}${t}`}):null}};const xc=({tags:t=[],color:e="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:s="tag-click",gtmContext:o="tags"})=>{const c=q.useIntl();if(!t||t.length<1)return null;const f=[];return t.forEach(u=>{if(!u)return;const d=_c.getTagDetails(u);d&&f.push(d)}),f.length<1?null:a.jsx("ul",{className:M("tags text-small",e,i,{"one-line":n}),children:f.map(u=>{const d=c.formatMessage({id:u.text});return a.jsx("li",{children:u.href&&r?a.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":s,"data-gtm-event-context":o,children:d}):d},u.id)})})};const wc=({members:{data:t=[],total:e=t.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:i="member",gtmType:s="member-click",className:o=""})=>{const c=q.useIntl();return t.length===0?null:a.jsxs("div",{className:M("members-list",o),children:[a.jsxs("h1",{children:[c.formatMessage({id:"membersList"}),a.jsx("span",{className:"count",children:e})]}),a.jsx("ul",{children:t.map((f,u)=>a.jsxs("li",{children:[a.jsx(Gt,{member:f,gtmContext:i,gtmType:s}),f.isAdmin&&a.jsx(Ve,{children:c.formatMessage({id:"membersList_admin"})})]},u))}),n&&a.jsx(yt,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:i})]})};let $t=null;const ye="discussion_form_",Jt=({content:t={type:"response",slugs:{}},userHasPermissions:e=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},inputRef:r,placeholder:i,maxLength:s=5e4,minRows:o=4,forceShow:c={cancel:!1,error:!1},functions:f={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:u="DiscussionForm"})=>{var D,C,E;const d=q.useIntl(),l=g.useContext(Te),[m,p]=g.useState(n.isEditing&&n.isEditing.text||""),[b,_]=g.useState(c.error||!1),[x,v]=g.useState(!1),y=g.useRef(null);if(r||(r=y),n.isLoading)return a.jsx(xe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const S=w=>{const N=w.target.value;p(N);let L;!l||!l.id?L=ke(d.formatMessage,`${ye}error_loggedOut`,t.type,"action"):e?N.length>=s&&(L=`${ye}error_tooLong`):L=ke(d.formatMessage,`${ye}error_noPermission`,t.type,"action"),L?_(L):b&&_(!1)};let T=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const w=((D=t.slugs)==null?void 0:D.reply)||((C=t.slugs)==null?void 0:C.answer)||((E=t.slugs)==null?void 0:E.question)||"";w&&(T=`${T}-${w.slice(-15)}`)}const k=async w=>{var L;if(w.preventDefault(),w.stopPropagation(),!l||!l.id||!e||O)return;$t&&clearTimeout($t),v("submitting");const N=window.location.pathname;try{let z;switch(t.type){case"post":z=await f.create({content:m});break;case"question":z=await f.create({title:m,authorId:l&&l.id,...(L=f.props)==null?void 0:L.create});break;case"response":z=await f.create({questionSlug:t.slugs.question},{body:m,authorId:l&&l.id,contentPath:N});break;case"reply":z=await f.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:m,authorId:l&&l.id,contentPath:N});break;default:break}await zi(1e3),f.callback&&await f.callback(z),$t=setTimeout(()=>{p(""),v("submitted");const I=new Event("discussionFormSubmitted");document.dispatchEvent(I),Z()},500)}catch(z){const I=z;let H=`${ye}error`;I!=null&&I.message.includes("entry already exists")&&(H=ke(d.formatMessage,`${ye}error_alreadyExists`,t.type,"action")),I!=null&&I.message.includes("429")?H=ke(d.formatMessage,`${ye}error_tooMany`,t.type,"action"):I!=null&&I.message.includes("400")&&(H=`${ye}error`),_(H),Z()}},Z=()=>{$t=setTimeout(()=>{_(!1),v(!1)},5e3)},O=!m||!Ki(m),Y=x==="submitting",R=[];return(n.isEditing&&!Y||c.cancel)&&R.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:f.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!c.cancel&&(!l||!l.id||!m),children:d.formatMessage({id:`${ye}cancel`})}),R.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:w=>{if(n.isEditing){v("submitting"),f.handleSaveEdit&&f.handleSaveEdit(y.current&&"value"in y.current?y.current.value:"");return}k(w)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!l||!l.id||!e||O||Y||n.isEditing&&m===n.isEditing.text,children:d.formatMessage({id:`${ye}${Y?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),a.jsxs("form",{id:T,className:M("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(t.type)&&a.jsx("h2",{children:ke(d.formatMessage,`${ye}title`,t.type,"action")}),a.jsx(Gt,{member:l||"community",gtmContext:u,gtmType:"profile-click"}),a.jsx(ge,{element:"label",showOnFocus:!1,htmlFor:`${T}-input`,children:ke(d.formatMessage,`${ye}label`,t.type,"action")}),a.jsx($i,{ref:r,id:`${T}-input`,name:t.type,placeholder:i||ke(d.formatMessage,`${ye}placeholder`,t.type,"action"),onChange:S,value:x==="submitting"&&!b?"":m,maxLength:s,"aria-invalid":!!b,"aria-errormessage":"error-message",minRows:o,autoFocus:!!n.isEditing}),a.jsx("small",{children:ke(d.formatMessage,`${ye}explainer`,t.type,"action",{a:w=>a.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:w})})}),a.jsx(et,{buttons:R}),x==="submitted"&&n.showSuccessMessage&&a.jsx(gt,{className:"success","data-testid":"success",children:ke(d.formatMessage,`${ye}success`,t.type,"action")}),b&&a.jsx(gt,{id:"error-message",className:"error","data-testid":"error",children:c.error?c.error:typeof b=="string"?b.includes(" ")?b:d.formatMessage({id:b},{action:d.formatMessage({id:`discussion_action_${t.type}`}),maxLength:s}):b})]})},Xn=({form:t,membershipRequiredToPost:{isMember:e,required:n,join:r,leave:i,notMemberStateText:s}})=>{if(n&&!e)return a.jsx(Be,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:a.jsx(Kn,{isShort:!0,functions:{join:r,leave:i}})}});const{content:o,functions:c,meta:f,...u}=t;return a.jsx(Jt,{content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...c,create:(c==null?void 0:c.create)||(()=>{})},meta:{...f,isEditing:(f==null?void 0:f.isEditing)||!1,showSuccessMessage:!1},...u})},kc={showForm:!1},Xt=g.createContext(kc),Ka=({children:t})=>{const[e,n]=g.useState({showForm:!1});return a.jsx(Xt.Provider,{value:{...e,updateConversation:n},children:t})},jc=({question:t,answer:e,reply:n})=>({...t&&{questionSlug:t},...e&&{answerSlug:e},...n&&{replySlug:n}}),Tc=(t,e=10)=>!t||t.length===0?[]:t.slice(0,e);let pt=!1;const Cn=()=>{pt!==!1&&(clearTimeout(pt),pt=!1)},Mn=5,Ga=({element:t="div",likes:e=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:s={type:"reply",slugs:{}},canLike:o=!0,functions:{createLike:c=()=>{},deleteLike:f=()=>{}}={}})=>{const u=q.useIntl();g.useEffect(()=>{p(i)},[i]);const[d,l]=g.useState(e),[m,p]=g.useState(i),[b,_]=g.useState(!1),[x,v]=g.useState(!1),y=g.useMemo(()=>Tc(n,Mn),[n]),S=k=>{if(k.preventDefault(),k.stopPropagation(),v(!1),pt)return Cn(),!1;if(Cn(),b||!o)return!1;pt=setTimeout(T,350)},T=async()=>{if(Cn(),b||!o)return!1;let k=m?d-1:d+1;k<0&&(k=0),_(!0),l(k),p(!m);try{if(s&&s.slugs){const Z=jc(s.slugs);m?await f(Z):await c({...Z,payload:{contentPath:window.location.pathname}})}}catch{l(e),p(i)}finally{_(!1)}};return g.createElement(t,{className:M("likes-wrapper text-medium action-button",{"show-spinner":b,"is-liked":m,disabled:!o}),onClick:S,onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onFocus:()=>{v(!0)},onBlur:()=>{v(!1)},children:a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"tertiary",size:"medium",icon:{icon:m?"heart":"heart_empty",animate:"bounce"},className:M({"do-animation":m&&!i}),screenreaderText:o?u.formatMessage({id:`discussion_likes_${m?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${s.type}`})}):!1,onClick:S,disabled:!o,"aria-hidden":!o,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${s.type}-click`}),a.jsx("span",{className:M("number-of-likes",{"no-likes":d===0}),"data-testid":"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:d})}),n&&a.jsx(ua,{isOpen:x,isLoading:n.length===0,children:n.length&&a.jsxs("ul",{children:[y.map(k=>typeof k=="string"||!k.name?null:a.jsx("li",{children:a.jsx(nt,{href:k.id?`/profiles/${k.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:Z=>Z==null?void 0:Z.stopPropagation(),children:k.name})},k.id||window.btoa(k.name))),e>Mn&&a.jsx("li",{children:u.formatMessage({id:"discussion_likes_more"},{number:e-Mn})})]})})]})})},qr=t=>{const e={};return Object.keys(t).forEach(n=>n.includes("Id")?e[n]=t[n]:e[`${n}Slug`]=t[n]),e},en=(t,e)=>t&&!e;const Ce="discussion_",Ec=280,_t=({element:t="div",content:e,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:i,forceHide:s={comments:!1,likes:!1},functions:{content:{createContent:o,deleteContent:c,updateContent:f}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:d}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:l}={openComments:()=>{}}},links:m={},className:p,gtmContext:b="DiscussionAnswer",children:_,isTruncated:x=!1})=>{const v=q.useIntl(),y=g.useContext(Te),S=g.useContext(Xt),{author:T,canLike:k,createdAt:Z,id:O,likes:Y=0,userLiked:R,comments:D=0}=e,C=y&&y.id&&typeof T!="string"&&T.id&&T.id===y.id||!1,E=typeof k=="boolean"?k:n?!C:!1,w=C&&(!e.createdAt||Ui(e.createdAt,10,"seconds")),N=g.useRef(null),[L,z]=g.useState({body:e&&e.body||"",isEditing:!1,didEdit:e&&e.isEdited||!1}),[I,H]=g.useState(!1),[J,j]=g.useState(w?"highlighted":"default"),[$,W]=g.useState("");g.useEffect(()=>{const F=N.current;if(!(!F||J==="default"))return document.addEventListener("discussionFormSubmitted",U),F.addEventListener("transitionend",V),()=>{document.removeEventListener("discussionFormSubmitted",U),F.removeEventListener("transitionend",V)}},[]),g.useEffect(()=>{z({...L,body:e&&e.body||"",didEdit:e&&e.isEdited||!1})},[e.isEdited]);const U=()=>{setTimeout(()=>{j("fading")},1e3)},V=({propertyName:F})=>{F==="background-color"&&j(ie=>(ie==="default"&&(document.removeEventListener("discussionFormSubmitted",U),N.current&&N.current.removeEventListener("transitionend",V)),ie==="fading"?"default":ie))};if(r||!e||e.type==="answer"&&(!e.slugs||!e.slugs.question))return a.jsx(xe,{className:"discussion-card discussion-post"});const ee=x?Ye(L.body,Ec):L.body,G=async F=>{F||(F=""),W("");try{if(!Pi(F,L.body)){const ie=e.type==="question"?{title:F}:{body:F};await f(qr(e.slugs),ie)}z({body:F,isEditing:!1,didEdit:!0})}catch{W(`${Ce}form_error`)}},K=()=>{S&&S.updateConversation&&S.updateConversation({showForm:!0}),setTimeout(()=>{var Ee,we,Fe;const ie=`reply-form-${(e.type==="answer"?e.slug:((Ee=e.slugs)==null?void 0:Ee.reply)||((we=e.slugs)==null?void 0:we.answer)||((Fe=e.slugs)==null?void 0:Fe.question)||"").toLowerCase().slice(-15)}`,A=document.getElementById(ie),he=document.getElementById(`${ie}-input`);he&&he.focus(),A&&A.scrollIntoView({behavior:"smooth"})},0)},X=async()=>{H(!1);try{await c(qr(e.slugs))}catch{W("delete-error")}},ne=[{text:v.formatMessage({id:`${Ce}moreMenu_report`}),onClick:F=>{F.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Ce}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${Ce}report_body`},{contentType:e.type||"",contentSlug:e.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${e.slugs.question||""}`}))}`,icon:"flag"}];return n&&C&&ne.push({text:v.formatMessage({id:`${Ce}moreMenu_edit`}),onClick:()=>z({...L,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`edit-${e.type}-click`},{text:v.formatMessage({id:`${Ce}moreMenu_delete`}),onClick:F=>{F.preventDefault(),F.stopPropagation(),H(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`delete-${e.type}-click`,...Fa(`delete-${e.slug}-modal`,I)}),g.createElement(t,{className:M("discussion-post",p,{[J]:!p||!p.includes("highlighted-text-box")}),ref:N,"data-testid":`discussion-${e.type}-thread`,children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{id:O||e.slug,className:M("discussion-card",e.type,{editing:L.isEditing,"has-link":m.post&&!L.isEditing}),onClick:F=>{!m.post||L.isEditing||(F.preventDefault(),F.stopPropagation(),window.location.href=m.post)},children:[!L.isEditing&&a.jsx(Gt,{member:T,additionalContent:{createdAt:Z,didEdit:L.didEdit},className:typeof T!="string"&&T.id===i?"highlighted":"",gtmContext:b,gtmType:"profile-click"}),L.isEditing?a.jsx(Jt,{content:{type:e.type,slugs:e.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:L.body}},maxLength:e.type==="question"?250:5e4,forceShow:{error:$!==""&&$!=="delete-error"?v.formatMessage({id:$},{action:v.formatMessage({id:`discussion_action_${e.type}`})}):!1},functions:{create:o,handleSaveEdit:G,handleCancel:()=>{W(""),z({...L,isEditing:!1})}},gtmContext:`${b}Form`}):m.post?a.jsx("a",{href:m.post,className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":"title-click",children:a.jsx(ht,{options:{overrides:{a:ba}},children:ee})}):a.jsx(ht,{options:{wrapper:e.type==="question"?"h1":g.Fragment,forceWrapper:e.type==="question",forceInline:e.type==="question",forceBlock:e.type!=="question"},children:ee}),!L.isEditing&&a.jsxs("ul",{className:M("actions text-medium",e.type),"data-testid":`${e.type}-actions`,children:[!s.likes&&a.jsx(Ga,{element:"li",likes:Y,isShort:!1,userLiked:R,content:{type:e.type,slugs:e.slugs},canLike:E,peopleWhoLiked:e.peopleWhoLiked,functions:{createLike:u,deleteLike:d}}),!s.comments&&(["question","post"].includes(e.type)||m.comments||typeof l=="function")&&a.jsxs("li",{className:"action-button",onClick:F=>{F.preventDefault(),F.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof l=="function"&&l()},children:[a.jsx(re,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:m.comments?m.comments:!1,onClick:m.comments||typeof l!="function"?!1:l,className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`answer-${e.type}-click`,screenreaderText:v.formatMessage({id:`${Ce}comments_screenReader`},{count:D})}),a.jsx("span",{children:v.formatMessage({id:`${Ce}comments`},{count:D})})]}),(e.type==="answer"||e.type==="reply")&&a.jsx("li",{children:a.jsx(re,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:K,children:v.formatMessage({id:`${Ce}reply`})})}),a.jsx(Za,{element:"li",id:`more-${e.slug}`,options:ne})]})]}),_,a.jsx(bt,{id:`delete-${e.slug}-modal`,isOpen:I,functions:{onOpen:()=>{},onClose:()=>H(!1)},forceShow:{error:$==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${e.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${e.type}`})}),buttons:[{variant:"secondary",onClick:()=>H(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:X,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}:${e.slug}`,children:a.jsx(q.FormattedMessage,{id:"discussion_delete_text",values:{p:F=>a.jsx("p",{children:F}),action:v.formatMessage({id:`discussion_action_${e.type}`})}})})]})})};const Nn="discussion_responses_",Qa=({type:t="answer",responses:e=0})=>{const n=q.useIntl();return e=parseInt(e),a.jsxs("div",{className:"responses-heading",children:[a.jsx("h4",{children:n.formatMessage({id:`${Nn}title`},{action:n.formatMessage({id:`${Nn}${t}`}),count:e})}),e===0&&a.jsx("p",{children:ke(n.formatMessage,`${Nn}empty`,t,t)})]})};const Ja=({loadMore:{isLoading:t,hasNextPage:e,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const s=q.useIntl(),o=g.useContext(Xt),c=Ft(i,{element:"li"});return a.jsxs("div",{className:"thread-wrapper",children:[!Object.is(c,null)&&a.jsx("ul",{className:"thread",children:c}),!t&&a.jsx(yt,{hasNextPage:e,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:s.formatMessage({id:"discussion_thread_loadMore"}),error:s.formatMessage({id:"loadMore_error"})}}),r&&o.showForm&&a.jsx(Jt,{...r})]})},Sc="post",Cc="reply",Xa="00000000-0000-0000-0000-000000000000";function er({queryClient:t,queryKey:e}){function n(r,i,s){t.setQueryData(e,s)}return n}function tr({queryClient:t,queryKey:e}){async function n(r){await t.cancelQueries({queryKey:e});const i=t.getQueryData(e);return t.setQueryData(e,r),i}return n}function Mc(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Nc(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function ei(t){const{id:e="",name:n="",organization:r="",jobTitle:i="",image:s={}}=t,{thumbnail:o=""}=s;return{id:e,data:{name:n,organization:r,jobTitle:i,thumbnail:o}}}function $c({content:t}){return{content:t,id:Xa,time:new Date().toISOString(),verb:Sc}}function Ur({activity:t,user:e}){return{...t,actor:ei(e),...Mc()}}function Wt({activity:t,reaction:e}){var n,r,i;e?(t.latest_reactions={...t.latest_reactions||{},like:[...((r=t.latest_reactions)==null?void 0:r.like)||[],e]},t.own_reactions={...t.own_reactions||{},like:[...((i=t.own_reactions)==null?void 0:i.like)||[],e]}):t.reaction_counts={...t.reaction_counts||{},like:(n=t.reaction_counts)!=null&&n.like?t.reaction_counts.like+1:1}}function ti({activity:t,user:e}){var n,r,i;t.reaction_counts={...t.reaction_counts||{},like:(n=t.reaction_counts)!=null&&n.like?t.reaction_counts.like-1:0},e!=null&&e.id&&(t.latest_reactions={...t.latest_reactions||{},like:(((r=t.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:s})=>s!==e.id)},t.own_reactions={...t.own_reactions||{},like:(((i=t.own_reactions)==null?void 0:i.like)||[]).filter(({user_id:s})=>s!==e.id)})}function Pc({activityId:t,replyId:e,content:n}){return{activity_id:t,data:{content:n},id:Xa,kind:Cc,parent:e||""}}function zr({reply:t,user:e}){const n=ei(e);return{...t,user_id:n.id,user:n,...Nc()}}function Zr({reply:t,reaction:e}){var n,r,i;e?(t.latest_children={...t.latest_children||{},like:[...((r=t.latest_children)==null?void 0:r.like)||[],e]},t.own_children={...t.own_children||{},like:[...((i=t.own_children)==null?void 0:i.like)||[],e]}):t.children_counts={...t.children_counts||{},like:(n=t.children_counts)!=null&&n.like?t.children_counts.like+1:1}}function Rc({reply:t,user:e}){var n,r,i;t.children_counts={...t.children_counts||{},like:(n=t.children_counts)!=null&&n.like?t.children_counts.like-1:0},e!=null&&e.id&&(t.latest_children={...t.latest_children||{},like:(((r=t.latest_children)==null?void 0:r.like)||[]).filter(({user_id:s})=>s!==e.id)},t.own_children={...t.own_children||{},like:(((i=t.own_children)==null?void 0:i.like)||[]).filter(({user_id:s})=>s!==e.id)})}const ni=t=>{const e=new CustomEvent("discussionPostAdded",{detail:t});document.dispatchEvent(e)};let Wr,$n=0;const ri=()=>{g.useEffect(()=>(document.addEventListener("discussionPostAdded",t),()=>{document.removeEventListener("discussionPostAdded",t)}),[]);const t=e=>{const n=e.detail;if(!n)return;clearTimeout(Wr);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),$n=0;return}$n++,!($n>10)&&(Wr=setTimeout(()=>{t(e)},50))}},Qe=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),Pe=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),ai=Object.freeze({actor:`SU:${Qe.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),Fc=Object.freeze({actor:`SU:${Pe.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Oc=Object.freeze({actor:`SU:${Qe.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),Dc=Object.freeze({actor:`SU:${Pe.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:ai.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Pe.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Pe.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:Pe.id,user:{id:Pe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ai.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Qe.id,user:{id:Qe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Fc.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Pe.id,user:{id:Pe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Oc.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Qe.id,user:{id:Qe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Dc.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Ac({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i,user:s}){const{mutate:o}=me.useMutation({mutationFn:t,onMutate:c=>e(f=>{const u=Ur({activity:$c(c),user:s});return Hr(u,f)}),onError:n,onSuccess:(c,f,u)=>{const d=Ur({activity:c,user:s});r.setQueryData(i,Hr(d,u,!0)),setTimeout(()=>{ni(d.id)},0)}});return o}function Ic({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({activityId:i,content:s})=>e(o=>{const c=Ht(i,o);return c&&(c.content=s),o}),onError:n});return r}function Lc({queryFns:{create:t,edit:e,like:n,list:r,remove:i,unlike:s},queryKey:o}){const c=me.useQueryClient(),f=Kt(),u={queryClient:c,queryKey:o},d={mutationHandlers:{error:er(u),mutate:tr(u)},user:f,...u},l=Ac({...d,mutationFn:t}),m=Ic({...d,mutationFn:e}),p=Bc({...d,mutationFn:n}),b=Uc({...d,mutationFn:i}),_=zc({...d,mutationFn:s}),{activities:x,...v}=qc({queryKey:o,queryFn:r});return{activities:x,mutations:{create:l,edit:m,remove:b,like:p,unlike:_},user:f,...v}}function Bc({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i}){const{mutate:s}=me.useMutation({mutationFn:t,onMutate:({activityId:o})=>e(c=>{const f=Ht(o,c);return f&&Wt({activity:f}),c}),onError:n,onSuccess:(o,{activityId:c},f)=>{const u=Ht(c,f);u&&Wt({activity:u,reaction:o}),r.setQueryData(i,f)}});return s}function qc({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}=me.useInfiniteQuery({queryKey:e,queryFn:t,initialPageParam:{next:null},getNextPageParam:c=>(c==null?void 0:c.next)||null});return{activities:Wc(n),error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Uc({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({activityId:i})=>e(s=>Zc(i,s)),onError:n});return r}function zc({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:i}=me.useMutation({mutationFn:t,onMutate:({activityId:s})=>e(o=>{const c=Ht(s,o);return c&&ti({activity:c,user:r}),o}),onError:n});return i}function Hr(t,e,n=!1){return e?(n?e.pages[0].results[0]=t:e.pages[0].results=[t,...e.pages[0].results],e):{pages:[{next:"",results:[t]}],pageParams:[""]}}function Ht(t,e){if(e)for(const{results:n}of e.pages){const r=n.find(({id:i})=>i===t);if(r)return r}}function Zc(t,e){for(const{results:n}of e.pages){const r=n.findIndex(({id:i})=>i===t);if(r!==-1){n.splice(r,1);break}}return e}function Wc(t){var e;return((e=t==null?void 0:t.pages)==null?void 0:e.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Hc=({basePath:t,parentId:e,isMember:n,functions:{activities:r,join:i,leave:s}})=>{const o=q.useIntl(),{activities:c,error:f,fetchNextPage:u,hasNextPage:d,isLoading:l,mutations:{create:m,edit:p,remove:b,like:_,unlike:x},user:v}=Lc({queryKey:[t,e,"activities"],queryFns:r});if(ri(),f)return a.jsx(Be,{variant:"error",text:f.message});const y=(c==null?void 0:c.length)||0;return a.jsxs("section",{children:[a.jsx(Xn,{form:{content:{type:"post",slugs:{}},functions:{create:m},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),c==null?void 0:c.map((S,T)=>{var L,z,I,H,J,j,$,W;const{id:k,own_reactions:Z,latest_reactions:O,reaction_counts:Y}=S,R=(((L=O==null?void 0:O.like)==null?void 0:L.length)||0)>0,D=(((z=Z==null?void 0:Z.like)==null?void 0:z.length)||0)>0,C=D?Z==null?void 0:Z.like[0].id:"",E=R?(I=O==null?void 0:O.like)==null?void 0:I.map(U=>{var V,ee,G;return{id:(V=U==null?void 0:U.user)==null?void 0:V.id,name:(G=(ee=U==null?void 0:U.user)==null?void 0:ee.data)==null?void 0:G.name}}):!1,w=S==null?void 0:S.actor,N=(w==null?void 0:w.id)===(v==null?void 0:v.id);return a.jsxs(g.Fragment,{children:[a.jsx(_t,{content:{type:"post",body:S==null?void 0:S.content,canLike:en(n,N),createdAt:(S==null?void 0:S.time)||"",slugs:{question:`${t}/${e}`,answer:k},slug:k,author:{id:w==null?void 0:w.id,name:(H=w==null?void 0:w.data)==null?void 0:H.name,organization:(J=w==null?void 0:w.data)==null?void 0:J.organization,jobTitle:(j=w==null?void 0:w.data)==null?void 0:j.jobTitle,location:($=w==null?void 0:w.data)==null?void 0:$.location,image:{thumbnail:((W=w==null?void 0:w.data)==null?void 0:W.thumbnail)||void 0}},userLiked:D,likes:(Y==null?void 0:Y.like)||0,comments:(Y==null?void 0:Y.reply)||0,peopleWhoLiked:E},links:{post:`${t}/${e}/${k}`,comments:`${t}/${e}/${k}`},functions:{content:{createContent:()=>null,deleteContent:()=>b({activityId:k}),updateContent:(U,{body:V})=>p({activityId:k,content:V})},likes:{createLike:()=>_({activityId:k}),deleteLike:()=>x({activityId:k,reactionId:C})},comments:{openComments:()=>null}},isTruncated:!0}),y>T+1&&a.jsx(je,{})]},k)}),!l&&a.jsx(yt,{hasNextPage:d,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},Vc={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Yc({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i,user:s}){const{mutate:o}=me.useMutation({mutationFn:t,onMutate:c=>e(f=>{const u=zr({reply:Pc(c),user:s});return Vr(u,f,{replace:!1,append:(c==null?void 0:c.replyId)!==void 0})}),onError:n,onSuccess:(c,f,u)=>{const d=zr({reply:c,user:s});r.setQueryData(i,Vr(d,u,{replace:!0,append:(f==null?void 0:f.replyId)!==void 0})),setTimeout(()=>{ni(d.id)},0)}});return o}function Kc({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({replyId:i,content:s})=>e(o=>{const c=Vt(i,o);return c&&(c.data.content=s),o}),onError:n});return r}function ii({queryFns:{create:t,edit:e,like:n,list:r,remove:i,unlike:s},queryKey:o}){const c=me.useQueryClient(),f=Kt(),u={queryClient:c,queryKey:o},d={mutationHandlers:{error:er(u),mutate:tr(u)},user:f,...u},l=Yc({...d,mutationFn:t}),m=Kc({...d,mutationFn:e}),p=Gc({...d,mutationFn:n}),b=Jc({...d,mutationFn:i}),_=Xc({...d,mutationFn:s}),{replies:x,...v}=Qc({queryKey:o,queryFn:r});return{replies:x,mutations:{create:l,edit:m,remove:b,like:p,unlike:_},user:f,...v}}function Gc({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i}){const{mutate:s}=me.useMutation({mutationFn:t,onMutate:({replyId:o})=>e(c=>{const f=Vt(o,c);return f&&Zr({reply:f}),c}),onError:n,onSuccess:(o,{replyId:c},f)=>{const u=Vt(c,f);u&&Zr({reply:u,reaction:o}),r.setQueryData(i,f)}});return s}function Qc({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}=me.useInfiniteQuery({queryKey:e,queryFn:t,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),c=al(n),f=`${c.length||0}${s?"+":""}`;return{replies:c,repliesCount:f,error:r,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Jc({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({replyId:i})=>e(s=>rl(i,s)),onError:n});return r}function Xc({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:i}=me.useMutation({mutationFn:t,onMutate:({replyId:s})=>e(o=>{const c=Vt(s,o);return c&&Rc({reply:c,user:r}),o}),onError:n});return i}function el(t){return{pages:[{next:"",results:[t]}],pageParams:[""]}}function tl(t,e,n){const r=e.pages.length-1,i=e.pages[r].results.length-1;return n!=null&&n.replace?e.pages[r].results[i]=t:e.pages[r].results.push(t),e}function nl(t,e,n){return n!=null&&n.replace?e.pages[0].results[0]=t:e.pages[0].results=[t,...e.pages[0].results],e}function Vr(t,e,n){return e?n!=null&&n.append?tl(t,e,n):nl(t,e,n):el(t)}function Vt(t,e){if(e)for(const{results:n}of e.pages){const r=n.find(({id:i})=>i===t);if(r)return r}}function rl(t,e){for(const{results:n}of e.pages){const r=n.findIndex(({id:i})=>i===t);if(r!==-1){n.splice(r,1);break}}return e}function al(t){var e;return((e=t==null?void 0:t.pages)==null?void 0:e.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const il=({basePath:t,parentId:e,activityId:n,replyId:r,isMember:i,functions:s})=>{const{replies:o,fetchNextPage:c,hasNextPage:f,isLoading:u,mutations:{create:d,edit:l,like:m,remove:p,unlike:b},user:_}=ii({queryKey:[t,e,n,r,"replies"],queryFns:{...s,list:x=>s.list({...x,reactionId:r})}});return a.jsx(Ja,{loadMore:{isLoading:u,hasNextPage:f,loadNextPage:()=>c()},form:{content:{type:"reply",slugs:{question:`${t}/${e}`,answer:n,reply:r}},functions:{create:(x,{body:v})=>d({activityId:n,replyId:r,content:v})},meta:{isEditing:!1,showSuccessMessage:!1}},children:o&&o.length>0?o==null?void 0:o.map(x=>{var L,z,I,H,J,j,$,W,U,V,ee,G;const{id:v,own_children:y,latest_children:S,children_counts:T}=x,Z=(((L=y==null?void 0:y.like)==null?void 0:L.length)||0)>0?(z=y==null?void 0:y.like)==null?void 0:z.find(K=>{var X;return((X=K==null?void 0:K.user)==null?void 0:X.id)===(_==null?void 0:_.id)}):!1,O=Z?Z==null?void 0:Z.id:"",Y=!!Z,D=(((I=S==null?void 0:S.like)==null?void 0:I.length)||0)>0?(H=S==null?void 0:S.like)==null?void 0:H.map(K=>{var X,ne,F;return{id:(X=K==null?void 0:K.user)==null?void 0:X.id,name:(F=(ne=K==null?void 0:K.user)==null?void 0:ne.data)==null?void 0:F.name}}):!1,C=x==null?void 0:x.user,E=(C==null?void 0:C.id)===(_==null?void 0:_.id),w=en(i,E),N=typeof x.data.content=="string"?(J=x==null?void 0:x.data)==null?void 0:J.content:(($=(j=x==null?void 0:x.data)==null?void 0:j.content)==null?void 0:$.text)||"";return a.jsx(_t,{content:{id:v,type:"reply",body:N,canLike:w,createdAt:x==null?void 0:x.created_at,slugs:{question:`${t}/${e}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:C==null?void 0:C.id,name:(W=C.data)==null?void 0:W.name,organization:(U=C.data)==null?void 0:U.organization,jobTitle:(V=C.data)==null?void 0:V.jobTitle,location:(ee=C.data)==null?void 0:ee.location,image:{thumbnail:((G=C.data)==null?void 0:G.thumbnail)||void 0}},userLiked:Y,likes:(T==null?void 0:T.like)||0,peopleWhoLiked:D},functions:{content:{createContent:()=>null,deleteContent:()=>p({replyId:v}),updateContent:(K,{body:X})=>l({replyId:v,content:X})},likes:{createLike:()=>m({replyId:v}),deleteLike:()=>b({replyId:v,reactionId:O})},comments:{}}},v)}):null})},si=({basePath:t,parentId:e,activityId:n,isMember:r,functions:{reactions:i,join:s,leave:o}})=>{const c=q.useIntl(),{replies:f,repliesCount:u,fetchNextPage:d,hasNextPage:l,isLoading:m,mutations:{create:p,edit:b,like:_,remove:x,unlike:v},user:y}=ii({queryKey:[t,e,n,"replies"],queryFns:i});return na(),ri(),a.jsxs("section",{children:[a.jsx(Qa,{type:"comment",responses:u}),a.jsx(Xn,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:T})=>p({activityId:n,content:T})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:c.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),f==null?void 0:f.map(S=>{var H,J,j,$,W,U,V,ee,G,K,X,ne;const{id:T,own_children:k,latest_children:Z,children_counts:O}=S,R=(((H=k==null?void 0:k.like)==null?void 0:H.length)||0)>0?(J=k==null?void 0:k.like)==null?void 0:J.find(F=>{var ie;return((ie=F==null?void 0:F.user)==null?void 0:ie.id)===(y==null?void 0:y.id)}):!1,D=R?R==null?void 0:R.id:"",C=!!R,w=(((j=Z==null?void 0:Z.like)==null?void 0:j.length)||0)>0?($=Z==null?void 0:Z.like)==null?void 0:$.map(F=>{var ie,A,he;return{id:(ie=F==null?void 0:F.user)==null?void 0:ie.id,name:(he=(A=F==null?void 0:F.user)==null?void 0:A.data)==null?void 0:he.name}}):!1,N=S==null?void 0:S.user,L=(N==null?void 0:N.id)===(y==null?void 0:y.id),z=en(r,L),I=typeof S.data.content=="string"?(W=S==null?void 0:S.data)==null?void 0:W.content:((V=(U=S==null?void 0:S.data)==null?void 0:U.content)==null?void 0:V.text)||"";return a.jsx(Ka,{children:a.jsx(_t,{content:{id:T,type:"reply",body:I,canLike:z,createdAt:S==null?void 0:S.created_at,slugs:{question:`${t}/${e}`,answer:n,reply:T},slug:T,author:{id:N==null?void 0:N.id,name:(ee=N.data)==null?void 0:ee.name,organization:(G=N.data)==null?void 0:G.organization,jobTitle:(K=N.data)==null?void 0:K.jobTitle,location:(X=N.data)==null?void 0:X.location,image:{thumbnail:((ne=N.data)==null?void 0:ne.thumbnail)||void 0}},userLiked:C,likes:(O==null?void 0:O.like)||0,peopleWhoLiked:w},functions:{content:{createContent:()=>null,deleteContent:()=>x({replyId:T}),updateContent:(F,{body:ie})=>b({replyId:T,content:ie})},likes:{createLike:()=>_({replyId:T}),deleteLike:()=>v({replyId:T,reactionId:D})},comments:{}},children:a.jsx(il,{basePath:t,parentId:e,activityId:n,replyId:T,isMember:r,functions:{...i}})},T)},T)}),!m&&a.jsx(yt,{hasNextPage:l,loadNextPage:()=>d(),icon:{icon:"arrow-down",position:"right"},messages:{button:c.formatMessage({id:"loadMore_button"}),error:c.formatMessage({id:"loadMore_error"})}})]})};function sl({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=me.useMutation({mutationFn:t,onMutate:({content:i})=>e(s=>(s&&(s.content=i),s)),onError:n});return r}function ol({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:i,isFetching:s}=me.useQuery({queryFn:t,queryKey:e});return{activity:n,error:r,isLoading:i,isFetching:s}}function cl({queryFns:{read:t,edit:e,like:n,unlike:r},queryKey:i}){const s=me.useQueryClient(),o=Kt(),c={queryClient:s,queryKey:i},f={mutationHandlers:{error:er(c),mutate:tr(c)},user:o,...c},u=sl({...f,mutationFn:e}),d=ll({...f,mutationFn:n}),l=ul({...f,mutationFn:r}),{activity:m,...p}=ol({queryKey:i,queryFn:t});return{activity:m,mutations:{edit:u,like:d,unlike:l},user:o,...p}}function ll({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:i}){const{mutate:s}=me.useMutation({mutationFn:t,onMutate:o=>e(c=>(c&&Wt({activity:c}),c)),onError:n,onSuccess:(o,c,f)=>{f&&Wt({activity:f,reaction:o}),r.setQueryData(i,f)}});return s}function ul({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:i}=me.useMutation({mutationFn:t,onMutate:s=>e(o=>(o&&ti({activity:o,user:r}),o)),onError:n});return i}const dl=({basePath:t,parentId:e,activityId:n,isMember:r,functions:{activities:{remove:i,...s},reactions:o,join:c,leave:f}})=>{var R,D,C,E,w,N,L,z,I,H;const u=q.useIntl(),d=g.useContext(Te),{activity:l,error:m,isLoading:p,mutations:{edit:b,like:_,unlike:x}}=cl({queryFns:s,queryKey:[t,e,n]});if(p)return a.jsx(xe,{style:{height:"400px"}});if(m||!l)return a.jsx(Be,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:y}=l,S=(((R=y==null?void 0:y.like)==null?void 0:R.length)||0)>0,T=(((D=v==null?void 0:v.like)==null?void 0:D.length)||0)>0,k=T?v==null?void 0:v.like[0].id:"",Z=S?(C=y==null?void 0:y.like)==null?void 0:C.map(J=>{var j,$,W;return{id:(j=J==null?void 0:J.user)==null?void 0:j.id,name:(W=($=J==null?void 0:J.user)==null?void 0:$.data)==null?void 0:W.name}}):!1,O=l==null?void 0:l.actor,Y=(O==null?void 0:O.id)===(d==null?void 0:d.id);return a.jsxs("section",{className:"activity-section",children:[a.jsx(_t,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:l==null?void 0:l.content,canLike:en(r,Y),createdAt:(l==null?void 0:l.time)||"",slugs:{question:`${t}/${e}`,answer:l==null?void 0:l.id},slug:n,author:{id:O.id,name:(E=O.data)==null?void 0:E.name,organization:(w=O.data)==null?void 0:w.organization,jobTitle:(N=O.data)==null?void 0:N.jobTitle,location:(L=O.data)==null?void 0:L.location,image:{thumbnail:((z=O.data)==null?void 0:z.thumbnail)||void 0}},userLiked:T,likes:((I=l==null?void 0:l.reaction_counts)==null?void 0:I.like)||0,comments:((H=l==null?void 0:l.reaction_counts)==null?void 0:H.reply)||0,peopleWhoLiked:Z},originalAuthorId:O==null?void 0:O.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(J,{body:j})=>b({content:j})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>x({activityId:n,reactionId:k})},comments:{openComments:()=>{}}}},n),a.jsx(si,{basePath:t,parentId:e,activityId:n,isMember:r,functions:{reactions:o,join:c,leave:f}})]})},fl=({id:t,data:{jobTitle:e,name:n,organization:r,thumbnail:i}})=>({id:t,name:n,jobTitle:e,organization:r,image:{thumbnail:i}}),Yr=[{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 Pt="notFoundError_",ml=()=>{const t=q.useIntl(),e=[];return Yr.forEach((n,r)=>{n.title=t.formatMessage({id:`${Pt}post_${r+1}`}),e.push("solutionArticle")}),a.jsxs(Ya,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:a.jsxs(Le,{children:[a.jsx(za,{cards:Yr,cardTypes:e,buildCardData:n=>new Promise((r,i)=>{r(n)})}),a.jsx(re,{href:"/solution-articles/",children:t.formatMessage({id:`${Pt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[a.jsx("h1",{children:t.formatMessage({id:`${Pt}title`})}),a.jsx("p",{children:t.formatMessage({id:`${Pt}text`})})]})};exports.ASSETS_BUCKET=Ae;exports.ActivitiesFeed=Hc;exports.ActivitySection=dl;exports.AddPost=Xn;exports.Banner=ts;exports.BannerSection=cs;exports.Breadcrumbs=ic;exports.Button=re;exports.ButtonWrapper=et;exports.CacheProvider=fa;exports.Card=Yn;exports.CardBlock=za;exports.Carousel=rc;exports.CollapsibleSection=qn;exports.Columns=Ha;exports.CommunityDetails=ac;exports.ContactFooter=gc;exports.ContactForm=Ba;exports.Contributors=Zn;exports.ConversationContext=Xt;exports.CookieBanner=Va;exports.Directory=Ko;exports.DiscussionConversation=Ka;exports.DiscussionForm=Jt;exports.DiscussionLikes=Ga;exports.DiscussionPost=_t;exports.DiscussionThread=Ja;exports.Divider=je;exports.DownloadSection=ns;exports.EMAILS=We;exports.EditSection=as;exports.EmailHelperTextBox=Oa;exports.EmptyStateBox=Be;exports.Filters=sc;exports.FlagsProvider=ma;exports.Footer=Qn;exports.Form=Qt;exports.FullWidthSection=Le;exports.GlobalProviders=ps;exports.Header=Jn;exports.HelperTextBox=va;exports.HiddenFromScreenReaders=Yt;exports.HideShowTextBox=hs;exports.HighlightSection=us;exports.HighlightedTextBox=Ne;exports.ImageContainer=Xi;exports.IntlProvider=pa;exports.InviteForm=qa;exports.InviteModal=Yo;exports.JoinButton=Kn;exports.LanguageSwitcher=cc;exports.Link=nt;exports.LoadMore=yt;exports.LoadingBlock=Ss;exports.LoadingPlaceholder=xe;exports.LoadingState=Un;exports.Logo=Gn;exports.LogoSection=is;exports.MarkdownText=ht;exports.MarketingBlock=ds;exports.Member=Gt;exports.MembersList=wc;exports.Modal=Vn;exports.MoreMenu=Za;exports.NUMBER_OF_USERS=Bi;exports.NavigationMenu=Wa;exports.NotFoundError=ml;exports.Overlay=bt;exports.PageHeading=ya;exports.PageLayout=Ya;exports.PasswordRules=Io;exports.Pill=Ve;exports.ProfileImageChange=qo;exports.ProfilePicture=Re;exports.ProgressBar=_a;exports.Rating=Lo;exports.RepliesFeed=si;exports.ResponsesHeading=Qa;exports.ResponsiveImage=tt;exports.ReturnToNavButton=es;exports.SearchForm=Ua;exports.ShareLinks=mc;exports.SignupForm=Vo;exports.Span=ba;exports.StatusBanner=gt;exports.Tabs=pc;exports.Tags=xc;exports.TestimonialBlock=js;exports.Toggle=Bo;exports.Tooltip=ua;exports.TopLevelPage=vc;exports.UserContext=Te;exports.UserProvider=ha;exports.VisuallyHidden=ge;exports.addAriaProps=Fa;exports.generateCssIcon=sa;exports.getMember=zn;exports.headerData=vt;exports.mapGetStreamData=fl;exports.pageReady=la;exports.passwordValidator=Gi;exports.repliesFeedMock=Vc;exports.useCurrentPath=Xr;exports.useEffectAfterMount=Ke;exports.useElementWidth=Xe;exports.useScrollListener=ta;exports.useScrollToHash=na;exports.useUser=Kt;
|