@apolitical/component-library 1.14.9 → 1.14.10-beta.7
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 +11 -11
- package/index.mjs +161 -161
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),$s=require("lodash.clonedeep"),Ms=require("lodash.set"),T=require("react-intl"),Ie=require("truncate"),xt=require("markdown-to-jsx"),W=require("@tanstack/react-query"),Ts=require("@tanstack/react-query-devtools"),mt=require("posthog-js"),$n=require("react-cookie"),Cs=require("react-multi-email"),Mn=require("lodash.get"),Ns=require("react-error-boundary"),Ds=require("react-textarea-autosize"),Ps=require("lodash.isequal");function Rs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tn={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
|
|
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 As=Tn.exports;const M=Rs(As),Fs=({element:e="span",showOnFocus:t=!0,children:n,...r})=>_.createElement(e,{...r,className:M("hidden",{"show-on-focus":t}),children:n}),ue=_.memo(Fs),Ls=({element:e="span",children:t=null,...n})=>_.createElement(e,{...n,"aria-hidden":!0},t),zt=_.memo(Ls);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
|
|
13
|
+
*/var gn;function Is(){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={};/**
|
|
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
|
|
21
|
+
*/var _n;function Bs(){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,P=!1,A=!1,V=!1,D=!1,R;R=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||P||A||typeof f=="object"&&f!==null&&(f.$$typeof===h||f.$$typeof===m||f.$$typeof===d||f.$$typeof===a||f.$$typeof===l||f.$$typeof===R||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`
|
|
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,
|
|
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,ds={key:!0,ref:!0,__self:!0,__source:!0},on,cn,kt;kt={};function ms(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 fs(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 hs(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 ps(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 gs(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 _s=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 xs(f,E,$,N,O){{var U,I={},F=null,_e=null;$!==void 0&&(an($),F=""+$),fs(E)&&(an(E.key),F=""+E.key),ms(E)&&(_e=E.ref,hs(E,O));for(U in E)be.call(E,U)&&!ds.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&&ps(I,te),_e&&gs(I,te)}return _s(f,F,_e,O,N,Qe.current,I)}}var jt=S.ReactCurrentOwner,ln=S.ReactDebugCurrentFrame;function Re(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
|
|
27
|
+
Check the render method of \``+f+"`."}return""}}function bs(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
|
|
29
|
+
Check your code at `+E+":"+$+"."}return""}}var dn={};function vs(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)+"."),Re(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),Re(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"){Re(f),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",N),Re(null);break}}f.ref!==null&&(Re(f),j("Invalid attribute `ref` supplied to `React.Fragment`."),Re(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 R=a.current,Y=l.current;return a.current=l.current=null,i.current=D,o.current=u.current.apply(Y,R)},x=function(D,R){h&&cancelAnimationFrame(d.current),d.current=h?requestAnimationFrame(D):setTimeout(D,R)},C=function(D){if(!m.current)return!1;var R=D-c.current;return!c.current||R>=t||R<0||v&&D-i.current>=k},P=function(D){return d.current=null,g&&a.current?j(D):(a.current=l.current=null,o.current)},A=function D(){var R=Date.now();if(C(R))return P(R);if(m.current){var Y=t-(R-c.current),b=v?Math.min(Y,k-(R-i.current)):Y;x(D,b)}},V=function(){var D=Date.now(),R=C(D);if(a.current=[].slice.call(arguments),l.current=r,c.current=D,R){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?P(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)},Us=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Ms(e);return t.forEach(({type:r,value:c})=>{Ts(n,r,c)}),n},Pn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Rn=(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},Ws=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),zs=(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)}},Vs=e=>new Promise(t=>setTimeout(t,e)),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 $=vs(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)+"."),Re(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),Re(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 ws(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 ks(f){{for(var E=Object.keys(f.props),$=0;$<E.length;$++){var N=E[$];if(N!=="children"&&N!=="key"){Re(f),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",N),Re(null);break}}f.ref!==null&&(Re(f),j("Invalid attribute `ref` supplied to `React.Fragment`."),Re(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=bs(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=xs(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?ks(te):ws(te),te}}function js(f,E,$){return hn(f,E,$,!0)}function ys(f,E,$){return hn(f,E,$,!1)}var Es=ys,Ss=js;Ue.Fragment=r,Ue.jsx=Es,Ue.jsxs=Ss}()),Ue}process.env.NODE_ENV==="production"?Ot.exports=Is():Ot.exports=Bs();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 Os(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 R=a.current,Y=l.current;return a.current=l.current=null,i.current=D,o.current=u.current.apply(Y,R)},x=function(D,R){h&&cancelAnimationFrame(d.current),d.current=h?requestAnimationFrame(D):setTimeout(D,R)},C=function(D){if(!m.current)return!1;var R=D-c.current;return!c.current||R>=t||R<0||v&&D-i.current>=k},P=function(D){return d.current=null,g&&a.current?j(D):(a.current=l.current=null,o.current)},A=function D(){var R=Date.now();if(C(R))return P(R);if(m.current){var Y=t-(R-c.current),b=v?Math.min(Y,k-(R-i.current)):Y;x(D,b)}},V=function(){var D=Date.now(),R=C(D);if(a.current=[].slice.call(arguments),l.current=r,c.current=D,R){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?P(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 Os(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},Qs=(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)},Hs=(e,t)=>{Array.isArray(t)||(t=[t]);const n=$s(e);return t.forEach(({type:r,value:c})=>{Ms(n,r,c)}),n},Pn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Rn=(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)}},zs=e=>new Promise(t=>setTimeout(t,e)),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..."},Ys={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>"},Gs={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>"},Js={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>"},Xs=Object.freeze(Object.defineProperty({__proto__:null,en:Vt,es:Ys,fr:Gs,pt:Js},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},Zs=(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},ft=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),qs=e=>e.replace(/\s+/g,"").length>0,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=Pn(Object.keys(k));t=Rn(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 Pe=({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 Ln=({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=Pn(Object.keys(m));c=Rn(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}),In={q:Ht,blockquote:Ht};for(let e=1;e<=6;e++)In[`h${e}`]={component:Ht,props:{className:"title"}};const Bn=({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:In},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"})),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},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 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},ft=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),Zs=e=>e.replace(/\s+/g,"").length>0,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=Pn(Object.keys(k));t=Rn(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 Pe=({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"}},qs=({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}},Ks=({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}?${Ks({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}=qs(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 Ln=({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 er=({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 tr=({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 nr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],sr=({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&&nr.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"}})]})})},rr=_.memo(sr);const ar=({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"}},or="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=Pn(Object.keys(m));c=Rn(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}),In={q:Ht,blockquote:Ht};for(let e=1;e<=6;e++)In[`h${e}`]={component:Ht,props:{className:"title"}};const Bn=({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:In},children:r}):s.jsx("p",{children:r})]});const ir=({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(`
|
|
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})},On=({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 Qn=({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})})})},Hn=_.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(Hn,{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"]},Un=(e,t)=>e in Wt?s.jsx("div",{className:e,children:Wt[e].map((n,r)=>Un(n,r))},t):s.jsx(we,{className:e},t),Wn=({layout:e="overview-page",...t})=>s.jsx("div",{className:M("loading-state",e),...t,children:Wt[e].map((n,r)=>Un(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"],br=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=br(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},vr=({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=vr(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:["+",Zs(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 wr=_.createContext({client:mt});function kr(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(wr.Provider,{value:{client:i}},t)}const Yn=({children:e,user:t})=>t.isLoading?s.jsx(s.Fragment,{}):process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(kr,{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={...Xs[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}),jr=({bootstrap:e,children:t,intl:n})=>{const[r,c]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(i=>c({...i,isLoading:!1})).catch(()=>c({isLoading:!1}))},[]),s.jsx(Gn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,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_",yr=({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(Pe,{}),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 Er=({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 Sr=({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)})})},$r=(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_",Mr=({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:$r(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}`)})})]})})},Tr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Cr=[{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:[Cr.map(({key:c,href:i})=>s.jsx("li",{className:M(c,{active:Tr(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}`:""}`,Nr=({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"&&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"})})})]})},cr=()=>_.Fragment,lr=({children:e})=>s.jsx(Me,{variant:"secondary",children:e}),ur=["span","strong","h1","h2","h3","h4","h5","h6","p"],dr=({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(ur.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)})},mr=({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})},fr=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},hr=({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})},On=({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:hr,CollapsibleSection:Gt,TextBox:Me,CaseStudy:lr,style:cr,details:dr,div:mr,iframe:fr}};return s.jsx("div",{className:M("markdown-text",e),children:s.jsx(xt,{options:{...r,...t},children:n})})};const Qn=({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 pr=({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})})})},Hn=_.memo(pr);const Mt="loadingBlock_",gr=({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(Hn,{progress:e})]})},_r=_.memo(gr);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"]},Un=(e,t)=>e in Wt?s.jsx("div",{className:e,children:Wt[e].map((n,r)=>Un(n,r))},t):s.jsx(we,{className:e},t),xr=({layout:e="overview-page",...t})=>s.jsx("div",{className:M("loading-state",e),...t,children:Wt[e].map((n,r)=>Un(n,r))}),Wn=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"],br=e=>{const t=Math.ceil(26/at.length),n=Wn(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=br(n),h.fillRect(0,0,p,g),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(Wn(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},vr=({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=vr(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:["+",Xs(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})]})})},zn=({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(Ts.ReactQueryDevtools,{initialIsOpen:!1})]})};var wr=_.createContext({client:mt});function kr(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(wr.Provider,{value:{client:i}},t)}const Vn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(kr,{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,Yn=({children:e,locale:t,messages:n})=>{const r=t||"en",c={...Js[r],...n||{}};return s.jsx(T.IntlProvider,{locale:r,messages:c,children:e})},ke=_.createContext(null),Gn=({children:e,user:t})=>s.jsx(ke.Provider,{value:t,children:e}),jr=({bootstrap:e,children:t,intl:n})=>{const[r,c]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(i=>c({...i,isLoading:!1})).catch(()=>c({isLoading:!1}))},[]),s.jsx(Yn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx($n.CookiesProvider,{children:s.jsx(Gn,{user:r,children:s.jsx(zn,{children:s.jsx(Vn,{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_",yr=({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(Pe,{}),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 Er=({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 Sr=({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)})})},$r=(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_",Mr=({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:$r(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}),Jn=({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 Xn=({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}`)})})]})})},Tr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Cr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],Zn=({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:[Cr.map(({key:c,href:i})=>s.jsx("li",{className:M(c,{active:Tr(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}`:""}`,Nr=({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 Dr="shareLinks_",Pr=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:c="large",variant:i="default",className:d=""})=>{const a=T.useIntl(),l=Nr({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:`${Dr}link_${o}`}),...g})},o)})})]})};const Rr={"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<Rr[e]?null:d)})},Ar=({activeLink:e,...t})=>s.jsx(Kn,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(qn,{activeLink:e}),s.jsx(Qn,{...t})]})});const Pt="cookieBanner_",Rt=["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(Rt),[c,i]=_.useState(!t["apol-cookie-banner"]),d=()=>{Rt.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}),Rt.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:`${Pt}buttons_${u.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${Pt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${Pt}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_",Fr=({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(Bn,{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",Lr={[ts]:"8Characters",[ns]:"numberSymbol",[ss]:"lowercaseUppercase"},Ir=({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_${Lr[r]}`})}),!e[r]&&s.jsxs(ue,{element:"strong",children:[" "," ",n.formatMessage({id:`${lt}notMet`})]})]},`rule-${r}`))})]})},Br=_.memo(Ir);const Or=({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(P){v("ERROR"),a(P)}},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(Pe,{}),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,P,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(P),p(!u.length)},className:"remove-email-button",screenreaderText:k({id:"overlay_close"})})]},P)})]}),s.jsx(Pe,{}),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 Qr={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(Us,{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:Qr[`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(Pe,{}),l,o&&s.jsxs("div",{className:"bottom",children:[s.jsx(Pe,{}),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 Hr=({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 Ur=()=>{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(Ur,{}),children:s.jsx(_.Suspense,{fallback:s.jsx(Wn,{layout:"overview-page"}),children:s.jsx("div",{id:"wrapper",className:M(d,S,{"has-footer":o}),children:s.jsxs($n.CookiesProvider,{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"},Wr={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 zr=({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=Wr.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 Vr=({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 R,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"?((R=e.slugs)==null?void 0:R.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 Vs(1e3),a.callback&&await a.callback(w),ut=setTimeout(()=>{h(""),k("submitted"),P()},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),P()}},P=()=>{ut=setTimeout(()=>{g(!1),k(!1)},5e3)},A=!m||!qs(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(Ps,{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}}),Yr={showThread:!1,showForm:!1},et=_.createContext(Yr),cs=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(et.Provider,{value:{...t,updateConversation:n},children:e})},Gr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Jr=(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(()=>Jr(n,It),[n]),x=P=>{if(P.preventDefault(),P.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 P=h?u-1:u+1;P<0&&(P=0),v(!0),m(P),p(!h);try{if(i&&i.slugs){const A=Gr(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(Ln,{isOpen:k,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[j.map(P=>typeof P=="string"||!P.name?null:s.jsx("li",{children:s.jsx(qe,{href:P.id?`/profiles/${P.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:A=>A==null?void 0:A.stopPropagation(),children:P.name})},P.id||window.btoa(P.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_",Xr=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}),[P,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:R,canLike:Y,createdAt:b,id:Z,likes:y=0,userLiked:w,comments:z=0}=t,J=v?Ie(x.body,Xr):x.body,ne=S&&S.id&&typeof R!="string"&&R.id&&R.id===S.id||!1,se=typeof Y=="boolean"?Y:n?!ne:!1,re=async L=>{L||(L=""),D("");try{if(!Rs(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`,P)}),_.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:R,additionalContent:{createdAt:b,didEdit:x.didEdit},className:typeof R!="string"&&R.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:On}},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:P,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_",Zr=({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})]})},qr=({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}),Kr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:a})=>{if(!n)return;const l=qr({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})}}),ea=({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})}}),ta=({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]})}}),na=({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]})}}),sa=({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]})}}),ra=({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=Kr({queryClient:h,queryKey:[e,t],user:p,mutationFn:c}),{mutate:x}=W.useMutation(j),C=ea({queryClient:h,queryKey:[e,t],mutationFn:async w=>await i(w)}),{mutate:P}=W.useMutation(C),A=ta({queryClient:h,queryKey:[e,t],mutationFn:async({activityId:w})=>await d({activityId:w})}),{mutate:V}=W.useMutation(A),D=na({queryClient:h,queryKey:[e,t],mutationFn:a}),{mutate:R}=W.useMutation(D),Y=sa({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})=>R({activityId:w}),[R]),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)=>P({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(Pe,{})]},w==null?void 0:w.id)}))]})},aa=({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})}}),oa=({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)}}),ia=({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)}}),ca=({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}}}),la=({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}}}),ua=({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})}}),da=({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}}}),ma=({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}}}),fa=({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}}}),ha=({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}}}),pa=({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=ua({queryClient:g,queryKey:[e,t,r],mutationFn:async y=>d({replyId:n,content:y.body})}),{mutate:j}=W.useMutation(S),x=da({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:C}=W.useMutation(x),P=ma({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:y})=>l({replyId:y})}),{mutate:A}=W.useMutation(P),V=fa({queryClient:g,queryKey:[e,t,r],mutationFn:m}),{mutate:D}=W.useMutation(V),R=ha({queryClient:g,queryKey:[e,t,r],user:v,mutationFn:h}),{mutate:Y}=W.useMutation(R),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=aa({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>i({activityId:n,content:b.body})}),{mutate:k}=W.useMutation(v),S=oa({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:j}=W.useMutation(S),x=ia({queryClient:p,queryKey:[e,t,n],mutationFn:async({replyId:b})=>a({replyId:b})}),{mutate:C}=W.useMutation(x),P=ca({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:A}=W.useMutation(P),V=la({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:o}),{mutate:D}=W.useMutation(V),R=_.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:()=>R({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(pa,{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)}))]})},ga=({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})}}),_a=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),xa=({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})}}),ba=({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 va=({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:P}=W.useQuery({queryKey:[e,t,n],queryFn:c}),A=ga({queryClient:j,queryKey:[e,t,n],mutationFn:async ee=>await i(ee)}),{mutate:V}=W.useMutation(A),D=_a({queryClient:j,queryKey:[e,t,n],mutationFn:async({activityId:ee})=>d({activityId:ee}),redirectUrl:`${e}/${t}`}),{mutate:R}=W.useMutation(D),Y=xa({queryClient:j,queryKey:[e,t,n],mutationFn:a}),{mutate:b}=W.useMutation(Y),Z=ba({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||P)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:()=>R({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)},wa=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:c}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:c}}),ka=({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"}},ja=({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"},ya=e=>{let t=e;return Object.keys(En).includes(e)&&(t=En[e]),`url(${Ye}icons/${t}.svg)`};const Ea={title:66,text:3e3,secondaryText:1e3,partner:25},Sa=({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,P={...Ea,...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":ya(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"}):zs(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,P.partner)}),["title","text","secondaryText"].map(D=>{const R=m[D];if(!R)return null;const Y=Ws(D);return s.jsx("p",{className:Y,"data-testid":Y,children:Ie(R,P[D])},D)}),s.jsx(ka,{type:k||"",data:m}),s.jsx(ja,{data:m,cta:r,link:C||"",gtmContext:c})]}))})};const $a=({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(Sa,{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_",Ma=()=>{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($a,{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=ra;exports.ActivitySection=va;exports.AddPost=wt;exports.BannerSection=ar;exports.Breadcrumbs=Er;exports.Button=Q;exports.ButtonWrapper=Ze;exports.CacheProvider=Vn;exports.CollapsibleSection=Gt;exports.Columns=Kn;exports.CommunityDetails=yr;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=Pe;exports.DownloadSection=tr;exports.EMAILS=Fe;exports.EmailHelperTextBox=Fr;exports.EmptyStateBox=Ke;exports.Filters=Sr;exports.FlagsProvider=Yn;exports.Footer=Kt;exports.FullWidthSection=bt;exports.GlobalProviders=jr;exports.Header=en;exports.HelperTextBox=Bn;exports.HiddenFromScreenReaders=zt;exports.HideShowTextBox=cr;exports.HighlightedTextBox=Me;exports.IntlProvider=Gn;exports.InviteForm=as;exports.InviteModal=Hr;exports.JoinButton=Zt;exports.LanguageSwitcher=Mr;exports.Link=qe;exports.LoadMore=Xn;exports.LoadingBlock=xr;exports.LoadingPlaceholder=we;exports.LoadingState=Wn;exports.Logo=qt;exports.LogoSection=nr;exports.MarkdownText=Ut;exports.MarketingBox=or;exports.Member=vt;exports.MembersList=Vr;exports.Modal=tn;exports.MoreMenu=Zn;exports.NUMBER_OF_USERS=ir;exports.NavigationMenu=qn;exports.NotFoundError=Ma;exports.Overlay=nn;exports.PageHeading=Qn;exports.PageLayout=is;exports.PasswordRules=Br;exports.Pill=Ge;exports.ProfilePicture=Be;exports.ProgressBar=Hn;exports.Rating=Or;exports.RepliesFeed=ds;exports.ResponsesHeading=Zr;exports.ResponsiveImage=Yt;exports.SearchForm=rs;exports.ShareLinks=Pr;exports.Span=On;exports.StatusBanner=ht;exports.Tags=zr;exports.Tooltip=Ln;exports.TopLevelPage=Ar;exports.UserContext=ke;exports.UserProvider=Jn;exports.VisuallyHidden=ue;exports.addAriaProps=os;exports.getMember=Jt;exports.headerData=Je;exports.mapGetStreamData=wa;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,c)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(c))}];const Dr="shareLinks_",Pr=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:c="large",variant:i="default",className:d=""})=>{const a=T.useIntl(),l=Nr({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:`${Dr}link_${o}`}),...g})},o)})})]})};const Rr={"2-1":901,"1-3":769},qn=({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<Rr[e]?null:d)})},Ar=({activeLink:e,...t})=>s.jsx(qn,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(Zn,{activeLink:e}),s.jsx(Qn,{...t})]})});const Pt="cookieBanner_",Rt=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],At=new Date(Date.now()+12*30*24*60*60*1e3),Kn=()=>{const e=T.useIntl(),[t,n,r]=$n.useCookies(Rt),[c,i]=_.useState(!t["apol-cookie-banner"]),d=()=>{Rt.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}),Rt.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:`${Pt}buttons_${u.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${Pt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${Pt}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_",Fr=({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(Bn,{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_",es="isMoreThanEightCharacters",ts="includesNumberAndSymbol",ns="includesLowerAndUppercase",Lr={[es]:"8Characters",[ts]:"numberSymbol",[ns]:"lowercaseUppercase"},Ir=({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:[es,ts,ns].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_${Lr[r]}`})}),!e[r]&&s.jsxs(ue,{element:"strong",children:[" "," ",n.formatMessage({id:`${lt}notMet`})]})]},`rule-${r}`))})]})},Br=_.memo(Ir);const Or=({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 ss=({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 rs=({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(P){v("ERROR"),a(P)}},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(Pe,{}),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(Cs.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,P,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(P),p(!u.length)},className:"remove-email-button",screenreaderText:k({id:"overlay_close"})})]},P)})]}),s.jsx(Pe,{}),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 Qr={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(Hs,{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:Qr[`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(ss,{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(Pe,{}),l,o&&s.jsxs("div",{className:"bottom",children:[s.jsx(Pe,{}),s.jsx(Ze,{buttons:o})]}),d&&s.jsx(ht,{className:"error",children:d})]})})})},as=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Hr=({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(rs,{title:r,label:c,ctaMessage:i,onClose:a,sendInvites:o,reportError:l})});const Ur=()=>{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,{})]})},os=({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(Ns.ErrorBoundary,{onError:r,fallback:s.jsx(Ur,{}),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(Kn,{})]})})})},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"},Wr={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 zr=({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=Wr.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 Vr=({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(Jn,{...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 R,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"?((R=e.slugs)==null?void 0:R.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 zs(1e3),a.callback&&await a.callback(w),ut=setTimeout(()=>{h(""),k("submitted"),P()},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),P()}},P=()=>{ut=setTimeout(()=>{g(!1),k(!1)},5e3)},A=!m||!Zs(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(Ds,{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}}),Yr={showThread:!1,showForm:!1},et=_.createContext(Yr),is=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(et.Provider,{value:{...t,updateConversation:n},children:e})},Gr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Jr=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ve=!1;const Lt=()=>{Ve!==!1&&(clearTimeout(Ve),Ve=!1)},It=5,cs=({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(()=>Jr(n,It),[n]),x=P=>{if(P.preventDefault(),P.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 P=h?u-1:u+1;P<0&&(P=0),v(!0),m(P),p(!h);try{if(i&&i.slugs){const A=Gr(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(Ln,{isOpen:k,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[j.map(P=>typeof P=="string"||!P.name?null:s.jsx("li",{children:s.jsx(qe,{href:P.id?`/profiles/${P.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:A=>A==null?void 0:A.stopPropagation(),children:P.name})},P.id||window.btoa(P.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_",Xr=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}),[P,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:R,canLike:Y,createdAt:b,id:Z,likes:y=0,userLiked:w,comments:z=0}=t,J=v?Ie(x.body,Xr):x.body,ne=S&&S.id&&typeof R!="string"&&R.id&&R.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`,...as(`delete-${t.slug}-modal`,P)}),_.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:R,additionalContent:{createdAt:b,didEdit:x.didEdit},className:typeof R!="string"&&R.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:On}},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(cs,{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(Xn,{element:"li",id:`more-${t.slug}`,options:ce})]})]}),g,s.jsx(nn,{id:`delete-${t.slug}-modal`,isOpen:P,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_",Zr=({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 ls=({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})]})},qr=({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}),Kr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:a})=>{if(!n)return;const l=qr({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})}}),ea=({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})}}),ta=({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]})}}),na=({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]})}}),sa=({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]})}}),ra=({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=Kr({queryClient:h,queryKey:[e,t],user:p,mutationFn:c}),{mutate:x}=W.useMutation(j),C=ea({queryClient:h,queryKey:[e,t],mutationFn:async w=>await i(w)}),{mutate:P}=W.useMutation(C),A=ta({queryClient:h,queryKey:[e,t],mutationFn:async({activityId:w})=>await d({activityId:w})}),{mutate:V}=W.useMutation(A),D=na({queryClient:h,queryKey:[e,t],mutationFn:a}),{mutate:R}=W.useMutation(D),Y=sa({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})=>R({activityId:w}),[R]),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)=>P({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(Pe,{})]},w==null?void 0:w.id)}))]})},aa=({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})}}),oa=({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)}}),ia=({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)}}),ca=({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}}}),la=({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}}}),ua=({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})}}),da=({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}}}),ma=({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}}}),fa=({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}}}),ha=({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}}}),pa=({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=ua({queryClient:g,queryKey:[e,t,r],mutationFn:async y=>d({replyId:n,content:y.body})}),{mutate:j}=W.useMutation(S),x=da({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:C}=W.useMutation(x),P=ma({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:y})=>l({replyId:y})}),{mutate:A}=W.useMutation(P),V=fa({queryClient:g,queryKey:[e,t,r],mutationFn:m}),{mutate:D}=W.useMutation(V),R=ha({queryClient:g,queryKey:[e,t,r],user:v,mutationFn:h}),{mutate:Y}=W.useMutation(R),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(ls,{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)}))]})})},us=({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=aa({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>i({activityId:n,content:b.body})}),{mutate:k}=W.useMutation(v),S=oa({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:j}=W.useMutation(S),x=ia({queryClient:p,queryKey:[e,t,n],mutationFn:async({replyId:b})=>a({replyId:b})}),{mutate:C}=W.useMutation(x),P=ca({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:A}=W.useMutation(P),V=la({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:o}),{mutate:D}=W.useMutation(V),R=_.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(is,{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:()=>R({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(pa,{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)}))]})},ga=({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})}}),_a=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),xa=({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})}}),ba=({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 va=({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:P}=W.useQuery({queryKey:[e,t,n],queryFn:c}),A=ga({queryClient:j,queryKey:[e,t,n],mutationFn:async ee=>await i(ee)}),{mutate:V}=W.useMutation(A),D=_a({queryClient:j,queryKey:[e,t,n],mutationFn:async({activityId:ee})=>d({activityId:ee}),redirectUrl:`${e}/${t}`}),{mutate:R}=W.useMutation(D),Y=xa({queryClient:j,queryKey:[e,t,n],mutationFn:a}),{mutate:b}=W.useMutation(Y),Z=ba({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||P)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:()=>R({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(us,{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)},wa=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:c}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:c}}),ka=({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"}},ja=({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"},ya=e=>{let t=e;return Object.keys(En).includes(e)&&(t=En[e]),`url(${Ye}icons/${t}.svg)`};const Ea={title:66,text:3e3,secondaryText:1e3,partner:25},Sa=({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,P={...Ea,...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":ya(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,P.partner)}),["title","text","secondaryText"].map(D=>{const R=m[D];if(!R)return null;const Y=Us(D);return s.jsx("p",{className:Y,"data-testid":Y,children:Ie(R,P[D])},D)}),s.jsx(ka,{type:k||"",data:m}),s.jsx(ja,{data:m,cta:r,link:C||"",gtmContext:c})]}))})};const $a=({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(Sa,{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_",Ma=()=>{const e=T.useIntl(),t=[];return Sn.forEach((n,r)=>{n.title=e.formatMessage({id:`${dt}post_${r+1}`}),t.push("solutionArticle")}),s.jsxs(os,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:s.jsxs(bt,{children:[s.jsx($a,{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=ra;exports.ActivitySection=va;exports.AddPost=wt;exports.BannerSection=rr;exports.Breadcrumbs=Er;exports.Button=Q;exports.ButtonWrapper=Ze;exports.CacheProvider=zn;exports.CollapsibleSection=Gt;exports.Columns=qn;exports.CommunityDetails=yr;exports.Contributors=Xt;exports.ConversationContext=et;exports.CookieBanner=Kn;exports.DiscussionConversation=is;exports.DiscussionForm=sn;exports.DiscussionLikes=cs;exports.DiscussionPost=tt;exports.DiscussionThread=ls;exports.Divider=Pe;exports.DownloadSection=er;exports.EMAILS=Fe;exports.EmailHelperTextBox=Fr;exports.EmptyStateBox=Ke;exports.Filters=Sr;exports.FlagsProvider=Vn;exports.Footer=Kt;exports.FullWidthSection=bt;exports.GlobalProviders=jr;exports.Header=en;exports.HelperTextBox=Bn;exports.HiddenFromScreenReaders=zt;exports.HideShowTextBox=ir;exports.HighlightedTextBox=Me;exports.IntlProvider=Yn;exports.InviteForm=rs;exports.InviteModal=Hr;exports.JoinButton=Zt;exports.LanguageSwitcher=Mr;exports.Link=qe;exports.LoadMore=Jn;exports.LoadingBlock=_r;exports.LoadingPlaceholder=we;exports.LoadingState=xr;exports.Logo=qt;exports.LogoSection=tr;exports.MarkdownText=Ut;exports.MarketingBox=ar;exports.Member=vt;exports.MembersList=Vr;exports.Modal=tn;exports.MoreMenu=Xn;exports.NUMBER_OF_USERS=or;exports.NavigationMenu=Zn;exports.NotFoundError=Ma;exports.Overlay=nn;exports.PageHeading=Qn;exports.PageLayout=os;exports.PasswordRules=Br;exports.Pill=Ge;exports.ProfilePicture=Be;exports.ProgressBar=Hn;exports.Rating=Or;exports.RepliesFeed=us;exports.ResponsesHeading=Zr;exports.ResponsiveImage=Yt;exports.SearchForm=ss;exports.ShareLinks=Pr;exports.Span=On;exports.StatusBanner=ht;exports.Tags=zr;exports.Tooltip=Ln;exports.TopLevelPage=Ar;exports.UserContext=ke;exports.UserProvider=Gn;exports.VisuallyHidden=ue;exports.addAriaProps=as;exports.getMember=Jt;exports.headerData=Je;exports.mapGetStreamData=wa;exports.useCurrentPath=Cn;exports.useEffectAfterMount=De;exports.useElementWidth=Xe;exports.useScrollListener=Dn;exports.useScrollToHash=Qs;
|