@apolitical/component-library 1.14.7-beta.0 → 1.14.7-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +11 -11
  2. package/index.mjs +548 -549
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),bs=require("lodash.clonedeep"),vs=require("lodash.set"),C=require("react-intl"),ut=require("truncate"),dt=require("markdown-to-jsx"),U=require("@tanstack/react-query"),ws=require("@tanstack/react-query-devtools"),rt=require("posthog-js"),_n=require("react-cookie"),ks=require("react-multi-email"),xn=require("lodash.get"),js=require("react-error-boundary"),Es=require("react-textarea-autosize"),Ss=require("lodash.isequal");function ys(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bn={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),bs=require("lodash.clonedeep"),vs=require("lodash.set"),C=require("react-intl"),dt=require("truncate"),mt=require("markdown-to-jsx"),U=require("@tanstack/react-query"),ws=require("@tanstack/react-query-devtools"),ot=require("posthog-js"),xn=require("react-cookie"),ks=require("react-multi-email"),bn=require("lodash.get"),js=require("react-error-boundary"),Es=require("react-textarea-autosize"),Ss=require("lodash.isequal");function ys(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vn={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],c=0;c<arguments.length;c++){var i=arguments[c];if(i){var d=typeof i;if(d==="string"||d==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(d==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(bn);var Ms=bn.exports;const M=ys(Ms),Ts=({element:e="span",showOnFocus:t=!0,children:n,...r})=>x.createElement(e,{...r,className:M("hidden",{"show-on-focus":t}),children:n}),ue=x.memo(Ts),$s=({element:e="span",children:t=null,...n})=>x.createElement(e,{...n,"aria-hidden":!0},t),It=x.memo($s);var At={exports:{}},Oe={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],c=0;c<arguments.length;c++){var i=arguments[c];if(i){var d=typeof i;if(d==="string"||d==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(d==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(vn);var Ms=vn.exports;const M=ys(Ms),Ts=({element:e="span",showOnFocus:t=!0,children:n,...r})=>x.createElement(e,{...r,className:M("hidden",{"show-on-focus":t}),children:n}),ue=x.memo(Ts),$s=({element:e="span",children:t=null,...n})=>x.createElement(e,{...n,"aria-hidden":!0},t),Lt=x.memo($s);var Nt={exports:{}},Oe={};/**
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 cn;function Cs(){if(cn)return Oe;cn=1;var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,c=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(o,l,a){var u,f={},h=null,p=null;a!==void 0&&(h=""+a),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(u in l)r.call(l,u)&&!i.hasOwnProperty(u)&&(f[u]=l[u]);if(o&&o.defaultProps)for(u in l=o.defaultProps,l)f[u]===void 0&&(f[u]=l[u]);return{$$typeof:t,type:o,key:h,ref:p,props:f,_owner:c.current}}return Oe.Fragment=n,Oe.jsx=d,Oe.jsxs=d,Oe}var Qe={};/**
13
+ */var ln;function Cs(){if(ln)return Oe;ln=1;var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,c=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(o,l,a){var u,f={},h=null,p=null;a!==void 0&&(h=""+a),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(u in l)r.call(l,u)&&!i.hasOwnProperty(u)&&(f[u]=l[u]);if(o&&o.defaultProps)for(u in l=o.defaultProps,l)f[u]===void 0&&(f[u]=l[u]);return{$$typeof:t,type:o,key:h,ref:p,props:f,_owner:c.current}}return Oe.Fragment=n,Oe.jsx=d,Oe.jsxs=d,Oe}var Qe={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,20 +18,20 @@
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 ln;function Rs(){return ln||(ln=1,process.env.NODE_ENV!=="production"&&function(){var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),_=Symbol.iterator,j="@@iterator";function w(m){if(m===null||typeof m!="object")return null;var E=_&&m[_]||m[j];return typeof E=="function"?E:null}var S=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(m){{for(var E=arguments.length,y=new Array(E>1?E-1:0),$=1;$<E;$++)y[$-1]=arguments[$];T("error",m,y)}}function T(m,E,y){{var $=S.ReactDebugCurrentFrame,O=$.getStackAddendum();O!==""&&(E+="%s",y=y.concat([O]));var H=y.map(function(I){return String(I)});H.unshift("Warning: "+E),Function.prototype.apply.call(console[m],console,H)}}var R=!1,D=!1,L=!1,V=!1,N=!1,P;P=Symbol.for("react.module.reference");function X(m){return!!(typeof m=="string"||typeof m=="function"||m===r||m===i||N||m===c||m===a||m===u||V||m===p||R||D||L||typeof m=="object"&&m!==null&&(m.$$typeof===h||m.$$typeof===f||m.$$typeof===d||m.$$typeof===o||m.$$typeof===l||m.$$typeof===P||m.getModuleId!==void 0))}function b(m,E,y){var $=m.displayName;if($)return $;var O=E.displayName||E.name||"";return O!==""?y+"("+O+")":y}function q(m){return m.displayName||"Context"}function k(m){if(m==null)return null;if(typeof m.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof m=="function")return m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case c:return"StrictMode";case a:return"Suspense";case u:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case o:var E=m;return q(E)+".Consumer";case d:var y=m;return q(y._context)+".Provider";case l:return b(m,m.render,"ForwardRef");case f:var $=m.displayName||null;return $!==null?$:k(m.type)||"Memo";case h:{var O=m,H=O._payload,I=O._init;try{return k(I(H))}catch{return null}}}return null}var v=Object.assign,W=0,J,ne,se,re,K,de,ce;function F(){}F.__reactDisabledLog=!0;function oe(){{if(W===0){J=console.log,ne=console.info,se=console.warn,re=console.error,K=console.group,de=console.groupCollapsed,ce=console.groupEnd;var m={configurable:!0,enumerable:!0,value:F,writable:!0};Object.defineProperties(console,{info:m,log:m,warn:m,error:m,group:m,groupCollapsed:m,groupEnd:m})}W++}}function me(){{if(W--,W===0){var m={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:v({},m,{value:J}),info:v({},m,{value:ne}),warn:v({},m,{value:se}),error:v({},m,{value:re}),group:v({},m,{value:K}),groupCollapsed:v({},m,{value:de}),groupEnd:v({},m,{value:ce})})}W<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=S.ReactCurrentDispatcher,pe;function fe(m,E,y){{if(pe===void 0)try{throw Error()}catch(O){var $=O.stack.trim().match(/\n( *(at )?)/);pe=$&&$[1]||""}return`
22
- `+pe+m}}var ge=!1,he;{var B=typeof WeakMap=="function"?WeakMap:Map;he=new B}function Y(m,E){if(!m||ge)return"";{var y=he.get(m);if(y!==void 0)return y}var $;ge=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var H;H=ae.current,ae.current=null,oe();try{if(E){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(Se){$=Se}Reflect.construct(m,[],I)}else{try{I.call()}catch(Se){$=Se}m.call(I.prototype)}}else{try{throw Error()}catch(Se){$=Se}m()}}catch(Se){if(Se&&$&&typeof Se.stack=="string"){for(var A=Se.stack.split(`
21
+ */var un;function Rs(){return un||(un=1,process.env.NODE_ENV!=="production"&&function(){var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),_=Symbol.iterator,j="@@iterator";function w(m){if(m===null||typeof m!="object")return null;var E=_&&m[_]||m[j];return typeof E=="function"?E:null}var S=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(m){{for(var E=arguments.length,y=new Array(E>1?E-1:0),$=1;$<E;$++)y[$-1]=arguments[$];T("error",m,y)}}function T(m,E,y){{var $=S.ReactDebugCurrentFrame,O=$.getStackAddendum();O!==""&&(E+="%s",y=y.concat([O]));var H=y.map(function(I){return String(I)});H.unshift("Warning: "+E),Function.prototype.apply.call(console[m],console,H)}}var R=!1,D=!1,L=!1,V=!1,N=!1,P;P=Symbol.for("react.module.reference");function G(m){return!!(typeof m=="string"||typeof m=="function"||m===r||m===i||N||m===c||m===a||m===u||V||m===p||R||D||L||typeof m=="object"&&m!==null&&(m.$$typeof===h||m.$$typeof===f||m.$$typeof===d||m.$$typeof===o||m.$$typeof===l||m.$$typeof===P||m.getModuleId!==void 0))}function b(m,E,y){var $=m.displayName;if($)return $;var O=E.displayName||E.name||"";return O!==""?y+"("+O+")":y}function X(m){return m.displayName||"Context"}function k(m){if(m==null)return null;if(typeof m.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof m=="function")return m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case c:return"StrictMode";case a:return"Suspense";case u:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case o:var E=m;return X(E)+".Consumer";case d:var y=m;return X(y._context)+".Provider";case l:return b(m,m.render,"ForwardRef");case f:var $=m.displayName||null;return $!==null?$:k(m.type)||"Memo";case h:{var O=m,H=O._payload,I=O._init;try{return k(I(H))}catch{return null}}}return null}var v=Object.assign,W=0,J,q,se,re,K,de,ce;function F(){}F.__reactDisabledLog=!0;function oe(){{if(W===0){J=console.log,q=console.info,se=console.warn,re=console.error,K=console.group,de=console.groupCollapsed,ce=console.groupEnd;var m={configurable:!0,enumerable:!0,value:F,writable:!0};Object.defineProperties(console,{info:m,log:m,warn:m,error:m,group:m,groupCollapsed:m,groupEnd:m})}W++}}function me(){{if(W--,W===0){var m={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:v({},m,{value:J}),info:v({},m,{value:q}),warn:v({},m,{value:se}),error:v({},m,{value:re}),group:v({},m,{value:K}),groupCollapsed:v({},m,{value:de}),groupEnd:v({},m,{value:ce})})}W<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=S.ReactCurrentDispatcher,pe;function fe(m,E,y){{if(pe===void 0)try{throw Error()}catch(O){var $=O.stack.trim().match(/\n( *(at )?)/);pe=$&&$[1]||""}return`
22
+ `+pe+m}}var ge=!1,he;{var B=typeof WeakMap=="function"?WeakMap:Map;he=new B}function Y(m,E){if(!m||ge)return"";{var y=he.get(m);if(y!==void 0)return y}var $;ge=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var H;H=ae.current,ae.current=null,oe();try{if(E){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(ye){$=ye}Reflect.construct(m,[],I)}else{try{I.call()}catch(ye){$=ye}m.call(I.prototype)}}else{try{throw Error()}catch(ye){$=ye}m()}}catch(ye){if(ye&&$&&typeof ye.stack=="string"){for(var A=ye.stack.split(`
23
23
  `),_e=$.stack.split(`
24
- `),Z=A.length-1,te=_e.length-1;Z>=1&&te>=0&&A[Z]!==_e[te];)te--;for(;Z>=1&&te>=0;Z--,te--)if(A[Z]!==_e[te]){if(Z!==1||te!==1)do if(Z--,te--,te<0||A[Z]!==_e[te]){var ve=`
25
- `+A[Z].replace(" at new "," at ");return m.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",m.displayName)),typeof m=="function"&&he.set(m,ve),ve}while(Z>=1&&te>=0);break}}}finally{ge=!1,ae.current=H,me(),Error.prepareStackTrace=O}var Pe=m?m.displayName||m.name:"",an=Pe?fe(Pe):"";return typeof m=="function"&&he.set(m,an),an}function ie(m,E,y){return Y(m,!1)}function ee(m){var E=m.prototype;return!!(E&&E.isReactComponent)}function le(m,E,y){if(m==null)return"";if(typeof m=="function")return Y(m,ee(m));if(typeof m=="string")return fe(m);switch(m){case a:return fe("Suspense");case u:return fe("SuspenseList")}if(typeof m=="object")switch(m.$$typeof){case l:return ie(m.render);case f:return le(m.type,E,y);case h:{var $=m,O=$._payload,H=$._init;try{return le(H(O),E,y)}catch{}}}return""}var be=Object.prototype.hasOwnProperty,$e={},Le=S.ReactDebugCurrentFrame;function G(m){if(m){var E=m._owner,y=le(m.type,m._source,E?E.type:null);Le.setExtraStackFrame(y)}else Le.setExtraStackFrame(null)}function Ee(m,E,y,$,O){{var H=Function.call.bind(be);for(var I in m)if(H(m,I)){var A=void 0;try{if(typeof m[I]!="function"){var _e=Error(($||"React class")+": "+y+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof m[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _e.name="Invariant Violation",_e}A=m[I](E,I,$,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Z){A=Z}A&&!(A instanceof Error)&&(G(O),g("%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).",$||"React class",y,I,typeof A),G(null)),A instanceof Error&&!(A.message in $e)&&($e[A.message]=!0,G(O),g("Failed %s type: %s",y,A.message),G(null))}}}var Ce=Array.isArray;function Ae(m){return Ce(m)}function ht(m){{var E=typeof Symbol=="function"&&Symbol.toStringTag,y=E&&m[Symbol.toStringTag]||m.constructor.name||"Object";return y}}function ns(m){try{return Xt(m),!1}catch{return!0}}function Xt(m){return""+m}function Zt(m){if(ns(m))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ht(m)),Xt(m)}var Be=S.ReactCurrentOwner,ss={key:!0,ref:!0,__self:!0,__source:!0},qt,Kt,pt;pt={};function rs(m){if(be.call(m,"ref")){var E=Object.getOwnPropertyDescriptor(m,"ref").get;if(E&&E.isReactWarning)return!1}return m.ref!==void 0}function os(m){if(be.call(m,"key")){var E=Object.getOwnPropertyDescriptor(m,"key").get;if(E&&E.isReactWarning)return!1}return m.key!==void 0}function as(m,E){if(typeof m.ref=="string"&&Be.current&&E&&Be.current.stateNode!==E){var y=k(Be.current.type);pt[y]||(g('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',k(Be.current.type),m.ref),pt[y]=!0)}}function is(m,E){{var y=function(){qt||(qt=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};y.isReactWarning=!0,Object.defineProperty(m,"key",{get:y,configurable:!0})}}function cs(m,E){{var y=function(){Kt||(Kt=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};y.isReactWarning=!0,Object.defineProperty(m,"ref",{get:y,configurable:!0})}}var ls=function(m,E,y,$,O,H,I){var A={$$typeof:t,type:m,key:E,ref:y,props:I,_owner:H};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:$}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function us(m,E,y,$,O){{var H,I={},A=null,_e=null;y!==void 0&&(Zt(y),A=""+y),os(E)&&(Zt(E.key),A=""+E.key),rs(E)&&(_e=E.ref,as(E,O));for(H in E)be.call(E,H)&&!ss.hasOwnProperty(H)&&(I[H]=E[H]);if(m&&m.defaultProps){var Z=m.defaultProps;for(H in Z)I[H]===void 0&&(I[H]=Z[H])}if(A||_e){var te=typeof m=="function"?m.displayName||m.name||"Unknown":m;A&&is(I,te),_e&&cs(I,te)}return ls(m,A,_e,O,$,Be.current,I)}}var gt=S.ReactCurrentOwner,en=S.ReactDebugCurrentFrame;function Ne(m){if(m){var E=m._owner,y=le(m.type,m._source,E?E.type:null);en.setExtraStackFrame(y)}else en.setExtraStackFrame(null)}var _t;_t=!1;function xt(m){return typeof m=="object"&&m!==null&&m.$$typeof===t}function tn(){{if(gt.current){var m=k(gt.current.type);if(m)return`
24
+ `),Z=A.length-1,ne=_e.length-1;Z>=1&&ne>=0&&A[Z]!==_e[ne];)ne--;for(;Z>=1&&ne>=0;Z--,ne--)if(A[Z]!==_e[ne]){if(Z!==1||ne!==1)do if(Z--,ne--,ne<0||A[Z]!==_e[ne]){var ve=`
25
+ `+A[Z].replace(" at new "," at ");return m.displayName&&ve.includes("<anonymous>")&&(ve=ve.replace("<anonymous>",m.displayName)),typeof m=="function"&&he.set(m,ve),ve}while(Z>=1&&ne>=0);break}}}finally{ge=!1,ae.current=H,me(),Error.prepareStackTrace=O}var Pe=m?m.displayName||m.name:"",cn=Pe?fe(Pe):"";return typeof m=="function"&&he.set(m,cn),cn}function ie(m,E,y){return Y(m,!1)}function ee(m){var E=m.prototype;return!!(E&&E.isReactComponent)}function le(m,E,y){if(m==null)return"";if(typeof m=="function")return Y(m,ee(m));if(typeof m=="string")return fe(m);switch(m){case a:return fe("Suspense");case u:return fe("SuspenseList")}if(typeof m=="object")switch(m.$$typeof){case l:return ie(m.render);case f:return le(m.type,E,y);case h:{var $=m,O=$._payload,H=$._init;try{return le(H(O),E,y)}catch{}}}return""}var be=Object.prototype.hasOwnProperty,Ce={},Le=S.ReactDebugCurrentFrame;function Re(m){if(m){var E=m._owner,y=le(m.type,m._source,E?E.type:null);Le.setExtraStackFrame(y)}else Le.setExtraStackFrame(null)}function te(m,E,y,$,O){{var H=Function.call.bind(be);for(var I in m)if(H(m,I)){var A=void 0;try{if(typeof m[I]!="function"){var _e=Error(($||"React class")+": "+y+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof m[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _e.name="Invariant Violation",_e}A=m[I](E,I,$,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Z){A=Z}A&&!(A instanceof Error)&&(Re(O),g("%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).",$||"React class",y,I,typeof A),Re(null)),A instanceof Error&&!(A.message in Ce)&&(Ce[A.message]=!0,Re(O),g("Failed %s type: %s",y,A.message),Re(null))}}}var Ee=Array.isArray;function Se(m){return Ee(m)}function qe(m){{var E=typeof Symbol=="function"&&Symbol.toStringTag,y=E&&m[Symbol.toStringTag]||m.constructor.name||"Object";return y}}function pt(m){try{return Zt(m),!1}catch{return!0}}function Zt(m){return""+m}function qt(m){if(pt(m))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(m)),Zt(m)}var Be=S.ReactCurrentOwner,ss={key:!0,ref:!0,__self:!0,__source:!0},Kt,en,gt;gt={};function rs(m){if(be.call(m,"ref")){var E=Object.getOwnPropertyDescriptor(m,"ref").get;if(E&&E.isReactWarning)return!1}return m.ref!==void 0}function os(m){if(be.call(m,"key")){var E=Object.getOwnPropertyDescriptor(m,"key").get;if(E&&E.isReactWarning)return!1}return m.key!==void 0}function as(m,E){if(typeof m.ref=="string"&&Be.current&&E&&Be.current.stateNode!==E){var y=k(Be.current.type);gt[y]||(g('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',k(Be.current.type),m.ref),gt[y]=!0)}}function is(m,E){{var y=function(){Kt||(Kt=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};y.isReactWarning=!0,Object.defineProperty(m,"key",{get:y,configurable:!0})}}function cs(m,E){{var y=function(){en||(en=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",E))};y.isReactWarning=!0,Object.defineProperty(m,"ref",{get:y,configurable:!0})}}var ls=function(m,E,y,$,O,H,I){var A={$$typeof:t,type:m,key:E,ref:y,props:I,_owner:H};return A._store={},Object.defineProperty(A._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(A,"_self",{configurable:!1,enumerable:!1,writable:!1,value:$}),Object.defineProperty(A,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(A.props),Object.freeze(A)),A};function us(m,E,y,$,O){{var H,I={},A=null,_e=null;y!==void 0&&(qt(y),A=""+y),os(E)&&(qt(E.key),A=""+E.key),rs(E)&&(_e=E.ref,as(E,O));for(H in E)be.call(E,H)&&!ss.hasOwnProperty(H)&&(I[H]=E[H]);if(m&&m.defaultProps){var Z=m.defaultProps;for(H in Z)I[H]===void 0&&(I[H]=Z[H])}if(A||_e){var ne=typeof m=="function"?m.displayName||m.name||"Unknown":m;A&&is(I,ne),_e&&cs(I,ne)}return ls(m,A,_e,O,$,Be.current,I)}}var _t=S.ReactCurrentOwner,tn=S.ReactDebugCurrentFrame;function Ne(m){if(m){var E=m._owner,y=le(m.type,m._source,E?E.type:null);tn.setExtraStackFrame(y)}else tn.setExtraStackFrame(null)}var xt;xt=!1;function bt(m){return typeof m=="object"&&m!==null&&m.$$typeof===t}function nn(){{if(_t.current){var m=k(_t.current.type);if(m)return`
26
26
 
27
27
  Check the render method of \``+m+"`."}return""}}function ds(m){{if(m!==void 0){var E=m.fileName.replace(/^.*[\\\/]/,""),y=m.lineNumber;return`
28
28
 
29
- Check your code at `+E+":"+y+"."}return""}}var nn={};function ms(m){{var E=tn();if(!E){var y=typeof m=="string"?m:m.displayName||m.name;y&&(E=`
29
+ Check your code at `+E+":"+y+"."}return""}}var sn={};function ms(m){{var E=nn();if(!E){var y=typeof m=="string"?m:m.displayName||m.name;y&&(E=`
30
30
 
31
- Check the top-level render call using <`+y+">.")}return E}}function sn(m,E){{if(!m._store||m._store.validated||m.key!=null)return;m._store.validated=!0;var y=ms(E);if(nn[y])return;nn[y]=!0;var $="";m&&m._owner&&m._owner!==gt.current&&($=" It was passed a child from "+k(m._owner.type)+"."),Ne(m),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,$),Ne(null)}}function rn(m,E){{if(typeof m!="object")return;if(Ae(m))for(var y=0;y<m.length;y++){var $=m[y];xt($)&&sn($,E)}else if(xt(m))m._store&&(m._store.validated=!0);else if(m){var O=w(m);if(typeof O=="function"&&O!==m.entries)for(var H=O.call(m),I;!(I=H.next()).done;)xt(I.value)&&sn(I.value,E)}}}function fs(m){{var E=m.type;if(E==null||typeof E=="string")return;var y;if(typeof E=="function")y=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===l||E.$$typeof===f))y=E.propTypes;else return;if(y){var $=k(E);Ee(y,m.props,"prop",$,m)}else if(E.PropTypes!==void 0&&!_t){_t=!0;var O=k(E);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hs(m){{for(var E=Object.keys(m.props),y=0;y<E.length;y++){var $=E[y];if($!=="children"&&$!=="key"){Ne(m),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",$),Ne(null);break}}m.ref!==null&&(Ne(m),g("Invalid attribute `ref` supplied to `React.Fragment`."),Ne(null))}}function on(m,E,y,$,O,H){{var I=X(m);if(!I){var A="";(m===void 0||typeof m=="object"&&m!==null&&Object.keys(m).length===0)&&(A+=" 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=ds(O);_e?A+=_e:A+=tn();var Z;m===null?Z="null":Ae(m)?Z="array":m!==void 0&&m.$$typeof===t?(Z="<"+(k(m.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):Z=typeof m,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Z,A)}var te=us(m,E,y,O,H);if(te==null)return te;if(I){var ve=E.children;if(ve!==void 0)if($)if(Ae(ve)){for(var Pe=0;Pe<ve.length;Pe++)rn(ve[Pe],m);Object.freeze&&Object.freeze(ve)}else g("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 rn(ve,m)}return m===r?hs(te):fs(te),te}}function ps(m,E,y){return on(m,E,y,!0)}function gs(m,E,y){return on(m,E,y,!1)}var _s=gs,xs=ps;Qe.Fragment=r,Qe.jsx=_s,Qe.jsxs=xs}()),Qe}process.env.NODE_ENV==="production"?At.exports=Cs():At.exports=Rs();var s=At.exports;const vn=()=>{const[e,t]=x.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return x.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Re=(e,t)=>{const n=x.useRef(!1);x.useEffect(()=>{n.current?e():n.current=!0},t)};function Ds(e,t,n){var r=this,c=x.useRef(null),i=x.useRef(0),d=x.useRef(null),o=x.useRef([]),l=x.useRef(),a=x.useRef(),u=x.useRef(e),f=x.useRef(!0);x.useEffect(function(){u.current=e},[e]);var h=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var p=!!(n=n||{}).leading,_=!("trailing"in n)||!!n.trailing,j="maxWait"in n,w=j?Math.max(+n.maxWait||0,t):null;x.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var S=x.useMemo(function(){var g=function(N){var P=o.current,X=l.current;return o.current=l.current=null,i.current=N,a.current=u.current.apply(X,P)},T=function(N,P){h&&cancelAnimationFrame(d.current),d.current=h?requestAnimationFrame(N):setTimeout(N,P)},R=function(N){if(!f.current)return!1;var P=N-c.current;return!c.current||P>=t||P<0||j&&N-i.current>=w},D=function(N){return d.current=null,_&&o.current?g(N):(o.current=l.current=null,a.current)},L=function N(){var P=Date.now();if(R(P))return D(P);if(f.current){var X=t-(P-c.current),b=j?Math.min(X,w-(P-i.current)):X;T(N,b)}},V=function(){var N=Date.now(),P=R(N);if(o.current=[].slice.call(arguments),l.current=r,c.current=N,P){if(!d.current&&f.current)return i.current=c.current,T(L,t),p?g(c.current):a.current;if(j)return T(L,t),g(c.current)}return d.current||T(L,t),a.current};return V.cancel=function(){d.current&&(h?cancelAnimationFrame(d.current):clearTimeout(d.current)),i.current=0,o.current=c.current=l.current=d.current=null},V.isPending=function(){return!!d.current},V.flush=function(){return d.current?D(Date.now()):a.current},V},[p,j,t,w,_,h]);return S}function wn(e,t,n){var r=n===void 0?{}:n,c=r.leading,i=r.trailing;return Ds(e,t,{maxWait:t,leading:c===void 0||c,trailing:i===void 0||i})}let bt;const ze=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,c]=x.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];x.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(bt),l.flush(),window.removeEventListener("resize",l)}),i);const d=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{c(d())},l=wn(()=>{d()!==r&&(t&&(clearTimeout(bt),document.body.classList.add("is-resizing"),bt=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},kn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[c,i]=x.useState({current:0,past:0})||[!1,()=>{}],[d,o]=x.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];x.useEffect(()=>(l(),window.addEventListener("scroll",a),()=>{a.flush(),window.removeEventListener("scroll",a)}),[]);const l=()=>{const u=window.scrollY,f=c.current,h=u-f,p=h>0?"down":"up";if(i({current:u,past:f}),p==="down"){u>=e+t.down&&!d.scrollDown&&(!d.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!d.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},a=wn(()=>{l()},250);return c},As=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=x.useRef(!1);Re(()=>{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)},Ns=(e,t)=>{Array.isArray(t)||(t=[t]);const n=bs(e);return t.forEach(({type:r,value:c})=>{vs(n,r,c)}),n},jn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},En=(e,t,n)=>{let r=n.mobile;for(const c in t){const i=parseInt(String(t[c]));if(e>=i)r=n[i];else if(e<i)break}return r},Ps=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Fs=e=>{let i;try{i=new Date().getTime()-new Date(e).getTime()}catch{return""}const d=i/36e5,o=Math.floor(i/864e5);if(o<1)return d<1?{path:"now"}:{path:"hours",number:Math.floor(d)};if(o<7)return{path:"days",number:o};const l=Math.floor(o/7);return l<=52?{path:"weeks",number:l}:{path:"years",number:Math.floor(o/365)}},Is=e=>new Promise(t=>setTimeout(t,e)),Lt={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.",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 <`+y+">.")}return E}}function rn(m,E){{if(!m._store||m._store.validated||m.key!=null)return;m._store.validated=!0;var y=ms(E);if(sn[y])return;sn[y]=!0;var $="";m&&m._owner&&m._owner!==_t.current&&($=" It was passed a child from "+k(m._owner.type)+"."),Ne(m),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,$),Ne(null)}}function on(m,E){{if(typeof m!="object")return;if(Se(m))for(var y=0;y<m.length;y++){var $=m[y];bt($)&&rn($,E)}else if(bt(m))m._store&&(m._store.validated=!0);else if(m){var O=w(m);if(typeof O=="function"&&O!==m.entries)for(var H=O.call(m),I;!(I=H.next()).done;)bt(I.value)&&rn(I.value,E)}}}function fs(m){{var E=m.type;if(E==null||typeof E=="string")return;var y;if(typeof E=="function")y=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===l||E.$$typeof===f))y=E.propTypes;else return;if(y){var $=k(E);te(y,m.props,"prop",$,m)}else if(E.PropTypes!==void 0&&!xt){xt=!0;var O=k(E);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hs(m){{for(var E=Object.keys(m.props),y=0;y<E.length;y++){var $=E[y];if($!=="children"&&$!=="key"){Ne(m),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",$),Ne(null);break}}m.ref!==null&&(Ne(m),g("Invalid attribute `ref` supplied to `React.Fragment`."),Ne(null))}}function an(m,E,y,$,O,H){{var I=G(m);if(!I){var A="";(m===void 0||typeof m=="object"&&m!==null&&Object.keys(m).length===0)&&(A+=" 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=ds(O);_e?A+=_e:A+=nn();var Z;m===null?Z="null":Se(m)?Z="array":m!==void 0&&m.$$typeof===t?(Z="<"+(k(m.type)||"Unknown")+" />",A=" Did you accidentally export a JSX literal instead of a component?"):Z=typeof m,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Z,A)}var ne=us(m,E,y,O,H);if(ne==null)return ne;if(I){var ve=E.children;if(ve!==void 0)if($)if(Se(ve)){for(var Pe=0;Pe<ve.length;Pe++)on(ve[Pe],m);Object.freeze&&Object.freeze(ve)}else g("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 on(ve,m)}return m===r?hs(ne):fs(ne),ne}}function ps(m,E,y){return an(m,E,y,!0)}function gs(m,E,y){return an(m,E,y,!1)}var _s=gs,xs=ps;Qe.Fragment=r,Qe.jsx=_s,Qe.jsxs=xs}()),Qe}process.env.NODE_ENV==="production"?Nt.exports=Cs():Nt.exports=Rs();var s=Nt.exports;const wn=()=>{const[e,t]=x.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return x.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},De=(e,t)=>{const n=x.useRef(!1);x.useEffect(()=>{n.current?e():n.current=!0},t)};function Ds(e,t,n){var r=this,c=x.useRef(null),i=x.useRef(0),d=x.useRef(null),o=x.useRef([]),l=x.useRef(),a=x.useRef(),u=x.useRef(e),f=x.useRef(!0);x.useEffect(function(){u.current=e},[e]);var h=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var p=!!(n=n||{}).leading,_=!("trailing"in n)||!!n.trailing,j="maxWait"in n,w=j?Math.max(+n.maxWait||0,t):null;x.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var S=x.useMemo(function(){var g=function(N){var P=o.current,G=l.current;return o.current=l.current=null,i.current=N,a.current=u.current.apply(G,P)},T=function(N,P){h&&cancelAnimationFrame(d.current),d.current=h?requestAnimationFrame(N):setTimeout(N,P)},R=function(N){if(!f.current)return!1;var P=N-c.current;return!c.current||P>=t||P<0||j&&N-i.current>=w},D=function(N){return d.current=null,_&&o.current?g(N):(o.current=l.current=null,a.current)},L=function N(){var P=Date.now();if(R(P))return D(P);if(f.current){var G=t-(P-c.current),b=j?Math.min(G,w-(P-i.current)):G;T(N,b)}},V=function(){var N=Date.now(),P=R(N);if(o.current=[].slice.call(arguments),l.current=r,c.current=N,P){if(!d.current&&f.current)return i.current=c.current,T(L,t),p?g(c.current):a.current;if(j)return T(L,t),g(c.current)}return d.current||T(L,t),a.current};return V.cancel=function(){d.current&&(h?cancelAnimationFrame(d.current):clearTimeout(d.current)),i.current=0,o.current=c.current=l.current=d.current=null},V.isPending=function(){return!!d.current},V.flush=function(){return d.current?D(Date.now()):a.current},V},[p,j,t,w,_,h]);return S}function kn(e,t,n){var r=n===void 0?{}:n,c=r.leading,i=r.trailing;return Ds(e,t,{maxWait:t,leading:c===void 0||c,trailing:i===void 0||i})}let vt;const ze=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,c]=x.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];x.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(vt),l.flush(),window.removeEventListener("resize",l)}),i);const d=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{c(d())},l=kn(()=>{d()!==r&&(t&&(clearTimeout(vt),document.body.classList.add("is-resizing"),vt=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},jn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[c,i]=x.useState({current:0,past:0})||[!1,()=>{}],[d,o]=x.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];x.useEffect(()=>(l(),window.addEventListener("scroll",a),()=>{a.flush(),window.removeEventListener("scroll",a)}),[]);const l=()=>{const u=window.scrollY,f=c.current,h=u-f,p=h>0?"down":"up";if(i({current:u,past:f}),p==="down"){u>=e+t.down&&!d.scrollDown&&(!d.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!d.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},a=kn(()=>{l()},250);return c},As=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=x.useRef(!1);De(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},Ns=(e,t)=>{Array.isArray(t)||(t=[t]);const n=bs(e);return t.forEach(({type:r,value:c})=>{vs(n,r,c)}),n},En=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Sn=(e,t,n)=>{let r=n.mobile;for(const c in t){const i=parseInt(String(t[c]));if(e>=i)r=n[i];else if(e<i)break}return r},Ps=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Fs=e=>{let i;try{i=new Date().getTime()-new Date(e).getTime()}catch{return""}const d=i/36e5,o=Math.floor(i/864e5);if(o<1)return d<1?{path:"now"}:{path:"hours",number:Math.floor(d)};if(o<7)return{path:"days",number:o};const l=Math.floor(o/7);return l<=52?{path:"weeks",number:l}:{path:"years",number:Math.floor(o/365)}},Is=e=>new Promise(t=>setTimeout(t,e)),Bt={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.",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",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",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>",sharedLinks_copy_text:"Copy link",tags_community:"From the community",tooltip_loading:"Loading..."},Ls={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>"},Bs={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>"},Os={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>"},Qs=Object.freeze(Object.defineProperty({__proto__:null,en:Lt,es:Ls,fr:Bs,pt:Os},Symbol.toStringTag,{value:"Module"})),Hs=e=>e in Lt,ke=(e,t,n,r,c={})=>{let i="";return Hs(`${t}_${n}`)?i=e({id:`${t}_${n}`},c):i=e({id:t},{[r]:n,...c}),i},Us=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let c=n.length-1;c>=0;c--){const i=Math.pow(10,(c+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&c<n.length-1&&(e=1,c++),r=`${e}${n[c]}`;break}}return r},ot=(e,t)=>x.Children.map(e,n=>x.cloneElement(n,{...t})),Ws=e=>e.replace(/\s+/g,"").length>0,z=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:c=!1,element:i="button",onClick:d=!1,className:o="",disabled:l=!1,screenreaderText:a=!1,children:u=!1,...f})=>{const p=ze(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const w=Object.assign({},t),S=jn(Object.keys(w));t=En(p,S,w)}const _=[];typeof t=="string"&&_.push(t),r&&(_.push("icon"),typeof r=="object"?(_.push(r.icon),r.position?_.push(r.position):_.push("left"),r.hover&&_.push(`hover_${r.hover}`),r.animate&&(_.push("animate"),typeof r.animate=="string"&&_.push(r.animate))):(_.push(r),!r.includes("right")&&!r.includes("left")&&_.push("left"))),n.muted&&_.push("muted"),n.fullWidth&&_.push("full-width");const j={...f,className:M(e,o,_,{"no-text":!u,disabled:l,button:c}),onClick:w=>{(!c||c[0]==="#")&&d&&(w.preventDefault(),w.stopPropagation()),d&&d(w)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return c&&(i="a",j.href=c),x.createElement(i,j,u||(a?s.jsx(ue,{showOnFocus:!1,children:a}):null))},Ve=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",c=e.map((i,d)=>r==="p"?s.jsx(z,{...i},d):s.jsx("li",{children:s.jsx(z,{...i})},d));return x.createElement(r,{className:M("button-wrapper",t),...n,children:c})};const De=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:M(e,{"has-max-width":t}),style:n})},Ye=({href:e,children:t,fallbackElement:n,className:r="",onClick:c,gtmContext:i,gtmType:d,...o})=>{if(e){const l={...o};return c&&(l.onClick=c),i&&(l["data-gtm-event-context"]=i),d&&(l["data-gtm-event-type"]=d),s.jsx("a",{href:e,className:M("gtm-trackable",r),...l,children:t})}return n?x.createElement(n,{children:t,className:r,...o}):t},un={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"}},zs=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:c}=e?un[e]:un.fallback;return{range:t&&t.length>0?t:r,sizes:n||c}},Vs=({format:e,height:t,query:n,width:r})=>{let c=`w=${r}&h=${t}`;return c=e?`${c}&fm=${e}`:c,c=n?`${c}&${n}`:c,c},vt=({format:e,range:t,url:n,query:r})=>t.map(({height:c,width:i})=>`${n}?${Vs({format:e,height:c,query:r,width:i})} ${i}w`).join(", ");const Sn=({image:e,className:t,testId:n})=>{const{description:r,height:c,type:i,query:d,url:o,width:l,loading:a,decoding:u,fetchPriority:f}=e,{range:h,sizes:p}=zs(e),_=vt({format:"avif",query:d,range:h,url:o}),j=vt({format:"webp",query:d,range:h,url:o}),w=vt({format:"",query:d,range:h,url:o});return s.jsxs("picture",{className:t,children:[i!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:_,sizes:p,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:j,sizes:p,"data-testid":"source"}),s.jsx("img",{srcSet:w,sizes:p,src:o,alt:r,loading:a||"lazy",decoding:u||"async",fetchpriority:f||"auto",width:l,height:c,"data-testid":n||"image"})]})};let He=!1;const yn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=C.useIntl(),c=x.useRef(null),[i,d]=x.useState("hidden");x.useEffect(()=>{const l=c.current;if(l)return l.addEventListener("transitionend",o),()=>{l.removeEventListener("transitionend",o)}},[]);const o=({propertyName:l})=>{l==="opacity"&&(He!==!1&&clearTimeout(He),d(a=>a==="opening"?"open":a==="closing"?"closed":a==="closed"?"hidden":a))};return Re(()=>{He!==!1&&clearTimeout(He);let l="open";e?d("opening"):(d("closing"),l="hidden"),He=setTimeout(()=>{d(l)},300)},[e]),s.jsx("aside",{ref:c,className:M("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Bt=({children:e,className:t="",...n})=>s.jsx("section",{className:M("full-width-section",t),...n,children:e});const Ys=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(c=>{r.push({href:c.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":c.eventContext||"Download",target:"_blank",children:c.text})}),s.jsx(Bt,{className:M("download-section",n),children:s.jsxs(s.Fragment,{children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Ve,{buttons:r})]})})};const Gs=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const c={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:M("logos",n),children:[e&&x.createElement(c.element,{className:"title"},c.text),s.jsx("ul",{className:M({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:d,link:o=!1,description:l=!1},a)=>{if(!i||!i.url)return null;const u=s.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:d});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:o?s.jsx("a",{href:o,target:"_blank",rel:"nofollow noreferrer noopener",children:u}):u}),l&&s.jsx("small",{children:l})]},window.btoa(`${i.url}_${a}`))})})]})};const Js=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Xs=({className:e="",content:t,image:n,variant:r="default",spacing:c="normal",cta:i,children:d})=>{const o=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},a={};return o.forEach(u=>{if(!t[u]){a[u]=!1;return}if(typeof t[u]=="object"){a[u]=t[u];const{text:f,element:h}=t[u];if(h&&Js.includes(h.toLowerCase()))return;a[u]={text:f,element:l[u]};return}a[u]={text:t[u],element:l[u]}}),i&&i.link&&i.link[0]==="#"&&(i.props||(i.props={}),i.props.onClick=u=>{u.preventDefault(),u.stopPropagation();const f=document.getElementById(i.link.substring(1));f&&f.scrollIntoView({behavior:"smooth"})}),s.jsx(Bt,{className:M("banner-section",r,c,e,{"has-image":n,"has-extra-spacing":c==="normal"&&a.eyebrow&&a.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[o.map(u=>{if(a[u]&&typeof a[u]=="object"){const{text:f,element:h=""}=a[u];return x.createElement(h.toLowerCase(),{key:u,className:u},f)}return null}),d,i&&i.text&&i.link&&s.jsx(z,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:i.link,...i.props,children:i.text})]}),n&&s.jsx(Sn,{image:{...n,aspect:"banner"}})]})})},Zs=x.memo(Xs);const qs=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:c})=>!n&&!r?null:s.jsxs("aside",{className:M("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(z,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":"learn-more-click",children:t.text})]}),at="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"}},Ks="200,000+";const Ot=({label:e=!1,className:t="",children:n})=>{const r=C.useIntl();return s.jsxs("details",{className:M("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const Te=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:M("highlighted-text-box",e,t),...r,children:n});const Ge=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let c=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,d=ze(i);if(i&&typeof n=="object"&&typeof d=="number"){const f=Object.assign({},n.breakpoints),h=jn(Object.keys(f));c=En(d,h,f)}const{breakpoints:o,text:l="",component:a,...u}=n;return s.jsx(Te,{variant:"subtle",className:M("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(dt,{options:{forceBlock:!0},children:t}),c&&typeof n=="object"&&(a||s.jsx(z,{...u,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Nt=({children:e,...t})=>s.jsx("p",{...t,children:e}),Mn={q:Nt,blockquote:Nt};for(let e=1;e<=6;e++)Mn[`h${e}`]={component:Nt,props:{className:"title"}};const Tn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:M("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(dt,{options:{wrapper:x.Fragment,forceBlock:!0,overrides:Mn},children:r}):s.jsx("p",{children:r})]});const er=({className:e="",show:t=!1,hide:n=!1,text:r,children:c})=>{const i=C.useIntl(),d=x.useRef(null),[o,l]=x.useState(""),[a,u]=x.useState("closed");x.useEffect(()=>{const p=d.current;if(p)return p.addEventListener("transitionend",f),()=>{p.removeEventListener("transitionend",f)}},[]),x.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Type your {action} here...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_thread_show:"Show {count, plural, =0 {replies} one {# reply} other {# replies}}",discussion_thread_hide:"Hide replies",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",filters_all:"Show all",filters_disabled:"{name} - no results",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",inviteModal_title:"You’re registered",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_profile:"My profile",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",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>",sharedLinks_copy_text:"Copy link",tags_community:"From the community",tooltip_loading:"Loading..."},Ls={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>"},Bs={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>"},Os={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>"},Qs=Object.freeze(Object.defineProperty({__proto__:null,en:Bt,es:Ls,fr:Bs,pt:Os},Symbol.toStringTag,{value:"Module"})),Hs=e=>e in Bt,ke=(e,t,n,r,c={})=>{let i="";return Hs(`${t}_${n}`)?i=e({id:`${t}_${n}`},c):i=e({id:t},{[r]:n,...c}),i},Us=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let c=n.length-1;c>=0;c--){const i=Math.pow(10,(c+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&c<n.length-1&&(e=1,c++),r=`${e}${n[c]}`;break}}return r},at=(e,t)=>x.Children.map(e,n=>x.cloneElement(n,{...t})),Ws=e=>e.replace(/\s+/g,"").length>0,z=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:c=!1,element:i="button",onClick:d=!1,className:o="",disabled:l=!1,screenreaderText:a=!1,children:u=!1,...f})=>{const p=ze(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const w=Object.assign({},t),S=En(Object.keys(w));t=Sn(p,S,w)}const _=[];typeof t=="string"&&_.push(t),r&&(_.push("icon"),typeof r=="object"?(_.push(r.icon),r.position?_.push(r.position):_.push("left"),r.hover&&_.push(`hover_${r.hover}`),r.animate&&(_.push("animate"),typeof r.animate=="string"&&_.push(r.animate))):(_.push(r),!r.includes("right")&&!r.includes("left")&&_.push("left"))),n.muted&&_.push("muted"),n.fullWidth&&_.push("full-width");const j={...f,className:M(e,o,_,{"no-text":!u,disabled:l,button:c}),onClick:w=>{(!c||c[0]==="#")&&d&&(w.preventDefault(),w.stopPropagation()),d&&d(w)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return c&&(i="a",j.href=c),x.createElement(i,j,u||(a?s.jsx(ue,{showOnFocus:!1,children:a}):null))},Ve=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",c=e.map((i,d)=>r==="p"?s.jsx(z,{...i},d):s.jsx("li",{children:s.jsx(z,{...i})},d));return x.createElement(r,{className:M("button-wrapper",t),...n,children:c})};const Ae=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return s.jsx("hr",{className:M(e,{"has-max-width":t}),style:n})},Ye=({href:e,children:t,fallbackElement:n,className:r="",onClick:c,gtmContext:i,gtmType:d,...o})=>{if(e){const l={...o};return c&&(l.onClick=c),i&&(l["data-gtm-event-context"]=i),d&&(l["data-gtm-event-type"]=d),s.jsx("a",{href:e,className:M("gtm-trackable",r),...l,children:t})}return n?x.createElement(n,{children:t,className:r,...o}):t},dn={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"}},zs=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:c}=e?dn[e]:dn.fallback;return{range:t&&t.length>0?t:r,sizes:n||c}},Vs=({format:e,height:t,query:n,width:r})=>{let c=`w=${r}&h=${t}`;return c=e?`${c}&fm=${e}`:c,c=n?`${c}&${n}`:c,c},wt=({format:e,range:t,url:n,query:r})=>t.map(({height:c,width:i})=>`${n}?${Vs({format:e,height:c,query:r,width:i})} ${i}w`).join(", ");const yn=({image:e,className:t,testId:n})=>{const{description:r,height:c,type:i,query:d,url:o,width:l,loading:a,decoding:u,fetchPriority:f}=e,{range:h,sizes:p}=zs(e),_=wt({format:"avif",query:d,range:h,url:o}),j=wt({format:"webp",query:d,range:h,url:o}),w=wt({format:"",query:d,range:h,url:o});return s.jsxs("picture",{className:t,children:[i!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:_,sizes:p,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:j,sizes:p,"data-testid":"source"}),s.jsx("img",{srcSet:w,sizes:p,src:o,alt:r,loading:a||"lazy",decoding:u||"async",fetchpriority:f||"auto",width:l,height:c,"data-testid":n||"image"})]})};let He=!1;const Mn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=C.useIntl(),c=x.useRef(null),[i,d]=x.useState("hidden");x.useEffect(()=>{const l=c.current;if(l)return l.addEventListener("transitionend",o),()=>{l.removeEventListener("transitionend",o)}},[]);const o=({propertyName:l})=>{l==="opacity"&&(He!==!1&&clearTimeout(He),d(a=>a==="opening"?"open":a==="closing"?"closed":a==="closed"?"hidden":a))};return De(()=>{He!==!1&&clearTimeout(He);let l="open";e?d("opening"):(d("closing"),l="hidden"),He=setTimeout(()=>{d(l)},300)},[e]),s.jsx("aside",{ref:c,className:M("tooltip text-medium",i,{loading:t}),hidden:i==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Ot=({children:e,className:t="",...n})=>s.jsx("section",{className:M("full-width-section",t),...n,children:e});const Ys=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(c=>{r.push({href:c.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":c.eventContext||"Download",target:"_blank",children:c.text})}),s.jsx(Ot,{className:M("download-section",n),children:s.jsxs(s.Fragment,{children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Ve,{buttons:r})]})})};const Gs=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const c={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:M("logos",n),children:[e&&x.createElement(c.element,{className:"title"},c.text),s.jsx("ul",{className:M({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:i,nameOfBusiness:d,link:o=!1,description:l=!1},a)=>{if(!i||!i.url)return null;const u=s.jsx("img",{src:i.url,width:i.width||"auto",height:i.height||"auto",alt:d});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:o?s.jsx("a",{href:o,target:"_blank",rel:"nofollow noreferrer noopener",children:u}):u}),l&&s.jsx("small",{children:l})]},window.btoa(`${i.url}_${a}`))})})]})};const Js=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Xs=({className:e="",content:t,image:n,variant:r="default",spacing:c="normal",cta:i,children:d})=>{const o=["eyebrow","title","text"],l={eyebrow:"small",title:"h1",text:"p"},a={};return o.forEach(u=>{if(!t[u]){a[u]=!1;return}if(typeof t[u]=="object"){a[u]=t[u];const{text:f,element:h}=t[u];if(h&&Js.includes(h.toLowerCase()))return;a[u]={text:f,element:l[u]};return}a[u]={text:t[u],element:l[u]}}),i&&i.link&&i.link[0]==="#"&&(i.props||(i.props={}),i.props.onClick=u=>{u.preventDefault(),u.stopPropagation();const f=document.getElementById(i.link.substring(1));f&&f.scrollIntoView({behavior:"smooth"})}),s.jsx(Ot,{className:M("banner-section",r,c,e,{"has-image":n,"has-extra-spacing":c==="normal"&&a.eyebrow&&a.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[o.map(u=>{if(a[u]&&typeof a[u]=="object"){const{text:f,element:h=""}=a[u];return x.createElement(h.toLowerCase(),{key:u,className:u},f)}return null}),d,i&&i.text&&i.link&&s.jsx(z,{variant:n||r==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:i.link,...i.props,children:i.text})]}),n&&s.jsx(yn,{image:{...n,aspect:"banner"}})]})})},Zs=x.memo(Xs);const qs=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:c})=>!n&&!r?null:s.jsxs("aside",{className:M("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(z,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":c,"data-gtm-event-type":"learn-more-click",children:t.text})]}),it="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"}},Ks="200,000+";const Qt=({label:e=!1,className:t="",children:n})=>{const r=C.useIntl();return s.jsxs("details",{className:M("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const $e=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:M("highlighted-text-box",e,t),...r,children:n});const Ge=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let c=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,d=ze(i);if(i&&typeof n=="object"&&typeof d=="number"){const f=Object.assign({},n.breakpoints),h=En(Object.keys(f));c=Sn(d,h,f)}const{breakpoints:o,text:l="",component:a,...u}=n;return s.jsx($e,{variant:"subtle",className:M("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(mt,{options:{forceBlock:!0},children:t}),c&&typeof n=="object"&&(a||s.jsx(z,{...u,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Pt=({children:e,...t})=>s.jsx("p",{...t,children:e}),Tn={q:Pt,blockquote:Pt};for(let e=1;e<=6;e++)Tn[`h${e}`]={component:Pt,props:{className:"title"}};const $n=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:M("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(mt,{options:{wrapper:x.Fragment,forceBlock:!0,overrides:Tn},children:r}):s.jsx("p",{children:r})]});const er=({className:e="",show:t=!1,hide:n=!1,text:r,children:c})=>{const i=C.useIntl(),d=x.useRef(null),[o,l]=x.useState(""),[a,u]=x.useState("closed");x.useEffect(()=>{const p=d.current;if(p)return p.addEventListener("transitionend",f),()=>{p.removeEventListener("transitionend",f)}},[]),x.useEffect(()=>{if(!r||typeof r!="string")return;const p=r.split(`
36
36
  `);l(p.length<3?`${r.substring(0,400)}...`:p.slice(0,3).join(`
37
- `))},[r]),x.useEffect(()=>{a==="ready-to-close"&&u("closing")},[a]);const f=({propertyName:p})=>{p==="max-height"&&u(_=>_==="opening"?"open":_==="closing"?"closed":_)};if(!r)return null;const h=["opening","open"].includes(a);return s.jsxs(Te,{variant:"subtle",className:M("hide-show-text-box",e),children:[s.jsxs("div",{ref:d,className:M("content",a),children:[s.jsx(dt,{options:{forceBlock:!0},children:a==="closed"?o:r}),a!=="closed"&&c]}),s.jsx("p",{className:"cta",children:s.jsx(z,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:M({"rotate-180":h}),onClick:()=>{u(h?"ready-to-close":"opening")},children:h?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},tr=()=>x.Fragment,nr=({children:e})=>s.jsx(Te,{variant:"secondary",children:e}),sr=["span","strong","h1","h2","h3","h4","h5","h6","p"],rr=({children:e})=>{const t=C.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(x.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const d of x.Children.toArray(i.props.children))if(!(!d||typeof d=="string"||typeof d=="number")&&x.isValidElement(d)){const o=d.type;if(sr.includes(o)){for(n=d.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const c=n?n.toString():"";return s.jsx(Ot,{label:c,className:["Sources","Resources"].includes(c)?"discrete-links":"",children:r.map(i=>i)})},or=({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})},ar=e=>{const t=C.useIntl(),n=Date.now().toString();let r="default";const c=e.src;return c.includes("youtube")||c.includes("vimeo")?r="video":c.includes("riddle")||c.includes("sli.do")?r="poll":c.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(ue,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},dn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},ir=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,c=!1;for(const i of x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&x.isValidElement(i)){const d=i.type;if(["button","center","span","strong"].includes(d)&&i.props&&i.props.children&&i.props.children[0])for((d==="button"||dn(i.props.children[0])==="button")&&(c=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!x.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&dn(r)==="button"&&(c=!0);else break}return c?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(z,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},$n=({children:e})=>s.jsx("span",{children:e});const Pt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:x.Fragment,forceBlock:!0,overrides:{a:ir,CollapsibleSection:Ot,TextBox:Te,CaseStudy:nr,style:tr,details:rr,div:or,iframe:ar}};return s.jsx("div",{className:M("markdown-text",e),children:s.jsx(dt,{options:{...r,...t},children:n})})};const Cn=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:c=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:M("page-heading",c),children:[s.jsxs("div",{className:M("content",{"has-max-width":e}),style:i,children:[t&&t.text&&x.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&x.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Rn=({size:e="medium",variant:t="default",className:n="",children:r,...c})=>s.jsx("span",{className:M("pill",e,t,n),...c,children:r});const it=({element:e="p",children:t=null,className:n="",...r})=>x.createElement(e,{...r,className:M("status-banner text-small",n),"aria-live":"assertive"},t);const cr=({progress:e=0,text:t=!1,className:n=""})=>{const r=C.useIntl(),c=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return s.jsx("span",{className:M(`progress-bar section-${c}`,n),style:i,children:s.jsx(ue,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},Dn=x.memo(cr);const wt="loadingBlock_",lr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=C.useIntl();t||(t={0:{text:r.formatMessage({id:`${wt}loading`})},75:{text:r.formatMessage({id:`${wt}almostDone`})},100:{text:r.formatMessage({id:`${wt}complete`})}});let c=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)c=i[o];const d=c&&t[c].icon?{"--icon":`url(${at}icons/${t[c].icon}.svg)`}:{};return s.jsxs(Te,{className:M("loading-block",n,{"has-icon":c&&t[c].icon}),variant:"subtle",style:d,children:[c&&s.jsx("span",{className:"step",children:t[c].text}),s.jsx(Dn,{progress:e})]})},ur=x.memo(lr);const je=({element:e="div",className:t="",...n})=>s.jsx(It,{element:e,className:M("loading-placeholder",t),...n});const Ft={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"]},An=(e,t)=>e in Ft?s.jsx("div",{className:e,children:Ft[e].map((n,r)=>An(n,r))},t):s.jsx(je,{className:e},t),Nn=({layout:e="overview-page",...t})=>s.jsx("div",{className:M("loading-state",e),...t,children:Ft[e].map((n,r)=>An(n,r))}),Pn=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):""},qe=["#5AB6A3","#A2D7AF","#806056","#3962B3"],dr=e=>{const t=Math.ceil(26/qe.length),n=Pn(e).toLowerCase();if(n==="")return qe[0];const r=n.charCodeAt(0)-96;for(let c=0;c<qe.length;c++)if(r<=t*(c+1))return qe[c]};const mn=256,Je=({className:e="",src:t="",name:n,alt:r,width:c=mn,height:i=mn,...d})=>{const[o,l]=x.useState(!1),a=x.useRef(null);x.useEffect(()=>{const f=a.current;if(!f)return;const h=f.getContext("2d");if(!h)return;const p=c,_=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=p*window.devicePixelRatio,f.height=_*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=dr(n),h.fillRect(0,0,p,_),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(Pn(n),p/2,_/1.6)},[n]);let u=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(u=!0),s.jsx("figure",{className:M("profile-picture",e,{error:o}),...d,children:u?s.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:c,height:i}):s.jsx("canvas",{ref:a})})},Qt=e=>e==="apolitical"?{image:`${at}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${at}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 c=e!=="",i=t!=="",d=n!=="";if(!c&&!i&&!d)return"";const o=`${e}${c&&i?` — ${t}`:t}`;let l=`${o}${(c||i)&&d?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=ut(l,r)),l};const mt=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:c="member-click",className:i=""})=>{const d=C.useIntl(),o=Qt(t);o.name||(o.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:l,url:a,image:u}=o,f=mr(o),h=n&&n.createdAt?Fs(n.createdAt):!1,p=n&&n.createdAt?Ps(n.createdAt):"";return x.createElement(e,{className:M("member text-medium",i),children:s.jsxs(Ye,{href:a,gtmType:c,gtmContext:r,onClick:_=>{_==null||_.stopPropagation()},children:[s.jsx(Je,{name:l,src:u}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:l}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&s.jsx("span",{className:"date",title:p,"aria-label":p,children:d.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&s.jsx("em",{children:d.formatMessage({id:"discussion_edited"})})]}),f&&s.jsx("small",{children:f})]})]})})};const fn={small:24,medium:48},Fn=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:c,showGap:i,showPlaceholders:d}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,className:l="",...a})=>{const u=C.useIntl();return!n||n.length===0?null:x.createElement(e,{...a,className:M("contributors",l,c,{"has-gap":i}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((f,h)=>{let p,_="";if(h<o){const{name:j="",image:w=""}=Qt(f);if(d)return s.jsx(je,{element:"li",className:"contributor"},h);p=s.jsx(Je,{name:j,src:w,width:fn[c||"medium"],height:fn[c||"medium"]})}else if(h===o){const j=(t||n.length)-o;p=s.jsxs("small",{className:M({"large-number":j>99}),children:["+",Us(j,0)]}),_="number-left"}return p?s.jsx("li",{className:M("contributor",_),children:p},h):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?u.formatMessage({id:`member_${n[0]}`}):ut(n[0].name||"",20):null})]})})},In=({showDevTools:e=!0,children:t})=>{const n=new U.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(U.QueryClientProvider,{client:n,children:[t,e&&s.jsx(ws.ReactQueryDevtools,{initialIsOpen:!1})]})};var fr=x.createContext({client:rt});function hr(e){var t=e.children,n=e.client,r=e.apiKey,c=e.options,i=x.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&c&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(rt.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),rt.init(r,c)),rt)},[n,r]);return x.createElement(fr.Provider,{value:{client:i}},t)}const Ln=({children:e,user:t})=>t.isLoading?s.jsx(s.Fragment,{}):process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(hr,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"https://eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,Bn=({children:e,locale:t,messages:n})=>{const r=t||"en",c={...Qs[r],...n||{}};return s.jsx(C.IntlProvider,{locale:r,messages:c,children:e})},we=x.createContext(null),On=({children:e,user:t})=>s.jsx(we.Provider,{value:t,children:e}),pr=({bootstrap:e,children:t,intl:n})=>{const[r,c]=x.useState({isLoading:!0});return x.useEffect(()=>{e().then(i=>c({...i,isLoading:!1})).catch(()=>c({isLoading:!1}))},[]),s.jsx(Bn,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(On,{user:r,children:s.jsx(In,{children:s.jsx(Ln,{user:r,children:t})})})})};const kt="joinCommunityButton",Ht=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const c=C.useIntl(),i=x.useContext(we),d=i&&typeof i.id=="string",[o,l]=x.useState(e),[a,u]=x.useState(e?"joined":"notJoined");x.useEffect(()=>{a==="joining"?u("joined"):a==="leaving"&&u("notJoined")},[o]);const f={},h={};return o&&a!=="leaving"&&(f["data-hover-text"]=c.formatMessage({id:`${kt}_leave`}),f["aria-label"]=c.formatMessage({id:`${kt}_member_aria`}),h["aria-hidden"]="true"),s.jsx(z,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&a!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{d&&(p.currentTarget.blur(),o?(u("leaving"),typeof r=="function"&&await r()):(u("joining"),typeof n=="function"&&await n()),l(!o))},className:M("join-community-button",a,{active:a==="joining"}),disabled:!d,...f,children:s.jsx("span",{className:"text",...h,children:c.formatMessage({id:`${kt}${["joining","leaving"].includes(a)?`_${a}`:o?"_member":t?"_short":""}`})})})};const jt="communityDetails_",gr=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:c=[]}={number:0,data:[]},functions:{invite:i,...d}})=>{const o=C.useIntl(),l=5,a=r||c.length,u=c.length?c:Array(l).fill({});return s.jsxs("div",{className:M("community-details",e),children:[s.jsx(De,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[o.formatMessage({id:`${jt}members`}),s.jsx("span",{className:"count",children:a})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${n}/members`,children:o.formatMessage({id:`${jt}viewAll`})})})]}),s.jsx(Fn,{contributors:{total:r,data:u},styling:{size:"medium",showGap:!0,showPlaceholders:a===0},cutoff:l})]}),s.jsx(Ht,{isMember:t,functions:{...d}}),t&&s.jsx(z,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${jt}invite`})})]})};const _r=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(ue,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:M("breadcrumbs text-small",n),children:e.map(({text:c,href:i,current:d=!1},o)=>s.jsxs("li",{children:[d&&s.jsx(ue,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Ye,{href:d?void 0:i,children:ut(c,t)})]},`${window.btoa(c)}_${o}`))})]})};const xr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:c=""})=>{const i=C.useIntl(),d=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=x.useState(t?["all"]:[]),a=(u,f)=>{let h=[];o.includes(u)?h=o.filter(p=>p!==u):u==="all"?h=["all"]:n?h=[...o.filter(p=>p!=="all"),u]:h=[u],l(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),f&&typeof f=="function"&&f()};return s.jsx("ul",{className:M("filters",c),children:d.map(({id:u,text:f,disabled:h=!1,callback:p=()=>{}})=>{let _={};return h&&(_={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),s.jsx("li",{children:s.jsx("button",{className:M(u,{selected:o.includes(u)}),onClick:j=>{j.preventDefault(),j.stopPropagation(),a(u,p)},..._,children:f})},u)})})},br=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:c,position:i})=>{i==="before-lang"?r+=`/${c}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${c}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const Et={en:"English",es:"Español",fr:"Français",pt:"Português"},Ke="languageSwitcher_",vr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:c=()=>{},urlParts:i,variant:d="default",label:o,className:l=""})=>{const a=C.useIntl(),[u,f]=x.useState(e);if(x.useEffect(()=>{e!==u&&f(e)},[e]),!r||!Object.values(r).some(j=>j&&j.post_name))return null;const p=Object.keys(r),_=u!==e;return s.jsxs("div",{className:M("language-switcher text-small",d,l),children:[s.jsxs("nav",{children:[d!=="short"&&s.jsx("p",{children:o||a.formatMessage({id:`${Ke}label`})}),s.jsx("ul",{children:p.map(j=>{if(!Et[j])return null;let w={className:j};return u===j?w["aria-label"]=a.formatMessage({id:`${Ke}selected`},{language:Et[j]}):w={...w,href:br(j,i),onClick:S=>{S.preventDefault(),S.stopPropagation(),f(j),c(j)}},s.jsx("li",{children:s.jsx(Ye,{...w,fallbackElement:"span",children:Et[j]})},j)})}),d!=="short"&&!_&&s.jsx("p",{children:a.formatMessage({id:`${Ke}translation_${t?"original":n?"human":"machine"}`})})]}),d!=="short"&&!_&&!t&&!n&&s.jsx("small",{children:a.formatMessage({id:`${Ke}disclaimer`},{email:Fe.support,link:j=>{const w=`mailto:${j}`;return s.jsx("a",{href:w,children:j})}})})]})};const St=C.createIntl({locale:"en",messages:Lt}),Qn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:c=!1,messages:i={button:St.formatMessage({id:"loadMore_button"}),endOfFeed:St.formatMessage({id:"loadMore_endOfFeed"}),error:St.formatMessage({id:"loadMore_error"})},className:d="",gtmContext:o="LoadMore"})=>{const[l,a]=x.useState(!1),[u,f]=x.useState(!1);if(t<=0||t<n*e)return null;const h=async p=>{try{await r(p)}catch(_){_ instanceof Error&&_.message&&_.message.includes("Cannot read items")?f(!0):a(!0)}};return s.jsxs("footer",{className:M("load-more",d),children:[l&&s.jsx("p",{className:"error",children:i.error}),u?s.jsx("p",{children:i.endOfFeed}):s.jsx(z,{variant:"secondary",icon:c,onClick:h,"data-gtm-event-context":o,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:i.button})]})};let et=!1;const Hn=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const c=C.useIntl(),i=x.useRef(null),[d,o]=x.useState(!1),l=a=>{i.current&&a.target instanceof HTMLElement&&!i.current.contains(a.target)&&o(!1)};return x.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),x.createElement(e,{ref:i,className:M("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!d),"aria-haspopup":"true","aria-expanded":d,"aria-controls":t,screenreaderText:c.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!d,children:n.map(({href:a,onClick:u,text:f,icon:h,...p},_)=>{const j={...p,onClick:w=>{o(!1),typeof u=="function"&&u(w)},onFocus:()=>{et&&(clearTimeout(et),et=!1)},onBlur:()=>{et=setTimeout(()=>{o(!1)},100)}};return a&&(j.href=a),s.jsx("li",{children:s.jsx(z,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...j,children:f})},`${window.btoa(f)}_${_}`)})})]})})},wr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const kr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],Un=({activeLink:e})=>{const t=C.useIntl(),n=x.useContext(we),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[kr.map(({key:c,href:i})=>s.jsx("li",{className:M(c,{active:wr(i,e)}),children:s.jsx("a",{href:i,"data-gtm-event-type":`${c}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${c}`})})},c)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Je,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})};const Ut=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:M("logo",e,t,n),...r,children:s.jsx(ue,{children:s.jsx(C.FormattedMessage,{id:"apolitical"})})})});const jr={"2-1":901,"1-3":769},Wn=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const c=ze(!0);let i=r;return x.Children.count(r)===1&&(i=x.Children.toArray(r)[0],i.props&&(i=i.props.children)),s.jsx("section",{className:M("columns",`layout-${e}`,n),children:x.Children.map(i,(d,o)=>t!==!1&&o===t&&c&&c<jr[e]?null:d)})},Er=({activeLink:e,...t})=>s.jsx(Wn,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(Un,{activeLink:e}),s.jsx(Cn,{...t})]})});const yt="cookieBanner_",Mt=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Tt=new Date(Date.now()+12*30*24*60*60*1e3),zn=()=>{const e=C.useIntl(),[t,n,r]=_n.useCookies(Mt),[c,i]=x.useState(!t["apol-cookie-banner"]),d=()=>{Mt.forEach(u=>{n(u,!0,{path:"/",expires:Tt,domain:u==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Tt}),Mt.forEach(u=>{if(u==="apol-cookie-banner"){n(u,!0,{path:"/",expires:Tt});return}r(u)}),i(!1)};if(!c)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:d,gtmType:"accepted-all"}],a=[];return l.forEach(u=>{a.push({variant:u.href?"tertiary":"primary",href:u.href,onClick:u.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${u.gtmType}-click`,children:e.formatMessage({id:`${yt}buttons_${u.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${yt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${yt}text`})}),s.jsx(Ve,{buttons:a})]})},Me={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_",ct="SiteFooter",hn=({group:e})=>{const t=Me[e].order||[];let n=!1;return"text"in Me[e]&&(n=Me[e].text),s.jsxs(x.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(C.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:c,gtmType:i}=Me[e][r],d={};return["legal"].includes(e)&&(d.target="_blank",d.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:c,className:"gtm-trackable","data-gtm-event-context":ct,"data-gtm-event-type":i,...d,children:s.jsx(C.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(x.Fragment,{children:[s.jsx("dt",{children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(C.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":ct,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Wt=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(It,{element:"hr"}),s.jsx(Ut,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ct,"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(hn,{group:e}),Object.keys(Me[e]).includes("child")&&s.jsx(hn,{group:Me[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray(Me.social.order)&&Me.social.order.map(e=>{const t=Me.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":ct,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(C.FormattedMessage,{id:`${Ie}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(C.FormattedMessage,{id:`${Ie}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const tt="emailHelperTextBox_",Sr=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const c=C.useIntl(),[i,d]=x.useState({path:`${tt}default`,type:"default",link:{},mail:{},error:""}),[o,l]=x.useState(!1),a=x.useCallback(p=>{p.preventDefault(),p.stopPropagation();const _=j=>{d({path:`${tt}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>a(w),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:j})};if(typeof r!="function"){_(c.formatMessage({id:`${tt}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(j=>{_(j.message)}).finally(()=>{l(!1)})},[t,n,r]);x.useEffect(()=>{let p=tt,_="default",j={},w={};switch(e){case"gov":p+="autoApproved",_="success";break;case"nonGov":p+="unrecognisedEmail",_="error",j={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",_="error",w={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",_="error",j={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:S=>a(S),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",_="error",j={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},w={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",j={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}d({...i,path:p,type:_,link:j,mail:w})},[e]);const u={};return["link","mail"].forEach(p=>{u[p]=Object.keys(i[p]).length?_=>s.jsx("a",{...i[p],children:_}):_=>_}),s.jsx(Tn,{type:i.type,heading:o?!1:c.formatMessage({id:`${i.path}_title`}),children:o?s.jsxs(s.Fragment,{children:[s.jsx(je,{element:"span"}),s.jsx(je,{element:"span"})]}):c.formatMessage({id:`${i.path}_text`},{...u,strong:p=>s.jsx("strong",{children:p}),em:p=>s.jsx("em",{children:p}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:i.error})})};const nt="passwordRules_",Vn="isMoreThanEightCharacters",Yn="includesNumberAndSymbol",Gn="includesLowerAndUppercase",yr={[Vn]:"8Characters",[Yn]:"numberSymbol",[Gn]:"lowercaseUppercase"},Mr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=C.useIntl();return s.jsxs("aside",{className:M("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${nt}intro`})}),s.jsx("ul",{children:[Vn,Yn,Gn].map(r=>s.jsxs("li",{className:M({matches:e[r]}),children:[s.jsxs(ue,{children:[n.formatMessage({id:`${nt}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${nt}rule_${yr[r]}`})}),!e[r]&&s.jsxs(ue,{element:"strong",children:[" "," ",n.formatMessage({id:`${nt}notMet`})]})]},`rule-${r}`))})]})},Tr=x.memo(Mr);const $r=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:c=()=>{}},className:i="",hasLoaded:d=!1})=>{const o=C.useIntl(),[l,a]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const S=await n();a(g=>({...g,setUp:!0,id:S&&S.id,disabled:!1}))}catch(S){a(g=>({...g,setUp:!0,disabled:!0})),c(S)}};if(x.useEffect(()=>{d&&!l.setUp&&u()},[d]),!d)return s.jsx(je,{className:"rating-placeholder"});const{id:f,rating:h,disabled:p}=l,_="ratings_",j={text:o.formatMessage({id:`${_}text`}),low:o.formatMessage({id:`${_}low`}),high:o.formatMessage({id:`${_}high`}),success:o.formatMessage({id:`${_}success`}),...e},w=async S=>{if(!(!f||p))try{a(g=>({...g,rating:S,disabled:!0})),await r({id:f,value:S})}catch(g){a(T=>({...T,rating:null})),c(g)}finally{a(g=>({...g,disabled:!1}))}};return s.jsxs("div",{className:M("rating",i),children:[s.jsx("span",{className:"label",children:j[h?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(S=>{const g=S+1;return s.jsx("li",{className:M({selected:h&&g<=h}),children:s.jsx(z,{variant:"tertiary",size:"small",icon:{icon:`star${!h||g>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${_}stars`},{number:g,total:t})}${g===1||g===t?` - ${j[g===1?"low":"high"]}`:""}`,onClick:T=>{T.preventDefault(),T.stopPropagation(),w(g)},disabled:p})},`rating-${g}`)})})]})};const Jn=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:c="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:d=!0,isDesktopVersion:o=!1}=n||{},l=C.useIntl(),a=x.useRef(null);Re(()=>{!n||o||!d||a.current&&a.current.focus()},[d]);const u=f=>{f.preventDefault(),f.stopPropagation(),!(!a.current||!a.current.value||a.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(a.current.value)}`)};return s.jsx("form",{onSubmit:u,className:M("search-form gtm-trackable",t),"data-gtm-event-context":c,"data-gtm-event-type":i,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!d:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(ue,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),s.jsx("input",{ref:a,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&u(f)}}),s.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),a.current&&a.current.value&&(a.current.value="")},children:s.jsx(ue,{children:l.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:u,children:s.jsx(ue,{children:l.formatMessage({id:"search_cta"})})})]})})})};const Xn=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:c,backgroundColor:i,onClose:d,reportError:o,sendInvites:l,initialFormStatus:a="NOT_SUBMITTED"})=>{const[u,f]=x.useState([]),[h,p]=x.useState(!0),[_,j]=x.useState(a),{formatMessage:w}=C.useIntl(),S=async R=>{R.preventDefault();try{await l(u),f([]),j("SUCCESS")}catch(D){j("ERROR"),o(D)}},g=R=>{R.preventDefault(),j("NOT_SUBMITTED"),p(!0),f([])},T=R=>{R.preventDefault(),d(),j("CLOSED")};return _==="CLOSED"?null:_==="ERROR"||_==="SUCCESS"?s.jsxs("div",{className:"invite-form-wrapper",children:[s.jsx("div",{className:"content centred",children:_==="SUCCESS"?s.jsx("h2",{className:"success-title",children:w({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",w({id:"inviteForm_error"})]})}),s.jsx(De,{}),s.jsx("div",{className:"footer",children:_==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"secondary",onClick:g,children:w({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(z,{onClick:T,children:w({id:"inviteForm_ctaDone"})})]}):s.jsx(z,{onClick:g,children:w({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:i},onSubmit:S,className:M("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:c},children:t}),s.jsx(ks.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:w({id:"inviteForm_email_placeholder"}),emails:u,onChange:R=>{f(R),p(!R.length)},autoFocus:!1,getLabel:(R,D,L)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:R}),s.jsx(z,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{L(D),p(!u.length)},className:"remove-email-button",screenreaderText:w({id:"overlay_close"})})]},D)})]}),s.jsx(De,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(z,{className:"sendEmailsButton",disabled:h,children:n})})]})})},Q={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const d=`logged${e?"In":"Out"}`;return t>=n[i][d]};let c={};return["navigation","search"].forEach(i=>{c[i]=r(i)}),c},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(c=>c===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const c=Date.now();if(!t&&Q.handlerCalled[e]&&c-Q.handlerCalled[e]<500)return;Q.handlerCalled[e]=c;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(d=>{d===e||n[d]===!1||i.push({type:`menus.${d}`,value:!1})}),r(i)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const c=xn(e[r],t);if(!(typeof c>"u")&&(!n||c[t]&&c[t].includes(n)||c.value&&c.value.includes(n)||c.toString().includes(n)))return e[r]}return e[0].children?Q.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:c})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let d,o;switch(e){case"navigation":if(n){const l=Q.findFirstChild(t.current.children,"attributes.aria-controls","navigation");d=Q.findFirstChild(l.children,"href")}else d=Q.findFirstChild(t.current.children,"href");d||(d=t.current);break;case"account":if(o=Q.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;d=Q.findFirstChild(o.children,"href");break;default:return}d&&(c([{type:`focusElements.${e}.${i}`,value:d}]),d.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Q.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Q.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Q.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Q.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},We={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"}}}},lt=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:c=()=>{},doTrack:i=null})=>{const d=C.useIntl(),o=xn(We,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,a=i===null?l?o.doTrack:!0:i,u=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let g=o.gtmType||`${e}-click`;if(g.includes(".")){const T=g.split("."),R=T[T.length-2];g=`${R==="topics"?`${R}-`:""}${T[T.length-1]}`}h={href:o.href,role:"menuitem"},a&&(h={...h,className:"gtm-trackable","data-gtm-event-type":g,"data-gtm-event-context":"HeaderButtons"}),u&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],_=p&&o[o.order[0]].order,j=h&&window.location.pathname===o.href;let w={},S={};if(p){const g=o.menuId||e,T={onClick:R=>Q.events.onClick(R,{id:g,callback:c,isOpen:r[g]}),onFocus:()=>Q.events.onFocus({id:g}),onBlur:()=>Q.events.onBlur({id:g,callback:c}),onMouseLeave:()=>Q.events.onBlur({id:g,callback:c}),onMouseEnter:()=>Q.events.onMouseEnter({id:g,callback:c})};n&&(_&&(w={...T,onKeyPress:R=>{R.key==="Enter"&&Q.events.onClick(R,{id:g,callback:c,isOpen:r[g]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[g],"aria-controls":g}),S={hidden:g in r?!r[g]:!0}),_||(S={...S,...T})}return s.jsxs("li",{className:M({[o.className]:o.className,"has-submenu":p,parent:_,active:j}),role:"none",...w,children:[h?x.createElement(u?z:"a",h,d.formatMessage({id:f})):d.formatMessage({id:f}),o.order&&s.jsx("ul",{...S,children:o.order.map(g=>{if(!o[g])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:c,doTrack:l?a:null};return o[g].order?s.jsxs("li",{className:M({[o[g].className]:o[g].className}),children:[d.formatMessage({id:`${f}_${g}`}),s.jsx("ul",{children:o[g].order.map(R=>s.jsx(lt,{id:`${e}.${g}.${R}`,...T},R))})]},g):s.jsx(lt,{id:`${e}.${g}`,...T},g)})})]},e)};const Cr={height:67,height_desktop:83},zt=({showNavigation:e=!0})=>{const t=C.useIntl(),n=x.useContext(we),r=ze(!0,!0),c=n&&typeof n.id=="string",i=x.useMemo(()=>Q.getIsDesktopVersion(c,r),[c,r]),[d,o]=x.useReducer(Ns,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:a,focusElements:u}=d;kn({scrollPosition:Cr[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!i&&a.navigation||Q.shouldChangeHeaderIsVisible(!0,a,o)},scrollDown:()=>{!i&&a.navigation||Q.shouldChangeHeaderIsVisible(!1,a,o)}}});const f=(p,_)=>{Q.handleMenus({id:p,value:_,menus:a,dispatch:o})},h=x.useRef(null);return Re(()=>{a.navigation&&Q.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:u,dispatch:o})},[a.navigation]),Re(()=>{a.account&&Q.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:u,dispatch:o})},[a.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:M({"logged-in":c,"logged-out":!c,visible:l}),children:[s.jsx(ue,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(Ut,{}),e&&s.jsxs(s.Fragment,{children:[!i.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),f("navigation",!a.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":a.navigation,"aria-controls":"navigation",children:s.jsx(ue,{children:t.formatMessage({id:`header_menu_${a.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||a.account?!1:!a.navigation,role:"menu","data-showing":!i.navigation&&a.account?"account":"default",children:We.order.map(p=>s.jsx(lt,{id:p,isLoggedIn:c,isDesktopVersion:i.navigation,menus:{navigation:a.navigation,account:a.account},callback:f},p))}),!i.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),f("search",!a.search)},"aria-haspopup":"true","aria-expanded":a.search,"aria-controls":"search-form",children:s.jsx(ue,{children:t.formatMessage({id:`header_search_${a.search?"hide":"show"}`})})}),s.jsx(Jn,{id:"global-search",handleToggle:{searchIsOpen:a.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),c?s.jsxs("button",{className:"account-button",onClick:p=>Q.events.onClick(p,{id:"account",callback:f,isOpen:a.account}),onMouseEnter:()=>Q.events.onMouseEnter({id:"account",callback:f}),onMouseLeave:()=>Q.events.onBlur({id:"account",callback:f}),"aria-haspopup":"true","aria-expanded":a.account,"aria-controls":"navigation",children:[s.jsx(ue,{children:t.formatMessage({id:`header_account_${a.account?"hide":"show"}`})}),s.jsx(Je,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:We.buttons.order.map(p=>s.jsx(lt,{id:`buttons.${p}`},p))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:M("overlay",{open:a.navigation||a.account||!i.search&&a.search})})]})};const Vt=({element:e="section",children:t,className:n,...r})=>x.createElement(e,{className:M("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const Yt=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:c=()=>{},onClose:i=()=>{}}={},forceShow:{error:d=!1}={},title:o,children:l,buttons:a,className:u="",gtmContext:f="Modal"})=>{const h=C.useIntl(),[p,_]=x.useState(t),j=S=>{_(S),S?(c(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};x.useEffect(()=>{j(t)},[t]);const w=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:M("overlay",{open:p}),children:s.jsx(Vt,{id:e,className:M("overlay-modal",u,{"has-max-width":r}),hidden:!p,style:w,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[o&&s.jsx("h2",{className:"modal-title",children:o}),s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>j(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(De,{}),l,a&&s.jsxs("div",{className:"bottom",children:[s.jsx(De,{}),s.jsx(Ve,{buttons:a})]}),d&&s.jsx(it,{className:"error",children:d})]})})})},Zn=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Rr=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:c="Invite your colleagues by typing or pasting their emails below.",ctaMessage:i="Send",showIcon:d,onClose:o,reportError:l=()=>{},sendInvites:a})=>s.jsx(Yt,{title:n,isOpen:t,showDivider:!1,showIcon:d,functions:{onClose:o},className:M("invite-modal",e,{success:!!n}),children:s.jsx(Xn,{title:r,label:c,ctaMessage:i,onClose:o,sendInvites:a,reportError:l})});const Dr=()=>{const e=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(zt,{}),s.jsx("div",{id:"content",children:s.jsx(Ge,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Wt,{})]})},Ar=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:c={},styling:i={},className:d="",locale:o="en"})=>{const{navigation:l=!0,footer:a=!0}=c,{background:u="default",variant:f="default",circle:h="default"}=i,p=vn();x.useEffect(()=>{window.scrollTo(0,0)},[p]);const _=ot(e,{locale:o}),j=ot(t,{locale:o}),w=ot(n,{locale:o}),S={};return u!=="default"&&(S[u]=!0),f!=="default"&&(S[f]=!0),h!=="default"&&(S[h]=!0),s.jsx(js.ErrorBoundary,{onError:r,fallback:s.jsx(Dr,{}),children:s.jsx(x.Suspense,{fallback:s.jsx(Nn,{layout:"overview-page"}),children:s.jsx("div",{id:"wrapper",className:M(d,S),children:s.jsxs(_n.CookiesProvider,{children:[s.jsx(zt,{showNavigation:l}),j&&s.jsx("div",{className:"additional-content prepended",children:j}),x.createElement(u==="bold"?Vt:"div",{id:"content",children:_}),w&&s.jsx("div",{className:"additional-content appended",children:w}),a&&s.jsx(Wt,{}),s.jsx(zn,{})]})})})})},pn={default:"tags_",headerTopics:"header_topics_topics_"},$t={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"},Nr={getTagDetails:e=>{if(e.includes("topic_")){if(e=$t.topic[e.replace("topic_","")],e){const t=We.topics.topics[e].href;return t?{id:e,href:t,text:`${pn.headerTopics}${e}`}:null}return null}return $t[e]?(e=$t[e],{id:e,text:`${pn.default}${e}`}):null}};const Pr=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:c="",gtmType:i="tag-click",gtmContext:d="tags"})=>{const o=C.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(a=>{if(!a)return;const u=Nr.getTagDetails(a);u&&l.push(u)}),l.length<1?null:s.jsx("ul",{className:M("tags text-small",t,c,{"one-line":n}),children:l.map(a=>{const u=o.formatMessage({id:a.text});return s.jsx("li",{children:a.href&&r?s.jsx("a",{href:a.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":d,children:u}):u},a.id)})})};const Fr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:c="member-click",className:i=""})=>{const d=C.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:M("members-list",i),children:[s.jsxs("h1",{children:[d.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((o,l)=>s.jsxs("li",{children:[s.jsx(mt,{member:o,gtmContext:r,gtmType:c}),o.isAdmin&&s.jsx(Rn,{children:d.formatMessage({id:"membersList_admin"})})]},l))}),n&&s.jsx(Qn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let st=null;const xe="discussion_form_",Gt=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:c=5e4,minRows:i=4,forceShow:d={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var P,X;const a=C.useIntl(),u=x.useContext(we),[f,h]=x.useState(n.isEditing&&n.isEditing.text||""),[p,_]=x.useState(d.error||!1),[j,w]=x.useState(!1),S=x.useRef(null);if(r||(r=S),n.isLoading)return s.jsx(je,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const g=b=>{const q=b.target.value;h(q);let k;!u||!u.id?k=ke(a.formatMessage,`${xe}error_loggedOut`,e.type,"action"):t?q.length>=c&&(k=`${xe}error_tooLong`):k=ke(a.formatMessage,`${xe}error_noPermission`,e.type,"action"),k?_(k):p&&_(!1)};let T=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const b=e.type==="response"?((P=e.slugs)==null?void 0:P.question)||"":((X=e.slugs)==null?void 0:X.answer)||"";b&&(T=`${T}-${b.slice(-15)}`)}const R=async b=>{var k;if(b.preventDefault(),b.stopPropagation(),!u||!u.id||!t||L)return;st&&clearTimeout(st),w("submitting");const q=window.location.pathname;try{let v;switch(e.type){case"post":v=await o.create({content:f});break;case"question":v=await o.create({title:f,authorId:u&&u.id,...(k=o.props)==null?void 0:k.create});break;case"response":v=await o.create({question:e.slugs.question},{body:f,authorId:u&&u.id,contentPath:q});break;case"reply":v=await o.create({question:e.slugs.question,answer:e.slugs.answer},{body:f,authorId:u&&u.id,contentPath:q});break;default:break}await Is(1e3),o.callback&&await o.callback(v),st=setTimeout(()=>{h(""),w("submitted"),D()},500)}catch(v){const W=v;let J=`${xe}error`;W.message.includes("entry already exists")&&(J=ke(a.formatMessage,`${xe}error_alreadyExists`,e.type,"action")),W.message.includes("429")?J=ke(a.formatMessage,`${xe}error_tooMany`,e.type,"action"):W.message.includes("400")&&(J=`${xe}error`),_(J),D()}},D=()=>{st=setTimeout(()=>{_(!1),w(!1)},5e3)},L=!f||!Ws(f),V=j==="submitting",N=[];return(n.isEditing&&!V||d.cancel)&&N.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!d.cancel&&(!u||!u.id||!f),children:a.formatMessage({id:`${xe}cancel`})}),N.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:b=>{if(n.isEditing){w("submitting"),o.handleSaveEdit&&o.handleSaveEdit(S.current&&"value"in S.current?S.current.value:"");return}R(b)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!u||!u.id||!t||L||V||n.isEditing&&f===n.isEditing.text,children:a.formatMessage({id:`${xe}${V?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:T,className:M("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:ke(a.formatMessage,`${xe}title`,e.type,"action")}),s.jsx(mt,{member:u||"community",gtmContext:l,gtmType:"profile-click"}),s.jsx(ue,{element:"label",showOnFocus:!1,htmlFor:`${T}-input`,children:ke(a.formatMessage,`${xe}label`,e.type,"action")}),s.jsx(Es,{ref:r,id:`${T}-input`,name:e.type,placeholder:ke(a.formatMessage,`${xe}placeholder`,e.type,"action"),onChange:g,value:f,maxLength:c,"aria-invalid":!!p,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),s.jsx("small",{children:ke(a.formatMessage,`${xe}explainer`,e.type,"action",{a:b=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:b})})}),s.jsx(Ve,{buttons:N}),j==="submitted"&&s.jsx(it,{className:"success","data-testid":"success",children:ke(a.formatMessage,`${xe}success`,e.type,"action")}),p&&s.jsx(it,{id:"error-message",className:"error","data-testid":"error",children:d.error?d.error:typeof p=="string"?p.includes(" ")?p:a.formatMessage({id:p},{action:a.formatMessage({id:`discussion_action_${e.type}`}),maxLength:c}):p})]})},ft=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:c,leave:i,notMemberStateText:d}})=>r&&!n?s.jsx(Ge,{text:d,button:{component:s.jsx(Ht,{functions:{join:c,leave:i}})}}):s.jsx(Gt,{content:{type:e,slugs:{}},functions:{create:t}}),Ir={showThread:!1,showForm:!1},Xe=x.createContext(Ir),qn=({children:e})=>{const[t,n]=x.useState({showThread:!1,showForm:!1});return s.jsx(Xe.Provider,{value:{...t,updateConversation:n},children:e})},Lr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Br=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ue=!1;const Ct=()=>{Ue!==!1&&(clearTimeout(Ue),Ue=!1)},Rt=10,Kn=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:c=!1,content:i={type:"reply",slugs:{}},canLike:d=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const a=C.useIntl();x.useEffect(()=>{p(c)},[c]);const[u,f]=x.useState(t),[h,p]=x.useState(c),[_,j]=x.useState(!1),[w,S]=x.useState(!1),g=x.useMemo(()=>Br(n,Rt),[n]),T=D=>{if(D.preventDefault(),D.stopPropagation(),S(!1),Ue)return Ct(),!1;if(Ct(),_||!d)return!1;Ue=setTimeout(R,350)},R=async()=>{if(Ct(),_||!d)return!1;let D=h?u-1:u+1;D<0&&(D=0),j(!0),f(D),p(!h);try{if(i&&i.slugs){const L=Lr(i.slugs);h?await l(L):await o(L,{contentPath:window.location.pathname})}}catch{f(t),p(c)}finally{j(!1)}};return x.createElement(e,{className:M("likes-wrapper text-medium action-button",{"show-spinner":_,"is-liked":h,disabled:!d}),onClick:T,onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},onFocus:()=>{S(!0)},onBlur:()=>{S(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:M({"do-animation":h&&!c}),screenreaderText:d?a.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:a.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:T,disabled:!d,"aria-hidden":!d,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),s.jsx("span",{className:M("number-of-likes",{"no-likes":u===0}),"data-testid":"number-of-likes",children:a.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:u})}),n&&s.jsx(yn,{isOpen:w,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[g.map(D=>typeof D=="string"||!D.name?null:s.jsx("li",{children:s.jsx(Ye,{href:D.id?`/profiles/${D.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:L=>L==null?void 0:L.stopPropagation(),children:D.name})},D.id||window.btoa(D.name))),n.length>Rt&&s.jsx("li",{children:a.formatMessage({id:"discussion_likes_more"},{number:n.length-Rt})})]})})]})})},gn=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Jt=(e,t)=>e&&!t;const ye="discussion_",Or=280,Ze=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:c,functions:{content:{createContent:i,deleteContent:d,updateContent:o}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:l,deleteLike:a}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:u}={openComments:()=>{}}},links:f={},className:h,gtmContext:p="DiscussionAnswer",children:_,isTruncated:j=!1})=>{const w=C.useIntl(),S=x.useContext(we),g=x.useContext(Xe),[T,R]=x.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[D,L]=x.useState(!1),[V,N]=x.useState("");if(x.useEffect(()=>{R({...T,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:P,canLike:X,createdAt:b,id:q,likes:k=0,userLiked:v,comments:W=0}=t,J=j?ut(T.body,Or):T.body,ne=S&&S.id&&typeof P!="string"&&P.id&&P.id===S.id||!1,se=typeof X=="boolean"?X:n?!ne:!1,re=async F=>{F||(F=""),N("");try{if(!Ss(F,T.body)){const oe=t.type==="question"?{title:F}:{body:F};await o(gn(t.slugs),oe)}R({body:F,isEditing:!1,didEdit:!0})}catch{N(`${ye}form_error`)}},K=()=>{g&&g.updateConversation&&g.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const oe=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,me=document.getElementById(oe),ae=document.getElementById(`${oe}-input`);ae&&ae.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},de=()=>{L(!1);try{d(gn(t.slugs))}catch{N("delete-error")}},ce=[{text:w.formatMessage({id:`${ye}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(w.formatMessage({id:`${ye}report_subject`}))}&body=${encodeURI(w.formatMessage({id:`${ye}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:w.formatMessage({id:`${ye}moreMenu_edit`}),onClick:()=>R({...T,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${ye}moreMenu_delete`}),onClick:F=>{F.preventDefault(),F.stopPropagation(),L(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`delete-${t.type}-click`,...Zn(`delete-${t.slug}-modal`,D)}),x.createElement(e,{className:M("discussion-post",h),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:q||t.slug,className:M("discussion-card",t.type,{editing:T.isEditing,"has-link":f.post&&!T.isEditing}),onClick:F=>{!f.post||T.isEditing||(F.preventDefault(),F.stopPropagation(),window.location.href=f.post)},children:[!T.isEditing&&s.jsx(mt,{member:P,additionalContent:{createdAt:b,didEdit:T.didEdit},className:typeof P!="string"&&P.id===c?"highlighted":"",gtmContext:p,gtmType:"profile-click"}),T.isEditing?s.jsx(Gt,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:T.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?w.formatMessage({id:V},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:i,handleSaveEdit:re,handleCancel:()=>{N(""),R({...T,isEditing:!1})}},gtmContext:`${p}Form`}):f.post?s.jsx("a",{href:f.post,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":"title-click",children:s.jsx(Pt,{options:{overrides:{a:$n}},children:J})}):s.jsx(Pt,{options:{wrapper:t.type==="question"?"h1":x.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:J}),!T.isEditing&&s.jsxs("ul",{className:M("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(Kn,{element:"li",likes:k,isShort:!1,userLiked:v,content:{type:t.type,slugs:t.slugs},canLike:se,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:l,deleteLike:a}}),(["question","post"].includes(t.type)||f.comments||typeof u=="function")&&s.jsxs("li",{className:"action-button",onClick:F=>{F.preventDefault(),F.stopPropagation(),f.comments&&(window.location.href=f.comments),typeof u=="function"&&u()},children:[s.jsx(z,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:f.comments?f.comments:!1,onClick:f.comments||typeof u!="function"?!1:u,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:w.formatMessage({id:`${ye}comments_screenReader`},{count:W})}),s.jsx("span",{children:w.formatMessage({id:`${ye}comments`},{count:W})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(z,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:K,children:w.formatMessage({id:`${ye}reply`})})}),s.jsx(Hn,{element:"li",id:`more-${t.slug}`,options:ce})]})]}),_,s.jsx(Yt,{id:`delete-${t.slug}-modal`,isOpen:D,functions:{onOpen:()=>{},onClose:()=>L(!1)},forceShow:{error:V==="delete-error"?w.formatMessage({id:"discussion_delete_error"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:w.formatMessage({id:"discussion_delete_title"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>L(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:de,children:w.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(C.FormattedMessage,{id:"discussion_delete_text",values:{p:F=>s.jsx("p",{children:F}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Dt="discussion_responses_",Qr=({type:e="answer",responses:t=0})=>{const n=C.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${Dt}title`},{action:n.formatMessage({id:`${Dt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ke(n.formatMessage,`${Dt}empty`,e,e)})]})};const es=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=C.useIntl(),c=x.useRef(null),i=x.useContext(Xe),[d,o]=x.useState("closed");x.useEffect(()=>{const f=c.current;if(f)return f.addEventListener("transitionend",l),()=>{f.removeEventListener("transitionend",l)}},[]),Re(()=>{d==="closed"&&!i.showThread||o(["opening","open"].includes(d)?"ready-to-close":"opening")},[i.showThread]),x.useEffect(()=>{d==="ready-to-close"&&o("closing")},[d]);const l=({propertyName:f})=>{f==="max-height"&&o(h=>h==="opening"?"open":h==="closing"?"closed":h)},a=["opening","open"].includes(d),u=ot(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(z,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${a?"left":"right"}`},onClick:()=>{var f;(f=i.updateConversation)==null||f.call(i,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${a?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:c,className:M("thread",d),hidden:!i.showThread,children:u})]})},Hr=({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}),Ur=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:o})=>{if(!n)return;const l=Hr({user:n,content:o,verb:"post"});await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,u=>[...u,l]),{previousActivities:a}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Wr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),a=l==null?void 0:l.map(u=>((u==null?void 0:u.id)===(d==null?void 0:d.activityId)&&(u.content=o),u));return e.setQueryData(t,()=>a&&[...a]),{previousActivities:a}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),zr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:d})=>{await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),l=o==null?void 0:o.filter(a=>(a==null?void 0:a.id)!==d);return e.setQueryData(t,()=>l&&[...l]),{previousActivities:l}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:(d,o,l)=>{e.invalidateQueries({queryKey:[...t,l.activityId]})}}),Vr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:o})=>{await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),a=l==null?void 0:l.map(u=>{var f;return(u==null?void 0:u.id)===o&&((f=u.reaction_counts)!=null&&f.like?u.reaction_counts.like+=1:u.reaction_counts.like=1),u});return e.setQueryData(t,()=>a&&[...a]),{previousActivities:a}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivities)},onSuccess:o=>{const l=e.getQueryData(t),a=l==null?void 0:l.map(u=>{var f,h;return(u==null?void 0:u.id)===(o==null?void 0:o.activity_id)&&((f=u.own_reactions)!=null&&f.like?u.own_reactions.like.push(o):u.own_reactions.like=[o],(h=u.latest_reactions)!=null&&h.like?u.latest_reactions.like.push(o):u.own_reactions.like=[o]),u});return e.setQueryData(t,()=>a&&[...a]),{previousActivities:l}},onSettled:(o,l,a)=>{e.invalidateQueries({queryKey:[...t,a.activityId]})}}),Yr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:l})=>{await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),u=a==null?void 0:a.map(f=>{var h;return(f==null?void 0:f.id)===l&&(h=f.reaction_counts)!=null&&h.like&&(f.reaction_counts.like-=1),f});return e.setQueryData(t,()=>u&&[...u]),{previousActivities:u}},onError:(l,a,u)=>{e.setQueryData(t,u.previousActivities)},onSuccess:(l,{activityId:a})=>{const u=e.getQueryData(t),f=u==null?void 0:u.map(h=>{var p,_,j,w,S;if(h.id===a){const g=(j=(_=(p=h.own_reactions)==null?void 0:p.like)==null?void 0:_.find(T=>T.user_id===(n==null?void 0:n.id)))==null?void 0:j.id;return h.own_reactions.like=(w=h.own_reactions.like)==null?void 0:w.filter(T=>T.id!==g),h.latest_reactions.like=(S=h.latest_reactions.like)==null?void 0:S.filter(T=>T.id!==g),h}else return h});return e.setQueryData(t,()=>f&&[...f]),{previousActivities:u}},onSettled:(l,a,u)=>{e.invalidateQueries({queryKey:[...t,u.activityId]})}}),Gr=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:c,edit:i,remove:d,like:o,unlike:l,join:a,leave:u}})=>{const f=C.useIntl(),h=U.useQueryClient(),p=x.useContext(we),{data:_,error:j,isLoading:w,isFetching:S}=U.useQuery({queryKey:[e,t],queryFn:r}),g=Ur({queryClient:h,queryKey:[e,t],user:p,mutationFn:c}),{mutate:T}=U.useMutation(g),R=Wr({queryClient:h,queryKey:[e,t],mutationFn:async v=>await i(v)}),{mutate:D}=U.useMutation(R),L=zr({queryClient:h,queryKey:[e,t],mutationFn:async({activityId:v})=>await d({activityId:v})}),{mutate:V}=U.useMutation(L),N=Vr({queryClient:h,queryKey:[e,t],mutationFn:o}),{mutate:P}=U.useMutation(N),X=Yr({queryClient:h,queryKey:[e,t],user:p,mutationFn:async({activityId:v})=>{var ne,se,re;const W=_&&(_==null?void 0:_.find(K=>K.id===v)),J=(re=(se=(ne=W==null?void 0:W.own_reactions)==null?void 0:ne.like)==null?void 0:se.find(K=>K.user_id===(p==null?void 0:p.id)))==null?void 0:re.id;await l({reactionId:J||"",activityId:v})}}),{mutate:b}=U.useMutation(X),q=x.useCallback(({activityId:v})=>P({activityId:v}),[P]),k=x.useCallback(({activityId:v})=>b({activityId:v}),[b]);return j?s.jsx(Ge,{variant:"error",text:j.message}):w?s.jsx(je,{style:{height:"400px"}}):s.jsxs(s.Fragment,{children:[s.jsx(ft,{contentType:"post",createPost:T,membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:u,notMemberStateText:f.formatMessage({id:"community_joinToPost"})}}),!S&&Array.isArray(_)&&(_==null?void 0:_.map(v=>{var ne,se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he;const W=((ne=v==null?void 0:v.actor)==null?void 0:ne.id)===(p==null?void 0:p.id),J=Jt(n,W);return s.jsxs(x.Fragment,{children:[s.jsx(Ze,{content:{type:"post",body:v==null?void 0:v.content,canLike:J,createdAt:(v==null?void 0:v.time)||"",slugs:{parentId:t,activityId:v==null?void 0:v.id},slug:v==null?void 0:v.id,author:{id:(se=v==null?void 0:v.actor)==null?void 0:se.id,name:`${(K=(re=v==null?void 0:v.actor)==null?void 0:re.data)==null?void 0:K.name}`,organization:(ce=(de=v==null?void 0:v.actor)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(oe=(F=v==null?void 0:v.actor)==null?void 0:F.data)==null?void 0:oe.jobTitle,image:{thumbnail:((ae=(me=v==null?void 0:v.actor)==null?void 0:me.data)==null?void 0:ae.thumbnail)||void 0}},userLiked:((pe=v==null?void 0:v.own_reactions)==null?void 0:pe.like)&&((fe=v==null?void 0:v.own_reactions)==null?void 0:fe.like.length)>0,likes:(v==null?void 0:v.reaction_counts.like)||0,comments:(v==null?void 0:v.reaction_counts.reply)||0,peopleWhoLiked:((ge=v==null?void 0:v.latest_reactions)==null?void 0:ge.like)&&((he=v==null?void 0:v.latest_reactions)==null?void 0:he.like.map(B=>{var Y,ie;return{id:B==null?void 0:B.user_id,name:(ie=(Y=B==null?void 0:B.user)==null?void 0:Y.data)==null?void 0:ie.name}}))},links:{post:`${e}/${t}/${v==null?void 0:v.id}`,comments:`${e}/${t}/${v==null?void 0:v.id}`},functions:{content:{createContent:()=>null,deleteContent:B=>V(B),updateContent:(B,Y)=>D({activityInfo:B,content:Y})},likes:{createLike:()=>{q({activityId:v==null?void 0:v.id})},deleteLike:()=>{k({activityId:v==null?void 0:v.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(De,{})]},v==null?void 0:v.id)}))]})},Jr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:o=>{var a;const l=e.getQueryData(t);if(l)return(a=l==null?void 0:l.latest_reactions)!=null&&a.reply?(l.latest_reactions.reply.unshift(o),l&&(l.reaction_counts={reply:l.latest_reactions.reply.length})):(l.latest_reactions={reply:[o]},l.reaction_counts={reply:1}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Xr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:i,content:{body:d}})=>{var a,u,f;if(d.length===0)return;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((a=o==null?void 0:o.latest_reactions)!=null&&a.reply))return;const l=(f=(u=o==null?void 0:o.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(h=>(h.id===i.replySlug&&(h.data.content=d),h));return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}},onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)}}),Zr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:i})=>{var l,a,u;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);if(!d||!((l=d==null?void 0:d.latest_reactions)!=null&&l.reply))return;const o=(u=(a=d==null?void 0:d.latest_reactions)==null?void 0:a.reply)==null?void 0:u.filter(f=>f.id!==i);return e.setQueryData(t,()=>({...d,latest_reactions:{reply:o}})),{previousActivity:d}},onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)}}),qr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d})=>{var a,u;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),l=(u=(a=o==null?void 0:o.latest_reactions)==null?void 0:a.reply)==null?void 0:u.map(f=>{var h;return f.id===d&&((h=f.children_counts)!=null&&h.like?f.children_counts.like+=1:f.children_counts={like:1}),f});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:d=>{var a;const o=e.getQueryData(t),l=(a=o==null?void 0:o.latest_reactions.reply)==null?void 0:a.map(u=>{var f,h;return u.id===d.id&&((f=u.own_children)!=null&&f.like?u.own_children.like.push(d):u.own_children={like:[d]},(h=u.latest_children)!=null&&h.like?u.latest_children.like.push(d):u.latest_children={like:[d]}),u});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}}}),Kr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:o})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);if(!l)return;const a=(u=l.latest_reactions.reply)==null?void 0:u.map(f=>(f.id===o&&f.children_counts.like&&(f.children_counts.like-=1),f));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:(o,{replyId:l})=>{var f;const a=e.getQueryData(t);if(!a)return;const u=(f=a.latest_reactions.reply)==null?void 0:f.map(h=>{var p,_,j;if(h.id===l){let w=(p=h.latest_children.reply)==null?void 0:p.filter(S=>S.user_id!==(n==null?void 0:n.id));return w=(j=(_=h==null?void 0:h.own_children)==null?void 0:_.reply)==null?void 0:j.filter(S=>S.user_id!==(n==null?void 0:n.id)),w}return h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}}}),eo=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:o=>{var u;const l=e.getQueryData(t),a=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(f=>(f.id===o.parent&&(f.latest_children.reply&&f.children_counts.reply?(f.latest_children.reply.push(o),f.children_counts.reply+=1):(f.latest_children.reply=[o],f.children_counts.reply=1)),f));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),to=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)},onMutate:async({replyInfo:i,content:{body:d}})=>{var a,u,f;if(d.length===0)return;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((a=o==null?void 0:o.latest_reactions)!=null&&a.reply))return;const l=(f=(u=o==null?void 0:o.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(h=>{var p;return h.id===i.replyParentId&&((p=h.latest_children.reply)==null||p.map(_=>(_.id===i.replySlug&&(_.data.content=d),_))),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}}}),no=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)},onMutate:async({replyId:i,replyParentId:d})=>{var a,u,f;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((a=o==null?void 0:o.latest_reactions)!=null&&a.reply))return;const l=(f=(u=o==null?void 0:o.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(h=>{var p,_;return h.id===d&&(h.latest_children.reply=(p=h.latest_children.reply)==null?void 0:p.filter(j=>j.id!==i),(_=h.children_counts)!=null&&_.reply&&(h.children_counts.reply-=1)),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}}}),so=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d,replyParentId:o})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),a=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(f=>{var h;return f.id===o&&((h=f.latest_children.reply)==null||h.map(p=>{var _;return p.id===d&&((_=p.children_counts)!=null&&_.like?p.children_counts.like+=1:p.children_counts={like:1}),p})),f});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(d,o)=>{var u;const l=e.getQueryData(t),a=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(f=>{var h;return f.id===o.replyParentId&&((h=f.latest_children.reply)==null||h.map(p=>(p.id===o.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))),f});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}}}),ro=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:o,replyParentId:l})=>{var f;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),u=(f=a==null?void 0:a.latest_reactions.reply)==null?void 0:f.map(h=>{var p;return h.id===l&&((p=h.latest_children.reply)==null||p.map(_=>{var j;return _.id===o&&((j=_.children_counts)!=null&&j.like?_.children_counts.like-=1:_.children_counts={like:0}),_})),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:(o,l)=>{var f;const a=e.getQueryData(t),u=(f=a==null?void 0:a.latest_reactions.reply)==null?void 0:f.map(h=>{var p;return h.id===l.replyParentId&&((p=h.latest_children.reply)==null||p.map(_=>{var j,w;return _.id===l.replyId&&((j=_.own_children)!=null&&j.like&&(_.own_children.like=_.own_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id))),(w=_.latest_children)!=null&&w.like&&(_.latest_children.like=_.latest_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id)))),_})),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}}}),oo=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:c,replies:i,functions:{create:d,edit:o,remove:l,join:a,leave:u,like:f,unlike:h}})=>{const p=C.useIntl(),_=U.useQueryClient(),j=x.useContext(we),w=x.useContext(Xe),S=eo({queryClient:_,queryKey:[e,t,r],mutationFn:async k=>d({replyId:n,content:k.body})}),{mutate:g}=U.useMutation(S),T=to({queryClient:_,queryKey:[e,t,r],mutationFn:o}),{mutate:R}=U.useMutation(T),D=no({queryClient:_,queryKey:[e,t,r],mutationFn:async({replyId:k})=>l({replyId:k})}),{mutate:L}=U.useMutation(D),V=so({queryClient:_,queryKey:[e,t,r],mutationFn:f}),{mutate:N}=U.useMutation(V),P=ro({queryClient:_,queryKey:[e,t,r],user:j,mutationFn:h}),{mutate:X}=U.useMutation(P),b=x.useCallback(({replyId:k,replyParentId:v})=>N({replyId:k,replyParentId:v}),[N]),q=x.useCallback(({replyId:k,replyParentId:v})=>X({replyId:k,replyParentId:v}),[X]);return s.jsx(es,{count:c,showRepliesButton:c>0||w.showForm,children:s.jsxs(s.Fragment,{children:[w.showForm&&s.jsx(ft,{contentType:"reply",createPost:(k,v)=>g(v),membershipRequiredToPost:{isMember:!0,required:!0,join:a,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(i==null?void 0:i.length)===0||(i==null?void 0:i.map(k=>{var v,W,J,ne,se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he;return s.jsx(Ze,{content:{type:"reply",body:typeof k.data.content=="string"?(v=k==null?void 0:k.data)==null?void 0:v.content:((J=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:J.text)||"",createdAt:k==null?void 0:k.created_at,slugs:{parentId:t,activityId:r,replyParentId:k==null?void 0:k.parent,reply:k==null?void 0:k.id},slug:"",author:{id:(ne=k==null?void 0:k.user)==null?void 0:ne.id,name:(re=(se=k==null?void 0:k.user)==null?void 0:se.data)==null?void 0:re.name,organization:(de=(K=k==null?void 0:k.user)==null?void 0:K.data)==null?void 0:de.organization,jobTitle:(F=(ce=k==null?void 0:k.user)==null?void 0:ce.data)==null?void 0:F.jobTitle,image:{thumbnail:((me=(oe=k==null?void 0:k.user)==null?void 0:oe.data)==null?void 0:me.thumbnail)||void 0}},userLiked:((ae=k==null?void 0:k.own_children)==null?void 0:ae.like)&&((pe=k==null?void 0:k.own_children)==null?void 0:pe.like.length)>0,likes:((fe=k==null?void 0:k.children_counts)==null?void 0:fe.like)||0,peopleWhoLiked:((ge=k==null?void 0:k.latest_children)==null?void 0:ge.like)&&((he=k==null?void 0:k.latest_children)==null?void 0:he.like.map(B=>{var Y,ie;return{id:B==null?void 0:B.user_id,name:(ie=(Y=B==null?void 0:B.user)==null?void 0:Y.data)==null?void 0:ie.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:B=>{const{replySlug:Y,replyParentId:ie}=B;return L({replyId:Y,replyParentId:ie})},updateContent:(B,Y)=>R({replyInfo:B,content:Y})},likes:{createLike:()=>b({replyId:k==null?void 0:k.id,replyParentId:k==null?void 0:k.parent}),deleteLike:()=>{var Y,ie,ee;const B=((Y=k==null?void 0:k.own_children)==null?void 0:Y.like)&&((ee=(ie=k==null?void 0:k.own_children)==null?void 0:ie.like[0])==null?void 0:ee.id);return q({replyId:B||""})}},comments:{}}},k==null?void 0:k.id)}))]})})},ts=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:c,functions:{create:i,edit:d,remove:o,like:l,unlike:a,join:u,leave:f}})=>{const h=C.useIntl(),p=U.useQueryClient(),_=x.useContext(we),j=Jr({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>i({activityId:n,content:b.body})}),{mutate:w}=U.useMutation(j),S=Xr({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:g}=U.useMutation(S),T=Zr({queryClient:p,queryKey:[e,t,n],mutationFn:async({replyId:b})=>o({replyId:b})}),{mutate:R}=U.useMutation(T),D=qr({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:L}=U.useMutation(D),V=Kr({queryClient:p,queryKey:[e,t,n],user:_,mutationFn:a}),{mutate:N}=U.useMutation(V),P=x.useCallback(({replyId:b})=>L({replyId:b}),[L]),X=x.useCallback(({replyId:b})=>N({replyId:b}),[N]);return s.jsxs(s.Fragment,{children:[s.jsx(ft,{contentType:"reply",createPost:(b,q)=>w(q),membershipRequiredToPost:{isMember:c,required:!0,join:u,leave:f,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var v,W,J,ne,se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he,B,Y,ie;const q=((v=b==null?void 0:b.user)==null?void 0:v.id)===(_==null?void 0:_.id),k=Jt(c,q);return s.jsx(qn,{children:s.jsx(Ze,{content:{type:"reply",body:typeof b.data.content=="string"?(W=b==null?void 0:b.data)==null?void 0:W.content:((ne=(J=b==null?void 0:b.data)==null?void 0:J.content)==null?void 0:ne.text)||"",canLike:k,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:b==null?void 0:b.id},slug:`${e}/${t}/${n}#${b==null?void 0:b.id}`,author:{id:(se=b==null?void 0:b.user)==null?void 0:se.id,name:(K=(re=b==null?void 0:b.user)==null?void 0:re.data)==null?void 0:K.name,organization:(ce=(de=b==null?void 0:b.user)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(oe=(F=b==null?void 0:b.user)==null?void 0:F.data)==null?void 0:oe.jobTitle,image:{thumbnail:((ae=(me=b==null?void 0:b.user)==null?void 0:me.data)==null?void 0:ae.thumbnail)||void 0}},userLiked:((pe=b==null?void 0:b.own_children)==null?void 0:pe.like)&&((fe=b==null?void 0:b.own_children)==null?void 0:fe.like.length)>0,likes:((ge=b==null?void 0:b.children_counts)==null?void 0:ge.like)||0,peopleWhoLiked:((he=b==null?void 0:b.latest_children)==null?void 0:he.like)&&((B=b==null?void 0:b.latest_children)==null?void 0:B.like.map(ee=>{var le,be;return{id:ee==null?void 0:ee.user_id,name:(be=(le=ee==null?void 0:ee.user)==null?void 0:le.data)==null?void 0:be.name}}))},functions:{content:{createContent:()=>null,deleteContent:ee=>{const{replySlug:le}=ee;return R({replyId:le})},updateContent:(ee,le)=>g({replyInfo:ee,content:le})},likes:{createLike:()=>P({replyId:b==null?void 0:b.id}),deleteLike:()=>{var le,be,$e;const ee=((le=b==null?void 0:b.own_children)==null?void 0:le.like)&&(($e=(be=b==null?void 0:b.own_children)==null?void 0:be.like[0])==null?void 0:$e.id);return X({replyId:ee||""})}},comments:{}},children:s.jsx(oo,{basePath:e,parentId:t,replyParentId:b==null?void 0:b.id,activityId:n,replyCount:((Y=b==null?void 0:b.children_counts)==null?void 0:Y.reply)||0,replies:(ie=b==null?void 0:b.latest_children)==null?void 0:ie.reply,isMember:c,functions:{create:i,edit:d,remove:o,like:l,unlike:a,join:u,leave:f}})},b==null?void 0:b.id)},b==null?void 0:b.id)}))]})},ao=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);return l&&l.id===(d==null?void 0:d.activityId)&&(l.content=o),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),io=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),co=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var l;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(l=o==null?void 0:o.reaction_counts)!=null&&l.like?o.reaction_counts.like+=1:o&&(o.reaction_counts={like:1}),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:o=>{const l=e.getQueryData(t);return l!=null&&l.own_reactions.like?l.own_reactions.like.push(o):l&&(l.own_reactions={like:[o]}),l!=null&&l.latest_reactions.like?l.latest_reactions.like.push(o):l&&(l.own_reactions={like:[o]}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),lo=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:c})=>({mutationFn:c,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>0&&(a.reaction_counts.like-=1),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,u,f)=>{e.setQueryData(t,f.previousActivity)},onSuccess:()=>{var f,h,p;if(!r)return;const a=(p=(h=(f=r.own_reactions)==null?void 0:f.like)==null?void 0:h.find(_=>_.user_id===(n==null?void 0:n.id)))==null?void 0:p.id,u=e.getQueryData(t);if(u!=null&&u.own_reactions.like&&(u.own_reactions.like=u.own_reactions.like.filter(_=>_.id!==a),!!(u!=null&&u.latest_reactions.like)))return u.latest_reactions.like=u.latest_reactions.like.filter(_=>_.id!==a),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const uo=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:c,editActivity:i,removeActivity:d,likeActivity:o,unlikeActivity:l,createReply:a,editReply:u,removeReply:f,likeReply:h,unlikeReply:p,join:_,leave:j}})=>{var se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he,B,Y,ie,ee,le,be,$e,Le;const w=x.useContext(we),S=U.useQueryClient(),{data:g,error:T,isLoading:R,isFetching:D}=U.useQuery({queryKey:[e,t,n],queryFn:c}),L=ao({queryClient:S,queryKey:[e,t,n],mutationFn:async G=>await i(G)}),{mutate:V}=U.useMutation(L),N=io({queryClient:S,queryKey:[e,t,n],mutationFn:async({activityId:G})=>d({activityId:G}),redirectUrl:`${e}/${t}`}),{mutate:P}=U.useMutation(N),X=co({queryClient:S,queryKey:[e,t,n],mutationFn:o}),{mutate:b}=U.useMutation(X),q=lo({queryClient:S,queryKey:[e,t,n],user:w,mutationFn:async()=>{var Ee,Ce,Ae;const G=(Ae=(Ce=(Ee=g==null?void 0:g.own_reactions)==null?void 0:Ee.like)==null?void 0:Ce.find(ht=>ht.user_id===(w==null?void 0:w.id)))==null?void 0:Ae.id;await l({activityId:n,reactionId:G})},activity:g}),{mutate:k}=U.useMutation(q),v=x.useCallback(({activityId:G})=>b({activityId:G}),[b]),W=x.useCallback(async({activityId:G})=>k({activityId:G}),[k]);if(T)return s.jsx(Ge,{variant:"error",text:T.message});if(R||D)return s.jsx(je,{style:{height:"400px"}});const J=((se=g==null?void 0:g.actor)==null?void 0:se.id)===(w==null?void 0:w.id),ne=Jt(r,J);return s.jsx(Ze,{className:"activity-section",content:{type:"post",body:g==null?void 0:g.content,canLike:ne,createdAt:(g==null?void 0:g.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:g==null?void 0:g.id},slug:n,author:{id:(re=g==null?void 0:g.actor)==null?void 0:re.id,name:((K=g==null?void 0:g.actor)==null?void 0:K.data)&&((ce=(de=g==null?void 0:g.actor)==null?void 0:de.data)==null?void 0:ce.name),organization:((F=g==null?void 0:g.actor)==null?void 0:F.data)&&((me=(oe=g==null?void 0:g.actor)==null?void 0:oe.data)==null?void 0:me.organization),jobTitle:((ae=g==null?void 0:g.actor)==null?void 0:ae.data)&&((fe=(pe=g==null?void 0:g.actor)==null?void 0:pe.data)==null?void 0:fe.jobTitle),image:{thumbnail:((ge=g==null?void 0:g.actor)==null?void 0:ge.data)&&((B=(he=g==null?void 0:g.actor)==null?void 0:he.data)==null?void 0:B.thumbnail)||void 0}},userLiked:((Y=g==null?void 0:g.own_reactions)==null?void 0:Y.like)&&((ie=g==null?void 0:g.own_reactions)==null?void 0:ie.like.length)>0,likes:g&&(g==null?void 0:g.reaction_counts.like),comments:g&&(g==null?void 0:g.reaction_counts.reply),peopleWhoLiked:((ee=g==null?void 0:g.latest_reactions)==null?void 0:ee.like)&&((le=g==null?void 0:g.latest_reactions)==null?void 0:le.like.map(G=>{var Ee,Ce;return{id:G==null?void 0:G.user_id,name:(Ce=(Ee=G==null?void 0:G.user)==null?void 0:Ee.data)==null?void 0:Ce.name}}))},originalAuthorId:(be=g==null?void 0:g.actor)==null?void 0:be.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>P({activityId:n}),updateContent:(G,Ee)=>V({activityInfo:G,content:Ee})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>W({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",(($e=g==null?void 0:g.reaction_counts)==null?void 0:$e.reply)||0,")"]}),s.jsx(ts,{basePath:e,parentId:t,activityId:n,repliesList:(Le=g==null?void 0:g.latest_reactions)==null?void 0:Le.reply,isMember:r,functions:{create:a,edit:u,remove:f,like:h,unlike:p,join:_,leave:j}})]})},n)},mo=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:c}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:c}});exports.ASSETS_BUCKET=at;exports.ActivitiesFeed=Gr;exports.ActivitySection=uo;exports.AddPost=ft;exports.BannerSection=Zs;exports.Breadcrumbs=_r;exports.Button=z;exports.ButtonWrapper=Ve;exports.CacheProvider=In;exports.CollapsibleSection=Ot;exports.Columns=Wn;exports.CommunityDetails=gr;exports.Contributors=Fn;exports.ConversationContext=Xe;exports.CookieBanner=zn;exports.DiscussionConversation=qn;exports.DiscussionForm=Gt;exports.DiscussionLikes=Kn;exports.DiscussionPost=Ze;exports.DiscussionThread=es;exports.Divider=De;exports.DownloadSection=Ys;exports.EMAILS=Fe;exports.EmailHelperTextBox=Sr;exports.EmptyStateBox=Ge;exports.Filters=xr;exports.FlagsProvider=Ln;exports.Footer=Wt;exports.FullWidthSection=Bt;exports.GlobalProviders=pr;exports.Header=zt;exports.HelperTextBox=Tn;exports.HiddenFromScreenReaders=It;exports.HideShowTextBox=er;exports.HighlightedTextBox=Te;exports.IntlProvider=Bn;exports.InviteForm=Xn;exports.InviteModal=Rr;exports.JoinButton=Ht;exports.LanguageSwitcher=vr;exports.Link=Ye;exports.LoadMore=Qn;exports.LoadingBlock=ur;exports.LoadingPlaceholder=je;exports.LoadingState=Nn;exports.Logo=Ut;exports.LogoSection=Gs;exports.MarkdownText=Pt;exports.MarketingBox=qs;exports.Member=mt;exports.MembersList=Fr;exports.Modal=Vt;exports.MoreMenu=Hn;exports.NUMBER_OF_USERS=Ks;exports.NavigationMenu=Un;exports.Overlay=Yt;exports.PageHeading=Cn;exports.PageLayout=Ar;exports.PasswordRules=Tr;exports.Pill=Rn;exports.ProfilePicture=Je;exports.ProgressBar=Dn;exports.Rating=$r;exports.RepliesFeed=ts;exports.ResponsesHeading=Qr;exports.ResponsiveImage=Sn;exports.SearchForm=Jn;exports.Span=$n;exports.StatusBanner=it;exports.Tags=Pr;exports.Tooltip=yn;exports.TopLevelPage=Er;exports.UserContext=we;exports.UserProvider=On;exports.VisuallyHidden=ue;exports.addAriaProps=Zn;exports.getMember=Qt;exports.headerData=We;exports.mapGetStreamData=mo;exports.useCurrentPath=vn;exports.useEffectAfterMount=Re;exports.useElementWidth=ze;exports.useScrollListener=kn;exports.useScrollToHash=As;
37
+ `))},[r]),x.useEffect(()=>{a==="ready-to-close"&&u("closing")},[a]);const f=({propertyName:p})=>{p==="max-height"&&u(_=>_==="opening"?"open":_==="closing"?"closed":_)};if(!r)return null;const h=["opening","open"].includes(a);return s.jsxs($e,{variant:"subtle",className:M("hide-show-text-box",e),children:[s.jsxs("div",{ref:d,className:M("content",a),children:[s.jsx(mt,{options:{forceBlock:!0},children:a==="closed"?o:r}),a!=="closed"&&c]}),s.jsx("p",{className:"cta",children:s.jsx(z,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:M({"rotate-180":h}),onClick:()=>{u(h?"ready-to-close":"opening")},children:h?n||i.formatMessage({id:"hideShowTextBox_hide"}):t||i.formatMessage({id:"hideShowTextBox_show"})})})]})},tr=()=>x.Fragment,nr=({children:e})=>s.jsx($e,{variant:"secondary",children:e}),sr=["span","strong","h1","h2","h3","h4","h5","h6","p"],rr=({children:e})=>{const t=C.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(x.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const d of x.Children.toArray(i.props.children))if(!(!d||typeof d=="string"||typeof d=="number")&&x.isValidElement(d)){const o=d.type;if(sr.includes(o)){for(n=d.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const c=n?n.toString():"";return s.jsx(Qt,{label:c,className:["Sources","Resources"].includes(c)?"discrete-links":"",children:r.map(i=>i)})},or=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx($e,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx($e,{variant:"primary",children:e});case"pink-textbox":return s.jsx($e,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},ar=e=>{const t=C.useIntl(),n=Date.now().toString();let r="default";const c=e.src;return c.includes("youtube")||c.includes("vimeo")?r="video":c.includes("riddle")||c.includes("sli.do")?r="poll":c.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(ue,{children:s.jsx("a",{href:`#content-after-iframe-${n}`,children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})})}),s.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),s.jsx("span",{id:`content-after-iframe-${n}`,tabIndex:-1})]})},mn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},ir=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,c=!1;for(const i of x.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&x.isValidElement(i)){const d=i.type;if(["button","center","span","strong"].includes(d)&&i.props&&i.props.children&&i.props.children[0])for((d==="button"||mn(i.props.children[0])==="button")&&(c=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!x.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&mn(r)==="button"&&(c=!0);else break}return c?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(z,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},Cn=({children:e})=>s.jsx("span",{children:e});const Ft=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:x.Fragment,forceBlock:!0,overrides:{a:ir,CollapsibleSection:Qt,TextBox:$e,CaseStudy:nr,style:tr,details:rr,div:or,iframe:ar}};return s.jsx("div",{className:M("markdown-text",e),children:s.jsx(mt,{options:{...r,...t},children:n})})};const Rn=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:c=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return s.jsxs("section",{className:M("page-heading",c),children:[s.jsxs("div",{className:M("content",{"has-max-width":e}),style:i,children:[t&&t.text&&x.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&x.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Dn=({size:e="medium",variant:t="default",className:n="",children:r,...c})=>s.jsx("span",{className:M("pill",e,t,n),...c,children:r});const ct=({element:e="p",children:t=null,className:n="",...r})=>x.createElement(e,{...r,className:M("status-banner text-small",n),"aria-live":"assertive"},t);const cr=({progress:e=0,text:t=!1,className:n=""})=>{const r=C.useIntl(),c=e>75?100:e>50?75:e>25?50:e>5?25:0,i={"--progress":`${e}%`};return s.jsx("span",{className:M(`progress-bar section-${c}`,n),style:i,children:s.jsx(ue,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},An=x.memo(cr);const kt="loadingBlock_",lr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=C.useIntl();t||(t={0:{text:r.formatMessage({id:`${kt}loading`})},75:{text:r.formatMessage({id:`${kt}almostDone`})},100:{text:r.formatMessage({id:`${kt}complete`})}});let c=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)c=i[o];const d=c&&t[c].icon?{"--icon":`url(${it}icons/${t[c].icon}.svg)`}:{};return s.jsxs($e,{className:M("loading-block",n,{"has-icon":c&&t[c].icon}),variant:"subtle",style:d,children:[c&&s.jsx("span",{className:"step",children:t[c].text}),s.jsx(An,{progress:e})]})},ur=x.memo(lr);const je=({element:e="div",className:t="",...n})=>s.jsx(Lt,{element:e,className:M("loading-placeholder",t),...n});const It={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"]},Nn=(e,t)=>e in It?s.jsx("div",{className:e,children:It[e].map((n,r)=>Nn(n,r))},t):s.jsx(je,{className:e},t),Pn=({layout:e="overview-page",...t})=>s.jsx("div",{className:M("loading-state",e),...t,children:It[e].map((n,r)=>Nn(n,r))}),Fn=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):""},Ke=["#5AB6A3","#A2D7AF","#806056","#3962B3"],dr=e=>{const t=Math.ceil(26/Ke.length),n=Fn(e).toLowerCase();if(n==="")return Ke[0];const r=n.charCodeAt(0)-96;for(let c=0;c<Ke.length;c++)if(r<=t*(c+1))return Ke[c]};const fn=256,Je=({className:e="",src:t="",name:n,alt:r,width:c=fn,height:i=fn,...d})=>{const[o,l]=x.useState(!1),a=x.useRef(null);x.useEffect(()=>{const f=a.current;if(!f)return;const h=f.getContext("2d");if(!h)return;const p=c,_=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=p*window.devicePixelRatio,f.height=_*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=dr(n),h.fillRect(0,0,p,_),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(Fn(n),p/2,_/1.6)},[n]);let u=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(u=!0),s.jsx("figure",{className:M("profile-picture",e,{error:o}),...d,children:u?s.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:c,height:i}):s.jsx("canvas",{ref:a})})},Ht=e=>e==="apolitical"?{image:`${it}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${it}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 c=e!=="",i=t!=="",d=n!=="";if(!c&&!i&&!d)return"";const o=`${e}${c&&i?` — ${t}`:t}`;let l=`${o}${(c||i)&&d?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=dt(l,r)),l};const ft=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:c="member-click",className:i=""})=>{const d=C.useIntl(),o=Ht(t);o.name||(o.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:l,url:a,image:u}=o,f=mr(o),h=n&&n.createdAt?Fs(n.createdAt):!1,p=n&&n.createdAt?Ps(n.createdAt):"";return x.createElement(e,{className:M("member text-medium",i),children:s.jsxs(Ye,{href:a,gtmType:c,gtmContext:r,onClick:_=>{_==null||_.stopPropagation()},children:[s.jsx(Je,{name:l,src:u}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:l}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&h&&s.jsx("span",{className:"date",title:p,"aria-label":p,children:d.formatMessage({id:`dates_${h.path}`},{number:h.number})}),n.didEdit&&s.jsx("em",{children:d.formatMessage({id:"discussion_edited"})})]}),f&&s.jsx("small",{children:f})]})]})})};const hn={small:24,medium:48},In=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:c,showGap:i,showPlaceholders:d}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,className:l="",...a})=>{const u=C.useIntl();return!n||n.length===0?null:x.createElement(e,{...a,className:M("contributors",l,c,{"has-gap":i}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((f,h)=>{let p,_="";if(h<o){const{name:j="",image:w=""}=Ht(f);if(d)return s.jsx(je,{element:"li",className:"contributor"},h);p=s.jsx(Je,{name:j,src:w,width:hn[c||"medium"],height:hn[c||"medium"]})}else if(h===o){const j=(t||n.length)-o;p=s.jsxs("small",{className:M({"large-number":j>99}),children:["+",Us(j,0)]}),_="number-left"}return p?s.jsx("li",{className:M("contributor",_),children:p},h):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?u.formatMessage({id:`member_${n[0]}`}):dt(n[0].name||"",20):null})]})})},Ln=({showDevTools:e=!0,children:t})=>{const n=new U.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(U.QueryClientProvider,{client:n,children:[t,e&&s.jsx(ws.ReactQueryDevtools,{initialIsOpen:!1})]})};var fr=x.createContext({client:ot});function hr(e){var t=e.children,n=e.client,r=e.apiKey,c=e.options,i=x.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&c&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(ot.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ot.init(r,c)),ot)},[n,r]);return x.createElement(fr.Provider,{value:{client:i}},t)}const Bn=({children:e,user:t})=>t.isLoading?s.jsx(s.Fragment,{}):process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(hr,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"https://eu.posthog.com",autocapture:!1,secure_cookie:!0,bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):e,On=({children:e,locale:t,messages:n})=>{const r=t||"en",c={...Qs[r],...n||{}};return s.jsx(C.IntlProvider,{locale:r,messages:c,children:e})},we=x.createContext(null),Qn=({children:e,user:t})=>s.jsx(we.Provider,{value:t,children:e}),pr=({bootstrap:e,children:t,intl:n})=>{const[r,c]=x.useState({isLoading:!0});return x.useEffect(()=>{e().then(i=>c({...i,isLoading:!1})).catch(()=>c({isLoading:!1}))},[]),s.jsx(On,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Qn,{user:r,children:s.jsx(Ln,{children:s.jsx(Bn,{user:r,children:t})})})})};const jt="joinCommunityButton",Ut=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const c=C.useIntl(),i=x.useContext(we),d=i&&typeof i.id=="string",[o,l]=x.useState(e),[a,u]=x.useState(e?"joined":"notJoined");x.useEffect(()=>{a==="joining"?u("joined"):a==="leaving"&&u("notJoined")},[o]);const f={},h={};return o&&a!=="leaving"&&(f["data-hover-text"]=c.formatMessage({id:`${jt}_leave`}),f["aria-label"]=c.formatMessage({id:`${jt}_member_aria`}),h["aria-hidden"]="true"),s.jsx(z,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&a!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{d&&(p.currentTarget.blur(),o?(u("leaving"),typeof r=="function"&&await r()):(u("joining"),typeof n=="function"&&await n()),l(!o))},className:M("join-community-button",a,{active:a==="joining"}),disabled:!d,...f,children:s.jsx("span",{className:"text",...h,children:c.formatMessage({id:`${jt}${["joining","leaving"].includes(a)?`_${a}`:o?"_member":t?"_short":""}`})})})};const Et="communityDetails_",gr=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:c=[]}={number:0,data:[]},functions:{invite:i,...d}})=>{const o=C.useIntl(),l=5,a=r||c.length,u=c.length?c:Array(l).fill({});return s.jsxs("div",{className:M("community-details",e),children:[s.jsx(Ae,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[o.formatMessage({id:`${Et}members`}),s.jsx("span",{className:"count",children:a})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${n}/members`,children:o.formatMessage({id:`${Et}viewAll`})})})]}),s.jsx(In,{contributors:{total:r,data:u},styling:{size:"medium",showGap:!0,showPlaceholders:a===0},cutoff:l})]}),s.jsx(Ut,{isMember:t,functions:{...d}}),t&&s.jsx(z,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${Et}invite`})})]})};const _r=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(ue,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:M("breadcrumbs text-small",n),children:e.map(({text:c,href:i,current:d=!1},o)=>s.jsxs("li",{children:[d&&s.jsx(ue,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Ye,{href:d?void 0:i,children:dt(c,t)})]},`${window.btoa(c)}_${o}`))})]})};const xr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:c=""})=>{const i=C.useIntl(),d=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=x.useState(t?["all"]:[]),a=(u,f)=>{let h=[];o.includes(u)?h=o.filter(p=>p!==u):u==="all"?h=["all"]:n?h=[...o.filter(p=>p!=="all"),u]:h=[u],l(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),f&&typeof f=="function"&&f()};return s.jsx("ul",{className:M("filters",c),children:d.map(({id:u,text:f,disabled:h=!1,callback:p=()=>{}})=>{let _={};return h&&(_={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),s.jsx("li",{children:s.jsx("button",{className:M(u,{selected:o.includes(u)}),onClick:j=>{j.preventDefault(),j.stopPropagation(),a(u,p)},..._,children:f})},u)})})},br=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:c,position:i})=>{i==="before-lang"?r+=`/${c}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${c}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const St={en:"English",es:"Español",fr:"Français",pt:"Português"},et="languageSwitcher_",vr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:c=()=>{},urlParts:i,variant:d="default",label:o,className:l=""})=>{const a=C.useIntl(),[u,f]=x.useState(e);if(x.useEffect(()=>{e!==u&&f(e)},[e]),!r||!Object.values(r).some(j=>j&&j.post_name))return null;const p=Object.keys(r),_=u!==e;return s.jsxs("div",{className:M("language-switcher text-small",d,l),children:[s.jsxs("nav",{children:[d!=="short"&&s.jsx("p",{children:o||a.formatMessage({id:`${et}label`})}),s.jsx("ul",{children:p.map(j=>{if(!St[j])return null;let w={className:j};return u===j?w["aria-label"]=a.formatMessage({id:`${et}selected`},{language:St[j]}):w={...w,href:br(j,i),onClick:S=>{S.preventDefault(),S.stopPropagation(),f(j),c(j)}},s.jsx("li",{children:s.jsx(Ye,{...w,fallbackElement:"span",children:St[j]})},j)})}),d!=="short"&&!_&&s.jsx("p",{children:a.formatMessage({id:`${et}translation_${t?"original":n?"human":"machine"}`})})]}),d!=="short"&&!_&&!t&&!n&&s.jsx("small",{children:a.formatMessage({id:`${et}disclaimer`},{email:Fe.support,link:j=>{const w=`mailto:${j}`;return s.jsx("a",{href:w,children:j})}})})]})};const yt=C.createIntl({locale:"en",messages:Bt}),Hn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:c=!1,messages:i={button:yt.formatMessage({id:"loadMore_button"}),endOfFeed:yt.formatMessage({id:"loadMore_endOfFeed"}),error:yt.formatMessage({id:"loadMore_error"})},className:d="",gtmContext:o="LoadMore"})=>{const[l,a]=x.useState(!1),[u,f]=x.useState(!1);if(t<=0||t<n*e)return null;const h=async p=>{try{await r(p)}catch(_){_ instanceof Error&&_.message&&_.message.includes("Cannot read items")?f(!0):a(!0)}};return s.jsxs("footer",{className:M("load-more",d),children:[l&&s.jsx("p",{className:"error",children:i.error}),u?s.jsx("p",{children:i.endOfFeed}):s.jsx(z,{variant:"secondary",icon:c,onClick:h,"data-gtm-event-context":o,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:i.button})]})};let tt=!1;const Un=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const c=C.useIntl(),i=x.useRef(null),[d,o]=x.useState(!1),l=a=>{i.current&&a.target instanceof HTMLElement&&!i.current.contains(a.target)&&o(!1)};return x.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),x.createElement(e,{ref:i,className:M("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!d),"aria-haspopup":"true","aria-expanded":d,"aria-controls":t,screenreaderText:c.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!d,children:n.map(({href:a,onClick:u,text:f,icon:h,...p},_)=>{const j={...p,onClick:w=>{o(!1),typeof u=="function"&&u(w)},onFocus:()=>{tt&&(clearTimeout(tt),tt=!1)},onBlur:()=>{tt=setTimeout(()=>{o(!1)},100)}};return a&&(j.href=a),s.jsx("li",{children:s.jsx(z,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...j,children:f})},`${window.btoa(f)}_${_}`)})})]})})},wr=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const kr=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"q-and-a",href:"/questions-answers/"},{key:"articles",href:"/solution-articles/"}],Wn=({activeLink:e})=>{const t=C.useIntl(),n=x.useContext(we),r=n&&typeof n.id=="string";return s.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[kr.map(({key:c,href:i})=>s.jsx("li",{className:M(c,{active:wr(i,e)}),children:s.jsx("a",{href:i,"data-gtm-event-type":`${c}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:t.formatMessage({id:`navigationMenu_links_${c}`})})},c)),r&&s.jsx("li",{className:"profile","data-testid":"profile-link",children:s.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[s.jsx(Je,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),s.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})};const Wt=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:M("logo",e,t,n),...r,children:s.jsx(ue,{children:s.jsx(C.FormattedMessage,{id:"apolitical"})})})});const jr={"2-1":901,"1-3":769},zn=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const c=ze(!0);let i=r;return x.Children.count(r)===1&&(i=x.Children.toArray(r)[0],i.props&&(i=i.props.children)),s.jsx("section",{className:M("columns",`layout-${e}`,n),children:x.Children.map(i,(d,o)=>t!==!1&&o===t&&c&&c<jr[e]?null:d)})},Er=({activeLink:e,...t})=>s.jsx(zn,{layout:"1-3",children:s.jsxs(s.Fragment,{children:[s.jsx(Wn,{activeLink:e}),s.jsx(Rn,{...t})]})});const Mt="cookieBanner_",Tt=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],$t=new Date(Date.now()+12*30*24*60*60*1e3),Vn=()=>{const e=C.useIntl(),[t,n,r]=xn.useCookies(Tt),[c,i]=x.useState(!t["apol-cookie-banner"]),d=()=>{Tt.forEach(u=>{n(u,!0,{path:"/",expires:$t,domain:u==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:$t}),Tt.forEach(u=>{if(u==="apol-cookie-banner"){n(u,!0,{path:"/",expires:$t});return}r(u)}),i(!1)};if(!c)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:d,gtmType:"accepted-all"}],a=[];return l.forEach(u=>{a.push({variant:u.href?"tertiary":"primary",href:u.href,onClick:u.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${u.gtmType}-click`,children:e.formatMessage({id:`${Mt}buttons_${u.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${Mt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${Mt}text`})}),s.jsx(Ve,{buttons:a})]})},Te={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_",lt="SiteFooter",pn=({group:e})=>{const t=Te[e].order||[];let n=!1;return"text"in Te[e]&&(n=Te[e].text),s.jsxs(x.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(C.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:c,gtmType:i}=Te[e][r],d={};return["legal"].includes(e)&&(d.target="_blank",d.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:c,className:"gtm-trackable","data-gtm-event-context":lt,"data-gtm-event-type":i,...d,children:s.jsx(C.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(x.Fragment,{children:[s.jsx("dt",{children:s.jsx(C.FormattedMessage,{id:`${Ie}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(C.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":lt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},zt=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(Lt,{element:"hr"}),s.jsx(Wt,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":lt,"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(pn,{group:e}),Object.keys(Te[e]).includes("child")&&s.jsx(pn,{group:Te[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray(Te.social.order)&&Te.social.order.map(e=>{const t=Te.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":lt,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(C.FormattedMessage,{id:`${Ie}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(C.FormattedMessage,{id:`${Ie}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const nt="emailHelperTextBox_",Sr=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const c=C.useIntl(),[i,d]=x.useState({path:`${nt}default`,type:"default",link:{},mail:{},error:""}),[o,l]=x.useState(!1),a=x.useCallback(p=>{p.preventDefault(),p.stopPropagation();const _=j=>{d({path:`${nt}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>a(w),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:j})};if(typeof r!="function"){_(c.formatMessage({id:`${nt}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(j=>{_(j.message)}).finally(()=>{l(!1)})},[t,n,r]);x.useEffect(()=>{let p=nt,_="default",j={},w={};switch(e){case"gov":p+="autoApproved",_="success";break;case"nonGov":p+="unrecognisedEmail",_="error",j={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",_="error",w={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",_="error",j={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:S=>a(S),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",_="error",j={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},w={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",j={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}d({...i,path:p,type:_,link:j,mail:w})},[e]);const u={};return["link","mail"].forEach(p=>{u[p]=Object.keys(i[p]).length?_=>s.jsx("a",{...i[p],children:_}):_=>_}),s.jsx($n,{type:i.type,heading:o?!1:c.formatMessage({id:`${i.path}_title`}),children:o?s.jsxs(s.Fragment,{children:[s.jsx(je,{element:"span"}),s.jsx(je,{element:"span"})]}):c.formatMessage({id:`${i.path}_text`},{...u,strong:p=>s.jsx("strong",{children:p}),em:p=>s.jsx("em",{children:p}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:i.error})})};const st="passwordRules_",Yn="isMoreThanEightCharacters",Gn="includesNumberAndSymbol",Jn="includesLowerAndUppercase",yr={[Yn]:"8Characters",[Gn]:"numberSymbol",[Jn]:"lowercaseUppercase"},Mr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=C.useIntl();return s.jsxs("aside",{className:M("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${st}intro`})}),s.jsx("ul",{children:[Yn,Gn,Jn].map(r=>s.jsxs("li",{className:M({matches:e[r]}),children:[s.jsxs(ue,{children:[n.formatMessage({id:`${st}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${st}rule_${yr[r]}`})}),!e[r]&&s.jsxs(ue,{element:"strong",children:[" "," ",n.formatMessage({id:`${st}notMet`})]})]},`rule-${r}`))})]})},Tr=x.memo(Mr);const $r=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:c=()=>{}},className:i="",hasLoaded:d=!1})=>{const o=C.useIntl(),[l,a]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const S=await n();a(g=>({...g,setUp:!0,id:S&&S.id,disabled:!1}))}catch(S){a(g=>({...g,setUp:!0,disabled:!0})),c(S)}};if(x.useEffect(()=>{d&&!l.setUp&&u()},[d]),!d)return s.jsx(je,{className:"rating-placeholder"});const{id:f,rating:h,disabled:p}=l,_="ratings_",j={text:o.formatMessage({id:`${_}text`}),low:o.formatMessage({id:`${_}low`}),high:o.formatMessage({id:`${_}high`}),success:o.formatMessage({id:`${_}success`}),...e},w=async S=>{if(!(!f||p))try{a(g=>({...g,rating:S,disabled:!0})),await r({id:f,value:S})}catch(g){a(T=>({...T,rating:null})),c(g)}finally{a(g=>({...g,disabled:!1}))}};return s.jsxs("div",{className:M("rating",i),children:[s.jsx("span",{className:"label",children:j[h?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(S=>{const g=S+1;return s.jsx("li",{className:M({selected:h&&g<=h}),children:s.jsx(z,{variant:"tertiary",size:"small",icon:{icon:`star${!h||g>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${_}stars`},{number:g,total:t})}${g===1||g===t?` - ${j[g===1?"low":"high"]}`:""}`,onClick:T=>{T.preventDefault(),T.stopPropagation(),w(g)},disabled:p})},`rating-${g}`)})})]})};const Xn=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:c="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:d=!0,isDesktopVersion:o=!1}=n||{},l=C.useIntl(),a=x.useRef(null);De(()=>{!n||o||!d||a.current&&a.current.focus()},[d]);const u=f=>{f.preventDefault(),f.stopPropagation(),!(!a.current||!a.current.value||a.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(a.current.value)}`)};return s.jsx("form",{onSubmit:u,className:M("search-form gtm-trackable",t),"data-gtm-event-context":c,"data-gtm-event-type":i,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!d:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(ue,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),s.jsx("input",{ref:a,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&u(f)}}),s.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),a.current&&a.current.value&&(a.current.value="")},children:s.jsx(ue,{children:l.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:u,children:s.jsx(ue,{children:l.formatMessage({id:"search_cta"})})})]})})})};const Zn=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:c,backgroundColor:i,onClose:d,reportError:o,sendInvites:l,initialFormStatus:a="NOT_SUBMITTED"})=>{const[u,f]=x.useState([]),[h,p]=x.useState(!0),[_,j]=x.useState(a),{formatMessage:w}=C.useIntl(),S=async R=>{R.preventDefault();try{await l(u),f([]),j("SUCCESS")}catch(D){j("ERROR"),o(D)}},g=R=>{R.preventDefault(),j("NOT_SUBMITTED"),p(!0),f([])},T=R=>{R.preventDefault(),d(),j("CLOSED")};return _==="CLOSED"?null:_==="ERROR"||_==="SUCCESS"?s.jsxs("div",{className:"invite-form-wrapper",children:[s.jsx("div",{className:"content centred",children:_==="SUCCESS"?s.jsx("h2",{className:"success-title",children:w({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",w({id:"inviteForm_error"})]})}),s.jsx(Ae,{}),s.jsx("div",{className:"footer",children:_==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"secondary",onClick:g,children:w({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(z,{onClick:T,children:w({id:"inviteForm_ctaDone"})})]}):s.jsx(z,{onClick:g,children:w({id:"inviteForm_ctaTryAgain"})})})]}):s.jsx("div",{className:"invite-form-wrapper",children:s.jsxs("form",{style:{backgroundColor:i},onSubmit:S,className:M("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:c},children:t}),s.jsx(ks.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:w({id:"inviteForm_email_placeholder"}),emails:u,onChange:R=>{f(R),p(!R.length)},autoFocus:!1,getLabel:(R,D,L)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:R}),s.jsx(z,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{L(D),p(!u.length)},className:"remove-email-button",screenreaderText:w({id:"overlay_close"})})]},D)})]}),s.jsx(Ae,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(z,{className:"sendEmailsButton",disabled:h,children:n})})]})})},Q={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const d=`logged${e?"In":"Out"}`;return t>=n[i][d]};let c={};return["navigation","search"].forEach(i=>{c[i]=r(i)}),c},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(c=>c===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r})=>{if(n[e]===t||e==="account"&&t===!1&&n.navigation===!0)return;const c=Date.now();if(!t&&Q.handlerCalled[e]&&c-Q.handlerCalled[e]<500)return;Q.handlerCalled[e]=c;let i=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(d=>{d===e||n[d]===!1||i.push({type:`menus.${d}`,value:!1})}),r(i)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const c=bn(e[r],t);if(!(typeof c>"u")&&(!n||c[t]&&c[t].includes(n)||c.value&&c.value.includes(n)||c.toString().includes(n)))return e[r]}return e[0].children?Q.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:c})=>{if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){r[e][i].focus();return}let d,o;switch(e){case"navigation":if(n){const l=Q.findFirstChild(t.current.children,"attributes.aria-controls","navigation");d=Q.findFirstChild(l.children,"href")}else d=Q.findFirstChild(t.current.children,"href");d||(d=t.current);break;case"account":if(o=Q.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;d=Q.findFirstChild(o.children,"href");break;default:return}d&&(c([{type:`focusElements.${e}.${i}`,value:d}]),d.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Q.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Q.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Q.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Q.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},We={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"}}}},ut=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:c=()=>{},doTrack:i=null})=>{const d=C.useIntl(),o=bn(We,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,a=i===null?l?o.doTrack:!0:i,u=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let g=o.gtmType||`${e}-click`;if(g.includes(".")){const T=g.split("."),R=T[T.length-2];g=`${R==="topics"?`${R}-`:""}${T[T.length-1]}`}h={href:o.href,role:"menuitem"},a&&(h={...h,className:"gtm-trackable","data-gtm-event-type":g,"data-gtm-event-context":"HeaderButtons"}),u&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],_=p&&o[o.order[0]].order,j=h&&window.location.pathname===o.href;let w={},S={};if(p){const g=o.menuId||e,T={onClick:R=>Q.events.onClick(R,{id:g,callback:c,isOpen:r[g]}),onFocus:()=>Q.events.onFocus({id:g}),onBlur:()=>Q.events.onBlur({id:g,callback:c}),onMouseLeave:()=>Q.events.onBlur({id:g,callback:c}),onMouseEnter:()=>Q.events.onMouseEnter({id:g,callback:c})};n&&(_&&(w={...T,onKeyPress:R=>{R.key==="Enter"&&Q.events.onClick(R,{id:g,callback:c,isOpen:r[g]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[g],"aria-controls":g}),S={hidden:g in r?!r[g]:!0}),_||(S={...S,...T})}return s.jsxs("li",{className:M({[o.className]:o.className,"has-submenu":p,parent:_,active:j}),role:"none",...w,children:[h?x.createElement(u?z:"a",h,d.formatMessage({id:f})):d.formatMessage({id:f}),o.order&&s.jsx("ul",{...S,children:o.order.map(g=>{if(!o[g])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:c,doTrack:l?a:null};return o[g].order?s.jsxs("li",{className:M({[o[g].className]:o[g].className}),children:[d.formatMessage({id:`${f}_${g}`}),s.jsx("ul",{children:o[g].order.map(R=>s.jsx(ut,{id:`${e}.${g}.${R}`,...T},R))})]},g):s.jsx(ut,{id:`${e}.${g}`,...T},g)})})]},e)};const Cr={height:67,height_desktop:83},Vt=({showNavigation:e=!0})=>{const t=C.useIntl(),n=x.useContext(we),r=ze(!0,!0),c=n&&typeof n.id=="string",i=x.useMemo(()=>Q.getIsDesktopVersion(c,r),[c,r]),[d,o]=x.useReducer(Ns,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:a,focusElements:u}=d;jn({scrollPosition:Cr[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!i&&a.navigation||Q.shouldChangeHeaderIsVisible(!0,a,o)},scrollDown:()=>{!i&&a.navigation||Q.shouldChangeHeaderIsVisible(!1,a,o)}}});const f=(p,_)=>{Q.handleMenus({id:p,value:_,menus:a,dispatch:o})},h=x.useRef(null);return De(()=>{a.navigation&&Q.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:u,dispatch:o})},[a.navigation]),De(()=>{a.account&&Q.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:u,dispatch:o})},[a.account]),n&&n.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:M({"logged-in":c,"logged-out":!c,visible:l}),children:[s.jsx(ue,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),s.jsx(Wt,{}),e&&s.jsxs(s.Fragment,{children:[!i.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),f("navigation",!a.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":a.navigation,"aria-controls":"navigation",children:s.jsx(ue,{children:t.formatMessage({id:`header_menu_${a.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||a.account?!1:!a.navigation,role:"menu","data-showing":!i.navigation&&a.account?"account":"default",children:We.order.map(p=>s.jsx(ut,{id:p,isLoggedIn:c,isDesktopVersion:i.navigation,menus:{navigation:a.navigation,account:a.account},callback:f},p))}),!i.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),f("search",!a.search)},"aria-haspopup":"true","aria-expanded":a.search,"aria-controls":"search-form",children:s.jsx(ue,{children:t.formatMessage({id:`header_search_${a.search?"hide":"show"}`})})}),s.jsx(Xn,{id:"global-search",handleToggle:{searchIsOpen:a.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),c?s.jsxs("button",{className:"account-button",onClick:p=>Q.events.onClick(p,{id:"account",callback:f,isOpen:a.account}),onMouseEnter:()=>Q.events.onMouseEnter({id:"account",callback:f}),onMouseLeave:()=>Q.events.onBlur({id:"account",callback:f}),"aria-haspopup":"true","aria-expanded":a.account,"aria-controls":"navigation",children:[s.jsx(ue,{children:t.formatMessage({id:`header_account_${a.account?"hide":"show"}`})}),s.jsx(Je,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:We.buttons.order.map(p=>s.jsx(ut,{id:`buttons.${p}`},p))})]})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:M("overlay",{open:a.navigation||a.account||!i.search&&a.search})})]})};const Yt=({element:e="section",children:t,className:n,...r})=>x.createElement(e,{className:M("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const Gt=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:c=()=>{},onClose:i=()=>{}}={},forceShow:{error:d=!1}={},title:o,children:l,buttons:a,className:u="",gtmContext:f="Modal"})=>{const h=C.useIntl(),[p,_]=x.useState(t),j=S=>{_(S),S?(c(),document.body.classList.add("has-overlay")):(i(),document.body.classList.remove("has-overlay"))};x.useEffect(()=>{j(t)},[t]);const w=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:M("overlay",{open:p}),children:s.jsx(Yt,{id:e,className:M("overlay-modal",u,{"has-max-width":r}),hidden:!p,style:w,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[o&&s.jsx("h2",{className:"modal-title",children:o}),s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>j(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Ae,{}),l,a&&s.jsxs("div",{className:"bottom",children:[s.jsx(Ae,{}),s.jsx(Ve,{buttons:a})]}),d&&s.jsx(ct,{className:"error",children:d})]})})})},qn=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Rr=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:c="Invite your colleagues by typing or pasting their emails below.",ctaMessage:i="Send",showIcon:d,onClose:o,reportError:l=()=>{},sendInvites:a})=>s.jsx(Gt,{title:n,isOpen:t,showDivider:!1,showIcon:d,functions:{onClose:o},className:M("invite-modal",e,{success:!!n}),children:s.jsx(Zn,{title:r,label:c,ctaMessage:i,onClose:o,sendInvites:a,reportError:l})});const Dr=()=>{const e=C.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(Vt,{}),s.jsx("div",{id:"content",children:s.jsx(Ge,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(zt,{})]})},Ar=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:c={},styling:i={},className:d="",locale:o="en"})=>{const{navigation:l=!0,footer:a=!0}=c,{background:u="default",variant:f="default",circle:h="default"}=i,p=wn();x.useEffect(()=>{window.scrollTo(0,0)},[p]);const _=at(e,{locale:o}),j=at(t,{locale:o}),w=at(n,{locale:o}),S={};return u!=="default"&&(S[u]=!0),f!=="default"&&(S[f]=!0),h!=="default"&&(S[h]=!0),s.jsx(js.ErrorBoundary,{onError:r,fallback:s.jsx(Dr,{}),children:s.jsx(x.Suspense,{fallback:s.jsx(Pn,{layout:"overview-page"}),children:s.jsx("div",{id:"wrapper",className:M(d,S),children:s.jsxs(xn.CookiesProvider,{children:[s.jsx(Vt,{showNavigation:l}),j&&s.jsx("div",{className:"additional-content prepended",children:j}),x.createElement(u==="bold"?Yt:"div",{id:"content",children:_}),w&&s.jsx("div",{className:"additional-content appended",children:w}),a&&s.jsx(zt,{}),s.jsx(Vn,{})]})})})})},gn={default:"tags_",headerTopics:"header_topics_topics_"},Ct={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"},Nr={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ct.topic[e.replace("topic_","")],e){const t=We.topics.topics[e].href;return t?{id:e,href:t,text:`${gn.headerTopics}${e}`}:null}return null}return Ct[e]?(e=Ct[e],{id:e,text:`${gn.default}${e}`}):null}};const Pr=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:c="",gtmType:i="tag-click",gtmContext:d="tags"})=>{const o=C.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(a=>{if(!a)return;const u=Nr.getTagDetails(a);u&&l.push(u)}),l.length<1?null:s.jsx("ul",{className:M("tags text-small",t,c,{"one-line":n}),children:l.map(a=>{const u=o.formatMessage({id:a.text});return s.jsx("li",{children:a.href&&r?s.jsx("a",{href:a.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":d,children:u}):u},a.id)})})};const Fr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:c="member-click",className:i=""})=>{const d=C.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:M("members-list",i),children:[s.jsxs("h1",{children:[d.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((o,l)=>s.jsxs("li",{children:[s.jsx(ft,{member:o,gtmContext:r,gtmType:c}),o.isAdmin&&s.jsx(Dn,{children:d.formatMessage({id:"membersList_admin"})})]},l))}),n&&s.jsx(Hn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let rt=null;const xe="discussion_form_",Jt=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:c=5e4,minRows:i=4,forceShow:d={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var P,G;const a=C.useIntl(),u=x.useContext(we),[f,h]=x.useState(n.isEditing&&n.isEditing.text||""),[p,_]=x.useState(d.error||!1),[j,w]=x.useState(!1),S=x.useRef(null);if(r||(r=S),n.isLoading)return s.jsx(je,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const g=b=>{const X=b.target.value;h(X);let k;!u||!u.id?k=ke(a.formatMessage,`${xe}error_loggedOut`,e.type,"action"):t?X.length>=c&&(k=`${xe}error_tooLong`):k=ke(a.formatMessage,`${xe}error_noPermission`,e.type,"action"),k?_(k):p&&_(!1)};let T=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const b=e.type==="response"?((P=e.slugs)==null?void 0:P.question)||"":((G=e.slugs)==null?void 0:G.answer)||"";b&&(T=`${T}-${b.slice(-15)}`)}const R=async b=>{var k;if(b.preventDefault(),b.stopPropagation(),!u||!u.id||!t||L)return;rt&&clearTimeout(rt),w("submitting");const X=window.location.pathname;try{let v;switch(e.type){case"post":v=await o.create({content:f});break;case"question":v=await o.create({title:f,authorId:u&&u.id,...(k=o.props)==null?void 0:k.create});break;case"response":v=await o.create({question:e.slugs.question},{body:f,authorId:u&&u.id,contentPath:X});break;case"reply":v=await o.create({question:e.slugs.question,answer:e.slugs.answer},{body:f,authorId:u&&u.id,contentPath:X});break;default:break}await Is(1e3),o.callback&&await o.callback(v),rt=setTimeout(()=>{h(""),w("submitted"),D()},500)}catch(v){const W=v;let J=`${xe}error`;W.message.includes("entry already exists")&&(J=ke(a.formatMessage,`${xe}error_alreadyExists`,e.type,"action")),W.message.includes("429")?J=ke(a.formatMessage,`${xe}error_tooMany`,e.type,"action"):W.message.includes("400")&&(J=`${xe}error`),_(J),D()}},D=()=>{rt=setTimeout(()=>{_(!1),w(!1)},5e3)},L=!f||!Ws(f),V=j==="submitting",N=[];return(n.isEditing&&!V||d.cancel)&&N.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!d.cancel&&(!u||!u.id||!f),children:a.formatMessage({id:`${xe}cancel`})}),N.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:b=>{if(n.isEditing){w("submitting"),o.handleSaveEdit&&o.handleSaveEdit(S.current&&"value"in S.current?S.current.value:"");return}R(b)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!u||!u.id||!t||L||V||n.isEditing&&f===n.isEditing.text,children:a.formatMessage({id:`${xe}${V?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:T,className:M("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:ke(a.formatMessage,`${xe}title`,e.type,"action")}),s.jsx(ft,{member:u||"community",gtmContext:l,gtmType:"profile-click"}),s.jsx(ue,{element:"label",showOnFocus:!1,htmlFor:`${T}-input`,children:ke(a.formatMessage,`${xe}label`,e.type,"action")}),s.jsx(Es,{ref:r,id:`${T}-input`,name:e.type,placeholder:ke(a.formatMessage,`${xe}placeholder`,e.type,"action"),onChange:g,value:f,maxLength:c,"aria-invalid":!!p,"aria-errormessage":"error-message",minRows:i,autoFocus:!!n.isEditing}),s.jsx("small",{children:ke(a.formatMessage,`${xe}explainer`,e.type,"action",{a:b=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:b})})}),s.jsx(Ve,{buttons:N}),j==="submitted"&&s.jsx(ct,{className:"success","data-testid":"success",children:ke(a.formatMessage,`${xe}success`,e.type,"action")}),p&&s.jsx(ct,{id:"error-message",className:"error","data-testid":"error",children:d.error?d.error:typeof p=="string"?p.includes(" ")?p:a.formatMessage({id:p},{action:a.formatMessage({id:`discussion_action_${e.type}`}),maxLength:c}):p})]})},ht=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:c,leave:i,notMemberStateText:d}})=>r&&!n?s.jsx(Ge,{text:d,button:{component:s.jsx(Ut,{functions:{join:c,leave:i}})}}):s.jsx(Jt,{content:{type:e,slugs:{}},functions:{create:t}}),Ir={showThread:!1,showForm:!1},Xe=x.createContext(Ir),Kn=({children:e})=>{const[t,n]=x.useState({showThread:!1,showForm:!1});return s.jsx(Xe.Provider,{value:{...t,updateConversation:n},children:e})},Lr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Br=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ue=!1;const Rt=()=>{Ue!==!1&&(clearTimeout(Ue),Ue=!1)},Dt=5,es=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:c=!1,content:i={type:"reply",slugs:{}},canLike:d=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const a=C.useIntl();x.useEffect(()=>{p(c)},[c]);const[u,f]=x.useState(t),[h,p]=x.useState(c),[_,j]=x.useState(!1),[w,S]=x.useState(!1),g=x.useMemo(()=>Br(n,Dt),[n]),T=D=>{if(D.preventDefault(),D.stopPropagation(),S(!1),Ue)return Rt(),!1;if(Rt(),_||!d)return!1;Ue=setTimeout(R,350)},R=async()=>{if(Rt(),_||!d)return!1;let D=h?u-1:u+1;D<0&&(D=0),j(!0),f(D),p(!h);try{if(i&&i.slugs){const L=Lr(i.slugs);h?await l(L):await o(L,{contentPath:window.location.pathname})}}catch{f(t),p(c)}finally{j(!1)}};return x.createElement(e,{className:M("likes-wrapper text-medium action-button",{"show-spinner":_,"is-liked":h,disabled:!d}),onClick:T,onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},onFocus:()=>{S(!0)},onBlur:()=>{S(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(z,{variant:"tertiary",size:"medium",icon:{icon:h?"heart":"heart_empty",animate:"bounce"},className:M({"do-animation":h&&!c}),screenreaderText:d?a.formatMessage({id:`discussion_likes_${h?"unlike":"like"}`},{action:a.formatMessage({id:`discussion_action_${i.type}`})}):!1,onClick:T,disabled:!d,"aria-hidden":!d,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`}),s.jsx("span",{className:M("number-of-likes",{"no-likes":u===0}),"data-testid":"number-of-likes",children:a.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:u})}),n&&s.jsx(Mn,{isOpen:w,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[g.map(D=>typeof D=="string"||!D.name?null:s.jsx("li",{children:s.jsx(Ye,{href:D.id?`/profiles/${D.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:L=>L==null?void 0:L.stopPropagation(),children:D.name})},D.id||window.btoa(D.name))),n.length>Dt&&s.jsx("li",{children:a.formatMessage({id:"discussion_likes_more"},{number:n.length-Dt})})]})})]})})},_n=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Xt=(e,t)=>e&&!t;const Me="discussion_",Or=280,Ze=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:c,functions:{content:{createContent:i,deleteContent:d,updateContent:o}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:l,deleteLike:a}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:u}={openComments:()=>{}}},links:f={},className:h,gtmContext:p="DiscussionAnswer",children:_,isTruncated:j=!1})=>{const w=C.useIntl(),S=x.useContext(we),g=x.useContext(Xe),[T,R]=x.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[D,L]=x.useState(!1),[V,N]=x.useState("");if(x.useEffect(()=>{R({...T,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:P,canLike:G,createdAt:b,id:X,likes:k=0,userLiked:v,comments:W=0}=t,J=j?dt(T.body,Or):T.body,q=S&&S.id&&typeof P!="string"&&P.id&&P.id===S.id||!1,se=typeof G=="boolean"?G:n?!q:!1,re=async F=>{F||(F=""),N("");try{if(!Ss(F,T.body)){const oe=t.type==="question"?{title:F}:{body:F};await o(_n(t.slugs),oe)}R({body:F,isEditing:!1,didEdit:!0})}catch{N(`${Me}form_error`)}},K=()=>{g&&g.updateConversation&&g.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const oe=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,me=document.getElementById(oe),ae=document.getElementById(`${oe}-input`);ae&&ae.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},de=()=>{L(!1);try{d(_n(t.slugs))}catch{N("delete-error")}},ce=[{text:w.formatMessage({id:`${Me}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(w.formatMessage({id:`${Me}report_subject`}))}&body=${encodeURI(w.formatMessage({id:`${Me}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&&q&&ce.push({text:w.formatMessage({id:`${Me}moreMenu_edit`}),onClick:()=>R({...T,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${Me}moreMenu_delete`}),onClick:F=>{F.preventDefault(),F.stopPropagation(),L(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`delete-${t.type}-click`,...qn(`delete-${t.slug}-modal`,D)}),x.createElement(e,{className:M("discussion-post",h),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:X||t.slug,className:M("discussion-card",t.type,{editing:T.isEditing,"has-link":f.post&&!T.isEditing}),onClick:F=>{!f.post||T.isEditing||(F.preventDefault(),F.stopPropagation(),window.location.href=f.post)},children:[!T.isEditing&&s.jsx(ft,{member:P,additionalContent:{createdAt:b,didEdit:T.didEdit},className:typeof P!="string"&&P.id===c?"highlighted":"",gtmContext:p,gtmType:"profile-click"}),T.isEditing?s.jsx(Jt,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:T.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:V!==""&&V!=="delete-error"?w.formatMessage({id:V},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:i,handleSaveEdit:re,handleCancel:()=>{N(""),R({...T,isEditing:!1})}},gtmContext:`${p}Form`}):f.post?s.jsx("a",{href:f.post,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":"title-click",children:s.jsx(Ft,{options:{overrides:{a:Cn}},children:J})}):s.jsx(Ft,{options:{wrapper:t.type==="question"?"h1":x.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:J}),!T.isEditing&&s.jsxs("ul",{className:M("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(es,{element:"li",likes:k,isShort:!1,userLiked:v,content:{type:t.type,slugs:t.slugs},canLike:se,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:l,deleteLike:a}}),(["question","post"].includes(t.type)||f.comments||typeof u=="function")&&s.jsxs("li",{className:"action-button",onClick:F=>{F.preventDefault(),F.stopPropagation(),f.comments&&(window.location.href=f.comments),typeof u=="function"&&u()},children:[s.jsx(z,{variant:"tertiary",size:"medium",styling:{muted:!0},icon:{icon:"speech-bubble_square_thick"},href:f.comments?f.comments:!1,onClick:f.comments||typeof u!="function"?!1:u,className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:w.formatMessage({id:`${Me}comments_screenReader`},{count:W})}),s.jsx("span",{children:w.formatMessage({id:`${Me}comments`},{count:W})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(z,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:K,children:w.formatMessage({id:`${Me}reply`})})}),s.jsx(Un,{element:"li",id:`more-${t.slug}`,options:ce})]})]}),_,s.jsx(Gt,{id:`delete-${t.slug}-modal`,isOpen:D,functions:{onOpen:()=>{},onClose:()=>L(!1)},forceShow:{error:V==="delete-error"?w.formatMessage({id:"discussion_delete_error"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:w.formatMessage({id:"discussion_delete_title"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>L(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:de,children:w.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(C.FormattedMessage,{id:"discussion_delete_text",values:{p:F=>s.jsx("p",{children:F}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const At="discussion_responses_",Qr=({type:e="answer",responses:t=0})=>{const n=C.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${At}title`},{action:n.formatMessage({id:`${At}${e}`}),count:t})}),t===0&&s.jsx("p",{children:ke(n.formatMessage,`${At}empty`,e,e)})]})};const ts=({count:e=0,showRepliesButton:t=!0,children:n})=>{const r=C.useIntl(),c=x.useRef(null),i=x.useContext(Xe),[d,o]=x.useState("closed");x.useEffect(()=>{const f=c.current;if(f)return f.addEventListener("transitionend",l),()=>{f.removeEventListener("transitionend",l)}},[]),De(()=>{d==="closed"&&!i.showThread||o(["opening","open"].includes(d)?"ready-to-close":"opening")},[i.showThread]),x.useEffect(()=>{d==="ready-to-close"&&o("closing")},[d]);const l=({propertyName:f})=>{f==="max-height"&&o(h=>h==="opening"?"open":h==="closing"?"closed":h)},a=["opening","open"].includes(d),u=at(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[t&&s.jsx(z,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${a?"left":"right"}`},onClick:()=>{var f;(f=i.updateConversation)==null||f.call(i,h=>({showThread:!h.showThread,showForm:!1}))},children:r.formatMessage({id:`discussion_thread_${a?"hide":"show"}`},{count:e})}),s.jsx("ul",{ref:c,className:M("thread",d),hidden:!i.showThread,children:u})]})},Hr=({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}),Ur=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:o})=>{if(!n)return;const l=Hr({user:n,content:o,verb:"post"});await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,u=>[...u,l]),{previousActivities:a}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Wr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),a=l==null?void 0:l.map(u=>((u==null?void 0:u.id)===(d==null?void 0:d.activityId)&&(u.content=o),u));return e.setQueryData(t,()=>a&&[...a]),{previousActivities:a}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),zr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:d})=>{await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),l=o==null?void 0:o.filter(a=>(a==null?void 0:a.id)!==d);return e.setQueryData(t,()=>l&&[...l]),{previousActivities:l}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivities)},onSettled:(d,o,l)=>{e.invalidateQueries({queryKey:[...t,l.activityId]})}}),Vr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:o})=>{await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),a=l==null?void 0:l.map(u=>{var f;return(u==null?void 0:u.id)===o&&((f=u.reaction_counts)!=null&&f.like?u.reaction_counts.like+=1:u.reaction_counts.like=1),u});return e.setQueryData(t,()=>a&&[...a]),{previousActivities:a}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivities)},onSuccess:o=>{const l=e.getQueryData(t),a=l==null?void 0:l.map(u=>{var f,h;return(u==null?void 0:u.id)===(o==null?void 0:o.activity_id)&&((f=u.own_reactions)!=null&&f.like?u.own_reactions.like.push(o):u.own_reactions.like=[o],(h=u.latest_reactions)!=null&&h.like?u.latest_reactions.like.push(o):u.own_reactions.like=[o]),u});return e.setQueryData(t,()=>a&&[...a]),{previousActivities:l}},onSettled:(o,l,a)=>{e.invalidateQueries({queryKey:[...t,a.activityId]})}}),Yr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:l})=>{await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),u=a==null?void 0:a.map(f=>{var h;return(f==null?void 0:f.id)===l&&(h=f.reaction_counts)!=null&&h.like&&(f.reaction_counts.like-=1),f});return e.setQueryData(t,()=>u&&[...u]),{previousActivities:u}},onError:(l,a,u)=>{e.setQueryData(t,u.previousActivities)},onSuccess:(l,{activityId:a})=>{const u=e.getQueryData(t),f=u==null?void 0:u.map(h=>{var p,_,j,w,S;if(h.id===a){const g=(j=(_=(p=h.own_reactions)==null?void 0:p.like)==null?void 0:_.find(T=>T.user_id===(n==null?void 0:n.id)))==null?void 0:j.id;return h.own_reactions.like=(w=h.own_reactions.like)==null?void 0:w.filter(T=>T.id!==g),h.latest_reactions.like=(S=h.latest_reactions.like)==null?void 0:S.filter(T=>T.id!==g),h}else return h});return e.setQueryData(t,()=>f&&[...f]),{previousActivities:u}},onSettled:(l,a,u)=>{e.invalidateQueries({queryKey:[...t,u.activityId]})}}),Gr=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:c,edit:i,remove:d,like:o,unlike:l,join:a,leave:u}})=>{const f=C.useIntl(),h=U.useQueryClient(),p=x.useContext(we),{data:_,error:j,isLoading:w,isFetching:S}=U.useQuery({queryKey:[e,t],queryFn:r}),g=Ur({queryClient:h,queryKey:[e,t],user:p,mutationFn:c}),{mutate:T}=U.useMutation(g),R=Wr({queryClient:h,queryKey:[e,t],mutationFn:async v=>await i(v)}),{mutate:D}=U.useMutation(R),L=zr({queryClient:h,queryKey:[e,t],mutationFn:async({activityId:v})=>await d({activityId:v})}),{mutate:V}=U.useMutation(L),N=Vr({queryClient:h,queryKey:[e,t],mutationFn:o}),{mutate:P}=U.useMutation(N),G=Yr({queryClient:h,queryKey:[e,t],user:p,mutationFn:async({activityId:v})=>{var q,se,re;const W=_&&(_==null?void 0:_.find(K=>K.id===v)),J=(re=(se=(q=W==null?void 0:W.own_reactions)==null?void 0:q.like)==null?void 0:se.find(K=>K.user_id===(p==null?void 0:p.id)))==null?void 0:re.id;await l({reactionId:J||"",activityId:v})}}),{mutate:b}=U.useMutation(G),X=x.useCallback(({activityId:v})=>P({activityId:v}),[P]),k=x.useCallback(({activityId:v})=>b({activityId:v}),[b]);return j?s.jsx(Ge,{variant:"error",text:j.message}):w?s.jsx(je,{style:{height:"400px"}}):s.jsxs("section",{children:[s.jsx(ht,{contentType:"post",createPost:T,membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:u,notMemberStateText:f.formatMessage({id:"community_joinToPost"})}}),!S&&Array.isArray(_)&&(_==null?void 0:_.map(v=>{var q,se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he;const W=((q=v==null?void 0:v.actor)==null?void 0:q.id)===(p==null?void 0:p.id),J=Xt(n,W);return s.jsxs(x.Fragment,{children:[s.jsx(Ze,{content:{type:"post",body:v==null?void 0:v.content,canLike:J,createdAt:(v==null?void 0:v.time)||"",slugs:{parentId:t,activityId:v==null?void 0:v.id},slug:v==null?void 0:v.id,author:{id:(se=v==null?void 0:v.actor)==null?void 0:se.id,name:`${(K=(re=v==null?void 0:v.actor)==null?void 0:re.data)==null?void 0:K.name}`,organization:(ce=(de=v==null?void 0:v.actor)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(oe=(F=v==null?void 0:v.actor)==null?void 0:F.data)==null?void 0:oe.jobTitle,image:{thumbnail:((ae=(me=v==null?void 0:v.actor)==null?void 0:me.data)==null?void 0:ae.thumbnail)||void 0}},userLiked:((pe=v==null?void 0:v.own_reactions)==null?void 0:pe.like)&&((fe=v==null?void 0:v.own_reactions)==null?void 0:fe.like.length)>0,likes:(v==null?void 0:v.reaction_counts.like)||0,comments:(v==null?void 0:v.reaction_counts.reply)||0,peopleWhoLiked:((ge=v==null?void 0:v.latest_reactions)==null?void 0:ge.like)&&((he=v==null?void 0:v.latest_reactions)==null?void 0:he.like.map(B=>{var Y,ie;return{id:B==null?void 0:B.user_id,name:(ie=(Y=B==null?void 0:B.user)==null?void 0:Y.data)==null?void 0:ie.name}}))},links:{post:`${e}/${t}/${v==null?void 0:v.id}`,comments:`${e}/${t}/${v==null?void 0:v.id}`},functions:{content:{createContent:()=>null,deleteContent:B=>V(B),updateContent:(B,Y)=>D({activityInfo:B,content:Y})},likes:{createLike:()=>{X({activityId:v==null?void 0:v.id})},deleteLike:()=>{k({activityId:v==null?void 0:v.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(Ae,{})]},v==null?void 0:v.id)}))]})},Jr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:o=>{var a;const l=e.getQueryData(t);if(l)return(a=l==null?void 0:l.latest_reactions)!=null&&a.reply?(l.latest_reactions.reply.unshift(o),l&&(l.reaction_counts={reply:l.latest_reactions.reply.length})):(l.latest_reactions={reply:[o]},l.reaction_counts={reply:1}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Xr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:i,content:{body:d}})=>{var a,u,f;if(d.length===0)return;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((a=o==null?void 0:o.latest_reactions)!=null&&a.reply))return;const l=(f=(u=o==null?void 0:o.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(h=>(h.id===i.replySlug&&(h.data.content=d),h));return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}},onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)}}),Zr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:i})=>{var l,a,u;await e.cancelQueries({queryKey:t});const d=e.getQueryData(t);if(!d||!((l=d==null?void 0:d.latest_reactions)!=null&&l.reply))return;const o=(u=(a=d==null?void 0:d.latest_reactions)==null?void 0:a.reply)==null?void 0:u.filter(f=>f.id!==i);return e.setQueryData(t,()=>({...d,latest_reactions:{reply:o}})),{previousActivity:d}},onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)}}),qr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d})=>{var a,u;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t),l=(u=(a=o==null?void 0:o.latest_reactions)==null?void 0:a.reply)==null?void 0:u.map(f=>{var h;return f.id===d&&((h=f.children_counts)!=null&&h.like?f.children_counts.like+=1:f.children_counts={like:1}),f});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:d=>{var a;const o=e.getQueryData(t),l=(a=o==null?void 0:o.latest_reactions.reply)==null?void 0:a.map(u=>{var f,h;return u.id===d.id&&((f=u.own_children)!=null&&f.like?u.own_children.like.push(d):u.own_children={like:[d]},(h=u.latest_children)!=null&&h.like?u.latest_children.like.push(d):u.latest_children={like:[d]}),u});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}}}),Kr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:o})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);if(!l)return;const a=(u=l.latest_reactions.reply)==null?void 0:u.map(f=>(f.id===o&&f.children_counts.like&&(f.children_counts.like-=1),f));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:(o,{replyId:l})=>{var f;const a=e.getQueryData(t);if(!a)return;const u=(f=a.latest_reactions.reply)==null?void 0:f.map(h=>{var p,_,j;if(h.id===l){let w=(p=h.latest_children.reply)==null?void 0:p.filter(S=>S.user_id!==(n==null?void 0:n.id));return w=(j=(_=h==null?void 0:h.own_children)==null?void 0:_.reply)==null?void 0:j.filter(S=>S.user_id!==(n==null?void 0:n.id)),w}return h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}}}),eo=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onSuccess:o=>{var u;const l=e.getQueryData(t),a=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(f=>(f.id===o.parent&&(f.latest_children.reply&&f.children_counts.reply?(f.latest_children.reply.push(o),f.children_counts.reply+=1):(f.latest_children.reply=[o],f.children_counts.reply=1)),f));return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),to=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)},onMutate:async({replyInfo:i,content:{body:d}})=>{var a,u,f;if(d.length===0)return;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((a=o==null?void 0:o.latest_reactions)!=null&&a.reply))return;const l=(f=(u=o==null?void 0:o.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(h=>{var p;return h.id===i.replyParentId&&((p=h.latest_children.reply)==null||p.map(_=>(_.id===i.replySlug&&(_.data.content=d),_))),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}}}),no=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onError:(i,d,o)=>{e.setQueryData(t,o.previousActivity)},onMutate:async({replyId:i,replyParentId:d})=>{var a,u,f;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);if(!o||!((a=o==null?void 0:o.latest_reactions)!=null&&a.reply))return;const l=(f=(u=o==null?void 0:o.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(h=>{var p,_;return h.id===d&&(h.latest_children.reply=(p=h.latest_children.reply)==null?void 0:p.filter(j=>j.id!==i),(_=h.children_counts)!=null&&_.reply&&(h.children_counts.reply-=1)),h});return e.setQueryData(t,()=>({...o,latest_reactions:{reply:l}})),{previousActivity:o}}}),so=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d,replyParentId:o})=>{var u;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t),a=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(f=>{var h;return f.id===o&&((h=f.latest_children.reply)==null||h.map(p=>{var _;return p.id===d&&((_=p.children_counts)!=null&&_.like?p.children_counts.like+=1:p.children_counts={like:1}),p})),f});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSuccess:(d,o)=>{var u;const l=e.getQueryData(t),a=(u=l==null?void 0:l.latest_reactions.reply)==null?void 0:u.map(f=>{var h;return f.id===o.replyParentId&&((h=f.latest_children.reply)==null||h.map(p=>(p.id===o.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))),f});return e.setQueryData(t,()=>({...l,latest_reactions:{reply:a}})),{previousActivity:l}}}),ro=({queryClient:e,queryKey:t,mutationFn:n,user:r})=>({mutationFn:n,onMutate:async({replyId:o,replyParentId:l})=>{var f;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),u=(f=a==null?void 0:a.latest_reactions.reply)==null?void 0:f.map(h=>{var p;return h.id===l&&((p=h.latest_children.reply)==null||p.map(_=>{var j;return _.id===o&&((j=_.children_counts)!=null&&j.like?_.children_counts.like-=1:_.children_counts={like:0}),_})),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:(o,l)=>{var f;const a=e.getQueryData(t),u=(f=a==null?void 0:a.latest_reactions.reply)==null?void 0:f.map(h=>{var p;return h.id===l.replyParentId&&((p=h.latest_children.reply)==null||p.map(_=>{var j,w;return _.id===l.replyId&&((j=_.own_children)!=null&&j.like&&(_.own_children.like=_.own_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id))),(w=_.latest_children)!=null&&w.like&&(_.latest_children.like=_.latest_children.like.filter(S=>S.user_id!==(r==null?void 0:r.id)))),_})),h});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:u}})),{previousActivity:a}}}),oo=({basePath:e,parentId:t,replyParentId:n,activityId:r,replyCount:c,replies:i,functions:{create:d,edit:o,remove:l,join:a,leave:u,like:f,unlike:h}})=>{const p=C.useIntl(),_=U.useQueryClient(),j=x.useContext(we),w=x.useContext(Xe),S=eo({queryClient:_,queryKey:[e,t,r],mutationFn:async k=>d({replyId:n,content:k.body})}),{mutate:g}=U.useMutation(S),T=to({queryClient:_,queryKey:[e,t,r],mutationFn:o}),{mutate:R}=U.useMutation(T),D=no({queryClient:_,queryKey:[e,t,r],mutationFn:async({replyId:k})=>l({replyId:k})}),{mutate:L}=U.useMutation(D),V=so({queryClient:_,queryKey:[e,t,r],mutationFn:f}),{mutate:N}=U.useMutation(V),P=ro({queryClient:_,queryKey:[e,t,r],user:j,mutationFn:h}),{mutate:G}=U.useMutation(P),b=x.useCallback(({replyId:k,replyParentId:v})=>N({replyId:k,replyParentId:v}),[N]),X=x.useCallback(({replyId:k,replyParentId:v})=>G({replyId:k,replyParentId:v}),[G]);return s.jsx(ts,{count:c,showRepliesButton:c>0||w.showForm,children:s.jsxs(s.Fragment,{children:[w.showForm&&s.jsx(ht,{contentType:"reply",createPost:(k,v)=>g(v),membershipRequiredToPost:{isMember:!0,required:!0,join:a,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),(i==null?void 0:i.length)===0||(i==null?void 0:i.map(k=>{var v,W,J,q,se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he;return s.jsx(Ze,{content:{type:"reply",body:typeof k.data.content=="string"?(v=k==null?void 0:k.data)==null?void 0:v.content:((J=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:J.text)||"",createdAt:k==null?void 0:k.created_at,slugs:{parentId:t,activityId:r,replyParentId:k==null?void 0:k.parent,reply:k==null?void 0:k.id},slug:"",author:{id:(q=k==null?void 0:k.user)==null?void 0:q.id,name:(re=(se=k==null?void 0:k.user)==null?void 0:se.data)==null?void 0:re.name,organization:(de=(K=k==null?void 0:k.user)==null?void 0:K.data)==null?void 0:de.organization,jobTitle:(F=(ce=k==null?void 0:k.user)==null?void 0:ce.data)==null?void 0:F.jobTitle,image:{thumbnail:((me=(oe=k==null?void 0:k.user)==null?void 0:oe.data)==null?void 0:me.thumbnail)||void 0}},userLiked:((ae=k==null?void 0:k.own_children)==null?void 0:ae.like)&&((pe=k==null?void 0:k.own_children)==null?void 0:pe.like.length)>0,likes:((fe=k==null?void 0:k.children_counts)==null?void 0:fe.like)||0,peopleWhoLiked:((ge=k==null?void 0:k.latest_children)==null?void 0:ge.like)&&((he=k==null?void 0:k.latest_children)==null?void 0:he.like.map(B=>{var Y,ie;return{id:B==null?void 0:B.user_id,name:(ie=(Y=B==null?void 0:B.user)==null?void 0:Y.data)==null?void 0:ie.name}}))},functions:{content:{createContent:()=>console.log("create"),deleteContent:B=>{const{replySlug:Y,replyParentId:ie}=B;return L({replyId:Y,replyParentId:ie})},updateContent:(B,Y)=>R({replyInfo:B,content:Y})},likes:{createLike:()=>b({replyId:k==null?void 0:k.id,replyParentId:k==null?void 0:k.parent}),deleteLike:()=>{var Y,ie,ee;const B=((Y=k==null?void 0:k.own_children)==null?void 0:Y.like)&&((ee=(ie=k==null?void 0:k.own_children)==null?void 0:ie.like[0])==null?void 0:ee.id);return X({replyId:B||""})}},comments:{}}},k==null?void 0:k.id)}))]})})},ns=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:c,functions:{create:i,edit:d,remove:o,like:l,unlike:a,join:u,leave:f}})=>{const h=C.useIntl(),p=U.useQueryClient(),_=x.useContext(we),j=Jr({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>i({activityId:n,content:b.body})}),{mutate:w}=U.useMutation(j),S=Xr({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:g}=U.useMutation(S),T=Zr({queryClient:p,queryKey:[e,t,n],mutationFn:async({replyId:b})=>o({replyId:b})}),{mutate:R}=U.useMutation(T),D=qr({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:L}=U.useMutation(D),V=Kr({queryClient:p,queryKey:[e,t,n],user:_,mutationFn:a}),{mutate:N}=U.useMutation(V),P=x.useCallback(({replyId:b})=>L({replyId:b}),[L]),G=x.useCallback(({replyId:b})=>N({replyId:b}),[N]);return s.jsxs(s.Fragment,{children:[s.jsx(ht,{contentType:"reply",createPost:(b,X)=>w(X),membershipRequiredToPost:{isMember:c,required:!0,join:u,leave:f,notMemberStateText:h.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var v,W,J,q,se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he,B,Y,ie;const X=((v=b==null?void 0:b.user)==null?void 0:v.id)===(_==null?void 0:_.id),k=Xt(c,X);return s.jsx(Kn,{children:s.jsx(Ze,{content:{type:"reply",body:typeof b.data.content=="string"?(W=b==null?void 0:b.data)==null?void 0:W.content:((q=(J=b==null?void 0:b.data)==null?void 0:J.content)==null?void 0:q.text)||"",canLike:k,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:b==null?void 0:b.id},slug:`${e}/${t}/${n}#${b==null?void 0:b.id}`,author:{id:(se=b==null?void 0:b.user)==null?void 0:se.id,name:(K=(re=b==null?void 0:b.user)==null?void 0:re.data)==null?void 0:K.name,organization:(ce=(de=b==null?void 0:b.user)==null?void 0:de.data)==null?void 0:ce.organization,jobTitle:(oe=(F=b==null?void 0:b.user)==null?void 0:F.data)==null?void 0:oe.jobTitle,image:{thumbnail:((ae=(me=b==null?void 0:b.user)==null?void 0:me.data)==null?void 0:ae.thumbnail)||void 0}},userLiked:((pe=b==null?void 0:b.own_children)==null?void 0:pe.like)&&((fe=b==null?void 0:b.own_children)==null?void 0:fe.like.length)>0,likes:((ge=b==null?void 0:b.children_counts)==null?void 0:ge.like)||0,peopleWhoLiked:((he=b==null?void 0:b.latest_children)==null?void 0:he.like)&&((B=b==null?void 0:b.latest_children)==null?void 0:B.like.map(ee=>{var le,be;return{id:ee==null?void 0:ee.user_id,name:(be=(le=ee==null?void 0:ee.user)==null?void 0:le.data)==null?void 0:be.name}}))},functions:{content:{createContent:()=>null,deleteContent:ee=>{const{replySlug:le}=ee;return R({replyId:le})},updateContent:(ee,le)=>g({replyInfo:ee,content:le})},likes:{createLike:()=>P({replyId:b==null?void 0:b.id}),deleteLike:()=>{var le,be,Ce;const ee=((le=b==null?void 0:b.own_children)==null?void 0:le.like)&&((Ce=(be=b==null?void 0:b.own_children)==null?void 0:be.like[0])==null?void 0:Ce.id);return G({replyId:ee||""})}},comments:{}},children:s.jsx(oo,{basePath:e,parentId:t,replyParentId:b==null?void 0:b.id,activityId:n,replyCount:((Y=b==null?void 0:b.children_counts)==null?void 0:Y.reply)||0,replies:(ie=b==null?void 0:b.latest_children)==null?void 0:ie.reply,isMember:c,functions:{create:i,edit:d,remove:o,like:l,unlike:a,join:u,leave:f}})},b==null?void 0:b.id)},b==null?void 0:b.id)}))]})},ao=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:o}})=>{if(o.length===0)return;await e.cancelQueries({queryKey:t});const l=e.getQueryData(t);return l&&l.id===(d==null?void 0:d.activityId)&&(l.content=o),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onError:(d,o,l)=>{e.setQueryData(t,l.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),io=({queryClient:e,queryKey:t,redirectUrl:n,mutationFn:r})=>({mutationFn:r,onSuccess:()=>{e.invalidateQueries({queryKey:t}),window.location.href=n}}),co=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var l;await e.cancelQueries({queryKey:t});const o=e.getQueryData(t);return(l=o==null?void 0:o.reaction_counts)!=null&&l.like?o.reaction_counts.like+=1:o&&(o.reaction_counts={like:1}),e.setQueryData(t,()=>({...o})),{previousActivity:o}},onError:(o,l,a)=>{e.setQueryData(t,a.previousActivity)},onSuccess:o=>{const l=e.getQueryData(t);return l!=null&&l.own_reactions.like?l.own_reactions.like.push(o):l&&(l.own_reactions={like:[o]}),l!=null&&l.latest_reactions.like?l.latest_reactions.like.push(o):l&&(l.own_reactions={like:[o]}),e.setQueryData(t,()=>({...l})),{previousActivity:l}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),lo=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:c})=>({mutationFn:c,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>0&&(a.reaction_counts.like-=1),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,u,f)=>{e.setQueryData(t,f.previousActivity)},onSuccess:()=>{var f,h,p;if(!r)return;const a=(p=(h=(f=r.own_reactions)==null?void 0:f.like)==null?void 0:h.find(_=>_.user_id===(n==null?void 0:n.id)))==null?void 0:p.id,u=e.getQueryData(t);if(u!=null&&u.own_reactions.like&&(u.own_reactions.like=u.own_reactions.like.filter(_=>_.id!==a),!!(u!=null&&u.latest_reactions.like)))return u.latest_reactions.like=u.latest_reactions.like.filter(_=>_.id!==a),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onSettled:()=>{e.invalidateQueries({queryKey:t})}});const uo=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:c,editActivity:i,removeActivity:d,likeActivity:o,unlikeActivity:l,createReply:a,editReply:u,removeReply:f,likeReply:h,unlikeReply:p,join:_,leave:j}})=>{var q,se,re,K,de,ce,F,oe,me,ae,pe,fe,ge,he,B,Y,ie,ee,le,be,Ce,Le,Re;const w=x.useContext(we),S=U.useQueryClient(),{data:g,isLoading:T,isFetching:R}=U.useQuery({queryKey:[e,t,n],queryFn:c}),D=ao({queryClient:S,queryKey:[e,t,n],mutationFn:async te=>await i(te)}),{mutate:L}=U.useMutation(D),V=io({queryClient:S,queryKey:[e,t,n],mutationFn:async({activityId:te})=>d({activityId:te}),redirectUrl:`${e}/${t}`}),{mutate:N}=U.useMutation(V),P=co({queryClient:S,queryKey:[e,t,n],mutationFn:o}),{mutate:G}=U.useMutation(P),b=lo({queryClient:S,queryKey:[e,t,n],user:w,mutationFn:async()=>{var Ee,Se,qe;const te=(qe=(Se=(Ee=g==null?void 0:g.own_reactions)==null?void 0:Ee.like)==null?void 0:Se.find(pt=>pt.user_id===(w==null?void 0:w.id)))==null?void 0:qe.id;await l({activityId:n,reactionId:te})},activity:g}),{mutate:X}=U.useMutation(b),k=x.useCallback(({activityId:te})=>G({activityId:te}),[G]),v=x.useCallback(async({activityId:te})=>X({activityId:te}),[X]);if(T||R)return s.jsx(je,{style:{height:"400px"}});if(!g)return s.jsx(Ge,{variant:"error",text:"Post not found"});const W=((q=g==null?void 0:g.actor)==null?void 0:q.id)===(w==null?void 0:w.id),J=Xt(r,W);return s.jsx(Ze,{className:"activity-section",content:{type:"post",body:g==null?void 0:g.content,canLike:J,createdAt:(g==null?void 0:g.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:g==null?void 0:g.id},slug:n,author:{id:(se=g==null?void 0:g.actor)==null?void 0:se.id,name:((re=g==null?void 0:g.actor)==null?void 0:re.data)&&((de=(K=g==null?void 0:g.actor)==null?void 0:K.data)==null?void 0:de.name),organization:((ce=g==null?void 0:g.actor)==null?void 0:ce.data)&&((oe=(F=g==null?void 0:g.actor)==null?void 0:F.data)==null?void 0:oe.organization),jobTitle:((me=g==null?void 0:g.actor)==null?void 0:me.data)&&((pe=(ae=g==null?void 0:g.actor)==null?void 0:ae.data)==null?void 0:pe.jobTitle),image:{thumbnail:((fe=g==null?void 0:g.actor)==null?void 0:fe.data)&&((he=(ge=g==null?void 0:g.actor)==null?void 0:ge.data)==null?void 0:he.thumbnail)||void 0}},userLiked:((B=g==null?void 0:g.own_reactions)==null?void 0:B.like)&&((Y=g==null?void 0:g.own_reactions)==null?void 0:Y.like.length)>0,likes:g&&((ie=g==null?void 0:g.reaction_counts)==null?void 0:ie.like),comments:g&&((ee=g==null?void 0:g.reaction_counts)==null?void 0:ee.reply),peopleWhoLiked:((le=g==null?void 0:g.latest_reactions)==null?void 0:le.like)&&((be=g==null?void 0:g.latest_reactions)==null?void 0:be.like.map(te=>{var Ee,Se;return{id:te==null?void 0:te.user_id,name:(Se=(Ee=te==null?void 0:te.user)==null?void 0:Ee.data)==null?void 0:Se.name}}))},originalAuthorId:(Ce=g==null?void 0:g.actor)==null?void 0:Ce.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>N({activityId:n}),updateContent:(te,Ee)=>L({activityInfo:te,content:Ee})},likes:{createLike:()=>k({activityId:n}),deleteLike:()=>v({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((Le=g==null?void 0:g.reaction_counts)==null?void 0:Le.reply)||0,")"]}),s.jsx(ns,{basePath:e,parentId:t,activityId:n,repliesList:(Re=g==null?void 0:g.latest_reactions)==null?void 0:Re.reply,isMember:r,functions:{create:a,edit:u,remove:f,like:h,unlike:p,join:_,leave:j}})]})},n)},mo=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:c}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:c}});exports.ASSETS_BUCKET=it;exports.ActivitiesFeed=Gr;exports.ActivitySection=uo;exports.AddPost=ht;exports.BannerSection=Zs;exports.Breadcrumbs=_r;exports.Button=z;exports.ButtonWrapper=Ve;exports.CacheProvider=Ln;exports.CollapsibleSection=Qt;exports.Columns=zn;exports.CommunityDetails=gr;exports.Contributors=In;exports.ConversationContext=Xe;exports.CookieBanner=Vn;exports.DiscussionConversation=Kn;exports.DiscussionForm=Jt;exports.DiscussionLikes=es;exports.DiscussionPost=Ze;exports.DiscussionThread=ts;exports.Divider=Ae;exports.DownloadSection=Ys;exports.EMAILS=Fe;exports.EmailHelperTextBox=Sr;exports.EmptyStateBox=Ge;exports.Filters=xr;exports.FlagsProvider=Bn;exports.Footer=zt;exports.FullWidthSection=Ot;exports.GlobalProviders=pr;exports.Header=Vt;exports.HelperTextBox=$n;exports.HiddenFromScreenReaders=Lt;exports.HideShowTextBox=er;exports.HighlightedTextBox=$e;exports.IntlProvider=On;exports.InviteForm=Zn;exports.InviteModal=Rr;exports.JoinButton=Ut;exports.LanguageSwitcher=vr;exports.Link=Ye;exports.LoadMore=Hn;exports.LoadingBlock=ur;exports.LoadingPlaceholder=je;exports.LoadingState=Pn;exports.Logo=Wt;exports.LogoSection=Gs;exports.MarkdownText=Ft;exports.MarketingBox=qs;exports.Member=ft;exports.MembersList=Fr;exports.Modal=Yt;exports.MoreMenu=Un;exports.NUMBER_OF_USERS=Ks;exports.NavigationMenu=Wn;exports.Overlay=Gt;exports.PageHeading=Rn;exports.PageLayout=Ar;exports.PasswordRules=Tr;exports.Pill=Dn;exports.ProfilePicture=Je;exports.ProgressBar=An;exports.Rating=$r;exports.RepliesFeed=ns;exports.ResponsesHeading=Qr;exports.ResponsiveImage=yn;exports.SearchForm=Xn;exports.Span=Cn;exports.StatusBanner=ct;exports.Tags=Pr;exports.Tooltip=Mn;exports.TopLevelPage=Er;exports.UserContext=we;exports.UserProvider=Qn;exports.VisuallyHidden=ue;exports.addAriaProps=qn;exports.getMember=Ht;exports.headerData=We;exports.mapGetStreamData=mo;exports.useCurrentPath=wn;exports.useEffectAfterMount=De;exports.useElementWidth=ze;exports.useScrollListener=jn;exports.useScrollToHash=As;