@apolitical/component-library 1.14.12 → 1.14.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Ms=require("lodash.clonedeep"),Ts=require("lodash.set"),T=require("react-intl"),Ie=require("truncate"),xt=require("markdown-to-jsx"),W=require("@tanstack/react-query"),Cs=require("@tanstack/react-query-devtools"),mt=require("posthog-js"),$n=require("react-cookie"),Ns=require("react-multi-email"),Mn=require("lodash.get"),Ds=require("react-error-boundary"),Rs=require("react-textarea-autosize"),Ps=require("lodash.isequal");function As(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tn={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Ms=require("lodash.clonedeep"),Cs=require("lodash.set"),M=require("react-intl"),Ie=require("truncate"),xt=require("markdown-to-jsx"),W=require("@tanstack/react-query"),Ns=require("@tanstack/react-query-devtools"),mt=require("posthog-js"),Tn=require("react-cookie"),Ds=require("react-multi-email"),Mn=require("lodash.get"),Rs=require("react-error-boundary"),Ps=require("react-textarea-autosize"),As=require("lodash.isequal");function Fs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cn={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],c=0;c<arguments.length;c++){var i=arguments[c];if(i){var d=typeof i;if(d==="string"||d==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var a=n.apply(null,i);a&&r.push(a)}}else if(d==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Tn);var Fs=Tn.exports;const M=As(Fs),Ls=({element:e="span",showOnFocus:t=!0,children:n,...r})=>_.createElement(e,{...r,className:M("hidden",{"show-on-focus":t}),children:n}),ue=_.memo(Ls),Is=({element:e="span",children:t=null,...n})=>_.createElement(e,{...n,"aria-hidden":!0},t),zt=_.memo(Is);var Ot={exports:{}},He={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],i=0;i<arguments.length;i++){var c=arguments[i];if(c){var u=typeof c;if(u==="string"||u==="number")r.push(c);else if(Array.isArray(c)){if(c.length){var a=n.apply(null,c);a&&r.push(a)}}else if(u==="object"){if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]")){r.push(c.toString());continue}for(var l in c)t.call(c,l)&&c[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Cn);var Ls=Cn.exports;const T=Fs(Ls),Is=({element:e="span",showOnFocus:t=!0,children:n,...r})=>_.createElement(e,{...r,className:T("hidden",{"show-on-focus":t}),children:n}),ue=_.memo(Is),Bs=({element:e="span",children:t=null,...n})=>_.createElement(e,{...n,"aria-hidden":!0},t),zt=_.memo(Bs);var Ot={exports:{}},He={};/**
6
6
  * @license React
7
7
  * react-jsx-runtime.production.min.js
8
8
  *
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var gn;function Bs(){if(gn)return He;gn=1;var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,c=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(a,l,o){var u,m={},h=null,p=null;o!==void 0&&(h=""+o),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(u in l)r.call(l,u)&&!i.hasOwnProperty(u)&&(m[u]=l[u]);if(a&&a.defaultProps)for(u in l=a.defaultProps,l)m[u]===void 0&&(m[u]=l[u]);return{$$typeof:t,type:a,key:h,ref:p,props:m,_owner:c.current}}return He.Fragment=n,He.jsx=d,He.jsxs=d,He}var Ue={};/**
13
+ */var gn;function Os(){if(gn)return He;gn=1;var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(a,l,o){var m,d={},h=null,p=null;o!==void 0&&(h=""+o),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(m in l)r.call(l,m)&&!c.hasOwnProperty(m)&&(d[m]=l[m]);if(a&&a.defaultProps)for(m in l=a.defaultProps,l)d[m]===void 0&&(d[m]=l[m]);return{$$typeof:t,type:a,key:h,ref:p,props:d,_owner:i.current}}return He.Fragment=n,He.jsx=u,He.jsxs=u,He}var Ue={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,22 +18,22 @@
18
18
  *
19
19
  * This source code is licensed under the MIT license found in the
20
20
  * LICENSE file in the root directory of this source tree.
21
- */var _n;function Os(){return _n||(_n=1,process.env.NODE_ENV!=="production"&&function(){var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,v="@@iterator";function k(f){if(f===null||typeof f!="object")return null;var E=g&&f[g]||f[v];return typeof E=="function"?E:null}var S=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(f){{for(var E=arguments.length,$=new Array(E>1?E-1:0),N=1;N<E;N++)$[N-1]=arguments[N];x("error",f,$)}}function x(f,E,$){{var N=S.ReactDebugCurrentFrame,O=N.getStackAddendum();O!==""&&(E+="%s",$=$.concat([O]));var U=$.map(function(I){return String(I)});U.unshift("Warning: "+E),Function.prototype.apply.call(console[f],console,U)}}var C=!1,R=!1,A=!1,V=!1,D=!1,P;P=Symbol.for("react.module.reference");function Y(f){return!!(typeof f=="string"||typeof f=="function"||f===r||f===i||D||f===c||f===o||f===u||V||f===p||C||R||A||typeof f=="object"&&f!==null&&(f.$$typeof===h||f.$$typeof===m||f.$$typeof===d||f.$$typeof===a||f.$$typeof===l||f.$$typeof===P||f.getModuleId!==void 0))}function b(f,E,$){var N=f.displayName;if(N)return N;var O=E.displayName||E.name||"";return O!==""?$+"("+O+")":$}function Z(f){return f.displayName||"Context"}function y(f){if(f==null)return null;if(typeof f.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case c:return"StrictMode";case o:return"Suspense";case u:return"SuspenseList"}if(typeof f=="object")switch(f.$$typeof){case a:var E=f;return Z(E)+".Consumer";case d:var $=f;return Z($._context)+".Provider";case l:return b(f,f.render,"ForwardRef");case m:var N=f.displayName||null;return N!==null?N:y(f.type)||"Memo";case h:{var O=f,U=O._payload,I=O._init;try{return y(I(U))}catch{return null}}}return null}var w=Object.assign,z=0,J,ne,se,re,q,de,ce;function L(){}L.__reactDisabledLog=!0;function ae(){{if(z===0){J=console.log,ne=console.info,se=console.warn,re=console.error,q=console.group,de=console.groupCollapsed,ce=console.groupEnd;var f={configurable:!0,enumerable:!0,value:L,writable:!0};Object.defineProperties(console,{info:f,log:f,warn:f,error:f,group:f,groupCollapsed:f,groupEnd:f})}z++}}function me(){{if(z--,z===0){var f={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:w({},f,{value:J}),info:w({},f,{value:ne}),warn:w({},f,{value:se}),error:w({},f,{value:re}),group:w({},f,{value:q}),groupCollapsed:w({},f,{value:de}),groupEnd:w({},f,{value:ce})})}z<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var oe=S.ReactCurrentDispatcher,pe;function fe(f,E,$){{if(pe===void 0)try{throw Error()}catch(O){var N=O.stack.trim().match(/\n( *(at )?)/);pe=N&&N[1]||""}return`
21
+ */var _n;function Qs(){return _n||(_n=1,process.env.NODE_ENV!=="production"&&function(){var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,v="@@iterator";function k(f){if(f===null||typeof f!="object")return null;var E=g&&f[g]||f[v];return typeof E=="function"?E:null}var S=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(f){{for(var E=arguments.length,$=new Array(E>1?E-1:0),N=1;N<E;N++)$[N-1]=arguments[N];x("error",f,$)}}function x(f,E,$){{var N=S.ReactDebugCurrentFrame,O=N.getStackAddendum();O!==""&&(E+="%s",$=$.concat([O]));var U=$.map(function(I){return String(I)});U.unshift("Warning: "+E),Function.prototype.apply.call(console[f],console,U)}}var C=!1,R=!1,A=!1,V=!1,D=!1,P;P=Symbol.for("react.module.reference");function Y(f){return!!(typeof f=="string"||typeof f=="function"||f===r||f===c||D||f===i||f===o||f===m||V||f===p||C||R||A||typeof f=="object"&&f!==null&&(f.$$typeof===h||f.$$typeof===d||f.$$typeof===u||f.$$typeof===a||f.$$typeof===l||f.$$typeof===P||f.getModuleId!==void 0))}function b(f,E,$){var N=f.displayName;if(N)return N;var O=E.displayName||E.name||"";return O!==""?$+"("+O+")":$}function Z(f){return f.displayName||"Context"}function y(f){if(f==null)return null;if(typeof f.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case r:return"Fragment";case n:return"Portal";case c:return"Profiler";case i:return"StrictMode";case o:return"Suspense";case m:return"SuspenseList"}if(typeof f=="object")switch(f.$$typeof){case a:var E=f;return Z(E)+".Consumer";case u:var $=f;return Z($._context)+".Provider";case l:return b(f,f.render,"ForwardRef");case d:var N=f.displayName||null;return N!==null?N:y(f.type)||"Memo";case h:{var O=f,U=O._payload,I=O._init;try{return y(I(U))}catch{return null}}}return null}var w=Object.assign,z=0,J,ne,se,re,q,de,ce;function L(){}L.__reactDisabledLog=!0;function ae(){{if(z===0){J=console.log,ne=console.info,se=console.warn,re=console.error,q=console.group,de=console.groupCollapsed,ce=console.groupEnd;var f={configurable:!0,enumerable:!0,value:L,writable:!0};Object.defineProperties(console,{info:f,log:f,warn:f,error:f,group:f,groupCollapsed:f,groupEnd:f})}z++}}function me(){{if(z--,z===0){var f={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:w({},f,{value:J}),info:w({},f,{value:ne}),warn:w({},f,{value:se}),error:w({},f,{value:re}),group:w({},f,{value:q}),groupCollapsed:w({},f,{value:de}),groupEnd:w({},f,{value:ce})})}z<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var oe=S.ReactCurrentDispatcher,pe;function fe(f,E,$){{if(pe===void 0)try{throw Error()}catch(O){var N=O.stack.trim().match(/\n( *(at )?)/);pe=N&&N[1]||""}return`
22
22
  `+pe+f}}var ge=!1,he;{var B=typeof WeakMap=="function"?WeakMap:Map;he=new B}function G(f,E){if(!f||ge)return"";{var $=he.get(f);if($!==void 0)return $}var N;ge=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var U;U=oe.current,oe.current=null,ae();try{if(E){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(Ee){N=Ee}Reflect.construct(f,[],I)}else{try{I.call()}catch(Ee){N=Ee}f.call(I.prototype)}}else{try{throw Error()}catch(Ee){N=Ee}f()}}catch(Ee){if(Ee&&N&&typeof Ee.stack=="string"){for(var F=Ee.stack.split(`
23
23
  `),_e=N.stack.split(`
24
24
  `),X=F.length-1,te=_e.length-1;X>=1&&te>=0&&F[X]!==_e[te];)te--;for(;X>=1&&te>=0;X--,te--)if(F[X]!==_e[te]){if(X!==1||te!==1)do if(X--,te--,te<0||F[X]!==_e[te]){var ve=`
25
- `+F[X].replace(" at new "," at ");return f.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",f.displayName)),typeof f=="function"&&he.set(f,ve),ve}while(X>=1&&te>=0);break}}}finally{ge=!1,oe.current=U,me(),Error.prepareStackTrace=O}var Ae=f?f.displayName||f.name:"",pn=Ae?fe(Ae):"";return typeof f=="function"&&he.set(f,pn),pn}function ie(f,E,$){return G(f,!1)}function K(f){var E=f.prototype;return!!(E&&E.isReactComponent)}function le(f,E,$){if(f==null)return"";if(typeof f=="function")return G(f,K(f));if(typeof f=="string")return fe(f);switch(f){case o:return fe("Suspense");case u:return fe("SuspenseList")}if(typeof f=="object")switch(f.$$typeof){case l:return ie(f.render);case m:return le(f.type,E,$);case h:{var N=f,O=N._payload,U=N._init;try{return le(U(O),E,$)}catch{}}}return""}var be=Object.prototype.hasOwnProperty,Te={},Oe=S.ReactDebugCurrentFrame;function Ce(f){if(f){var E=f._owner,$=le(f.type,f._source,E?E.type:null);Oe.setExtraStackFrame($)}else Oe.setExtraStackFrame(null)}function nt(f,E,$,N,O){{var U=Function.call.bind(be);for(var I in f)if(U(f,I)){var F=void 0;try{if(typeof f[I]!="function"){var _e=Error((N||"React class")+": "+$+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof f[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _e.name="Invariant Violation",_e}F=f[I](E,I,N,$,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(X){F=X}F&&!(F instanceof Error)&&(Ce(O),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",N||"React class",$,I,typeof F),Ce(null)),F instanceof Error&&!(F.message in Te)&&(Te[F.message]=!0,Ce(O),j("Failed %s type: %s",$,F.message),Ce(null))}}}var ee=Array.isArray;function je(f){return ee(f)}function Ne(f){{var E=typeof Symbol=="function"&&Symbol.toStringTag,$=E&&f[Symbol.toStringTag]||f.constructor.name||"Object";return $}}function st(f){try{return rt(f),!1}catch{return!0}}function rt(f){return""+f}function an(f){if(st(f))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ne(f)),rt(f)}var Qe=S.ReactCurrentOwner,ms={key:!0,ref:!0,__self:!0,__source:!0},on,cn,kt;kt={};function fs(f){if(be.call(f,"ref")){var E=Object.getOwnPropertyDescriptor(f,"ref").get;if(E&&E.isReactWarning)return!1}return f.ref!==void 0}function hs(f){if(be.call(f,"key")){var E=Object.getOwnPropertyDescriptor(f,"key").get;if(E&&E.isReactWarning)return!1}return f.key!==void 0}function ps(f,E){if(typeof f.ref=="string"&&Qe.current&&E&&Qe.current.stateNode!==E){var $=y(Qe.current.type);kt[$]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',y(Qe.current.type),f.ref),kt[$]=!0)}}function gs(f,E){{var $=function(){on||(on=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};$.isReactWarning=!0,Object.defineProperty(f,"key",{get:$,configurable:!0})}}function _s(f,E){{var $=function(){cn||(cn=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};$.isReactWarning=!0,Object.defineProperty(f,"ref",{get:$,configurable:!0})}}var xs=function(f,E,$,N,O,U,I){var F={$$typeof:t,type:f,key:E,ref:$,props:I,_owner:U};return F._store={},Object.defineProperty(F._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(F,"_self",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.defineProperty(F,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(F.props),Object.freeze(F)),F};function bs(f,E,$,N,O){{var U,I={},F=null,_e=null;$!==void 0&&(an($),F=""+$),hs(E)&&(an(E.key),F=""+E.key),fs(E)&&(_e=E.ref,ps(E,O));for(U in E)be.call(E,U)&&!ms.hasOwnProperty(U)&&(I[U]=E[U]);if(f&&f.defaultProps){var X=f.defaultProps;for(U in X)I[U]===void 0&&(I[U]=X[U])}if(F||_e){var te=typeof f=="function"?f.displayName||f.name||"Unknown":f;F&&gs(I,te),_e&&_s(I,te)}return xs(f,F,_e,O,N,Qe.current,I)}}var jt=S.ReactCurrentOwner,ln=S.ReactDebugCurrentFrame;function Pe(f){if(f){var E=f._owner,$=le(f.type,f._source,E?E.type:null);ln.setExtraStackFrame($)}else ln.setExtraStackFrame(null)}var yt;yt=!1;function Et(f){return typeof f=="object"&&f!==null&&f.$$typeof===t}function un(){{if(jt.current){var f=y(jt.current.type);if(f)return`
25
+ `+F[X].replace(" at new "," at ");return f.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",f.displayName)),typeof f=="function"&&he.set(f,ve),ve}while(X>=1&&te>=0);break}}}finally{ge=!1,oe.current=U,me(),Error.prepareStackTrace=O}var Ae=f?f.displayName||f.name:"",pn=Ae?fe(Ae):"";return typeof f=="function"&&he.set(f,pn),pn}function ie(f,E,$){return G(f,!1)}function K(f){var E=f.prototype;return!!(E&&E.isReactComponent)}function le(f,E,$){if(f==null)return"";if(typeof f=="function")return G(f,K(f));if(typeof f=="string")return fe(f);switch(f){case o:return fe("Suspense");case m:return fe("SuspenseList")}if(typeof f=="object")switch(f.$$typeof){case l:return ie(f.render);case d:return le(f.type,E,$);case h:{var N=f,O=N._payload,U=N._init;try{return le(U(O),E,$)}catch{}}}return""}var be=Object.prototype.hasOwnProperty,Me={},Oe=S.ReactDebugCurrentFrame;function Ce(f){if(f){var E=f._owner,$=le(f.type,f._source,E?E.type:null);Oe.setExtraStackFrame($)}else Oe.setExtraStackFrame(null)}function nt(f,E,$,N,O){{var U=Function.call.bind(be);for(var I in f)if(U(f,I)){var F=void 0;try{if(typeof f[I]!="function"){var _e=Error((N||"React class")+": "+$+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof f[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _e.name="Invariant Violation",_e}F=f[I](E,I,N,$,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(X){F=X}F&&!(F instanceof Error)&&(Ce(O),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",N||"React class",$,I,typeof F),Ce(null)),F instanceof Error&&!(F.message in Me)&&(Me[F.message]=!0,Ce(O),j("Failed %s type: %s",$,F.message),Ce(null))}}}var ee=Array.isArray;function je(f){return ee(f)}function Ne(f){{var E=typeof Symbol=="function"&&Symbol.toStringTag,$=E&&f[Symbol.toStringTag]||f.constructor.name||"Object";return $}}function st(f){try{return rt(f),!1}catch{return!0}}function rt(f){return""+f}function an(f){if(st(f))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ne(f)),rt(f)}var Qe=S.ReactCurrentOwner,fs={key:!0,ref:!0,__self:!0,__source:!0},on,cn,kt;kt={};function hs(f){if(be.call(f,"ref")){var E=Object.getOwnPropertyDescriptor(f,"ref").get;if(E&&E.isReactWarning)return!1}return f.ref!==void 0}function ps(f){if(be.call(f,"key")){var E=Object.getOwnPropertyDescriptor(f,"key").get;if(E&&E.isReactWarning)return!1}return f.key!==void 0}function gs(f,E){if(typeof f.ref=="string"&&Qe.current&&E&&Qe.current.stateNode!==E){var $=y(Qe.current.type);kt[$]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',y(Qe.current.type),f.ref),kt[$]=!0)}}function _s(f,E){{var $=function(){on||(on=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};$.isReactWarning=!0,Object.defineProperty(f,"key",{get:$,configurable:!0})}}function xs(f,E){{var $=function(){cn||(cn=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};$.isReactWarning=!0,Object.defineProperty(f,"ref",{get:$,configurable:!0})}}var bs=function(f,E,$,N,O,U,I){var F={$$typeof:t,type:f,key:E,ref:$,props:I,_owner:U};return F._store={},Object.defineProperty(F._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(F,"_self",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.defineProperty(F,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(F.props),Object.freeze(F)),F};function vs(f,E,$,N,O){{var U,I={},F=null,_e=null;$!==void 0&&(an($),F=""+$),ps(E)&&(an(E.key),F=""+E.key),hs(E)&&(_e=E.ref,gs(E,O));for(U in E)be.call(E,U)&&!fs.hasOwnProperty(U)&&(I[U]=E[U]);if(f&&f.defaultProps){var X=f.defaultProps;for(U in X)I[U]===void 0&&(I[U]=X[U])}if(F||_e){var te=typeof f=="function"?f.displayName||f.name||"Unknown":f;F&&_s(I,te),_e&&xs(I,te)}return bs(f,F,_e,O,N,Qe.current,I)}}var jt=S.ReactCurrentOwner,ln=S.ReactDebugCurrentFrame;function Pe(f){if(f){var E=f._owner,$=le(f.type,f._source,E?E.type:null);ln.setExtraStackFrame($)}else ln.setExtraStackFrame(null)}var yt;yt=!1;function Et(f){return typeof f=="object"&&f!==null&&f.$$typeof===t}function un(){{if(jt.current){var f=y(jt.current.type);if(f)return`
26
26
 
27
- Check the render method of \``+f+"`."}return""}}function vs(f){{if(f!==void 0){var E=f.fileName.replace(/^.*[\\\/]/,""),$=f.lineNumber;return`
27
+ Check the render method of \``+f+"`."}return""}}function ws(f){{if(f!==void 0){var E=f.fileName.replace(/^.*[\\\/]/,""),$=f.lineNumber;return`
28
28
 
29
- Check your code at `+E+":"+$+"."}return""}}var dn={};function ws(f){{var E=un();if(!E){var $=typeof f=="string"?f:f.displayName||f.name;$&&(E=`
29
+ Check your code at `+E+":"+$+"."}return""}}var dn={};function ks(f){{var E=un();if(!E){var $=typeof f=="string"?f:f.displayName||f.name;$&&(E=`
30
30
 
31
- Check the top-level render call using <`+$+">.")}return E}}function mn(f,E){{if(!f._store||f._store.validated||f.key!=null)return;f._store.validated=!0;var $=ws(E);if(dn[$])return;dn[$]=!0;var N="";f&&f._owner&&f._owner!==jt.current&&(N=" It was passed a child from "+y(f._owner.type)+"."),Pe(f),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',$,N),Pe(null)}}function fn(f,E){{if(typeof f!="object")return;if(je(f))for(var $=0;$<f.length;$++){var N=f[$];Et(N)&&mn(N,E)}else if(Et(f))f._store&&(f._store.validated=!0);else if(f){var O=k(f);if(typeof O=="function"&&O!==f.entries)for(var U=O.call(f),I;!(I=U.next()).done;)Et(I.value)&&mn(I.value,E)}}}function ks(f){{var E=f.type;if(E==null||typeof E=="string")return;var $;if(typeof E=="function")$=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===l||E.$$typeof===m))$=E.propTypes;else return;if($){var N=y(E);nt($,f.props,"prop",N,f)}else if(E.PropTypes!==void 0&&!yt){yt=!0;var O=y(E);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function js(f){{for(var E=Object.keys(f.props),$=0;$<E.length;$++){var N=E[$];if(N!=="children"&&N!=="key"){Pe(f),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",N),Pe(null);break}}f.ref!==null&&(Pe(f),j("Invalid attribute `ref` supplied to `React.Fragment`."),Pe(null))}}function hn(f,E,$,N,O,U){{var I=Y(f);if(!I){var F="";(f===void 0||typeof f=="object"&&f!==null&&Object.keys(f).length===0)&&(F+=" 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 _e=vs(O);_e?F+=_e:F+=un();var X;f===null?X="null":je(f)?X="array":f!==void 0&&f.$$typeof===t?(X="<"+(y(f.type)||"Unknown")+" />",F=" Did you accidentally export a JSX literal instead of a component?"):X=typeof f,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",X,F)}var te=bs(f,E,$,O,U);if(te==null)return te;if(I){var ve=E.children;if(ve!==void 0)if(N)if(je(ve)){for(var Ae=0;Ae<ve.length;Ae++)fn(ve[Ae],f);Object.freeze&&Object.freeze(ve)}else j("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 fn(ve,f)}return f===r?js(te):ks(te),te}}function ys(f,E,$){return hn(f,E,$,!0)}function Es(f,E,$){return hn(f,E,$,!1)}var Ss=Es,$s=ys;Ue.Fragment=r,Ue.jsx=Ss,Ue.jsxs=$s}()),Ue}process.env.NODE_ENV==="production"?Ot.exports=Bs():Ot.exports=Os();var s=Ot.exports;const Cn=()=>{const[e,t]=_.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return _.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},De=(e,t)=>{const n=_.useRef(!1);_.useEffect(()=>{n.current?e():n.current=!0},t)};function Qs(e,t,n){var r=this,c=_.useRef(null),i=_.useRef(0),d=_.useRef(null),a=_.useRef([]),l=_.useRef(),o=_.useRef(),u=_.useRef(e),m=_.useRef(!0);_.useEffect(function(){u.current=e},[e]);var h=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var p=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,v="maxWait"in n,k=v?Math.max(+n.maxWait||0,t):null;_.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var S=_.useMemo(function(){var j=function(D){var P=a.current,Y=l.current;return a.current=l.current=null,i.current=D,o.current=u.current.apply(Y,P)},x=function(D,P){h&&cancelAnimationFrame(d.current),d.current=h?requestAnimationFrame(D):setTimeout(D,P)},C=function(D){if(!m.current)return!1;var P=D-c.current;return!c.current||P>=t||P<0||v&&D-i.current>=k},R=function(D){return d.current=null,g&&a.current?j(D):(a.current=l.current=null,o.current)},A=function D(){var P=Date.now();if(C(P))return R(P);if(m.current){var Y=t-(P-c.current),b=v?Math.min(Y,k-(P-i.current)):Y;x(D,b)}},V=function(){var D=Date.now(),P=C(D);if(a.current=[].slice.call(arguments),l.current=r,c.current=D,P){if(!d.current&&m.current)return i.current=c.current,x(A,t),p?j(c.current):o.current;if(v)return x(A,t),j(c.current)}return d.current||x(A,t),o.current};return V.cancel=function(){d.current&&(h?cancelAnimationFrame(d.current):clearTimeout(d.current)),i.current=0,a.current=c.current=l.current=d.current=null},V.isPending=function(){return!!d.current},V.flush=function(){return d.current?R(Date.now()):o.current},V},[p,v,t,k,g,h]);return S}function Nn(e,t,n){var r=n===void 0?{}:n,c=r.leading,i=r.trailing;return Qs(e,t,{maxWait:t,leading:c===void 0||c,trailing:i===void 0||i})}let St;const Xe=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,c]=_.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];_.useEffect(()=>(a(),window.addEventListener("resize",l),()=>{clearTimeout(St),l.flush(),window.removeEventListener("resize",l)}),i);const d=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},a=()=>{c(d())},l=Nn(()=>{d()!==r&&(t&&(clearTimeout(St),document.body.classList.add("is-resizing"),St=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),a())},500,{leading:!0});return r},Dn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[c,i]=_.useState({current:0,past:0})||[!1,()=>{}],[d,a]=_.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];_.useEffect(()=>(l(),window.addEventListener("scroll",o),()=>{o.flush(),window.removeEventListener("scroll",o)}),[]);const l=()=>{const u=window.scrollY,m=c.current,h=u-m,p=h>0?"down":"up";if(i({current:u,past:m}),p==="down"){u>=e+t.down&&!d.scrollDown&&(!d.scrollUp||h>t.up)&&(n(),a({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!d.scrollUp&&(r(),a({scrollUp:!0,scrollDown:!1}))},o=Nn(()=>{l()},250);return c},Hs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=_.useRef(!1);De(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},Rn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Pn=(e,t,n)=>{let r=n.mobile;for(const c in t){const i=parseInt(String(t[c]));if(e>=i)r=n[i];else if(e<i)break}return r},Us=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Ws=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),An=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Qt=e=>{let i;try{i=new Date().getTime()-new Date(e).getTime()}catch{return""}const d=i/36e5,a=Math.floor(i/864e5);if(a<1)return d<1?{path:"now"}:{path:"hours",number:Math.floor(d)};if(a<7)return{path:"days",number:a};const l=Math.floor(a/7);return l<=52?{path:"weeks",number:l}:{path:"years",number:Math.floor(a/365)}},Vt={apolitical:"Apolitical",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",card_carousel_viewAll:"View all",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}",collapsibleSection_summary:"Find out more",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",activitySection_notFoundError:"Post not found",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",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",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",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 <`+$+">.")}return E}}function mn(f,E){{if(!f._store||f._store.validated||f.key!=null)return;f._store.validated=!0;var $=ks(E);if(dn[$])return;dn[$]=!0;var N="";f&&f._owner&&f._owner!==jt.current&&(N=" It was passed a child from "+y(f._owner.type)+"."),Pe(f),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',$,N),Pe(null)}}function fn(f,E){{if(typeof f!="object")return;if(je(f))for(var $=0;$<f.length;$++){var N=f[$];Et(N)&&mn(N,E)}else if(Et(f))f._store&&(f._store.validated=!0);else if(f){var O=k(f);if(typeof O=="function"&&O!==f.entries)for(var U=O.call(f),I;!(I=U.next()).done;)Et(I.value)&&mn(I.value,E)}}}function js(f){{var E=f.type;if(E==null||typeof E=="string")return;var $;if(typeof E=="function")$=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===l||E.$$typeof===d))$=E.propTypes;else return;if($){var N=y(E);nt($,f.props,"prop",N,f)}else if(E.PropTypes!==void 0&&!yt){yt=!0;var O=y(E);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ys(f){{for(var E=Object.keys(f.props),$=0;$<E.length;$++){var N=E[$];if(N!=="children"&&N!=="key"){Pe(f),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",N),Pe(null);break}}f.ref!==null&&(Pe(f),j("Invalid attribute `ref` supplied to `React.Fragment`."),Pe(null))}}function hn(f,E,$,N,O,U){{var I=Y(f);if(!I){var F="";(f===void 0||typeof f=="object"&&f!==null&&Object.keys(f).length===0)&&(F+=" 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 _e=ws(O);_e?F+=_e:F+=un();var X;f===null?X="null":je(f)?X="array":f!==void 0&&f.$$typeof===t?(X="<"+(y(f.type)||"Unknown")+" />",F=" Did you accidentally export a JSX literal instead of a component?"):X=typeof f,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",X,F)}var te=vs(f,E,$,O,U);if(te==null)return te;if(I){var ve=E.children;if(ve!==void 0)if(N)if(je(ve)){for(var Ae=0;Ae<ve.length;Ae++)fn(ve[Ae],f);Object.freeze&&Object.freeze(ve)}else j("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 fn(ve,f)}return f===r?ys(te):js(te),te}}function Es(f,E,$){return hn(f,E,$,!0)}function Ss(f,E,$){return hn(f,E,$,!1)}var $s=Ss,Ts=Es;Ue.Fragment=r,Ue.jsx=$s,Ue.jsxs=Ts}()),Ue}process.env.NODE_ENV==="production"?Ot.exports=Os():Ot.exports=Qs();var s=Ot.exports;const Nn=()=>{const[e,t]=_.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return _.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},De=(e,t)=>{const n=_.useRef(!1);_.useEffect(()=>{n.current?e():n.current=!0},t)};function Hs(e,t,n){var r=this,i=_.useRef(null),c=_.useRef(0),u=_.useRef(null),a=_.useRef([]),l=_.useRef(),o=_.useRef(),m=_.useRef(e),d=_.useRef(!0);_.useEffect(function(){m.current=e},[e]);var h=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var p=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,v="maxWait"in n,k=v?Math.max(+n.maxWait||0,t):null;_.useEffect(function(){return d.current=!0,function(){d.current=!1}},[]);var S=_.useMemo(function(){var j=function(D){var P=a.current,Y=l.current;return a.current=l.current=null,c.current=D,o.current=m.current.apply(Y,P)},x=function(D,P){h&&cancelAnimationFrame(u.current),u.current=h?requestAnimationFrame(D):setTimeout(D,P)},C=function(D){if(!d.current)return!1;var P=D-i.current;return!i.current||P>=t||P<0||v&&D-c.current>=k},R=function(D){return u.current=null,g&&a.current?j(D):(a.current=l.current=null,o.current)},A=function D(){var P=Date.now();if(C(P))return R(P);if(d.current){var Y=t-(P-i.current),b=v?Math.min(Y,k-(P-c.current)):Y;x(D,b)}},V=function(){var D=Date.now(),P=C(D);if(a.current=[].slice.call(arguments),l.current=r,i.current=D,P){if(!u.current&&d.current)return c.current=i.current,x(A,t),p?j(i.current):o.current;if(v)return x(A,t),j(i.current)}return u.current||x(A,t),o.current};return V.cancel=function(){u.current&&(h?cancelAnimationFrame(u.current):clearTimeout(u.current)),c.current=0,a.current=i.current=l.current=u.current=null},V.isPending=function(){return!!u.current},V.flush=function(){return u.current?R(Date.now()):o.current},V},[p,v,t,k,g,h]);return S}function Dn(e,t,n){var r=n===void 0?{}:n,i=r.leading,c=r.trailing;return Hs(e,t,{maxWait:t,leading:i===void 0||i,trailing:c===void 0||c})}let St;const Xe=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,i]=_.useState(0)||[!1,()=>{}],c=n==="window"?[]:[n];_.useEffect(()=>(a(),window.addEventListener("resize",l),()=>{clearTimeout(St),l.flush(),window.removeEventListener("resize",l)}),c);const u=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},a=()=>{i(u())},l=Dn(()=>{u()!==r&&(t&&(clearTimeout(St),document.body.classList.add("is-resizing"),St=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),a())},500,{leading:!0});return r},Rn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,c]=_.useState({current:0,past:0})||[!1,()=>{}],[u,a]=_.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];_.useEffect(()=>(l(),window.addEventListener("scroll",o),()=>{o.flush(),window.removeEventListener("scroll",o)}),[]);const l=()=>{const m=window.scrollY,d=i.current,h=m-d,p=h>0?"down":"up";if(c({current:m,past:d}),p==="down"){m>=e+t.down&&!u.scrollDown&&(!u.scrollUp||h>t.up)&&(n(),a({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!u.scrollUp&&(r(),a({scrollUp:!0,scrollDown:!1}))},o=Dn(()=>{l()},250);return i},Us=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=_.useRef(!1);De(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},Pn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},An=(e,t,n)=>{let r=n.mobile;for(const i in t){const c=parseInt(String(t[i]));if(e>=c)r=n[c];else if(e<c)break}return r},Ws=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),zs=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Fn=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Qt=e=>{let c;const u=xn(),a=xn(new Date(e));try{c=u.getTime()-a.getTime()}catch{return""}const l=c/36e5,o=Math.floor(c/864e5);if(o<1)return l<1?{path:"now"}:{path:"hours",number:Math.floor(l)};if(o<7)return{path:"days",number:o};const m=Math.floor(o/7);return m<=52?{path:"weeks",number:m}:{path:"years",number:Math.floor(o/365)}},xn=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Vt={apolitical:"Apolitical",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",card_carousel_viewAll:"View all",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}",collapsibleSection_summary:"Find out more",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",activitySection_notFoundError:"Post not found",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",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",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",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:"Type your {action} here...",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_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",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.",filters_all:"Show all",filters_disabled:"{name} - no results",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",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_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",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",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",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",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",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.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",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",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",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",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",overlay_close:"Close",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",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",progressBar:"{number}% loaded",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",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",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>",tags_community:"From the community",tooltip_loading:"Loading..."},zs={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>"},Vs={collapsibleSection_summary:"En savoir plus",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>"},Ys={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>"},Gs=Object.freeze(Object.defineProperty({__proto__:null,en:Vt,es:zs,fr:Vs,pt:Ys},Symbol.toStringTag,{value:"Module"})),Fn=e=>e in Vt,ye=(e,t,n,r,c={})=>{let i="";return Fn(`${t}_${n}`)?i=e({id:`${t}_${n}`},c):i=e({id:t},{[r]:n,...c}),i},Js=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let c=n.length-1;c>=0;c--){const i=Math.pow(10,(c+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&c<n.length-1&&(e=1,c++),r=`${e}${n[c]}`;break}}return r},Ln=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Xs=e=>e.replace(/\s+/g,"").length>0,Zs=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Ms(e);return t.forEach(({type:r,value:c})=>{Ts(n,r,c)}),n},qs=e=>new Promise(t=>setTimeout(t,e)),ft=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),Q=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:c=!1,element:i="button",onClick:d=!1,className:a="",disabled:l=!1,screenreaderText:o=!1,children:u=!1,...m})=>{const p=Xe(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const k=Object.assign({},t),S=Rn(Object.keys(k));t=Pn(p,S,k)}const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left"))),n.muted&&g.push("muted"),n.fullWidth&&g.push("full-width");const v={...m,className:M(e,a,g,{"no-text":!u,disabled:l,button:c}),onClick:k=>{(!c||c[0]==="#")&&d&&(k.preventDefault(),k.stopPropagation()),d&&d(k)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return c&&(i="a",v.href=c),_.createElement(i,v,u||(o?s.jsx(ue,{showOnFocus:!1,children:o}):null))},Ze=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",c=e.map((i,d)=>r==="p"?s.jsx(Q,{...i},d):s.jsx("li",{children:s.jsx(Q,{...i})},d));return _.createElement(r,{className:M("button-wrapper",t),...n,children:c})};const Re=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:M(e,{"has-max-width":t}),style:n})},qe=({href:e,children:t,fallbackElement:n,className:r="",onClick:c,gtmContext:i,gtmType:d,...a})=>{if(e){const l={...a};return c&&(l.onClick=c),i&&(l["data-gtm-event-context"]=i),d&&(l["data-gtm-event-type"]=d),s.jsx("a",{href:e,className:M("gtm-trackable",r),...l,children:t})}return n?_.createElement(n,{children:t,className:r,...a}):t},xn={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"}},Ks=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:c}=e?xn[e]:xn.fallback;return{range:t&&t.length>0?t:r,sizes:n||c}},er=({format:e,height:t,query:n,width:r})=>{let c=`w=${r}&h=${t}`;return c=e?`${c}&fm=${e}`:c,c=n?`${c}&${n}`:c,c},$t=({format:e,range:t,url:n,query:r})=>t.map(({height:c,width:i})=>`${n}?${er({format:e,height:c,query:r,width:i})} ${i}w`).join(", ");const Yt=({image:e,className:t,testId:n})=>{const{description:r,height:c,type:i,query:d,url:a,width:l,loading:o,decoding:u,fetchPriority:m}=e,{range:h,sizes:p}=Ks(e),g=$t({format:"avif",query:d,range:h,url:a}),v=$t({format:"webp",query:d,range:h,url:a}),k=$t({format:"",query:d,range:h,url:a});return s.jsxs("picture",{className:t,children:[i!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:v,sizes:p,"data-testid":"source"}),s.jsx("img",{srcSet:k,sizes:p,src:a,alt:r,loading:o||"lazy",decoding:u||"async",fetchpriority:m||"auto",width:l,height:c,"data-testid":n||"image"})]})};let We=!1;const In=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=T.useIntl(),c=_.useRef(null),[i,d]=_.useState("hidden");_.useEffect(()=>{const l=c.current;if(l)return l.addEventListener("transitionend",a),()=>{l.removeEventListener("transitionend",a)}},[]);const a=({propertyName:l})=>{l==="opacity"&&(We!==!1&&clearTimeout(We),d(o=>o==="opening"?"open":o==="closing"?"closed":o==="closed"?"hidden":o))};return De(()=>{We!==!1&&clearTimeout(We);let l="open";e?d("opening"):(d("closing"),l="hidden"),We=setTimeout(()=>{d(l)},300)},[e]),s.jsx("aside",{ref:c,className:M("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const bt=({children:e,className:t="",...n})=>s.jsx("section",{className:M("full-width-section",t),...n,children:e});const tr=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(c=>{r.push({href:c.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":c.eventContext||"Download",target:"_blank",children:c.text})}),s.jsx(bt,{className:M("download-section",n),children:s.jsxs(s.Fragment,{children:[_.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Ze,{buttons:r})]})})};const nr=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const c={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:M("logos",n),children:[e&&_.createElement(c.element,{className:"title"},c.text),s.jsx("ul",{className:M({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:d,link:a=!1,description:l=!1},o)=>{if(!i||!i.url)return null;const u=s.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:d});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:a?s.jsx("a",{href:a,target:"_blank",rel:"nofollow noreferrer noopener",children:u}):u}),l&&s.jsx("small",{children:l})]},window.btoa(`${i.url}_${o}`))})})]})};const sr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],rr=({className:e="",content:t,image:n,variant:r="default",spacing:c="normal",cta:i,children:d})=>{const a=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},o={};return a.forEach(u=>{if(!t[u]){o[u]=!1;return}if(typeof t[u]=="object"){o[u]=t[u];const{text:m,element:h}=t[u];if(h&&sr.includes(h.toLowerCase()))return;o[u]={text:m,element:l[u]};return}o[u]={text:t[u],element:l[u]}}),i&&i.link&&i.link[0]==="#"&&(i.props||(i.props={}),i.props.onClick=u=>{u.preventDefault(),u.stopPropagation();const m=document.getElementById(i.link.substring(1));m&&m.scrollIntoView({behavior:"smooth"})}),s.jsx(bt,{className:M("banner-section",r,c,e,{"has-image":n,"has-extra-spacing":c==="normal"&&o.eyebrow&&o.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[a.map(u=>{if(o[u]&&typeof o[u]=="object"){const{text:m,element:h=""}=o[u];return _.createElement(h.toLowerCase(),{key:u,className:u},m)}return null}),d,i&&i.text&&i.link&&s.jsx(Q,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:i.link,...i.props,children:i.text})]}),n&&s.jsx(Yt,{image:{...n,aspect:"banner"}})]})})},ar=_.memo(rr);const or=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:c})=>!n&&!r?null:s.jsxs("aside",{className:M("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(Q,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Ye="https://storage.googleapis.com/apolitical-assets/",Fe={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},ir="200,000+";const Gt=({label:e=!1,className:t="",children:n})=>{const r=T.useIntl();return s.jsxs("details",{className:M("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const Me=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:M("highlighted-text-box",e,t),...r,children:n});const Ke=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let c=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,d=Xe(i);if(i&&typeof n=="object"&&typeof d=="number"){const m=Object.assign({},n.breakpoints),h=Rn(Object.keys(m));c=Pn(d,h,m)}const{breakpoints:a,text:l="",component:o,...u}=n;return s.jsx(Me,{variant:"subtle",className:M("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(xt,{options:{forceBlock:!0},children:t}),c&&typeof n=="object"&&(o||s.jsx(Q,{...u,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ht=({children:e,...t})=>s.jsx("p",{...t,children:e}),Bn={q:Ht,blockquote:Ht};for(let e=1;e<=6;e++)Bn[`h${e}`]={component:Ht,props:{className:"title"}};const On=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:M("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(xt,{options:{wrapper:_.Fragment,forceBlock:!0,overrides:Bn},children:r}):s.jsx("p",{children:r})]});const cr=({className:e="",show:t=!1,hide:n=!1,text:r,children:c})=>{const i=T.useIntl(),d=_.useRef(null),[a,l]=_.useState(""),[o,u]=_.useState("closed");_.useEffect(()=>{const p=d.current;if(p)return p.addEventListener("transitionend",m),()=>{p.removeEventListener("transitionend",m)}},[]),_.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:"Type your {action} here...",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_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",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.",filters_all:"Show all",filters_disabled:"{name} - no results",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",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_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",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",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",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",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",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.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",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",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",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",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",overlay_close:"Close",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",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",progressBar:"{number}% loaded",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",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",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>",tags_community:"From the community",tooltip_loading:"Loading..."},Vs={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>"},Ys={collapsibleSection_summary:"En savoir plus",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>"},Gs={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>"},Js=Object.freeze(Object.defineProperty({__proto__:null,en:Vt,es:Vs,fr:Ys,pt:Gs},Symbol.toStringTag,{value:"Module"})),Ln=e=>e in Vt,ye=(e,t,n,r,i={})=>{let c="";return Ln(`${t}_${n}`)?c=e({id:`${t}_${n}`},i):c=e({id:t},{[r]:n,...i}),c},Xs=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let i=n.length-1;i>=0;i--){const c=Math.pow(10,(i+1)*3);if(c<=e){e=Math.round(e*t/c)/t,e===1e3&&i<n.length-1&&(e=1,i++),r=`${e}${n[i]}`;break}}return r},In=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Zs=e=>e.replace(/\s+/g,"").length>0,qs=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Ms(e);return t.forEach(({type:r,value:i})=>{Cs(n,r,i)}),n},Ks=e=>new Promise(t=>setTimeout(t,e)),ft=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),Q=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:c="button",onClick:u=!1,className:a="",disabled:l=!1,screenreaderText:o=!1,children:m=!1,...d})=>{const p=Xe(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const k=Object.assign({},t),S=Pn(Object.keys(k));t=An(p,S,k)}const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left"))),n.muted&&g.push("muted"),n.fullWidth&&g.push("full-width");const v={...d,className:T(e,a,g,{"no-text":!m,disabled:l,button:i}),onClick:k=>{(!i||i[0]==="#")&&u&&(k.preventDefault(),k.stopPropagation()),u&&u(k)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return i&&(c="a",v.href=i),_.createElement(c,v,m||(o?s.jsx(ue,{showOnFocus:!1,children:o}):null))},Ze=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",i=e.map((c,u)=>r==="p"?s.jsx(Q,{...c},u):s.jsx("li",{children:s.jsx(Q,{...c})},u));return _.createElement(r,{className:T("button-wrapper",t),...n,children:i})};const Re=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:T(e,{"has-max-width":t}),style:n})},qe=({href:e,children:t,fallbackElement:n,className:r="",onClick:i,gtmContext:c,gtmType:u,...a})=>{if(e){const l={...a};return i&&(l.onClick=i),c&&(l["data-gtm-event-context"]=c),u&&(l["data-gtm-event-type"]=u),s.jsx("a",{href:e,className:T("gtm-trackable",r),...l,children:t})}return n?_.createElement(n,{children:t,className:r,...a}):t},bn={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"}},er=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:i}=e?bn[e]:bn.fallback;return{range:t&&t.length>0?t:r,sizes:n||i}},tr=({format:e,height:t,query:n,width:r})=>{let i=`w=${r}&h=${t}`;return i=e?`${i}&fm=${e}`:i,i=n?`${i}&${n}`:i,i},$t=({format:e,range:t,url:n,query:r})=>t.map(({height:i,width:c})=>`${n}?${tr({format:e,height:i,query:r,width:c})} ${c}w`).join(", ");const Yt=({image:e,className:t,testId:n})=>{const{description:r,height:i,type:c,query:u,url:a,width:l,loading:o,decoding:m,fetchPriority:d}=e,{range:h,sizes:p}=er(e),g=$t({format:"avif",query:u,range:h,url:a}),v=$t({format:"webp",query:u,range:h,url:a}),k=$t({format:"",query:u,range:h,url:a});return s.jsxs("picture",{className:t,children:[c!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:v,sizes:p,"data-testid":"source"}),s.jsx("img",{srcSet:k,sizes:p,src:a,alt:r,loading:o||"lazy",decoding:m||"async",fetchpriority:d||"auto",width:l,height:i,"data-testid":n||"image"})]})};let We=!1;const Bn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=M.useIntl(),i=_.useRef(null),[c,u]=_.useState("hidden");_.useEffect(()=>{const l=i.current;if(l)return l.addEventListener("transitionend",a),()=>{l.removeEventListener("transitionend",a)}},[]);const a=({propertyName:l})=>{l==="opacity"&&(We!==!1&&clearTimeout(We),u(o=>o==="opening"?"open":o==="closing"?"closed":o==="closed"?"hidden":o))};return De(()=>{We!==!1&&clearTimeout(We);let l="open";e?u("opening"):(u("closing"),l="hidden"),We=setTimeout(()=>{u(l)},300)},[e]),s.jsx("aside",{ref:i,className:T("tooltip text-medium",c,{loading:t}),hidden:c==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const bt=({children:e,className:t="",...n})=>s.jsx("section",{className:T("full-width-section",t),...n,children:e});const nr=({text:e,buttons:t,className:n=""})=>{const r=[];return t.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})}),s.jsx(bt,{className:T("download-section",n),children:s.jsxs(s.Fragment,{children:[_.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Ze,{buttons:r})]})})};const sr=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const i={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:T("logos",n),children:[e&&_.createElement(i.element,{className:"title"},i.text),s.jsx("ul",{className:T({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:c,nameOfBusiness:u,link:a=!1,description:l=!1},o)=>{if(!c||!c.url)return null;const m=s.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:u});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:a?s.jsx("a",{href:a,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),l&&s.jsx("small",{children:l})]},window.btoa(`${c.url}_${o}`))})})]})};const rr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],ar=({className:e="",content:t,image:n,variant:r="default",spacing:i="normal",hideElements:c={eyebrow:!1,title:!1,text:!1},cta:u,children:a})=>{const l=["eyebrow","title","text"],o={eyebrow:"small",title:"h1",text:"p"},m={};return l.forEach(d=>{if(!t[d]){m[d]=!1;return}if(!c[d]){if(typeof t[d]=="object"){m[d]=t[d];const{text:h,element:p}=t[d];if(p&&rr.includes(p.toLowerCase()))return;m[d]={text:h,element:o[d]};return}m[d]={text:t[d],element:o[d]}}}),u&&u.link&&u.link[0]==="#"&&(u.props||(u.props={}),u.props.onClick=d=>{d.preventDefault(),d.stopPropagation();const h=document.getElementById(u.link.substring(1));h&&h.scrollIntoView({behavior:"smooth"})}),s.jsx(bt,{className:T("banner-section",r,i,e,{"has-image":n,"has-extra-spacing":i==="normal"&&m.eyebrow&&m.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[l.map(d=>{if(m[d]&&typeof m[d]=="object"){const{text:h,element:p=""}=m[d];return _.createElement(p.toLowerCase(),{key:d,className:d},h)}return null}),a,u&&u.text&&u.link&&s.jsx(Q,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:u.link,...u.props,children:u.text})]}),n&&s.jsx(Yt,{image:{...n,aspect:"banner"}})]})})},or=_.memo(ar);const ir=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:s.jsxs("aside",{className:T("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(Q,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Ye="https://storage.googleapis.com/apolitical-assets/",Fe={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},cr="200,000+";const Gt=({label:e=!1,className:t="",children:n})=>{const r=M.useIntl();return s.jsxs("details",{className:T("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const Te=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:T("highlighted-text-box",e,t),...r,children:n});const Ke=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const c=typeof n=="object"&&"breakpoints"in n,u=Xe(c);if(c&&typeof n=="object"&&typeof u=="number"){const d=Object.assign({},n.breakpoints),h=Pn(Object.keys(d));i=An(u,h,d)}const{breakpoints:a,text:l="",component:o,...m}=n;return s.jsx(Te,{variant:"subtle",className:T("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(xt,{options:{forceBlock:!0},children:t}),i&&typeof n=="object"&&(o||s.jsx(Q,{...m,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ht=({children:e,...t})=>s.jsx("p",{...t,children:e}),On={q:Ht,blockquote:Ht};for(let e=1;e<=6;e++)On[`h${e}`]={component:Ht,props:{className:"title"}};const Qn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:T("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(xt,{options:{wrapper:_.Fragment,forceBlock:!0,overrides:On},children:r}):s.jsx("p",{children:r})]});const lr=({className:e="",show:t=!1,hide:n=!1,text:r,children:i})=>{const c=M.useIntl(),u=_.useRef(null),[a,l]=_.useState(""),[o,m]=_.useState("closed");_.useEffect(()=>{const p=u.current;if(p)return p.addEventListener("transitionend",d),()=>{p.removeEventListener("transitionend",d)}},[]),_.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
36
36
  `);l(p.length<3?`${r.substring(0,400)}...`:p.slice(0,3).join(`
37
- `))},[r]),_.useEffect(()=>{o==="ready-to-close"&&u("closing")},[o]);const m=({propertyName:p})=>{p==="max-height"&&u(g=>g==="opening"?"open":g==="closing"?"closed":g)};if(!r)return null;const h=["opening","open"].includes(o);return s.jsxs(Me,{variant:"subtle",className:M("hide-show-text-box",e),children:[s.jsxs("div",{ref:d,className:M("content",o),children:[s.jsx(xt,{options:{forceBlock:!0},children:o==="closed"?a:r}),o!=="closed"&&c]}),s.jsx("p",{className:"cta",children:s.jsx(Q,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:M({"rotate-180":h}),onClick:()=>{u(h?"ready-to-close":"opening")},children:h?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},lr=()=>_.Fragment,ur=({children:e})=>s.jsx(Me,{variant:"secondary",children:e}),dr=["span","strong","h1","h2","h3","h4","h5","h6","p"],mr=({children:e})=>{const t=T.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of _.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(_.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const d of _.Children.toArray(i.props.children))if(!(!d||typeof d=="string"||typeof d=="number")&&_.isValidElement(d)){const a=d.type;if(dr.includes(a)){for(n=d.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(i);const c=n?n.toString():"";return s.jsx(Gt,{label:c,className:["Sources","Resources"].includes(c)?"discrete-links":"",children:r.map(i=>i)})},fr=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(Me,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(Me,{variant:"primary",children:e});case"pink-textbox":return s.jsx(Me,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},hr=e=>{const t=T.useIntl(),n=Date.now().toString();let r="default";const c=e.src;return c.includes("youtube")||c.includes("vimeo")?r="video":c.includes("riddle")||c.includes("sli.do")?r="poll":c.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(ue,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},bn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},pr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,c=!1;for(const i of _.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&_.isValidElement(i)){const d=i.type;if(["button","center","span","strong"].includes(d)&&i.props&&i.props.children&&i.props.children[0])for((d==="button"||bn(i.props.children[0])==="button")&&(c=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!_.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&bn(r)==="button"&&(c=!0);else break}return c?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(Q,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},Qn=({children:e})=>s.jsx("span",{children:e});const Ut=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:_.Fragment,forceBlock:!0,overrides:{a:pr,CollapsibleSection:Gt,TextBox:Me,CaseStudy:ur,style:lr,details:mr,div:fr,iframe:hr}};return s.jsx("div",{className:M("markdown-text",e),children:s.jsx(xt,{options:{...r,...t},children:n})})};const Hn=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:c=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:M("page-heading",c),children:[s.jsxs("div",{className:M("content",{"has-max-width":e}),style:i,children:[t&&t.text&&_.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&_.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Ge=({size:e="medium",variant:t="default",className:n="",children:r,...c})=>s.jsx("span",{className:M("pill",e,t,n),...c,children:r});const ht=({element:e="p",children:t=null,className:n="",...r})=>_.createElement(e,{...r,className:M("status-banner text-small",n),"aria-live":"assertive"},t);const gr=({progress:e=0,text:t=!1,className:n=""})=>{const r=T.useIntl(),c=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return s.jsx("span",{className:M(`progress-bar section-${c}`,n),style:i,children:s.jsx(ue,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},Un=_.memo(gr);const Mt="loadingBlock_",_r=({progress:e=0,steps:t=!1,className:n=""})=>{const r=T.useIntl();t||(t={0:{text:r.formatMessage({id:`${Mt}loading`})},75:{text:r.formatMessage({id:`${Mt}almostDone`})},100:{text:r.formatMessage({id:`${Mt}complete`})}});let c=null;const i=Object.keys(t);for(let a=0;a<i.length&&!(e<parseInt(i[a]));a++)c=i[a];const d=c&&t[c].icon?{"--icon":`url(${Ye}icons/${t[c].icon}.svg)`}:{};return s.jsxs(Me,{className:M("loading-block",n,{"has-icon":c&&t[c].icon}),variant:"subtle",style:d,children:[c&&s.jsx("span",{className:"step",children:t[c].text}),s.jsx(Un,{progress:e})]})},xr=_.memo(_r);const we=({element:e="div",className:t="",...n})=>s.jsx(zt,{element:e,className:M("loading-placeholder",t),...n});const Wt={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"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},Wn=(e,t)=>e in Wt?s.jsx("div",{className:e,children:Wt[e].map((n,r)=>Wn(n,r))},t):s.jsx(we,{className:e},t),br=({layout:e="overview-page",...t})=>s.jsx("div",{className:M("loading-state",e),...t,children:Wt[e].map((n,r)=>Wn(n,r))}),zn=e=>{const t=e&&e.toUpperCase().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},at=["#5AB6A3","#A2D7AF","#806056","#3962B3"],vr=e=>{const t=Math.ceil(26/at.length),n=zn(e).toLowerCase();if(n==="")return at[0];const r=n.charCodeAt(0)-96;for(let c=0;c<at.length;c++)if(r<=t*(c+1))return at[c]};const vn=256,Be=({className:e="",src:t="",name:n,alt:r,width:c=vn,height:i=vn,...d})=>{const[a,l]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{const m=o.current;if(!m)return;const h=m.getContext("2d");if(!h)return;const p=c,g=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=p*window.devicePixelRatio,m.height=g*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=vr(n),h.fillRect(0,0,p,g),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(zn(n),p/2,g/1.6)},[n]);let u=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(u=!0),s.jsx("figure",{className:M("profile-picture",e,{error:a}),...d,children:u?s.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:c,height:i}):s.jsx("canvas",{ref:o})})},Jt=e=>e==="apolitical"?{image:`${Ye}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ye}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},wr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const c=e!=="",i=t!=="",d=n!=="";if(!c&&!i&&!d)return"";const a=`${e}${c&&i?` — ${t}`:t}`;let l=`${a}${(c||i)&&d?`, ${n}`:n}`;return l.length>r&&(l=a),l.length>r&&(l=Ie(l,r)),l};const vt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:c="member-click",className:i=""})=>{const d=T.useIntl(),a=Jt(t);a.name||(a.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:l,url:o,image:u}=a,m=wr(a),h=n&&n.createdAt?Qt(n.createdAt):!1,p=n&&n.createdAt?An(n.createdAt):"";return _.createElement(e,{className:M("member text-medium",i),children:s.jsxs(qe,{href:o,gtmType:c,gtmContext:r,onClick:g=>{g==null||g.stopPropagation()},children:[s.jsx(Be,{name:l,src:u}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:l}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&s.jsx("span",{className:"date",title:p,"aria-label":p,children:d.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&s.jsx("em",{children:d.formatMessage({id:"discussion_edited"})})]}),m&&s.jsx("small",{children:m})]})]})})};const wn={small:24,medium:48},Xt=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:c,showGap:i,showPlaceholders:d}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:l="",...o})=>{const u=T.useIntl();return!n||n.length===0?null:_.createElement(e,{...o,className:M("contributors",l,c,{"has-gap":i}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((m,h)=>{let p,g="";if(h<a){const{name:v="",image:k=""}=Jt(m);if(d)return s.jsx(we,{element:"li",className:"contributor"},h);p=s.jsx(Be,{name:v,src:k,width:wn[c||"medium"],height:wn[c||"medium"]})}else if(h===a){const v=(t||n.length)-a;p=s.jsxs("small",{className:M({"large-number":v>99}),children:["+",Js(v,0)]}),g="number-left"}return p?s.jsx("li",{className:M("contributor",g),children:p},h):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?u.formatMessage({id:`member_${n[0]}`}):Ie(n[0].name||"",20):null})]})})},Vn=({showDevTools:e=!0,children:t})=>{const n=new W.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(W.QueryClientProvider,{client:n,children:[t,e&&s.jsx(Cs.ReactQueryDevtools,{initialIsOpen:!1})]})};var kr=_.createContext({client:mt});function jr(e){var t=e.children,n=e.client,r=e.apiKey,c=e.options,i=_.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&&c&&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&&(mt.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),mt.init(r,c)),mt)},[n,r]);return _.createElement(kr.Provider,{value:{client:i}},t)}const Yn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(jr,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"https://eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,Gn=({children:e,locale:t,messages:n})=>{const r=t||"en",c={...Gs[r],...n||{}};return s.jsx(T.IntlProvider,{locale:r,messages:c,children:e})},ke=_.createContext(null),Jn=({children:e,user:t})=>s.jsx(ke.Provider,{value:t,children:e}),yr=({bootstrap:e,children:t,intl:n})=>{const[r,c]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(i=>{c({...i,isLoading:!1}),Ln(5e3)}).catch(()=>c({isLoading:!1}))},[]),s.jsx(Gn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx($n.CookiesProvider,{children:s.jsx(Jn,{user:r,children:s.jsx(Vn,{children:s.jsx(Yn,{user:r,children:t})})})})})};const Tt="joinCommunityButton",Zt=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const c=T.useIntl(),i=_.useContext(ke),d=i&&typeof i.id=="string",[a,l]=_.useState(e),[o,u]=_.useState(e?"joined":"notJoined");_.useEffect(()=>{o==="joining"?u("joined"):o==="leaving"&&u("notJoined")},[a]);const m={},h={};return a&&o!=="leaving"&&(m["data-hover-text"]=c.formatMessage({id:`${Tt}_leave`}),m["aria-label"]=c.formatMessage({id:`${Tt}_member_aria`}),h["aria-hidden"]="true"),s.jsx(Q,{variant:a?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:a&&o!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{d&&(p.currentTarget.blur(),a?(u("leaving"),typeof r=="function"&&await r()):(u("joining"),typeof n=="function"&&await n()),l(!a))},className:M("join-community-button",o,{active:o==="joining"}),disabled:!d,...m,children:s.jsx("span",{className:"text",...h,children:c.formatMessage({id:`${Tt}${["joining","leaving"].includes(o)?`_${o}`:a?"_member":t?"_short":""}`})})})};const Ct="communityDetails_",Er=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:c=[]}={number:0,data:[]},functions:{invite:i,...d}})=>{const a=T.useIntl(),l=5,o=r||c.length,u=c.length?c:Array(l).fill({});return s.jsxs("div",{className:M("community-details",e),children:[s.jsx(Re,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[a.formatMessage({id:`${Ct}members`}),s.jsx("span",{className:"count",children:o})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${n}/members`,children:a.formatMessage({id:`${Ct}viewAll`})})})]}),s.jsx(Xt,{contributors:{total:r,data:u},styling:{size:"medium",showGap:!0,showPlaceholders:o===0},cutoff:l})]}),s.jsx(Zt,{isMember:t,functions:{...d}}),t&&s.jsx(Q,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:a.formatMessage({id:`${Ct}invite`})})]})};const Sr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=T.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(ue,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:M("breadcrumbs text-small",n),children:e.map(({text:c,href:i,current:d=!1},a)=>s.jsxs("li",{children:[d&&s.jsx(ue,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(qe,{href:d?void 0:i,children:Ie(c,t)})]},`${window.btoa(c)}_${a}`))})]})};const $r=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:c=""})=>{const i=T.useIntl(),d=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[a,l]=_.useState(t?["all"]:[]),o=(u,m)=>{let h=[];a.includes(u)?h=a.filter(p=>p!==u):u==="all"?h=["all"]:n?h=[...a.filter(p=>p!=="all"),u]:h=[u],l(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),m&&typeof m=="function"&&m()};return s.jsx("ul",{className:M("filters",c),children:d.map(({id:u,text:m,disabled:h=!1,callback:p=()=>{}})=>{let g={};return h&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),s.jsx("li",{children:s.jsx("button",{className:M(u,{selected:a.includes(u)}),onClick:v=>{v.preventDefault(),v.stopPropagation(),o(u,p)},...g,children:m})},u)})})},Mr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:c,position:i})=>{i==="before-lang"?r+=`/${c}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${c}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Nt={en:"English",es:"Español",fr:"Français",pt:"Português"},ot="languageSwitcher_",Tr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:c=()=>{},urlParts:i,variant:d="default",label:a,className:l=""})=>{const o=T.useIntl(),[u,m]=_.useState(e);if(_.useEffect(()=>{e!==u&&m(e)},[e]),!r||!Object.values(r).some(v=>v&&v.post_name))return null;const p=Object.keys(r),g=u!==e;return s.jsxs("div",{className:M("language-switcher text-small",d,l),children:[s.jsxs("nav",{children:[d!=="short"&&s.jsx("p",{children:a||o.formatMessage({id:`${ot}label`})}),s.jsx("ul",{children:p.map(v=>{if(!Nt[v])return null;let k={className:v};return u===v?k["aria-label"]=o.formatMessage({id:`${ot}selected`},{language:Nt[v]}):k={...k,href:Mr(v,i),onClick:S=>{S.preventDefault(),S.stopPropagation(),m(v),c(v)}},s.jsx("li",{children:s.jsx(qe,{...k,fallbackElement:"span",children:Nt[v]})},v)})}),d!=="short"&&!g&&s.jsx("p",{children:o.formatMessage({id:`${ot}translation_${t?"original":n?"human":"machine"}`})})]}),d!=="short"&&!g&&!t&&!n&&s.jsx("small",{children:o.formatMessage({id:`${ot}disclaimer`},{email:Fe.support,link:v=>{const k=`mailto:${v}`;return s.jsx("a",{href:k,children:v})}})})]})};const Dt=T.createIntl({locale:"en",messages:Vt}),Xn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:c=!1,messages:i={button:Dt.formatMessage({id:"loadMore_button"}),endOfFeed:Dt.formatMessage({id:"loadMore_endOfFeed"}),error:Dt.formatMessage({id:"loadMore_error"})},className:d="",gtmContext:a="LoadMore"})=>{const[l,o]=_.useState(!1),[u,m]=_.useState(!1);if(t<=0||t<n*e)return null;const h=async p=>{try{await r(p)}catch(g){g instanceof Error&&g.message&&g.message.includes("Cannot read items")?m(!0):o(!0)}};return s.jsxs("footer",{className:M("load-more",d),children:[l&&s.jsx("p",{className:"error",children:i.error}),u?s.jsx("p",{children:i.endOfFeed}):s.jsx(Q,{variant:"secondary",icon:c,onClick:h,"data-gtm-event-context":a,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:i.button})]})};const qt=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:M("logo",e,t,n),...r,children:s.jsx(ue,{children:s.jsx(T.FormattedMessage,{id:"apolitical"})})})});let it=!1;const Zn=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const c=T.useIntl(),i=_.useRef(null),[d,a]=_.useState(!1),l=o=>{i.current&&o.target instanceof HTMLElement&&!i.current.contains(o.target)&&a(!1)};return _.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),_.createElement(e,{ref:i,className:M("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!d),"aria-haspopup":"true","aria-expanded":d,"aria-controls":t,screenreaderText:c.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!d,children:n.map(({href:o,onClick:u,text:m,icon:h,...p},g)=>{const v={...p,onClick:k=>{a(!1),typeof u=="function"&&u(k)},onFocus:()=>{it&&(clearTimeout(it),it=!1)},onBlur:()=>{it=setTimeout(()=>{a(!1)},100)}};return o&&(v.href=o),s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...v,children:m})},`${window.btoa(m)}_${g}`)})})]})})},Cr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Nr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],qn=({activeLink:e})=>{const t=T.useIntl(),n=_.useContext(ke),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Nr.map(({key:c,href:i})=>s.jsx("li",{className:M(c,{active:Cr(i,e)}),children:s.jsx("a",{href:i,"data-gtm-event-type":`${c}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${c}`})})},c)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Be,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},ze=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Dr=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${ze(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${ze(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${ze(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
37
+ `))},[r]),_.useEffect(()=>{o==="ready-to-close"&&m("closing")},[o]);const d=({propertyName:p})=>{p==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)};if(!r)return null;const h=["opening","open"].includes(o);return s.jsxs(Te,{variant:"subtle",className:T("hide-show-text-box",e),children:[s.jsxs("div",{ref:u,className:T("content",o),children:[s.jsx(xt,{options:{forceBlock:!0},children:o==="closed"?a:r}),o!=="closed"&&i]}),s.jsx("p",{className:"cta",children:s.jsx(Q,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:T({"rotate-180":h}),onClick:()=>{m(h?"ready-to-close":"opening")},children:h?n||c.formatMessage({id:"hideShowTextBox_hide"}):t||c.formatMessage({id:"hideShowTextBox_show"})})})]})},ur=()=>_.Fragment,dr=({children:e})=>s.jsx(Te,{variant:"secondary",children:e}),mr=["span","strong","h1","h2","h3","h4","h5","h6","p"],fr=({children:e})=>{const t=M.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const c of _.Children.toArray(e))if(!(!c||typeof c=="string"||typeof c=="number"))if(_.isValidElement(c)&&c.type==="summary"){if(c.props&&c.props.children){for(const u of _.Children.toArray(c.props.children))if(!(!u||typeof u=="string"||typeof u=="number")&&_.isValidElement(u)){const a=u.type;if(mr.includes(a)){for(n=u.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(c);const i=n?n.toString():"";return s.jsx(Gt,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(c=>c)})},hr=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(Te,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(Te,{variant:"primary",children:e});case"pink-textbox":return s.jsx(Te,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},pr=e=>{const t=M.useIntl(),n=Date.now().toString();let r="default";const i=e.src;return i.includes("youtube")||i.includes("vimeo")?r="video":i.includes("riddle")||i.includes("sli.do")?r="poll":i.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(ue,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},vn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},gr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,i=!1;for(const c of _.Children.toArray(e))if(!(!c||typeof c=="string"||typeof c=="number")&&_.isValidElement(c)){const u=c.type;if(["button","center","span","strong"].includes(u)&&c.props&&c.props.children&&c.props.children[0])for((u==="button"||vn(c.props.children[0])==="button")&&(i=!0),r=c.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!_.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&vn(r)==="button"&&(i=!0);else break}return i?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(Q,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},Hn=({children:e})=>s.jsx("span",{children:e});const Ut=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:_.Fragment,forceBlock:!0,overrides:{a:gr,CollapsibleSection:Gt,TextBox:Te,CaseStudy:dr,style:ur,details:fr,div:hr,iframe:pr}};return s.jsx("div",{className:T("markdown-text",e),children:s.jsx(xt,{options:{...r,...t},children:n})})};const Un=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:i=""})=>{const c=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:T("page-heading",i),children:[s.jsxs("div",{className:T("content",{"has-max-width":e}),style:c,children:[t&&t.text&&_.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&_.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Ge=({size:e="medium",variant:t="default",className:n="",children:r,...i})=>s.jsx("span",{className:T("pill",e,t,n),...i,children:r});const ht=({element:e="p",children:t=null,className:n="",...r})=>_.createElement(e,{...r,className:T("status-banner text-small",n),"aria-live":"assertive"},t);const _r=({progress:e=0,text:t=!1,className:n=""})=>{const r=M.useIntl(),i=e>75?100:e>50?75:e>25?50:e>5?25:0,c={"--progress":`${e}%`};return s.jsx("span",{className:T(`progress-bar section-${i}`,n),style:c,children:s.jsx(ue,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},Wn=_.memo(_r);const Tt="loadingBlock_",xr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=M.useIntl();t||(t={0:{text:r.formatMessage({id:`${Tt}loading`})},75:{text:r.formatMessage({id:`${Tt}almostDone`})},100:{text:r.formatMessage({id:`${Tt}complete`})}});let i=null;const c=Object.keys(t);for(let a=0;a<c.length&&!(e<parseInt(c[a]));a++)i=c[a];const u=i&&t[i].icon?{"--icon":`url(${Ye}icons/${t[i].icon}.svg)`}:{};return s.jsxs(Te,{className:T("loading-block",n,{"has-icon":i&&t[i].icon}),variant:"subtle",style:u,children:[i&&s.jsx("span",{className:"step",children:t[i].text}),s.jsx(Wn,{progress:e})]})},br=_.memo(xr);const we=({element:e="div",className:t="",...n})=>s.jsx(zt,{element:e,className:T("loading-placeholder",t),...n});const Wt={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"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},zn=(e,t)=>e in Wt?s.jsx("div",{className:e,children:Wt[e].map((n,r)=>zn(n,r))},t):s.jsx(we,{className:e},t),vr=({layout:e="overview-page",...t})=>s.jsx("div",{className:T("loading-state",e),...t,children:Wt[e].map((n,r)=>zn(n,r))}),Vn=e=>{const t=e&&e.toUpperCase().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},at=["#5AB6A3","#A2D7AF","#806056","#3962B3"],wr=e=>{const t=Math.ceil(26/at.length),n=Vn(e).toLowerCase();if(n==="")return at[0];const r=n.charCodeAt(0)-96;for(let i=0;i<at.length;i++)if(r<=t*(i+1))return at[i]};const wn=256,Be=({className:e="",src:t="",name:n,alt:r,width:i=wn,height:c=wn,...u})=>{const[a,l]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{const d=o.current;if(!d)return;const h=d.getContext("2d");if(!h)return;const p=i,g=c;typeof window<"u"&&window.devicePixelRatio&&(d.width=p*window.devicePixelRatio,d.height=g*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=wr(n),h.fillRect(0,0,p,g),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(Vn(n),p/2,g/1.6)},[n]);let m=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(m=!0),s.jsx("figure",{className:T("profile-picture",e,{error:a}),...u,children:m?s.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:i,height:c}):s.jsx("canvas",{ref:o})})},Jt=e=>e==="apolitical"?{image:`${Ye}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ye}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},kr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const i=e!=="",c=t!=="",u=n!=="";if(!i&&!c&&!u)return"";const a=`${e}${i&&c?` — ${t}`:t}`;let l=`${a}${(i||c)&&u?`, ${n}`:n}`;return l.length>r&&(l=a),l.length>r&&(l=Ie(l,r)),l};const vt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:i="member-click",className:c=""})=>{const u=M.useIntl(),a=Jt(t);a.name||(a.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:l,url:o,image:m}=a,d=kr(a),h=n&&n.createdAt?Qt(n.createdAt):!1,p=n&&n.createdAt?Fn(n.createdAt):"";return _.createElement(e,{className:T("member text-medium",c),children:s.jsxs(qe,{href:o,gtmType:i,gtmContext:r,onClick:g=>{g==null||g.stopPropagation()},children:[s.jsx(Be,{name:l,src:m}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:l}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&s.jsx("span",{className:"date",title:p,"aria-label":p,children:u.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&s.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]}),d&&s.jsx("small",{children:d})]})]})})};const kn={small:24,medium:48},Xt=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:c,showPlaceholders:u}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:l="",...o})=>{const m=M.useIntl();return!n||n.length===0?null:_.createElement(e,{...o,className:T("contributors",l,i,{"has-gap":c}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((d,h)=>{let p,g="";if(h<a){const{name:v="",image:k=""}=Jt(d);if(u)return s.jsx(we,{element:"li",className:"contributor"},h);p=s.jsx(Be,{name:v,src:k,width:kn[i||"medium"],height:kn[i||"medium"]})}else if(h===a){const v=(t||n.length)-a;p=s.jsxs("small",{className:T({"large-number":v>99}),children:["+",Xs(v,0)]}),g="number-left"}return p?s.jsx("li",{className:T("contributor",g),children:p},h):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Ie(n[0].name||"",20):null})]})})},Yn=({showDevTools:e=!0,children:t})=>{const n=new W.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(W.QueryClientProvider,{client:n,children:[t,e&&s.jsx(Ns.ReactQueryDevtools,{initialIsOpen:!1})]})};var jr=_.createContext({client:mt});function yr(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,c=_.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&&(mt.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),mt.init(r,i)),mt)},[n,r]);return _.createElement(jr.Provider,{value:{client:c}},t)}const Gn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(yr,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"https://eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,Jn=({children:e,locale:t,messages:n})=>{const r=t||"en",i={...Js[r],...n||{}};return s.jsx(M.IntlProvider,{locale:r,messages:i,children:e})},ke=_.createContext(null),Xn=({children:e,user:t})=>s.jsx(ke.Provider,{value:t,children:e}),Er=({bootstrap:e,children:t,intl:n})=>{const[r,i]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),In(5e3)}).catch(()=>i({isLoading:!1}))},[]),s.jsx(Jn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Tn.CookiesProvider,{children:s.jsx(Xn,{user:r,children:s.jsx(Yn,{children:s.jsx(Gn,{user:r,children:t})})})})})};const Mt="joinCommunityButton",Zt=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const i=M.useIntl(),c=_.useContext(ke),u=c&&typeof c.id=="string",[a,l]=_.useState(e),[o,m]=_.useState(e?"joined":"notJoined");_.useEffect(()=>{o==="joining"?m("joined"):o==="leaving"&&m("notJoined")},[a]);const d={},h={};return a&&o!=="leaving"&&(d["data-hover-text"]=i.formatMessage({id:`${Mt}_leave`}),d["aria-label"]=i.formatMessage({id:`${Mt}_member_aria`}),h["aria-hidden"]="true"),s.jsx(Q,{variant:a?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:a&&o!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{u&&(p.currentTarget.blur(),a?(m("leaving"),typeof r=="function"&&await r()):(m("joining"),typeof n=="function"&&await n()),l(!a))},className:T("join-community-button",o,{active:o==="joining"}),disabled:!u,...d,children:s.jsx("span",{className:"text",...h,children:i.formatMessage({id:`${Mt}${["joining","leaving"].includes(o)?`_${o}`:a?"_member":t?"_short":""}`})})})};const Ct="communityDetails_",Sr=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:i=[]}={number:0,data:[]},functions:{invite:c,...u}})=>{const a=M.useIntl(),l=5,o=r||i.length,m=i.length?i:Array(l).fill({});return s.jsxs("div",{className:T("community-details",e),children:[s.jsx(Re,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[a.formatMessage({id:`${Ct}members`}),s.jsx("span",{className:"count",children:o})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${n}/members`,children:a.formatMessage({id:`${Ct}viewAll`})})})]}),s.jsx(Xt,{contributors:{total:r,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:o===0},cutoff:l})]}),s.jsx(Zt,{isMember:t,functions:{...u}}),t&&s.jsx(Q,{variant:"primary",onClick:c,icon:{icon:"plus"},styling:{fullWidth:!0},children:a.formatMessage({id:`${Ct}invite`})})]})};const $r=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(ue,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:T("breadcrumbs text-small",n),children:e.map(({text:i,href:c,current:u=!1},a)=>s.jsxs("li",{children:[u&&s.jsx(ue,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(qe,{href:u?void 0:c,children:Ie(i,t)})]},`${window.btoa(i)}_${a}`))})]})};const Tr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:i=""})=>{const c=M.useIntl(),u=t?[{id:"all",text:typeof t!="boolean"&&t.text||c.formatMessage({id:"filters_all"})},...e]:e,[a,l]=_.useState(t?["all"]:[]),o=(m,d)=>{let h=[];a.includes(m)?h=a.filter(p=>p!==m):m==="all"?h=["all"]:n?h=[...a.filter(p=>p!=="all"),m]:h=[m],l(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),d&&typeof d=="function"&&d()};return s.jsx("ul",{className:T("filters",i),children:u.map(({id:m,text:d,disabled:h=!1,callback:p=()=>{}})=>{let g={};return h&&(g={disabled:!0,"aria-label":c.formatMessage({id:"filters_disabled"},{name:d})}),s.jsx("li",{children:s.jsx("button",{className:T(m,{selected:a.includes(m)}),onClick:v=>{v.preventDefault(),v.stopPropagation(),o(m,p)},...g,children:d})},m)})})},Mr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:i,position:c})=>{c==="before-lang"?r+=`/${i}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${i}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Nt={en:"English",es:"Español",fr:"Français",pt:"Português"},ot="languageSwitcher_",Cr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i=()=>{},urlParts:c,variant:u="default",label:a,className:l=""})=>{const o=M.useIntl(),[m,d]=_.useState(e);if(_.useEffect(()=>{e!==m&&d(e)},[e]),!r||!Object.values(r).some(v=>v&&v.post_name))return null;const p=Object.keys(r),g=m!==e;return s.jsxs("div",{className:T("language-switcher text-small",u,l),children:[s.jsxs("nav",{children:[u!=="short"&&s.jsx("p",{children:a||o.formatMessage({id:`${ot}label`})}),s.jsx("ul",{children:p.map(v=>{if(!Nt[v])return null;let k={className:v};return m===v?k["aria-label"]=o.formatMessage({id:`${ot}selected`},{language:Nt[v]}):k={...k,href:Mr(v,c),onClick:S=>{S.preventDefault(),S.stopPropagation(),d(v),i(v)}},s.jsx("li",{children:s.jsx(qe,{...k,fallbackElement:"span",children:Nt[v]})},v)})}),u!=="short"&&!g&&s.jsx("p",{children:o.formatMessage({id:`${ot}translation_${t?"original":n?"human":"machine"}`})})]}),u!=="short"&&!g&&!t&&!n&&s.jsx("small",{children:o.formatMessage({id:`${ot}disclaimer`},{email:Fe.support,link:v=>{const k=`mailto:${v}`;return s.jsx("a",{href:k,children:v})}})})]})};const Dt=M.createIntl({locale:"en",messages:Vt}),Zn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:i=!1,messages:c={button:Dt.formatMessage({id:"loadMore_button"}),endOfFeed:Dt.formatMessage({id:"loadMore_endOfFeed"}),error:Dt.formatMessage({id:"loadMore_error"})},className:u="",gtmContext:a="LoadMore"})=>{const[l,o]=_.useState(!1),[m,d]=_.useState(!1);if(t<=0||t<n*e)return null;const h=async p=>{try{await r(p)}catch(g){g instanceof Error&&g.message&&g.message.includes("Cannot read items")?d(!0):o(!0)}};return s.jsxs("footer",{className:T("load-more",u),children:[l&&s.jsx("p",{className:"error",children:c.error}),m?s.jsx("p",{children:c.endOfFeed}):s.jsx(Q,{variant:"secondary",icon:i,onClick:h,"data-gtm-event-context":a,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:c.button})]})};const qt=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:T("logo",e,t,n),...r,children:s.jsx(ue,{children:s.jsx(M.FormattedMessage,{id:"apolitical"})})})});let it=!1;const qn=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=M.useIntl(),c=_.useRef(null),[u,a]=_.useState(!1),l=o=>{c.current&&o.target instanceof HTMLElement&&!c.current.contains(o.target)&&a(!1)};return _.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),_.createElement(e,{ref:c,className:T("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!u),"aria-haspopup":"true","aria-expanded":u,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!u,children:n.map(({href:o,onClick:m,text:d,icon:h,...p},g)=>{const v={...p,onClick:k=>{a(!1),typeof m=="function"&&m(k)},onFocus:()=>{it&&(clearTimeout(it),it=!1)},onBlur:()=>{it=setTimeout(()=>{a(!1)},100)}};return o&&(v.href=o),s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...v,children:d})},`${window.btoa(d)}_${g}`)})})]})})},Nr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Dr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],Kn=({activeLink:e})=>{const t=M.useIntl(),n=_.useContext(ke),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Dr.map(({key:i,href:c})=>s.jsx("li",{className:T(i,{active:Nr(c,e)}),children:s.jsx("a",{href:c,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${i}`})})},i)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Be,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},ze=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Rr=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${ze(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${ze(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${ze(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
38
38
 
39
- ${ze(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ze(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,c)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(c))}];const Rr="shareLinks_",Pr=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:c="large",variant:i="default",className:d=""})=>{const a=T.useIntl(),l=Dr({title:e,link:t,referrer:n});return s.jsxs("aside",{className:M("share-links",c,i,d),children:[s.jsx("p",{className:"text-small",children:a.formatMessage({id:"shareLinks_label"})}),s.jsx("ul",{children:l.map(({key:o,icon:u,url:m,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const g={};return p&&(g.onClick=v=>p(v,m)),s.jsx("li",{children:s.jsx(Q,{size:c,variant:"tertiary",icon:{icon:u||o},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${o}-click`,"data-testid":"link",screenreaderText:a.formatMessage({id:`${Rr}link_${o}`}),...g})},o)})})]})};const Ar={"2-1":901,"1-3":769},Kn=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const c=Xe(!0);let i=r;return _.Children.count(r)===1&&(i=_.Children.toArray(r)[0],i.props&&(i=i.props.children)),s.jsx("section",{className:M("columns",`layout-${e}`,n),children:_.Children.map(i,(d,a)=>t!==!1&&a===t&&c&&c<Ar[e]?null:d)})},Fr=({activeLink:e,...t})=>s.jsx(Kn,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(qn,{activeLink:e}),s.jsx(Hn,{...t})]})});const Rt="cookieBanner_",Pt=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],At=new Date(Date.now()+12*30*24*60*60*1e3),es=()=>{const e=T.useIntl(),[t,n,r]=$n.useCookies(Pt),[c,i]=_.useState(!t["apol-cookie-banner"]),d=()=>{Pt.forEach(u=>{n(u,!0,{path:"/",expires:At,domain:u==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:At}),Pt.forEach(u=>{if(u==="apol-cookie-banner"){n(u,!0,{path:"/",expires:At});return}r(u)}),i(!1)};if(!c)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:d,gtmType:"accepted-all"}],o=[];return l.forEach(u=>{o.push({variant:u.href?"tertiary":"primary",href:u.href,onClick:u.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${u.gtmType}-click`,children:e.formatMessage({id:`${Rt}buttons_${u.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${Rt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${Rt}text`})}),s.jsx(Ze,{buttons:o})]})},$e={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-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:Fe["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Fe["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:Fe.support,gtmType:"concierge-email-click"},business:{email:Fe.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 Le="footer_",pt="SiteFooter",kn=({group:e})=>{const t=$e[e].order||[];let n=!1;return"text"in $e[e]&&(n=$e[e].text),s.jsxs(_.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(T.FormattedMessage,{id:`${Le}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:c,gtmType:i}=$e[e][r],d={};return["legal"].includes(e)&&(d.target="_blank",d.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:c,className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":i,...d,children:s.jsx(T.FormattedMessage,{id:`${Le}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&s.jsx("dl",{className:"text-medium",children:n.order.map(r=>s.jsxs(_.Fragment,{children:[s.jsx("dt",{children:s.jsx(T.FormattedMessage,{id:`${Le}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(T.FormattedMessage,{id:`${Le}${e}_${r}_address`,values:{br:s.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&s.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Kt=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(zt,{element:"hr"}),s.jsx(qt,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":"logo-homepage-link"}),s.jsx("footer",{children:["platform","community","company","contact"].map(e=>s.jsxs("div",{className:"group",children:[s.jsx(kn,{group:e}),Object.keys($e[e]).includes("child")&&s.jsx(kn,{group:$e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray($e.social.order)&&$e.social.order.map(e=>{const t=$e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(T.FormattedMessage,{id:`${Le}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(T.FormattedMessage,{id:`${Le}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const ct="emailHelperTextBox_",Lr=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const c=T.useIntl(),[i,d]=_.useState({path:`${ct}default`,type:"default",link:{},mail:{},error:""}),[a,l]=_.useState(!1),o=_.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=v=>{d({path:`${ct}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:k=>o(k),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:v})};if(typeof r!="function"){g(c.formatMessage({id:`${ct}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(v=>{g(v.message)}).finally(()=>{l(!1)})},[t,n,r]);_.useEffect(()=>{let p=ct,g="default",v={},k={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",v={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",g="error",k={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",g="error",v={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:S=>o(S),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",v={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},k={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",v={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}d({...i,path:p,type:g,link:v,mail:k})},[e]);const u={};return["link","mail"].forEach(p=>{u[p]=Object.keys(i[p]).length?g=>s.jsx("a",{...i[p],children:g}):g=>g}),s.jsx(On,{type:i.type,heading:a?!1:c.formatMessage({id:`${i.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(we,{element:"span"}),s.jsx(we,{element:"span"})]}):c.formatMessage({id:`${i.path}_text`},{...u,strong:p=>s.jsx("strong",{children:p}),em:p=>s.jsx("em",{children:p}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:i.error})})};const lt="passwordRules_",ts="isMoreThanEightCharacters",ns="includesNumberAndSymbol",ss="includesLowerAndUppercase",Ir={[ts]:"8Characters",[ns]:"numberSymbol",[ss]:"lowercaseUppercase"},Br=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=T.useIntl();return s.jsxs("aside",{className:M("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${lt}intro`})}),s.jsx("ul",{children:[ts,ns,ss].map(r=>s.jsxs("li",{className:M({matches:e[r]}),children:[s.jsxs(ue,{children:[n.formatMessage({id:`${lt}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${lt}rule_${Ir[r]}`})}),!e[r]&&s.jsxs(ue,{element:"strong",children:[" "," ",n.formatMessage({id:`${lt}notMet`})]})]},`rule-${r}`))})]})},Or=_.memo(Br);const Qr=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:c=()=>{}},className:i="",hasLoaded:d=!1})=>{const a=T.useIntl(),[l,o]=_.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const S=await n();o(j=>({...j,setUp:!0,id:S&&S.id,disabled:!1}))}catch(S){o(j=>({...j,setUp:!0,disabled:!0})),c(S)}};if(_.useEffect(()=>{d&&!l.setUp&&u()},[d]),!d)return s.jsx(we,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,g="ratings_",v={text:a.formatMessage({id:`${g}text`}),low:a.formatMessage({id:`${g}low`}),high:a.formatMessage({id:`${g}high`}),success:a.formatMessage({id:`${g}success`}),...e},k=async S=>{if(!(!m||p))try{o(j=>({...j,rating:S,disabled:!0})),await r({id:m,value:S})}catch(j){o(x=>({...x,rating:null})),c(j)}finally{o(j=>({...j,disabled:!1}))}};return s.jsxs("div",{className:M("rating",i),children:[s.jsx("span",{className:"label",children:v[h?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(S=>{const j=S+1;return s.jsx("li",{className:M({selected:h&&j<=h}),children:s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:`star${!h||j>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${g}stars`},{number:j,total:t})}${j===1||j===t?` - ${v[j===1?"low":"high"]}`:""}`,onClick:x=>{x.preventDefault(),x.stopPropagation(),k(j)},disabled:p})},`rating-${j}`)})})]})};const rs=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:c="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:d=!0,isDesktopVersion:a=!1}=n||{},l=T.useIntl(),o=_.useRef(null);De(()=>{!n||a||!d||o.current&&o.current.focus()},[d]);const u=m=>{m.preventDefault(),m.stopPropagation(),!(!o.current||!o.current.value||o.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(o.current.value)}`)};return s.jsx("form",{onSubmit:u,className:M("search-form gtm-trackable",t),"data-gtm-event-context":c,"data-gtm-event-type":i,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!d:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(ue,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),s.jsx("input",{ref:o,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&u(m)}}),s.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),o.current&&o.current.value&&(o.current.value="")},children:s.jsx(ue,{children:l.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:u,children:s.jsx(ue,{children:l.formatMessage({id:"search_cta"})})})]})})})};const as=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:c,backgroundColor:i,onClose:d,reportError:a,sendInvites:l,initialFormStatus:o="NOT_SUBMITTED"})=>{const[u,m]=_.useState([]),[h,p]=_.useState(!0),[g,v]=_.useState(o),{formatMessage:k}=T.useIntl(),S=async C=>{C.preventDefault();try{await l(u),m([]),v("SUCCESS")}catch(R){v("ERROR"),a(R)}},j=C=>{C.preventDefault(),v("NOT_SUBMITTED"),p(!0),m([])},x=C=>{C.preventDefault(),d(),v("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?s.jsxs("div",{className:"invite-form-wrapper",children:[s.jsx("div",{className:"content centred",children:g==="SUCCESS"?s.jsx("h2",{className:"success-title",children:k({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",k({id:"inviteForm_error"})]})}),s.jsx(Re,{}),s.jsx("div",{className:"footer",children:g==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"secondary",onClick:j,children:k({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(Q,{onClick:x,children:k({id:"inviteForm_ctaDone"})})]}):s.jsx(Q,{onClick:j,children:k({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:i},onSubmit:S,className:M("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:c},children:t}),s.jsx(Ns.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:k({id:"inviteForm_email_placeholder"}),emails:u,onChange:C=>{m(C),p(!C.length)},autoFocus:!1,getLabel:(C,R,A)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:C}),s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{A(R),p(!u.length)},className:"remove-email-button",screenreaderText:k({id:"overlay_close"})})]},R)})]}),s.jsx(Re,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(Q,{className:"sendEmailsButton",disabled:h,children:n})})]})})},H={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const d=`logged${e?"In":"Out"}`;return t>=n[i][d]};let c={};return["navigation","search"].forEach(i=>{c[i]=r(i)}),c},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(c=>c===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const c=Date.now();if(!t&&H.handlerCalled[e]&&c-H.handlerCalled[e]<500)return;H.handlerCalled[e]=c;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(d=>{d===e||n[d]===!1||i.push({type:`menus.${d}`,value:!1})}),r(i)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const c=Mn(e[r],t);if(!(typeof c>"u")&&(!n||c[t]&&c[t].includes(n)||c.value&&c.value.includes(n)||c.toString().includes(n)))return e[r]}return e[0].children?H.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:c})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let d,a;switch(e){case"navigation":if(n){const l=H.findFirstChild(t.current.children,"attributes.aria-controls","navigation");d=H.findFirstChild(l.children,"href")}else d=H.findFirstChild(t.current.children,"href");d||(d=t.current);break;case"account":if(a=H.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;d=H.findFirstChild(a.children,"href");break;default:return}d&&(c([{type:`focusElements.${e}.${i}`,value:d}]),d.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(H.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(H.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(H.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{H.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Je={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","q-and-a","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},"q-and-a":{href:"/questions-answers/",className:"icon q-and-a"},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"}}}},gt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:c=()=>{},doTrack:i=null})=>{const d=T.useIntl(),a=Mn(Je,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const l="doTrack"in a,o=i===null?l?a.doTrack:!0:i,u=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(a.href){let j=a.gtmType||`${e}-click`;if(j.includes(".")){const x=j.split("."),C=x[x.length-2];j=`${C==="topics"?`${C}-`:""}${x[x.length-1]}`}h={href:a.href,role:"menuitem"},o&&(h={...h,className:"gtm-trackable","data-gtm-event-type":j,"data-gtm-event-context":"HeaderButtons"}),u&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const p=a.order&&a.order[0]&&a[a.order[0]],g=p&&a[a.order[0]].order,v=h&&window.location.pathname===a.href;let k={},S={};if(p){const j=a.menuId||e,x={onClick:C=>H.events.onClick(C,{id:j,callback:c,isOpen:r[j]}),onFocus:()=>H.events.onFocus({id:j}),onBlur:()=>H.events.onBlur({id:j,callback:c}),onMouseLeave:()=>H.events.onBlur({id:j,callback:c}),onMouseEnter:()=>H.events.onMouseEnter({id:j,callback:c})};n&&(g&&(k={...x,onKeyPress:C=>{C.key==="Enter"&&H.events.onClick(C,{id:j,callback:c,isOpen:r[j]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[j],"aria-controls":j}),S={hidden:j in r?!r[j]:!0}),g||(S={...S,...x})}return s.jsxs("li",{className:M({[a.className]:a.className,"has-submenu":p,parent:g,active:v}),role:"none",...k,children:[h?_.createElement(u?Q:"a",h,d.formatMessage({id:m})):d.formatMessage({id:m}),a.order&&s.jsx("ul",{...S,children:a.order.map(j=>{if(!a[j])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:c,doTrack:l?o:null};return a[j].order?s.jsxs("li",{className:M({[a[j].className]:a[j].className}),children:[d.formatMessage({id:`${m}_${j}`}),s.jsx("ul",{children:a[j].order.map(C=>s.jsx(gt,{id:`${e}.${j}.${C}`,...x},C))})]},j):s.jsx(gt,{id:`${e}.${j}`,...x},j)})})]},e)};const Hr={height:67,height_desktop:83},en=({showNavigation:e=!0})=>{const t=T.useIntl(),n=_.useContext(ke),r=Xe(!0,!0),c=n&&typeof n.id=="string",i=_.useMemo(()=>H.getIsDesktopVersion(c,r),[c,r]),[d,a]=_.useReducer(Zs,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:o,focusElements:u}=d;Dn({scrollPosition:Hr[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!i&&o.navigation||H.shouldChangeHeaderIsVisible(!0,o,a)},scrollDown:()=>{!i&&o.navigation||H.shouldChangeHeaderIsVisible(!1,o,a)}}});const m=(p,g)=>{H.handleMenus({id:p,value:g,menus:o,dispatch:a})},h=_.useRef(null);return De(()=>{o.navigation&&H.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:u,dispatch:a})},[o.navigation]),De(()=>{o.account&&H.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:u,dispatch:a})},[o.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:M({"logged-in":c,"logged-out":!c,visible:l}),children:[s.jsx(ue,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(qt,{}),e&&s.jsxs(s.Fragment,{children:[!i.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),m("navigation",!o.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":o.navigation,"aria-controls":"navigation",children:s.jsx(ue,{children:t.formatMessage({id:`header_menu_${o.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||o.account?!1:!o.navigation,role:"menu","data-showing":!i.navigation&&o.account?"account":"default",children:Je.order.map(p=>s.jsx(gt,{id:p,isLoggedIn:c,isDesktopVersion:i.navigation,menus:{navigation:o.navigation,account:o.account},callback:m},p))}),!i.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),m("search",!o.search)},"aria-haspopup":"true","aria-expanded":o.search,"aria-controls":"search-form",children:s.jsx(ue,{children:t.formatMessage({id:`header_search_${o.search?"hide":"show"}`})})}),s.jsx(rs,{id:"global-search",handleToggle:{searchIsOpen:o.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),c?s.jsxs("button",{className:"account-button",onClick:p=>H.events.onClick(p,{id:"account",callback:m,isOpen:o.account}),onMouseEnter:()=>H.events.onMouseEnter({id:"account",callback:m}),onMouseLeave:()=>H.events.onBlur({id:"account",callback:m}),"aria-haspopup":"true","aria-expanded":o.account,"aria-controls":"navigation",children:[s.jsx(ue,{children:t.formatMessage({id:`header_account_${o.account?"hide":"show"}`})}),s.jsx(Be,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:Je.buttons.order.map(p=>s.jsx(gt,{id:`buttons.${p}`},p))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:M("overlay",{open:o.navigation||o.account||!i.search&&o.search})})]})};const tn=({element:e="section",children:t,className:n,...r})=>_.createElement(e,{className:M("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const nn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:c=()=>{},onClose:i=()=>{}}={},forceShow:{error:d=!1}={},title:a,children:l,buttons:o,className:u="",gtmContext:m="Modal"})=>{const h=T.useIntl(),[p,g]=_.useState(t),v=S=>{g(S),S?(c(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};_.useEffect(()=>{v(t)},[t]);const k=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:M("overlay",{open:p}),children:s.jsx(tn,{id:e,className:M("overlay-modal",u,{"has-max-width":r}),hidden:!p,style:k,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[a&&s.jsx("h2",{className:"modal-title",children:a}),s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>v(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Re,{}),l,o&&s.jsxs("div",{className:"bottom",children:[s.jsx(Re,{}),s.jsx(Ze,{buttons:o})]}),d&&s.jsx(ht,{className:"error",children:d})]})})})},os=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Ur=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:c="Invite your colleagues by typing or pasting their emails below.",ctaMessage:i="Send",showIcon:d,onClose:a,reportError:l=()=>{},sendInvites:o})=>s.jsx(nn,{title:n,isOpen:t,showDivider:!1,showIcon:d,functions:{onClose:a},className:M("invite-modal",e,{success:!!n}),children:s.jsx(as,{title:r,label:c,ctaMessage:i,onClose:a,sendInvites:o,reportError:l})});const Wr=()=>{const e=T.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(en,{}),s.jsx("div",{id:"content",children:s.jsx(Ke,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Kt,{})]})},is=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:c={},styling:i={},className:d="",locale:a="en"})=>{const{navigation:l=!0,footer:o=!0}=c,{background:u="default",variant:m="default",circle:h="default"}=i,p=Cn();_.useEffect(()=>{window.scrollTo(0,0)},[p]);const g=ft(e,{locale:a}),v=ft(t,{locale:a}),k=ft(n,{locale:a}),S={};return u!=="default"&&(S[u]=!0),m!=="default"&&(S[m]=!0),h!=="default"&&(S[h]=!0),s.jsx(Ds.ErrorBoundary,{onError:r,fallback:s.jsx(Wr,{}),children:s.jsx(_.Suspense,{fallback:null,children:s.jsxs("div",{id:"wrapper",className:M(d,S,{"has-footer":o}),children:[s.jsx(en,{showNavigation:l}),s.jsxs("section",{id:"content-wrapper",children:[v&&s.jsx("div",{className:"additional-content prepended",children:v}),_.createElement(u==="bold"?tn:"div",{id:"content",children:g})]}),k&&s.jsx("div",{className:"additional-content appended",children:k}),o&&s.jsx(Kt,{}),s.jsx(es,{})]})})})},jn={default:"tags_",headerTopics:"header_topics_topics_"},Ft={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"},zr={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ft.topic[e.replace("topic_","")],e){const t=Je.topics.topics[e].href;return t?{id:e,href:t,text:`${jn.headerTopics}${e}`}:null}return null}return Ft[e]?(e=Ft[e],{id:e,text:`${jn.default}${e}`}):null}};const Vr=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:c="",gtmType:i="tag-click",gtmContext:d="tags"})=>{const a=T.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(o=>{if(!o)return;const u=zr.getTagDetails(o);u&&l.push(u)}),l.length<1?null:s.jsx("ul",{className:M("tags text-small",t,c,{"one-line":n}),children:l.map(o=>{const u=a.formatMessage({id:o.text});return s.jsx("li",{children:o.href&&r?s.jsx("a",{href:o.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":d,children:u}):u},o.id)})})};const Yr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:c="member-click",className:i=""})=>{const d=T.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:M("members-list",i),children:[s.jsxs("h1",{children:[d.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((a,l)=>s.jsxs("li",{children:[s.jsx(vt,{member:a,gtmContext:r,gtmType:c}),a.isAdmin&&s.jsx(Ge,{children:d.formatMessage({id:"membersList_admin"})})]},l))}),n&&s.jsx(Xn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let ut=null;const xe="discussion_form_",sn=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:c=5e4,minRows:i=4,forceShow:d={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var P,Y;const o=T.useIntl(),u=_.useContext(ke),[m,h]=_.useState(n.isEditing&&n.isEditing.text||""),[p,g]=_.useState(d.error||!1),[v,k]=_.useState(!1),S=_.useRef(null);if(r||(r=S),n.isLoading)return s.jsx(we,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const j=b=>{const Z=b.target.value;h(Z);let y;!u||!u.id?y=ye(o.formatMessage,`${xe}error_loggedOut`,e.type,"action"):t?Z.length>=c&&(y=`${xe}error_tooLong`):y=ye(o.formatMessage,`${xe}error_noPermission`,e.type,"action"),y?g(y):p&&g(!1)};let x=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const b=e.type==="response"?((P=e.slugs)==null?void 0:P.question)||"":((Y=e.slugs)==null?void 0:Y.answer)||"";b&&(x=`${x}-${b.slice(-15)}`)}const C=async b=>{var y;if(b.preventDefault(),b.stopPropagation(),!u||!u.id||!t||A)return;ut&&clearTimeout(ut),k("submitting");const Z=window.location.pathname;try{let w;switch(e.type){case"post":w=await a.create({content:m});break;case"question":w=await a.create({title:m,authorId:u&&u.id,...(y=a.props)==null?void 0:y.create});break;case"response":w=await a.create({question:e.slugs.question},{body:m,authorId:u&&u.id,contentPath:Z});break;case"reply":w=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:m,authorId:u&&u.id,contentPath:Z});break;default:break}await qs(1e3),a.callback&&await a.callback(w),ut=setTimeout(()=>{h(""),k("submitted"),R()},500)}catch(w){const z=w;let J=`${xe}error`;z.message.includes("entry already exists")&&(J=ye(o.formatMessage,`${xe}error_alreadyExists`,e.type,"action")),z.message.includes("429")?J=ye(o.formatMessage,`${xe}error_tooMany`,e.type,"action"):z.message.includes("400")&&(J=`${xe}error`),g(J),R()}},R=()=>{ut=setTimeout(()=>{g(!1),k(!1)},5e3)},A=!m||!Xs(m),V=v==="submitting",D=[];return(n.isEditing&&!V||d.cancel)&&D.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!d.cancel&&(!u||!u.id||!m),children:o.formatMessage({id:`${xe}cancel`})}),D.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:b=>{if(n.isEditing){k("submitting"),a.handleSaveEdit&&a.handleSaveEdit(S.current&&"value"in S.current?S.current.value:"");return}C(b)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!u||!u.id||!t||A||V||n.isEditing&&m===n.isEditing.text,children:o.formatMessage({id:`${xe}${V?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:x,className:M("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:ye(o.formatMessage,`${xe}title`,e.type,"action")}),s.jsx(vt,{member:u||"community",gtmContext:l,gtmType:"profile-click"}),s.jsx(ue,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:ye(o.formatMessage,`${xe}label`,e.type,"action")}),s.jsx(Rs,{ref:r,id:`${x}-input`,name:e.type,placeholder:ye(o.formatMessage,`${xe}placeholder`,e.type,"action"),onChange:j,value:m,maxLength:c,"aria-invalid":!!p,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),s.jsx("small",{children:ye(o.formatMessage,`${xe}explainer`,e.type,"action",{a:b=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:b})})}),s.jsx(Ze,{buttons:D}),v==="submitted"&&s.jsx(ht,{className:"success","data-testid":"success",children:ye(o.formatMessage,`${xe}success`,e.type,"action")}),p&&s.jsx(ht,{id:"error-message",className:"error","data-testid":"error",children:d.error?d.error:typeof p=="string"?p.includes(" ")?p:o.formatMessage({id:p},{action:o.formatMessage({id:`discussion_action_${e.type}`}),maxLength:c}):p})]})},wt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:c,leave:i,notMemberStateText:d}})=>r&&!n?s.jsx(Ke,{text:d,button:{component:s.jsx(Zt,{functions:{join:c,leave:i}})}}):s.jsx(sn,{content:{type:e,slugs:{}},functions:{create:t}}),Gr={showThread:!1,showForm:!1},et=_.createContext(Gr),cs=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(et.Provider,{value:{...t,updateConversation:n},children:e})},Jr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Xr=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ve=!1;const Lt=()=>{Ve!==!1&&(clearTimeout(Ve),Ve=!1)},It=5,ls=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:c=!1,content:i={type:"reply",slugs:{}},canLike:d=!0,functions:{createLike:a=()=>{},deleteLike:l=()=>{}}={}})=>{const o=T.useIntl();_.useEffect(()=>{p(c)},[c]);const[u,m]=_.useState(t),[h,p]=_.useState(c),[g,v]=_.useState(!1),[k,S]=_.useState(!1),j=_.useMemo(()=>Xr(n,It),[n]),x=R=>{if(R.preventDefault(),R.stopPropagation(),S(!1),Ve)return Lt(),!1;if(Lt(),g||!d)return!1;Ve=setTimeout(C,350)},C=async()=>{if(Lt(),g||!d)return!1;let R=h?u-1:u+1;R<0&&(R=0),v(!0),m(R),p(!h);try{if(i&&i.slugs){const A=Jr(i.slugs);h?await l(A):await a(A,{contentPath:window.location.pathname})}}catch{m(t),p(c)}finally{v(!1)}};return _.createElement(e,{className:M("likes-wrapper text-medium action-button",{"show-spinner":g,"is-liked":h,disabled:!d}),onClick:x,onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},onFocus:()=>{S(!0)},onBlur:()=>{S(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:M({"do-animation":h&&!c}),screenreaderText:d?o.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:o.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:x,disabled:!d,"aria-hidden":!d,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),s.jsx("span",{className:M("number-of-likes",{"no-likes":u===0}),"data-testid":"number-of-likes",children:o.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:u})}),n&&s.jsx(In,{isOpen:k,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[j.map(R=>typeof R=="string"||!R.name?null:s.jsx("li",{children:s.jsx(qe,{href:R.id?`/profiles/${R.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:A=>A==null?void 0:A.stopPropagation(),children:R.name})},R.id||window.btoa(R.name))),n.length>It&&s.jsx("li",{children:o.formatMessage({id:"discussion_likes_more"},{number:n.length-It})})]})})]})})},yn=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},rn=(e,t)=>e&&!t;const Se="discussion_",Zr=280,tt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:c,functions:{content:{createContent:i,deleteContent:d,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:l,deleteLike:o}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:u}={openComments:()=>{}}},links:m={},className:h,gtmContext:p="DiscussionAnswer",children:g,isTruncated:v=!1})=>{const k=T.useIntl(),S=_.useContext(ke),j=_.useContext(et),[x,C]=_.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[R,A]=_.useState(!1),[V,D]=_.useState("");if(_.useEffect(()=>{C({...x,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(we,{className:"discussion-card discussion-post"});const{author:P,canLike:Y,createdAt:b,id:Z,likes:y=0,userLiked:w,comments:z=0}=t,J=v?Ie(x.body,Zr):x.body,ne=S&&S.id&&typeof P!="string"&&P.id&&P.id===S.id||!1,se=typeof Y=="boolean"?Y:n?!ne:!1,re=async L=>{L||(L=""),D("");try{if(!Ps(L,x.body)){const ae=t.type==="question"?{title:L}:{body:L};await a(yn(t.slugs),ae)}C({body:L,isEditing:!1,didEdit:!0})}catch{D(`${Se}form_error`)}},q=()=>{j&&j.updateConversation&&j.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const ae=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,me=document.getElementById(ae),oe=document.getElementById(`${ae}-input`);oe&&oe.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},de=()=>{A(!1);try{d(yn(t.slugs))}catch{D("delete-error")}},ce=[{text:k.formatMessage({id:`${Se}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(k.formatMessage({id:`${Se}report_subject`}))}&body=${encodeURI(k.formatMessage({id:`${Se}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&ne&&ce.push({text:k.formatMessage({id:`${Se}moreMenu_edit`}),onClick:()=>C({...x,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`edit-${t.type}-click`},{text:k.formatMessage({id:`${Se}moreMenu_delete`}),onClick:L=>{L.preventDefault(),L.stopPropagation(),A(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`delete-${t.type}-click`,...os(`delete-${t.slug}-modal`,R)}),_.createElement(e,{className:M("discussion-post",h),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:Z||t.slug,className:M("discussion-card",t.type,{editing:x.isEditing,"has-link":m.post&&!x.isEditing}),onClick:L=>{!m.post||x.isEditing||(L.preventDefault(),L.stopPropagation(),window.location.href=m.post)},children:[!x.isEditing&&s.jsx(vt,{member:P,additionalContent:{createdAt:b,didEdit:x.didEdit},className:typeof P!="string"&&P.id===c?"highlighted":"",gtmContext:p,gtmType:"profile-click"}),x.isEditing?s.jsx(sn,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:x.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?k.formatMessage({id:V},{action:k.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:i,handleSaveEdit:re,handleCancel:()=>{D(""),C({...x,isEditing:!1})}},gtmContext:`${p}Form`}):m.post?s.jsx("a",{href:m.post,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":"title-click",children:s.jsx(Ut,{options:{overrides:{a:Qn}},children:J})}):s.jsx(Ut,{options:{wrapper:t.type==="question"?"h1":_.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:J}),!x.isEditing&&s.jsxs("ul",{className:M("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(ls,{element:"li",likes:y,isShort:!1,userLiked:w,content:{type:t.type,slugs:t.slugs},canLike:se,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:l,deleteLike:o}}),(["question","post"].includes(t.type)||m.comments||typeof u=="function")&&s.jsxs("li",{className:"action-button",onClick:L=>{L.preventDefault(),L.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof u=="function"&&u()},children:[s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:m.comments?m.comments:!1,onClick:m.comments||typeof u!="function"?!1:u,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:k.formatMessage({id:`${Se}comments_screenReader`},{count:z})}),s.jsx("span",{children:k.formatMessage({id:`${Se}comments`},{count:z})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:q,children:k.formatMessage({id:`${Se}reply`})})}),s.jsx(Zn,{element:"li",id:`more-${t.slug}`,options:ce})]})]}),g,s.jsx(nn,{id:`delete-${t.slug}-modal`,isOpen:R,functions:{onOpen:()=>{},onClose:()=>A(!1)},forceShow:{error:V==="delete-error"?k.formatMessage({id:"discussion_delete_error"},{action:k.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:k.formatMessage({id:"discussion_delete_title"},{action:k.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>A(!1),children:k.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:de,children:k.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(T.FormattedMessage,{id:"discussion_delete_text",values:{p:L=>s.jsx("p",{children:L}),action:k.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Bt="discussion_responses_",qr=({type:e="answer",responses:t=0})=>{const n=T.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${Bt}title`},{action:n.formatMessage({id:`${Bt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ye(n.formatMessage,`${Bt}empty`,e,e)})]})};const us=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=T.useIntl(),c=_.useRef(null),i=_.useContext(et),[d,a]=_.useState("closed");_.useEffect(()=>{const m=c.current;if(m)return m.addEventListener("transitionend",l),()=>{m.removeEventListener("transitionend",l)}},[]),De(()=>{d==="closed"&&!i.showThread||a(["opening","open"].includes(d)?"ready-to-close":"opening")},[i.showThread]),_.useEffect(()=>{d==="ready-to-close"&&a("closing")},[d]);const l=({propertyName:m})=>{m==="max-height"&&a(h=>h==="opening"?"open":h==="closing"?"closed":h)},o=["opening","open"].includes(d),u=ft(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(Q,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${o?"left":"right"}`},onClick:()=>{var m;(m=i.updateConversation)==null||m.call(i,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${o?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:c,className:M("thread",d),hidden:!i.showThread,children:u})]})},Kr=({user:e,content:t,verb:n="post"})=>({actor:{id:e.id,data:{name:e.name,organization:e==null?void 0:e.organization,jobTitle:e==null?void 0:e.jobTitle}},content:t,latest_reactions:{like:[]},reaction_counts:{like:0},verb:n}),ea=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:a})=>{if(!n)return;const l=Kr({user:n,content:a,verb:"post"});await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return e.setQueryData(t,u=>[...u,l]),{previousActivities:o}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),ta=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),o=l==null?void 0:l.map(u=>((u==null?void 0:u.id)===(d==null?void 0:d.activityId)&&(u.content=a),u));return e.setQueryData(t,()=>o&&[...o]),{previousActivities:o}},onError:(d,a,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),na=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:d})=>{await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),l=a==null?void 0:a.filter(o=>(o==null?void 0:o.id)!==d);return e.setQueryData(t,()=>l&&[...l]),{previousActivities:l}},onError:(d,a,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:(d,a,l)=>{e.invalidateQueries({queryKey:[...t,l.activityId]})}}),sa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:a})=>{await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),o=l==null?void 0:l.map(u=>{var m;return(u==null?void 0:u.id)===a&&((m=u.reaction_counts)!=null&&m.like?u.reaction_counts.like+=1:u.reaction_counts.like=1),u});return e.setQueryData(t,()=>o&&[...o]),{previousActivities:o}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivities)},onSuccess:a=>{const l=e.getQueryData(t),o=l==null?void 0:l.map(u=>{var m,h;return(u==null?void 0:u.id)===(a==null?void 0:a.activity_id)&&((m=u.own_reactions)!=null&&m.like?u.own_reactions.like.push(a):u.own_reactions.like=[a],(h=u.latest_reactions)!=null&&h.like?u.latest_reactions.like.push(a):u.own_reactions.like=[a]),u});return e.setQueryData(t,()=>o&&[...o]),{previousActivities:l}},onSettled:(a,l,o)=>{e.invalidateQueries({queryKey:[...t,o.activityId]})}}),ra=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:l})=>{await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),u=o==null?void 0:o.map(m=>{var h;return(m==null?void 0:m.id)===l&&(h=m.reaction_counts)!=null&&h.like&&(m.reaction_counts.like-=1),m});return e.setQueryData(t,()=>u&&[...u]),{previousActivities:u}},onError:(l,o,u)=>{e.setQueryData(t,u.previousActivities)},onSuccess:(l,{activityId:o})=>{const u=e.getQueryData(t),m=u==null?void 0:u.map(h=>{var p,g,v,k,S;if(h.id===o){const j=(v=(g=(p=h.own_reactions)==null?void 0:p.like)==null?void 0:g.find(x=>x.user_id===(n==null?void 0:n.id)))==null?void 0:v.id;return h.own_reactions.like=(k=h.own_reactions.like)==null?void 0:k.filter(x=>x.id!==j),h.latest_reactions.like=(S=h.latest_reactions.like)==null?void 0:S.filter(x=>x.id!==j),h}else return h});return e.setQueryData(t,()=>m&&[...m]),{previousActivities:u}},onSettled:(l,o,u)=>{e.invalidateQueries({queryKey:[...t,u.activityId]})}}),aa=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:c,edit:i,remove:d,like:a,unlike:l,join:o,leave:u}})=>{const m=T.useIntl(),h=W.useQueryClient(),p=_.useContext(ke),{data:g,error:v,isLoading:k,isFetching:S}=W.useQuery({queryKey:[e,t],queryFn:r}),j=ea({queryClient:h,queryKey:[e,t],user:p,mutationFn:c}),{mutate:x}=W.useMutation(j),C=ta({queryClient:h,queryKey:[e,t],mutationFn:async w=>await i(w)}),{mutate:R}=W.useMutation(C),A=na({queryClient:h,queryKey:[e,t],mutationFn:async({activityId:w})=>await d({activityId:w})}),{mutate:V}=W.useMutation(A),D=sa({queryClient:h,queryKey:[e,t],mutationFn:a}),{mutate:P}=W.useMutation(D),Y=ra({queryClient:h,queryKey:[e,t],user:p,mutationFn:async({activityId:w})=>{var ne,se,re;const z=g&&(g==null?void 0:g.find(q=>q.id===w)),J=(re=(se=(ne=z==null?void 0:z.own_reactions)==null?void 0:ne.like)==null?void 0:se.find(q=>q.user_id===(p==null?void 0:p.id)))==null?void 0:re.id;await l({reactionId:J||"",activityId:w})}}),{mutate:b}=W.useMutation(Y),Z=_.useCallback(({activityId:w})=>P({activityId:w}),[P]),y=_.useCallback(({activityId:w})=>b({activityId:w}),[b]);return v?s.jsx(Ke,{variant:"error",text:v.message}):k?s.jsx(we,{style:{height:"400px"}}):s.jsxs("section",{children:[s.jsx(wt,{contentType:"post",createPost:x,membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:u,notMemberStateText:m.formatMessage({id:"community_joinToPost"})}}),!S&&Array.isArray(g)&&(g==null?void 0:g.map(w=>{var ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he;const z=((ne=w==null?void 0:w.actor)==null?void 0:ne.id)===(p==null?void 0:p.id),J=rn(n,z);return s.jsxs(_.Fragment,{children:[s.jsx(tt,{content:{type:"post",body:w==null?void 0:w.content,canLike:J,createdAt:(w==null?void 0:w.time)||"",slugs:{parentId:t,activityId:w==null?void 0:w.id},slug:w==null?void 0:w.id,author:{id:(se=w==null?void 0:w.actor)==null?void 0:se.id,name:`${(q=(re=w==null?void 0:w.actor)==null?void 0:re.data)==null?void 0:q.name}`,organization:(ce=(de=w==null?void 0:w.actor)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(ae=(L=w==null?void 0:w.actor)==null?void 0:L.data)==null?void 0:ae.jobTitle,image:{thumbnail:((oe=(me=w==null?void 0:w.actor)==null?void 0:me.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:((pe=w==null?void 0:w.own_reactions)==null?void 0:pe.like)&&((fe=w==null?void 0:w.own_reactions)==null?void 0:fe.like.length)>0,likes:(w==null?void 0:w.reaction_counts.like)||0,comments:(w==null?void 0:w.reaction_counts.reply)||0,peopleWhoLiked:((ge=w==null?void 0:w.latest_reactions)==null?void 0:ge.like)&&((he=w==null?void 0:w.latest_reactions)==null?void 0:he.like.map(B=>{var G,ie;return{id:B==null?void 0:B.user_id,name:(ie=(G=B==null?void 0:B.user)==null?void 0:G.data)==null?void 0:ie.name}}))},links:{post:`${e}/${t}/${w==null?void 0:w.id}`,comments:`${e}/${t}/${w==null?void 0:w.id}`},functions:{content:{createContent:()=>null,deleteContent:B=>V(B),updateContent:(B,G)=>R({activityInfo:B,content:G})},likes:{createLike:()=>{Z({activityId:w==null?void 0:w.id})},deleteLike:()=>{y({activityId:w==null?void 0:w.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(Re,{})]},w==null?void 0:w.id)}))]})},oa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{var o;const l=e.getQueryData(t);if(l)return(o=l==null?void 0:l.latest_reactions)!=null&&o.reply?(l.latest_reactions.reply.unshift(a),l&&(l.reaction_counts={reply:l.latest_reactions.reply.length})):(l.latest_reactions={reply:[a]},l.reaction_counts={reply:1}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),ia=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:i,content:{body:d}})=>{var o,u,m;if(d.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((o=a==null?void 0:a.latest_reactions)!=null&&o.reply))return;const l=(m=(u=a==null?void 0:a.latest_reactions)==null?void 0:u.reply)==null?void 0:m.map(h=>(h.id===i.replySlug&&(h.data.content=d),h));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}},onError:(i,d,a)=>{e.setQueryData(t,a.previousActivity)}}),ca=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:i})=>{var l,o,u;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);if(!d||!((l=d==null?void 0:d.latest_reactions)!=null&&l.reply))return;const a=(u=(o=d==null?void 0:d.latest_reactions)==null?void 0:o.reply)==null?void 0:u.filter(m=>m.id!==i);return e.setQueryData(t,()=>({...d,latest_reactions:{reply:a}})),{previousActivity:d}},onError:(i,d,a)=>{e.setQueryData(t,a.previousActivity)}}),la=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d})=>{var o,u;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),l=(u=(o=a==null?void 0:a.latest_reactions)==null?void 0:o.reply)==null?void 0:u.map(m=>{var h;return m.id===d&&((h=m.children_counts)!=null&&h.like?m.children_counts.like+=1:m.children_counts={like:1}),m});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}},onError:(d,a,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:d=>{var o;const a=e.getQueryData(t),l=(o=a==null?void 0:a.latest_reactions.reply)==null?void 0:o.map(u=>{var m,h;return u.id===d.id&&((m=u.own_children)!=null&&m.like?u.own_children.like.push(d):u.own_children={like:[d]},(h=u.latest_children)!=null&&h.like?u.latest_children.like.push(d):u.latest_children={like:[d]}),u});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}}}),ua=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);if(!l)return;const o=(u=l.latest_reactions.reply)==null?void 0:u.map(m=>(m.id===a&&m.children_counts.like&&(m.children_counts.like-=1),m));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,{replyId:l})=>{var m;const o=e.getQueryData(t);if(!o)return;const u=(m=o.latest_reactions.reply)==null?void 0:m.map(h=>{var p,g,v;if(h.id===l){let k=(p=h.latest_children.reply)==null?void 0:p.filter(S=>S.user_id!==(n==null?void 0:n.id));return k=(v=(g=h==null?void 0:h.own_children)==null?void 0:g.reply)==null?void 0:v.filter(S=>S.user_id!==(n==null?void 0:n.id)),k}return h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:u}})),{previousActivity:o}}}),da=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:a=>{var u;const l=e.getQueryData(t),o=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(m=>(m.id===a.parent&&(m.latest_children.reply&&m.children_counts.reply?(m.latest_children.reply.push(a),m.children_counts.reply+=1):(m.latest_children.reply=[a],m.children_counts.reply=1)),m));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),ma=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,d,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyInfo:i,content:{body:d}})=>{var o,u,m;if(d.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((o=a==null?void 0:a.latest_reactions)!=null&&o.reply))return;const l=(m=(u=a==null?void 0:a.latest_reactions)==null?void 0:u.reply)==null?void 0:m.map(h=>{var p;return h.id===i.replyParentId&&((p=h.latest_children.reply)==null||p.map(g=>(g.id===i.replySlug&&(g.data.content=d),g))),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}}}),fa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,d,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyId:i,replyParentId:d})=>{var o,u,m;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((o=a==null?void 0:a.latest_reactions)!=null&&o.reply))return;const l=(m=(u=a==null?void 0:a.latest_reactions)==null?void 0:u.reply)==null?void 0:m.map(h=>{var p,g;return h.id===d&&(h.latest_children.reply=(p=h.latest_children.reply)==null?void 0:p.filter(v=>v.id!==i),(g=h.children_counts)!=null&&g.reply&&(h.children_counts.reply-=1)),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}}}),ha=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d,replyParentId:a})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),o=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(m=>{var h;return m.id===a&&((h=m.latest_children.reply)==null||h.map(p=>{var g;return p.id===d&&((g=p.children_counts)!=null&&g.like?p.children_counts.like+=1:p.children_counts={like:1}),p})),m});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}},onError:(d,a,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(d,a)=>{var u;const l=e.getQueryData(t),o=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(m=>{var h;return m.id===a.replyParentId&&((h=m.latest_children.reply)==null||h.map(p=>(p.id===a.replyId&&(p.latest_children=p.latest_children||{},p.own_children=p.own_children||{},p.latest_children.like=p.latest_children.like||[],p.own_children.like=p.own_children.like||[],p.latest_children.like.push(d),p.own_children.like.push(d)),p))),m});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}}}),pa=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:a,replyParentId:l})=>{var m;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),u=(m=o==null?void 0:o.latest_reactions.reply)==null?void 0:m.map(h=>{var p;return h.id===l&&((p=h.latest_children.reply)==null||p.map(g=>{var v;return g.id===a&&((v=g.children_counts)!=null&&v.like?g.children_counts.like-=1:g.children_counts={like:0}),g})),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:u}})),{previousActivity:o}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,l)=>{var m;const o=e.getQueryData(t),u=(m=o==null?void 0:o.latest_reactions.reply)==null?void 0:m.map(h=>{var p;return h.id===l.replyParentId&&((p=h.latest_children.reply)==null||p.map(g=>{var v,k;return g.id===l.replyId&&((v=g.own_children)!=null&&v.like&&(g.own_children.like=g.own_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id))),(k=g.latest_children)!=null&&k.like&&(g.latest_children.like=g.latest_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id)))),g})),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:u}})),{previousActivity:o}}}),ga=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:c,replies:i,functions:{create:d,edit:a,remove:l,join:o,leave:u,like:m,unlike:h}})=>{const p=T.useIntl(),g=W.useQueryClient(),v=_.useContext(ke),k=_.useContext(et),S=da({queryClient:g,queryKey:[e,t,r],mutationFn:async y=>d({replyId:n,content:y.body})}),{mutate:j}=W.useMutation(S),x=ma({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:C}=W.useMutation(x),R=fa({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:y})=>l({replyId:y})}),{mutate:A}=W.useMutation(R),V=ha({queryClient:g,queryKey:[e,t,r],mutationFn:m}),{mutate:D}=W.useMutation(V),P=pa({queryClient:g,queryKey:[e,t,r],user:v,mutationFn:h}),{mutate:Y}=W.useMutation(P),b=_.useCallback(({replyId:y,replyParentId:w})=>D({replyId:y,replyParentId:w}),[D]),Z=_.useCallback(({replyId:y,replyParentId:w})=>Y({replyId:y,replyParentId:w}),[Y]);return s.jsx(us,{count:c,showRepliesButton:c>0||k.showForm,children:s.jsxs(s.Fragment,{children:[k.showForm&&s.jsx(wt,{contentType:"reply",createPost:(y,w)=>j(w),membershipRequiredToPost:{isMember:!0,required:!0,join:o,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(i==null?void 0:i.length)===0||(i==null?void 0:i.map(y=>{var w,z,J,ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he;return s.jsx(tt,{content:{type:"reply",body:typeof y.data.content=="string"?(w=y==null?void 0:y.data)==null?void 0:w.content:((J=(z=y==null?void 0:y.data)==null?void 0:z.content)==null?void 0:J.text)||"",createdAt:y==null?void 0:y.created_at,slugs:{parentId:t,activityId:r,replyParentId:y==null?void 0:y.parent,reply:y==null?void 0:y.id},slug:"",author:{id:(ne=y==null?void 0:y.user)==null?void 0:ne.id,name:(re=(se=y==null?void 0:y.user)==null?void 0:se.data)==null?void 0:re.name,organization:(de=(q=y==null?void 0:y.user)==null?void 0:q.data)==null?void 0:de.organization,jobTitle:(L=(ce=y==null?void 0:y.user)==null?void 0:ce.data)==null?void 0:L.jobTitle,image:{thumbnail:((me=(ae=y==null?void 0:y.user)==null?void 0:ae.data)==null?void 0:me.thumbnail)||void 0}},userLiked:((oe=y==null?void 0:y.own_children)==null?void 0:oe.like)&&((pe=y==null?void 0:y.own_children)==null?void 0:pe.like.length)>0,likes:((fe=y==null?void 0:y.children_counts)==null?void 0:fe.like)||0,peopleWhoLiked:((ge=y==null?void 0:y.latest_children)==null?void 0:ge.like)&&((he=y==null?void 0:y.latest_children)==null?void 0:he.like.map(B=>{var G,ie;return{id:B==null?void 0:B.user_id,name:(ie=(G=B==null?void 0:B.user)==null?void 0:G.data)==null?void 0:ie.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:B=>{const{replySlug:G,replyParentId:ie}=B;return A({replyId:G,replyParentId:ie})},updateContent:(B,G)=>C({replyInfo:B,content:G})},likes:{createLike:()=>b({replyId:y==null?void 0:y.id,replyParentId:y==null?void 0:y.parent}),deleteLike:()=>{var G,ie,K;const B=((G=y==null?void 0:y.own_children)==null?void 0:G.like)&&((K=(ie=y==null?void 0:y.own_children)==null?void 0:ie.like[0])==null?void 0:K.id);return Z({replyId:B||""})}},comments:{}}},y==null?void 0:y.id)}))]})})},ds=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:c,functions:{create:i,edit:d,remove:a,like:l,unlike:o,join:u,leave:m}})=>{const h=T.useIntl(),p=W.useQueryClient(),g=_.useContext(ke),v=oa({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>i({activityId:n,content:b.body})}),{mutate:k}=W.useMutation(v),S=ia({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:j}=W.useMutation(S),x=ca({queryClient:p,queryKey:[e,t,n],mutationFn:async({replyId:b})=>a({replyId:b})}),{mutate:C}=W.useMutation(x),R=la({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:A}=W.useMutation(R),V=ua({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:o}),{mutate:D}=W.useMutation(V),P=_.useCallback(({replyId:b})=>A({replyId:b}),[A]),Y=_.useCallback(({replyId:b})=>D({replyId:b}),[D]);return s.jsxs(s.Fragment,{children:[s.jsx(wt,{contentType:"reply",createPost:(b,Z)=>k(Z),membershipRequiredToPost:{isMember:c,required:!0,join:u,leave:m,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var w,z,J,ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he,B,G,ie;const Z=((w=b==null?void 0:b.user)==null?void 0:w.id)===(g==null?void 0:g.id),y=rn(c,Z);return s.jsx(cs,{children:s.jsx(tt,{content:{type:"reply",body:typeof b.data.content=="string"?(z=b==null?void 0:b.data)==null?void 0:z.content:((ne=(J=b==null?void 0:b.data)==null?void 0:J.content)==null?void 0:ne.text)||"",canLike:y,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:b==null?void 0:b.id},slug:`${e}/${t}/${n}#${b==null?void 0:b.id}`,author:{id:(se=b==null?void 0:b.user)==null?void 0:se.id,name:(q=(re=b==null?void 0:b.user)==null?void 0:re.data)==null?void 0:q.name,organization:(ce=(de=b==null?void 0:b.user)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(ae=(L=b==null?void 0:b.user)==null?void 0:L.data)==null?void 0:ae.jobTitle,image:{thumbnail:((oe=(me=b==null?void 0:b.user)==null?void 0:me.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:((pe=b==null?void 0:b.own_children)==null?void 0:pe.like)&&((fe=b==null?void 0:b.own_children)==null?void 0:fe.like.length)>0,likes:((ge=b==null?void 0:b.children_counts)==null?void 0:ge.like)||0,peopleWhoLiked:((he=b==null?void 0:b.latest_children)==null?void 0:he.like)&&((B=b==null?void 0:b.latest_children)==null?void 0:B.like.map(K=>{var le,be;return{id:K==null?void 0:K.user_id,name:(be=(le=K==null?void 0:K.user)==null?void 0:le.data)==null?void 0:be.name}}))},functions:{content:{createContent:()=>null,deleteContent:K=>{const{replySlug:le}=K;return C({replyId:le})},updateContent:(K,le)=>j({replyInfo:K,content:le})},likes:{createLike:()=>P({replyId:b==null?void 0:b.id}),deleteLike:()=>{var le,be,Te;const K=((le=b==null?void 0:b.own_children)==null?void 0:le.like)&&((Te=(be=b==null?void 0:b.own_children)==null?void 0:be.like[0])==null?void 0:Te.id);return Y({replyId:K||""})}},comments:{}},children:s.jsx(ga,{basePath:e,parentId:t,replyParentId:b==null?void 0:b.id,activityId:n,replyCount:((G=b==null?void 0:b.children_counts)==null?void 0:G.reply)||0,replies:(ie=b==null?void 0:b.latest_children)==null?void 0:ie.reply,isMember:c,functions:{create:i,edit:d,remove:a,like:l,unlike:o,join:u,leave:m}})},b==null?void 0:b.id)},b==null?void 0:b.id)}))]})},_a=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);return l&&l.id===(d==null?void 0:d.activityId)&&(l.content=a),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onError:(d,a,l)=>{e.setQueryData(t,l.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),xa=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),ba=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var l;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(l=a==null?void 0:a.reaction_counts)!=null&&l.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{const l=e.getQueryData(t);return l!=null&&l.own_reactions.like?l.own_reactions.like.push(a):l&&(l.own_reactions={like:[a]}),l!=null&&l.latest_reactions.like?l.latest_reactions.like.push(a):l&&(l.own_reactions={like:[a]}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),va=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:c})=>({mutationFn:c,onMutate:async()=>{var u;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(u=o==null?void 0:o.reaction_counts)!=null&&u.like&&o.reaction_counts.like>0&&(o.reaction_counts.like-=1),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,u,m)=>{e.setQueryData(t,m.previousActivity)},onSuccess:()=>{var m,h,p;if(!r)return;const o=(p=(h=(m=r.own_reactions)==null?void 0:m.like)==null?void 0:h.find(g=>g.user_id===(n==null?void 0:n.id)))==null?void 0:p.id,u=e.getQueryData(t);if(u!=null&&u.own_reactions.like&&(u.own_reactions.like=u.own_reactions.like.filter(g=>g.id!==o),!!(u!=null&&u.latest_reactions.like)))return u.latest_reactions.like=u.latest_reactions.like.filter(g=>g.id!==o),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const wa=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:c,editActivity:i,removeActivity:d,likeActivity:a,unlikeActivity:l,createReply:o,editReply:u,removeReply:m,likeReply:h,unlikeReply:p,join:g,leave:v}})=>{var se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he,B,G,ie,K,le,be,Te,Oe,Ce,nt;const k=T.useIntl(),S=_.useContext(ke),j=W.useQueryClient(),{data:x,isLoading:C,isFetching:R}=W.useQuery({queryKey:[e,t,n],queryFn:c}),A=_a({queryClient:j,queryKey:[e,t,n],mutationFn:async ee=>await i(ee)}),{mutate:V}=W.useMutation(A),D=xa({queryClient:j,queryKey:[e,t,n],mutationFn:async({activityId:ee})=>d({activityId:ee}),redirectUrl:`${e}/${t}`}),{mutate:P}=W.useMutation(D),Y=ba({queryClient:j,queryKey:[e,t,n],mutationFn:a}),{mutate:b}=W.useMutation(Y),Z=va({queryClient:j,queryKey:[e,t,n],user:S,mutationFn:async()=>{var je,Ne,st;const ee=(st=(Ne=(je=x==null?void 0:x.own_reactions)==null?void 0:je.like)==null?void 0:Ne.find(rt=>rt.user_id===(S==null?void 0:S.id)))==null?void 0:st.id;await l({activityId:n,reactionId:ee})},activity:x}),{mutate:y}=W.useMutation(Z),w=_.useCallback(({activityId:ee})=>b({activityId:ee}),[b]),z=_.useCallback(async({activityId:ee})=>y({activityId:ee}),[y]);if(C||R)return s.jsx(we,{style:{height:"400px"}});if(!x)return s.jsx(Ke,{variant:"error",text:k.formatMessage({id:"activitySection_notFoundError"})});const J=((se=x==null?void 0:x.actor)==null?void 0:se.id)===(S==null?void 0:S.id),ne=rn(r,J);return s.jsx(tt,{className:"activity-section",content:{type:"post",body:x==null?void 0:x.content,canLike:ne,createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:x==null?void 0:x.id},slug:n,author:{id:(re=x==null?void 0:x.actor)==null?void 0:re.id,name:((q=x==null?void 0:x.actor)==null?void 0:q.data)&&((ce=(de=x==null?void 0:x.actor)==null?void 0:de.data)==null?void 0:ce.name),organization:((L=x==null?void 0:x.actor)==null?void 0:L.data)&&((me=(ae=x==null?void 0:x.actor)==null?void 0:ae.data)==null?void 0:me.organization),jobTitle:((oe=x==null?void 0:x.actor)==null?void 0:oe.data)&&((fe=(pe=x==null?void 0:x.actor)==null?void 0:pe.data)==null?void 0:fe.jobTitle),image:{thumbnail:((ge=x==null?void 0:x.actor)==null?void 0:ge.data)&&((B=(he=x==null?void 0:x.actor)==null?void 0:he.data)==null?void 0:B.thumbnail)||void 0}},userLiked:((G=x==null?void 0:x.own_reactions)==null?void 0:G.like)&&((ie=x==null?void 0:x.own_reactions)==null?void 0:ie.like.length)>0,likes:x&&((K=x==null?void 0:x.reaction_counts)==null?void 0:K.like),comments:x&&((le=x==null?void 0:x.reaction_counts)==null?void 0:le.reply),peopleWhoLiked:((be=x==null?void 0:x.latest_reactions)==null?void 0:be.like)&&((Te=x==null?void 0:x.latest_reactions)==null?void 0:Te.like.map(ee=>{var je,Ne;return{id:ee==null?void 0:ee.user_id,name:(Ne=(je=ee==null?void 0:ee.user)==null?void 0:je.data)==null?void 0:Ne.name}}))},originalAuthorId:(Oe=x==null?void 0:x.actor)==null?void 0:Oe.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>P({activityId:n}),updateContent:(ee,je)=>V({activityInfo:ee,content:je})},likes:{createLike:()=>w({activityId:n}),deleteLike:()=>z({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((Ce=x==null?void 0:x.reaction_counts)==null?void 0:Ce.reply)||0,")"]}),s.jsx(ds,{basePath:e,parentId:t,activityId:n,repliesList:(nt=x==null?void 0:x.latest_reactions)==null?void 0:nt.reply,isMember:r,functions:{create:o,edit:u,remove:m,like:h,unlike:p,join:g,leave:v}})]})},n)},ka=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:c}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:c}}),ja=({type:e,data:t})=>{const n=T.useIntl(),{answers:r,createdAt:c,dateHasPassed:i,isOngoingEvent:d,pill:a,readingTime:l,publishedDate:o,startDate:u}=t;if(e==="question"){const m=c&&Qt(c);return s.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),c&&s.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(u&&!i||d)return s.jsx("p",{className:"details",children:d?n.formatMessage({id:"card_bootcamp"}):An(u)});if(a)return s.jsx(Ge,{variant:a==="free"?"subtle":"highlighted",className:a,"data-testid":"course-type",children:a});if(l||o){const m=o&&Qt(o);return s.jsxs("ul",{className:"details",children:[l&&s.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),o&&s.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},_t={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"}},ya=({data:e,cta:t,link:n,gtmContext:r})=>{var g;const c=T.useIntl(),[i,d]=_.useState({loading:!1,registered:e.registered||!1});_.useEffect(()=>{e.registered&&d(v=>({...v,registered:!0}))},[e.registered]);const{startDate:a,dateHasPassed:l,pill:o,slug:u}=e,m=e.contentType;let h="";if((g=_t[m])!=null&&g.gtmEvent&&(h=_t[m].gtmEvent),a&&l)return s.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:c.formatMessage({id:"card_watch"})});if(m==="people")return s.jsx(Q,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:c.formatMessage({id:"card_cta_people"})});const p=["microcourse","event"];if(t&&t.onClick&&p.includes(m)&&o!=="premium"){const v=i.loading||i.registered,k=async S=>{if(S.preventDefault(),S.stopPropagation(),!(v||!t||!t.onClick)){d(j=>({...j,loading:!0}));try{const j=await t.onClick(e);d(j==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{d(x=>({...x,loading:!1}))}}};return s.jsx(Q,{onClick:k,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${m}: ${u}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:c.formatMessage({id:`card_cta_${m}${v?`_${i.loading?"loading":"done"}`:""}`})})}return null},En={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Ea=e=>{let t=e;return Object.keys(En).includes(e)&&(t=En[e]),`url(${Ye}icons/${t}.svg)`};const Sa={title:66,text:3e3,secondaryText:1e3,partner:25},$a=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:c="Carousel",className:i=""})=>{const d=T.useIntl(),a=_.useContext(ke),l=a&&typeof a.id=="string",[o,u]=_.useState({data:null,isLoading:!0}),{data:m,isLoading:h}=o,p=_.useCallback(()=>{n(t,l).then(D=>{u(()=>({data:D,isLoading:!1}))}).catch(()=>u(D=>({...D,isLoading:!1})))},[e]);if(_.useEffect(()=>{p()},[]),h||!m)return s.jsx(we,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:g}=m;if(!g||!_t[g])return s.jsx(we,{element:"li",className:"card-wrapper"});const{basePath:v="",className:k,length:S,gtmEvent:j}=_t[g],x=Fn(`card_label_${g}`)?d.formatMessage({id:`card_label_${g}`}):!1,C=m.slug?`${v}${m.slug}`:!1,R={...Sa,...S};let A={className:"card"};C&&(A={href:C,className:"card gtm-trackable","data-gtm-event-context":`${c}-CarouselCard`,"data-gtm-event-type":`${j}-click`,"data-testid":"link"},m.openInNewTab&&(A.target="_blank"));const V=m.customIcon?{"--custom-icon":Ea(m.customIcon)}:{};return s.jsx("li",{className:M("card-wrapper text-medium",k,i,{"has-link":C,"no-link":!C,"has-custom-icon":m.customIcon,"has-image":m.banner}),style:V,"data-testid":`${g}-card`,children:_.createElement(C?"a":"div",A,s.jsxs(s.Fragment,{children:[(m.customLabel||x)&&s.jsx("small",{className:M("card-label text-small",k),children:m.customLabel||x}),m.startDate&&!m.isOngoingEvent&&s.jsx(Ge,{size:"small",variant:m.dateHasPassed?"default":"information","data-testid":"date",children:m.dateHasPassed?d.formatMessage({id:"card_ended"}):Ws(m.startDate)}),m.banner?s.jsxs("p",{className:"img",children:[m.registered&&s.jsx(Ge,{size:"small",variant:"registered",children:d.formatMessage({id:"card_registered"})}),s.jsx(Yt,{image:m.banner})]}):k==="people"?s.jsx(Be,{name:m.title||"",src:m.profile,"data-testid":"people-profile-picture"}):null,m.contributors&&s.jsx(Xt,{contributors:{data:m.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},"data-testid":"contributors"}),m.partner&&s.jsx("p",{className:"partners","data-testid":"partners",children:Ie(m.partner.title,R.partner)}),["title","text","secondaryText"].map(D=>{const P=m[D];if(!P)return null;const Y=Us(D);return s.jsx("p",{className:Y,"data-testid":Y,children:Ie(P,R[D])},D)}),s.jsx(ja,{type:k||"",data:m}),s.jsx(ya,{data:m,cta:r,link:C||"",gtmContext:c})]}))})};const Ma=({cards:e,cardTypes:t,className:n="",...r})=>s.jsx("ul",{className:M("card-block",n),children:e.map((c,i)=>{const d=c.slug?`${c.slug}-${t[i]}`:`${t[i]}-${i}`;return s.jsx($a,{id:d,card:{...c,contentType:t[i]},...r},d)})});const Sn=[{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 dt="notFoundError_",Ta=()=>{const e=T.useIntl(),t=[];return Sn.forEach((n,r)=>{n.title=e.formatMessage({id:`${dt}post_${r+1}`}),t.push("solutionArticle")}),s.jsxs(is,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:s.jsxs(bt,{children:[s.jsx(Ma,{cards:Sn,cardTypes:t,buildCardData:n=>new Promise((r,c)=>{r(n)})}),s.jsx(Q,{href:"/solution-articles/",children:e.formatMessage({id:`${dt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[s.jsx("h1",{children:e.formatMessage({id:`${dt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${dt}text`})})]})};exports.ASSETS_BUCKET=Ye;exports.ActivitiesFeed=aa;exports.ActivitySection=wa;exports.AddPost=wt;exports.BannerSection=ar;exports.Breadcrumbs=Sr;exports.Button=Q;exports.ButtonWrapper=Ze;exports.CacheProvider=Vn;exports.CollapsibleSection=Gt;exports.Columns=Kn;exports.CommunityDetails=Er;exports.Contributors=Xt;exports.ConversationContext=et;exports.CookieBanner=es;exports.DiscussionConversation=cs;exports.DiscussionForm=sn;exports.DiscussionLikes=ls;exports.DiscussionPost=tt;exports.DiscussionThread=us;exports.Divider=Re;exports.DownloadSection=tr;exports.EMAILS=Fe;exports.EmailHelperTextBox=Lr;exports.EmptyStateBox=Ke;exports.Filters=$r;exports.FlagsProvider=Yn;exports.Footer=Kt;exports.FullWidthSection=bt;exports.GlobalProviders=yr;exports.Header=en;exports.HelperTextBox=On;exports.HiddenFromScreenReaders=zt;exports.HideShowTextBox=cr;exports.HighlightedTextBox=Me;exports.IntlProvider=Gn;exports.InviteForm=as;exports.InviteModal=Ur;exports.JoinButton=Zt;exports.LanguageSwitcher=Tr;exports.Link=qe;exports.LoadMore=Xn;exports.LoadingBlock=xr;exports.LoadingPlaceholder=we;exports.LoadingState=br;exports.Logo=qt;exports.LogoSection=nr;exports.MarkdownText=Ut;exports.MarketingBox=or;exports.Member=vt;exports.MembersList=Yr;exports.Modal=tn;exports.MoreMenu=Zn;exports.NUMBER_OF_USERS=ir;exports.NavigationMenu=qn;exports.NotFoundError=Ta;exports.Overlay=nn;exports.PageHeading=Hn;exports.PageLayout=is;exports.PasswordRules=Or;exports.Pill=Ge;exports.ProfilePicture=Be;exports.ProgressBar=Un;exports.Rating=Qr;exports.RepliesFeed=ds;exports.ResponsesHeading=qr;exports.ResponsiveImage=Yt;exports.SearchForm=rs;exports.ShareLinks=Pr;exports.Span=Qn;exports.StatusBanner=ht;exports.Tags=Vr;exports.Tooltip=In;exports.TopLevelPage=Fr;exports.UserContext=ke;exports.UserProvider=Jn;exports.VisuallyHidden=ue;exports.addAriaProps=os;exports.getMember=Jt;exports.headerData=Je;exports.mapGetStreamData=ka;exports.pageReady=Ln;exports.useCurrentPath=Cn;exports.useEffectAfterMount=De;exports.useElementWidth=Xe;exports.useScrollListener=Dn;exports.useScrollToHash=Hs;
39
+ ${ze(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ze(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Pr="shareLinks_",Ar=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:c="default",className:u=""})=>{const a=M.useIntl(),l=Rr({title:e,link:t,referrer:n});return s.jsxs("aside",{className:T("share-links",i,c,u),children:[s.jsx("p",{className:"text-small",children:a.formatMessage({id:"shareLinks_label"})}),s.jsx("ul",{children:l.map(({key:o,icon:m,url:d,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const g={};return p&&(g.onClick=v=>p(v,d)),s.jsx("li",{children:s.jsx(Q,{size:i,variant:"tertiary",icon:{icon:m||o},href:d,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${o}-click`,"data-testid":"link",screenreaderText:a.formatMessage({id:`${Pr}link_${o}`}),...g})},o)})})]})};const Fr={"2-1":901,"1-3":769},es=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const i=Xe(!0);let c=r;return _.Children.count(r)===1&&(c=_.Children.toArray(r)[0],c.props&&(c=c.props.children)),s.jsx("section",{className:T("columns",`layout-${e}`,n),children:_.Children.map(c,(u,a)=>t!==!1&&a===t&&i&&i<Fr[e]?null:u)})},Lr=({activeLink:e,...t})=>s.jsx(es,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(Kn,{activeLink:e}),s.jsx(Un,{...t})]})});const Rt="cookieBanner_",Pt=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],At=new Date(Date.now()+12*30*24*60*60*1e3),ts=()=>{const e=M.useIntl(),[t,n,r]=Tn.useCookies(Pt),[i,c]=_.useState(!t["apol-cookie-banner"]),u=()=>{Pt.forEach(m=>{n(m,!0,{path:"/",expires:At,domain:m==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),c(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:At}),Pt.forEach(m=>{if(m==="apol-cookie-banner"){n(m,!0,{path:"/",expires:At});return}r(m)}),c(!1)};if(!i)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:u,gtmType:"accepted-all"}],o=[];return l.forEach(m=>{o.push({variant:m.href?"tertiary":"primary",href:m.href,onClick:m.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${m.gtmType}-click`,children:e.formatMessage({id:`${Rt}buttons_${m.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${Rt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${Rt}text`})}),s.jsx(Ze,{buttons:o})]})},$e={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-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:Fe["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Fe["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:Fe.support,gtmType:"concierge-email-click"},business:{email:Fe.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 Le="footer_",pt="SiteFooter",jn=({group:e})=>{const t=$e[e].order||[];let n=!1;return"text"in $e[e]&&(n=$e[e].text),s.jsxs(_.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(M.FormattedMessage,{id:`${Le}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:c}=$e[e][r],u={};return["legal"].includes(e)&&(u.target="_blank",u.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":c,...u,children:s.jsx(M.FormattedMessage,{id:`${Le}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&s.jsx("dl",{className:"text-medium",children:n.order.map(r=>s.jsxs(_.Fragment,{children:[s.jsx("dt",{children:s.jsx(M.FormattedMessage,{id:`${Le}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(M.FormattedMessage,{id:`${Le}${e}_${r}_address`,values:{br:s.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&s.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Kt=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(zt,{element:"hr"}),s.jsx(qt,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":"logo-homepage-link"}),s.jsx("footer",{children:["platform","community","company","contact"].map(e=>s.jsxs("div",{className:"group",children:[s.jsx(jn,{group:e}),Object.keys($e[e]).includes("child")&&s.jsx(jn,{group:$e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray($e.social.order)&&$e.social.order.map(e=>{const t=$e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(M.FormattedMessage,{id:`${Le}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(M.FormattedMessage,{id:`${Le}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const ct="emailHelperTextBox_",Ir=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const i=M.useIntl(),[c,u]=_.useState({path:`${ct}default`,type:"default",link:{},mail:{},error:""}),[a,l]=_.useState(!1),o=_.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=v=>{u({path:`${ct}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:k=>o(k),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:v})};if(typeof r!="function"){g(i.formatMessage({id:`${ct}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(v=>{g(v.message)}).finally(()=>{l(!1)})},[t,n,r]);_.useEffect(()=>{let p=ct,g="default",v={},k={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",v={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",g="error",k={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",g="error",v={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:S=>o(S),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",v={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},k={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",v={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}u({...c,path:p,type:g,link:v,mail:k})},[e]);const m={};return["link","mail"].forEach(p=>{m[p]=Object.keys(c[p]).length?g=>s.jsx("a",{...c[p],children:g}):g=>g}),s.jsx(Qn,{type:c.type,heading:a?!1:i.formatMessage({id:`${c.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(we,{element:"span"}),s.jsx(we,{element:"span"})]}):i.formatMessage({id:`${c.path}_text`},{...m,strong:p=>s.jsx("strong",{children:p}),em:p=>s.jsx("em",{children:p}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:c.error})})};const lt="passwordRules_",ns="isMoreThanEightCharacters",ss="includesNumberAndSymbol",rs="includesLowerAndUppercase",Br={[ns]:"8Characters",[ss]:"numberSymbol",[rs]:"lowercaseUppercase"},Or=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=M.useIntl();return s.jsxs("aside",{className:T("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${lt}intro`})}),s.jsx("ul",{children:[ns,ss,rs].map(r=>s.jsxs("li",{className:T({matches:e[r]}),children:[s.jsxs(ue,{children:[n.formatMessage({id:`${lt}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${lt}rule_${Br[r]}`})}),!e[r]&&s.jsxs(ue,{element:"strong",children:[" "," ",n.formatMessage({id:`${lt}notMet`})]})]},`rule-${r}`))})]})},Qr=_.memo(Or);const Hr=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:c="",hasLoaded:u=!1})=>{const a=M.useIntl(),[l,o]=_.useState({setUp:!1,id:null,rating:null,disabled:!0}),m=async()=>{try{const S=await n();o(j=>({...j,setUp:!0,id:S&&S.id,disabled:!1}))}catch(S){o(j=>({...j,setUp:!0,disabled:!0})),i(S)}};if(_.useEffect(()=>{u&&!l.setUp&&m()},[u]),!u)return s.jsx(we,{className:"rating-placeholder"});const{id:d,rating:h,disabled:p}=l,g="ratings_",v={text:a.formatMessage({id:`${g}text`}),low:a.formatMessage({id:`${g}low`}),high:a.formatMessage({id:`${g}high`}),success:a.formatMessage({id:`${g}success`}),...e},k=async S=>{if(!(!d||p))try{o(j=>({...j,rating:S,disabled:!0})),await r({id:d,value:S})}catch(j){o(x=>({...x,rating:null})),i(j)}finally{o(j=>({...j,disabled:!1}))}};return s.jsxs("div",{className:T("rating",c),children:[s.jsx("span",{className:"label",children:v[h?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(S=>{const j=S+1;return s.jsx("li",{className:T({selected:h&&j<=h}),children:s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:`star${!h||j>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${g}stars`},{number:j,total:t})}${j===1||j===t?` - ${v[j===1?"low":"high"]}`:""}`,onClick:x=>{x.preventDefault(),x.stopPropagation(),k(j)},disabled:p})},`rating-${j}`)})})]})};const as=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:c="form-submission"})=>{const{searchIsOpen:u=!0,isDesktopVersion:a=!1}=n||{},l=M.useIntl(),o=_.useRef(null);De(()=>{!n||a||!u||o.current&&o.current.focus()},[u]);const m=d=>{d.preventDefault(),d.stopPropagation(),!(!o.current||!o.current.value||o.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(o.current.value)}`)};return s.jsx("form",{onSubmit:m,className:T("search-form gtm-trackable",t),"data-gtm-event-context":i,"data-gtm-event-type":c,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!u:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(ue,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),s.jsx("input",{ref:o,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:d=>{d.key==="Enter"&&m(d)}}),s.jsx("button",{className:"clear",onClick:d=>{d.preventDefault(),d.stopPropagation(),o.current&&o.current.value&&(o.current.value="")},children:s.jsx(ue,{children:l.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:m,children:s.jsx(ue,{children:l.formatMessage({id:"search_cta"})})})]})})})};const os=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:i,backgroundColor:c,onClose:u,reportError:a,sendInvites:l,initialFormStatus:o="NOT_SUBMITTED"})=>{const[m,d]=_.useState([]),[h,p]=_.useState(!0),[g,v]=_.useState(o),{formatMessage:k}=M.useIntl(),S=async C=>{C.preventDefault();try{await l(m),d([]),v("SUCCESS")}catch(R){v("ERROR"),a(R)}},j=C=>{C.preventDefault(),v("NOT_SUBMITTED"),p(!0),d([])},x=C=>{C.preventDefault(),u(),v("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?s.jsxs("div",{className:"invite-form-wrapper",children:[s.jsx("div",{className:"content centred",children:g==="SUCCESS"?s.jsx("h2",{className:"success-title",children:k({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",k({id:"inviteForm_error"})]})}),s.jsx(Re,{}),s.jsx("div",{className:"footer",children:g==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"secondary",onClick:j,children:k({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(Q,{onClick:x,children:k({id:"inviteForm_ctaDone"})})]}):s.jsx(Q,{onClick:j,children:k({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:c},onSubmit:S,className:T("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t}),s.jsx(Ds.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:k({id:"inviteForm_email_placeholder"}),emails:m,onChange:C=>{d(C),p(!C.length)},autoFocus:!1,getLabel:(C,R,A)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:C}),s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{A(R),p(!m.length)},className:"remove-email-button",screenreaderText:k({id:"overlay_close"})})]},R)})]}),s.jsx(Re,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(Q,{className:"sendEmailsButton",disabled:h,children:n})})]})})},H={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=c=>{const u=`logged${e?"In":"Out"}`;return t>=n[c][u]};let i={};return["navigation","search"].forEach(c=>{i[c]=r(c)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!t&&H.handlerCalled[e]&&i-H.handlerCalled[e]<500)return;H.handlerCalled[e]=i;let c=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(u=>{u===e||n[u]===!1||c.push({type:`menus.${u}`,value:!1})}),r(c)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=Mn(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?H.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{if(!t.current||!t.current.children)return;const c=n?"desktop":"default";if(r[e][c]){r[e][c].focus();return}let u,a;switch(e){case"navigation":if(n){const l=H.findFirstChild(t.current.children,"attributes.aria-controls","navigation");u=H.findFirstChild(l.children,"href")}else u=H.findFirstChild(t.current.children,"href");u||(u=t.current);break;case"account":if(a=H.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;u=H.findFirstChild(a.children,"href");break;default:return}u&&(i([{type:`focusElements.${e}.${c}`,value:u}]),u.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(H.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(H.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(H.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{H.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Je={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","q-and-a","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},"q-and-a":{href:"/questions-answers/",className:"icon q-and-a"},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"}}}},gt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:c=null})=>{const u=M.useIntl(),a=Mn(Je,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const l="doTrack"in a,o=c===null?l?a.doTrack:!0:c,m=e.includes("buttons.");let d=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(d+=`_logged${t?"In":"Out"}`);let h=!1;if(a.href){let j=a.gtmType||`${e}-click`;if(j.includes(".")){const x=j.split("."),C=x[x.length-2];j=`${C==="topics"?`${C}-`:""}${x[x.length-1]}`}h={href:a.href,role:"menuitem"},o&&(h={...h,className:"gtm-trackable","data-gtm-event-type":j,"data-gtm-event-context":"HeaderButtons"}),m&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const p=a.order&&a.order[0]&&a[a.order[0]],g=p&&a[a.order[0]].order,v=h&&window.location.pathname===a.href;let k={},S={};if(p){const j=a.menuId||e,x={onClick:C=>H.events.onClick(C,{id:j,callback:i,isOpen:r[j]}),onFocus:()=>H.events.onFocus({id:j}),onBlur:()=>H.events.onBlur({id:j,callback:i}),onMouseLeave:()=>H.events.onBlur({id:j,callback:i}),onMouseEnter:()=>H.events.onMouseEnter({id:j,callback:i})};n&&(g&&(k={...x,onKeyPress:C=>{C.key==="Enter"&&H.events.onClick(C,{id:j,callback:i,isOpen:r[j]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[j],"aria-controls":j}),S={hidden:j in r?!r[j]:!0}),g||(S={...S,...x})}return s.jsxs("li",{className:T({[a.className]:a.className,"has-submenu":p,parent:g,active:v}),role:"none",...k,children:[h?_.createElement(m?Q:"a",h,u.formatMessage({id:d})):u.formatMessage({id:d}),a.order&&s.jsx("ul",{...S,children:a.order.map(j=>{if(!a[j])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?o:null};return a[j].order?s.jsxs("li",{className:T({[a[j].className]:a[j].className}),children:[u.formatMessage({id:`${d}_${j}`}),s.jsx("ul",{children:a[j].order.map(C=>s.jsx(gt,{id:`${e}.${j}.${C}`,...x},C))})]},j):s.jsx(gt,{id:`${e}.${j}`,...x},j)})})]},e)};const Ur={height:67,height_desktop:83},en=({showNavigation:e=!0})=>{const t=M.useIntl(),n=_.useContext(ke),r=Xe(!0,!0),i=n&&typeof n.id=="string",c=_.useMemo(()=>H.getIsDesktopVersion(i,r),[i,r]),[u,a]=_.useReducer(qs,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:o,focusElements:m}=u;Rn({scrollPosition:Ur[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!c&&o.navigation||H.shouldChangeHeaderIsVisible(!0,o,a)},scrollDown:()=>{!c&&o.navigation||H.shouldChangeHeaderIsVisible(!1,o,a)}}});const d=(p,g)=>{H.handleMenus({id:p,value:g,menus:o,dispatch:a})},h=_.useRef(null);return De(()=>{o.navigation&&H.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:c.navigation,focusElements:m,dispatch:a})},[o.navigation]),De(()=>{o.account&&H.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:c.navigation,focusElements:m,dispatch:a})},[o.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:T({"logged-in":i,"logged-out":!i,visible:l}),children:[s.jsx(ue,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(qt,{}),e&&s.jsxs(s.Fragment,{children:[!c.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),d("navigation",!o.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":o.navigation,"aria-controls":"navigation",children:s.jsx(ue,{children:t.formatMessage({id:`header_menu_${o.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:h,id:"navigation",hidden:c.navigation||o.account?!1:!o.navigation,role:"menu","data-showing":!c.navigation&&o.account?"account":"default",children:Je.order.map(p=>s.jsx(gt,{id:p,isLoggedIn:i,isDesktopVersion:c.navigation,menus:{navigation:o.navigation,account:o.account},callback:d},p))}),!c.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),d("search",!o.search)},"aria-haspopup":"true","aria-expanded":o.search,"aria-controls":"search-form",children:s.jsx(ue,{children:t.formatMessage({id:`header_search_${o.search?"hide":"show"}`})})}),s.jsx(as,{id:"global-search",handleToggle:{searchIsOpen:o.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),i?s.jsxs("button",{className:"account-button",onClick:p=>H.events.onClick(p,{id:"account",callback:d,isOpen:o.account}),onMouseEnter:()=>H.events.onMouseEnter({id:"account",callback:d}),onMouseLeave:()=>H.events.onBlur({id:"account",callback:d}),"aria-haspopup":"true","aria-expanded":o.account,"aria-controls":"navigation",children:[s.jsx(ue,{children:t.formatMessage({id:`header_account_${o.account?"hide":"show"}`})}),s.jsx(Be,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:Je.buttons.order.map(p=>s.jsx(gt,{id:`buttons.${p}`},p))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:T("overlay",{open:o.navigation||o.account||!c.search&&o.search})})]})};const tn=({element:e="section",children:t,className:n,...r})=>_.createElement(e,{className:T("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const nn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:c=()=>{}}={},forceShow:{error:u=!1}={},title:a,children:l,buttons:o,className:m="",gtmContext:d="Modal"})=>{const h=M.useIntl(),[p,g]=_.useState(t),v=S=>{g(S),S?(i(),document.body.classList.add("has-overlay")):(c(),document.body.classList.remove("has-overlay"))};_.useEffect(()=>{v(t)},[t]);const k=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:T("overlay",{open:p}),children:s.jsx(tn,{id:e,className:T("overlay-modal",m,{"has-max-width":r}),hidden:!p,style:k,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[a&&s.jsx("h2",{className:"modal-title",children:a}),s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>v(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":d,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Re,{}),l,o&&s.jsxs("div",{className:"bottom",children:[s.jsx(Re,{}),s.jsx(Ze,{buttons:o})]}),u&&s.jsx(ht,{className:"error",children:u})]})})})},is=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Wr=({className:e,showModal:t=!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:c="Send",showIcon:u,onClose:a,reportError:l=()=>{},sendInvites:o})=>s.jsx(nn,{title:n,isOpen:t,showDivider:!1,showIcon:u,functions:{onClose:a},className:T("invite-modal",e,{success:!!n}),children:s.jsx(os,{title:r,label:i,ctaMessage:c,onClose:a,sendInvites:o,reportError:l})});const zr=()=>{const e=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(en,{}),s.jsx("div",{id:"content",children:s.jsx(Ke,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Kt,{})]})},cs=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:c={},className:u="",locale:a="en"})=>{const{navigation:l=!0,footer:o=!0}=i,{background:m="default",variant:d="default",circle:h="default"}=c,p=Nn();_.useEffect(()=>{window.scrollTo(0,0)},[p]);const g=ft(e,{locale:a}),v=ft(t,{locale:a}),k=ft(n,{locale:a}),S={};return m!=="default"&&(S[m]=!0),d!=="default"&&(S[d]=!0),h!=="default"&&(S[h]=!0),s.jsx(Rs.ErrorBoundary,{onError:r,fallback:s.jsx(zr,{}),children:s.jsx(_.Suspense,{fallback:null,children:s.jsxs("div",{id:"wrapper",className:T(u,S,{"has-footer":o}),children:[s.jsx(en,{showNavigation:l}),s.jsxs("section",{id:"content-wrapper",children:[v&&s.jsx("div",{className:"additional-content prepended",children:v}),_.createElement(m==="bold"?tn:"div",{id:"content",children:g})]}),k&&s.jsx("div",{className:"additional-content appended",children:k}),o&&s.jsx(Kt,{}),s.jsx(ts,{})]})})})},yn={default:"tags_",headerTopics:"header_topics_topics_"},Ft={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"},Vr={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ft.topic[e.replace("topic_","")],e){const t=Je.topics.topics[e].href;return t?{id:e,href:t,text:`${yn.headerTopics}${e}`}:null}return null}return Ft[e]?(e=Ft[e],{id:e,text:`${yn.default}${e}`}):null}};const Yr=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:c="tag-click",gtmContext:u="tags"})=>{const a=M.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(o=>{if(!o)return;const m=Vr.getTagDetails(o);m&&l.push(m)}),l.length<1?null:s.jsx("ul",{className:T("tags text-small",t,i,{"one-line":n}),children:l.map(o=>{const m=a.formatMessage({id:o.text});return s.jsx("li",{children:o.href&&r?s.jsx("a",{href:o.href,className:"gtm-trackable","data-gtm-event-type":c,"data-gtm-event-context":u,children:m}):m},o.id)})})};const Gr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:i="member-click",className:c=""})=>{const u=M.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:T("members-list",c),children:[s.jsxs("h1",{children:[u.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((a,l)=>s.jsxs("li",{children:[s.jsx(vt,{member:a,gtmContext:r,gtmType:i}),a.isAdmin&&s.jsx(Ge,{children:u.formatMessage({id:"membersList_admin"})})]},l))}),n&&s.jsx(Zn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let ut=null;const xe="discussion_form_",sn=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:i=5e4,minRows:c=4,forceShow:u={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var P,Y;const o=M.useIntl(),m=_.useContext(ke),[d,h]=_.useState(n.isEditing&&n.isEditing.text||""),[p,g]=_.useState(u.error||!1),[v,k]=_.useState(!1),S=_.useRef(null);if(r||(r=S),n.isLoading)return s.jsx(we,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const j=b=>{const Z=b.target.value;h(Z);let y;!m||!m.id?y=ye(o.formatMessage,`${xe}error_loggedOut`,e.type,"action"):t?Z.length>=i&&(y=`${xe}error_tooLong`):y=ye(o.formatMessage,`${xe}error_noPermission`,e.type,"action"),y?g(y):p&&g(!1)};let x=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const b=e.type==="response"?((P=e.slugs)==null?void 0:P.question)||"":((Y=e.slugs)==null?void 0:Y.answer)||"";b&&(x=`${x}-${b.slice(-15)}`)}const C=async b=>{var y;if(b.preventDefault(),b.stopPropagation(),!m||!m.id||!t||A)return;ut&&clearTimeout(ut),k("submitting");const Z=window.location.pathname;try{let w;switch(e.type){case"post":w=await a.create({content:d});break;case"question":w=await a.create({title:d,authorId:m&&m.id,...(y=a.props)==null?void 0:y.create});break;case"response":w=await a.create({question:e.slugs.question},{body:d,authorId:m&&m.id,contentPath:Z});break;case"reply":w=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:d,authorId:m&&m.id,contentPath:Z});break;default:break}await Ks(1e3),a.callback&&await a.callback(w),ut=setTimeout(()=>{h(""),k("submitted"),R()},500)}catch(w){const z=w;let J=`${xe}error`;z.message.includes("entry already exists")&&(J=ye(o.formatMessage,`${xe}error_alreadyExists`,e.type,"action")),z.message.includes("429")?J=ye(o.formatMessage,`${xe}error_tooMany`,e.type,"action"):z.message.includes("400")&&(J=`${xe}error`),g(J),R()}},R=()=>{ut=setTimeout(()=>{g(!1),k(!1)},5e3)},A=!d||!Zs(d),V=v==="submitting",D=[];return(n.isEditing&&!V||u.cancel)&&D.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!u.cancel&&(!m||!m.id||!d),children:o.formatMessage({id:`${xe}cancel`})}),D.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:b=>{if(n.isEditing){k("submitting"),a.handleSaveEdit&&a.handleSaveEdit(S.current&&"value"in S.current?S.current.value:"");return}C(b)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!t||A||V||n.isEditing&&d===n.isEditing.text,children:o.formatMessage({id:`${xe}${V?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:x,className:T("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:ye(o.formatMessage,`${xe}title`,e.type,"action")}),s.jsx(vt,{member:m||"community",gtmContext:l,gtmType:"profile-click"}),s.jsx(ue,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:ye(o.formatMessage,`${xe}label`,e.type,"action")}),s.jsx(Ps,{ref:r,id:`${x}-input`,name:e.type,placeholder:ye(o.formatMessage,`${xe}placeholder`,e.type,"action"),onChange:j,value:d,maxLength:i,"aria-invalid":!!p,"aria-errormessage":"error-message",minRows:c,autoFocus:!!n.isEditing}),s.jsx("small",{children:ye(o.formatMessage,`${xe}explainer`,e.type,"action",{a:b=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:b})})}),s.jsx(Ze,{buttons:D}),v==="submitted"&&s.jsx(ht,{className:"success","data-testid":"success",children:ye(o.formatMessage,`${xe}success`,e.type,"action")}),p&&s.jsx(ht,{id:"error-message",className:"error","data-testid":"error",children:u.error?u.error:typeof p=="string"?p.includes(" ")?p:o.formatMessage({id:p},{action:o.formatMessage({id:`discussion_action_${e.type}`}),maxLength:i}):p})]})},wt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:i,leave:c,notMemberStateText:u}})=>r&&!n?s.jsx(Ke,{text:u,button:{breakpoints:{mobile:!0,901:!1},component:s.jsx(Zt,{isShort:!0,functions:{join:i,leave:c}})}}):s.jsx(sn,{content:{type:e,slugs:{}},functions:{create:t}}),Jr={showThread:!1,showForm:!1},et=_.createContext(Jr),ls=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(et.Provider,{value:{...t,updateConversation:n},children:e})},Xr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Zr=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ve=!1;const Lt=()=>{Ve!==!1&&(clearTimeout(Ve),Ve=!1)},It=5,us=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:c={type:"reply",slugs:{}},canLike:u=!0,functions:{createLike:a=()=>{},deleteLike:l=()=>{}}={}})=>{const o=M.useIntl();_.useEffect(()=>{p(i)},[i]);const[m,d]=_.useState(t),[h,p]=_.useState(i),[g,v]=_.useState(!1),[k,S]=_.useState(!1),j=_.useMemo(()=>Zr(n,It),[n]),x=R=>{if(R.preventDefault(),R.stopPropagation(),S(!1),Ve)return Lt(),!1;if(Lt(),g||!u)return!1;Ve=setTimeout(C,350)},C=async()=>{if(Lt(),g||!u)return!1;let R=h?m-1:m+1;R<0&&(R=0),v(!0),d(R),p(!h);try{if(c&&c.slugs){const A=Xr(c.slugs);h?await l(A):await a(A,{contentPath:window.location.pathname})}}catch{d(t),p(i)}finally{v(!1)}};return _.createElement(e,{className:T("likes-wrapper text-medium action-button",{"show-spinner":g,"is-liked":h,disabled:!u}),onClick:x,onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},onFocus:()=>{S(!0)},onBlur:()=>{S(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:T({"do-animation":h&&!i}),screenreaderText:u?o.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:o.formatMessage({id:`discussion_action_${c.type}`})}):!1,onClick:x,disabled:!u,"aria-hidden":!u,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${c.type}-click`}),s.jsx("span",{className:T("number-of-likes",{"no-likes":m===0}),"data-testid":"number-of-likes",children:o.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})}),n&&s.jsx(Bn,{isOpen:k,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[j.map(R=>typeof R=="string"||!R.name?null:s.jsx("li",{children:s.jsx(qe,{href:R.id?`/profiles/${R.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:A=>A==null?void 0:A.stopPropagation(),children:R.name})},R.id||window.btoa(R.name))),n.length>It&&s.jsx("li",{children:o.formatMessage({id:"discussion_likes_more"},{number:n.length-It})})]})})]})})},En=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},rn=(e,t)=>e&&!t;const Se="discussion_",qr=280,tt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:i,functions:{content:{createContent:c,deleteContent:u,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:l,deleteLike:o}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}}},links:d={},className:h,gtmContext:p="DiscussionAnswer",children:g,isTruncated:v=!1})=>{const k=M.useIntl(),S=_.useContext(ke),j=_.useContext(et),[x,C]=_.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[R,A]=_.useState(!1),[V,D]=_.useState("");if(_.useEffect(()=>{C({...x,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(we,{className:"discussion-card discussion-post"});const{author:P,canLike:Y,createdAt:b,id:Z,likes:y=0,userLiked:w,comments:z=0}=t,J=v?Ie(x.body,qr):x.body,ne=S&&S.id&&typeof P!="string"&&P.id&&P.id===S.id||!1,se=typeof Y=="boolean"?Y:n?!ne:!1,re=async L=>{L||(L=""),D("");try{if(!As(L,x.body)){const ae=t.type==="question"?{title:L}:{body:L};await a(En(t.slugs),ae)}C({body:L,isEditing:!1,didEdit:!0})}catch{D(`${Se}form_error`)}},q=()=>{j&&j.updateConversation&&j.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const ae=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,me=document.getElementById(ae),oe=document.getElementById(`${ae}-input`);oe&&oe.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},de=()=>{A(!1);try{u(En(t.slugs))}catch{D("delete-error")}},ce=[{text:k.formatMessage({id:`${Se}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(k.formatMessage({id:`${Se}report_subject`}))}&body=${encodeURI(k.formatMessage({id:`${Se}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&ne&&ce.push({text:k.formatMessage({id:`${Se}moreMenu_edit`}),onClick:()=>C({...x,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`edit-${t.type}-click`},{text:k.formatMessage({id:`${Se}moreMenu_delete`}),onClick:L=>{L.preventDefault(),L.stopPropagation(),A(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`delete-${t.type}-click`,...is(`delete-${t.slug}-modal`,R)}),_.createElement(e,{className:T("discussion-post",h),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:Z||t.slug,className:T("discussion-card",t.type,{editing:x.isEditing,"has-link":d.post&&!x.isEditing}),onClick:L=>{!d.post||x.isEditing||(L.preventDefault(),L.stopPropagation(),window.location.href=d.post)},children:[!x.isEditing&&s.jsx(vt,{member:P,additionalContent:{createdAt:b,didEdit:x.didEdit},className:typeof P!="string"&&P.id===i?"highlighted":"",gtmContext:p,gtmType:"profile-click"}),x.isEditing?s.jsx(sn,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:x.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?k.formatMessage({id:V},{action:k.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:c,handleSaveEdit:re,handleCancel:()=>{D(""),C({...x,isEditing:!1})}},gtmContext:`${p}Form`}):d.post?s.jsx("a",{href:d.post,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":"title-click",children:s.jsx(Ut,{options:{overrides:{a:Hn}},children:J})}):s.jsx(Ut,{options:{wrapper:t.type==="question"?"h1":_.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:J}),!x.isEditing&&s.jsxs("ul",{className:T("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(us,{element:"li",likes:y,isShort:!1,userLiked:w,content:{type:t.type,slugs:t.slugs},canLike:se,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:l,deleteLike:o}}),(["question","post"].includes(t.type)||d.comments||typeof m=="function")&&s.jsxs("li",{className:"action-button",onClick:L=>{L.preventDefault(),L.stopPropagation(),d.comments&&(window.location.href=d.comments),typeof m=="function"&&m()},children:[s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:d.comments?d.comments:!1,onClick:d.comments||typeof m!="function"?!1:m,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:k.formatMessage({id:`${Se}comments_screenReader`},{count:z})}),s.jsx("span",{children:k.formatMessage({id:`${Se}comments`},{count:z})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:q,children:k.formatMessage({id:`${Se}reply`})})}),s.jsx(qn,{element:"li",id:`more-${t.slug}`,options:ce})]})]}),g,s.jsx(nn,{id:`delete-${t.slug}-modal`,isOpen:R,functions:{onOpen:()=>{},onClose:()=>A(!1)},forceShow:{error:V==="delete-error"?k.formatMessage({id:"discussion_delete_error"},{action:k.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:k.formatMessage({id:"discussion_delete_title"},{action:k.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>A(!1),children:k.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:de,children:k.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(M.FormattedMessage,{id:"discussion_delete_text",values:{p:L=>s.jsx("p",{children:L}),action:k.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Bt="discussion_responses_",Kr=({type:e="answer",responses:t=0})=>{const n=M.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${Bt}title`},{action:n.formatMessage({id:`${Bt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ye(n.formatMessage,`${Bt}empty`,e,e)})]})};const ds=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=M.useIntl(),i=_.useRef(null),c=_.useContext(et),[u,a]=_.useState("closed");_.useEffect(()=>{const d=i.current;if(d)return d.addEventListener("transitionend",l),()=>{d.removeEventListener("transitionend",l)}},[]),De(()=>{u==="closed"&&!c.showThread||a(["opening","open"].includes(u)?"ready-to-close":"opening")},[c.showThread]),_.useEffect(()=>{u==="ready-to-close"&&a("closing")},[u]);const l=({propertyName:d})=>{d==="max-height"&&a(h=>h==="opening"?"open":h==="closing"?"closed":h)},o=["opening","open"].includes(u),m=ft(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(Q,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${o?"left":"right"}`},onClick:()=>{var d;(d=c.updateConversation)==null||d.call(c,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${o?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:i,className:T("thread",u),hidden:!c.showThread,children:m})]})},ea=({user:e,content:t,verb:n="post"})=>({actor:{id:e.id,data:{name:e.name,organization:e==null?void 0:e.organization,jobTitle:e==null?void 0:e.jobTitle}},content:t,latest_reactions:{like:[]},reaction_counts:{like:0},verb:n}),ta=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:a})=>{if(!n)return;const l=ea({user:n,content:a,verb:"post"});await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return e.setQueryData(t,m=>[...m,l]),{previousActivities:o}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),na=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:u,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),o=l==null?void 0:l.map(m=>((m==null?void 0:m.id)===(u==null?void 0:u.activityId)&&(m.content=a),m));return e.setQueryData(t,()=>o&&[...o]),{previousActivities:o}},onError:(u,a,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),sa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:u})=>{await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),l=a==null?void 0:a.filter(o=>(o==null?void 0:o.id)!==u);return e.setQueryData(t,()=>l&&[...l]),{previousActivities:l}},onError:(u,a,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:(u,a,l)=>{e.invalidateQueries({queryKey:[...t,l.activityId]})}}),ra=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:a})=>{await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),o=l==null?void 0:l.map(m=>{var d;return(m==null?void 0:m.id)===a&&((d=m.reaction_counts)!=null&&d.like?m.reaction_counts.like+=1:m.reaction_counts.like=1),m});return e.setQueryData(t,()=>o&&[...o]),{previousActivities:o}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivities)},onSuccess:a=>{const l=e.getQueryData(t),o=l==null?void 0:l.map(m=>{var d,h;return(m==null?void 0:m.id)===(a==null?void 0:a.activity_id)&&((d=m.own_reactions)!=null&&d.like?m.own_reactions.like.push(a):m.own_reactions.like=[a],(h=m.latest_reactions)!=null&&h.like?m.latest_reactions.like.push(a):m.own_reactions.like=[a]),m});return e.setQueryData(t,()=>o&&[...o]),{previousActivities:l}},onSettled:(a,l,o)=>{e.invalidateQueries({queryKey:[...t,o.activityId]})}}),aa=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:l})=>{await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),m=o==null?void 0:o.map(d=>{var h;return(d==null?void 0:d.id)===l&&(h=d.reaction_counts)!=null&&h.like&&(d.reaction_counts.like-=1),d});return e.setQueryData(t,()=>m&&[...m]),{previousActivities:m}},onError:(l,o,m)=>{e.setQueryData(t,m.previousActivities)},onSuccess:(l,{activityId:o})=>{const m=e.getQueryData(t),d=m==null?void 0:m.map(h=>{var p,g,v,k,S;if(h.id===o){const j=(v=(g=(p=h.own_reactions)==null?void 0:p.like)==null?void 0:g.find(x=>x.user_id===(n==null?void 0:n.id)))==null?void 0:v.id;return h.own_reactions.like=(k=h.own_reactions.like)==null?void 0:k.filter(x=>x.id!==j),h.latest_reactions.like=(S=h.latest_reactions.like)==null?void 0:S.filter(x=>x.id!==j),h}else return h});return e.setQueryData(t,()=>d&&[...d]),{previousActivities:m}},onSettled:(l,o,m)=>{e.invalidateQueries({queryKey:[...t,m.activityId]})}}),oa=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:i,edit:c,remove:u,like:a,unlike:l,join:o,leave:m}})=>{const d=M.useIntl(),h=W.useQueryClient(),p=_.useContext(ke),{data:g,error:v,isLoading:k,isFetching:S}=W.useQuery({queryKey:[e,t],queryFn:r}),j=ta({queryClient:h,queryKey:[e,t],user:p,mutationFn:i}),{mutate:x}=W.useMutation(j),C=na({queryClient:h,queryKey:[e,t],mutationFn:async w=>await c(w)}),{mutate:R}=W.useMutation(C),A=sa({queryClient:h,queryKey:[e,t],mutationFn:async({activityId:w})=>await u({activityId:w})}),{mutate:V}=W.useMutation(A),D=ra({queryClient:h,queryKey:[e,t],mutationFn:a}),{mutate:P}=W.useMutation(D),Y=aa({queryClient:h,queryKey:[e,t],user:p,mutationFn:async({activityId:w})=>{var ne,se,re;const z=g&&(g==null?void 0:g.find(q=>q.id===w)),J=(re=(se=(ne=z==null?void 0:z.own_reactions)==null?void 0:ne.like)==null?void 0:se.find(q=>q.user_id===(p==null?void 0:p.id)))==null?void 0:re.id;await l({reactionId:J||"",activityId:w})}}),{mutate:b}=W.useMutation(Y),Z=_.useCallback(({activityId:w})=>P({activityId:w}),[P]),y=_.useCallback(({activityId:w})=>b({activityId:w}),[b]);return v?s.jsx(Ke,{variant:"error",text:v.message}):k?s.jsx(we,{style:{height:"400px"}}):s.jsxs("section",{children:[s.jsx(wt,{contentType:"post",createPost:x,membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:m,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),!S&&Array.isArray(g)&&(g==null?void 0:g.map(w=>{var ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he;const z=((ne=w==null?void 0:w.actor)==null?void 0:ne.id)===(p==null?void 0:p.id),J=rn(n,z);return s.jsxs(_.Fragment,{children:[s.jsx(tt,{content:{type:"post",body:w==null?void 0:w.content,canLike:J,createdAt:(w==null?void 0:w.time)||"",slugs:{parentId:t,activityId:w==null?void 0:w.id},slug:w==null?void 0:w.id,author:{id:(se=w==null?void 0:w.actor)==null?void 0:se.id,name:`${(q=(re=w==null?void 0:w.actor)==null?void 0:re.data)==null?void 0:q.name}`,organization:(ce=(de=w==null?void 0:w.actor)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(ae=(L=w==null?void 0:w.actor)==null?void 0:L.data)==null?void 0:ae.jobTitle,image:{thumbnail:((oe=(me=w==null?void 0:w.actor)==null?void 0:me.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:((pe=w==null?void 0:w.own_reactions)==null?void 0:pe.like)&&((fe=w==null?void 0:w.own_reactions)==null?void 0:fe.like.length)>0,likes:(w==null?void 0:w.reaction_counts.like)||0,comments:(w==null?void 0:w.reaction_counts.reply)||0,peopleWhoLiked:((ge=w==null?void 0:w.latest_reactions)==null?void 0:ge.like)&&((he=w==null?void 0:w.latest_reactions)==null?void 0:he.like.map(B=>{var G,ie;return{id:B==null?void 0:B.user_id,name:(ie=(G=B==null?void 0:B.user)==null?void 0:G.data)==null?void 0:ie.name}}))},links:{post:`${e}/${t}/${w==null?void 0:w.id}`,comments:`${e}/${t}/${w==null?void 0:w.id}`},functions:{content:{createContent:()=>null,deleteContent:B=>V(B),updateContent:(B,G)=>R({activityInfo:B,content:G})},likes:{createLike:()=>{Z({activityId:w==null?void 0:w.id})},deleteLike:()=>{y({activityId:w==null?void 0:w.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(Re,{})]},w==null?void 0:w.id)}))]})},ia=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{var o;const l=e.getQueryData(t);if(l)return(o=l==null?void 0:l.latest_reactions)!=null&&o.reply?(l.latest_reactions.reply.unshift(a),l&&(l.reaction_counts={reply:l.latest_reactions.reply.length})):(l.latest_reactions={reply:[a]},l.reaction_counts={reply:1}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),ca=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:c,content:{body:u}})=>{var o,m,d;if(u.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((o=a==null?void 0:a.latest_reactions)!=null&&o.reply))return;const l=(d=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:d.map(h=>(h.id===c.replySlug&&(h.data.content=u),h));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}},onError:(c,u,a)=>{e.setQueryData(t,a.previousActivity)}}),la=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:c})=>{var l,o,m;await e.cancelQueries({queryKey:t});const u=e.getQueryData(t);if(!u||!((l=u==null?void 0:u.latest_reactions)!=null&&l.reply))return;const a=(m=(o=u==null?void 0:u.latest_reactions)==null?void 0:o.reply)==null?void 0:m.filter(d=>d.id!==c);return e.setQueryData(t,()=>({...u,latest_reactions:{reply:a}})),{previousActivity:u}},onError:(c,u,a)=>{e.setQueryData(t,a.previousActivity)}}),ua=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:u})=>{var o,m;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),l=(m=(o=a==null?void 0:a.latest_reactions)==null?void 0:o.reply)==null?void 0:m.map(d=>{var h;return d.id===u&&((h=d.children_counts)!=null&&h.like?d.children_counts.like+=1:d.children_counts={like:1}),d});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}},onError:(u,a,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:u=>{var o;const a=e.getQueryData(t),l=(o=a==null?void 0:a.latest_reactions.reply)==null?void 0:o.map(m=>{var d,h;return m.id===u.id&&((d=m.own_children)!=null&&d.like?m.own_children.like.push(u):m.own_children={like:[u]},(h=m.latest_children)!=null&&h.like?m.latest_children.like.push(u):m.latest_children={like:[u]}),m});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}}}),da=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var m;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);if(!l)return;const o=(m=l.latest_reactions.reply)==null?void 0:m.map(d=>(d.id===a&&d.children_counts.like&&(d.children_counts.like-=1),d));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,{replyId:l})=>{var d;const o=e.getQueryData(t);if(!o)return;const m=(d=o.latest_reactions.reply)==null?void 0:d.map(h=>{var p,g,v;if(h.id===l){let k=(p=h.latest_children.reply)==null?void 0:p.filter(S=>S.user_id!==(n==null?void 0:n.id));return k=(v=(g=h==null?void 0:h.own_children)==null?void 0:g.reply)==null?void 0:v.filter(S=>S.user_id!==(n==null?void 0:n.id)),k}return h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}}}),ma=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:a=>{var m;const l=e.getQueryData(t),o=(m=l==null?void 0:l.latest_reactions.reply)==null?void 0:m.map(d=>(d.id===a.parent&&(d.latest_children.reply&&d.children_counts.reply?(d.latest_children.reply.push(a),d.children_counts.reply+=1):(d.latest_children.reply=[a],d.children_counts.reply=1)),d));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),fa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(c,u,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyInfo:c,content:{body:u}})=>{var o,m,d;if(u.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((o=a==null?void 0:a.latest_reactions)!=null&&o.reply))return;const l=(d=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:d.map(h=>{var p;return h.id===c.replyParentId&&((p=h.latest_children.reply)==null||p.map(g=>(g.id===c.replySlug&&(g.data.content=u),g))),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}}}),ha=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(c,u,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyId:c,replyParentId:u})=>{var o,m,d;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((o=a==null?void 0:a.latest_reactions)!=null&&o.reply))return;const l=(d=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:d.map(h=>{var p,g;return h.id===u&&(h.latest_children.reply=(p=h.latest_children.reply)==null?void 0:p.filter(v=>v.id!==c),(g=h.children_counts)!=null&&g.reply&&(h.children_counts.reply-=1)),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:l}})),{previousActivity:a}}}),pa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:u,replyParentId:a})=>{var m;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),o=(m=l==null?void 0:l.latest_reactions.reply)==null?void 0:m.map(d=>{var h;return d.id===a&&((h=d.latest_children.reply)==null||h.map(p=>{var g;return p.id===u&&((g=p.children_counts)!=null&&g.like?p.children_counts.like+=1:p.children_counts={like:1}),p})),d});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}},onError:(u,a,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(u,a)=>{var m;const l=e.getQueryData(t),o=(m=l==null?void 0:l.latest_reactions.reply)==null?void 0:m.map(d=>{var h;return d.id===a.replyParentId&&((h=d.latest_children.reply)==null||h.map(p=>(p.id===a.replyId&&(p.latest_children=p.latest_children||{},p.own_children=p.own_children||{},p.latest_children.like=p.latest_children.like||[],p.own_children.like=p.own_children.like||[],p.latest_children.like.push(u),p.own_children.like.push(u)),p))),d});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:o}})),{previousActivity:l}}}),ga=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:a,replyParentId:l})=>{var d;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),m=(d=o==null?void 0:o.latest_reactions.reply)==null?void 0:d.map(h=>{var p;return h.id===l&&((p=h.latest_children.reply)==null||p.map(g=>{var v;return g.id===a&&((v=g.children_counts)!=null&&v.like?g.children_counts.like-=1:g.children_counts={like:0}),g})),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,l)=>{var d;const o=e.getQueryData(t),m=(d=o==null?void 0:o.latest_reactions.reply)==null?void 0:d.map(h=>{var p;return h.id===l.replyParentId&&((p=h.latest_children.reply)==null||p.map(g=>{var v,k;return g.id===l.replyId&&((v=g.own_children)!=null&&v.like&&(g.own_children.like=g.own_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id))),(k=g.latest_children)!=null&&k.like&&(g.latest_children.like=g.latest_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id)))),g})),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}}}),_a=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:i,replies:c,functions:{create:u,edit:a,remove:l,join:o,leave:m,like:d,unlike:h}})=>{const p=M.useIntl(),g=W.useQueryClient(),v=_.useContext(ke),k=_.useContext(et),S=ma({queryClient:g,queryKey:[e,t,r],mutationFn:async y=>u({replyId:n,content:y.body})}),{mutate:j}=W.useMutation(S),x=fa({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:C}=W.useMutation(x),R=ha({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:y})=>l({replyId:y})}),{mutate:A}=W.useMutation(R),V=pa({queryClient:g,queryKey:[e,t,r],mutationFn:d}),{mutate:D}=W.useMutation(V),P=ga({queryClient:g,queryKey:[e,t,r],user:v,mutationFn:h}),{mutate:Y}=W.useMutation(P),b=_.useCallback(({replyId:y,replyParentId:w})=>D({replyId:y,replyParentId:w}),[D]),Z=_.useCallback(({replyId:y,replyParentId:w})=>Y({replyId:y,replyParentId:w}),[Y]);return s.jsx(ds,{count:i,showRepliesButton:i>0||k.showForm,children:s.jsxs(s.Fragment,{children:[k.showForm&&s.jsx(wt,{contentType:"reply",createPost:(y,w)=>j(w),membershipRequiredToPost:{isMember:!0,required:!0,join:o,leave:m,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(c==null?void 0:c.length)===0||(c==null?void 0:c.map(y=>{var w,z,J,ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he;return s.jsx(tt,{content:{type:"reply",body:typeof y.data.content=="string"?(w=y==null?void 0:y.data)==null?void 0:w.content:((J=(z=y==null?void 0:y.data)==null?void 0:z.content)==null?void 0:J.text)||"",createdAt:y==null?void 0:y.created_at,slugs:{parentId:t,activityId:r,replyParentId:y==null?void 0:y.parent,reply:y==null?void 0:y.id},slug:"",author:{id:(ne=y==null?void 0:y.user)==null?void 0:ne.id,name:(re=(se=y==null?void 0:y.user)==null?void 0:se.data)==null?void 0:re.name,organization:(de=(q=y==null?void 0:y.user)==null?void 0:q.data)==null?void 0:de.organization,jobTitle:(L=(ce=y==null?void 0:y.user)==null?void 0:ce.data)==null?void 0:L.jobTitle,image:{thumbnail:((me=(ae=y==null?void 0:y.user)==null?void 0:ae.data)==null?void 0:me.thumbnail)||void 0}},userLiked:((oe=y==null?void 0:y.own_children)==null?void 0:oe.like)&&((pe=y==null?void 0:y.own_children)==null?void 0:pe.like.length)>0,likes:((fe=y==null?void 0:y.children_counts)==null?void 0:fe.like)||0,peopleWhoLiked:((ge=y==null?void 0:y.latest_children)==null?void 0:ge.like)&&((he=y==null?void 0:y.latest_children)==null?void 0:he.like.map(B=>{var G,ie;return{id:B==null?void 0:B.user_id,name:(ie=(G=B==null?void 0:B.user)==null?void 0:G.data)==null?void 0:ie.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:B=>{const{replySlug:G,replyParentId:ie}=B;return A({replyId:G,replyParentId:ie})},updateContent:(B,G)=>C({replyInfo:B,content:G})},likes:{createLike:()=>b({replyId:y==null?void 0:y.id,replyParentId:y==null?void 0:y.parent}),deleteLike:()=>{var G,ie,K;const B=((G=y==null?void 0:y.own_children)==null?void 0:G.like)&&((K=(ie=y==null?void 0:y.own_children)==null?void 0:ie.like[0])==null?void 0:K.id);return Z({replyId:B||""})}},comments:{}}},y==null?void 0:y.id)}))]})})},ms=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:i,functions:{create:c,edit:u,remove:a,like:l,unlike:o,join:m,leave:d}})=>{const h=M.useIntl(),p=W.useQueryClient(),g=_.useContext(ke),v=ia({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>c({activityId:n,content:b.body})}),{mutate:k}=W.useMutation(v),S=ca({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>u(b)}),{mutate:j}=W.useMutation(S),x=la({queryClient:p,queryKey:[e,t,n],mutationFn:async({replyId:b})=>a({replyId:b})}),{mutate:C}=W.useMutation(x),R=ua({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:A}=W.useMutation(R),V=da({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:o}),{mutate:D}=W.useMutation(V),P=_.useCallback(({replyId:b})=>A({replyId:b}),[A]),Y=_.useCallback(({replyId:b})=>D({replyId:b}),[D]);return s.jsxs(s.Fragment,{children:[s.jsx(wt,{contentType:"reply",createPost:(b,Z)=>k(Z),membershipRequiredToPost:{isMember:i,required:!0,join:m,leave:d,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var w,z,J,ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he,B,G,ie;const Z=((w=b==null?void 0:b.user)==null?void 0:w.id)===(g==null?void 0:g.id),y=rn(i,Z);return s.jsx(ls,{children:s.jsx(tt,{content:{type:"reply",body:typeof b.data.content=="string"?(z=b==null?void 0:b.data)==null?void 0:z.content:((ne=(J=b==null?void 0:b.data)==null?void 0:J.content)==null?void 0:ne.text)||"",canLike:y,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:b==null?void 0:b.id},slug:`${e}/${t}/${n}#${b==null?void 0:b.id}`,author:{id:(se=b==null?void 0:b.user)==null?void 0:se.id,name:(q=(re=b==null?void 0:b.user)==null?void 0:re.data)==null?void 0:q.name,organization:(ce=(de=b==null?void 0:b.user)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(ae=(L=b==null?void 0:b.user)==null?void 0:L.data)==null?void 0:ae.jobTitle,image:{thumbnail:((oe=(me=b==null?void 0:b.user)==null?void 0:me.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:((pe=b==null?void 0:b.own_children)==null?void 0:pe.like)&&((fe=b==null?void 0:b.own_children)==null?void 0:fe.like.length)>0,likes:((ge=b==null?void 0:b.children_counts)==null?void 0:ge.like)||0,peopleWhoLiked:((he=b==null?void 0:b.latest_children)==null?void 0:he.like)&&((B=b==null?void 0:b.latest_children)==null?void 0:B.like.map(K=>{var le,be;return{id:K==null?void 0:K.user_id,name:(be=(le=K==null?void 0:K.user)==null?void 0:le.data)==null?void 0:be.name}}))},functions:{content:{createContent:()=>null,deleteContent:K=>{const{replySlug:le}=K;return C({replyId:le})},updateContent:(K,le)=>j({replyInfo:K,content:le})},likes:{createLike:()=>P({replyId:b==null?void 0:b.id}),deleteLike:()=>{var le,be,Me;const K=((le=b==null?void 0:b.own_children)==null?void 0:le.like)&&((Me=(be=b==null?void 0:b.own_children)==null?void 0:be.like[0])==null?void 0:Me.id);return Y({replyId:K||""})}},comments:{}},children:s.jsx(_a,{basePath:e,parentId:t,replyParentId:b==null?void 0:b.id,activityId:n,replyCount:((G=b==null?void 0:b.children_counts)==null?void 0:G.reply)||0,replies:(ie=b==null?void 0:b.latest_children)==null?void 0:ie.reply,isMember:i,functions:{create:c,edit:u,remove:a,like:l,unlike:o,join:m,leave:d}})},b==null?void 0:b.id)},b==null?void 0:b.id)}))]})},xa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:u,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);return l&&l.id===(u==null?void 0:u.activityId)&&(l.content=a),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onError:(u,a,l)=>{e.setQueryData(t,l.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),ba=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),va=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var l;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(l=a==null?void 0:a.reaction_counts)!=null&&l.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,l,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{const l=e.getQueryData(t);return l!=null&&l.own_reactions.like?l.own_reactions.like.push(a):l&&(l.own_reactions={like:[a]}),l!=null&&l.latest_reactions.like?l.latest_reactions.like.push(a):l&&(l.own_reactions={like:[a]}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),wa=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:i})=>({mutationFn:i,onMutate:async()=>{var m;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(m=o==null?void 0:o.reaction_counts)!=null&&m.like&&o.reaction_counts.like>0&&(o.reaction_counts.like-=1),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,m,d)=>{e.setQueryData(t,d.previousActivity)},onSuccess:()=>{var d,h,p;if(!r)return;const o=(p=(h=(d=r.own_reactions)==null?void 0:d.like)==null?void 0:h.find(g=>g.user_id===(n==null?void 0:n.id)))==null?void 0:p.id,m=e.getQueryData(t);if(m!=null&&m.own_reactions.like&&(m.own_reactions.like=m.own_reactions.like.filter(g=>g.id!==o),!!(m!=null&&m.latest_reactions.like)))return m.latest_reactions.like=m.latest_reactions.like.filter(g=>g.id!==o),e.setQueryData(t,()=>({...m})),{previousActivity:m}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const ka=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:i,editActivity:c,removeActivity:u,likeActivity:a,unlikeActivity:l,createReply:o,editReply:m,removeReply:d,likeReply:h,unlikeReply:p,join:g,leave:v}})=>{var se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he,B,G,ie,K,le,be,Me,Oe,Ce,nt;const k=M.useIntl(),S=_.useContext(ke),j=W.useQueryClient(),{data:x,isLoading:C,isFetching:R}=W.useQuery({queryKey:[e,t,n],queryFn:i}),A=xa({queryClient:j,queryKey:[e,t,n],mutationFn:async ee=>await c(ee)}),{mutate:V}=W.useMutation(A),D=ba({queryClient:j,queryKey:[e,t,n],mutationFn:async({activityId:ee})=>u({activityId:ee}),redirectUrl:`${e}/${t}`}),{mutate:P}=W.useMutation(D),Y=va({queryClient:j,queryKey:[e,t,n],mutationFn:a}),{mutate:b}=W.useMutation(Y),Z=wa({queryClient:j,queryKey:[e,t,n],user:S,mutationFn:async()=>{var je,Ne,st;const ee=(st=(Ne=(je=x==null?void 0:x.own_reactions)==null?void 0:je.like)==null?void 0:Ne.find(rt=>rt.user_id===(S==null?void 0:S.id)))==null?void 0:st.id;await l({activityId:n,reactionId:ee})},activity:x}),{mutate:y}=W.useMutation(Z),w=_.useCallback(({activityId:ee})=>b({activityId:ee}),[b]),z=_.useCallback(async({activityId:ee})=>y({activityId:ee}),[y]);if(C||R)return s.jsx(we,{style:{height:"400px"}});if(!x)return s.jsx(Ke,{variant:"error",text:k.formatMessage({id:"activitySection_notFoundError"})});const J=((se=x==null?void 0:x.actor)==null?void 0:se.id)===(S==null?void 0:S.id),ne=rn(r,J);return s.jsx(tt,{className:"activity-section",content:{type:"post",body:x==null?void 0:x.content,canLike:ne,createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:x==null?void 0:x.id},slug:n,author:{id:(re=x==null?void 0:x.actor)==null?void 0:re.id,name:((q=x==null?void 0:x.actor)==null?void 0:q.data)&&((ce=(de=x==null?void 0:x.actor)==null?void 0:de.data)==null?void 0:ce.name),organization:((L=x==null?void 0:x.actor)==null?void 0:L.data)&&((me=(ae=x==null?void 0:x.actor)==null?void 0:ae.data)==null?void 0:me.organization),jobTitle:((oe=x==null?void 0:x.actor)==null?void 0:oe.data)&&((fe=(pe=x==null?void 0:x.actor)==null?void 0:pe.data)==null?void 0:fe.jobTitle),image:{thumbnail:((ge=x==null?void 0:x.actor)==null?void 0:ge.data)&&((B=(he=x==null?void 0:x.actor)==null?void 0:he.data)==null?void 0:B.thumbnail)||void 0}},userLiked:((G=x==null?void 0:x.own_reactions)==null?void 0:G.like)&&((ie=x==null?void 0:x.own_reactions)==null?void 0:ie.like.length)>0,likes:x&&((K=x==null?void 0:x.reaction_counts)==null?void 0:K.like),comments:x&&((le=x==null?void 0:x.reaction_counts)==null?void 0:le.reply),peopleWhoLiked:((be=x==null?void 0:x.latest_reactions)==null?void 0:be.like)&&((Me=x==null?void 0:x.latest_reactions)==null?void 0:Me.like.map(ee=>{var je,Ne;return{id:ee==null?void 0:ee.user_id,name:(Ne=(je=ee==null?void 0:ee.user)==null?void 0:je.data)==null?void 0:Ne.name}}))},originalAuthorId:(Oe=x==null?void 0:x.actor)==null?void 0:Oe.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>P({activityId:n}),updateContent:(ee,je)=>V({activityInfo:ee,content:je})},likes:{createLike:()=>w({activityId:n}),deleteLike:()=>z({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((Ce=x==null?void 0:x.reaction_counts)==null?void 0:Ce.reply)||0,")"]}),s.jsx(ms,{basePath:e,parentId:t,activityId:n,repliesList:(nt=x==null?void 0:x.latest_reactions)==null?void 0:nt.reply,isMember:r,functions:{create:o,edit:m,remove:d,like:h,unlike:p,join:g,leave:v}})]})},n)},ja=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),ya=({type:e,data:t})=>{const n=M.useIntl(),{answers:r,createdAt:i,dateHasPassed:c,isOngoingEvent:u,pill:a,readingTime:l,publishedDate:o,startDate:m}=t;if(e==="question"){const d=i&&Qt(i);return s.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&s.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})]})]})}if(m&&!c||u)return s.jsx("p",{className:"details",children:u?n.formatMessage({id:"card_bootcamp"}):Fn(m)});if(a)return s.jsx(Ge,{variant:a==="free"?"subtle":"highlighted",className:a,"data-testid":"course-type",children:a});if(l||o){const d=o&&Qt(o);return s.jsxs("ul",{className:"details",children:[l&&s.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),o&&s.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:d?n.formatMessage({id:`dates_${d.path}`},{number:d.number}):0})})]})}return null},_t={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"}},Ea=({data:e,cta:t,link:n,gtmContext:r})=>{var g;const i=M.useIntl(),[c,u]=_.useState({loading:!1,registered:e.registered||!1});_.useEffect(()=>{e.registered&&u(v=>({...v,registered:!0}))},[e.registered]);const{startDate:a,dateHasPassed:l,pill:o,slug:m}=e,d=e.contentType;let h="";if((g=_t[d])!=null&&g.gtmEvent&&(h=_t[d].gtmEvent),a&&l)return s.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:i.formatMessage({id:"card_watch"})});if(d==="people")return s.jsx(Q,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:i.formatMessage({id:"card_cta_people"})});const p=["microcourse","event"];if(t&&t.onClick&&p.includes(d)&&o!=="premium"){const v=c.loading||c.registered,k=async S=>{if(S.preventDefault(),S.stopPropagation(),!(v||!t||!t.onClick)){u(j=>({...j,loading:!0}));try{const j=await t.onClick(e);u(j==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{u(x=>({...x,loading:!1}))}}};return s.jsx(Q,{onClick:k,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${d}: ${m}`,"data-gtm-event-type":`${r}-${d}-register-click`,"data-testid":"in-card-button",children:i.formatMessage({id:`card_cta_${d}${v?`_${c.loading?"loading":"done"}`:""}`})})}return null},Sn={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Sa=e=>{let t=e;return Object.keys(Sn).includes(e)&&(t=Sn[e]),`url(${Ye}icons/${t}.svg)`};const $a={title:66,text:3e3,secondaryText:1e3,partner:25},Ta=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:i="Carousel",className:c=""})=>{const u=M.useIntl(),a=_.useContext(ke),l=a&&typeof a.id=="string",[o,m]=_.useState({data:null,isLoading:!0}),{data:d,isLoading:h}=o,p=_.useCallback(()=>{n(t,l).then(D=>{m(()=>({data:D,isLoading:!1}))}).catch(()=>m(D=>({...D,isLoading:!1})))},[e]);if(_.useEffect(()=>{p()},[]),h||!d)return s.jsx(we,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:g}=d;if(!g||!_t[g])return s.jsx(we,{element:"li",className:"card-wrapper"});const{basePath:v="",className:k,length:S,gtmEvent:j}=_t[g],x=Ln(`card_label_${g}`)?u.formatMessage({id:`card_label_${g}`}):!1,C=d.slug?`${v}${d.slug}`:!1,R={...$a,...S};let A={className:"card"};C&&(A={href:C,className:"card gtm-trackable","data-gtm-event-context":`${i}-CarouselCard`,"data-gtm-event-type":`${j}-click`,"data-testid":"link"},d.openInNewTab&&(A.target="_blank"));const V=d.customIcon?{"--custom-icon":Sa(d.customIcon)}:{};return s.jsx("li",{className:T("card-wrapper text-medium",k,c,{"has-link":C,"no-link":!C,"has-custom-icon":d.customIcon,"has-image":d.banner}),style:V,"data-testid":`${g}-card`,children:_.createElement(C?"a":"div",A,s.jsxs(s.Fragment,{children:[(d.customLabel||x)&&s.jsx("small",{className:T("card-label text-small",k),children:d.customLabel||x}),d.startDate&&!d.isOngoingEvent&&s.jsx(Ge,{size:"small",variant:d.dateHasPassed?"default":"information","data-testid":"date",children:d.dateHasPassed?u.formatMessage({id:"card_ended"}):zs(d.startDate)}),d.banner?s.jsxs("p",{className:"img",children:[d.registered&&s.jsx(Ge,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),s.jsx(Yt,{image:d.banner})]}):k==="people"?s.jsx(Be,{name:d.title||"",src:d.profile,"data-testid":"people-profile-picture"}):null,d.contributors&&s.jsx(Xt,{contributors:{data:d.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},"data-testid":"contributors"}),d.partner&&s.jsx("p",{className:"partners","data-testid":"partners",children:Ie(d.partner.title,R.partner)}),["title","text","secondaryText"].map(D=>{const P=d[D];if(!P)return null;const Y=Ws(D);return s.jsx("p",{className:Y,"data-testid":Y,children:Ie(P,R[D])},D)}),s.jsx(ya,{type:k||"",data:d}),s.jsx(Ea,{data:d,cta:r,link:C||"",gtmContext:i})]}))})};const Ma=({cards:e,cardTypes:t,className:n="",...r})=>s.jsx("ul",{className:T("card-block",n),children:e.map((i,c)=>{const u=i.slug?`${i.slug}-${t[c]}`:`${t[c]}-${c}`;return s.jsx(Ta,{id:u,card:{...i,contentType:t[c]},...r},u)})});const $n=[{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 dt="notFoundError_",Ca=()=>{const e=M.useIntl(),t=[];return $n.forEach((n,r)=>{n.title=e.formatMessage({id:`${dt}post_${r+1}`}),t.push("solutionArticle")}),s.jsxs(cs,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:s.jsxs(bt,{children:[s.jsx(Ma,{cards:$n,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),s.jsx(Q,{href:"/solution-articles/",children:e.formatMessage({id:`${dt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[s.jsx("h1",{children:e.formatMessage({id:`${dt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${dt}text`})})]})};exports.ASSETS_BUCKET=Ye;exports.ActivitiesFeed=oa;exports.ActivitySection=ka;exports.AddPost=wt;exports.BannerSection=or;exports.Breadcrumbs=$r;exports.Button=Q;exports.ButtonWrapper=Ze;exports.CacheProvider=Yn;exports.CollapsibleSection=Gt;exports.Columns=es;exports.CommunityDetails=Sr;exports.Contributors=Xt;exports.ConversationContext=et;exports.CookieBanner=ts;exports.DiscussionConversation=ls;exports.DiscussionForm=sn;exports.DiscussionLikes=us;exports.DiscussionPost=tt;exports.DiscussionThread=ds;exports.Divider=Re;exports.DownloadSection=nr;exports.EMAILS=Fe;exports.EmailHelperTextBox=Ir;exports.EmptyStateBox=Ke;exports.Filters=Tr;exports.FlagsProvider=Gn;exports.Footer=Kt;exports.FullWidthSection=bt;exports.GlobalProviders=Er;exports.Header=en;exports.HelperTextBox=Qn;exports.HiddenFromScreenReaders=zt;exports.HideShowTextBox=lr;exports.HighlightedTextBox=Te;exports.IntlProvider=Jn;exports.InviteForm=os;exports.InviteModal=Wr;exports.JoinButton=Zt;exports.LanguageSwitcher=Cr;exports.Link=qe;exports.LoadMore=Zn;exports.LoadingBlock=br;exports.LoadingPlaceholder=we;exports.LoadingState=vr;exports.Logo=qt;exports.LogoSection=sr;exports.MarkdownText=Ut;exports.MarketingBox=ir;exports.Member=vt;exports.MembersList=Gr;exports.Modal=tn;exports.MoreMenu=qn;exports.NUMBER_OF_USERS=cr;exports.NavigationMenu=Kn;exports.NotFoundError=Ca;exports.Overlay=nn;exports.PageHeading=Un;exports.PageLayout=cs;exports.PasswordRules=Qr;exports.Pill=Ge;exports.ProfilePicture=Be;exports.ProgressBar=Wn;exports.Rating=Hr;exports.RepliesFeed=ms;exports.ResponsesHeading=Kr;exports.ResponsiveImage=Yt;exports.SearchForm=as;exports.ShareLinks=Ar;exports.Span=Hn;exports.StatusBanner=ht;exports.Tags=Yr;exports.Tooltip=Bn;exports.TopLevelPage=Lr;exports.UserContext=ke;exports.UserProvider=Xn;exports.VisuallyHidden=ue;exports.addAriaProps=is;exports.getMember=Jt;exports.headerData=Je;exports.mapGetStreamData=ja;exports.pageReady=In;exports.useCurrentPath=Nn;exports.useEffectAfterMount=De;exports.useElementWidth=Xe;exports.useScrollListener=Rn;exports.useScrollToHash=Us;