@apolitical/component-library 1.15.5-beta.0 → 1.16.0-4186.44
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/communities/members-list/members-list.d.ts +6 -7
- package/context/user/index.d.ts +1 -0
- package/context/user/user.context.d.ts +1 -1
- package/context/user/user.hook.d.ts +1 -0
- package/context/user/user.provider.d.ts +1 -1
- package/discussion/feeds/activities-feed/activities-feed.d.ts +6 -20
- package/discussion/feeds/activities-feed/cache/handlers/error.handler.d.ts +2 -0
- package/discussion/feeds/activities-feed/cache/handlers/index.d.ts +2 -0
- package/discussion/feeds/activities-feed/cache/handlers/mutate.handler.d.ts +2 -0
- package/discussion/feeds/activities-feed/cache/helpers/activity.helper.d.ts +14 -0
- package/discussion/feeds/activities-feed/cache/helpers/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/create/create.hook.d.ts +6 -0
- package/discussion/feeds/activities-feed/cache/hooks/create/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/edit/edit.hook.d.ts +7 -0
- package/discussion/feeds/activities-feed/cache/hooks/edit/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/feed/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/index.d.ts +7 -0
- package/discussion/feeds/activities-feed/cache/hooks/like/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/like/like.hook.d.ts +7 -0
- package/discussion/feeds/activities-feed/cache/hooks/list/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/list/list.hook.d.ts +7 -0
- package/discussion/feeds/activities-feed/cache/hooks/remove/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/remove/remove.hook.d.ts +6 -0
- package/discussion/feeds/activities-feed/cache/hooks/unlike/index.d.ts +1 -0
- package/discussion/feeds/activities-feed/cache/hooks/unlike/unlike.hook.d.ts +7 -0
- package/discussion/feeds/activities-feed/cache/index.d.ts +3 -0
- package/discussion/feeds/activities-feed/cache/interfaces/cache.interface.d.ts +4 -0
- package/discussion/feeds/activities-feed/cache/interfaces/handler.interface.d.ts +4 -0
- package/discussion/feeds/activities-feed/cache/interfaces/index.d.ts +4 -0
- package/discussion/feeds/activities-feed/cache/interfaces/mutation.interface.d.ts +12 -0
- package/discussion/feeds/activities-feed/cache/interfaces/query.interface.d.ts +9 -0
- package/discussion/feeds/replies-feed/replies-feed.handlers.d.ts +1 -1
- package/discussion/feeds/replies-to-replies-feed/replies-to-replies-feed.handlers.d.ts +1 -1
- package/discussion/sections/activity-section/activity-section.handlers.d.ts +1 -1
- package/index.d.ts +0 -1
- package/index.js +15 -15
- package/index.mjs +2689 -2847
- package/package.json +1 -1
- package/style.css +1 -1
- package/discussion/feeds/activities-feed/activities-feed.handlers.d.ts +0 -72
- package/discussion/feeds/activities-feed/activities-feed.helpers.d.ts +0 -23
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Rs=require("lodash.clonedeep"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Rs=require("lodash.clonedeep"),Ds=require("lodash.set"),M=require("react-intl"),Le=require("truncate"),xt=require("markdown-to-jsx"),z=require("@tanstack/react-query"),Fs=require("@tanstack/react-query-devtools"),mt=require("posthog-js"),Tn=require("react-cookie"),As=require("react-multi-email"),Mn=require("lodash.get"),Is=require("react-error-boundary"),Ls=require("react-textarea-autosize"),Bs=require("lodash.isequal");function Os(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cn={exports:{}};/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],i=0;i<arguments.length;i++){var c=arguments[i];if(c){var
|
|
5
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],i=0;i<arguments.length;i++){var c=arguments[i];if(c){var l=typeof c;if(l==="string"||l==="number")r.push(c);else if(Array.isArray(c)){if(c.length){var a=n.apply(null,c);a&&r.push(a)}}else if(l==="object"){if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]")){r.push(c.toString());continue}for(var d in c)t.call(c,d)&&c[d]&&r.push(d)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Cn);var Hs=Cn.exports;const S=Os(Hs),Qs=({element:e="span",showOnFocus:t=!0,children:n,...r})=>_.createElement(e,{...r,className:S("hidden",{"show-on-focus":t}),children:n}),re=_.memo(Qs),Us=({element:e="span",children:t=null,...n})=>_.createElement(e,{...n,"aria-hidden":!0},t),zt=_.memo(Us);var Ot={exports:{}},Qe={};/**
|
|
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
|
|
13
|
+
*/var gn;function Ws(){if(gn)return Qe;gn=1;var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(a,d,o){var m,u={},p=null,h=null;o!==void 0&&(p=""+o),d.key!==void 0&&(p=""+d.key),d.ref!==void 0&&(h=d.ref);for(m in d)r.call(d,m)&&!c.hasOwnProperty(m)&&(u[m]=d[m]);if(a&&a.defaultProps)for(m in d=a.defaultProps,d)u[m]===void 0&&(u[m]=d[m]);return{$$typeof:t,type:a,key:p,ref:h,props:u,_owner:i.current}}return Qe.Fragment=n,Qe.jsx=l,Qe.jsxs=l,Qe}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
|
|
22
|
-
`+
|
|
23
|
-
`),
|
|
24
|
-
`),
|
|
25
|
-
`+
|
|
21
|
+
*/var _n;function zs(){return _n||(_n=1,process.env.NODE_ENV!=="production"&&function(){var e=_,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),a=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,w="@@iterator";function x(f){if(f===null||typeof f!="object")return null;var y=g&&f[g]||f[w];return typeof y=="function"?y:null}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(f){{for(var y=arguments.length,$=new Array(y>1?y-1:0),C=1;C<y;C++)$[C-1]=arguments[C];b("error",f,$)}}function b(f,y,$){{var C=E.ReactDebugCurrentFrame,O=C.getStackAddendum();O!==""&&(y+="%s",$=$.concat([O]));var W=$.map(function(I){return String(I)});W.unshift("Warning: "+y),Function.prototype.apply.call(console[f],console,W)}}var T=!1,N=!1,D=!1,P=!1,L=!1,H;H=Symbol.for("react.module.reference");function F(f){return!!(typeof f=="string"||typeof f=="function"||f===r||f===c||L||f===i||f===o||f===m||P||f===h||T||N||D||typeof f=="object"&&f!==null&&(f.$$typeof===p||f.$$typeof===u||f.$$typeof===l||f.$$typeof===a||f.$$typeof===d||f.$$typeof===H||f.getModuleId!==void 0))}function v(f,y,$){var C=f.displayName;if(C)return C;var O=y.displayName||y.name||"";return O!==""?$+"("+O+")":$}function V(f){return f.displayName||"Context"}function j(f){if(f==null)return null;if(typeof f.tag=="number"&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case r:return"Fragment";case n:return"Portal";case c:return"Profiler";case i:return"StrictMode";case o:return"Suspense";case m:return"SuspenseList"}if(typeof f=="object")switch(f.$$typeof){case a:var y=f;return V(y)+".Consumer";case l:var $=f;return V($._context)+".Provider";case d:return v(f,f.render,"ForwardRef");case u:var C=f.displayName||null;return C!==null?C:j(f.type)||"Memo";case p:{var O=f,W=O._payload,I=O._init;try{return j(I(W))}catch{return null}}}return null}var A=Object.assign,G=0,J,ae,Y,te,oe,ie,me;function B(){}B.__reactDisabledLog=!0;function ce(){{if(G===0){J=console.log,ae=console.info,Y=console.warn,te=console.error,oe=console.group,ie=console.groupCollapsed,me=console.groupEnd;var f={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:f,log:f,warn:f,error:f,group:f,groupCollapsed:f,groupEnd:f})}G++}}function he(){{if(G--,G===0){var f={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},f,{value:J}),info:A({},f,{value:ae}),warn:A({},f,{value:Y}),error:A({},f,{value:te}),group:A({},f,{value:oe}),groupCollapsed:A({},f,{value:ie}),groupEnd:A({},f,{value:me})})}G<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var le=E.ReactCurrentDispatcher,xe;function pe(f,y,$){{if(xe===void 0)try{throw Error()}catch(O){var C=O.stack.trim().match(/\n( *(at )?)/);xe=C&&C[1]||""}return`
|
|
22
|
+
`+xe+f}}var be=!1,ge;{var X=typeof WeakMap=="function"?WeakMap:Map;ge=new X}function ne(f,y){if(!f||be)return"";{var $=ge.get(f);if($!==void 0)return $}var C;be=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=le.current,le.current=null,ce();try{if(y){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){C=Ee}Reflect.construct(f,[],I)}else{try{I.call()}catch(Ee){C=Ee}f.call(I.prototype)}}else{try{throw Error()}catch(Ee){C=Ee}f()}}catch(Ee){if(Ee&&C&&typeof Ee.stack=="string"){for(var R=Ee.stack.split(`
|
|
23
|
+
`),de=C.stack.split(`
|
|
24
|
+
`),q=R.length-1,ee=de.length-1;q>=1&&ee>=0&&R[q]!==de[ee];)ee--;for(;q>=1&&ee>=0;q--,ee--)if(R[q]!==de[ee]){if(q!==1||ee!==1)do if(q--,ee--,ee<0||R[q]!==de[ee]){var ve=`
|
|
25
|
+
`+R[q].replace(" at new "," at ");return f.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",f.displayName)),typeof f=="function"&&ge.set(f,ve),ve}while(q>=1&&ee>=0);break}}}finally{be=!1,le.current=W,he(),Error.prepareStackTrace=O}var Fe=f?f.displayName||f.name:"",pn=Fe?pe(Fe):"";return typeof f=="function"&&ge.set(f,pn),pn}function ue(f,y,$){return ne(f,!1)}function Z(f){var y=f.prototype;return!!(y&&y.isReactComponent)}function se(f,y,$){if(f==null)return"";if(typeof f=="function")return ne(f,Z(f));if(typeof f=="string")return pe(f);switch(f){case o:return pe("Suspense");case m:return pe("SuspenseList")}if(typeof f=="object")switch(f.$$typeof){case d:return ue(f.render);case u:return se(f.type,y,$);case p:{var C=f,O=C._payload,W=C._init;try{return se(W(O),y,$)}catch{}}}return""}var _e=Object.prototype.hasOwnProperty,Me={},Oe=E.ReactDebugCurrentFrame;function Ce(f){if(f){var y=f._owner,$=se(f.type,f._source,y?y.type:null);Oe.setExtraStackFrame($)}else Oe.setExtraStackFrame(null)}function nt(f,y,$,C,O){{var W=Function.call.bind(_e);for(var I in f)if(W(f,I)){var R=void 0;try{if(typeof f[I]!="function"){var de=Error((C||"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 de.name="Invariant Violation",de}R=f[I](y,I,C,$,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(q){R=q}R&&!(R instanceof Error)&&(Ce(O),k("%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).",C||"React class",$,I,typeof R),Ce(null)),R instanceof Error&&!(R.message in Me)&&(Me[R.message]=!0,Ce(O),k("Failed %s type: %s",$,R.message),Ce(null))}}}var K=Array.isArray;function ke(f){return K(f)}function Ne(f){{var y=typeof Symbol=="function"&&Symbol.toStringTag,$=y&&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 k("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 He=E.ReactCurrentOwner,_s={key:!0,ref:!0,__self:!0,__source:!0},on,cn,kt;kt={};function xs(f){if(_e.call(f,"ref")){var y=Object.getOwnPropertyDescriptor(f,"ref").get;if(y&&y.isReactWarning)return!1}return f.ref!==void 0}function bs(f){if(_e.call(f,"key")){var y=Object.getOwnPropertyDescriptor(f,"key").get;if(y&&y.isReactWarning)return!1}return f.key!==void 0}function vs(f,y){if(typeof f.ref=="string"&&He.current&&y&&He.current.stateNode!==y){var $=j(He.current.type);kt[$]||(k('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',j(He.current.type),f.ref),kt[$]=!0)}}function ws(f,y){{var $=function(){on||(on=!0,k("%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)",y))};$.isReactWarning=!0,Object.defineProperty(f,"key",{get:$,configurable:!0})}}function ks(f,y){{var $=function(){cn||(cn=!0,k("%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)",y))};$.isReactWarning=!0,Object.defineProperty(f,"ref",{get:$,configurable:!0})}}var js=function(f,y,$,C,O,W,I){var R={$$typeof:t,type:f,key:y,ref:$,props:I,_owner:W};return R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(R,"_self",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.defineProperty(R,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R};function ys(f,y,$,C,O){{var W,I={},R=null,de=null;$!==void 0&&(an($),R=""+$),bs(y)&&(an(y.key),R=""+y.key),xs(y)&&(de=y.ref,vs(y,O));for(W in y)_e.call(y,W)&&!_s.hasOwnProperty(W)&&(I[W]=y[W]);if(f&&f.defaultProps){var q=f.defaultProps;for(W in q)I[W]===void 0&&(I[W]=q[W])}if(R||de){var ee=typeof f=="function"?f.displayName||f.name||"Unknown":f;R&&ws(I,ee),de&&ks(I,ee)}return js(f,R,de,O,C,He.current,I)}}var jt=E.ReactCurrentOwner,ln=E.ReactDebugCurrentFrame;function De(f){if(f){var y=f._owner,$=se(f.type,f._source,y?y.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=j(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 Es(f){{if(f!==void 0){var y=f.fileName.replace(/^.*[\\\/]/,""),$=f.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+
|
|
29
|
+
Check your code at `+y+":"+$+"."}return""}}var dn={};function Ss(f){{var y=un();if(!y){var $=typeof f=="string"?f:f.displayName||f.name;$&&(y=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+T+">.")}return E}}function gn(f,E){{if(!f._store||f._store.validated||f.key!=null)return;f._store.validated=!0;var T=Ts(E);if(pn[T])return;pn[T]=!0;var P="";f&&f._owner&&f._owner!==yt.current&&(P=" It was passed a child from "+y(f._owner.type)+"."),Ae(f),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',T,P),Ae(null)}}function _n(f,E){{if(typeof f!="object")return;if(je(f))for(var T=0;T<f.length;T++){var P=f[T];St(P)&&gn(P,E)}else if(St(f))f._store&&(f._store.validated=!0);else if(f){var Q=v(f);if(typeof Q=="function"&&Q!==f.entries)for(var W=Q.call(f),B;!(B=W.next()).done;)St(B.value)&&gn(B.value,E)}}}function Ms(f){{var E=f.type;if(E==null||typeof E=="string")return;var T;if(typeof E=="function")T=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===u||E.$$typeof===l))T=E.propTypes;else return;if(T){var P=y(E);nt(T,f.props,"prop",P,f)}else if(E.PropTypes!==void 0&&!Et){Et=!0;var Q=y(E);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Q||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Cs(f){{for(var E=Object.keys(f.props),T=0;T<E.length;T++){var P=E[T];if(P!=="children"&&P!=="key"){Ae(f),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",P),Ae(null);break}}f.ref!==null&&(Ae(f),k("Invalid attribute `ref` supplied to `React.Fragment`."),Ae(null))}}function xn(f,E,T,P,Q,W){{var B=D(f);if(!B){var I="";(f===void 0||typeof f=="object"&&f!==null&&Object.keys(f).length===0)&&(I+=" 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=$s(Q);_e?I+=_e:I+=hn();var Z;f===null?Z="null":je(f)?Z="array":f!==void 0&&f.$$typeof===t?(Z="<"+(y(f.type)||"Unknown")+" />",I=" Did you accidentally export a JSX literal instead of a component?"):Z=typeof f,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Z,I)}var te=Ss(f,E,T,Q,W);if(te==null)return te;if(B){var we=E.children;if(we!==void 0)if(P)if(je(we)){for(var Re=0;Re<we.length;Re++)_n(we[Re],f);Object.freeze&&Object.freeze(we)}else k("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 _n(we,f)}return f===r?Cs(te):Ms(te),te}}function Ns(f,E,T){return xn(f,E,T,!0)}function Ds(f,E,T){return xn(f,E,T,!1)}var Ps=Ds,As=Ns;We.Fragment=r,We.jsx=Ps,We.jsxs=As}()),We}process.env.NODE_ENV==="production"?Ht.exports=Vs():Ht.exports=Ys();var s=Ht.exports;const Rn=()=>{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},Pe=(e,t)=>{const n=_.useRef(!1);_.useEffect(()=>{n.current?e():n.current=!0},t)};function Gs(e,t,n){var r=this,i=_.useRef(null),c=_.useRef(0),d=_.useRef(null),a=_.useRef([]),u=_.useRef(),o=_.useRef(),m=_.useRef(e),l=_.useRef(!0);m.current=e;var h=typeof window<"u",p=!t&&t!==0&&h;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,w=!("trailing"in n)||!!n.trailing,v="maxWait"in n,S="debounceOnServer"in n&&!!n.debounceOnServer,k=v?Math.max(+n.maxWait||0,t):null;_.useEffect(function(){return l.current=!0,function(){l.current=!1}},[]);var x=_.useMemo(function(){var M=function(D){var b=a.current,G=u.current;return a.current=u.current=null,c.current=D,o.current=m.current.apply(G,b)},A=function(D,b){p&&cancelAnimationFrame(d.current),d.current=p?requestAnimationFrame(D):setTimeout(D,b)},R=function(D){if(!l.current)return!1;var b=D-i.current;return!i.current||b>=t||b<0||v&&D-c.current>=k},Y=function(D){return d.current=null,w&&a.current?M(D):(a.current=u.current=null,o.current)},F=function D(){var b=Date.now();if(R(b))return Y(b);if(l.current){var G=t-(b-i.current),y=v?Math.min(G,k-(b-c.current)):G;A(D,y)}},C=function(){if(h||S){var D=Date.now(),b=R(D);if(a.current=[].slice.call(arguments),u.current=r,i.current=D,b){if(!d.current&&l.current)return c.current=i.current,A(F,t),g?M(i.current):o.current;if(v)return A(F,t),M(i.current)}return d.current||A(F,t),o.current}};return C.cancel=function(){d.current&&(p?cancelAnimationFrame(d.current):clearTimeout(d.current)),c.current=0,a.current=i.current=u.current=d.current=null},C.isPending=function(){return!!d.current},C.flush=function(){return d.current?Y(Date.now()):o.current},C},[g,v,t,k,w,p,h,S]);return x}function Fn(e,t,n){var r=n===void 0?{}:n,i=r.leading,c=r.trailing;return Gs(e,t,{maxWait:t,leading:i===void 0||i,trailing:c===void 0||c})}let $t;const Be=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,i]=_.useState(0)||[!1,()=>{}],c=n==="window"?[]:[n];_.useEffect(()=>(a(),window.addEventListener("resize",u),()=>{clearTimeout($t),u.flush(),window.removeEventListener("resize",u)}),c);const d=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},a=()=>{i(d())},u=Fn(()=>{d()!==r&&(t&&(clearTimeout($t),document.body.classList.add("is-resizing"),$t=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),a())},500,{leading:!0});return r},In=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,c]=_.useState({current:0,past:0})||[!1,()=>{}],[d,a]=_.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];_.useEffect(()=>(u(),window.addEventListener("scroll",o),()=>{o.flush(),window.removeEventListener("scroll",o)}),[]);const u=()=>{const m=window.scrollY,l=i.current,h=m-l,p=h>0?"down":"up";if(c({current:m,past:l}),p==="down"){m>=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=Fn(()=>{u()},250);return i},Ln=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=_.useRef(!1);Pe(()=>{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)},Bn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},On=(e,t,n)=>{let r=n.mobile;for(const i in t){const c=parseInt(String(t[i]));if(e>=c)r=n[c];else if(e<c)break}return r},Js=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Xs=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Qn=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Ut=e=>{let c;const d=kn(),a=kn(new Date(e));try{c=d.getTime()-a.getTime()}catch{return""}const u=c/36e5,o=Math.floor(c/864e5);if(o<1)return u<1?{path:"now"}:{path:"hours",number:Math.floor(u)};if(o<7)return{path:"days",number:o};const m=Math.floor(o/7);return m<=52?{path:"weeks",number:m}:{path:"years",number:Math.floor(o/365)}},kn=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Gt={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 y}}function mn(f,y){{if(!f._store||f._store.validated||f.key!=null)return;f._store.validated=!0;var $=Ss(y);if(dn[$])return;dn[$]=!0;var C="";f&&f._owner&&f._owner!==jt.current&&(C=" It was passed a child from "+j(f._owner.type)+"."),De(f),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',$,C),De(null)}}function fn(f,y){{if(typeof f!="object")return;if(ke(f))for(var $=0;$<f.length;$++){var C=f[$];Et(C)&&mn(C,y)}else if(Et(f))f._store&&(f._store.validated=!0);else if(f){var O=x(f);if(typeof O=="function"&&O!==f.entries)for(var W=O.call(f),I;!(I=W.next()).done;)Et(I.value)&&mn(I.value,y)}}}function $s(f){{var y=f.type;if(y==null||typeof y=="string")return;var $;if(typeof y=="function")$=y.propTypes;else if(typeof y=="object"&&(y.$$typeof===d||y.$$typeof===u))$=y.propTypes;else return;if($){var C=j(y);nt($,f.props,"prop",C,f)}else if(y.PropTypes!==void 0&&!yt){yt=!0;var O=j(y);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof y.getDefaultProps=="function"&&!y.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ts(f){{for(var y=Object.keys(f.props),$=0;$<y.length;$++){var C=y[$];if(C!=="children"&&C!=="key"){De(f),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",C),De(null);break}}f.ref!==null&&(De(f),k("Invalid attribute `ref` supplied to `React.Fragment`."),De(null))}}function hn(f,y,$,C,O,W){{var I=F(f);if(!I){var R="";(f===void 0||typeof f=="object"&&f!==null&&Object.keys(f).length===0)&&(R+=" 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 de=Es(O);de?R+=de:R+=un();var q;f===null?q="null":ke(f)?q="array":f!==void 0&&f.$$typeof===t?(q="<"+(j(f.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):q=typeof f,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,R)}var ee=ys(f,y,$,O,W);if(ee==null)return ee;if(I){var ve=y.children;if(ve!==void 0)if(C)if(ke(ve)){for(var Fe=0;Fe<ve.length;Fe++)fn(ve[Fe],f);Object.freeze&&Object.freeze(ve)}else k("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?Ts(ee):$s(ee),ee}}function Ms(f,y,$){return hn(f,y,$,!0)}function Cs(f,y,$){return hn(f,y,$,!1)}var Ns=Cs,Ps=Ms;Ue.Fragment=r,Ue.jsx=Ns,Ue.jsxs=Ps}()),Ue}process.env.NODE_ENV==="production"?Ot.exports=Ws():Ot.exports=zs();var s=Ot.exports;const Nn=()=>{const[e,t]=_.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return _.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Pe=(e,t)=>{const n=_.useRef(!1);_.useEffect(()=>{n.current?e():n.current=!0},t)};function Vs(e,t,n){var r=this,i=_.useRef(null),c=_.useRef(0),l=_.useRef(null),a=_.useRef([]),d=_.useRef(),o=_.useRef(),m=_.useRef(e),u=_.useRef(!0);m.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,w=!("trailing"in n)||!!n.trailing,x="maxWait"in n,E="debounceOnServer"in n&&!!n.debounceOnServer,k=x?Math.max(+n.maxWait||0,t):null;_.useEffect(function(){return u.current=!0,function(){u.current=!1}},[]);var b=_.useMemo(function(){var T=function(F){var v=a.current,V=d.current;return a.current=d.current=null,c.current=F,o.current=m.current.apply(V,v)},N=function(F,v){h&&cancelAnimationFrame(l.current),l.current=h?requestAnimationFrame(F):setTimeout(F,v)},D=function(F){if(!u.current)return!1;var v=F-i.current;return!i.current||v>=t||v<0||x&&F-c.current>=k},P=function(F){return l.current=null,w&&a.current?T(F):(a.current=d.current=null,o.current)},L=function F(){var v=Date.now();if(D(v))return P(v);if(u.current){var V=t-(v-i.current),j=x?Math.min(V,k-(v-c.current)):V;N(F,j)}},H=function(){if(p||E){var F=Date.now(),v=D(F);if(a.current=[].slice.call(arguments),d.current=r,i.current=F,v){if(!l.current&&u.current)return c.current=i.current,N(L,t),g?T(i.current):o.current;if(x)return N(L,t),T(i.current)}return l.current||N(L,t),o.current}};return H.cancel=function(){l.current&&(h?cancelAnimationFrame(l.current):clearTimeout(l.current)),c.current=0,a.current=i.current=d.current=l.current=null},H.isPending=function(){return!!l.current},H.flush=function(){return l.current?P(Date.now()):o.current},H},[g,x,t,k,w,h,p,E]);return b}function Pn(e,t,n){var r=n===void 0?{}:n,i=r.leading,c=r.trailing;return Vs(e,t,{maxWait:t,leading:i===void 0||i,trailing:c===void 0||c})}let St;const qe=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,i]=_.useState(0)||[!1,()=>{}],c=n==="window"?[]:[n];_.useEffect(()=>(a(),window.addEventListener("resize",d),()=>{clearTimeout(St),d.flush(),window.removeEventListener("resize",d)}),c);const l=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},a=()=>{i(l())},d=Pn(()=>{l()!==r&&(t&&(clearTimeout(St),document.body.classList.add("is-resizing"),St=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),a())},500,{leading:!0});return r},Rn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,c]=_.useState({current:0,past:0})||[!1,()=>{}],[l,a]=_.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];_.useEffect(()=>(d(),window.addEventListener("scroll",o),()=>{o.flush(),window.removeEventListener("scroll",o)}),[]);const d=()=>{const m=window.scrollY,u=i.current,p=m-u,h=p>0?"down":"up";if(c({current:m,past:u}),h==="down"){m>=e+t.down&&!l.scrollDown&&(!l.scrollUp||p>t.up)&&(n(),a({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!l.scrollUp&&(r(),a({scrollUp:!0,scrollDown:!1}))},o=Pn(()=>{d()},250);return i},Dn=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=_.useRef(!1);Pe(()=>{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)},Fn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},An=(e,t,n)=>{let r=n.mobile;for(const i in t){const c=parseInt(String(t[i]));if(e>=c)r=n[c];else if(e<c)break}return r},Ys=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Gs=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),In=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Ht=e=>{let c;const l=xn(),a=xn(new Date(e));try{c=l.getTime()-a.getTime()}catch{return""}const d=c/36e5,o=Math.floor(c/864e5);if(o<1)return d<1?{path:"now"}:{path:"hours",number:Math.floor(d)};if(o<7)return{path:"days",number:o};const m=Math.floor(o/7);return m<=52?{path:"weeks",number:m}:{path:"years",number:Math.floor(o/365)}},xn=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Vt={apolitical:"Apolitical",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",card_carousel_viewAll:"View all",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_registered:"Registered",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_cta_people:"View profile",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",collapsibleSection_summary:"Find out more",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",activitySection_notFoundError:"Post not found",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
|
-
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Type your {action} here...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",filters_all:"Show all",filters_disabled:"{name} - no results",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_profile:"My profile",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",overlay_close:"Close",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",progressBar:"{number}% loaded",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tags_community:"From the community",tooltip_loading:"Loading..."},Zs={languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},qs={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>"},Ks={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>"},er=Object.freeze(Object.defineProperty({__proto__:null,en:Gt,es:Zs,fr:qs,pt:Ks},Symbol.toStringTag,{value:"Module"})),Hn=e=>e in Gt,ye=(e,t,n,r,i={})=>{let c="";return Hn(`${t}_${n}`)?c=e({id:`${t}_${n}`},i):c=e({id:t},{[r]:n,...i}),c},tr=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let i=n.length-1;i>=0;i--){const c=Math.pow(10,(i+1)*3);if(c<=e){e=Math.round(e*t/c)/t,e===1e3&&i<n.length-1&&(e=1,i++),r=`${e}${n[i]}`;break}}return r},Un=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},nr=e=>e.replace(/\s+/g,"").length>0,sr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Rs(e);return t.forEach(({type:r,value:i})=>{Fs(n,r,i)}),n},rr=e=>new Promise(t=>setTimeout(t,e)),ht=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),H=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:c="button",onClick:d=!1,className:a="",disabled:u=!1,screenreaderText:o=!1,children:m=!1,...l})=>{const p=Be(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const v=Object.assign({},t),S=Bn(Object.keys(v));t=On(p,S,v)}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 w={...l,className:$(e,a,g,{"no-text":!m,disabled:u,button:i}),onClick:v=>{(!i||i[0]==="#")&&d&&(v.preventDefault(),v.stopPropagation()),d&&d(v)},disabled:typeof u=="object"&&"isClickable"in u?!u.isClickable:u};return i&&(c="a",w.href=i),_.createElement(c,w,m||(o?s.jsx(le,{showOnFocus:!1,children:o}):null))},Ze=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",i=e.map((c,d)=>r==="p"?s.jsx(H,{...c},d):s.jsx("li",{children:s.jsx(H,{...c})},d));return _.createElement(r,{className:$("button-wrapper",t),...n,children:i})};const Me=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:$(e,{"has-max-width":t}),style:n})},qe=({href:e,children:t,fallbackElement:n,className:r="",onClick:i,gtmContext:c,gtmType:d,...a})=>{if(e){const u={...a};return i&&(u.onClick=i),c&&(u["data-gtm-event-context"]=c),d&&(u["data-gtm-event-type"]=d),s.jsx("a",{href:e,className:$("gtm-trackable",r),...u,children:t})}return n?_.createElement(n,{children:t,className:r,...a}):t},jn={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"}},ar=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:i}=e?jn[e]:jn.fallback;return{range:t&&t.length>0?t:r,sizes:n||i}},or=({format:e,height:t,query:n,width:r})=>{let i=`w=${r}&h=${t}`;return i=e?`${i}&fm=${e}`:i,i=n?`${i}&${n}`:i,i},Tt=({format:e,range:t,url:n,query:r})=>t.map(({height:i,width:c})=>`${n}?${or({format:e,height:i,query:r,width:c})} ${c}w`).join(", ");const Jt=({image:e,className:t,testId:n})=>{const{description:r,height:i,type:c,query:d,url:a,width:u,loading:o,decoding:m,fetchPriority:l}=e,{range:h,sizes:p}=ar(e),g=Tt({format:"avif",query:d,range:h,url:a}),w=Tt({format:"webp",query:d,range:h,url:a}),v=Tt({format:"",query:d,range:h,url:a});return s.jsxs("picture",{className:t,children:[c!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:w,sizes:p,"data-testid":"source"}),s.jsx("img",{srcSet:v,sizes:p,src:a,alt:r,loading:o||"lazy",decoding:m||"async",fetchpriority:l||"auto",width:u,height:i,"data-testid":n||"image"})]})};let ze=!1;const Wn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=N.useIntl(),i=_.useRef(null),[c,d]=_.useState("hidden");_.useEffect(()=>{const u=i.current;if(u)return u.addEventListener("transitionend",a),()=>{u.removeEventListener("transitionend",a)}},[]);const a=({propertyName:u})=>{u==="opacity"&&(ze!==!1&&clearTimeout(ze),d(o=>o==="opening"?"open":o==="closing"?"closed":o==="closed"?"hidden":o))};return Pe(()=>{ze!==!1&&clearTimeout(ze);let u="open";e?d("opening"):(d("closing"),u="hidden"),ze=setTimeout(()=>{d(u)},300)},[e]),s.jsx("aside",{ref:i,className:$("tooltip text-medium",c,{loading:t}),hidden:c==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const vt=({children:e,className:t="",...n})=>s.jsx("section",{className:$("full-width-section",t),...n,children:e});const ir=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),s.jsx(vt,{className:$("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 lr=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const i={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:$("logos",n),children:[e&&_.createElement(i.element,{className:"title"},i.text),s.jsx("ul",{className:$({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:c,nameOfBusiness:d,link:a=!1,description:u=!1},o)=>{if(!c||!c.url)return null;const m=s.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt: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:m}):m}),u&&s.jsx("small",{children:u})]},window.btoa(`${c.url}_${o}`))})})]})};const cr=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],ur=({className:e="",content:t,image:n,variant:r="default",spacing:i="normal",hideElements:c={eyebrow:!1,title:!1,text:!1},cta:d,children:a})=>{const u=["eyebrow","title","text"],o={eyebrow:"small",title:"h1",text:"p"},m={};return u.forEach(l=>{if(!t[l]){m[l]=!1;return}if(!c[l]){if(typeof t[l]=="object"){m[l]=t[l];const{text:h,element:p}=t[l];if(p&&cr.includes(p.toLowerCase()))return;m[l]={text:h,element:o[l]};return}m[l]={text:t[l],element:o[l]}}}),d&&d.link&&d.link[0]==="#"&&(d.props||(d.props={}),d.props.onClick=l=>{l.preventDefault(),l.stopPropagation();const h=document.getElementById(d.link.substring(1));h&&h.scrollIntoView({behavior:"smooth"})}),s.jsx(vt,{className:$("banner-section",r,i,e,{"has-image":n,"has-extra-spacing":i==="normal"&&m.eyebrow&&m.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[u.map(l=>{if(m[l]&&typeof m[l]=="object"){const{text:h,element:p=""}=m[l];return _.createElement(p.toLowerCase(),{key:l,className:l},h)}return null}),a,d&&d.text&&d.link&&s.jsx(H,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:d.link,...d.props,children:d.text})]}),n&&s.jsx(Jt,{image:{...n,aspect:"banner"}})]})})},dr=_.memo(ur);const mr=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:s.jsxs("aside",{className:$("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(H,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),zn=({showDevTools:e=!0,children:t})=>{const n=new z.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(z.QueryClientProvider,{client:n,children:[t,e&&s.jsx(Is.ReactQueryDevtools,{initialIsOpen:!1})]})};var fr=_.createContext({client:ft});function hr(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,c=_.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(ft.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ft.init(r,i)),ft)},[n,r]);return _.createElement(fr.Provider,{value:{client:c}},t)}const Vn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(hr,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",ui_host:"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",i={...er[r],...n||{}};return s.jsx(N.IntlProvider,{locale:r,messages:i,children:e})},ke=_.createContext(null),Gn=({children:e,user:t})=>s.jsx(ke.Provider,{value:t,children:e}),pr=({bootstrap:e,children:t,intl:n})=>{const[r,i]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Un(5e3)}).catch(()=>i({isLoading:!1}))},[]),s.jsx(Yn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Dn.CookiesProvider,{children:s.jsx(Gn,{user:r,children:s.jsx(zn,{children:s.jsx(Vn,{user:r,children:t})})})})})},Ge="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"}},gr="200,000+";const Xt=({label:e=!1,className:t="",children:n})=>{const r=N.useIntl();return s.jsxs("details",{className:$("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const Te=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:$("highlighted-text-box",e,t),...r,children:n});const Ke=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const c=typeof n=="object"&&"breakpoints"in n,d=Be(c);if(c&&typeof n=="object"&&typeof d=="number"){const l=Object.assign({},n.breakpoints),h=Bn(Object.keys(l));i=On(d,h,l)}const{breakpoints:a,text:u="",component:o,...m}=n;return s.jsx(Te,{variant:"subtle",className:$("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(bt,{options:{forceBlock:!0},children:t}),i&&typeof n=="object"&&(o||s.jsx(H,{...m,variant:n.variant?n.variant:"secondary",children:u}))]})})};const Wt=({children:e,...t})=>s.jsx("p",{...t,children:e}),Jn={q:Wt,blockquote:Wt};for(let e=1;e<=6;e++)Jn[`h${e}`]={component:Wt,props:{className:"title"}};const Xn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:$("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(bt,{options:{wrapper:_.Fragment,forceBlock:!0,overrides:Jn},children:r}):s.jsx("p",{children:r})]});const _r=({className:e="",show:t=!1,hide:n=!1,text:r,children:i})=>{const c=N.useIntl(),d=_.useRef(null),[a,u]=_.useState(""),[o,m]=_.useState("closed");_.useEffect(()=>{const p=d.current;if(p)return p.addEventListener("transitionend",l),()=>{p.removeEventListener("transitionend",l)}},[]),_.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
|
|
36
|
-
`);
|
|
37
|
-
`))},[r]),_.useEffect(()=>{o==="ready-to-close"&&m("closing")},[o]);const l=({propertyName:p})=>{p==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)};if(!r)return null;const h=["opening","open"].includes(o);return s.jsxs(Te,{variant:"subtle",className:$("hide-show-text-box",e),children:[s.jsxs("div",{ref:d,className:$("content",o),children:[s.jsx(bt,{options:{forceBlock:!0},children:o==="closed"?a:r}),o!=="closed"&&i]}),s.jsx("p",{className:"cta",children:s.jsx(H,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:$({"rotate-180":h}),onClick:()=>{m(h?"ready-to-close":"opening")},children:h?n||c.formatMessage({id:"hideShowTextBox_hide"}):t||c.formatMessage({id:"hideShowTextBox_show"})})})]})},xr=()=>_.Fragment,br=({children:e})=>s.jsx(Te,{variant:"secondary",children:e}),vr=["span","strong","h1","h2","h3","h4","h5","h6","p"],wr=({children:e})=>{const t=N.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const c of _.Children.toArray(e))if(!(!c||typeof c=="string"||typeof c=="number"))if(_.isValidElement(c)&&c.type==="summary"){if(c.props&&c.props.children){for(const d of _.Children.toArray(c.props.children))if(!(!d||typeof d=="string"||typeof d=="number")&&_.isValidElement(d)){const a=d.type;if(vr.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(c);const i=n?n.toString():"";return s.jsx(Xt,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(c=>c)})},kr=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(Te,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(Te,{variant:"primary",children:e});case"pink-textbox":return s.jsx(Te,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},jr=e=>{const t=N.useIntl(),n=Date.now().toString();let r="default";const i=e.src;return i.includes("youtube")||i.includes("vimeo")?r="video":i.includes("riddle")||i.includes("sli.do")?r="poll":i.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(le,{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})]})},yn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},yr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,i=!1;for(const c of _.Children.toArray(e))if(!(!c||typeof c=="string"||typeof c=="number")&&_.isValidElement(c)){const d=c.type;if(["button","center","span","strong"].includes(d)&&c.props&&c.props.children&&c.props.children[0])for((d==="button"||yn(c.props.children[0])==="button")&&(i=!0),r=c.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!_.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&yn(r)==="button"&&(i=!0);else break}return i?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(H,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},Zn=({children:e})=>s.jsx("span",{children:e});const zt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:_.Fragment,forceBlock:!0,overrides:{a:yr,CollapsibleSection:Xt,TextBox:Te,CaseStudy:br,style:xr,details:wr,div:kr,iframe:jr}};return s.jsx("div",{className:$("markdown-text",e),children:s.jsx(bt,{options:{...r,...t},children:n})})};const qn=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:i=""})=>{const c=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:$("page-heading",i),children:[s.jsxs("div",{className:$("content",{"has-max-width":e}),style:c,children:[t&&t.text&&_.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&_.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Je=({size:e="medium",variant:t="default",className:n="",children:r,...i})=>s.jsx("span",{className:$("pill",e,t,n),...i,children:r});const pt=({element:e="p",children:t=null,className:n="",...r})=>_.createElement(e,{...r,className:$("status-banner text-small",n),"aria-live":"assertive"},t);const Er=({progress:e=0,text:t=!1,className:n=""})=>{const r=N.useIntl(),i=e>75?100:e>50?75:e>25?50:e>5?25:0,c={"--progress":`${e}%`};return s.jsx("span",{className:$(`progress-bar section-${i}`,n),style:c,children:s.jsx(le,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},Kn=_.memo(Er);const Mt="loadingBlock_",Sr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=N.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 i=null;const c=Object.keys(t);for(let a=0;a<c.length&&!(e<parseInt(c[a]));a++)i=c[a];const d=i&&t[i].icon?{"--icon":`url(${Ge}icons/${t[i].icon}.svg)`}:{};return s.jsxs(Te,{className:$("loading-block",n,{"has-icon":i&&t[i].icon}),variant:"subtle",style:d,children:[i&&s.jsx("span",{className:"step",children:t[i].text}),s.jsx(Kn,{progress:e})]})},$r=_.memo(Sr);const ve=({element:e="div",className:t="",...n})=>s.jsx(Yt,{element:e,className:$("loading-placeholder",t),...n});const Vt={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"]},es=(e,t)=>e in Vt?s.jsx("div",{className:e,children:Vt[e].map((n,r)=>es(n,r))},t):s.jsx(ve,{className:e},t),Zt=({layout:e="overview-page",...t})=>s.jsx("div",{className:$("loading-state",e),...t,children:Vt[e].map((n,r)=>es(n,r))}),ts=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"],Tr=e=>{const t=Math.ceil(26/at.length),n=ts(e).toLowerCase();if(n==="")return at[0];const r=n.charCodeAt(0)-96;for(let i=0;i<at.length;i++)if(r<=t*(i+1))return at[i]};const En=256,Oe=({className:e="",src:t="",name:n,alt:r,width:i=En,height:c=En,...d})=>{const[a,u]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{const l=o.current;if(!l)return;const h=l.getContext("2d");if(!h)return;const p=i,g=c;typeof window<"u"&&window.devicePixelRatio&&(l.width=p*window.devicePixelRatio,l.height=g*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=Tr(n),h.fillRect(0,0,p,g),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(ts(n),p/2,g/1.6)},[n]);let m=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(m=!0),s.jsx("figure",{className:$("profile-picture",e,{error:a}),...d,children:m?s.jsx("img",{src:t,alt:r||n,onError:()=>{u(!0)},width:i,height:c}):s.jsx("canvas",{ref:o})})},qt=e=>e==="apolitical"?{image:`${Ge}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ge}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},Mr=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const i=e!=="",c=t!=="",d=n!=="";if(!i&&!c&&!d)return"";const a=`${e}${i&&c?` — ${t}`:t}`;let u=`${a}${(i||c)&&d?`, ${n}`:n}`;return u.length>r&&(u=a),u.length>r&&(u=Le(u,r)),u};const wt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:i="member-click",className:c=""})=>{const d=N.useIntl(),a=qt(t);a.name||(a.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:u,url:o,image:m}=a,l=Mr(a),h=n&&n.createdAt?Ut(n.createdAt):!1,p=n&&n.createdAt?Qn(n.createdAt):"";return _.createElement(e,{className:$("member text-medium",c),children:s.jsxs(qe,{href:o,gtmType:i,gtmContext:r,onClick:g=>{g==null||g.stopPropagation()},children:[s.jsx(Oe,{name:u,src:m}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:u}),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"})})]}),l&&s.jsx("small",{children:l})]})]})})};const Sn={small:24,medium:48},Kt=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:c,showPlaceholders:d}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:u="",...o})=>{const m=N.useIntl();return!n||n.length===0?null:_.createElement(e,{...o,className:$("contributors",u,i,{"has-gap":c}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((l,h)=>{let p,g="";if(h<a){const{name:w="",image:v=""}=qt(l);if(d)return s.jsx(ve,{element:"li",className:"contributor"},h);p=s.jsx(Oe,{name:w,src:v,width:Sn[i||"medium"],height:Sn[i||"medium"]})}else if(h===a){const w=(t||n.length)-a;p=s.jsxs("small",{className:$({"large-number":w>99}),children:["+",tr(w,0)]}),g="number-left"}return p?s.jsx("li",{className:$("contributor",g),children:p},h):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Le(n[0].name||"",20):null})]})})},Cr=({type:e,data:t})=>{const n=N.useIntl(),{answers:r,createdAt:i,dateHasPassed:c,isOngoingEvent:d,pill:a,readingTime:u,publishedDate:o,startDate:m}=t;if(e==="question"){const l=i&&Ut(i);return s.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&s.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:l?n.formatMessage({id:`dates_${l.path}`},{number:l.number}):0})]})]})}if(m&&!c||d)return s.jsx("p",{className:"details",children:d?n.formatMessage({id:"card_bootcamp"}):Qn(m)});if(a)return s.jsx(Je,{variant:a==="free"?"subtle":"highlighted",className:a,"data-testid":"course-type",children:a});if(u||o){const l=o&&Ut(o);return s.jsxs("ul",{className:"details",children:[u&&s.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:u})}),o&&s.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:l?n.formatMessage({id:`dates_${l.path}`},{number:l.number}):0})})]})}return null},gt={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"}},Nr=({data:e,cta:t,link:n,gtmContext:r})=>{var g;const i=N.useIntl(),[c,d]=_.useState({loading:!1,registered:e.registered||!1});_.useEffect(()=>{e.registered&&d(w=>({...w,registered:!0}))},[e.registered]);const{startDate:a,dateHasPassed:u,pill:o,slug:m}=e,l=e.contentType;let h="";if((g=gt[l])!=null&&g.gtmEvent&&(h=gt[l].gtmEvent),a&&u)return s.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:i.formatMessage({id:"card_watch"})});if(l==="people")return s.jsx(H,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:i.formatMessage({id:"card_cta_people"})});const p=["microcourse","event"];if(t&&t.onClick&&p.includes(l)&&o!=="premium"){const w=c.loading||c.registered,v=async S=>{if(S.preventDefault(),S.stopPropagation(),!(w||!t||!t.onClick)){d(k=>({...k,loading:!0}));try{const k=await t.onClick(e);d(k==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{d(x=>({...x,loading:!1}))}}};return s.jsx(H,{onClick:v,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:w,"data-gtm-event-context":`${r}Page-${l}: ${m}`,"data-gtm-event-type":`${r}-${l}-register-click`,"data-testid":"in-card-button",children:i.formatMessage({id:`card_cta_${l}${w?`_${c.loading?"loading":"done"}`:""}`})})}return null},$n={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Dr=e=>{let t=e;return Object.keys($n).includes(e)&&(t=$n[e]),`url(${Ge}icons/${t}.svg)`};const Pr={title:66,text:3e3,secondaryText:1e3,partner:25},en=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:i="Carousel",className:c=""})=>{const d=N.useIntl(),a=_.useContext(ke),u=a&&typeof a.id=="string",[o,m]=_.useState({data:null,isLoading:!0}),{data:l,isLoading:h}=o,p=_.useCallback(()=>{n(t,u).then(F=>{m(()=>({data:F,isLoading:!1}))}).catch(()=>m(F=>({...F,isLoading:!1})))},[e]);if(_.useEffect(()=>{p()},[]),h||!l)return s.jsx(ve,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:g}=l;if(!g||!gt[g])return s.jsx(ve,{element:"li",className:"card-wrapper"});const{basePath:w="",className:v,length:S,gtmEvent:k}=gt[g],x=Hn(`card_label_${g}`)?d.formatMessage({id:`card_label_${g}`}):!1,M=l.slug?`${w}${l.slug}`:!1,A={...Pr,...S};let R={className:"card"};M&&(R={href:M,className:"card gtm-trackable","data-gtm-event-context":`${i}-CarouselCard`,"data-gtm-event-type":`${k}-click`,"data-testid":"link"},l.openInNewTab&&(R.target="_blank"));const Y=l.customIcon?{"--custom-icon":Dr(l.customIcon)}:{};return s.jsx("li",{className:$("card-wrapper text-medium",v,c,{"has-link":M,"no-link":!M,"has-custom-icon":l.customIcon,"has-image":l.banner}),style:Y,"data-testid":`${g}-card`,children:_.createElement(M?"a":"div",R,s.jsxs(s.Fragment,{children:[(l.customLabel||x)&&s.jsx("small",{className:$("card-label text-small",v),children:l.customLabel||x}),l.startDate&&!l.isOngoingEvent&&s.jsx(Je,{size:"small",variant:l.dateHasPassed?"default":"information","data-testid":"date",children:l.dateHasPassed?d.formatMessage({id:"card_ended"}):Xs(l.startDate)}),l.banner?s.jsxs("p",{className:"img",children:[l.registered&&s.jsx(Je,{size:"small",variant:"registered",children:d.formatMessage({id:"card_registered"})}),s.jsx(Jt,{image:l.banner})]}):v==="people"?s.jsx(Oe,{name:l.title||"",src:l.profile,"data-testid":"people-profile-picture"}):null,l.contributors&&s.jsx(Kt,{contributors:{data:l.contributors},styling:{size:"small",showGap:v!=="question",showText:!0},"data-testid":"contributors"}),l.partner&&s.jsx("p",{className:"partners","data-testid":"partners",children:Le(l.partner.title,A.partner)}),["title","text","secondaryText"].map(F=>{const C=l[F];if(!C)return null;const D=Js(F);return s.jsx("p",{className:D,"data-testid":D,children:Le(C,A[F])},F)}),s.jsx(Cr,{type:v||"",data:l}),s.jsx(Nr,{data:l,cta:r,link:M||"",gtmContext:i})]}))})};const ns=({cards:e,cardTypes:t,className:n="",...r})=>s.jsx("ul",{className:$("card-block",n),children:e.map((i,c)=>{const d=i.slug?`${i.slug}-${t[c]}`:`${t[c]}-${c}`;return s.jsx(en,{id:d,card:{...i,contentType:t[c]},...r},d)})}),Ar=(e,t,n,r)=>{const i=t*n<=e,c=e<t*(n+1),d=r.includes(Math.floor(e/t));return i&&c||d},Rr=({id:e,title:t})=>{const n=N.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:c="default",size:d="medium",link:a}=t;return _.createElement(i,{className:$("title",c,d,{"highlighted-title":c==="highlighted"}),children:s.jsxs(s.Fragment,{children:[r,a&&s.jsx("a",{href:a,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Ct={fourCards:1024,threeCards:769,twoCards:480};let ot=null;const Fr=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:c,gtmContext:d})=>{var F;const a=N.useIntl(),[u,o]=_.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:l}=u,[h,p]=_.useState({currentPage:0,loadedPages:[0]}),{currentPage:g,loadedPages:w}=h,v=t.length,S=Math.ceil(v/m),k=_.useRef(null),x=Be(!0,!0,k==null?void 0:k.current);_.useEffect(()=>{let C=1;x&&(x>=Ct.fourCards?C=4:x>=Ct.threeCards?C=3:x>=Ct.twoCards&&(C=2),C>v&&(C=v)),o(D=>({...D,cardsPerPage:C,isLoading:!1}))},[x,v]);const M=(C="next")=>{let D=g;if(typeof C=="string")if(C==="next")if(g<S-1)D=g+1;else return;else if(g>0)D=g-1;else return;else D=C;p(b=>({...b,currentPage:D,loadedPages:[...new Set([...w,D])]}))},A=C=>{ot=C.touches[0].clientX},R=C=>{if(ot===null)return;const D=C.touches[0].clientX,b=ot-D;b>5?M("next"):b<-5&&M("previous"),ot=null},Y={"--width":`${((F=k==null?void 0:k.current)==null?void 0:F.offsetWidth)||0}px`,"--total-cards":v,"--cards-per-page":m,"--page":g};return l?s.jsx(Zt,{layout:`carousel${i?"-with-title":""}`}):s.jsxs("section",{ref:k,className:$("carousel-wrapper",c),"data-testid":"carousel",children:[s.jsx(Rr,{id:e,title:i}),s.jsx("ul",{className:"carousel",onTouchStart:A,onTouchMove:R,style:Y,"data-testid":"carousel-list",children:t.map((C,D)=>{let b=C&&C.sys&&C.sys.id?`${e}-card-${C.sys.id}`:null;return b&&Ar(D,m,g,w)?s.jsx(en,{id:b,card:{...C,contentType:n[D]},buildCardData:r,gtmContext:d},b):(b=b||`${e}-card-${D}`,s.jsx(ve,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},b))})}),S<=1?null:s.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[s.jsx("li",{className:"arrow previous",children:s.jsx(H,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:C=>{C.preventDefault(),C.stopPropagation(),M("previous")},screenreaderText:a.formatMessage({id:"carousel_pagination_previous"}),disabled:g<=0})}),[...Array(S)].map((C,D)=>s.jsx("li",{"data-testid":"carousel-controls-button",children:s.jsx("button",{className:$("page-indicator",{selected:D===g}),onClick:b=>{b.preventDefault(),b.stopPropagation(),M(D)},children:s.jsx(le,{showOnFocus:!1,children:a.formatMessage({id:"carousel_pagination_page"},{number:D+1,total:S})})})},`page-indicator-${D}`)),s.jsx("li",{className:"arrow next",children:s.jsx(H,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:C=>{C.preventDefault(),C.stopPropagation(),M("next")},screenreaderText:a.formatMessage({id:"carousel_pagination_next"}),disabled:g>=S-1})})]})]})},Ir=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:c,viewAllUrl:d,cards:a,cardsTypes:u},o)=>{const m=c?window.btoa(c):`carousel-${o}`,l=o===e.length-1;return t?s.jsxs(_.Fragment,{children:[s.jsx(Zt,{layout:`carousel${c?"-with-title":""}`,"data-testid":"carousel-placeholder"}),l?null:s.jsx(Me,{})]},`placeholder-${m}`):s.jsxs(_.Fragment,{children:[s.jsx(Fr,{cards:a,cardTypes:u,title:{...n,text:c,link:d},...i}),l?null:s.jsx(Me,{})]},`carousel-${m}`)});const Nt="joinCommunityButton",tn=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const i=N.useIntl(),c=_.useContext(ke),d=c&&typeof c.id=="string",[a,u]=_.useState(e),[o,m]=_.useState(e?"joined":"notJoined");_.useEffect(()=>{o==="joining"?m("joined"):o==="leaving"&&m("notJoined")},[a]);const l={},h={};return a&&o!=="leaving"&&(l["data-hover-text"]=i.formatMessage({id:`${Nt}_leave`}),l["aria-label"]=i.formatMessage({id:`${Nt}_member_aria`}),h["aria-hidden"]="true"),s.jsx(H,{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?(m("leaving"),typeof r=="function"&&await r()):(m("joining"),typeof n=="function"&&await n()),u(!a))},className:$("join-community-button",o,{active:o==="joining"}),disabled:!d,...l,children:s.jsx("span",{className:"text",...h,children:i.formatMessage({id:`${Nt}${["joining","leaving"].includes(o)?`_${o}`:a?"_member":t?"_short":""}`})})})};const Dt="communityDetails_",Lr=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:i=[]}={number:0,data:[]},functions:{invite:c,...d}})=>{const a=N.useIntl(),u=5,o=r||i.length,m=i.length?i:Array(u).fill({});return s.jsxs("div",{className:$("community-details",e),children:[s.jsx(Me,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[a.formatMessage({id:`${Dt}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:`${Dt}viewAll`})})})]}),s.jsx(Kt,{contributors:{total:r,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:o===0},cutoff:u})]}),s.jsx(tn,{isMember:t,functions:{...d}}),t&&s.jsx(H,{variant:"primary",onClick:c,icon:{icon:"plus"},styling:{fullWidth:!0},children:a.formatMessage({id:`${Dt}invite`})})]})};const Br=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=N.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(le,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:$("breadcrumbs text-small",n),children:e.map(({text:i,href:c,current:d=!1},a)=>s.jsxs("li",{children:[d&&s.jsx(le,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(qe,{href:d?void 0:c,children:Le(i,t)})]},`${window.btoa(i)}_${a}`))})]})};const Or=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:i=""})=>{const c=N.useIntl(),d=t?[{id:"all",text:typeof t!="boolean"&&t.text||c.formatMessage({id:"filters_all"})},...e]:e,[a,u]=_.useState(t?["all"]:[]),o=(m,l)=>{let h=[];a.includes(m)?h=a.filter(p=>p!==m):m==="all"?h=["all"]:n?h=[...a.filter(p=>p!=="all"),m]:h=[m],u(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),l&&typeof l=="function"&&l()};return s.jsx("ul",{className:$("filters",i),children:d.map(({id:m,text:l,disabled:h=!1,callback:p=()=>{}})=>{let g={};return h&&(g={disabled:!0,"aria-label":c.formatMessage({id:"filters_disabled"},{name:l})}),s.jsx("li",{children:s.jsx("button",{className:$(m,{selected:a.includes(m)}),onClick:w=>{w.preventDefault(),w.stopPropagation(),o(m,p)},...g,children:l})},m)})})},Qr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:i,position:c})=>{c==="before-lang"?r+=`/${i}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${i}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Pt={en:"English",es:"Español",fr:"Français",pt:"Português"},it="languageSwitcher_",Hr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i=()=>{},urlParts:c,variant:d="default",label:a,className:u=""})=>{const o=N.useIntl(),[m,l]=_.useState(e);if(_.useEffect(()=>{e!==m&&l(e)},[e]),!r||!Object.values(r).some(w=>w&&w.post_name))return null;const p=Object.keys(r),g=m!==e;return s.jsxs("div",{className:$("language-switcher text-small",d,u),children:[s.jsxs("nav",{children:[d!=="short"&&s.jsx("p",{children:a||o.formatMessage({id:`${it}label`})}),s.jsx("ul",{children:p.map(w=>{if(!Pt[w])return null;let v={className:w};return m===w?v["aria-label"]=o.formatMessage({id:`${it}selected`},{language:Pt[w]}):v={...v,href:Qr(w,c),onClick:S=>{S.preventDefault(),S.stopPropagation(),l(w),i(w)}},s.jsx("li",{children:s.jsx(qe,{...v,fallbackElement:"span",children:Pt[w]})},w)})}),d!=="short"&&!g&&s.jsx("p",{children:o.formatMessage({id:`${it}translation_${t?"original":n?"human":"machine"}`})})]}),d!=="short"&&!g&&!t&&!n&&s.jsx("small",{children:o.formatMessage({id:`${it}disclaimer`},{email:Fe.support,link:w=>{const v=`mailto:${w}`;return s.jsx("a",{href:v,children:w})}})})]})};const At=N.createIntl({locale:"en",messages:Gt}),ss=({hasNextPage:e,loadNextPage:t,icon:n=!1,messages:r={button:At.formatMessage({id:"loadMore_button"}),endOfFeed:At.formatMessage({id:"loadMore_endOfFeed"}),error:At.formatMessage({id:"loadMore_error"})},className:i="",gtmContext:c="LoadMore"})=>{const[d,a]=_.useState(!1),[u,o]=_.useState(e),m=async l=>{try{await t(l)}catch(h){h instanceof Error&&h.message&&h.message.includes("Cannot read items")?o(!1):a(!0)}};return s.jsxs("footer",{className:$("load-more",i),children:[d&&s.jsx("p",{className:"error",children:r.error}),u?s.jsx(H,{variant:"secondary",icon:n,onClick:m,"data-gtm-event-context":c,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:r.button}):s.jsx("p",{children:r.endOfFeed})]})};const nn=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:$("logo",e,t,n),...r,children:s.jsx(le,{children:s.jsx(N.FormattedMessage,{id:"apolitical"})})})});let lt=!1;const rs=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=N.useIntl(),c=_.useRef(null),[d,a]=_.useState(!1),u=o=>{c.current&&o.target instanceof HTMLElement&&!c.current.contains(o.target)&&a(!1)};return _.useEffect(()=>(document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)})),_.createElement(e,{ref:c,className:$("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!d),"aria-haspopup":"true","aria-expanded":d,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!d,children:n.map(({href:o,onClick:m,text:l,icon:h,...p},g)=>{const w={...p,onClick:v=>{a(!1),typeof m=="function"&&m(v)},onFocus:()=>{lt&&(clearTimeout(lt),lt=!1)},onBlur:()=>{lt=setTimeout(()=>{a(!1)},100)}};return o&&(w.href=o),s.jsx("li",{children:s.jsx(H,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...w,children:l})},`${window.btoa(l)}_${g}`)})})]})})},Ur=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Wr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],as=({activeLink:e})=>{const t=N.useIntl(),n=_.useContext(ke),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Wr.map(({key:i,href:c})=>s.jsx("li",{className:$(i,{active:Ur(c,e)}),children:s.jsx("a",{href:c,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${i}`})})},i)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Oe,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},Ve=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,zr=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Ve(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(`${Ve(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(`${Ve(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
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..."},Js={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>"},qs={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>"},Xs={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>"},Zs=Object.freeze(Object.defineProperty({__proto__:null,en:Vt,es:Js,fr:qs,pt:Xs},Symbol.toStringTag,{value:"Module"})),Ln=e=>e in Vt,ye=(e,t,n,r,i={})=>{let c="";return Ln(`${t}_${n}`)?c=e({id:`${t}_${n}`},i):c=e({id:t},{[r]:n,...i}),c},Ks=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let i=n.length-1;i>=0;i--){const c=Math.pow(10,(i+1)*3);if(c<=e){e=Math.round(e*t/c)/t,e===1e3&&i<n.length-1&&(e=1,i++),r=`${e}${n[i]}`;break}}return r},Bn=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},er=e=>e.replace(/\s+/g,"").length>0,tr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Rs(e);return t.forEach(({type:r,value:i})=>{Ds(n,r,i)}),n},nr=e=>new Promise(t=>setTimeout(t,e)),ft=(e,t)=>_.Children.map(e,n=>_.cloneElement(n,{...t})),Q=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:c="button",onClick:l=!1,className:a="",disabled:d=!1,screenreaderText:o=!1,children:m=!1,...u})=>{const h=qe(typeof t=="object");if(typeof t=="object"&&typeof h=="number"){const x=Object.assign({},t),E=Fn(Object.keys(x));t=An(h,E,x)}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 w={...u,className:S(e,a,g,{"no-text":!m,disabled:d,button:i}),onClick:x=>{(!i||i[0]==="#")&&l&&(x.preventDefault(),x.stopPropagation()),l&&l(x)},disabled:typeof d=="object"&&"isClickable"in d?!d.isClickable:d};return i&&(c="a",w.href=i),_.createElement(c,w,m||(o?s.jsx(re,{showOnFocus:!1,children:o}):null))},Xe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",i=e.map((c,l)=>r==="p"?s.jsx(Q,{...c},l):s.jsx("li",{children:s.jsx(Q,{...c})},l));return _.createElement(r,{className:S("button-wrapper",t),...n,children:i})};const Re=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:S(e,{"has-max-width":t}),style:n})},Ze=({href:e,children:t,fallbackElement:n,className:r="",onClick:i,gtmContext:c,gtmType:l,...a})=>{if(e){const d={...a};return i&&(d.onClick=i),c&&(d["data-gtm-event-context"]=c),l&&(d["data-gtm-event-type"]=l),s.jsx("a",{href:e,className:S("gtm-trackable",r),...d,children:t})}return n?_.createElement(n,{children:t,className:r,...a}):t},bn={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},sr=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:i}=e?bn[e]:bn.fallback;return{range:t&&t.length>0?t:r,sizes:n||i}},rr=({format:e,height:t,query:n,width:r})=>{let i=`w=${r}&h=${t}`;return i=e?`${i}&fm=${e}`:i,i=n?`${i}&${n}`:i,i},$t=({format:e,range:t,url:n,query:r})=>t.map(({height:i,width:c})=>`${n}?${rr({format:e,height:i,query:r,width:c})} ${c}w`).join(", ");const Yt=({image:e,className:t,testId:n})=>{const{description:r,height:i,type:c,query:l,url:a,width:d,loading:o,decoding:m,fetchPriority:u}=e,{range:p,sizes:h}=sr(e),g=$t({format:"avif",query:l,range:p,url:a}),w=$t({format:"webp",query:l,range:p,url:a}),x=$t({format:"",query:l,range:p,url:a});return s.jsxs("picture",{className:t,children:[c!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:g,sizes:h,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:w,sizes:h,"data-testid":"source"}),s.jsx("img",{srcSet:x,sizes:h,src:a,alt:r,loading:o||"lazy",decoding:m||"async",fetchpriority:u||"auto",width:d,height:i,"data-testid":n||"image"})]})};let We=!1;const On=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=M.useIntl(),i=_.useRef(null),[c,l]=_.useState("hidden");_.useEffect(()=>{const d=i.current;if(d)return d.addEventListener("transitionend",a),()=>{d.removeEventListener("transitionend",a)}},[]);const a=({propertyName:d})=>{d==="opacity"&&(We!==!1&&clearTimeout(We),l(o=>o==="opening"?"open":o==="closing"?"closed":o==="closed"?"hidden":o))};return Pe(()=>{We!==!1&&clearTimeout(We);let d="open";e?l("opening"):(l("closing"),d="hidden"),We=setTimeout(()=>{l(d)},300)},[e]),s.jsx("aside",{ref:i,className:S("tooltip text-medium",c,{loading:t}),hidden:c==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const bt=({children:e,className:t="",...n})=>s.jsx("section",{className:S("full-width-section",t),...n,children:e});const ar=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),s.jsx(bt,{className:S("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(Xe,{buttons:r})]})})};const or=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const i={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:S("logos",n),children:[e&&_.createElement(i.element,{className:"title"},i.text),s.jsx("ul",{className:S({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:c,nameOfBusiness:l,link:a=!1,description:d=!1},o)=>{if(!c||!c.url)return null;const m=s.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:l});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:a?s.jsx("a",{href:a,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),d&&s.jsx("small",{children:d})]},window.btoa(`${c.url}_${o}`))})})]})};const ir=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],cr=({className:e="",content:t,image:n,variant:r="default",spacing:i="normal",hideElements:c={eyebrow:!1,title:!1,text:!1},cta:l,children:a})=>{const d=["eyebrow","title","text"],o={eyebrow:"small",title:"h1",text:"p"},m={};return d.forEach(u=>{if(!t[u]){m[u]=!1;return}if(!c[u]){if(typeof t[u]=="object"){m[u]=t[u];const{text:p,element:h}=t[u];if(h&&ir.includes(h.toLowerCase()))return;m[u]={text:p,element:o[u]};return}m[u]={text:t[u],element:o[u]}}}),l&&l.link&&l.link[0]==="#"&&(l.props||(l.props={}),l.props.onClick=u=>{u.preventDefault(),u.stopPropagation();const p=document.getElementById(l.link.substring(1));p&&p.scrollIntoView({behavior:"smooth"})}),s.jsx(bt,{className:S("banner-section",r,i,e,{"has-image":n,"has-extra-spacing":i==="normal"&&m.eyebrow&&m.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[d.map(u=>{if(m[u]&&typeof m[u]=="object"){const{text:p,element:h=""}=m[u];return _.createElement(h.toLowerCase(),{key:u,className:u},p)}return null}),a,l&&l.text&&l.link&&s.jsx(Q,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:l.link,...l.props,children:l.text})]}),n&&s.jsx(Yt,{image:{...n,aspect:"banner"}})]})})},lr=_.memo(cr);const ur=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:s.jsxs("aside",{className:S("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(Q,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Ye="https://storage.googleapis.com/apolitical-assets/",Ae={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},dr="200,000+";const Gt=({label:e=!1,className:t="",children:n})=>{const r=M.useIntl();return s.jsxs("details",{className:S("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const Te=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:S("highlighted-text-box",e,t),...r,children:n});const Ke=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const c=typeof n=="object"&&"breakpoints"in n,l=qe(c);if(c&&typeof n=="object"&&typeof l=="number"){const u=Object.assign({},n.breakpoints),p=Fn(Object.keys(u));i=An(l,p,u)}const{breakpoints:a,text:d="",component:o,...m}=n;return s.jsx(Te,{variant:"subtle",className:S("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(xt,{options:{forceBlock:!0},children:t}),i&&typeof n=="object"&&(o||s.jsx(Q,{...m,variant:n.variant?n.variant:"secondary",children:d}))]})})};const Qt=({children:e,...t})=>s.jsx("p",{...t,children:e}),Hn={q:Qt,blockquote:Qt};for(let e=1;e<=6;e++)Hn[`h${e}`]={component:Qt,props:{className:"title"}};const Qn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:S("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:Hn},children:r}):s.jsx("p",{children:r})]});const mr=({className:e="",show:t=!1,hide:n=!1,text:r,children:i})=>{const c=M.useIntl(),l=_.useRef(null),[a,d]=_.useState(""),[o,m]=_.useState("closed");_.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",u),()=>{h.removeEventListener("transitionend",u)}},[]),_.useEffect(()=>{if(!r||typeof r!="string")return;const h=r.split(`
|
|
36
|
+
`);d(h.length<3?`${r.substring(0,400)}...`:h.slice(0,3).join(`
|
|
37
|
+
`))},[r]),_.useEffect(()=>{o==="ready-to-close"&&m("closing")},[o]);const u=({propertyName:h})=>{h==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)};if(!r)return null;const p=["opening","open"].includes(o);return s.jsxs(Te,{variant:"subtle",className:S("hide-show-text-box",e),children:[s.jsxs("div",{ref:l,className:S("content",o),children:[s.jsx(xt,{options:{forceBlock:!0},children:o==="closed"?a:r}),o!=="closed"&&i]}),s.jsx("p",{className:"cta",children:s.jsx(Q,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:S({"rotate-180":p}),onClick:()=>{m(p?"ready-to-close":"opening")},children:p?n||c.formatMessage({id:"hideShowTextBox_hide"}):t||c.formatMessage({id:"hideShowTextBox_show"})})})]})},fr=()=>_.Fragment,hr=({children:e})=>s.jsx(Te,{variant:"secondary",children:e}),pr=["span","strong","h1","h2","h3","h4","h5","h6","p"],gr=({children:e})=>{const t=M.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const c of _.Children.toArray(e))if(!(!c||typeof c=="string"||typeof c=="number"))if(_.isValidElement(c)&&c.type==="summary"){if(c.props&&c.props.children){for(const l of _.Children.toArray(c.props.children))if(!(!l||typeof l=="string"||typeof l=="number")&&_.isValidElement(l)){const a=l.type;if(pr.includes(a)){for(n=l.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(c);const i=n?n.toString():"";return s.jsx(Gt,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(c=>c)})},_r=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(Te,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(Te,{variant:"primary",children:e});case"pink-textbox":return s.jsx(Te,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},xr=e=>{const t=M.useIntl(),n=Date.now().toString();let r="default";const i=e.src;return i.includes("youtube")||i.includes("vimeo")?r="video":i.includes("riddle")||i.includes("sli.do")?r="poll":i.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(re,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},vn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},br=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,i=!1;for(const c of _.Children.toArray(e))if(!(!c||typeof c=="string"||typeof c=="number")&&_.isValidElement(c)){const l=c.type;if(["button","center","span","strong"].includes(l)&&c.props&&c.props.children&&c.props.children[0])for((l==="button"||vn(c.props.children[0])==="button")&&(i=!0),r=c.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!_.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&vn(r)==="button"&&(i=!0);else break}return i?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(Q,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},Un=({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:br,CollapsibleSection:Gt,TextBox:Te,CaseStudy:hr,style:fr,details:gr,div:_r,iframe:xr}};return s.jsx("div",{className:S("markdown-text",e),children:s.jsx(xt,{options:{...r,...t},children:n})})};const Wn=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:i=""})=>{const c=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:S("page-heading",i),children:[s.jsxs("div",{className:S("content",{"has-max-width":e}),style:c,children:[t&&t.text&&_.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&_.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Ge=({size:e="medium",variant:t="default",className:n="",children:r,...i})=>s.jsx("span",{className:S("pill",e,t,n),...i,children:r});const ht=({element:e="p",children:t=null,className:n="",...r})=>_.createElement(e,{...r,className:S("status-banner text-small",n),"aria-live":"assertive"},t);const vr=({progress:e=0,text:t=!1,className:n=""})=>{const r=M.useIntl(),i=e>75?100:e>50?75:e>25?50:e>5?25:0,c={"--progress":`${e}%`};return s.jsx("span",{className:S(`progress-bar section-${i}`,n),style:c,children:s.jsx(re,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},zn=_.memo(vr);const Tt="loadingBlock_",wr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=M.useIntl();t||(t={0:{text:r.formatMessage({id:`${Tt}loading`})},75:{text:r.formatMessage({id:`${Tt}almostDone`})},100:{text:r.formatMessage({id:`${Tt}complete`})}});let i=null;const c=Object.keys(t);for(let a=0;a<c.length&&!(e<parseInt(c[a]));a++)i=c[a];const l=i&&t[i].icon?{"--icon":`url(${Ye}icons/${t[i].icon}.svg)`}:{};return s.jsxs(Te,{className:S("loading-block",n,{"has-icon":i&&t[i].icon}),variant:"subtle",style:l,children:[i&&s.jsx("span",{className:"step",children:t[i].text}),s.jsx(zn,{progress:e})]})},kr=_.memo(wr);const je=({element:e="div",className:t="",...n})=>s.jsx(zt,{element:e,className:S("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"]},Vn=(e,t)=>e in Wt?s.jsx("div",{className:e,children:Wt[e].map((n,r)=>Vn(n,r))},t):s.jsx(je,{className:e},t),jr=({layout:e="overview-page",...t})=>s.jsx("div",{className:S("loading-state",e),...t,children:Wt[e].map((n,r)=>Vn(n,r))}),Yn=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"],yr=e=>{const t=Math.ceil(26/at.length),n=Yn(e).toLowerCase();if(n==="")return at[0];const r=n.charCodeAt(0)-96;for(let i=0;i<at.length;i++)if(r<=t*(i+1))return at[i]};const wn=256,Be=({className:e="",src:t="",name:n,alt:r,width:i=wn,height:c=wn,...l})=>{const[a,d]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{const u=o.current;if(!u)return;const p=u.getContext("2d");if(!p)return;const h=i,g=c;typeof window<"u"&&window.devicePixelRatio&&(u.width=h*window.devicePixelRatio,u.height=g*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=yr(n),p.fillRect(0,0,h,g),p.font=`${h/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(Yn(n),h/2,g/1.6)},[n]);let m=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(m=!0),s.jsx("figure",{className:S("profile-picture",e,{error:a}),...l,children:m?s.jsx("img",{src:t,alt:r||n,onError:()=>{d(!0)},width:i,height:c}):s.jsx("canvas",{ref:o})})},Jt=e=>e==="apolitical"?{image:`${Ye}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ye}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Er=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const i=e!=="",c=t!=="",l=n!=="";if(!i&&!c&&!l)return"";const a=`${e}${i&&c?` — ${t}`:t}`;let d=`${a}${(i||c)&&l?`, ${n}`:n}`;return d.length>r&&(d=a),d.length>r&&(d=Le(d,r)),d};const vt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:i="member-click",className:c=""})=>{const l=M.useIntl(),a=Jt(t);a.name||(a.name=l.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:d,url:o,image:m}=a,u=Er(a),p=n&&n.createdAt?Ht(n.createdAt):!1,h=n&&n.createdAt?In(n.createdAt):"";return _.createElement(e,{className:S("member text-medium",c),children:s.jsxs(Ze,{href:o,gtmType:i,gtmContext:r,onClick:g=>{g==null||g.stopPropagation()},children:[s.jsx(Be,{name:d,src:m}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:d}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&p&&s.jsx("span",{className:"date",title:h,"aria-label":h,children:l.formatMessage({id:`dates_${p.path}`},{number:p.number})}),n.didEdit&&s.jsx("em",{children:l.formatMessage({id:"discussion_edited"})})]}),u&&s.jsx("small",{children:u})]})]})})};const kn={small:24,medium:48},qt=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:c,showPlaceholders:l}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:d="",...o})=>{const m=M.useIntl();return!n||n.length===0?null:_.createElement(e,{...o,className:S("contributors",d,i,{"has-gap":c}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((u,p)=>{let h,g="";if(p<a){const{name:w="",image:x=""}=Jt(u);if(l)return s.jsx(je,{element:"li",className:"contributor"},p);h=s.jsx(Be,{name:w,src:x,width:kn[i||"medium"],height:kn[i||"medium"]})}else if(p===a){const w=(t||n.length)-a;h=s.jsxs("small",{className:S({"large-number":w>99}),children:["+",Ks(w,0)]}),g="number-left"}return h?s.jsx("li",{className:S("contributor",g),children:h},p):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Le(n[0].name||"",20):null})]})})},Gn=({showDevTools:e=!0,children:t})=>{const n=new z.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(z.QueryClientProvider,{client:n,children:[t,e&&s.jsx(Fs.ReactQueryDevtools,{initialIsOpen:!1})]})};var Sr=_.createContext({client:mt});function $r(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,c=_.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(mt.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),mt.init(r,i)),mt)},[n,r]);return _.createElement(Sr.Provider,{value:{client:c}},t)}const Jn=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx($r,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",ui_host:"eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,qn=({children:e,locale:t,messages:n})=>{const r=t||"en",i={...Zs[r],...n||{}};return s.jsx(M.IntlProvider,{locale:r,messages:i,children:e})},we=_.createContext({isLoading:!0});function Xn(){return _.useContext(we)}const Zn=({children:e,user:t})=>s.jsx(we.Provider,{value:t,children:e}),Tr=({bootstrap:e,children:t,intl:n})=>{const[r,i]=_.useState({isLoading:!0});return _.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Bn(5e3)}).catch(()=>i({isLoading:!1}))},[]),s.jsx(qn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Tn.CookiesProvider,{children:s.jsx(Zn,{user:r,children:s.jsx(Gn,{children:s.jsx(Jn,{user:r,children:t})})})})})};const Mt="joinCommunityButton",Xt=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const i=M.useIntl(),c=_.useContext(we),l=c&&typeof c.id=="string",[a,d]=_.useState(e),[o,m]=_.useState(e?"joined":"notJoined");_.useEffect(()=>{o==="joining"?m("joined"):o==="leaving"&&m("notJoined")},[a]);const u={},p={};return a&&o!=="leaving"&&(u["data-hover-text"]=i.formatMessage({id:`${Mt}_leave`}),u["aria-label"]=i.formatMessage({id:`${Mt}_member_aria`}),p["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 h=>{l&&(h.currentTarget.blur(),a?(m("leaving"),typeof r=="function"&&await r()):(m("joining"),typeof n=="function"&&await n()),d(!a))},className:S("join-community-button",o,{active:o==="joining"}),disabled:!l,...u,children:s.jsx("span",{className:"text",...p,children:i.formatMessage({id:`${Mt}${["joining","leaving"].includes(o)?`_${o}`:a?"_member":t?"_short":""}`})})})};const Ct="communityDetails_",Mr=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:i=[]}={number:0,data:[]},functions:{invite:c,...l}})=>{const a=M.useIntl(),d=5,o=r||i.length,m=i.length?i:Array(d).fill({});return s.jsxs("div",{className:S("community-details",e),children:[s.jsx(Re,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[a.formatMessage({id:`${Ct}members`}),s.jsx("span",{className:"count",children:o})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${n}/members`,children:a.formatMessage({id:`${Ct}viewAll`})})})]}),s.jsx(qt,{contributors:{total:r,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:o===0},cutoff:d})]}),s.jsx(Xt,{isMember:t,functions:{...l}}),t&&s.jsx(Q,{variant:"primary",onClick:c,icon:{icon:"plus"},styling:{fullWidth:!0},children:a.formatMessage({id:`${Ct}invite`})})]})};const Cr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(re,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:S("breadcrumbs text-small",n),children:e.map(({text:i,href:c,current:l=!1},a)=>s.jsxs("li",{children:[l&&s.jsx(re,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Ze,{href:l?void 0:c,children:Le(i,t)})]},`${window.btoa(i)}_${a}`))})]})};const Nr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:i=""})=>{const c=M.useIntl(),l=t?[{id:"all",text:typeof t!="boolean"&&t.text||c.formatMessage({id:"filters_all"})},...e]:e,[a,d]=_.useState(t?["all"]:[]),o=(m,u)=>{let p=[];a.includes(m)?p=a.filter(h=>h!==m):m==="all"?p=["all"]:n?p=[...a.filter(h=>h!=="all"),m]:p=[m],d(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),u&&typeof u=="function"&&u()};return s.jsx("ul",{className:S("filters",i),children:l.map(({id:m,text:u,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":c.formatMessage({id:"filters_disabled"},{name:u})}),s.jsx("li",{children:s.jsx("button",{className:S(m,{selected:a.includes(m)}),onClick:w=>{w.preventDefault(),w.stopPropagation(),o(m,h)},...g,children:u})},m)})})},Pr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:i,position:c})=>{c==="before-lang"?r+=`/${i}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${i}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Nt={en:"English",es:"Español",fr:"Français",pt:"Português"},ot="languageSwitcher_",Rr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i=()=>{},urlParts:c,variant:l="default",label:a,className:d=""})=>{const o=M.useIntl(),[m,u]=_.useState(e);if(_.useEffect(()=>{e!==m&&u(e)},[e]),!r||!Object.values(r).some(w=>w&&w.post_name))return null;const h=Object.keys(r),g=m!==e;return s.jsxs("div",{className:S("language-switcher text-small",l,d),children:[s.jsxs("nav",{children:[l!=="short"&&s.jsx("p",{children:a||o.formatMessage({id:`${ot}label`})}),s.jsx("ul",{children:h.map(w=>{if(!Nt[w])return null;let x={className:w};return m===w?x["aria-label"]=o.formatMessage({id:`${ot}selected`},{language:Nt[w]}):x={...x,href:Pr(w,c),onClick:E=>{E.preventDefault(),E.stopPropagation(),u(w),i(w)}},s.jsx("li",{children:s.jsx(Ze,{...x,fallbackElement:"span",children:Nt[w]})},w)})}),l!=="short"&&!g&&s.jsx("p",{children:o.formatMessage({id:`${ot}translation_${t?"original":n?"human":"machine"}`})})]}),l!=="short"&&!g&&!t&&!n&&s.jsx("small",{children:o.formatMessage({id:`${ot}disclaimer`},{email:Ae.support,link:w=>{const x=`mailto:${w}`;return s.jsx("a",{href:x,children:w})}})})]})};const Pt=M.createIntl({locale:"en",messages:Vt}),Kn=({hasNextPage:e,loadNextPage:t,icon:n=!1,messages:r={button:Pt.formatMessage({id:"loadMore_button"}),endOfFeed:Pt.formatMessage({id:"loadMore_endOfFeed"}),error:Pt.formatMessage({id:"loadMore_error"})},className:i="",gtmContext:c="LoadMore"})=>{const[l,a]=_.useState(!1),[d,o]=_.useState(e),m=async u=>{try{await t(u)}catch(p){p instanceof Error&&p.message&&p.message.includes("Cannot read items")?o(!1):a(!0)}};return s.jsxs("footer",{className:S("load-more",i),children:[l&&s.jsx("p",{className:"error",children:r.error}),d?s.jsx(Q,{variant:"secondary",icon:n,onClick:m,"data-gtm-event-context":c,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:r.button}):s.jsx("p",{children:r.endOfFeed})]})};const Zt=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:S("logo",e,t,n),...r,children:s.jsx(re,{children:s.jsx(M.FormattedMessage,{id:"apolitical"})})})});let it=!1;const es=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=M.useIntl(),c=_.useRef(null),[l,a]=_.useState(!1),d=o=>{c.current&&o.target instanceof HTMLElement&&!c.current.contains(o.target)&&a(!1)};return _.useEffect(()=>(document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)})),_.createElement(e,{ref:c,className:S("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!l),"aria-haspopup":"true","aria-expanded":l,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!l,children:n.map(({href:o,onClick:m,text:u,icon:p,...h},g)=>{const w={...h,onClick:x=>{a(!1),typeof m=="function"&&m(x)},onFocus:()=>{it&&(clearTimeout(it),it=!1)},onBlur:()=>{it=setTimeout(()=>{a(!1)},100)}};return o&&(w.href=o),s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...w,children:u})},`${window.btoa(u)}_${g}`)})})]})})},Dr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Fr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],ts=({activeLink:e})=>{const t=M.useIntl(),n=_.useContext(we),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Fr.map(({key:i,href:c})=>s.jsx("li",{className:S(i,{active:Dr(c,e)}),children:s.jsx("a",{href:c,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${i}`})})},i)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Be,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},ze=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Ar=({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
|
-
${Ve(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Ve(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Vr="shareLinks_",Yr=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:c="default",className:d=""})=>{const a=N.useIntl(),u=zr({title:e,link:t,referrer:n});return s.jsxs("aside",{className:$("share-links",i,c,d),children:[s.jsx("p",{className:"text-small",children:a.formatMessage({id:"shareLinks_label"})}),s.jsx("ul",{children:u.map(({key:o,icon:m,url:l,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const g={};return p&&(g.onClick=w=>p(w,l)),s.jsx("li",{children:s.jsx(H,{size:i,variant:"tertiary",icon:{icon:m||o},href:l,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:`${Vr}link_${o}`}),...g})},o)})})]})};const Gr=({tabs:e,className:t=""})=>{var u;const n=(o,m,l)=>(o||(o=`panel-${window.btoa(m)}-${l}`),o);let r=e.findIndex(o=>o.current===!0);if(r<0&&(r=0),window.location.hash){const o=window.location.hash.replace("#","");if(e.find(l=>l.id===o)){for(let l=0;l<e.length;l++)if(n(e[l].id,e[l].text,l)===o){r=l;break}}}const[i,c]=_.useState((u=e[r])!=null&&u.id?e[r].id:n(e[r].id,e[r].text,r)),d=[],a=[];return e.forEach(({id:o,text:m,content:l,href:h},p)=>{o=n(o,m,p);const g=i===o,w={};h||(w["aria-controls"]=o,w.onClick=v=>{v.preventDefault(),v.stopPropagation(),c(o),window.location.hash=`#${o}`},a.push(s.jsx("section",{id:o,hidden:!g,role:"tabpanel","aria-labelledby":`tab-${o}`,"aria-live":g?"assertive":"off",children:typeof l=="string"?s.jsx("p",{children:l}):l},`section-${o}`))),d.push(s.jsx("li",{children:s.jsx("a",{href:h||`#${o}`,id:`tab-${o}`,className:$({selected:g}),role:"tab","aria-selected":g,...w,children:m})},`tab-${o}`))}),s.jsxs("div",{className:$("tabs-wrapper",t),children:[s.jsx("ul",{className:"tabs",role:"tablist",children:d}),s.jsx("div",{className:"tab-content",children:a})]})};const Jr={"2-1":901,"1-3":769},os=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const i=Be(!0);let c=r;return _.Children.count(r)===1&&(c=_.Children.toArray(r)[0],c.props&&(c=c.props.children)),s.jsx("section",{className:$("columns",`layout-${e}`,n),children:_.Children.map(c,(d,a)=>t!==!1&&a===t&&i&&i<Jr[e]?null:d)})},Xr=({activeLink:e,...t})=>s.jsx(os,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(as,{activeLink:e}),s.jsx(qn,{...t})]})});const Rt="cookieBanner_",Ft=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],It=new Date(Date.now()+12*30*24*60*60*1e3),is=()=>{const e=N.useIntl(),[t,n,r]=Dn.useCookies(Ft),[i,c]=_.useState(!t["apol-cookie-banner"]),d=()=>{Ft.forEach(m=>{n(m,!0,{path:"/",expires:It,domain:m==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),c(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:It}),Ft.forEach(m=>{if(m==="apol-cookie-banner"){n(m,!0,{path:"/",expires:It});return}r(m)}),c(!1)};if(!i)return null;const u=[{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 u.forEach(m=>{o.push({variant:m.href?"tertiary":"primary",href:m.href,onClick:m.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${m.gtmType}-click`,children:e.formatMessage({id:`${Rt}buttons_${m.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${Rt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${Rt}text`})}),s.jsx(Ze,{buttons:o})]})},$e={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Fe["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Fe["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Fe.support,gtmType:"concierge-email-click"},business:{email:Fe.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const Ie="footer_",_t="SiteFooter",Tn=({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(N.FormattedMessage,{id:`${Ie}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:c}=$e[e][r],d={};return["legal"].includes(e)&&(d.target="_blank",d.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":_t,"data-gtm-event-type":c,...d,children:s.jsx(N.FormattedMessage,{id:`${Ie}${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(N.FormattedMessage,{id:`${Ie}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(N.FormattedMessage,{id:`${Ie}${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":_t,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},sn=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(Yt,{element:"hr"}),s.jsx(nn,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":_t,"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(Tn,{group:e}),Object.keys($e[e]).includes("child")&&s.jsx(Tn,{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":_t,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(N.FormattedMessage,{id:`${Ie}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(N.FormattedMessage,{id:`${Ie}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const ct="emailHelperTextBox_",Zr=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const i=N.useIntl(),[c,d]=_.useState({path:`${ct}default`,type:"default",link:{},mail:{},error:""}),[a,u]=_.useState(!1),o=_.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=w=>{d({path:`${ct}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>o(v),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:w})};if(typeof r!="function"){g(i.formatMessage({id:`${ct}error_noFunction`}));return}u(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(w=>{g(w.message)}).finally(()=>{u(!1)})},[t,n,r]);_.useEffect(()=>{let p=ct,g="default",w={},v={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",w={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",v={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",w={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",w={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",w={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}d({...c,path:p,type:g,link:w,mail:v})},[e]);const m={};return["link","mail"].forEach(p=>{m[p]=Object.keys(c[p]).length?g=>s.jsx("a",{...c[p],children:g}):g=>g}),s.jsx(Xn,{type:c.type,heading:a?!1:i.formatMessage({id:`${c.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(ve,{element:"span"}),s.jsx(ve,{element:"span"})]}):i.formatMessage({id:`${c.path}_text`},{...m,strong:p=>s.jsx("strong",{children:p}),em:p=>s.jsx("em",{children:p}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:c.error})})};const ut="passwordRules_",ls="isMoreThanEightCharacters",cs="includesNumberAndSymbol",us="includesLowerAndUppercase",qr={[ls]:"8Characters",[cs]:"numberSymbol",[us]:"lowercaseUppercase"},Kr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=N.useIntl();return s.jsxs("aside",{className:$("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${ut}intro`})}),s.jsx("ul",{children:[ls,cs,us].map(r=>s.jsxs("li",{className:$({matches:e[r]}),children:[s.jsxs(le,{children:[n.formatMessage({id:`${ut}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${ut}rule_${qr[r]}`})}),!e[r]&&s.jsxs(le,{element:"strong",children:[" "," ",n.formatMessage({id:`${ut}notMet`})]})]},`rule-${r}`))})]})},ea=_.memo(Kr);const ta=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:c="",hasLoaded:d=!1})=>{const a=N.useIntl(),[u,o]=_.useState({setUp:!1,id:null,rating:null,disabled:!0}),m=async()=>{try{const S=await n();o(k=>({...k,setUp:!0,id:S&&S.id,disabled:!1}))}catch(S){o(k=>({...k,setUp:!0,disabled:!0})),i(S)}};if(_.useEffect(()=>{d&&!u.setUp&&m()},[d]),!d)return s.jsx(ve,{className:"rating-placeholder"});const{id:l,rating:h,disabled:p}=u,g="ratings_",w={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},v=async S=>{if(!(!l||p))try{o(k=>({...k,rating:S,disabled:!0})),await r({id:l,value:S})}catch(k){o(x=>({...x,rating:null})),i(k)}finally{o(k=>({...k,disabled:!1}))}};return s.jsxs("div",{className:$("rating",c),children:[s.jsx("span",{className:"label",children:w[h?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(S=>{const k=S+1;return s.jsx("li",{className:$({selected:h&&k<=h}),children:s.jsx(H,{variant:"tertiary",size:"small",icon:{icon:`star${!h||k>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${g}stars`},{number:k,total:t})}${k===1||k===t?` - ${w[k===1?"low":"high"]}`:""}`,onClick:x=>{x.preventDefault(),x.stopPropagation(),v(k)},disabled:p})},`rating-${k}`)})})]})};const ds=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:c="form-submission"})=>{const{searchIsOpen:d=!0,isDesktopVersion:a=!1}=n||{},u=N.useIntl(),o=_.useRef(null);Pe(()=>{!n||a||!d||o.current&&o.current.focus()},[d]);const m=l=>{l.preventDefault(),l.stopPropagation(),!(!o.current||!o.current.value||o.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(o.current.value)}`)};return s.jsx("form",{onSubmit:m,className:$("search-form gtm-trackable",t),"data-gtm-event-context":i,"data-gtm-event-type":c,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!d:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(le,{element:"label",htmlFor:e,children:u.formatMessage({id:"search_label"})}),s.jsx("input",{ref:o,type:"search",id:e,name:e,defaultValue:r,placeholder:u.formatMessage({id:"search_placeholder"}),onKeyDown:l=>{l.key==="Enter"&&m(l)}}),s.jsx("button",{className:"clear",onClick:l=>{l.preventDefault(),l.stopPropagation(),o.current&&o.current.value&&(o.current.value="")},children:s.jsx(le,{children:u.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:m,children:s.jsx(le,{children:u.formatMessage({id:"search_cta"})})})]})})})};const ms=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:i,backgroundColor:c,onClose:d,reportError:a,sendInvites:u,initialFormStatus:o="NOT_SUBMITTED"})=>{const[m,l]=_.useState([]),[h,p]=_.useState(!0),[g,w]=_.useState(o),{formatMessage:v}=N.useIntl(),S=async M=>{M.preventDefault();try{await u(m),l([]),w("SUCCESS")}catch(A){w("ERROR"),a(A)}},k=M=>{M.preventDefault(),w("NOT_SUBMITTED"),p(!0),l([])},x=M=>{M.preventDefault(),d(),w("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:v({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",v({id:"inviteForm_error"})]})}),s.jsx(Me,{}),s.jsx("div",{className:"footer",children:g==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"secondary",onClick:k,children:v({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(H,{onClick:x,children:v({id:"inviteForm_ctaDone"})})]}):s.jsx(H,{onClick:k,children:v({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:c},onSubmit:S,className:$("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t}),s.jsx(Ls.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:v({id:"inviteForm_email_placeholder"}),emails:m,onChange:M=>{l(M),p(!M.length)},autoFocus:!1,getLabel:(M,A,R)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:M}),s.jsx(H,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{R(A),p(!m.length)},className:"remove-email-button",screenreaderText:v({id:"overlay_close"})})]},A)})]}),s.jsx(Me,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(H,{className:"sendEmailsButton",disabled:h,children:n})})]})})},U={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=c=>{const d=`logged${e?"In":"Out"}`;return t>=n[c][d]};let i={};return["navigation","search"].forEach(c=>{i[c]=r(c)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!t&&U.handlerCalled[e]&&i-U.handlerCalled[e]<500)return;U.handlerCalled[e]=i;let c=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(d=>{d===e||n[d]===!1||c.push({type:`menus.${d}`,value:!1})}),r(c)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=Pn(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?U.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{if(!t.current||!t.current.children)return;const c=n?"desktop":"default";if(r[e][c]){r[e][c].focus();return}let d,a;switch(e){case"navigation":if(n){const u=U.findFirstChild(t.current.children,"attributes.aria-controls","navigation");d=U.findFirstChild(u.children,"href")}else d=U.findFirstChild(t.current.children,"href");d||(d=t.current);break;case"account":if(a=U.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;d=U.findFirstChild(a.children,"href");break;default:return}d&&(i([{type:`focusElements.${e}.${c}`,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(U.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(U.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(U.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{U.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Xe={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"}}}},xt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:c=null})=>{const d=N.useIntl(),a=Pn(Xe,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const u="doTrack"in a,o=c===null?u?a.doTrack:!0:c,m=e.includes("buttons.");let l=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(l+=`_logged${t?"In":"Out"}`);let h=!1;if(a.href){let k=a.gtmType||`${e}-click`;if(k.includes(".")){const x=k.split("."),M=x[x.length-2];k=`${M==="topics"?`${M}-`:""}${x[x.length-1]}`}h={href:a.href,role:"menuitem"},o&&(h={...h,className:"gtm-trackable","data-gtm-event-type":k,"data-gtm-event-context":"HeaderButtons"}),m&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const p=a.order&&a.order[0]&&a[a.order[0]],g=p&&a[a.order[0]].order,w=h&&window.location.pathname===a.href;let v={},S={};if(p){const k=a.menuId||e,x={onClick:M=>U.events.onClick(M,{id:k,callback:i,isOpen:r[k]}),onFocus:()=>U.events.onFocus({id:k}),onBlur:()=>U.events.onBlur({id:k,callback:i}),onMouseLeave:()=>U.events.onBlur({id:k,callback:i}),onMouseEnter:()=>U.events.onMouseEnter({id:k,callback:i})};n&&(g&&(v={...x,onKeyPress:M=>{M.key==="Enter"&&U.events.onClick(M,{id:k,callback:i,isOpen:r[k]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),S={hidden:k in r?!r[k]:!0}),g||(S={...S,...x})}return s.jsxs("li",{className:$({[a.className]:a.className,"has-submenu":p,parent:g,active:w}),role:"none",...v,children:[h?_.createElement(m?H:"a",h,d.formatMessage({id:l})):d.formatMessage({id:l}),a.order&&s.jsx("ul",{...S,children:a.order.map(k=>{if(!a[k])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:u?o:null};return a[k].order?s.jsxs("li",{className:$({[a[k].className]:a[k].className}),children:[d.formatMessage({id:`${l}_${k}`}),s.jsx("ul",{children:a[k].order.map(M=>s.jsx(xt,{id:`${e}.${k}.${M}`,...x},M))})]},k):s.jsx(xt,{id:`${e}.${k}`,...x},k)})})]},e)};const na={height:67,height_desktop:83},rn=({showNavigation:e=!0})=>{const t=N.useIntl(),n=_.useContext(ke),r=Be(!0,!0),i=n&&typeof n.id=="string",c=_.useMemo(()=>U.getIsDesktopVersion(i,r),[i,r]),[d,a]=_.useReducer(sr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:u,menus:o,focusElements:m}=d;In({scrollPosition:na[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!c&&o.navigation||U.shouldChangeHeaderIsVisible(!0,o,a)},scrollDown:()=>{!c&&o.navigation||U.shouldChangeHeaderIsVisible(!1,o,a)}}});const l=(p,g)=>{U.handleMenus({id:p,value:g,menus:o,dispatch:a})},h=_.useRef(null);return Pe(()=>{o.navigation&&U.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:c.navigation,focusElements:m,dispatch:a})},[o.navigation]),Pe(()=>{o.account&&U.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:c.navigation,focusElements:m,dispatch:a})},[o.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:$({"logged-in":i,"logged-out":!i,visible:u}),children:[s.jsx(le,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(nn,{}),e&&s.jsxs(s.Fragment,{children:[!c.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),l("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(le,{children:t.formatMessage({id:`header_menu_${o.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:h,id:"navigation",hidden:c.navigation||o.account?!1:!o.navigation,role:"menu","data-showing":!c.navigation&&o.account?"account":"default",children:Xe.order.map(p=>s.jsx(xt,{id:p,isLoggedIn:i,isDesktopVersion:c.navigation,menus:{navigation:o.navigation,account:o.account},callback:l},p))}),!c.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),l("search",!o.search)},"aria-haspopup":"true","aria-expanded":o.search,"aria-controls":"search-form",children:s.jsx(le,{children:t.formatMessage({id:`header_search_${o.search?"hide":"show"}`})})}),s.jsx(ds,{id:"global-search",handleToggle:{searchIsOpen:o.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),i?s.jsxs("button",{className:"account-button",onClick:p=>U.events.onClick(p,{id:"account",callback:l,isOpen:o.account}),onMouseEnter:()=>U.events.onMouseEnter({id:"account",callback:l}),onMouseLeave:()=>U.events.onBlur({id:"account",callback:l}),"aria-haspopup":"true","aria-expanded":o.account,"aria-controls":"navigation",children:[s.jsx(le,{children:t.formatMessage({id:`header_account_${o.account?"hide":"show"}`})}),s.jsx(Oe,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:Xe.buttons.order.map(p=>s.jsx(xt,{id:`buttons.${p}`},p))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:$("overlay",{open:o.navigation||o.account||!c.search&&o.search})})]})};const an=({element:e="section",children:t,className:n,...r})=>_.createElement(e,{className:$("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const on=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:c=()=>{}}={},forceShow:{error:d=!1}={},title:a,children:u,buttons:o,className:m="",gtmContext:l="Modal"})=>{const h=N.useIntl(),[p,g]=_.useState(t),w=S=>{g(S),S?(i(),document.body.classList.add("has-overlay")):(c(),document.body.classList.remove("has-overlay"))};_.useEffect(()=>{w(t)},[t]);const v=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:$("overlay",{open:p}),children:s.jsx(an,{id:e,className:$("overlay-modal",m,{"has-max-width":r}),hidden:!p,style:v,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[a&&s.jsx("h2",{className:"modal-title",children:a}),s.jsx(H,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>w(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":l,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Me,{}),u,o&&s.jsxs("div",{className:"bottom",children:[s.jsx(Me,{}),s.jsx(Ze,{buttons:o})]}),d&&s.jsx(pt,{className:"error",children:d})]})})})},fs=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const sa=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:i="Invite your colleagues by typing or pasting their emails below.",ctaMessage:c="Send",showIcon:d,onClose:a,reportError:u=()=>{},sendInvites:o})=>s.jsx(on,{title:n,isOpen:t,showDivider:!1,showIcon:d,functions:{onClose:a},className:$("invite-modal",e,{success:!!n}),children:s.jsx(ms,{title:r,label:i,ctaMessage:c,onClose:a,sendInvites:o,reportError:u})});const ra=()=>{const e=N.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(rn,{}),s.jsx("div",{id:"content",children:s.jsx(Ke,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(sn,{})]})},hs=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:c={},className:d="",locale:a="en"})=>{const{navigation:u=!0,footer:o=!0}=i,{background:m="default",variant:l="default",circle:h="default"}=c,p=Rn();_.useEffect(()=>{window.scrollTo(0,0)},[p]);const g=ht(e,{locale:a}),w=ht(t,{locale:a}),v=ht(n,{locale:a}),S={};return m!=="default"&&(S[m]=!0),l!=="default"&&(S[l]=!0),h!=="default"&&(S[h]=!0),s.jsx(Bs.ErrorBoundary,{onError:r,fallback:s.jsx(ra,{}),children:s.jsx(_.Suspense,{fallback:null,children:s.jsxs("div",{id:"wrapper",className:$(d,S,{"has-footer":o}),children:[s.jsx(rn,{showNavigation:u}),s.jsxs("section",{id:"content-wrapper",children:[w&&s.jsx("div",{className:"additional-content prepended",children:w}),_.createElement(m==="bold"?an:"div",{id:"content",children:g})]}),v&&s.jsx("div",{className:"additional-content appended",children:v}),o&&s.jsx(sn,{}),s.jsx(is,{})]})})})},Mn={default:"tags_",headerTopics:"header_topics_topics_"},Lt={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"},aa={getTagDetails:e=>{if(e.includes("topic_")){if(e=Lt.topic[e.replace("topic_","")],e){const t=Xe.topics.topics[e].href;return t?{id:e,href:t,text:`${Mn.headerTopics}${e}`}:null}return null}return Lt[e]?(e=Lt[e],{id:e,text:`${Mn.default}${e}`}):null}};const oa=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:c="tag-click",gtmContext:d="tags"})=>{const a=N.useIntl();if(!e||e.length<1)return null;const u=[];return e.forEach(o=>{if(!o)return;const m=aa.getTagDetails(o);m&&u.push(m)}),u.length<1?null:s.jsx("ul",{className:$("tags text-small",t,i,{"one-line":n}),children:u.map(o=>{const m=a.formatMessage({id:o.text});return s.jsx("li",{children:o.href&&r?s.jsx("a",{href:o.href,className:"gtm-trackable","data-gtm-event-type":c,"data-gtm-event-context":d,children:m}):m},o.id)})})};const ia=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:i="member",gtmType:c="member-click",className:d=""})=>{const a=N.useIntl();return e.length===0?null:s.jsxs("div",{className:$("members-list",d),children:[s.jsxs("h1",{children:[a.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:t})]}),s.jsx("ul",{children:e.map((u,o)=>s.jsxs("li",{children:[s.jsx(wt,{member:u,gtmContext:i,gtmType:c}),u.isAdmin&&s.jsx(Je,{children:a.formatMessage({id:"membersList_admin"})})]},o))}),n&&s.jsx(ss,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:i})]})};let dt=null;const xe="discussion_form_",ln=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:i=5e4,minRows:c=4,forceShow:d={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:u="DiscussionForm"})=>{var C,D;const o=N.useIntl(),m=_.useContext(ke),[l,h]=_.useState(n.isEditing&&n.isEditing.text||""),[p,g]=_.useState(d.error||!1),[w,v]=_.useState(!1),S=_.useRef(null);if(r||(r=S),n.isLoading)return s.jsx(ve,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const k=b=>{const G=b.target.value;h(G);let y;!m||!m.id?y=ye(o.formatMessage,`${xe}error_loggedOut`,e.type,"action"):t?G.length>=i&&(y=`${xe}error_tooLong`):y=ye(o.formatMessage,`${xe}error_noPermission`,e.type,"action"),y?g(y):p&&g(!1)};let x=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const b=e.type==="response"?((C=e.slugs)==null?void 0:C.question)||"":((D=e.slugs)==null?void 0:D.answer)||"";b&&(x=`${x}-${b.slice(-15)}`)}const M=async b=>{var y;if(b.preventDefault(),b.stopPropagation(),!m||!m.id||!t||R)return;dt&&clearTimeout(dt),v("submitting");const G=window.location.pathname;try{let j;switch(e.type){case"post":j=await a.create({content:l});break;case"question":j=await a.create({title:l,authorId:m&&m.id,...(y=a.props)==null?void 0:y.create});break;case"response":j=await a.create({question:e.slugs.question},{body:l,authorId:m&&m.id,contentPath:G});break;case"reply":j=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:l,authorId:m&&m.id,contentPath:G});break;default:break}await rr(1e3),a.callback&&await a.callback(j),dt=setTimeout(()=>{h(""),v("submitted"),A()},500)}catch(j){const V=j;let X=`${xe}error`;V.message.includes("entry already exists")&&(X=ye(o.formatMessage,`${xe}error_alreadyExists`,e.type,"action")),V.message.includes("429")?X=ye(o.formatMessage,`${xe}error_tooMany`,e.type,"action"):V.message.includes("400")&&(X=`${xe}error`),g(X),A()}},A=()=>{dt=setTimeout(()=>{g(!1),v(!1)},5e3)},R=!l||!nr(l),Y=w==="submitting",F=[];return(n.isEditing&&!Y||d.cancel)&&F.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!d.cancel&&(!m||!m.id||!l),children:o.formatMessage({id:`${xe}cancel`})}),F.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:b=>{if(n.isEditing){v("submitting"),a.handleSaveEdit&&a.handleSaveEdit(S.current&&"value"in S.current?S.current.value:"");return}M(b)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!t||R||Y||n.isEditing&&l===n.isEditing.text,children:o.formatMessage({id:`${xe}${Y?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:x,className:$("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(wt,{member:m||"community",gtmContext:u,gtmType:"profile-click"}),s.jsx(le,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:ye(o.formatMessage,`${xe}label`,e.type,"action")}),s.jsx(Os,{ref:r,id:`${x}-input`,name:e.type,placeholder:ye(o.formatMessage,`${xe}placeholder`,e.type,"action"),onChange:k,value:l,maxLength:i,"aria-invalid":!!p,"aria-errormessage":"error-message",minRows:c,autoFocus:!!n.isEditing}),s.jsx("small",{children:ye(o.formatMessage,`${xe}explainer`,e.type,"action",{a:b=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:b})})}),s.jsx(Ze,{buttons:F}),w==="submitted"&&s.jsx(pt,{className:"success","data-testid":"success",children:ye(o.formatMessage,`${xe}success`,e.type,"action")}),p&&s.jsx(pt,{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:i}):p})]})},kt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:i,leave:c,notMemberStateText:d}})=>r&&!n?s.jsx(Ke,{text:d,button:{breakpoints:{mobile:!0,901:!1},component:s.jsx(tn,{isShort:!0,functions:{join:i,leave:c}})}}):s.jsx(ln,{content:{type:e,slugs:{}},functions:{create:t}}),la={showThread:!1,showForm:!1},et=_.createContext(la),ps=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(et.Provider,{value:{...t,updateConversation:n},children:e})},ca=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),ua=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ye=!1;const Bt=()=>{Ye!==!1&&(clearTimeout(Ye),Ye=!1)},Ot=5,gs=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:c={type:"reply",slugs:{}},canLike:d=!0,functions:{createLike:a=()=>{},deleteLike:u=()=>{}}={}})=>{const o=N.useIntl();_.useEffect(()=>{p(i)},[i]);const[m,l]=_.useState(t),[h,p]=_.useState(i),[g,w]=_.useState(!1),[v,S]=_.useState(!1),k=_.useMemo(()=>ua(n,Ot),[n]),x=A=>{if(A.preventDefault(),A.stopPropagation(),S(!1),Ye)return Bt(),!1;if(Bt(),g||!d)return!1;Ye=setTimeout(M,350)},M=async()=>{if(Bt(),g||!d)return!1;let A=h?m-1:m+1;A<0&&(A=0),w(!0),l(A),p(!h);try{if(c&&c.slugs){const R=ca(c.slugs);h?await u(R):await a(R,{contentPath:window.location.pathname})}}catch{l(t),p(i)}finally{w(!1)}};return _.createElement(e,{className:$("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(H,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:$({"do-animation":h&&!i}),screenreaderText:d?o.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:o.formatMessage({id:`discussion_action_${c.type}`})}):!1,onClick:x,disabled:!d,"aria-hidden":!d,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${c.type}-click`}),s.jsx("span",{className:$("number-of-likes",{"no-likes":m===0}),"data-testid":"number-of-likes",children:o.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})}),n&&s.jsx(Wn,{isOpen:v,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[k.map(A=>typeof A=="string"||!A.name?null:s.jsx("li",{children:s.jsx(qe,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:R=>R==null?void 0:R.stopPropagation(),children:A.name})},A.id||window.btoa(A.name))),n.length>Ot&&s.jsx("li",{children:o.formatMessage({id:"discussion_likes_more"},{number:n.length-Ot})})]})})]})})},Cn=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},cn=(e,t)=>e&&!t;const Se="discussion_",da=280,tt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:i,functions:{content:{createContent:c,deleteContent:d,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:u,deleteLike:o}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}}},links:l={},className:h,gtmContext:p="DiscussionAnswer",children:g,isTruncated:w=!1})=>{const v=N.useIntl(),S=_.useContext(ke),k=_.useContext(et),[x,M]=_.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[A,R]=_.useState(!1),[Y,F]=_.useState("");if(_.useEffect(()=>{M({...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(ve,{className:"discussion-card discussion-post"});const{author:C,canLike:D,createdAt:b,id:G,likes:y=0,userLiked:j,comments:V=0}=t,X=w?Le(x.body,da):x.body,ne=S&&S.id&&typeof C!="string"&&C.id&&C.id===S.id||!1,se=typeof D=="boolean"?D:n?!ne:!1,re=async L=>{L||(L=""),F("");try{if(!Qs(L,x.body)){const ae=t.type==="question"?{title:L}:{body:L};await a(Cn(t.slugs),ae)}M({body:L,isEditing:!1,didEdit:!0})}catch{F(`${Se}form_error`)}},q=()=>{k&&k.updateConversation&&k.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=()=>{R(!1);try{d(Cn(t.slugs))}catch{F("delete-error")}},ce=[{text:v.formatMessage({id:`${Se}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Se}report_subject`}))}&body=${encodeURI(v.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:v.formatMessage({id:`${Se}moreMenu_edit`}),onClick:()=>M({...x,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${Se}moreMenu_delete`}),onClick:L=>{L.preventDefault(),L.stopPropagation(),R(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`delete-${t.type}-click`,...fs(`delete-${t.slug}-modal`,A)}),_.createElement(e,{className:$("discussion-post",h),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:G||t.slug,className:$("discussion-card",t.type,{editing:x.isEditing,"has-link":l.post&&!x.isEditing}),onClick:L=>{!l.post||x.isEditing||(L.preventDefault(),L.stopPropagation(),window.location.href=l.post)},children:[!x.isEditing&&s.jsx(wt,{member:C,additionalContent:{createdAt:b,didEdit:x.didEdit},className:typeof C!="string"&&C.id===i?"highlighted":"",gtmContext:p,gtmType:"profile-click"}),x.isEditing?s.jsx(ln,{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:Y!==""&&Y!=="delete-error"?v.formatMessage({id:Y},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:c,handleSaveEdit:re,handleCancel:()=>{F(""),M({...x,isEditing:!1})}},gtmContext:`${p}Form`}):l.post?s.jsx("a",{href:l.post,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":"title-click",children:s.jsx(zt,{options:{overrides:{a:Zn}},children:X})}):s.jsx(zt,{options:{wrapper:t.type==="question"?"h1":_.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:X}),!x.isEditing&&s.jsxs("ul",{className:$("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(gs,{element:"li",likes:y,isShort:!1,userLiked:j,content:{type:t.type,slugs:t.slugs},canLike:se,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:o}}),(["question","post"].includes(t.type)||l.comments||typeof m=="function")&&s.jsxs("li",{className:"action-button",onClick:L=>{L.preventDefault(),L.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof m=="function"&&m()},children:[s.jsx(H,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:l.comments?l.comments:!1,onClick:l.comments||typeof m!="function"?!1:m,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${Se}comments_screenReader`},{count:V})}),s.jsx("span",{children:v.formatMessage({id:`${Se}comments`},{count:V})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(H,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:q,children:v.formatMessage({id:`${Se}reply`})})}),s.jsx(rs,{element:"li",id:`more-${t.slug}`,options:ce})]})]}),g,s.jsx(on,{id:`delete-${t.slug}-modal`,isOpen:A,functions:{onOpen:()=>{},onClose:()=>R(!1)},forceShow:{error:Y==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>R(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:de,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(N.FormattedMessage,{id:"discussion_delete_text",values:{p:L=>s.jsx("p",{children:L}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Qt="discussion_responses_",ma=({type:e="answer",responses:t=0})=>{const n=N.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${Qt}title`},{action:n.formatMessage({id:`${Qt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ye(n.formatMessage,`${Qt}empty`,e,e)})]})};const _s=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=N.useIntl(),i=_.useRef(null),c=_.useContext(et),[d,a]=_.useState("closed");_.useEffect(()=>{const l=i.current;if(l)return l.addEventListener("transitionend",u),()=>{l.removeEventListener("transitionend",u)}},[]),Pe(()=>{d==="closed"&&!c.showThread||a(["opening","open"].includes(d)?"ready-to-close":"opening")},[c.showThread]),_.useEffect(()=>{d==="ready-to-close"&&a("closing")},[d]);const u=({propertyName:l})=>{l==="max-height"&&a(h=>h==="opening"?"open":h==="closing"?"closed":h)},o=["opening","open"].includes(d),m=ht(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(H,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${o?"left":"right"}`},onClick:()=>{var l;(l=c.updateConversation)==null||l.call(c,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${o?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:i,className:$("thread",d),hidden:!c.showThread,children:m})]})},fa=({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}),ha=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:a})=>{if(!n)return;const u=fa({user:n,content:a,verb:"post"});await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return e.setQueryData(t,m=>[...m,u]),{previousActivities:o}},onError:(a,u,o)=>{e.setQueryData(t,o.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),pa=({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 u=e.getQueryData(t),o=u==null?void 0:u.map(m=>((m==null?void 0:m.id)===(d==null?void 0:d.activityId)&&(m.content=a),m));return e.setQueryData(t,()=>o&&[...o]),{previousActivities:o}},onError:(d,a,u)=>{e.setQueryData(t,u.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),ga=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:d})=>{await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),u=a==null?void 0:a.filter(o=>(o==null?void 0:o.id)!==d);return e.setQueryData(t,()=>u&&[...u]),{previousActivities:u}},onError:(d,a,u)=>{e.setQueryData(t,u.previousActivities)},onSettled:(d,a,u)=>{e.invalidateQueries({queryKey:[...t,u.activityId]})}}),_a=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:a})=>{await e.cancelQueries({queryKey:t});const u=e.getQueryData(t),o=u==null?void 0:u.map(m=>{var l;return(m==null?void 0:m.id)===a&&((l=m.reaction_counts)!=null&&l.like?m.reaction_counts.like+=1:m.reaction_counts.like=1),m});return e.setQueryData(t,()=>o&&[...o]),{previousActivities:o}},onError:(a,u,o)=>{e.setQueryData(t,o.previousActivities)},onSuccess:a=>{const u=e.getQueryData(t),o=u==null?void 0:u.map(m=>{var l,h;return(m==null?void 0:m.id)===(a==null?void 0:a.activity_id)&&((l=m.own_reactions)!=null&&l.like?m.own_reactions.like.push(a):m.own_reactions.like=[a],(h=m.latest_reactions)!=null&&h.like?m.latest_reactions.like.push(a):m.own_reactions.like=[a]),m});return e.setQueryData(t,()=>o&&[...o]),{previousActivities:u}},onSettled:(a,u,o)=>{e.invalidateQueries({queryKey:[...t,o.activityId]})}}),xa=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:u})=>{await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),m=o==null?void 0:o.map(l=>{var h;return(l==null?void 0:l.id)===u&&(h=l.reaction_counts)!=null&&h.like&&(l.reaction_counts.like-=1),l});return e.setQueryData(t,()=>m&&[...m]),{previousActivities:m}},onError:(u,o,m)=>{e.setQueryData(t,m.previousActivities)},onSuccess:(u,{activityId:o})=>{const m=e.getQueryData(t),l=m==null?void 0:m.map(h=>{var p,g,w,v,S;if(h.id===o){const k=(w=(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:w.id;return h.own_reactions.like=(v=h.own_reactions.like)==null?void 0:v.filter(x=>x.id!==k),h.latest_reactions.like=(S=h.latest_reactions.like)==null?void 0:S.filter(x=>x.id!==k),h}else return h});return e.setQueryData(t,()=>l&&[...l]),{previousActivities:m}},onSettled:(u,o,m)=>{e.invalidateQueries({queryKey:[...t,m.activityId]})}}),ba=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:i,edit:c,remove:d,like:a,unlike:u,join:o,leave:m}})=>{const l=N.useIntl(),h=z.useQueryClient(),p=_.useContext(ke),{data:g,error:w,isLoading:v,isFetching:S}=z.useQuery({queryKey:[e,t],queryFn:r}),k=ha({queryClient:h,queryKey:[e,t],user:p,mutationFn:i}),{mutate:x}=z.useMutation(k),M=pa({queryClient:h,queryKey:[e,t],mutationFn:async j=>await c(j)}),{mutate:A}=z.useMutation(M),R=ga({queryClient:h,queryKey:[e,t],mutationFn:async({activityId:j})=>await d({activityId:j})}),{mutate:Y}=z.useMutation(R),F=_a({queryClient:h,queryKey:[e,t],mutationFn:a}),{mutate:C}=z.useMutation(F),D=xa({queryClient:h,queryKey:[e,t],user:p,mutationFn:async({activityId:j})=>{var ne,se,re;const V=g&&(g==null?void 0:g.find(q=>q.id===j)),X=(re=(se=(ne=V==null?void 0:V.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 u({reactionId:X||"",activityId:j})}}),{mutate:b}=z.useMutation(D),G=_.useCallback(({activityId:j})=>C({activityId:j}),[C]),y=_.useCallback(({activityId:j})=>b({activityId:j}),[b]);return w?s.jsx(Ke,{variant:"error",text:w.message}):v?s.jsx(ve,{style:{height:"400px"}}):s.jsxs("section",{children:[s.jsx(kt,{contentType:"post",createPost:x,membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:m,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),!S&&Array.isArray(g)&&(g==null?void 0:g.map(j=>{var ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he;const V=((ne=j==null?void 0:j.actor)==null?void 0:ne.id)===(p==null?void 0:p.id),X=cn(n,V);return s.jsxs(_.Fragment,{children:[s.jsx(tt,{content:{type:"post",body:j==null?void 0:j.content,canLike:X,createdAt:(j==null?void 0:j.time)||"",slugs:{parentId:t,activityId:j==null?void 0:j.id},slug:j==null?void 0:j.id,author:{id:(se=j==null?void 0:j.actor)==null?void 0:se.id,name:`${(q=(re=j==null?void 0:j.actor)==null?void 0:re.data)==null?void 0:q.name}`,organization:(ce=(de=j==null?void 0:j.actor)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(ae=(L=j==null?void 0:j.actor)==null?void 0:L.data)==null?void 0:ae.jobTitle,image:{thumbnail:((oe=(me=j==null?void 0:j.actor)==null?void 0:me.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:((pe=j==null?void 0:j.own_reactions)==null?void 0:pe.like)&&((fe=j==null?void 0:j.own_reactions)==null?void 0:fe.like.length)>0,likes:(j==null?void 0:j.reaction_counts.like)||0,comments:(j==null?void 0:j.reaction_counts.reply)||0,peopleWhoLiked:((ge=j==null?void 0:j.latest_reactions)==null?void 0:ge.like)&&((he=j==null?void 0:j.latest_reactions)==null?void 0:he.like.map(O=>{var J,ie;return{id:O==null?void 0:O.user_id,name:(ie=(J=O==null?void 0:O.user)==null?void 0:J.data)==null?void 0:ie.name}}))},links:{post:`${e}/${t}/${j==null?void 0:j.id}`,comments:`${e}/${t}/${j==null?void 0:j.id}`},functions:{content:{createContent:()=>null,deleteContent:O=>Y(O),updateContent:(O,J)=>A({activityInfo:O,content:J})},likes:{createLike:()=>{G({activityId:j==null?void 0:j.id})},deleteLike:()=>{y({activityId:j==null?void 0:j.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(Me,{})]},j==null?void 0:j.id)}))]})},va=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,u,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{var o;const u=e.getQueryData(t);if(u)return(o=u==null?void 0:u.latest_reactions)!=null&&o.reply?(u.latest_reactions.reply.unshift(a),u&&(u.reaction_counts={reply:u.latest_reactions.reply.length})):(u.latest_reactions={reply:[a]},u.reaction_counts={reply:1}),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),wa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:c,content:{body:d}})=>{var o,m,l;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 u=(l=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:l.map(h=>(h.id===c.replySlug&&(h.data.content=d),h));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}},onError:(c,d,a)=>{e.setQueryData(t,a.previousActivity)}}),ka=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:c})=>{var u,o,m;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);if(!d||!((u=d==null?void 0:d.latest_reactions)!=null&&u.reply))return;const a=(m=(o=d==null?void 0:d.latest_reactions)==null?void 0:o.reply)==null?void 0:m.filter(l=>l.id!==c);return e.setQueryData(t,()=>({...d,latest_reactions:{reply:a}})),{previousActivity:d}},onError:(c,d,a)=>{e.setQueryData(t,a.previousActivity)}}),ja=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d})=>{var o,m;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),u=(m=(o=a==null?void 0:a.latest_reactions)==null?void 0:o.reply)==null?void 0:m.map(l=>{var h;return l.id===d&&((h=l.children_counts)!=null&&h.like?l.children_counts.like+=1:l.children_counts={like:1}),l});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}},onError:(d,a,u)=>{e.setQueryData(t,u.previousActivity)},onSuccess:d=>{var o;const a=e.getQueryData(t),u=(o=a==null?void 0:a.latest_reactions.reply)==null?void 0:o.map(m=>{var l,h;return m.id===d.id&&((l=m.own_children)!=null&&l.like?m.own_children.like.push(d):m.own_children={like:[d]},(h=m.latest_children)!=null&&h.like?m.latest_children.like.push(d):m.latest_children={like:[d]}),m});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}}}),ya=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var m;await e.cancelQueries({queryKey:t});const u=e.getQueryData(t);if(!u)return;const o=(m=u.latest_reactions.reply)==null?void 0:m.map(l=>(l.id===a&&l.children_counts.like&&(l.children_counts.like-=1),l));return e.setQueryData(t,()=>({...u,latest_reactions:{reply:o}})),{previousActivity:u}},onError:(a,u,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,{replyId:u})=>{var l;const o=e.getQueryData(t);if(!o)return;const m=(l=o.latest_reactions.reply)==null?void 0:l.map(h=>{var p,g,w;if(h.id===u){let v=(p=h.latest_children.reply)==null?void 0:p.filter(S=>S.user_id!==(n==null?void 0:n.id));return v=(w=(g=h==null?void 0:h.own_children)==null?void 0:g.reply)==null?void 0:w.filter(S=>S.user_id!==(n==null?void 0:n.id)),v}return h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}}}),Ea=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:a=>{var m;const u=e.getQueryData(t),o=(m=u==null?void 0:u.latest_reactions.reply)==null?void 0:m.map(l=>(l.id===a.parent&&(l.latest_children.reply&&l.children_counts.reply?(l.latest_children.reply.push(a),l.children_counts.reply+=1):(l.latest_children.reply=[a],l.children_counts.reply=1)),l));return e.setQueryData(t,()=>({...u,latest_reactions:{reply:o}})),{previousActivity:u}},onError:(a,u,o)=>{e.setQueryData(t,o.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Sa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(c,d,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyInfo:c,content:{body:d}})=>{var o,m,l;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 u=(l=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:l.map(h=>{var p;return h.id===c.replyParentId&&((p=h.latest_children.reply)==null||p.map(g=>(g.id===c.replySlug&&(g.data.content=d),g))),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}}}),$a=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(c,d,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyId:c,replyParentId:d})=>{var o,m,l;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 u=(l=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:l.map(h=>{var p,g;return h.id===d&&(h.latest_children.reply=(p=h.latest_children.reply)==null?void 0:p.filter(w=>w.id!==c),(g=h.children_counts)!=null&&g.reply&&(h.children_counts.reply-=1)),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}}}),Ta=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d,replyParentId:a})=>{var m;await e.cancelQueries({queryKey:t});const u=e.getQueryData(t),o=(m=u==null?void 0:u.latest_reactions.reply)==null?void 0:m.map(l=>{var h;return l.id===a&&((h=l.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})),l});return e.setQueryData(t,()=>({...u,latest_reactions:{reply:o}})),{previousActivity:u}},onError:(d,a,u)=>{e.setQueryData(t,u.previousActivity)},onSuccess:(d,a)=>{var m;const u=e.getQueryData(t),o=(m=u==null?void 0:u.latest_reactions.reply)==null?void 0:m.map(l=>{var h;return l.id===a.replyParentId&&((h=l.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))),l});return e.setQueryData(t,()=>({...u,latest_reactions:{reply:o}})),{previousActivity:u}}}),Ma=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:a,replyParentId:u})=>{var l;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),m=(l=o==null?void 0:o.latest_reactions.reply)==null?void 0:l.map(h=>{var p;return h.id===u&&((p=h.latest_children.reply)==null||p.map(g=>{var w;return g.id===a&&((w=g.children_counts)!=null&&w.like?g.children_counts.like-=1:g.children_counts={like:0}),g})),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}},onError:(a,u,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,u)=>{var l;const o=e.getQueryData(t),m=(l=o==null?void 0:o.latest_reactions.reply)==null?void 0:l.map(h=>{var p;return h.id===u.replyParentId&&((p=h.latest_children.reply)==null||p.map(g=>{var w,v;return g.id===u.replyId&&((w=g.own_children)!=null&&w.like&&(g.own_children.like=g.own_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id))),(v=g.latest_children)!=null&&v.like&&(g.latest_children.like=g.latest_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id)))),g})),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}}}),Ca=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:i,replies:c,functions:{create:d,edit:a,remove:u,join:o,leave:m,like:l,unlike:h}})=>{const p=N.useIntl(),g=z.useQueryClient(),w=_.useContext(ke),v=_.useContext(et),S=Ea({queryClient:g,queryKey:[e,t,r],mutationFn:async y=>d({replyId:n,content:y.body})}),{mutate:k}=z.useMutation(S),x=Sa({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:M}=z.useMutation(x),A=$a({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:y})=>u({replyId:y})}),{mutate:R}=z.useMutation(A),Y=Ta({queryClient:g,queryKey:[e,t,r],mutationFn:l}),{mutate:F}=z.useMutation(Y),C=Ma({queryClient:g,queryKey:[e,t,r],user:w,mutationFn:h}),{mutate:D}=z.useMutation(C),b=_.useCallback(({replyId:y,replyParentId:j})=>F({replyId:y,replyParentId:j}),[F]),G=_.useCallback(({replyId:y,replyParentId:j})=>D({replyId:y,replyParentId:j}),[D]);return s.jsx(_s,{count:i,showRepliesButton:i>0||v.showForm,children:s.jsxs(s.Fragment,{children:[v.showForm&&s.jsx(kt,{contentType:"reply",createPost:(y,j)=>k(j),membershipRequiredToPost:{isMember:!0,required:!0,join:o,leave:m,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(c==null?void 0:c.length)===0||(c==null?void 0:c.map(y=>{var j,V,X,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"?(j=y==null?void 0:y.data)==null?void 0:j.content:((X=(V=y==null?void 0:y.data)==null?void 0:V.content)==null?void 0:X.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(O=>{var J,ie;return{id:O==null?void 0:O.user_id,name:(ie=(J=O==null?void 0:O.user)==null?void 0:J.data)==null?void 0:ie.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:O=>{const{replySlug:J,replyParentId:ie}=O;return R({replyId:J,replyParentId:ie})},updateContent:(O,J)=>M({replyInfo:O,content:J})},likes:{createLike:()=>b({replyId:y==null?void 0:y.id,replyParentId:y==null?void 0:y.parent}),deleteLike:()=>{var J,ie,K;const O=((J=y==null?void 0:y.own_children)==null?void 0:J.like)&&((K=(ie=y==null?void 0:y.own_children)==null?void 0:ie.like[0])==null?void 0:K.id);return G({replyId:O||""})}},comments:{}}},y==null?void 0:y.id)}))]})})},xs=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:i,functions:{create:c,edit:d,remove:a,like:u,unlike:o,join:m,leave:l}})=>{const h=N.useIntl(),p=z.useQueryClient(),g=_.useContext(ke),w=va({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>c({activityId:n,content:b.body})}),{mutate:v}=z.useMutation(w),S=wa({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:k}=z.useMutation(S),x=ka({queryClient:p,queryKey:[e,t,n],mutationFn:async({replyId:b})=>a({replyId:b})}),{mutate:M}=z.useMutation(x),A=ja({queryClient:p,queryKey:[e,t,n],mutationFn:u}),{mutate:R}=z.useMutation(A),Y=ya({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:o}),{mutate:F}=z.useMutation(Y),C=_.useCallback(({replyId:b})=>R({replyId:b}),[R]),D=_.useCallback(({replyId:b})=>F({replyId:b}),[F]);return Ln(),s.jsxs(s.Fragment,{children:[s.jsx(kt,{contentType:"reply",createPost:(b,G)=>v(G),membershipRequiredToPost:{isMember:i,required:!0,join:m,leave:l,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var j,V,X,ne,se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he,O,J,ie;const G=((j=b==null?void 0:b.user)==null?void 0:j.id)===(g==null?void 0:g.id),y=cn(i,G);return s.jsx(ps,{children:s.jsx(tt,{content:{type:"reply",body:typeof b.data.content=="string"?(V=b==null?void 0:b.data)==null?void 0:V.content:((ne=(X=b==null?void 0:b.data)==null?void 0:X.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: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)&&((O=b==null?void 0:b.latest_children)==null?void 0:O.like.map(K=>{var ue,be;return{id:K==null?void 0:K.user_id,name:(be=(ue=K==null?void 0:K.user)==null?void 0:ue.data)==null?void 0:be.name}}))},functions:{content:{createContent:()=>null,deleteContent:K=>{const{replySlug:ue}=K;return M({replyId:ue})},updateContent:(K,ue)=>k({replyInfo:K,content:ue})},likes:{createLike:()=>C({replyId:b==null?void 0:b.id}),deleteLike:()=>{var ue,be,Ce;const K=((ue=b==null?void 0:b.own_children)==null?void 0:ue.like)&&((Ce=(be=b==null?void 0:b.own_children)==null?void 0:be.like[0])==null?void 0:Ce.id);return D({replyId:K||""})}},comments:{}},children:s.jsx(Ca,{basePath:e,parentId:t,replyParentId:b==null?void 0:b.id,activityId:n,replyCount:((J=b==null?void 0:b.children_counts)==null?void 0:J.reply)||0,replies:(ie=b==null?void 0:b.latest_children)==null?void 0:ie.reply,isMember:i,functions:{create:c,edit:d,remove:a,like:u,unlike:o,join:m,leave:l}})},b==null?void 0:b.id)},b==null?void 0:b.id)}))]})},Na=({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 u=e.getQueryData(t);return u&&u.id===(d==null?void 0:d.activityId)&&(u.content=a),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onError:(d,a,u)=>{e.setQueryData(t,u.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Da=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),Pa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var u;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(u=a==null?void 0:a.reaction_counts)!=null&&u.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,u,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{const u=e.getQueryData(t);return u!=null&&u.own_reactions.like?u.own_reactions.like.push(a):u&&(u.own_reactions={like:[a]}),u!=null&&u.latest_reactions.like?u.latest_reactions.like.push(a):u&&(u.own_reactions={like:[a]}),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Aa=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:i})=>({mutationFn:i,onMutate:async()=>{var m;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(m=o==null?void 0:o.reaction_counts)!=null&&m.like&&o.reaction_counts.like>0&&(o.reaction_counts.like-=1),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,m,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:()=>{var l,h,p;if(!r)return;const o=(p=(h=(l=r.own_reactions)==null?void 0:l.like)==null?void 0:h.find(g=>g.user_id===(n==null?void 0:n.id)))==null?void 0:p.id,m=e.getQueryData(t);if(m!=null&&m.own_reactions.like&&(m.own_reactions.like=m.own_reactions.like.filter(g=>g.id!==o),!!(m!=null&&m.latest_reactions.like)))return m.latest_reactions.like=m.latest_reactions.like.filter(g=>g.id!==o),e.setQueryData(t,()=>({...m})),{previousActivity:m}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const Ra=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:i,editActivity:c,removeActivity:d,likeActivity:a,unlikeActivity:u,createReply:o,editReply:m,removeReply:l,likeReply:h,unlikeReply:p,join:g,leave:w}})=>{var se,re,q,de,ce,L,ae,me,oe,pe,fe,ge,he,O,J,ie,K,ue,be,Ce,Qe,Ne,nt;const v=N.useIntl(),S=_.useContext(ke),k=z.useQueryClient(),{data:x,isLoading:M,isFetching:A}=z.useQuery({queryKey:[e,t,n],queryFn:i}),R=Na({queryClient:k,queryKey:[e,t,n],mutationFn:async ee=>await c(ee)}),{mutate:Y}=z.useMutation(R),F=Da({queryClient:k,queryKey:[e,t,n],mutationFn:async({activityId:ee})=>d({activityId:ee}),redirectUrl:`${e}/${t}`}),{mutate:C}=z.useMutation(F),D=Pa({queryClient:k,queryKey:[e,t,n],mutationFn:a}),{mutate:b}=z.useMutation(D),G=Aa({queryClient:k,queryKey:[e,t,n],user:S,mutationFn:async()=>{var je,De,st;const ee=(st=(De=(je=x==null?void 0:x.own_reactions)==null?void 0:je.like)==null?void 0:De.find(rt=>rt.user_id===(S==null?void 0:S.id)))==null?void 0:st.id;await u({activityId:n,reactionId:ee})},activity:x}),{mutate:y}=z.useMutation(G),j=_.useCallback(({activityId:ee})=>b({activityId:ee}),[b]),V=_.useCallback(async({activityId:ee})=>y({activityId:ee}),[y]);if(M||A)return s.jsx(ve,{style:{height:"400px"}});if(!x)return s.jsx(Ke,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const X=((se=x==null?void 0:x.actor)==null?void 0:se.id)===(S==null?void 0:S.id),ne=cn(r,X);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)&&((O=(he=x==null?void 0:x.actor)==null?void 0:he.data)==null?void 0:O.thumbnail)||void 0}},userLiked:((J=x==null?void 0:x.own_reactions)==null?void 0:J.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&&((ue=x==null?void 0:x.reaction_counts)==null?void 0:ue.reply),peopleWhoLiked:((be=x==null?void 0:x.latest_reactions)==null?void 0:be.like)&&((Ce=x==null?void 0:x.latest_reactions)==null?void 0:Ce.like.map(ee=>{var je,De;return{id:ee==null?void 0:ee.user_id,name:(De=(je=ee==null?void 0:ee.user)==null?void 0:je.data)==null?void 0:De.name}}))},originalAuthorId:(Qe=x==null?void 0:x.actor)==null?void 0:Qe.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>C({activityId:n}),updateContent:(ee,je)=>Y({activityInfo:ee,content:je})},likes:{createLike:()=>j({activityId:n}),deleteLike:()=>V({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((Ne=x==null?void 0:x.reaction_counts)==null?void 0:Ne.reply)||0,")"]}),s.jsx(xs,{basePath:e,parentId:t,activityId:n,repliesList:(nt=x==null?void 0:x.latest_reactions)==null?void 0:nt.reply,isMember:r,functions:{create:o,edit:m,remove:l,like:h,unlike:p,join:g,leave:w}})]})},n)},Fa=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),Nn=[{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 mt="notFoundError_",Ia=()=>{const e=N.useIntl(),t=[];return Nn.forEach((n,r)=>{n.title=e.formatMessage({id:`${mt}post_${r+1}`}),t.push("solutionArticle")}),s.jsxs(hs,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:s.jsxs(vt,{children:[s.jsx(ns,{cards:Nn,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),s.jsx(H,{href:"/solution-articles/",children:e.formatMessage({id:`${mt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[s.jsx("h1",{children:e.formatMessage({id:`${mt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${mt}text`})})]})};exports.ASSETS_BUCKET=Ge;exports.ActivitiesFeed=ba;exports.ActivitySection=Ra;exports.AddPost=kt;exports.BannerSection=dr;exports.Breadcrumbs=Br;exports.Button=H;exports.ButtonWrapper=Ze;exports.CacheProvider=zn;exports.Card=en;exports.CardBlock=ns;exports.Carousel=Ir;exports.CollapsibleSection=Xt;exports.Columns=os;exports.CommunityDetails=Lr;exports.Contributors=Kt;exports.ConversationContext=et;exports.CookieBanner=is;exports.DiscussionConversation=ps;exports.DiscussionForm=ln;exports.DiscussionLikes=gs;exports.DiscussionPost=tt;exports.DiscussionThread=_s;exports.Divider=Me;exports.DownloadSection=ir;exports.EMAILS=Fe;exports.EmailHelperTextBox=Zr;exports.EmptyStateBox=Ke;exports.Filters=Or;exports.FlagsProvider=Vn;exports.Footer=sn;exports.FullWidthSection=vt;exports.GlobalProviders=pr;exports.Header=rn;exports.HelperTextBox=Xn;exports.HiddenFromScreenReaders=Yt;exports.HideShowTextBox=_r;exports.HighlightedTextBox=Te;exports.IntlProvider=Yn;exports.InviteForm=ms;exports.InviteModal=sa;exports.JoinButton=tn;exports.LanguageSwitcher=Hr;exports.Link=qe;exports.LoadMore=ss;exports.LoadingBlock=$r;exports.LoadingPlaceholder=ve;exports.LoadingState=Zt;exports.Logo=nn;exports.LogoSection=lr;exports.MarkdownText=zt;exports.MarketingBox=mr;exports.Member=wt;exports.MembersList=ia;exports.Modal=an;exports.MoreMenu=rs;exports.NUMBER_OF_USERS=gr;exports.NavigationMenu=as;exports.NotFoundError=Ia;exports.Overlay=on;exports.PageHeading=qn;exports.PageLayout=hs;exports.PasswordRules=ea;exports.Pill=Je;exports.ProfilePicture=Oe;exports.ProgressBar=Kn;exports.Rating=ta;exports.RepliesFeed=xs;exports.ResponsesHeading=ma;exports.ResponsiveImage=Jt;exports.SearchForm=ds;exports.ShareLinks=Yr;exports.Span=Zn;exports.StatusBanner=pt;exports.Tabs=Gr;exports.Tags=oa;exports.Tooltip=Wn;exports.TopLevelPage=Xr;exports.UserContext=ke;exports.UserProvider=Gn;exports.VisuallyHidden=le;exports.addAriaProps=fs;exports.getMember=qt;exports.headerData=Xe;exports.mapGetStreamData=Fa;exports.pageReady=Un;exports.useCurrentPath=Rn;exports.useEffectAfterMount=Pe;exports.useElementWidth=Be;exports.useScrollListener=In;exports.useScrollToHash=Ln;
|
|
39
|
+
${ze(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ze(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Ir="shareLinks_",Lr=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:c="default",className:l=""})=>{const a=M.useIntl(),d=Ar({title:e,link:t,referrer:n});return s.jsxs("aside",{className:S("share-links",i,c,l),children:[s.jsx("p",{className:"text-small",children:a.formatMessage({id:"shareLinks_label"})}),s.jsx("ul",{children:d.map(({key:o,icon:m,url:u,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=w=>h(w,u)),s.jsx("li",{children:s.jsx(Q,{size:i,variant:"tertiary",icon:{icon:m||o},href:u,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:`${Ir}link_${o}`}),...g})},o)})})]})};const Br=({tabs:e,className:t=""})=>{var d;const n=(o,m,u)=>(o||(o=`panel-${window.btoa(m)}-${u}`),o);let r=e.findIndex(o=>o.current===!0);if(r<0&&(r=0),window.location.hash){const o=window.location.hash.replace("#","");if(e.find(u=>u.id===o)){for(let u=0;u<e.length;u++)if(n(e[u].id,e[u].text,u)===o){r=u;break}}}const[i,c]=_.useState((d=e[r])!=null&&d.id?e[r].id:n(e[r].id,e[r].text,r)),l=[],a=[];return e.forEach(({id:o,text:m,content:u,href:p},h)=>{o=n(o,m,h);const g=i===o,w={};p||(w["aria-controls"]=o,w.onClick=x=>{x.preventDefault(),x.stopPropagation(),c(o),window.location.hash=`#${o}`},a.push(s.jsx("section",{id:o,hidden:!g,role:"tabpanel","aria-labelledby":`tab-${o}`,"aria-live":g?"assertive":"off",children:typeof u=="string"?s.jsx("p",{children:u}):u},`section-${o}`))),l.push(s.jsx("li",{children:s.jsx("a",{href:p||`#${o}`,id:`tab-${o}`,className:S({selected:g}),role:"tab","aria-selected":g,...w,children:m})},`tab-${o}`))}),s.jsxs("div",{className:S("tabs-wrapper",t),children:[s.jsx("ul",{className:"tabs",role:"tablist",children:l}),s.jsx("div",{className:"tab-content",children:a})]})};const Or={"2-1":901,"1-3":769},ns=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const i=qe(!0);let c=r;return _.Children.count(r)===1&&(c=_.Children.toArray(r)[0],c.props&&(c=c.props.children)),s.jsx("section",{className:S("columns",`layout-${e}`,n),children:_.Children.map(c,(l,a)=>t!==!1&&a===t&&i&&i<Or[e]?null:l)})},Hr=({activeLink:e,...t})=>s.jsx(ns,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(ts,{activeLink:e}),s.jsx(Wn,{...t})]})});const Rt="cookieBanner_",Dt=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Ft=new Date(Date.now()+12*30*24*60*60*1e3),ss=()=>{const e=M.useIntl(),[t,n,r]=Tn.useCookies(Dt),[i,c]=_.useState(!t["apol-cookie-banner"]),l=()=>{Dt.forEach(m=>{n(m,!0,{path:"/",expires:Ft,domain:m==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),c(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Ft}),Dt.forEach(m=>{if(m==="apol-cookie-banner"){n(m,!0,{path:"/",expires:Ft});return}r(m)}),c(!1)};if(!i)return null;const d=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:l,gtmType:"accepted-all"}],o=[];return d.forEach(m=>{o.push({variant:m.href?"tertiary":"primary",href:m.href,onClick:m.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${m.gtmType}-click`,children:e.formatMessage({id:`${Rt}buttons_${m.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${Rt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${Rt}text`})}),s.jsx(Xe,{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:Ae["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Ae["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:Ae.support,gtmType:"concierge-email-click"},business:{email:Ae.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 Ie="footer_",pt="SiteFooter",jn=({group:e})=>{const t=$e[e].order||[];let n=!1;return"text"in $e[e]&&(n=$e[e].text),s.jsxs(_.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(M.FormattedMessage,{id:`${Ie}${e}`})}),Array.isArray(t)&&t.length>0&&s.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:c}=$e[e][r],l={};return["legal"].includes(e)&&(l.target="_blank",l.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":c,...l,children:s.jsx(M.FormattedMessage,{id:`${Ie}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&s.jsx("dl",{className:"text-medium",children:n.order.map(r=>s.jsxs(_.Fragment,{children:[s.jsx("dt",{children:s.jsx(M.FormattedMessage,{id:`${Ie}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(M.FormattedMessage,{id:`${Ie}${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(Zt,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":"logo-homepage-link"}),s.jsx("footer",{children:["platform","community","company","contact"].map(e=>s.jsxs("div",{className:"group",children:[s.jsx(jn,{group:e}),Object.keys($e[e]).includes("child")&&s.jsx(jn,{group:$e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray($e.social.order)&&$e.social.order.map(e=>{const t=$e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":pt,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(M.FormattedMessage,{id:`${Ie}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(M.FormattedMessage,{id:`${Ie}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const ct="emailHelperTextBox_",Qr=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const i=M.useIntl(),[c,l]=_.useState({path:`${ct}default`,type:"default",link:{},mail:{},error:""}),[a,d]=_.useState(!1),o=_.useCallback(h=>{h.preventDefault(),h.stopPropagation();const g=w=>{l({path:`${ct}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>o(x),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:w})};if(typeof r!="function"){g(i.formatMessage({id:`${ct}error_noFunction`}));return}d(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(w=>{g(w.message)}).finally(()=>{d(!1)})},[t,n,r]);_.useEffect(()=>{let h=ct,g="default",w={},x={};switch(e){case"gov":h+="autoApproved",g="success";break;case"nonGov":h+="unrecognisedEmail",g="error",w={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":h+="pendingApproval",g="error",x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":h+="emailUnverified",g="error",w={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>o(E),"data-testid":"send-verify-email-click"};break;case"exists":h+="emailAlreadyExists",g="error",w={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},x={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:h+="default",w={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}l({...c,path:h,type:g,link:w,mail:x})},[e]);const m={};return["link","mail"].forEach(h=>{m[h]=Object.keys(c[h]).length?g=>s.jsx("a",{...c[h],children:g}):g=>g}),s.jsx(Qn,{type:c.type,heading:a?!1:i.formatMessage({id:`${c.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(je,{element:"span"}),s.jsx(je,{element:"span"})]}):i.formatMessage({id:`${c.path}_text`},{...m,strong:h=>s.jsx("strong",{children:h}),em:h=>s.jsx("em",{children:h}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:c.error})})};const lt="passwordRules_",rs="isMoreThanEightCharacters",as="includesNumberAndSymbol",os="includesLowerAndUppercase",Ur={[rs]:"8Characters",[as]:"numberSymbol",[os]:"lowercaseUppercase"},Wr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=M.useIntl();return s.jsxs("aside",{className:S("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${lt}intro`})}),s.jsx("ul",{children:[rs,as,os].map(r=>s.jsxs("li",{className:S({matches:e[r]}),children:[s.jsxs(re,{children:[n.formatMessage({id:`${lt}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${lt}rule_${Ur[r]}`})}),!e[r]&&s.jsxs(re,{element:"strong",children:[" "," ",n.formatMessage({id:`${lt}notMet`})]})]},`rule-${r}`))})]})},zr=_.memo(Wr);const Vr=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:c="",hasLoaded:l=!1})=>{const a=M.useIntl(),[d,o]=_.useState({setUp:!1,id:null,rating:null,disabled:!0}),m=async()=>{try{const E=await n();o(k=>({...k,setUp:!0,id:E&&E.id,disabled:!1}))}catch(E){o(k=>({...k,setUp:!0,disabled:!0})),i(E)}};if(_.useEffect(()=>{l&&!d.setUp&&m()},[l]),!l)return s.jsx(je,{className:"rating-placeholder"});const{id:u,rating:p,disabled:h}=d,g="ratings_",w={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},x=async E=>{if(!(!u||h))try{o(k=>({...k,rating:E,disabled:!0})),await r({id:u,value:E})}catch(k){o(b=>({...b,rating:null})),i(k)}finally{o(k=>({...k,disabled:!1}))}};return s.jsxs("div",{className:S("rating",c),children:[s.jsx("span",{className:"label",children:w[p?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(E=>{const k=E+1;return s.jsx("li",{className:S({selected:p&&k<=p}),children:s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:`star${!p||k>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${g}stars`},{number:k,total:t})}${k===1||k===t?` - ${w[k===1?"low":"high"]}`:""}`,onClick:b=>{b.preventDefault(),b.stopPropagation(),x(k)},disabled:h})},`rating-${k}`)})})]})};const is=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:c="form-submission"})=>{const{searchIsOpen:l=!0,isDesktopVersion:a=!1}=n||{},d=M.useIntl(),o=_.useRef(null);Pe(()=>{!n||a||!l||o.current&&o.current.focus()},[l]);const m=u=>{u.preventDefault(),u.stopPropagation(),!(!o.current||!o.current.value||o.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(o.current.value)}`)};return s.jsx("form",{onSubmit:m,className:S("search-form gtm-trackable",t),"data-gtm-event-context":i,"data-gtm-event-type":c,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!l:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(re,{element:"label",htmlFor:e,children:d.formatMessage({id:"search_label"})}),s.jsx("input",{ref:o,type:"search",id:e,name:e,defaultValue:r,placeholder:d.formatMessage({id:"search_placeholder"}),onKeyDown:u=>{u.key==="Enter"&&m(u)}}),s.jsx("button",{className:"clear",onClick:u=>{u.preventDefault(),u.stopPropagation(),o.current&&o.current.value&&(o.current.value="")},children:s.jsx(re,{children:d.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:m,children:s.jsx(re,{children:d.formatMessage({id:"search_cta"})})})]})})})};const cs=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:i,backgroundColor:c,onClose:l,reportError:a,sendInvites:d,initialFormStatus:o="NOT_SUBMITTED"})=>{const[m,u]=_.useState([]),[p,h]=_.useState(!0),[g,w]=_.useState(o),{formatMessage:x}=M.useIntl(),E=async T=>{T.preventDefault();try{await d(m),u([]),w("SUCCESS")}catch(N){w("ERROR"),a(N)}},k=T=>{T.preventDefault(),w("NOT_SUBMITTED"),h(!0),u([])},b=T=>{T.preventDefault(),l(),w("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:x({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",x({id:"inviteForm_error"})]})}),s.jsx(Re,{}),s.jsx("div",{className:"footer",children:g==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"secondary",onClick:k,children:x({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(Q,{onClick:b,children:x({id:"inviteForm_ctaDone"})})]}):s.jsx(Q,{onClick:k,children:x({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:c},onSubmit:E,className:S("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t}),s.jsx(As.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:x({id:"inviteForm_email_placeholder"}),emails:m,onChange:T=>{u(T),h(!T.length)},autoFocus:!1,getLabel:(T,N,D)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:T}),s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{D(N),h(!m.length)},className:"remove-email-button",screenreaderText:x({id:"overlay_close"})})]},N)})]}),s.jsx(Re,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(Q,{className:"sendEmailsButton",disabled:p,children:n})})]})})},U={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=c=>{const l=`logged${e?"In":"Out"}`;return t>=n[c][l]};let i={};return["navigation","search"].forEach(c=>{i[c]=r(c)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!t&&U.handlerCalled[e]&&i-U.handlerCalled[e]<500)return;U.handlerCalled[e]=i;let c=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(l=>{l===e||n[l]===!1||c.push({type:`menus.${l}`,value:!1})}),r(c)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=Mn(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?U.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{if(!t.current||!t.current.children)return;const c=n?"desktop":"default";if(r[e][c]){r[e][c].focus();return}let l,a;switch(e){case"navigation":if(n){const d=U.findFirstChild(t.current.children,"attributes.aria-controls","navigation");l=U.findFirstChild(d.children,"href")}else l=U.findFirstChild(t.current.children,"href");l||(l=t.current);break;case"account":if(a=U.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;l=U.findFirstChild(a.children,"href");break;default:return}l&&(i([{type:`focusElements.${e}.${c}`,value:l}]),l.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(U.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(U.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(U.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{U.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Je={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","q-and-a","articles"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},"q-and-a":{href:"/questions-answers/",className:"icon q-and-a"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},gt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:c=null})=>{const l=M.useIntl(),a=Mn(Je,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const d="doTrack"in a,o=c===null?d?a.doTrack:!0:c,m=e.includes("buttons.");let u=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(u+=`_logged${t?"In":"Out"}`);let p=!1;if(a.href){let k=a.gtmType||`${e}-click`;if(k.includes(".")){const b=k.split("."),T=b[b.length-2];k=`${T==="topics"?`${T}-`:""}${b[b.length-1]}`}p={href:a.href,role:"menuitem"},o&&(p={...p,className:"gtm-trackable","data-gtm-event-type":k,"data-gtm-event-context":"HeaderButtons"}),m&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const h=a.order&&a.order[0]&&a[a.order[0]],g=h&&a[a.order[0]].order,w=p&&window.location.pathname===a.href;let x={},E={};if(h){const k=a.menuId||e,b={onClick:T=>U.events.onClick(T,{id:k,callback:i,isOpen:r[k]}),onFocus:()=>U.events.onFocus({id:k}),onBlur:()=>U.events.onBlur({id:k,callback:i}),onMouseLeave:()=>U.events.onBlur({id:k,callback:i}),onMouseEnter:()=>U.events.onMouseEnter({id:k,callback:i})};n&&(g&&(x={...b,onKeyPress:T=>{T.key==="Enter"&&U.events.onClick(T,{id:k,callback:i,isOpen:r[k]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),E={hidden:k in r?!r[k]:!0}),g||(E={...E,...b})}return s.jsxs("li",{className:S({[a.className]:a.className,"has-submenu":h,parent:g,active:w}),role:"none",...x,children:[p?_.createElement(m?Q:"a",p,l.formatMessage({id:u})):l.formatMessage({id:u}),a.order&&s.jsx("ul",{...E,children:a.order.map(k=>{if(!a[k])return null;const b={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:d?o:null};return a[k].order?s.jsxs("li",{className:S({[a[k].className]:a[k].className}),children:[l.formatMessage({id:`${u}_${k}`}),s.jsx("ul",{children:a[k].order.map(T=>s.jsx(gt,{id:`${e}.${k}.${T}`,...b},T))})]},k):s.jsx(gt,{id:`${e}.${k}`,...b},k)})})]},e)};const Yr={height:67,height_desktop:83},en=({showNavigation:e=!0})=>{const t=M.useIntl(),n=_.useContext(we),r=qe(!0,!0),i=n&&typeof n.id=="string",c=_.useMemo(()=>U.getIsDesktopVersion(i,r),[i,r]),[l,a]=_.useReducer(tr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:d,menus:o,focusElements:m}=l;Rn({scrollPosition:Yr[`height${c.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!c&&o.navigation||U.shouldChangeHeaderIsVisible(!0,o,a)},scrollDown:()=>{!c&&o.navigation||U.shouldChangeHeaderIsVisible(!1,o,a)}}});const u=(h,g)=>{U.handleMenus({id:h,value:g,menus:o,dispatch:a})},p=_.useRef(null);return Pe(()=>{o.navigation&&U.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:c.navigation,focusElements:m,dispatch:a})},[o.navigation]),Pe(()=>{o.account&&U.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:c.navigation,focusElements:m,dispatch:a})},[o.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:S({"logged-in":i,"logged-out":!i,visible:d}),children:[s.jsx(re,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(Zt,{}),e&&s.jsxs(s.Fragment,{children:[!c.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.stopPropagation(),u("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(re,{children:t.formatMessage({id:`header_menu_${o.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:p,id:"navigation",hidden:c.navigation||o.account?!1:!o.navigation,role:"menu","data-showing":!c.navigation&&o.account?"account":"default",children:Je.order.map(h=>s.jsx(gt,{id:h,isLoggedIn:i,isDesktopVersion:c.navigation,menus:{navigation:o.navigation,account:o.account},callback:u},h))}),!c.search&&s.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),u("search",!o.search)},"aria-haspopup":"true","aria-expanded":o.search,"aria-controls":"search-form",children:s.jsx(re,{children:t.formatMessage({id:`header_search_${o.search?"hide":"show"}`})})}),s.jsx(is,{id:"global-search",handleToggle:{searchIsOpen:o.search,isDesktopVersion:c.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),i?s.jsxs("button",{className:"account-button",onClick:h=>U.events.onClick(h,{id:"account",callback:u,isOpen:o.account}),onMouseEnter:()=>U.events.onMouseEnter({id:"account",callback:u}),onMouseLeave:()=>U.events.onBlur({id:"account",callback:u}),"aria-haspopup":"true","aria-expanded":o.account,"aria-controls":"navigation",children:[s.jsx(re,{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(h=>s.jsx(gt,{id:`buttons.${h}`},h))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:S("overlay",{open:o.navigation||o.account||!c.search&&o.search})})]})};const tn=({element:e="section",children:t,className:n,...r})=>_.createElement(e,{className:S("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const nn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:c=()=>{}}={},forceShow:{error:l=!1}={},title:a,children:d,buttons:o,className:m="",gtmContext:u="Modal"})=>{const p=M.useIntl(),[h,g]=_.useState(t),w=E=>{g(E),E?(i(),document.body.classList.add("has-overlay")):(c(),document.body.classList.remove("has-overlay"))};_.useEffect(()=>{w(t)},[t]);const x=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:S("overlay",{open:h}),children:s.jsx(tn,{id:e,className:S("overlay-modal",m,{"has-max-width":r}),hidden:!h,style:x,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:()=>w(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":u,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Re,{}),d,o&&s.jsxs("div",{className:"bottom",children:[s.jsx(Re,{}),s.jsx(Xe,{buttons:o})]}),l&&s.jsx(ht,{className:"error",children:l})]})})})},ls=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Gr=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:i="Invite your colleagues by typing or pasting their emails below.",ctaMessage:c="Send",showIcon:l,onClose:a,reportError:d=()=>{},sendInvites:o})=>s.jsx(nn,{title:n,isOpen:t,showDivider:!1,showIcon:l,functions:{onClose:a},className:S("invite-modal",e,{success:!!n}),children:s.jsx(cs,{title:r,label:i,ctaMessage:c,onClose:a,sendInvites:o,reportError:d})});const Jr=()=>{const e=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(en,{}),s.jsx("div",{id:"content",children:s.jsx(Ke,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Kt,{})]})},us=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:c={},className:l="",locale:a="en"})=>{const{navigation:d=!0,footer:o=!0}=i,{background:m="default",variant:u="default",circle:p="default"}=c,h=Nn();_.useEffect(()=>{window.scrollTo(0,0)},[h]);const g=ft(e,{locale:a}),w=ft(t,{locale:a}),x=ft(n,{locale:a}),E={};return m!=="default"&&(E[m]=!0),u!=="default"&&(E[u]=!0),p!=="default"&&(E[p]=!0),s.jsx(Is.ErrorBoundary,{onError:r,fallback:s.jsx(Jr,{}),children:s.jsx(_.Suspense,{fallback:null,children:s.jsxs("div",{id:"wrapper",className:S(l,E,{"has-footer":o}),children:[s.jsx(en,{showNavigation:d}),s.jsxs("section",{id:"content-wrapper",children:[w&&s.jsx("div",{className:"additional-content prepended",children:w}),_.createElement(m==="bold"?tn:"div",{id:"content",children:g})]}),x&&s.jsx("div",{className:"additional-content appended",children:x}),o&&s.jsx(Kt,{}),s.jsx(ss,{})]})})})},yn={default:"tags_",headerTopics:"header_topics_topics_"},At={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"},qr={getTagDetails:e=>{if(e.includes("topic_")){if(e=At.topic[e.replace("topic_","")],e){const t=Je.topics.topics[e].href;return t?{id:e,href:t,text:`${yn.headerTopics}${e}`}:null}return null}return At[e]?(e=At[e],{id:e,text:`${yn.default}${e}`}):null}};const Xr=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:c="tag-click",gtmContext:l="tags"})=>{const a=M.useIntl();if(!e||e.length<1)return null;const d=[];return e.forEach(o=>{if(!o)return;const m=qr.getTagDetails(o);m&&d.push(m)}),d.length<1?null:s.jsx("ul",{className:S("tags text-small",t,i,{"one-line":n}),children:d.map(o=>{const m=a.formatMessage({id:o.text});return s.jsx("li",{children:o.href&&r?s.jsx("a",{href:o.href,className:"gtm-trackable","data-gtm-event-type":c,"data-gtm-event-context":l,children:m}):m},o.id)})})};const Zr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:i="member-click",className:c=""})=>{const l=M.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:S("members-list",c),children:[s.jsxs("h1",{children:[l.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((a,d)=>s.jsxs("li",{children:[s.jsx(vt,{member:a,gtmContext:r,gtmType:i}),a.isAdmin&&s.jsx(Ge,{children:l.formatMessage({id:"membersList_admin"})})]},d))}),n&&s.jsx(Kn,{hasNextPage:!0,loadNextPage:()=>{},icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let ut=null;const fe="discussion_form_",sn=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:i=5e4,minRows:c=4,forceShow:l={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:d="DiscussionForm"})=>{var H,F;const o=M.useIntl(),m=_.useContext(we),[u,p]=_.useState(n.isEditing&&n.isEditing.text||""),[h,g]=_.useState(l.error||!1),[w,x]=_.useState(!1),E=_.useRef(null);if(r||(r=E),n.isLoading)return s.jsx(je,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const k=v=>{const V=v.target.value;p(V);let j;!m||!m.id?j=ye(o.formatMessage,`${fe}error_loggedOut`,e.type,"action"):t?V.length>=i&&(j=`${fe}error_tooLong`):j=ye(o.formatMessage,`${fe}error_noPermission`,e.type,"action"),j?g(j):h&&g(!1)};let b=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const v=e.type==="response"?((H=e.slugs)==null?void 0:H.question)||"":((F=e.slugs)==null?void 0:F.answer)||"";v&&(b=`${b}-${v.slice(-15)}`)}const T=async v=>{var j;if(v.preventDefault(),v.stopPropagation(),!m||!m.id||!t||D)return;ut&&clearTimeout(ut),x("submitting");const V=window.location.pathname;try{let A;switch(e.type){case"post":A=await a.create({content:u});break;case"question":A=await a.create({title:u,authorId:m&&m.id,...(j=a.props)==null?void 0:j.create});break;case"response":A=await a.create({question:e.slugs.question},{body:u,authorId:m&&m.id,contentPath:V});break;case"reply":A=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:u,authorId:m&&m.id,contentPath:V});break;default:break}await nr(1e3),a.callback&&await a.callback(A),ut=setTimeout(()=>{p(""),x("submitted"),N()},500)}catch(A){const G=A;let J=`${fe}error`;G.message.includes("entry already exists")&&(J=ye(o.formatMessage,`${fe}error_alreadyExists`,e.type,"action")),G.message.includes("429")?J=ye(o.formatMessage,`${fe}error_tooMany`,e.type,"action"):G.message.includes("400")&&(J=`${fe}error`),g(J),N()}},N=()=>{ut=setTimeout(()=>{g(!1),x(!1)},5e3)},D=!u||!er(u),P=w==="submitting",L=[];return(n.isEditing&&!P||l.cancel)&&L.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!l.cancel&&(!m||!m.id||!u),children:o.formatMessage({id:`${fe}cancel`})}),L.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:v=>{if(n.isEditing){x("submitting"),a.handleSaveEdit&&a.handleSaveEdit(E.current&&"value"in E.current?E.current.value:"");return}T(v)},className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!t||D||P||n.isEditing&&u===n.isEditing.text,children:o.formatMessage({id:`${fe}${P?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:b,className:S("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,`${fe}title`,e.type,"action")}),s.jsx(vt,{member:m||"community",gtmContext:d,gtmType:"profile-click"}),s.jsx(re,{element:"label",showOnFocus:!1,htmlFor:`${b}-input`,children:ye(o.formatMessage,`${fe}label`,e.type,"action")}),s.jsx(Ls,{ref:r,id:`${b}-input`,name:e.type,placeholder:ye(o.formatMessage,`${fe}placeholder`,e.type,"action"),onChange:k,value:u,maxLength:i,"aria-invalid":!!h,"aria-errormessage":"error-message",minRows:c,autoFocus:!!n.isEditing}),s.jsx("small",{children:ye(o.formatMessage,`${fe}explainer`,e.type,"action",{a:v=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:v})})}),s.jsx(Xe,{buttons:L}),w==="submitted"&&s.jsx(ht,{className:"success","data-testid":"success",children:ye(o.formatMessage,`${fe}success`,e.type,"action")}),h&&s.jsx(ht,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof h=="string"?h.includes(" ")?h:o.formatMessage({id:h},{action:o.formatMessage({id:`discussion_action_${e.type}`}),maxLength:i}):h})]})},wt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:i,leave:c,notMemberStateText:l}})=>r&&!n?s.jsx(Ke,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:s.jsx(Xt,{isShort:!0,functions:{join:i,leave:c}})}}):s.jsx(sn,{content:{type:e,slugs:{}},functions:{create:t}}),Kr={showThread:!1,showForm:!1},et=_.createContext(Kr),ds=({children:e})=>{const[t,n]=_.useState({showThread:!1,showForm:!1});return s.jsx(et.Provider,{value:{...t,updateConversation:n},children:e})},ea=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),ta=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ve=!1;const It=()=>{Ve!==!1&&(clearTimeout(Ve),Ve=!1)},Lt=5,ms=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:c={type:"reply",slugs:{}},canLike:l=!0,functions:{createLike:a=()=>{},deleteLike:d=()=>{}}={}})=>{const o=M.useIntl();_.useEffect(()=>{h(i)},[i]);const[m,u]=_.useState(t),[p,h]=_.useState(i),[g,w]=_.useState(!1),[x,E]=_.useState(!1),k=_.useMemo(()=>ta(n,Lt),[n]),b=N=>{if(N.preventDefault(),N.stopPropagation(),E(!1),Ve)return It(),!1;if(It(),g||!l)return!1;Ve=setTimeout(T,350)},T=async()=>{if(It(),g||!l)return!1;let N=p?m-1:m+1;N<0&&(N=0),w(!0),u(N),h(!p);try{if(c&&c.slugs){const D=ea(c.slugs);p?await d(D):await a(D,{contentPath:window.location.pathname})}}catch{u(t),h(i)}finally{w(!1)}};return _.createElement(e,{className:S("likes-wrapper text-medium action-button",{"show-spinner":g,"is-liked":p,disabled:!l}),onClick:b,onMouseEnter:()=>{E(!0)},onMouseLeave:()=>{E(!1)},onFocus:()=>{E(!0)},onBlur:()=>{E(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:p?"heart":"heart_empty",animate:"bounce"},className:S({"do-animation":p&&!i}),screenreaderText:l?o.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:o.formatMessage({id:`discussion_action_${c.type}`})}):!1,onClick:b,disabled:!l,"aria-hidden":!l,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${c.type}-click`}),s.jsx("span",{className:S("number-of-likes",{"no-likes":m===0}),"data-testid":"number-of-likes",children:o.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})}),n&&s.jsx(On,{isOpen:x,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[k.map(N=>typeof N=="string"||!N.name?null:s.jsx("li",{children:s.jsx(Ze,{href:N.id?`/profiles/${N.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:D=>D==null?void 0:D.stopPropagation(),children:N.name})},N.id||window.btoa(N.name))),n.length>Lt&&s.jsx("li",{children:o.formatMessage({id:"discussion_likes_more"},{number:n.length-Lt})})]})})]})})},En=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},rn=(e,t)=>e&&!t;const Se="discussion_",na=280,tt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:i,functions:{content:{createContent:c,deleteContent:l,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:d,deleteLike:o}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}}},links:u={},className:p,gtmContext:h="DiscussionAnswer",children:g,isTruncated:w=!1})=>{const x=M.useIntl(),E=_.useContext(we),k=_.useContext(et),[b,T]=_.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[N,D]=_.useState(!1),[P,L]=_.useState("");if(_.useEffect(()=>{T({...b,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(je,{className:"discussion-card discussion-post"});const{author:H,canLike:F,createdAt:v,id:V,likes:j=0,userLiked:A,comments:G=0}=t,J=w?Le(b.body,na):b.body,ae=E&&E.id&&typeof H!="string"&&H.id&&H.id===E.id||!1,Y=typeof F=="boolean"?F:n?!ae:!1,te=async B=>{B||(B=""),L("");try{if(!Bs(B,b.body)){const ce=t.type==="question"?{title:B}:{body:B};await a(En(t.slugs),ce)}T({body:B,isEditing:!1,didEdit:!0})}catch{L(`${Se}form_error`)}},oe=()=>{k&&k.updateConversation&&k.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const ce=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,he=document.getElementById(ce),le=document.getElementById(`${ce}-input`);le&&le.focus(),he&&he.scrollIntoView({behavior:"smooth"})},0)},ie=()=>{D(!1);try{l(En(t.slugs))}catch{L("delete-error")}},me=[{text:x.formatMessage({id:`${Se}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(x.formatMessage({id:`${Se}report_subject`}))}&body=${encodeURI(x.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&&ae&&me.push({text:x.formatMessage({id:`${Se}moreMenu_edit`}),onClick:()=>T({...b,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`edit-${t.type}-click`},{text:x.formatMessage({id:`${Se}moreMenu_delete`}),onClick:B=>{B.preventDefault(),B.stopPropagation(),D(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`delete-${t.type}-click`,...ls(`delete-${t.slug}-modal`,N)}),_.createElement(e,{className:S("discussion-post",p),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:V||t.slug,className:S("discussion-card",t.type,{editing:b.isEditing,"has-link":u.post&&!b.isEditing}),onClick:B=>{!u.post||b.isEditing||(B.preventDefault(),B.stopPropagation(),window.location.href=u.post)},children:[!b.isEditing&&s.jsx(vt,{member:H,additionalContent:{createdAt:v,didEdit:b.didEdit},className:typeof H!="string"&&H.id===i?"highlighted":"",gtmContext:h,gtmType:"profile-click"}),b.isEditing?s.jsx(sn,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:b.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:P!==""&&P!=="delete-error"?x.formatMessage({id:P},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:c,handleSaveEdit:te,handleCancel:()=>{L(""),T({...b,isEditing:!1})}},gtmContext:`${h}Form`}):u.post?s.jsx("a",{href:u.post,className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":"title-click",children:s.jsx(Ut,{options:{overrides:{a:Un}},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}),!b.isEditing&&s.jsxs("ul",{className:S("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(ms,{element:"li",likes:j,isShort:!1,userLiked:A,content:{type:t.type,slugs:t.slugs},canLike:Y,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:d,deleteLike:o}}),(["question","post"].includes(t.type)||u.comments||typeof m=="function")&&s.jsxs("li",{className:"action-button",onClick:B=>{B.preventDefault(),B.stopPropagation(),u.comments&&(window.location.href=u.comments),typeof m=="function"&&m()},children:[s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:u.comments?u.comments:!1,onClick:u.comments||typeof m!="function"?!1:m,className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:x.formatMessage({id:`${Se}comments_screenReader`},{count:G})}),s.jsx("span",{children:x.formatMessage({id:`${Se}comments`},{count:G})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:oe,children:x.formatMessage({id:`${Se}reply`})})}),s.jsx(es,{element:"li",id:`more-${t.slug}`,options:me})]})]}),g,s.jsx(nn,{id:`delete-${t.slug}-modal`,isOpen:N,functions:{onOpen:()=>{},onClose:()=>D(!1)},forceShow:{error:P==="delete-error"?x.formatMessage({id:"discussion_delete_error"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:x.formatMessage({id:"discussion_delete_title"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>D(!1),children:x.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ie,children:x.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(M.FormattedMessage,{id:"discussion_delete_text",values:{p:B=>s.jsx("p",{children:B}),action:x.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Bt="discussion_responses_",sa=({type:e="answer",responses:t=0})=>{const n=M.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${Bt}title`},{action:n.formatMessage({id:`${Bt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ye(n.formatMessage,`${Bt}empty`,e,e)})]})};const fs=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=M.useIntl(),i=_.useRef(null),c=_.useContext(et),[l,a]=_.useState("closed");_.useEffect(()=>{const u=i.current;if(u)return u.addEventListener("transitionend",d),()=>{u.removeEventListener("transitionend",d)}},[]),Pe(()=>{l==="closed"&&!c.showThread||a(["opening","open"].includes(l)?"ready-to-close":"opening")},[c.showThread]),_.useEffect(()=>{l==="ready-to-close"&&a("closing")},[l]);const d=({propertyName:u})=>{u==="max-height"&&a(p=>p==="opening"?"open":p==="closing"?"closed":p)},o=["opening","open"].includes(l),m=ft(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(Q,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${o?"left":"right"}`},onClick:()=>{var u;(u=c.updateConversation)==null||u.call(c,p=>({showThread:!p.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${o?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:i,className:S("thread",l),hidden:!c.showThread,children:m})]})};function ra({queryClient:e,queryKey:t}){function n(r,i,c){if(c){const{data:l}=c;e.setQueryData(t,l)}}return n}function aa({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return e.setQueryData(t,r),{data:i}}return n}function hs(e){var t;return{id:e==null?void 0:e.id,data:{name:e==null?void 0:e.name,organization:e==null?void 0:e.organization,jobTitle:e==null?void 0:e.jobTitle,thumbnail:(t=e==null?void 0:e.image)==null?void 0:t.thumbnail}}}function ps(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function oa({content:e,user:t,verb:n="post"}){return{id:"00000000-0000-0000-0000-000000000000",actor:hs(t),content:e,time:new Date().toISOString(),verb:n,...ps()}}function ia({activity:e,user:t}){return{...e,actor:hs(t),...ps()}}function ca({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:c}){return z.useMutation({mutationFn:e,onMutate:({content:l})=>t(a=>[oa({content:l,user:c}),...a]),onError:n,onSuccess:(l,a,d)=>{const o=(d==null?void 0:d.data)||[];r.setQueryData(i,[ia({activity:l,user:c}),...o])}})}function la({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){return z.useMutation({mutationFn:e,onMutate:({activityId:r,body:i})=>t(c=>{const l=c.find(({id:a})=>a===r);return l&&(l.content=i),c}),onError:n})}function ua({queryKey:e,queryFns:{create:t,edit:n,like:r,list:i,remove:c,unlike:l}}){const a=z.useQueryClient(),d=Xn(),o={queryClient:a,queryKey:e},m={mutationHandlers:{error:ra(o),mutate:aa(o)},user:d,...o},{mutate:u}=ca({...m,mutationFn:t}),{mutate:p}=la({...m,mutationFn:n}),{mutate:h}=da({...m,mutationFn:r}),{mutate:g}=fa({...m,mutationFn:c}),{mutate:w}=ha({...m,mutationFn:l}),{activities:x,...E}=ma({queryKey:e,queryFn:i});return{activities:x,mutations:{create:u,edit:p,remove:g,like:h,unlike:w},user:d,...E}}function da({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){return z.useMutation({mutationFn:e,onMutate:({activityId:c})=>t(l=>{const a=l.find(({id:d})=>d===c);if(a){const{reaction_counts:d}=a;d&&(d.like=(d==null?void 0:d.like)+1||1)}return l}),onError:n,onSuccess:(c,{activityId:l},a)=>{const d=(a==null?void 0:a.data)||[],o=d.find(({id:m})=>m===l);if(o){const{latest_reactions:m,own_reactions:u}=o;m&&(m.like=[...m.like||[],c]),u&&(u.like=[...u.like||[],c])}r.setQueryData(i,d)}})}function ma({queryKey:e,queryFn:t}){const{data:n,error:r,isFetching:i,isLoading:c}=z.useQuery({queryKey:e,queryFn:t});return{activities:n,error:r,isFetching:i,isLoading:c}}function fa({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){return z.useMutation({mutationFn:e,onMutate:({activityId:r})=>t(i=>i.filter(({id:c})=>c!==r)),onError:n})}function ha({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:c}){return z.useMutation({mutationFn:e,onMutate:({activityId:l})=>t(a=>{const d=a.find(({id:o})=>o===l);if(d){const{reaction_counts:o}=d;o&&(o.like=(o==null?void 0:o.like)-1||0)}return a}),onError:n,onSuccess:(l,{activityId:a},d)=>{var u,p;const o=(d==null?void 0:d.data)||[],m=o.find(({id:h})=>h===a);if(m){const{latest_reactions:h,own_reactions:g}=m;h&&(h.like=(u=h.like)==null?void 0:u.filter(({user_id:w})=>w!==c.id)),g&&(g.like=(p=g.like)==null?void 0:p.filter(({user_id:w})=>w!==c.id))}r.setQueryData(i,o)}})}const pa=({basePath:e,parentId:t,isMember:n,functions:{join:r,leave:i,...c}})=>{const l=M.useIntl(),{activities:a,error:d,isFetching:o,mutations:{create:m,edit:u,remove:p,like:h,unlike:g},user:w}=ua({queryKey:[e,t],queryFns:c});return d?s.jsx(Ke,{variant:"error",text:d.message}):s.jsxs("section",{children:[s.jsx(wt,{contentType:"post",createPost:m,membershipRequiredToPost:{isMember:n,required:!0,join:r,leave:i,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),!o&&Array.isArray(a)&&(a==null?void 0:a.map(x=>{var H,F,v,V,j,A,G,J,ae;const{own_reactions:E,latest_reactions:k}=x,b=(((H=k==null?void 0:k.like)==null?void 0:H.length)||0)>0,T=(((F=E==null?void 0:E.like)==null?void 0:F.length)||0)>0,N=T?E==null?void 0:E.like[0].id:null,D=b?(v=k==null?void 0:k.like)==null?void 0:v.map(Y=>{var te,oe,ie;return{id:(te=Y==null?void 0:Y.user)==null?void 0:te.id,name:(ie=(oe=Y==null?void 0:Y.user)==null?void 0:oe.data)==null?void 0:ie.name}}):!1,P=x==null?void 0:x.actor,L=(P==null?void 0:P.id)===(w==null?void 0:w.id);return s.jsxs(_.Fragment,{children:[s.jsx(tt,{content:{type:"post",body:x==null?void 0:x.content,canLike:rn(n,L),createdAt:(x==null?void 0:x.time)||"",slugs:{parentId:t,activityId:x==null?void 0:x.id},slug:x==null?void 0:x.id,author:{id:P==null?void 0:P.id,name:(V=P==null?void 0:P.data)==null?void 0:V.name,organization:(j=P==null?void 0:P.data)==null?void 0:j.organization,jobTitle:(A=P==null?void 0:P.data)==null?void 0:A.jobTitle,image:{thumbnail:((G=P==null?void 0:P.data)==null?void 0:G.thumbnail)||void 0}},userLiked:T,likes:((J=x==null?void 0:x.reaction_counts)==null?void 0:J.like)||0,comments:((ae=x==null?void 0:x.reaction_counts)==null?void 0:ae.reply)||0,peopleWhoLiked:D},links:{post:`${e}/${t}/${x==null?void 0:x.id}`,comments:`${e}/${t}/${x==null?void 0:x.id}`},functions:{content:{createContent:()=>null,deleteContent:Y=>p(Y),updateContent:(Y,te)=>u({...Y,...te})},likes:{createLike:()=>h({activityId:x==null?void 0:x.id}),deleteLike:()=>g({activityId:x==null?void 0:x.id,reactionId:N})},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(Re,{})]},x==null?void 0:x.id)}))]})},ga=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,d,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{var o;const d=e.getQueryData(t);if(d)return(o=d==null?void 0:d.latest_reactions)!=null&&o.reply?(d.latest_reactions.reply.unshift(a),d&&(d.reaction_counts={reply:d.latest_reactions.reply.length})):(d.latest_reactions={reply:[a]},d.reaction_counts={reply:1}),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),_a=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:c,content:{body:l}})=>{var o,m,u;if(l.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 d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>(p.id===c.replySlug&&(p.data.content=l),p));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}},onError:(c,l,a)=>{e.setQueryData(t,a.previousActivity)}}),xa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:c})=>{var d,o,m;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);if(!l||!((d=l==null?void 0:l.latest_reactions)!=null&&d.reply))return;const a=(m=(o=l==null?void 0:l.latest_reactions)==null?void 0:o.reply)==null?void 0:m.filter(u=>u.id!==c);return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}},onError:(c,l,a)=>{e.setQueryData(t,a.previousActivity)}}),ba=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:l})=>{var o,m;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),d=(m=(o=a==null?void 0:a.latest_reactions)==null?void 0:o.reply)==null?void 0:m.map(u=>{var p;return u.id===l&&((p=u.children_counts)!=null&&p.like?u.children_counts.like+=1:u.children_counts={like:1}),u});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}},onError:(l,a,d)=>{e.setQueryData(t,d.previousActivity)},onSuccess:l=>{var o;const a=e.getQueryData(t),d=(o=a==null?void 0:a.latest_reactions.reply)==null?void 0:o.map(m=>{var u,p;return m.id===l.id&&((u=m.own_children)!=null&&u.like?m.own_children.like.push(l):m.own_children={like:[l]},(p=m.latest_children)!=null&&p.like?m.latest_children.like.push(l):m.latest_children={like:[l]}),m});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),va=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var m;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);if(!d)return;const o=(m=d.latest_reactions.reply)==null?void 0:m.map(u=>(u.id===a&&u.children_counts.like&&(u.children_counts.like-=1),u));return e.setQueryData(t,()=>({...d,latest_reactions:{reply:o}})),{previousActivity:d}},onError:(a,d,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,{replyId:d})=>{var u;const o=e.getQueryData(t);if(!o)return;const m=(u=o.latest_reactions.reply)==null?void 0:u.map(p=>{var h,g,w;if(p.id===d){let x=(h=p.latest_children.reply)==null?void 0:h.filter(E=>E.user_id!==(n==null?void 0:n.id));return x=(w=(g=p==null?void 0:p.own_children)==null?void 0:g.reply)==null?void 0:w.filter(E=>E.user_id!==(n==null?void 0:n.id)),x}return p});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}}}),wa=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:a=>{var m;const d=e.getQueryData(t),o=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>(u.id===a.parent&&(u.latest_children.reply&&u.children_counts.reply?(u.latest_children.reply.push(a),u.children_counts.reply+=1):(u.latest_children.reply=[a],u.children_counts.reply=1)),u));return e.setQueryData(t,()=>({...d,latest_reactions:{reply:o}})),{previousActivity:d}},onError:(a,d,o)=>{e.setQueryData(t,o.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),ka=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(c,l,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyInfo:c,content:{body:l}})=>{var o,m,u;if(l.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 d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>{var h;return p.id===c.replyParentId&&((h=p.latest_children.reply)==null||h.map(g=>(g.id===c.replySlug&&(g.data.content=l),g))),p});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),ja=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(c,l,a)=>{e.setQueryData(t,a.previousActivity)},onMutate:async({replyId:c,replyParentId:l})=>{var o,m,u;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 d=(u=(m=a==null?void 0:a.latest_reactions)==null?void 0:m.reply)==null?void 0:u.map(p=>{var h,g;return p.id===l&&(p.latest_children.reply=(h=p.latest_children.reply)==null?void 0:h.filter(w=>w.id!==c),(g=p.children_counts)!=null&&g.reply&&(p.children_counts.reply-=1)),p});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:d}})),{previousActivity:a}}}),ya=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:l,replyParentId:a})=>{var m;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t),o=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>{var p;return u.id===a&&((p=u.latest_children.reply)==null||p.map(h=>{var g;return h.id===l&&((g=h.children_counts)!=null&&g.like?h.children_counts.like+=1:h.children_counts={like:1}),h})),u});return e.setQueryData(t,()=>({...d,latest_reactions:{reply:o}})),{previousActivity:d}},onError:(l,a,d)=>{e.setQueryData(t,d.previousActivity)},onSuccess:(l,a)=>{var m;const d=e.getQueryData(t),o=(m=d==null?void 0:d.latest_reactions.reply)==null?void 0:m.map(u=>{var p;return u.id===a.replyParentId&&((p=u.latest_children.reply)==null||p.map(h=>(h.id===a.replyId&&(h.latest_children=h.latest_children||{},h.own_children=h.own_children||{},h.latest_children.like=h.latest_children.like||[],h.own_children.like=h.own_children.like||[],h.latest_children.like.push(l),h.own_children.like.push(l)),h))),u});return e.setQueryData(t,()=>({...d,latest_reactions:{reply:o}})),{previousActivity:d}}}),Ea=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:a,replyParentId:d})=>{var u;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),m=(u=o==null?void 0:o.latest_reactions.reply)==null?void 0:u.map(p=>{var h;return p.id===d&&((h=p.latest_children.reply)==null||h.map(g=>{var w;return g.id===a&&((w=g.children_counts)!=null&&w.like?g.children_counts.like-=1:g.children_counts={like:0}),g})),p});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}},onError:(a,d,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:(a,d)=>{var u;const o=e.getQueryData(t),m=(u=o==null?void 0:o.latest_reactions.reply)==null?void 0:u.map(p=>{var h;return p.id===d.replyParentId&&((h=p.latest_children.reply)==null||h.map(g=>{var w,x;return g.id===d.replyId&&((w=g.own_children)!=null&&w.like&&(g.own_children.like=g.own_children.like.filter(E=>E.user_id!==(r==null?void 0:r.id))),(x=g.latest_children)!=null&&x.like&&(g.latest_children.like=g.latest_children.like.filter(E=>E.user_id!==(r==null?void 0:r.id)))),g})),p});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:m}})),{previousActivity:o}}}),Sa=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:i,replies:c,functions:{create:l,edit:a,remove:d,join:o,leave:m,like:u,unlike:p}})=>{const h=M.useIntl(),g=z.useQueryClient(),w=_.useContext(we),x=_.useContext(et),E=wa({queryClient:g,queryKey:[e,t,r],mutationFn:async j=>l({replyId:n,content:j.body})}),{mutate:k}=z.useMutation(E),b=ka({queryClient:g,queryKey:[e,t,r],mutationFn:a}),{mutate:T}=z.useMutation(b),N=ja({queryClient:g,queryKey:[e,t,r],mutationFn:async({replyId:j})=>d({replyId:j})}),{mutate:D}=z.useMutation(N),P=ya({queryClient:g,queryKey:[e,t,r],mutationFn:u}),{mutate:L}=z.useMutation(P),H=Ea({queryClient:g,queryKey:[e,t,r],user:w,mutationFn:p}),{mutate:F}=z.useMutation(H),v=_.useCallback(({replyId:j,replyParentId:A})=>L({replyId:j,replyParentId:A}),[L]),V=_.useCallback(({replyId:j,replyParentId:A})=>F({replyId:j,replyParentId:A}),[F]);return s.jsx(fs,{count:i,showRepliesButton:i>0||x.showForm,children:s.jsxs(s.Fragment,{children:[x.showForm&&s.jsx(wt,{contentType:"reply",createPost:(j,A)=>k(A),membershipRequiredToPost:{isMember:!0,required:!0,join:o,leave:m,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(c==null?void 0:c.length)===0||(c==null?void 0:c.map(j=>{var A,G,J,ae,Y,te,oe,ie,me,B,ce,he,le,xe,pe,be,ge;return s.jsx(tt,{content:{type:"reply",body:typeof j.data.content=="string"?(A=j==null?void 0:j.data)==null?void 0:A.content:((J=(G=j==null?void 0:j.data)==null?void 0:G.content)==null?void 0:J.text)||"",createdAt:j==null?void 0:j.created_at,slugs:{parentId:t,activityId:r,replyParentId:j==null?void 0:j.parent,reply:j==null?void 0:j.id},slug:"",author:{id:(ae=j==null?void 0:j.user)==null?void 0:ae.id,name:(te=(Y=j==null?void 0:j.user)==null?void 0:Y.data)==null?void 0:te.name,organization:(ie=(oe=j==null?void 0:j.user)==null?void 0:oe.data)==null?void 0:ie.organization,jobTitle:(B=(me=j==null?void 0:j.user)==null?void 0:me.data)==null?void 0:B.jobTitle,image:{thumbnail:((he=(ce=j==null?void 0:j.user)==null?void 0:ce.data)==null?void 0:he.thumbnail)||void 0}},userLiked:((le=j==null?void 0:j.own_children)==null?void 0:le.like)&&((xe=j==null?void 0:j.own_children)==null?void 0:xe.like.length)>0,likes:((pe=j==null?void 0:j.children_counts)==null?void 0:pe.like)||0,peopleWhoLiked:((be=j==null?void 0:j.latest_children)==null?void 0:be.like)&&((ge=j==null?void 0:j.latest_children)==null?void 0:ge.like.map(X=>{var ne,ue;return{id:X==null?void 0:X.user_id,name:(ue=(ne=X==null?void 0:X.user)==null?void 0:ne.data)==null?void 0:ue.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:X=>{const{replySlug:ne,replyParentId:ue}=X;return D({replyId:ne,replyParentId:ue})},updateContent:(X,ne)=>T({replyInfo:X,content:ne})},likes:{createLike:()=>v({replyId:j==null?void 0:j.id,replyParentId:j==null?void 0:j.parent}),deleteLike:()=>{var ne,ue,Z;const X=((ne=j==null?void 0:j.own_children)==null?void 0:ne.like)&&((Z=(ue=j==null?void 0:j.own_children)==null?void 0:ue.like[0])==null?void 0:Z.id);return V({replyId:X||""})}},comments:{}}},j==null?void 0:j.id)}))]})})},gs=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:i,functions:{create:c,edit:l,remove:a,like:d,unlike:o,join:m,leave:u}})=>{const p=M.useIntl(),h=z.useQueryClient(),g=_.useContext(we),w=ga({queryClient:h,queryKey:[e,t,n],mutationFn:async v=>c({activityId:n,content:v.body})}),{mutate:x}=z.useMutation(w),E=_a({queryClient:h,queryKey:[e,t,n],mutationFn:async v=>l(v)}),{mutate:k}=z.useMutation(E),b=xa({queryClient:h,queryKey:[e,t,n],mutationFn:async({replyId:v})=>a({replyId:v})}),{mutate:T}=z.useMutation(b),N=ba({queryClient:h,queryKey:[e,t,n],mutationFn:d}),{mutate:D}=z.useMutation(N),P=va({queryClient:h,queryKey:[e,t,n],user:g,mutationFn:o}),{mutate:L}=z.useMutation(P),H=_.useCallback(({replyId:v})=>D({replyId:v}),[D]),F=_.useCallback(({replyId:v})=>L({replyId:v}),[L]);return Dn(),s.jsxs(s.Fragment,{children:[s.jsx(wt,{contentType:"reply",createPost:(v,V)=>x(V),membershipRequiredToPost:{isMember:i,required:!0,join:m,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(v=>{var A,G,J,ae,Y,te,oe,ie,me,B,ce,he,le,xe,pe,be,ge,X,ne,ue;const V=((A=v==null?void 0:v.user)==null?void 0:A.id)===(g==null?void 0:g.id),j=rn(i,V);return s.jsx(ds,{children:s.jsx(tt,{content:{type:"reply",body:typeof v.data.content=="string"?(G=v==null?void 0:v.data)==null?void 0:G.content:((ae=(J=v==null?void 0:v.data)==null?void 0:J.content)==null?void 0:ae.text)||"",canLike:j,createdAt:v==null?void 0:v.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:v==null?void 0:v.id},slug:v==null?void 0:v.id,author:{id:(Y=v==null?void 0:v.user)==null?void 0:Y.id,name:(oe=(te=v==null?void 0:v.user)==null?void 0:te.data)==null?void 0:oe.name,organization:(me=(ie=v==null?void 0:v.user)==null?void 0:ie.data)==null?void 0:me.organization,jobTitle:(ce=(B=v==null?void 0:v.user)==null?void 0:B.data)==null?void 0:ce.jobTitle,image:{thumbnail:((le=(he=v==null?void 0:v.user)==null?void 0:he.data)==null?void 0:le.thumbnail)||void 0}},userLiked:((xe=v==null?void 0:v.own_children)==null?void 0:xe.like)&&((pe=v==null?void 0:v.own_children)==null?void 0:pe.like.length)>0,likes:((be=v==null?void 0:v.children_counts)==null?void 0:be.like)||0,peopleWhoLiked:((ge=v==null?void 0:v.latest_children)==null?void 0:ge.like)&&((X=v==null?void 0:v.latest_children)==null?void 0:X.like.map(Z=>{var se,_e;return{id:Z==null?void 0:Z.user_id,name:(_e=(se=Z==null?void 0:Z.user)==null?void 0:se.data)==null?void 0:_e.name}}))},functions:{content:{createContent:()=>null,deleteContent:Z=>{const{replySlug:se}=Z;return T({replyId:se})},updateContent:(Z,se)=>k({replyInfo:Z,content:se})},likes:{createLike:()=>H({replyId:v==null?void 0:v.id}),deleteLike:()=>{var se,_e,Me;const Z=((se=v==null?void 0:v.own_children)==null?void 0:se.like)&&((Me=(_e=v==null?void 0:v.own_children)==null?void 0:_e.like[0])==null?void 0:Me.id);return F({replyId:Z||""})}},comments:{}},children:s.jsx(Sa,{basePath:e,parentId:t,replyParentId:v==null?void 0:v.id,activityId:n,replyCount:((ne=v==null?void 0:v.children_counts)==null?void 0:ne.reply)||0,replies:(ue=v==null?void 0:v.latest_children)==null?void 0:ue.reply,isMember:i,functions:{create:c,edit:l,remove:a,like:d,unlike:o,join:m,leave:u}})},v==null?void 0:v.id)},v==null?void 0:v.id)}))]})},$a=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:l,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);return d&&d.id===(l==null?void 0:l.activityId)&&(d.content=a),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onError:(l,a,d)=>{e.setQueryData(t,d.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ta=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),Ma=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var d;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(d=a==null?void 0:a.reaction_counts)!=null&&d.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,d,o)=>{e.setQueryData(t,o.previousActivity)},onSuccess:a=>{const d=e.getQueryData(t);return d!=null&&d.own_reactions.like?d.own_reactions.like.push(a):d&&(d.own_reactions={like:[a]}),d!=null&&d.latest_reactions.like?d.latest_reactions.like.push(a):d&&(d.own_reactions={like:[a]}),e.setQueryData(t,()=>({...d})),{previousActivity:d}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ca=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:i})=>({mutationFn:i,onMutate:async()=>{var m;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(m=o==null?void 0:o.reaction_counts)!=null&&m.like&&o.reaction_counts.like>0&&(o.reaction_counts.like-=1),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,m,u)=>{e.setQueryData(t,u.previousActivity)},onSuccess:()=>{var u,p,h;if(!r)return;const o=(h=(p=(u=r.own_reactions)==null?void 0:u.like)==null?void 0:p.find(g=>g.user_id===(n==null?void 0:n.id)))==null?void 0:h.id,m=e.getQueryData(t);if(m!=null&&m.own_reactions.like&&(m.own_reactions.like=m.own_reactions.like.filter(g=>g.id!==o),!!(m!=null&&m.latest_reactions.like)))return m.latest_reactions.like=m.latest_reactions.like.filter(g=>g.id!==o),e.setQueryData(t,()=>({...m})),{previousActivity:m}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const Na=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:i,editActivity:c,removeActivity:l,likeActivity:a,unlikeActivity:d,createReply:o,editReply:m,removeReply:u,likeReply:p,unlikeReply:h,join:g,leave:w}})=>{var Y,te,oe,ie,me,B,ce,he,le,xe,pe,be,ge,X,ne,ue,Z,se,_e,Me,Oe,Ce,nt;const x=M.useIntl(),E=_.useContext(we),k=z.useQueryClient(),{data:b,isLoading:T,isFetching:N}=z.useQuery({queryKey:[e,t,n],queryFn:i}),D=$a({queryClient:k,queryKey:[e,t,n],mutationFn:async K=>await c(K)}),{mutate:P}=z.useMutation(D),L=Ta({queryClient:k,queryKey:[e,t,n],mutationFn:async({activityId:K})=>l({activityId:K}),redirectUrl:`${e}/${t}`}),{mutate:H}=z.useMutation(L),F=Ma({queryClient:k,queryKey:[e,t,n],mutationFn:a}),{mutate:v}=z.useMutation(F),V=Ca({queryClient:k,queryKey:[e,t,n],user:E,mutationFn:async()=>{var ke,Ne,st;const K=(st=(Ne=(ke=b==null?void 0:b.own_reactions)==null?void 0:ke.like)==null?void 0:Ne.find(rt=>rt.user_id===(E==null?void 0:E.id)))==null?void 0:st.id;await d({activityId:n,reactionId:K})},activity:b}),{mutate:j}=z.useMutation(V),A=_.useCallback(({activityId:K})=>v({activityId:K}),[v]),G=_.useCallback(async({activityId:K})=>j({activityId:K}),[j]);if(T||N)return s.jsx(je,{style:{height:"400px"}});if(!b)return s.jsx(Ke,{variant:"error",text:x.formatMessage({id:"activitySection_notFoundError"})});const J=((Y=b==null?void 0:b.actor)==null?void 0:Y.id)===(E==null?void 0:E.id),ae=rn(r,J);return s.jsx(tt,{className:"activity-section",content:{type:"post",body:b==null?void 0:b.content,canLike:ae,createdAt:(b==null?void 0:b.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:b==null?void 0:b.id},slug:n,author:{id:(te=b==null?void 0:b.actor)==null?void 0:te.id,name:((oe=b==null?void 0:b.actor)==null?void 0:oe.data)&&((me=(ie=b==null?void 0:b.actor)==null?void 0:ie.data)==null?void 0:me.name),organization:((B=b==null?void 0:b.actor)==null?void 0:B.data)&&((he=(ce=b==null?void 0:b.actor)==null?void 0:ce.data)==null?void 0:he.organization),jobTitle:((le=b==null?void 0:b.actor)==null?void 0:le.data)&&((pe=(xe=b==null?void 0:b.actor)==null?void 0:xe.data)==null?void 0:pe.jobTitle),image:{thumbnail:((be=b==null?void 0:b.actor)==null?void 0:be.data)&&((X=(ge=b==null?void 0:b.actor)==null?void 0:ge.data)==null?void 0:X.thumbnail)||void 0}},userLiked:((ne=b==null?void 0:b.own_reactions)==null?void 0:ne.like)&&((ue=b==null?void 0:b.own_reactions)==null?void 0:ue.like.length)>0,likes:b&&((Z=b==null?void 0:b.reaction_counts)==null?void 0:Z.like),comments:b&&((se=b==null?void 0:b.reaction_counts)==null?void 0:se.reply),peopleWhoLiked:((_e=b==null?void 0:b.latest_reactions)==null?void 0:_e.like)&&((Me=b==null?void 0:b.latest_reactions)==null?void 0:Me.like.map(K=>{var ke,Ne;return{id:K==null?void 0:K.user_id,name:(Ne=(ke=K==null?void 0:K.user)==null?void 0:ke.data)==null?void 0:Ne.name}}))},originalAuthorId:(Oe=b==null?void 0:b.actor)==null?void 0:Oe.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>H({activityId:n}),updateContent:(K,ke)=>P({activityInfo:K,content:ke})},likes:{createLike:()=>A({activityId:n}),deleteLike:()=>G({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((Ce=b==null?void 0:b.reaction_counts)==null?void 0:Ce.reply)||0,")"]}),s.jsx(gs,{basePath:e,parentId:t,activityId:n,repliesList:(nt=b==null?void 0:b.latest_reactions)==null?void 0:nt.reply,isMember:r,functions:{create:o,edit:m,remove:u,like:p,unlike:h,join:g,leave:w}})]})},n)},Pa=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),Ra=({type:e,data:t})=>{const n=M.useIntl(),{answers:r,createdAt:i,dateHasPassed:c,isOngoingEvent:l,pill:a,readingTime:d,publishedDate:o,startDate:m}=t;if(e==="question"){const u=i&&Ht(i);return s.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&s.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:u?n.formatMessage({id:`dates_${u.path}`},{number:u.number}):0})]})]})}if(m&&!c||l)return s.jsx("p",{className:"details",children:l?n.formatMessage({id:"card_bootcamp"}):In(m)});if(a)return s.jsx(Ge,{variant:a==="free"?"subtle":"highlighted",className:a,"data-testid":"course-type",children:a});if(d||o){const u=o&&Ht(o);return s.jsxs("ul",{className:"details",children:[d&&s.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:d})}),o&&s.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:u?n.formatMessage({id:`dates_${u.path}`},{number:u.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"}},Da=({data:e,cta:t,link:n,gtmContext:r})=>{var g;const i=M.useIntl(),[c,l]=_.useState({loading:!1,registered:e.registered||!1});_.useEffect(()=>{e.registered&&l(w=>({...w,registered:!0}))},[e.registered]);const{startDate:a,dateHasPassed:d,pill:o,slug:m}=e,u=e.contentType;let p="";if((g=_t[u])!=null&&g.gtmEvent&&(p=_t[u].gtmEvent),a&&d)return s.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:i.formatMessage({id:"card_watch"})});if(u==="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":`${p}-click`,children:i.formatMessage({id:"card_cta_people"})});const h=["microcourse","event"];if(t&&t.onClick&&h.includes(u)&&o!=="premium"){const w=c.loading||c.registered,x=async E=>{if(E.preventDefault(),E.stopPropagation(),!(w||!t||!t.onClick)){l(k=>({...k,loading:!0}));try{const k=await t.onClick(e);l(k==="success"?()=>({registered:!0,loading:!1}):b=>({...b,loading:!1}))}catch{l(b=>({...b,loading:!1}))}}};return s.jsx(Q,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:w,"data-gtm-event-context":`${r}Page-${u}: ${m}`,"data-gtm-event-type":`${r}-${u}-register-click`,"data-testid":"in-card-button",children:i.formatMessage({id:`card_cta_${u}${w?`_${c.loading?"loading":"done"}`:""}`})})}return null},Sn={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Fa=e=>{let t=e;return Object.keys(Sn).includes(e)&&(t=Sn[e]),`url(${Ye}icons/${t}.svg)`};const Aa={title:66,text:3e3,secondaryText:1e3,partner:25},Ia=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:i="Carousel",className:c=""})=>{const l=M.useIntl(),a=_.useContext(we),d=a&&typeof a.id=="string",[o,m]=_.useState({data:null,isLoading:!0}),{data:u,isLoading:p}=o,h=_.useCallback(()=>{n(t,d).then(L=>{m(()=>({data:L,isLoading:!1}))}).catch(()=>m(L=>({...L,isLoading:!1})))},[e]);if(_.useEffect(()=>{h()},[]),p||!u)return s.jsx(je,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});const{contentType:g}=u;if(!g||!_t[g])return s.jsx(je,{element:"li",className:"card-wrapper"});const{basePath:w="",className:x,length:E,gtmEvent:k}=_t[g],b=Ln(`card_label_${g}`)?l.formatMessage({id:`card_label_${g}`}):!1,T=u.slug?`${w}${u.slug}`:!1,N={...Aa,...E};let D={className:"card"};T&&(D={href:T,className:"card gtm-trackable","data-gtm-event-context":`${i}-CarouselCard`,"data-gtm-event-type":`${k}-click`,"data-testid":"link"},u.openInNewTab&&(D.target="_blank"));const P=u.customIcon?{"--custom-icon":Fa(u.customIcon)}:{};return s.jsx("li",{className:S("card-wrapper text-medium",x,c,{"has-link":T,"no-link":!T,"has-custom-icon":u.customIcon,"has-image":u.banner}),style:P,"data-testid":`${g}-card`,children:_.createElement(T?"a":"div",D,s.jsxs(s.Fragment,{children:[(u.customLabel||b)&&s.jsx("small",{className:S("card-label text-small",x),children:u.customLabel||b}),u.startDate&&!u.isOngoingEvent&&s.jsx(Ge,{size:"small",variant:u.dateHasPassed?"default":"information","data-testid":"date",children:u.dateHasPassed?l.formatMessage({id:"card_ended"}):Gs(u.startDate)}),u.banner?s.jsxs("p",{className:"img",children:[u.registered&&s.jsx(Ge,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),s.jsx(Yt,{image:u.banner})]}):x==="people"?s.jsx(Be,{name:u.title||"",src:u.profile,"data-testid":"people-profile-picture"}):null,u.contributors&&s.jsx(qt,{contributors:{data:u.contributors},styling:{size:"small",showGap:x!=="question",showText:!0},"data-testid":"contributors"}),u.partner&&s.jsx("p",{className:"partners","data-testid":"partners",children:Le(u.partner.title,N.partner)}),["title","text","secondaryText"].map(L=>{const H=u[L];if(!H)return null;const F=Ys(L);return s.jsx("p",{className:F,"data-testid":F,children:Le(H,N[L])},L)}),s.jsx(Ra,{type:x||"",data:u}),s.jsx(Da,{data:u,cta:r,link:T||"",gtmContext:i})]}))})};const La=({cards:e,cardTypes:t,className:n="",...r})=>s.jsx("ul",{className:S("card-block",n),children:e.map((i,c)=>{const l=i.slug?`${i.slug}-${t[c]}`:`${t[c]}-${c}`;return s.jsx(Ia,{id:l,card:{...i,contentType:t[c]},...r},l)})});const $n=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const dt="notFoundError_",Ba=()=>{const e=M.useIntl(),t=[];return $n.forEach((n,r)=>{n.title=e.formatMessage({id:`${dt}post_${r+1}`}),t.push("solutionArticle")}),s.jsxs(us,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:s.jsxs(bt,{children:[s.jsx(La,{cards:$n,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),s.jsx(Q,{href:"/solution-articles/",children:e.formatMessage({id:`${dt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[s.jsx("h1",{children:e.formatMessage({id:`${dt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${dt}text`})})]})};exports.ASSETS_BUCKET=Ye;exports.ActivitiesFeed=pa;exports.ActivitySection=Na;exports.AddPost=wt;exports.BannerSection=lr;exports.Breadcrumbs=Cr;exports.Button=Q;exports.ButtonWrapper=Xe;exports.CacheProvider=Gn;exports.CollapsibleSection=Gt;exports.Columns=ns;exports.CommunityDetails=Mr;exports.Contributors=qt;exports.ConversationContext=et;exports.CookieBanner=ss;exports.DiscussionConversation=ds;exports.DiscussionForm=sn;exports.DiscussionLikes=ms;exports.DiscussionPost=tt;exports.DiscussionThread=fs;exports.Divider=Re;exports.DownloadSection=ar;exports.EMAILS=Ae;exports.EmailHelperTextBox=Qr;exports.EmptyStateBox=Ke;exports.Filters=Nr;exports.FlagsProvider=Jn;exports.Footer=Kt;exports.FullWidthSection=bt;exports.GlobalProviders=Tr;exports.Header=en;exports.HelperTextBox=Qn;exports.HiddenFromScreenReaders=zt;exports.HideShowTextBox=mr;exports.HighlightedTextBox=Te;exports.IntlProvider=qn;exports.InviteForm=cs;exports.InviteModal=Gr;exports.JoinButton=Xt;exports.LanguageSwitcher=Rr;exports.Link=Ze;exports.LoadMore=Kn;exports.LoadingBlock=kr;exports.LoadingPlaceholder=je;exports.LoadingState=jr;exports.Logo=Zt;exports.LogoSection=or;exports.MarkdownText=Ut;exports.MarketingBox=ur;exports.Member=vt;exports.MembersList=Zr;exports.Modal=tn;exports.MoreMenu=es;exports.NUMBER_OF_USERS=dr;exports.NavigationMenu=ts;exports.NotFoundError=Ba;exports.Overlay=nn;exports.PageHeading=Wn;exports.PageLayout=us;exports.PasswordRules=zr;exports.Pill=Ge;exports.ProfilePicture=Be;exports.ProgressBar=zn;exports.Rating=Vr;exports.RepliesFeed=gs;exports.ResponsesHeading=sa;exports.ResponsiveImage=Yt;exports.SearchForm=is;exports.ShareLinks=Lr;exports.Span=Un;exports.StatusBanner=ht;exports.Tabs=Br;exports.Tags=Xr;exports.Tooltip=On;exports.TopLevelPage=Hr;exports.UserContext=we;exports.UserProvider=Zn;exports.VisuallyHidden=re;exports.addAriaProps=ls;exports.getMember=Jt;exports.headerData=Je;exports.mapGetStreamData=Pa;exports.pageReady=Bn;exports.useCurrentPath=Nn;exports.useEffectAfterMount=Pe;exports.useElementWidth=qe;exports.useScrollListener=Rn;exports.useScrollToHash=Dn;exports.useUser=Xn;
|