@apolitical/component-library 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/communities/community-details/community-details.d.ts +1 -3
- package/discussion/components/post/post.d.ts +3 -1
- package/index.js +13 -13
- package/index.mjs +1177 -1123
- package/package.json +1 -1
- package/style.css +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),ps=require("lodash.clonedeep"),hs=require("lodash.set"),M=require("react-intl"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),ps=require("lodash.clonedeep"),hs=require("lodash.set"),M=require("react-intl"),Xe=require("truncate"),Ze=require("markdown-to-jsx"),Z=require("@tanstack/react-query"),gs=require("@tanstack/react-query-devtools"),Ve=require("posthog-js"),cn=require("react-cookie"),_s=require("react-multi-email"),un=require("lodash.get"),xs=require("react-error-boundary"),vs=require("react-textarea-autosize"),bs=require("lodash.isequal");function ws(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dn={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=[],o=0;o<arguments.length;o++){var l=arguments[o];if(l){var
|
|
5
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],o=0;o<arguments.length;o++){var l=arguments[o];if(l){var d=typeof l;if(d==="string"||d==="number")r.push(l);else if(Array.isArray(l)){if(l.length){var a=n.apply(null,l);a&&r.push(a)}}else if(d==="object"){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){r.push(l.toString());continue}for(var i in l)t.call(l,i)&&l[i]&&r.push(i)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(dn);var ks=dn.exports;const S=ws(ks),ys=({element:e="span",showOnFocus:t=!0,children:n,...r})=>h.createElement(e,{...r,className:S("hidden",{"show-on-focus":t}),children:n}),K=h.memo(ys),js=({element:e="span",children:t=null,...n})=>h.createElement(e,{...n,"aria-hidden":!0},t),St=h.memo(js);var wt={exports:{}},$e={};/**
|
|
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 Kt;function Ss(){if(Kt)return $e;Kt=1;var e=h,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function
|
|
13
|
+
*/var Kt;function Ss(){if(Kt)return $e;Kt=1;var e=h,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(a,i,c){var u,f={},p=null,g=null;c!==void 0&&(p=""+c),i.key!==void 0&&(p=""+i.key),i.ref!==void 0&&(g=i.ref);for(u in i)r.call(i,u)&&!l.hasOwnProperty(u)&&(f[u]=i[u]);if(a&&a.defaultProps)for(u in i=a.defaultProps,i)f[u]===void 0&&(f[u]=i[u]);return{$$typeof:t,type:a,key:p,ref:g,props:f,_owner:o.current}}return $e.Fragment=n,$e.jsx=d,$e.jsxs=d,$e}var Me={};/**
|
|
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 en;function Es(){return en||(en=1,process.env.NODE_ENV!=="production"&&function(){var e=h,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),
|
|
22
|
-
`+ue+
|
|
23
|
-
`),
|
|
24
|
-
`),Y=N.length-1,
|
|
25
|
-
`+N[Y].replace(" at new "," at ");return
|
|
21
|
+
*/var en;function Es(){return en||(en=1,process.env.NODE_ENV!=="production"&&function(){var e=h,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),a=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),x=Symbol.iterator,y="@@iterator";function _(m){if(m===null||typeof m!="object")return null;var v=x&&m[x]||m[y];return typeof v=="function"?v:null}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(m){{for(var v=arguments.length,j=new Array(v>1?v-1:0),$=1;$<v;$++)j[$-1]=arguments[$];T("error",m,j)}}function T(m,v,j){{var $=E.ReactDebugCurrentFrame,D=$.getStackAddendum();D!==""&&(v+="%s",j=j.concat([D]));var O=j.map(function(P){return String(P)});O.unshift("Warning: "+v),Function.prototype.apply.call(console[m],console,O)}}var C=!1,A=!1,H=!1,W=!1,b=!1,F;F=Symbol.for("react.module.reference");function q(m){return!!(typeof m=="string"||typeof m=="function"||m===r||m===l||b||m===o||m===c||m===u||W||m===g||C||A||H||typeof m=="object"&&m!==null&&(m.$$typeof===p||m.$$typeof===f||m.$$typeof===d||m.$$typeof===a||m.$$typeof===i||m.$$typeof===F||m.getModuleId!==void 0))}function k(m,v,j){var $=m.displayName;if($)return $;var D=v.displayName||v.name||"";return D!==""?j+"("+D+")":j}function V(m){return m.displayName||"Context"}function I(m){if(m==null)return null;if(typeof m.tag=="number"&&w("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 l:return"Profiler";case o:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof m=="object")switch(m.$$typeof){case a:var v=m;return V(v)+".Consumer";case d:var j=m;return V(j._context)+".Provider";case i:return k(m,m.render,"ForwardRef");case f:var $=m.displayName||null;return $!==null?$:I(m.type)||"Memo";case p:{var D=m,O=D._payload,P=D._init;try{return I(P(O))}catch{return null}}}return null}var L=Object.assign,U=0,z,X,oe,ae,ie,le,se;function R(){}R.__reactDisabledLog=!0;function ee(){{if(U===0){z=console.log,X=console.info,oe=console.warn,ae=console.error,ie=console.group,le=console.groupCollapsed,se=console.groupEnd;var m={configurable:!0,enumerable:!0,value:R,writable:!0};Object.defineProperties(console,{info:m,log:m,warn:m,error:m,group:m,groupCollapsed:m,groupEnd:m})}U++}}function G(){{if(U--,U===0){var m={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},m,{value:z}),info:L({},m,{value:X}),warn:L({},m,{value:oe}),error:L({},m,{value:ae}),group:L({},m,{value:ie}),groupCollapsed:L({},m,{value:le}),groupEnd:L({},m,{value:se})})}U<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=E.ReactCurrentDispatcher,ue;function de(m,v,j){{if(ue===void 0)try{throw Error()}catch(D){var $=D.stack.trim().match(/\n( *(at )?)/);ue=$&&$[1]||""}return`
|
|
22
|
+
`+ue+m}}var pe=!1,ke;{var zn=typeof WeakMap=="function"?WeakMap:Map;ke=new zn}function Bt(m,v){if(!m||pe)return"";{var j=ke.get(m);if(j!==void 0)return j}var $;pe=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var O;O=te.current,te.current=null,ee();try{if(v){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(he){$=he}Reflect.construct(m,[],P)}else{try{P.call()}catch(he){$=he}m.call(P.prototype)}}else{try{throw Error()}catch(he){$=he}m()}}catch(he){if(he&&$&&typeof he.stack=="string"){for(var N=he.stack.split(`
|
|
23
|
+
`),ne=$.stack.split(`
|
|
24
|
+
`),Y=N.length-1,J=ne.length-1;Y>=1&&J>=0&&N[Y]!==ne[J];)J--;for(;Y>=1&&J>=0;Y--,J--)if(N[Y]!==ne[J]){if(Y!==1||J!==1)do if(Y--,J--,J<0||N[Y]!==ne[J]){var ce=`
|
|
25
|
+
`+N[Y].replace(" at new "," at ");return m.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",m.displayName)),typeof m=="function"&&ke.set(m,ce),ce}while(Y>=1&&J>=0);break}}}finally{pe=!1,te.current=O,G(),Error.prepareStackTrace=D}var je=m?m.displayName||m.name:"",Zt=je?de(je):"";return typeof m=="function"&&ke.set(m,Zt),Zt}function Vn(m,v,j){return Bt(m,!1)}function Yn(m){var v=m.prototype;return!!(v&&v.isReactComponent)}function Ie(m,v,j){if(m==null)return"";if(typeof m=="function")return Bt(m,Yn(m));if(typeof m=="string")return de(m);switch(m){case c:return de("Suspense");case u:return de("SuspenseList")}if(typeof m=="object")switch(m.$$typeof){case i:return Vn(m.render);case f:return Ie(m.type,v,j);case p:{var $=m,D=$._payload,O=$._init;try{return Ie(O(D),v,j)}catch{}}}return""}var Le=Object.prototype.hasOwnProperty,Ot={},Ht=E.ReactDebugCurrentFrame;function Be(m){if(m){var v=m._owner,j=Ie(m.type,m._source,v?v.type:null);Ht.setExtraStackFrame(j)}else Ht.setExtraStackFrame(null)}function Gn(m,v,j,$,D){{var O=Function.call.bind(Le);for(var P in m)if(O(m,P)){var N=void 0;try{if(typeof m[P]!="function"){var ne=Error(($||"React class")+": "+j+" type `"+P+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof m[P]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ne.name="Invariant Violation",ne}N=m[P](v,P,$,j,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Y){N=Y}N&&!(N instanceof Error)&&(Be(D),w("%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",j,P,typeof N),Be(null)),N instanceof Error&&!(N.message in Ot)&&(Ot[N.message]=!0,Be(D),w("Failed %s type: %s",j,N.message),Be(null))}}}var Jn=Array.isArray;function nt(m){return Jn(m)}function qn(m){{var v=typeof Symbol=="function"&&Symbol.toStringTag,j=v&&m[Symbol.toStringTag]||m.constructor.name||"Object";return j}}function Xn(m){try{return Qt(m),!1}catch{return!0}}function Qt(m){return""+m}function Ut(m){if(Xn(m))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qn(m)),Qt(m)}var Te=E.ReactCurrentOwner,Zn={key:!0,ref:!0,__self:!0,__source:!0},Wt,zt,st;st={};function Kn(m){if(Le.call(m,"ref")){var v=Object.getOwnPropertyDescriptor(m,"ref").get;if(v&&v.isReactWarning)return!1}return m.ref!==void 0}function es(m){if(Le.call(m,"key")){var v=Object.getOwnPropertyDescriptor(m,"key").get;if(v&&v.isReactWarning)return!1}return m.key!==void 0}function ts(m,v){if(typeof m.ref=="string"&&Te.current&&v&&Te.current.stateNode!==v){var j=I(Te.current.type);st[j]||(w('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',I(Te.current.type),m.ref),st[j]=!0)}}function ns(m,v){{var j=function(){Wt||(Wt=!0,w("%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)",v))};j.isReactWarning=!0,Object.defineProperty(m,"key",{get:j,configurable:!0})}}function ss(m,v){{var j=function(){zt||(zt=!0,w("%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)",v))};j.isReactWarning=!0,Object.defineProperty(m,"ref",{get:j,configurable:!0})}}var rs=function(m,v,j,$,D,O,P){var N={$$typeof:t,type:m,key:v,ref:j,props:P,_owner:O};return N._store={},Object.defineProperty(N._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(N,"_self",{configurable:!1,enumerable:!1,writable:!1,value:$}),Object.defineProperty(N,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(N.props),Object.freeze(N)),N};function os(m,v,j,$,D){{var O,P={},N=null,ne=null;j!==void 0&&(Ut(j),N=""+j),es(v)&&(Ut(v.key),N=""+v.key),Kn(v)&&(ne=v.ref,ts(v,D));for(O in v)Le.call(v,O)&&!Zn.hasOwnProperty(O)&&(P[O]=v[O]);if(m&&m.defaultProps){var Y=m.defaultProps;for(O in Y)P[O]===void 0&&(P[O]=Y[O])}if(N||ne){var J=typeof m=="function"?m.displayName||m.name||"Unknown":m;N&&ns(P,J),ne&&ss(P,J)}return rs(m,N,ne,D,$,Te.current,P)}}var rt=E.ReactCurrentOwner,Vt=E.ReactDebugCurrentFrame;function ye(m){if(m){var v=m._owner,j=Ie(m.type,m._source,v?v.type:null);Vt.setExtraStackFrame(j)}else Vt.setExtraStackFrame(null)}var ot;ot=!1;function at(m){return typeof m=="object"&&m!==null&&m.$$typeof===t}function Yt(){{if(rt.current){var m=I(rt.current.type);if(m)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+
|
|
27
|
+
Check the render method of \``+m+"`."}return""}}function as(m){{if(m!==void 0){var v=m.fileName.replace(/^.*[\\\/]/,""),j=m.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+
|
|
29
|
+
Check your code at `+v+":"+j+"."}return""}}var Gt={};function is(m){{var v=Yt();if(!v){var j=typeof m=="string"?m:m.displayName||m.name;j&&(v=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+j+">.")}return
|
|
31
|
+
Check the top-level render call using <`+j+">.")}return v}}function Jt(m,v){{if(!m._store||m._store.validated||m.key!=null)return;m._store.validated=!0;var j=is(v);if(Gt[j])return;Gt[j]=!0;var $="";m&&m._owner&&m._owner!==rt.current&&($=" It was passed a child from "+I(m._owner.type)+"."),ye(m),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',j,$),ye(null)}}function qt(m,v){{if(typeof m!="object")return;if(nt(m))for(var j=0;j<m.length;j++){var $=m[j];at($)&&Jt($,v)}else if(at(m))m._store&&(m._store.validated=!0);else if(m){var D=_(m);if(typeof D=="function"&&D!==m.entries)for(var O=D.call(m),P;!(P=O.next()).done;)at(P.value)&&Jt(P.value,v)}}}function ls(m){{var v=m.type;if(v==null||typeof v=="string")return;var j;if(typeof v=="function")j=v.propTypes;else if(typeof v=="object"&&(v.$$typeof===i||v.$$typeof===f))j=v.propTypes;else return;if(j){var $=I(v);Gn(j,m.props,"prop",$,m)}else if(v.PropTypes!==void 0&&!ot){ot=!0;var D=I(v);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof v.getDefaultProps=="function"&&!v.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cs(m){{for(var v=Object.keys(m.props),j=0;j<v.length;j++){var $=v[j];if($!=="children"&&$!=="key"){ye(m),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",$),ye(null);break}}m.ref!==null&&(ye(m),w("Invalid attribute `ref` supplied to `React.Fragment`."),ye(null))}}function Xt(m,v,j,$,D,O){{var P=q(m);if(!P){var N="";(m===void 0||typeof m=="object"&&m!==null&&Object.keys(m).length===0)&&(N+=" 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 ne=as(D);ne?N+=ne:N+=Yt();var Y;m===null?Y="null":nt(m)?Y="array":m!==void 0&&m.$$typeof===t?(Y="<"+(I(m.type)||"Unknown")+" />",N=" Did you accidentally export a JSX literal instead of a component?"):Y=typeof m,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Y,N)}var J=os(m,v,j,D,O);if(J==null)return J;if(P){var ce=v.children;if(ce!==void 0)if($)if(nt(ce)){for(var je=0;je<ce.length;je++)qt(ce[je],m);Object.freeze&&Object.freeze(ce)}else w("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 qt(ce,m)}return m===r?cs(J):ls(J),J}}function us(m,v,j){return Xt(m,v,j,!0)}function ds(m,v,j){return Xt(m,v,j,!1)}var ms=ds,fs=us;Me.Fragment=r,Me.jsx=ms,Me.jsxs=fs}()),Me}process.env.NODE_ENV==="production"?wt.exports=Ss():wt.exports=Es();var s=wt.exports;const mn=()=>{const[e,t]=h.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return h.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},be=(e,t)=>{const n=h.useRef(!1);h.useEffect(()=>{n.current?e():n.current=!0},t)};function Ts(e,t,n){var r=this,o=h.useRef(null),l=h.useRef(0),d=h.useRef(null),a=h.useRef([]),i=h.useRef(),c=h.useRef(),u=h.useRef(e),f=h.useRef(!0);h.useEffect(function(){u.current=e},[e]);var p=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,x=!("trailing"in n)||!!n.trailing,y="maxWait"in n,_=y?Math.max(+n.maxWait||0,t):null;h.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var E=h.useMemo(function(){var w=function(b){var F=a.current,q=i.current;return a.current=i.current=null,l.current=b,c.current=u.current.apply(q,F)},T=function(b,F){p&&cancelAnimationFrame(d.current),d.current=p?requestAnimationFrame(b):setTimeout(b,F)},C=function(b){if(!f.current)return!1;var F=b-o.current;return!o.current||F>=t||F<0||y&&b-l.current>=_},A=function(b){return d.current=null,x&&a.current?w(b):(a.current=i.current=null,c.current)},H=function b(){var F=Date.now();if(C(F))return A(F);if(f.current){var q=t-(F-o.current),k=y?Math.min(q,_-(F-l.current)):q;T(b,k)}},W=function(){var b=Date.now(),F=C(b);if(a.current=[].slice.call(arguments),i.current=r,o.current=b,F){if(!d.current&&f.current)return l.current=o.current,T(H,t),g?w(o.current):c.current;if(y)return T(H,t),w(o.current)}return d.current||T(H,t),c.current};return W.cancel=function(){d.current&&(p?cancelAnimationFrame(d.current):clearTimeout(d.current)),l.current=0,a.current=o.current=i.current=d.current=null},W.isPending=function(){return!!d.current},W.flush=function(){return d.current?A(Date.now()):c.current},W},[g,y,t,_,x,p]);return E}function fn(e,t,n){var r=n===void 0?{}:n,o=r.leading,l=r.trailing;return Ts(e,t,{maxWait:t,leading:o===void 0||o,trailing:l===void 0||l})}let it;const Fe=(e=!0,t=!1)=>{if(!e)return;const[n,r]=h.useState(0)||[!1,()=>{}];h.useEffect(()=>(l(),window.addEventListener("resize",d),()=>{clearTimeout(it),d.flush(),window.removeEventListener("resize",d)}),[]);const o=()=>window.innerWidth,l=()=>{r(o())},d=fn(()=>{o()!==n&&(t&&(clearTimeout(it),document.body.classList.add("is-resizing"),it=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),l())},500,{leading:!0});return n},pn=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[o,l]=h.useState({current:0,past:0})||[!1,()=>{}],[d,a]=h.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];h.useEffect(()=>(i(),window.addEventListener("scroll",c),()=>{c.flush(),window.removeEventListener("scroll",c)}),[]);const i=()=>{const u=window.scrollY,f=o.current,p=u-f,g=p>0?"down":"up";if(l({current:u,past:f}),g==="down"){u>=e+t.down&&!d.scrollDown&&(!d.scrollUp||p>t.up)&&(n(),a({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!d.scrollUp&&(r(),a({scrollUp:!0,scrollDown:!1}))},c=fn(()=>{i()},250);return o},$s=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=h.useRef(!1);be(()=>{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)},Ms=(e,t)=>{Array.isArray(t)||(t=[t]);const n=ps(e);return t.forEach(({type:r,value:o})=>{hs(n,r,o)}),n},hn=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},gn=(e,t,n)=>{let r=n.mobile;for(const o in t){const l=parseInt(String(t[o]));if(e>=l)r=n[l];else if(e<l)break}return r},Cs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),As=e=>{let l;try{l=new Date().getTime()-new Date(e).getTime()}catch{return""}const d=l/36e5,a=Math.floor(l/864e5);if(a<1)return d<1?{path:"now"}:{path:"hours",number:Math.floor(d)};if(a<7)return{path:"days",number:a};const i=Math.floor(a/7);return i<=52?{path:"weeks",number:i}:{path:"years",number:Math.floor(a/365)}},Ns=e=>new Promise(t=>setTimeout(t,e)),Et={apolitical:"Apolitical",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",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",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",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..."},Fs={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>"},Ps={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>"},Rs={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>"},Ds=Object.freeze(Object.defineProperty({__proto__:null,en:Et,es:Fs,fr:Ps,pt:Rs},Symbol.toStringTag,{value:"Module"})),me=(e,t,n,r,o={})=>{let l="";return`${t}_${n}`in Et?l=e({id:`${t}_${n}`},o):l=e({id:t},{[r]:n,...o}),l},Is=(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 o=n.length-1;o>=0;o--){const l=Math.pow(10,(o+1)*3);if(l<=e){e=Math.round(e*t/l)/t,e===1e3&&o<n.length-1&&(e=1,o++),r=`${e}${n[o]}`;break}}return r},_n=(e,t)=>h.Children.map(e,n=>h.cloneElement(n,{...t})),Ls=e=>e.replace(/\s+/g,"").length>0,Q=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:o=!1,element:l="button",onClick:m=!1,className:a="",disabled:i=!1,screenreaderText:c=!1,children:u=!1,...f})=>{const g=Fe(typeof t=="object");if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),E=hn(Object.keys(_));t=gn(g,E,_)}const x=[];typeof t=="string"&&x.push(t),r&&(x.push("icon"),typeof r=="object"?(x.push(r.icon),r.position?x.push(r.position):x.push("left"),r.hover&&x.push(`hover_${r.hover}`),r.animate&&(x.push("animate"),typeof r.animate=="string"&&x.push(r.animate))):(x.push(r),!r.includes("right")&&!r.includes("left")&&x.push("left"))),n.muted&&x.push("muted"),n.fullWidth&&x.push("full-width");const b={...f,className:S(e,a,x,{"no-text":!u,disabled:i,button:o}),onClick:_=>{(!o||o[0]==="#")&&m&&(_.preventDefault(),_.stopPropagation()),m&&m(_)},disabled:typeof i=="object"&&"isClickable"in i?!i.isClickable:i};return o&&(l="a",b.href=o),h.createElement(l,b,u||(c?s.jsx(ee,{showOnFocus:!1,children:c}):null))},Pe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",o=e.map((l,m)=>r==="p"?s.jsx(Q,{...l},m):s.jsx("li",{children:s.jsx(Q,{...l})},m));return h.createElement(r,{className:S("button-wrapper",t),...n,children:o})};const Ee=({maxWidth:e=!1})=>{const t=e?{"--max-width":`${e/16}rem`}:{};return s.jsx("hr",{className:S({"has-max-width":e}),style:t})},Re=({href:e,children:t,fallbackElement:n,className:r="",onClick:o,gtmContext:l,gtmType:m,...a})=>{if(e){const i={...a};return o&&(i.onClick=o),l&&(i["data-gtm-event-context"]=l),m&&(i["data-gtm-event-type"]=m),s.jsx("a",{href:e,className:S("gtm-trackable",r),...i,children:t})}return n?h.createElement(n,{children:t,className:r,...a}):t},tn={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"}},Bs=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:o}=e?tn[e]:tn.fallback;return{range:t&&t.length>0?t:r,sizes:n||o}},Os=({format:e,height:t,query:n,width:r})=>{let o=`w=${r}&h=${t}`;return o=e?`${o}&fm=${e}`:o,o=n?`${o}&${n}`:o,o},it=({format:e,range:t,url:n,query:r})=>t.map(({height:o,width:l})=>`${n}?${Os({format:e,height:o,query:r,width:l})} ${l}w`).join(", ");const xn=({image:e,className:t,testId:n})=>{const{description:r,height:o,type:l,query:m,url:a,width:i,loading:c,decoding:u,fetchPriority:f}=e,{range:p,sizes:g}=Bs(e),x=it({format:"avif",query:m,range:p,url:a}),b=it({format:"webp",query:m,range:p,url:a}),_=it({format:"",query:m,range:p,url:a});return s.jsxs("picture",{className:t,children:[l!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:x,sizes:g,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:b,sizes:g,"data-testid":"source"}),s.jsx("img",{srcSet:_,sizes:g,src:a,alt:r,loading:c||"lazy",decoding:u||"async",fetchpriority:f||"auto",width:i,height:o,"data-testid":n||"image"})]})};let Ce=!1;const vn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=M.useIntl(),o=h.useRef(null),[l,m]=h.useState("hidden");h.useEffect(()=>{const i=o.current;if(i)return i.addEventListener("transitionend",a),()=>{i.removeEventListener("transitionend",a)}},[]);const a=({propertyName:i})=>{i==="opacity"&&(Ce!==!1&&clearTimeout(Ce),m(c=>c==="opening"?"open":c==="closing"?"closed":c==="closed"?"hidden":c))};return be(()=>{Ce!==!1&&clearTimeout(Ce);let i="open";e?m("opening"):(m("closing"),i="hidden"),Ce=setTimeout(()=>{m(i)},300)},[e]),s.jsx("aside",{ref:o,className:S("tooltip text-medium",l,{loading:t}),hidden:l==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Tt=({children:e,className:t="",...n})=>s.jsx("section",{className:S("full-width-section",t),...n,children:e});const Hs=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(o=>{r.push({href:o.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":o.eventContext||"Download",target:"_blank",children:o.text})}),s.jsx(Tt,{className:S("download-section",n),children:s.jsxs(s.Fragment,{children:[h.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Pe,{buttons:r})]})})};const Qs=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const o={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:S("logos",n),children:[e&&h.createElement(o.element,{className:"title"},o.text),s.jsx("ul",{className:S({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:l,nameOfBusiness:m,link:a=!1,description:i=!1},c)=>{if(!l||!l.url)return null;const u=s.jsx("img",{src:l.url,width:l.width||"auto",height:l.height||"auto",alt:m});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:a?s.jsx("a",{href:a,target:"_blank",rel:"nofollow noreferrer noopener",children:u}):u}),i&&s.jsx("small",{children:i})]},window.btoa(`${l.url}_${c}`))})})]})};const Us=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ws=({content:e,image:t,variant:n="default",spacing:r="normal",cta:o,children:l})=>{const m=["eyebrow","title","text"],a={eyebrow:"small",title:"h1",text:"p"},i={};return m.forEach(c=>{if(!e[c]){i[c]=!1;return}if(typeof e[c]=="object"){i[c]=e[c];const{text:u,element:f}=e[c];if(f&&Us.includes(f.toLowerCase()))return;i[c]={text:u,element:a[c]};return}i[c]={text:e[c],element:a[c]}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=c=>{c.preventDefault(),c.stopPropagation();const u=document.getElementById(o.link.substring(1));u&&u.scrollIntoView({behavior:"smooth"})}),s.jsx(Tt,{className:S("banner-section",n,r,{"has-image":t,"has-extra-spacing":r==="normal"&&i.eyebrow&&i.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[m.map(c=>{if(i[c]&&typeof i[c]=="object"){const{text:u,element:f=""}=i[c];return h.createElement(f.toLowerCase(),{key:c,className:c},u)}return null}),l,o&&o.text&&o.link&&s.jsx(Q,{variant:t||n==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),t&&s.jsx(xn,{image:{...t,aspect:"banner"}})]})})},zs=h.memo(Ws);const Vs=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:o})=>!n&&!r?null:s.jsxs("aside",{className:S("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(Q,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":o,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Ye="https://storage.googleapis.com/apolitical-assets/",je={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Ys="200,000+";const $t=({label:e=!1,className:t="",children:n})=>{const r=M.useIntl();return s.jsxs("details",{className:S("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const xe=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:S("highlighted-text-box",e,t),...r,children:n});const De=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let o=n&&!!Object.keys(n).length;const l=typeof n=="object"&&"breakpoints"in n,m=Fe(l);if(l&&typeof n=="object"&&typeof m=="number"){const f=Object.assign({},n.breakpoints),p=hn(Object.keys(f));o=gn(m,p,f)}const{breakpoints:a,text:i="",component:c,...u}=n;return s.jsx(xe,{variant:"subtle",className:S("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(Xe,{options:{forceBlock:!0},children:t}),o&&typeof n=="object"&&(c||s.jsx(Q,{...u,variant:n.variant?n.variant:"secondary",children:i}))]})})};const wt=({children:e,...t})=>s.jsx("p",{...t,children:e}),bn={q:wt,blockquote:wt};for(let e=1;e<=6;e++)bn[`h${e}`]={component:wt,props:{className:"title"}};const wn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:S("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(Xe,{options:{wrapper:h.Fragment,forceBlock:!0,overrides:bn},children:r}):s.jsx("p",{children:r})]});const Gs=({className:e="",show:t=!1,hide:n=!1,text:r,children:o})=>{const l=M.useIntl(),m=h.useRef(null),[a,i]=h.useState(""),[c,u]=h.useState("closed");h.useEffect(()=>{const g=m.current;if(g)return g.addEventListener("transitionend",f),()=>{g.removeEventListener("transitionend",f)}},[]),h.useEffect(()=>{if(!r||typeof r!="string")return;const g=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",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..."},Fs={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>"},Ps={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>"},Rs={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>"},Ds=Object.freeze(Object.defineProperty({__proto__:null,en:Et,es:Fs,fr:Ps,pt:Rs},Symbol.toStringTag,{value:"Module"})),me=(e,t,n,r,o={})=>{let l="";return`${t}_${n}`in Et?l=e({id:`${t}_${n}`},o):l=e({id:t},{[r]:n,...o}),l},Is=(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 o=n.length-1;o>=0;o--){const l=Math.pow(10,(o+1)*3);if(l<=e){e=Math.round(e*t/l)/t,e===1e3&&o<n.length-1&&(e=1,o++),r=`${e}${n[o]}`;break}}return r},_n=(e,t)=>h.Children.map(e,n=>h.cloneElement(n,{...t})),Ls=e=>e.replace(/\s+/g,"").length>0,Q=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:o=!1,element:l="button",onClick:d=!1,className:a="",disabled:i=!1,screenreaderText:c=!1,children:u=!1,...f})=>{const g=Fe(typeof t=="object");if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),E=hn(Object.keys(_));t=gn(g,E,_)}const x=[];typeof t=="string"&&x.push(t),r&&(x.push("icon"),typeof r=="object"?(x.push(r.icon),r.position?x.push(r.position):x.push("left"),r.hover&&x.push(`hover_${r.hover}`),r.animate&&(x.push("animate"),typeof r.animate=="string"&&x.push(r.animate))):(x.push(r),!r.includes("right")&&!r.includes("left")&&x.push("left"))),n.muted&&x.push("muted"),n.fullWidth&&x.push("full-width");const y={...f,className:S(e,a,x,{"no-text":!u,disabled:i,button:o}),onClick:_=>{(!o||o[0]==="#")&&d&&(_.preventDefault(),_.stopPropagation()),d&&d(_)},disabled:typeof i=="object"&&"isClickable"in i?!i.isClickable:i};return o&&(l="a",y.href=o),h.createElement(l,y,u||(c?s.jsx(K,{showOnFocus:!1,children:c}):null))},Pe=({buttons:e,className:t="",...n})=>{const r=e.length>1?"ul":"p",o=e.map((l,d)=>r==="p"?s.jsx(Q,{...l},d):s.jsx("li",{children:s.jsx(Q,{...l})},d));return h.createElement(r,{className:S("button-wrapper",t),...n,children:o})};const we=({maxWidth:e=!1})=>{const t=e?{"--max-width":`${e/16}rem`}:{};return s.jsx("hr",{className:S({"has-max-width":e}),style:t})},Re=({href:e,children:t,fallbackElement:n,className:r="",onClick:o,gtmContext:l,gtmType:d,...a})=>{if(e){const i={...a};return o&&(i.onClick=o),l&&(i["data-gtm-event-context"]=l),d&&(i["data-gtm-event-type"]=d),s.jsx("a",{href:e,className:S("gtm-trackable",r),...i,children:t})}return n?h.createElement(n,{children:t,className:r,...a}):t},tn={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"}},Bs=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:o}=e?tn[e]:tn.fallback;return{range:t&&t.length>0?t:r,sizes:n||o}},Os=({format:e,height:t,query:n,width:r})=>{let o=`w=${r}&h=${t}`;return o=e?`${o}&fm=${e}`:o,o=n?`${o}&${n}`:o,o},lt=({format:e,range:t,url:n,query:r})=>t.map(({height:o,width:l})=>`${n}?${Os({format:e,height:o,query:r,width:l})} ${l}w`).join(", ");const xn=({image:e,className:t,testId:n})=>{const{description:r,height:o,type:l,query:d,url:a,width:i,loading:c,decoding:u,fetchPriority:f}=e,{range:p,sizes:g}=Bs(e),x=lt({format:"avif",query:d,range:p,url:a}),y=lt({format:"webp",query:d,range:p,url:a}),_=lt({format:"",query:d,range:p,url:a});return s.jsxs("picture",{className:t,children:[l!=="image/gif"&&s.jsx("source",{type:"image/avif",srcSet:x,sizes:g,"data-testid":"source"}),s.jsx("source",{type:"image/webp",srcSet:y,sizes:g,"data-testid":"source"}),s.jsx("img",{srcSet:_,sizes:g,src:a,alt:r,loading:c||"lazy",decoding:u||"async",fetchpriority:f||"auto",width:i,height:o,"data-testid":n||"image"})]})};let Ce=!1;const vn=({isOpen:e=!1,isLoading:t=!1,children:n})=>{const r=M.useIntl(),o=h.useRef(null),[l,d]=h.useState("hidden");h.useEffect(()=>{const i=o.current;if(i)return i.addEventListener("transitionend",a),()=>{i.removeEventListener("transitionend",a)}},[]);const a=({propertyName:i})=>{i==="opacity"&&(Ce!==!1&&clearTimeout(Ce),d(c=>c==="opening"?"open":c==="closing"?"closed":c==="closed"?"hidden":c))};return be(()=>{Ce!==!1&&clearTimeout(Ce);let i="open";e?d("opening"):(d("closing"),i="hidden"),Ce=setTimeout(()=>{d(i)},300)},[e]),s.jsx("aside",{ref:o,className:S("tooltip text-medium",l,{loading:t}),hidden:l==="hidden",children:t?s.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?s.jsx("p",{children:n}):n})};const Tt=({children:e,className:t="",...n})=>s.jsx("section",{className:S("full-width-section",t),...n,children:e});const Hs=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(o=>{r.push({href:o.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":o.eventContext||"Download",target:"_blank",children:o.text})}),s.jsx(Tt,{className:S("download-section",n),children:s.jsxs(s.Fragment,{children:[h.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),s.jsx(Pe,{buttons:r})]})})};const Qs=({title:e=!1,logos:t=[],className:n=""})=>{const r=t.length;if(r===0)return null;const o={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:""};return s.jsxs("div",{className:S("logos",n),children:[e&&h.createElement(o.element,{className:"title"},o.text),s.jsx("ul",{className:S({"two-col":r===2||r===4,"three-col":r===5||r<=10&&r%3===0}),children:t.map(({logo:l,nameOfBusiness:d,link:a=!1,description:i=!1},c)=>{if(!l||!l.url)return null;const u=s.jsx("img",{src:l.url,width:l.width||"auto",height:l.height||"auto",alt:d});return s.jsxs("li",{children:[s.jsx("p",{className:"img-wrapper",children:a?s.jsx("a",{href:a,target:"_blank",rel:"nofollow noreferrer noopener",children:u}):u}),i&&s.jsx("small",{children:i})]},window.btoa(`${l.url}_${c}`))})})]})};const Us=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ws=({content:e,image:t,variant:n="default",spacing:r="normal",cta:o,children:l})=>{const d=["eyebrow","title","text"],a={eyebrow:"small",title:"h1",text:"p"},i={};return d.forEach(c=>{if(!e[c]){i[c]=!1;return}if(typeof e[c]=="object"){i[c]=e[c];const{text:u,element:f}=e[c];if(f&&Us.includes(f.toLowerCase()))return;i[c]={text:u,element:a[c]};return}i[c]={text:e[c],element:a[c]}}),o&&o.link&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=c=>{c.preventDefault(),c.stopPropagation();const u=document.getElementById(o.link.substring(1));u&&u.scrollIntoView({behavior:"smooth"})}),s.jsx(Tt,{className:S("banner-section",n,r,{"has-image":t,"has-extra-spacing":r==="normal"&&i.eyebrow&&i.title}),children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"content-wrapper",children:[d.map(c=>{if(i[c]&&typeof i[c]=="object"){const{text:u,element:f=""}=i[c];return h.createElement(f.toLowerCase(),{key:c,className:c},u)}return null}),l,o&&o.text&&o.link&&s.jsx(Q,{variant:t||n==="light"?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,children:o.text})]}),t&&s.jsx(xn,{image:{...t,aspect:"banner"}})]})})},zs=h.memo(Ws);const Vs=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:o})=>!n&&!r?null:s.jsxs("aside",{className:S("marketing-block",e),children:[n&&s.jsx("p",{className:"title",children:n}),r&&s.jsx("p",{children:r}),t&&s.jsx(Q,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":o,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Ye="https://storage.googleapis.com/apolitical-assets/",Se={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Ys="200,000+";const $t=({label:e=!1,className:t="",children:n})=>{const r=M.useIntl();return s.jsxs("details",{className:S("collapsible-section",t),children:[s.jsx("summary",{children:e||r.formatMessage({id:"collapsibleSection_summary"})}),s.jsx("div",{className:"content",children:n})]})};const xe=({variant:e="primary",className:t="",children:n,...r})=>s.jsx("div",{className:S("highlighted-text-box",e,t),...r,children:n});const De=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let o=n&&!!Object.keys(n).length;const l=typeof n=="object"&&"breakpoints"in n,d=Fe(l);if(l&&typeof n=="object"&&typeof d=="number"){const f=Object.assign({},n.breakpoints),p=hn(Object.keys(f));o=gn(d,p,f)}const{breakpoints:a,text:i="",component:c,...u}=n;return s.jsx(xe,{variant:"subtle",className:S("empty-state-box",e,r),children:s.jsxs(s.Fragment,{children:[t&&s.jsx(Ze,{options:{forceBlock:!0},children:t}),o&&typeof n=="object"&&(c||s.jsx(Q,{...u,variant:n.variant?n.variant:"secondary",children:i}))]})})};const kt=({children:e,...t})=>s.jsx("p",{...t,children:e}),bn={q:kt,blockquote:kt};for(let e=1;e<=6;e++)bn[`h${e}`]={component:kt,props:{className:"title"}};const wn=({type:e="default",className:t="",heading:n=!1,children:r})=>s.jsxs("div",{className:S("helper-text-box text-small",e,t),children:[n&&s.jsx("p",{className:"title",children:n}),typeof r=="string"?s.jsx(Ze,{options:{wrapper:h.Fragment,forceBlock:!0,overrides:bn},children:r}):s.jsx("p",{children:r})]});const Gs=({className:e="",show:t=!1,hide:n=!1,text:r,children:o})=>{const l=M.useIntl(),d=h.useRef(null),[a,i]=h.useState(""),[c,u]=h.useState("closed");h.useEffect(()=>{const g=d.current;if(g)return g.addEventListener("transitionend",f),()=>{g.removeEventListener("transitionend",f)}},[]),h.useEffect(()=>{if(!r||typeof r!="string")return;const g=r.split(`
|
|
36
36
|
`);i(g.length<3?`${r.substring(0,400)}...`:g.slice(0,3).join(`
|
|
37
|
-
`))},[r]),h.useEffect(()=>{c==="ready-to-close"&&u("closing")},[c]);const f=({propertyName:g})=>{g==="max-height"&&u(x=>x==="opening"?"open":x==="closing"?"closed":x)};if(!r)return null;const p=["opening","open"].includes(c);return s.jsxs(xe,{variant:"subtle",className:S("hide-show-text-box",e),children:[s.jsxs("div",{ref:m,className:S("content",c),children:[s.jsx(Xe,{options:{forceBlock:!0},children:c==="closed"?a:r}),c!=="closed"&&o]}),s.jsx("p",{className:"cta",children:s.jsx(Q,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:S({"rotate-180":p}),onClick:()=>{u(p?"ready-to-close":"opening")},children:p?n||l.formatMessage({id:"hideShowTextBox_hide"}):t||l.formatMessage({id:"hideShowTextBox_show"})})})]})},Js=()=>h.Fragment,qs=({children:e})=>s.jsx(xe,{variant:"secondary",children:e}),Xs=["span","strong","h1","h2","h3","h4","h5","h6","p"],Zs=({children:e})=>{const t=M.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const l of h.Children.toArray(e))if(!(!l||typeof l=="string"||typeof l=="number"))if(h.isValidElement(l)&&l.type==="summary"){if(l.props&&l.props.children){for(const m of h.Children.toArray(l.props.children))if(!(!m||typeof m=="string"||typeof m=="number")&&h.isValidElement(m)){const a=m.type;if(Xs.includes(a)){for(n=m.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(l);const o=n?n.toString():"";return s.jsx($t,{label:o,className:["Sources","Resources"].includes(o)?"discrete-links":"",children:r.map(l=>l)})},Ks=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(xe,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(xe,{variant:"primary",children:e});case"pink-textbox":return s.jsx(xe,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},er=e=>{const t=M.useIntl(),n=Date.now().toString();let r="default";const o=e.src;return o.includes("youtube")||o.includes("vimeo")?r="video":o.includes("riddle")||o.includes("sli.do")?r="poll":o.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(ee,{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})]})},nn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},tr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,o=!1;for(const l of h.Children.toArray(e))if(!(!l||typeof l=="string"||typeof l=="number")&&h.isValidElement(l)){const m=l.type;if(["button","center","span","strong"].includes(m)&&l.props&&l.props.children&&l.props.children[0])for((m==="button"||nn(l.props.children[0])==="button")&&(o=!0),r=l.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!h.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&nn(r)==="button"&&(o=!0);else break}return o?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(Q,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},kn=({children:e})=>s.jsx("span",{children:e});const kt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:h.Fragment,forceBlock:!0,overrides:{a:tr,CollapsibleSection:$t,TextBox:xe,CaseStudy:qs,style:Js,details:Zs,div:Ks,iframe:er}};return s.jsx("div",{className:S("markdown-text",e),children:s.jsx(Xe,{options:{...r,...t},children:n})})};const yn=({size:e="medium",variant:t="default",className:n="",children:r})=>s.jsx("span",{className:S("pill",e,t,n),children:r});const Ge=({element:e="p",children:t=null,className:n="",...r})=>h.createElement(e,{...r,className:S("status-banner text-small",n),"aria-live":"assertive"},t);const nr=({progress:e=0,text:t=!1,className:n=""})=>{const r=M.useIntl(),o=e>75?100:e>50?75:e>25?50:e>5?25:0,l={"--progress":`${e}%`};return s.jsx("span",{className:S(`progress-bar section-${o}`,n),style:l,children:s.jsx(ee,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},jn=h.memo(nr);const lt="loadingBlock_",sr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=M.useIntl();t||(t={0:{text:r.formatMessage({id:`${lt}loading`})},75:{text:r.formatMessage({id:`${lt}almostDone`})},100:{text:r.formatMessage({id:`${lt}complete`})}});let o=null;const l=Object.keys(t);for(let a=0;a<l.length&&!(e<parseInt(l[a]));a++)o=l[a];const m=o&&t[o].icon?{"--icon":`url(${Ye}icons/${t[o].icon}.svg)`}:{};return s.jsxs(xe,{className:S("loading-block",n,{"has-icon":o&&t[o].icon}),variant:"subtle",style:m,children:[o&&s.jsx("span",{className:"step",children:t[o].text}),s.jsx(jn,{progress:e})]})},rr=h.memo(sr);const fe=({element:e="div",className:t="",...n})=>s.jsx(St,{element:e,className:S("loading-placeholder",t),...n});const yt={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],cards:["card","card","card","card"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},Sn=(e,t)=>e in yt?s.jsx("div",{className:e,children:yt[e].map((n,r)=>Sn(n,r))},t):s.jsx(fe,{className:e},t),En=({layout:e="overview-page"})=>s.jsx("div",{className:S("loading-state",e),children:yt[e].map((t,n)=>Sn(t,n))}),Tn=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):""},Oe=["#5AB6A3","#A2D7AF","#806056","#3962B3"],or=e=>{const t=Math.ceil(26/Oe.length),n=Tn(e).toLowerCase();if(n==="")return Oe[0];const r=n.charCodeAt(0)-96;for(let o=0;o<Oe.length;o++)if(r<=t*(o+1))return Oe[o]};const sn=256,Ze=({className:e="",src:t="",name:n,alt:r,width:o=sn,height:l=sn,...m})=>{const[a,i]=h.useState(!1),c=h.useRef(null);h.useEffect(()=>{const f=c.current;if(!f)return;const p=f.getContext("2d");if(!p)return;const g=o,x=l;typeof window<"u"&&window.devicePixelRatio&&(f.width=g*window.devicePixelRatio,f.height=x*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=or(n),p.fillRect(0,0,g,x),p.font=`${g/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(Tn(n),g/2,x/1.6)},[n]);let u=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(u=!0),s.jsx("figure",{className:S("profile-picture",e,{error:a}),...m,children:u?s.jsx("img",{src:t,alt:r||n,onError:()=>{i(!0)},width:o,height:l}):s.jsx("canvas",{ref:c})})},Mt=e=>e==="apolitical"?{image:`${Ye}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ye}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},ar=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const o=e!=="",l=t!=="",m=n!=="";if(!o&&!l&&!m)return"";const a=`${e}${o&&l?` — ${t}`:t}`;let i=`${a}${(o||l)&&m?`, ${n}`:n}`;return i.length>r&&(i=a),i.length>r&&(i=jt(i,r)),i};const Ke=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:o="member-click",className:l=""})=>{const m=M.useIntl(),a=Mt(t);a.name||(a.name=m.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:i,url:c,image:u}=a,f=ar(a),p=n&&n.createdAt?As(n.createdAt):!1,g=n&&n.createdAt?Cs(n.createdAt):"";return h.createElement(e,{className:S("member text-medium",l),children:s.jsxs(Re,{href:c,gtmType:o,gtmContext:r,onClick:x=>{x==null||x.stopPropagation()},children:[s.jsx(Ze,{name:i,src:u}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:i}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&p&&s.jsx("span",{className:"date",title:g,"aria-label":g,children:m.formatMessage({id:`dates_${p.path}`},{number:p.number})}),n.didEdit&&s.jsx("em",{children:m.formatMessage({id:"discussion_edited"})})]}),f&&s.jsx("small",{children:f})]})]})})};const rn={small:24,medium:48},$n=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:o,showGap:l,showPlaceholders:m}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:i=""})=>{const c=M.useIntl();return!n||n.length===0?null:h.createElement(e,{className:S("contributors",i,o,{"has-gap":l}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((u,f)=>{let p,g="";if(f<a){const{name:x="",image:b=""}=Mt(u);if(m)return s.jsx(fe,{element:"li",className:"contributor"},f);p=s.jsx(Ze,{name:x,src:b,width:rn[o||"medium"],height:rn[o||"medium"]})}else if(f===a){const x=(t||n.length)-a;p=s.jsxs("small",{className:S({"large-number":x>99}),children:["+",Is(x,0)]}),g="number-left"}return p?s.jsx("li",{className:S("contributor",g),children:p},f):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?c.formatMessage({id:`member_${n[0]}`}):jt(n[0].name||"",20):null})]})})},Mn=({showDevTools:e=!0,children:t})=>{const n=new J.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(J.QueryClientProvider,{client:n,children:[t,e&&s.jsx(gs.ReactQueryDevtools,{initialIsOpen:!1})]})};var ir=h.createContext({client:Ve});function lr(e){var t=e.children,n=e.client,r=e.apiKey,o=e.options,l=h.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&&o&&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&&(Ve.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ve.init(r,o)),Ve)},[n,r]);return h.createElement(ir.Provider,{value:{client:l}},t)}const Cn=({children:e,user:t})=>t.isLoading?s.jsx(s.Fragment,{}):process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(lr,{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,An=({children:e,locale:t,messages:n})=>{const r=t||"en",o={...Ds[r],...n||{}};return s.jsx(M.IntlProvider,{locale:r,messages:o,children:e})},ve=h.createContext(null),Nn=({children:e,user:t})=>s.jsx(ve.Provider,{value:t,children:e}),cr=({bootstrap:e,children:t,intl:n})=>{const[r,o]=h.useState({isLoading:!0});return h.useEffect(()=>{e().then(l=>o({...l,isLoading:!1})).catch(()=>o({isLoading:!1}))},[]),s.jsx(An,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Nn,{user:r,children:s.jsx(Mn,{children:s.jsx(Cn,{user:r,children:t})})})})};const ct="joinCommunityButton",Ct=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const o=M.useIntl(),l=h.useContext(ve),m=l&&typeof l.id=="string",[a,i]=h.useState(e),[c,u]=h.useState(e?"joined":"notJoined");h.useEffect(()=>{c==="joining"?u("joined"):c==="leaving"&&u("notJoined")},[a]);const f={},p={};return a&&c!=="leaving"&&(f["data-hover-text"]=o.formatMessage({id:`${ct}_leave`}),f["aria-label"]=o.formatMessage({id:`${ct}_member_aria`}),p["aria-hidden"]="true"),s.jsx(Q,{variant:a?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:a&&c!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async g=>{m&&(g.currentTarget.blur(),a?(u("leaving"),typeof r=="function"&&await r()):(u("joining"),typeof n=="function"&&await n()),i(!a))},className:S("join-community-button",c,{active:c==="joining"}),disabled:!m,...f,children:s.jsx("span",{className:"text",...p,children:o.formatMessage({id:`${ct}${["joining","leaving"].includes(c)?`_${c}`:a?"_member":t?"_short":""}`})})})};const ut="communityDetails_",ur=({isMember:e=!1,slug:t,members:{number:n,data:r}={number:void 0,data:[]},className:o="",onInviteClick:l,...m})=>{const a=M.useIntl(),i=n||(r==null?void 0:r.length)||0;return s.jsxs("div",{className:S("community-details",o),children:[s.jsx(Ee,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[a.formatMessage({id:`${ut}members`}),s.jsx("span",{className:"count",children:i})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${t}/members`,children:a.formatMessage({id:`${ut}viewAll`})})})]}),s.jsx($n,{contributors:{total:n,data:r!=null&&r.length?r:[{},{},{},{},{}]},styling:{size:"medium",showGap:!0,showPlaceholders:i===0},cutoff:5})]}),s.jsx(Ct,{isMember:e,...m}),e&&s.jsx(Q,{variant:"primary",onClick:()=>l(),icon:{icon:"plus"},styling:{fullWidth:!0},children:a.formatMessage({id:`${ut}invite`})})]})};const dr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(ee,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:S("breadcrumbs text-small",n),children:e.map(({text:o,href:l,current:m=!1},a)=>s.jsxs("li",{children:[m&&s.jsx(ee,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Re,{href:m?void 0:l,children:jt(o,t)})]},`${window.btoa(o)}_${a}`))})]})};const mr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:o=""})=>{const l=M.useIntl(),m=t?[{id:"all",text:typeof t!="boolean"&&t.text||l.formatMessage({id:"filters_all"})},...e]:e,[a,i]=h.useState(t?["all"]:[]),c=(u,f)=>{let p=[];a.includes(u)?p=a.filter(g=>g!==u):u==="all"?p=["all"]:n?p=[...a.filter(g=>g!=="all"),u]:p=[u],i(g=>(r&&typeof r=="function"&&r({current:p,previous:g}),p)),f&&typeof f=="function"&&f()};return s.jsx("ul",{className:S("filters",o),children:m.map(({id:u,text:f,disabled:p=!1,callback:g=()=>{}})=>{let x={};return p&&(x={disabled:!0,"aria-label":l.formatMessage({id:"filters_disabled"},{name:f})}),s.jsx("li",{children:s.jsx("button",{className:S(u,{selected:a.includes(u)}),onClick:b=>{b.preventDefault(),b.stopPropagation(),c(u,g)},...x,children:f})},u)})})},fr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:o,position:l})=>{l==="before-lang"?r+=`/${o}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${o}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const dt={en:"English",es:"Español",fr:"Français",pt:"Português"},He="languageSwitcher_",pr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:o=()=>{},urlParts:l,variant:m="default",label:a,className:i=""})=>{const c=M.useIntl(),[u,f]=h.useState(e);if(h.useEffect(()=>{e!==u&&f(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),x=u!==e;return s.jsxs("div",{className:S("language-switcher text-small",m,i),children:[s.jsxs("nav",{children:[m!=="short"&&s.jsx("p",{children:a||c.formatMessage({id:`${He}label`})}),s.jsx("ul",{children:g.map(b=>{if(!dt[b])return null;let _={className:b};return u===b?_["aria-label"]=c.formatMessage({id:`${He}selected`},{language:dt[b]}):_={..._,href:fr(b,l),onClick:E=>{E.preventDefault(),E.stopPropagation(),f(b),o(b)}},s.jsx("li",{children:s.jsx(Re,{..._,fallbackElement:"span",children:dt[b]})},b)})}),m!=="short"&&!x&&s.jsx("p",{children:c.formatMessage({id:`${He}translation_${t?"original":n?"human":"machine"}`})})]}),m!=="short"&&!x&&!t&&!n&&s.jsx("small",{children:c.formatMessage({id:`${He}disclaimer`},{email:je.support,link:b=>{const _=`mailto:${b}`;return s.jsx("a",{href:_,children:b})}})})]})};const mt=M.createIntl({locale:"en",messages:Et}),Fn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:o=!1,messages:l={button:mt.formatMessage({id:"loadMore_button"}),endOfFeed:mt.formatMessage({id:"loadMore_endOfFeed"}),error:mt.formatMessage({id:"loadMore_error"})},className:m="",gtmContext:a="LoadMore"})=>{const[i,c]=h.useState(!1),[u,f]=h.useState(!1);if(t<=0||t<n*e)return null;const p=async g=>{try{await r(g)}catch(x){x instanceof Error&&x.message&&x.message.includes("Cannot read items")?f(!0):c(!0)}};return s.jsxs("footer",{className:S("load-more",m),children:[i&&s.jsx("p",{className:"error",children:l.error}),u?s.jsx("p",{children:l.endOfFeed}):s.jsx(Q,{variant:"secondary",icon:o,onClick:p,"data-gtm-event-context":a,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:l.button})]})};let Qe=!1;const Pn=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const o=M.useIntl(),l=h.useRef(null),[m,a]=h.useState(!1),i=c=>{l.current&&c.target instanceof HTMLElement&&!l.current.contains(c.target)&&a(!1)};return h.useEffect(()=>(document.addEventListener("click",i,!0),()=>{document.removeEventListener("click",i,!0)})),h.createElement(e,{ref:l,className:S("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!m),"aria-haspopup":"true","aria-expanded":m,"aria-controls":t,screenreaderText:o.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!m,children:n.map(({href:c,onClick:u,text:f,icon:p,...g},x)=>{const b={...g,onClick:_=>{a(!1),typeof u=="function"&&u(_)},onFocus:()=>{Qe&&(clearTimeout(Qe),Qe=!1)},onBlur:()=>{Qe=setTimeout(()=>{a(!1)},100)}};return c&&(b.href=c),s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...b,children:f})},`${window.btoa(f)}_${x}`)})})]})})};const At=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:S("logo",e,t,n),...r,children:s.jsx(ee,{children:s.jsx(M.FormattedMessage,{id:"apolitical"})})})});const hr={"2-1":901},gr=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const o=Fe(!0);let l=r;return h.Children.count(r)===1&&(l=h.Children.toArray(r)[0],l.props&&(l=l.props.children)),s.jsx("section",{className:S("columns",`layout-${e}`,n),children:h.Children.map(l,(m,a)=>t!==!1&&a===t&&o&&o<hr[e]?null:m)})};const ft="cookieBanner_",pt=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],ht=new Date(Date.now()+12*30*24*60*60*1e3),Rn=()=>{const e=M.useIntl(),[t,n,r]=cn.useCookies(pt),[o,l]=h.useState(!t["apol-cookie-banner"]),m=()=>{pt.forEach(u=>{n(u,!0,{path:"/",expires:ht,domain:u==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),l(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:ht}),pt.forEach(u=>{if(u==="apol-cookie-banner"){n(u,!0,{path:"/",expires:ht});return}r(u)}),l(!1)};if(!o)return null;const i=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:m,gtmType:"accepted-all"}],c=[];return i.forEach(u=>{c.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:`${ft}buttons_${u.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${ft}title`})}),s.jsx("p",{children:e.formatMessage({id:`${ft}text`})}),s.jsx(Pe,{buttons:c})]})},_e={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:je["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:je["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:je.support,gtmType:"concierge-email-click"},business:{email:je.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 Se="footer_",Je="SiteFooter",on=({group:e})=>{const t=_e[e].order||[];let n=!1;return"text"in _e[e]&&(n=_e[e].text),s.jsxs(h.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(M.FormattedMessage,{id:`${Se}${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:o,gtmType:l}=_e[e][r],m={};return["legal"].includes(e)&&(m.target="_blank",m.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:o,className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":l,...m,children:s.jsx(M.FormattedMessage,{id:`${Se}${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(h.Fragment,{children:[s.jsx("dt",{children:s.jsx(M.FormattedMessage,{id:`${Se}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(M.FormattedMessage,{id:`${Se}${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":Je,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Nt=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(St,{element:"hr"}),s.jsx(At,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Je,"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(on,{group:e}),Object.keys(_e[e]).includes("child")&&s.jsx(on,{group:_e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray(_e.social.order)&&_e.social.order.map(e=>{const t=_e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(M.FormattedMessage,{id:`${Se}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(M.FormattedMessage,{id:`${Se}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const Ue="emailHelperTextBox_",_r=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const o=M.useIntl(),[l,m]=h.useState({path:`${Ue}default`,type:"default",link:{},mail:{},error:""}),[a,i]=h.useState(!1),c=h.useCallback(g=>{g.preventDefault(),g.stopPropagation();const x=b=>{m({path:`${Ue}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>c(_),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:b})};if(typeof r!="function"){x(o.formatMessage({id:`${Ue}error_noFunction`}));return}i(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(b=>{x(b.message)}).finally(()=>{i(!1)})},[t,n,r]);h.useEffect(()=>{let g=Ue,x="default",b={},_={};switch(e){case"gov":g+="autoApproved",x="success";break;case"nonGov":g+="unrecognisedEmail",x="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",x="error",_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",x="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>c(E),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",x="error",b={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}m({...l,path:g,type:x,link:b,mail:_})},[e]);const u={};return["link","mail"].forEach(g=>{u[g]=Object.keys(l[g]).length?x=>s.jsx("a",{...l[g],children:x}):x=>x}),s.jsx(wn,{type:l.type,heading:a?!1:o.formatMessage({id:`${l.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(fe,{element:"span"}),s.jsx(fe,{element:"span"})]}):o.formatMessage({id:`${l.path}_text`},{...u,strong:g=>s.jsx("strong",{children:g}),em:g=>s.jsx("em",{children:g}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:l.error})})};const We="passwordRules_",Dn="isMoreThanEightCharacters",In="includesNumberAndSymbol",Ln="includesLowerAndUppercase",xr={[Dn]:"8Characters",[In]:"numberSymbol",[Ln]:"lowercaseUppercase"},vr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=M.useIntl();return s.jsxs("aside",{className:S("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${We}intro`})}),s.jsx("ul",{children:[Dn,In,Ln].map(r=>s.jsxs("li",{className:S({matches:e[r]}),children:[s.jsxs(ee,{children:[n.formatMessage({id:`${We}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${We}rule_${xr[r]}`})}),!e[r]&&s.jsxs(ee,{element:"strong",children:[" "," ",n.formatMessage({id:`${We}notMet`})]})]},`rule-${r}`))})]})},br=h.memo(vr);const wr=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:o=()=>{}},className:l="",hasLoaded:m=!1})=>{const a=M.useIntl(),[i,c]=h.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const E=await n();c(v=>({...v,setUp:!0,id:E&&E.id,disabled:!1}))}catch(E){c(v=>({...v,setUp:!0,disabled:!0})),o(E)}};if(h.useEffect(()=>{m&&!i.setUp&&u()},[m]),!m)return s.jsx(fe,{className:"rating-placeholder"});const{id:f,rating:p,disabled:g}=i,x="ratings_",b={text:a.formatMessage({id:`${x}text`}),low:a.formatMessage({id:`${x}low`}),high:a.formatMessage({id:`${x}high`}),success:a.formatMessage({id:`${x}success`}),...e},_=async E=>{if(!(!f||g))try{c(v=>({...v,rating:E,disabled:!0})),await r({id:f,value:E})}catch(v){c($=>({...$,rating:null})),o(v)}finally{c(v=>({...v,disabled:!1}))}};return s.jsxs("div",{className:S("rating",l),children:[s.jsx("span",{className:"label",children:b[p?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(E=>{const v=E+1;return s.jsx("li",{className:S({selected:p&&v<=p}),children:s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:`star${!p||v>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${x}stars`},{number:v,total:t})}${v===1||v===t?` - ${b[v===1?"low":"high"]}`:""}`,onClick:$=>{$.preventDefault(),$.stopPropagation(),_(v)},disabled:g})},`rating-${v}`)})})]})};const Bn=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:o="search-bar",gtmEvent:l="form-submission"})=>{const{searchIsOpen:m=!0,isDesktopVersion:a=!1}=n||{},i=M.useIntl(),c=h.useRef(null);be(()=>{!n||a||!m||c.current&&c.current.focus()},[m]);const u=f=>{f.preventDefault(),f.stopPropagation(),!(!c.current||!c.current.value||c.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(c.current.value)}`)};return s.jsx("form",{onSubmit:u,className:S("search-form gtm-trackable",t),"data-gtm-event-context":o,"data-gtm-event-type":l,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!m:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(ee,{element:"label",htmlFor:e,children:i.formatMessage({id:"search_label"})}),s.jsx("input",{ref:c,type:"search",id:e,name:e,defaultValue:r,placeholder:i.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&u(f)}}),s.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),c.current&&c.current.value&&(c.current.value="")},children:s.jsx(ee,{children:i.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:u,children:s.jsx(ee,{children:i.formatMessage({id:"search_cta"})})})]})})})};const On=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:o,backgroundColor:l,onClose:m,reportError:a,sendInvites:i,initialFormStatus:c="NOT_SUBMITTED"})=>{const[u,f]=h.useState([]),[p,g]=h.useState(!0),[x,b]=h.useState(c),{formatMessage:_}=M.useIntl(),E=async C=>{C.preventDefault();try{await i(u),f([]),b("SUCCESS")}catch(A){b("ERROR"),a(A)}},v=C=>{C.preventDefault(),b("NOT_SUBMITTED"),g(!0),f([])},$=C=>{C.preventDefault(),m(),b("CLOSED")};return x==="CLOSED"?null:x==="ERROR"||x==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"content centred",children:x==="SUCCESS"?s.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),s.jsx(Ee,{}),s.jsx("div",{className:"footer",children:x==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"secondary",onClick:v,children:_({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(Q,{onClick:$,children:_({id:"inviteForm_ctaDone"})})]}):s.jsx(Q,{onClick:v,children:_({id:"inviteForm_ctaTryAgain"})})})]}):s.jsxs("form",{style:{backgroundColor:l},onSubmit:E,className:S("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:o},children:t}),s.jsx(_s.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:_({id:"inviteForm_email_placeholder"}),emails:u,onChange:C=>{f(C),g(!C.length)},autoFocus:!1,getLabel:(C,A,H)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:C}),s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{H(A),g(!u.length)},className:"remove-email-button",screenreaderText:_({id:"overlay_close"})})]},A)})]}),s.jsx(Ee,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(Q,{className:"sendEmailsButton",disabled:p,children:n})})]})},B={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=l=>{const m=`logged${e?"In":"Out"}`;return t>=n[l][m]};let o={};return["navigation","search"].forEach(l=>{o[l]=r(l)}),o},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(o=>o===!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 o=Date.now();if(!t&&B.handlerCalled[e]&&o-B.handlerCalled[e]<500)return;B.handlerCalled[e]=o;let l=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(m=>{m===e||n[m]===!1||l.push({type:`menus.${m}`,value:!1})}),r(l)},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 o=un(e[r],t);if(!(typeof o>"u")&&(!n||o[t]&&o[t].includes(n)||o.value&&o.value.includes(n)||o.toString().includes(n)))return e[r]}return e[0].children?B.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:o})=>{if(!t.current||!t.current.children)return;const l=n?"desktop":"default";if(r[e][l]){r[e][l].focus();return}let m,a;switch(e){case"navigation":if(n){const i=B.findFirstChild(t.current.children,"attributes.aria-controls","navigation");m=B.findFirstChild(i.children,"href")}else m=B.findFirstChild(t.current.children,"href");m||(m=t.current);break;case"account":if(a=B.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;m=B.findFirstChild(a.children,"href");break;default:return}m&&(o([{type:`focusElements.${e}.${l}`,value:m}]),m.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(B.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(B.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(B.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{B.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Ne={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"}}}},qe=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:o=()=>{},doTrack:l=null})=>{const m=M.useIntl(),a=un(Ne,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const i="doTrack"in a,c=l===null?i?a.doTrack:!0:l,u=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(a.href){let v=a.gtmType||`${e}-click`;if(v.includes(".")){const $=v.split("."),C=$[$.length-2];v=`${C==="topics"?`${C}-`:""}${$[$.length-1]}`}p={href:a.href,role:"menuitem"},c&&(p={...p,className:"gtm-trackable","data-gtm-event-type":v,"data-gtm-event-context":"HeaderButtons"}),u&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const g=a.order&&a.order[0]&&a[a.order[0]],x=g&&a[a.order[0]].order,b=p&&window.location.pathname===a.href;let _={},E={};if(g){const v=a.menuId||e,$={onClick:C=>B.events.onClick(C,{id:v,callback:o,isOpen:r[v]}),onFocus:()=>B.events.onFocus({id:v}),onBlur:()=>B.events.onBlur({id:v,callback:o}),onMouseLeave:()=>B.events.onBlur({id:v,callback:o}),onMouseEnter:()=>B.events.onMouseEnter({id:v,callback:o})};n&&(x&&(_={...$,onKeyPress:C=>{C.key==="Enter"&&B.events.onClick(C,{id:v,callback:o,isOpen:r[v]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[v],"aria-controls":v}),E={hidden:v in r?!r[v]:!0}),x||(E={...E,...$})}return s.jsxs("li",{className:S({[a.className]:a.className,"has-submenu":g,parent:x,active:b}),role:"none",..._,children:[p?h.createElement(u?Q:"a",p,m.formatMessage({id:f})):m.formatMessage({id:f}),a.order&&s.jsx("ul",{...E,children:a.order.map(v=>{if(!a[v])return null;const $={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:o,doTrack:i?c:null};return a[v].order?s.jsxs("li",{className:S({[a[v].className]:a[v].className}),children:[m.formatMessage({id:`${f}_${v}`}),s.jsx("ul",{children:a[v].order.map(C=>s.jsx(qe,{id:`${e}.${v}.${C}`,...$},C))})]},v):s.jsx(qe,{id:`${e}.${v}`,...$},v)})})]},e)};const kr={height:67,height_desktop:83},Ft=()=>{const e=M.useIntl(),t=h.useContext(ve),n=Fe(!0,!0),r=t&&typeof t.id=="string",o=h.useMemo(()=>B.getIsDesktopVersion(r,n),[r,n]),[l,m]=h.useReducer(Ms,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:a,menus:i,focusElements:c}=l;pn({scrollPosition:kr[`height${o.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!o&&i.navigation||B.shouldChangeHeaderIsVisible(!0,i,m)},scrollDown:()=>{!o&&i.navigation||B.shouldChangeHeaderIsVisible(!1,i,m)}}});const u=(p,g)=>{B.handleMenus({id:p,value:g,menus:i,dispatch:m})},f=h.useRef(null);return be(()=>{i.navigation&&B.autoFocus({menu:"navigation",navigationRef:f,isDesktopVersion:o.navigation,focusElements:c,dispatch:m})},[i.navigation]),be(()=>{i.account&&B.autoFocus({menu:"account",navigationRef:f,isDesktopVersion:o.navigation,focusElements:c,dispatch:m})},[i.account]),t&&t.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:S({"logged-in":r,"logged-out":!r,visible:a}),children:[s.jsx(ee,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),s.jsx(At,{}),!o.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),u("navigation",!i.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":i.navigation,"aria-controls":"navigation",children:s.jsx(ee,{children:e.formatMessage({id:`header_menu_${i.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:f,id:"navigation",hidden:o.navigation||i.account?!1:!i.navigation,role:"menu","data-showing":!o.navigation&&i.account?"account":"default",children:Ne.order.map(p=>s.jsx(qe,{id:p,isLoggedIn:r,isDesktopVersion:o.navigation,menus:{navigation:i.navigation,account:i.account},callback:u},p))}),!o.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),u("search",!i.search)},"aria-haspopup":"true","aria-expanded":i.search,"aria-controls":"search-form",children:s.jsx(ee,{children:e.formatMessage({id:`header_search_${i.search?"hide":"show"}`})})}),s.jsx(Bn,{id:"global-search",handleToggle:{searchIsOpen:i.search,isDesktopVersion:o.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),r?s.jsxs("button",{className:"account-button",onClick:p=>B.events.onClick(p,{id:"account",callback:u,isOpen:i.account}),onMouseEnter:()=>B.events.onMouseEnter({id:"account",callback:u}),onMouseLeave:()=>B.events.onBlur({id:"account",callback:u}),"aria-haspopup":"true","aria-expanded":i.account,"aria-controls":"navigation",children:[s.jsx(ee,{children:e.formatMessage({id:`header_account_${i.account?"hide":"show"}`})}),s.jsx(Ze,{name:t&&t.name||"",src:t&&t.image&&t.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:Ne.buttons.order.map(p=>s.jsx(qe,{id:`buttons.${p}`},p))})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:S("overlay",{open:i.navigation||i.account||!o.search&&i.search})})]})};const yr=()=>{const e=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(Ft,{}),s.jsx("div",{id:"content",children:s.jsx(De,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Nt,{})]})},jr=({children:e,reportError:t,showFooter:n=!0,background:r="default",className:o="",locale:l="en"})=>{const m=mn();h.useEffect(()=>{window.scrollTo(0,0)},[m]);const a=_n(e,{locale:l});return s.jsx(xs.ErrorBoundary,{onError:t,fallback:s.jsx(yr,{}),children:s.jsx(h.Suspense,{fallback:s.jsx(En,{layout:"overview-page"}),children:s.jsx("div",{id:"wrapper",className:S(o,{[r]:r!=="default"}),children:s.jsxs(cn.CookiesProvider,{children:[s.jsx(Ft,{}),s.jsx("div",{id:"content",children:a}),n&&s.jsx(Nt,{}),s.jsx(Rn,{})]})})})})},an={default:"tags_",headerTopics:"header_topics_topics_"},gt={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"},Sr={getTagDetails:e=>{if(e.includes("topic_")){if(e=gt.topic[e.replace("topic_","")],e){const t=Ne.topics.topics[e].href;return t?{id:e,href:t,text:`${an.headerTopics}${e}`}:null}return null}return gt[e]?(e=gt[e],{id:e,text:`${an.default}${e}`}):null}};const Er=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:o="",gtmType:l="tag-click",gtmContext:m="tags"})=>{const a=M.useIntl();if(!e||e.length<1)return null;const i=[];return e.forEach(c=>{if(!c)return;const u=Sr.getTagDetails(c);u&&i.push(u)}),i.length<1?null:s.jsx("ul",{className:S("tags text-small",t,o,{"one-line":n}),children:i.map(c=>{const u=a.formatMessage({id:c.text});return s.jsx("li",{children:c.href&&r?s.jsx("a",{href:c.href,className:"gtm-trackable","data-gtm-event-type":l,"data-gtm-event-context":m,children:u}):u},c.id)})})};const Tr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:o="member-click",className:l=""})=>{const m=M.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:S("members-list",l),children:[s.jsxs("h1",{children:[m.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((a,i)=>s.jsxs("li",{children:[s.jsx(Ke,{member:a,gtmContext:r,gtmType:o}),a.isAdmin&&s.jsx(yn,{children:m.formatMessage({id:"membersList_admin"})})]},i))}),n&&s.jsx(Fn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let ze=null;const re="discussion_form_",Pt=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:o=5e4,minRows:l=4,forceShow:m={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:i="DiscussionForm"})=>{var P,q;const c=M.useIntl(),u=h.useContext(ve),[f,p]=h.useState(n.isEditing&&n.isEditing.text||""),[g,x]=h.useState(m.error||!1),[b,_]=h.useState(!1),E=h.useRef(null);if(r||(r=E),n.isLoading)return s.jsx(fe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const v=y=>{const z=y.target.value;p(z);let L;!u||!u.id?L=me(c.formatMessage,`${re}error_loggedOut`,e.type,"action"):t?z.length>=o&&(L=`${re}error_tooLong`):L=me(c.formatMessage,`${re}error_noPermission`,e.type,"action"),L?x(L):g&&x(!1)};let $=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const y=e.type==="response"?((P=e.slugs)==null?void 0:P.question)||"":((q=e.slugs)==null?void 0:q.answer)||"";y&&($=`${$}-${y.slice(-15)}`)}const C=async y=>{var L;if(y.preventDefault(),y.stopPropagation(),!u||!u.id||!t||H)return;ze&&clearTimeout(ze),_("submitting");const z=window.location.pathname;try{let I;switch(e.type){case"post":I=await a.create({content:f});break;case"question":I=await a.create({title:f,authorId:u&&u.id,...(L=a.props)==null?void 0:L.create});break;case"response":I=await a.create({question:e.slugs.question},{body:f,authorId:u&&u.id,contentPath:z});break;case"reply":I=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:f,authorId:u&&u.id,contentPath:z});break;default:break}await Ns(1e3),a.callback&&await a.callback(I),ze=setTimeout(()=>{p(""),_("submitted"),A()},500)}catch(I){const U=I;let V=`${re}error`;U.message.includes("entry already exists")&&(V=me(c.formatMessage,`${re}error_alreadyExists`,e.type,"action")),U.message.includes("429")?V=me(c.formatMessage,`${re}error_tooMany`,e.type,"action"):U.message.includes("400")&&(V=`${re}error`),x(V),A()}},A=()=>{ze=setTimeout(()=>{x(!1),_(!1)},5e3)},H=!f||!Ls(f),W=b==="submitting",k=[];return(n.isEditing&&!W||m.cancel)&&k.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!m.cancel&&(!u||!u.id||!f),children:c.formatMessage({id:`${re}cancel`})}),k.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:y=>{if(n.isEditing){_("submitting"),a.handleSaveEdit&&a.handleSaveEdit(E.current&&"value"in E.current?E.current.value:"");return}C(y)},className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!u||!u.id||!t||H||W||n.isEditing&&f===n.isEditing.text,children:c.formatMessage({id:`${re}${W?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:$,className:S("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:me(c.formatMessage,`${re}title`,e.type,"action")}),s.jsx(Ke,{member:u||"community",gtmContext:i,gtmType:"profile-click"}),s.jsx(ee,{element:"label",showOnFocus:!1,htmlFor:`${$}-input`,children:me(c.formatMessage,`${re}label`,e.type,"action")}),s.jsx(vs,{ref:r,id:`${$}-input`,name:e.type,placeholder:me(c.formatMessage,`${re}placeholder`,e.type,"action"),onChange:v,value:f,maxLength:o,"aria-invalid":!!g,"aria-errormessage":"error-message",minRows:l,autoFocus:!!n.isEditing}),s.jsx("small",{children:me(c.formatMessage,`${re}explainer`,e.type,"action",{a:y=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:y})})}),s.jsx(Pe,{buttons:k}),b==="submitted"&&s.jsx(Ge,{className:"success","data-testid":"success",children:me(c.formatMessage,`${re}success`,e.type,"action")}),g&&s.jsx(Ge,{id:"error-message",className:"error","data-testid":"error",children:m.error?m.error:typeof g=="string"?g.includes(" ")?g:c.formatMessage({id:g},{action:c.formatMessage({id:`discussion_action_${e.type}`}),maxLength:o}):g})]})},Rt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:o,leave:l,notMemberStateText:m}})=>r&&!n?s.jsx(De,{text:m,button:{component:s.jsx(Ct,{functions:{join:o,leave:l}})}}):s.jsx(Pt,{content:{type:e,slugs:{}},functions:{create:t}}),$r={showThread:!1,showForm:!1},Dt=h.createContext($r),Mr=({children:e})=>{const[t,n]=h.useState({showThread:!1,showForm:!1});return s.jsx(Dt.Provider,{value:{...t,updateConversation:n},children:e})},Cr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Ar=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ae=!1;const _t=()=>{Ae!==!1&&(clearTimeout(Ae),Ae=!1)},xt=10,Hn=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:o=!1,content:l={type:"reply",slugs:{}},canLike:m=!0,functions:{createLike:a=()=>{},deleteLike:i=()=>{}}={}})=>{const c=M.useIntl();h.useEffect(()=>{g(o)},[o]);const[u,f]=h.useState(t),[p,g]=h.useState(o),[x,b]=h.useState(!1),[_,E]=h.useState(!1),v=h.useMemo(()=>Ar(n,xt),[n]),$=A=>{if(A.preventDefault(),A.stopPropagation(),E(!1),Ae)return _t(),!1;if(_t(),x||!m)return!1;Ae=setTimeout(C,350)},C=async()=>{if(_t(),x||!m)return!1;let A=p?u-1:u+1;A<0&&(A=0),b(!0),f(A),g(!p);try{if(l&&l.slugs){const H=Cr(l.slugs);p?await i(H):await a(H,{contentPath:window.location.pathname})}}catch{f(t),g(o)}finally{b(!1)}};return h.createElement(e,{className:S("likes-wrapper text-medium action-button",{"show-spinner":x,"is-liked":p,disabled:!m}),onClick:$,onMouseEnter:()=>{E(!0)},onMouseLeave:()=>{E(!1)},onFocus:()=>{E(!0)},onBlur:()=>{E(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:p?"heart":"heart_empty",animate:"bounce"},className:S({"do-animation":p&&!o}),screenreaderText:m?c.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:c.formatMessage({id:`discussion_action_${l.type}`})}):!1,onClick:$,disabled:!m,"aria-hidden":!m,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${l.type}-click`}),s.jsx("span",{className:S("number-of-likes",{"no-likes":u===0}),"data-testid":"number-of-likes",children:c.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:u})}),n&&s.jsx(vn,{isOpen:_,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[v.map(A=>typeof A=="string"||!A.name?null:s.jsx("li",{children:s.jsx(Re,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",children:A.name})},A.id||window.btoa(A.name))),n.length>xt&&s.jsx("li",{children:c.formatMessage({id:"discussion_likes_more"},{number:n.length-xt})})]})})]})})};const Qn=({element:e="section",children:t,className:n,...r})=>h.createElement(e,{className:S("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const It=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:o=()=>{},onClose:l=()=>{}}={},forceShow:{error:m=!1}={},title:a,children:i,buttons:c,className:u="",gtmContext:f="Modal"})=>{const p=M.useIntl(),[g,x]=h.useState(t),b=E=>{x(E),E?(o(),document.body.classList.add("has-overlay")):(l(),document.body.classList.remove("has-overlay"))};h.useEffect(()=>{b(t)},[t]);const _=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:S("overlay",{open:g}),children:s.jsx(Qn,{id:e,className:S("overlay-modal",u,{"has-max-width":r}),hidden:!g,style:_,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[a&&s.jsx("h2",{className:"modal-title",children:a}),s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>b(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(Ee,{}),i,c&&s.jsxs("div",{className:"bottom",children:[s.jsx(Ee,{}),s.jsx(Pe,{buttons:c})]}),m&&s.jsx(Ge,{className:"error",children:m})]})})})},Un=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Nr=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:o="Send an invitation to your colleagues below",ctaMessage:l="Send invites",showIcon:m,onClose:a,reportError:i=()=>{},sendInvites:c})=>s.jsx(It,{title:n,isOpen:t,showDivider:!1,showIcon:m,functions:{onClose:a},className:S("invite-modal",e,{success:!!n}),children:s.jsx(On,{title:r,label:o,ctaMessage:l,onClose:a,sendInvites:c,reportError:i})}),ln=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Lt=(e,t)=>e&&!t;const ge="discussion_",et=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:o,functions:{content:{createContent:l,deleteContent:m,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:i,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:u}={openComments:()=>{}}},links:f={},className:p,gtmContext:g="DiscussionAnswer",children:x})=>{const b=M.useIntl(),_=h.useContext(ve),E=h.useContext(Dt),[v,$]=h.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[C,A]=h.useState(!1),[H,W]=h.useState("");if(h.useEffect(()=>{$({...v,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return s.jsx(fe,{className:"discussion-card discussion-post"});const{author:k,canLike:P,createdAt:q,id:y,likes:z=0,userLiked:L,comments:I=0}=t,U=_&&_.id&&typeof k!="string"&&k.id&&k.id===_.id||!1,V=typeof P=="boolean"?P:n?!U:!1,X=async R=>{R||(R=""),W("");try{if(!bs(R,v.body)){const Z=t.type==="question"?{title:R}:{body:R};await a(ln(t.slugs),Z)}$({body:R,isEditing:!1,didEdit:!0})}catch{W(`${ge}form_error`)}},oe=()=>{E&&E.updateConversation&&E.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const Z=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,se=document.getElementById(Z),ie=document.getElementById(`${Z}-input`);ie&&ie.focus(),se&&se.scrollIntoView({behavior:"smooth"})},0)},ae=()=>{try{m(ln(t.slugs))}catch{W("delete-error")}},ne=[{text:b.formatMessage({id:`${ge}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(b.formatMessage({id:`${ge}report_subject`}))}&body=${encodeURI(b.formatMessage({id:`${ge}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&&U&&ne.push({text:b.formatMessage({id:`${ge}moreMenu_edit`}),onClick:()=>$({...v,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:b.formatMessage({id:`${ge}moreMenu_delete`}),onClick:R=>{R.preventDefault(),R.stopPropagation(),A(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...Un(`delete-${t.slug}-modal`,C)}),h.createElement(e,{className:S("discussion-post",p),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:y||t.slug,className:S("discussion-card",t.type,{editing:v.isEditing,"has-link":f.post&&!v.isEditing}),onClick:R=>{!f.post||v.isEditing||(R.preventDefault(),R.stopPropagation(),window.location.href=f.post)},children:[!v.isEditing&&s.jsx(Ke,{member:k,additionalContent:{createdAt:q,didEdit:v.didEdit},className:typeof k!="string"&&k.id===o?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),v.isEditing?s.jsx(Pt,{content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:v.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:H!==""&&H!=="delete-error"?b.formatMessage({id:H},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:l,handleSaveEdit:X,handleCancel:()=>{W(""),$({...v,isEditing:!1})}},gtmContext:`${g}Form`}):f.post?s.jsx("a",{href:f.post,className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":"title-click",children:s.jsx(kt,{options:{overrides:{a:kn}},children:v.body})}):s.jsx(kt,{options:{wrapper:t.type==="question"?"h1":h.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:v.body}),!v.isEditing&&s.jsxs("ul",{className:S("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(Hn,{element:"li",likes:z,isShort:!1,userLiked:L,content:{type:t.type,slugs:t.slugs},canLike:V,functions:{createLike:i,deleteLike:c}}),(["question","post"].includes(t.type)||f.comments||typeof u=="function")&&s.jsxs("li",{className:"action-button",onClick:R=>{R.preventDefault(),R.stopPropagation(),f.comments&&(window.location.href=f.comments),typeof u=="function"&&u()},children:[s.jsx(Q,{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":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:b.formatMessage({id:`${ge}comments_screenReader`},{count:I})}),s.jsx("span",{children:b.formatMessage({id:`${ge}comments`},{count:I})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:oe,children:b.formatMessage({id:`${ge}reply`})})}),s.jsx(Pn,{element:"li",id:`more-${t.slug}`,options:ne})]})]}),x,s.jsx(It,{id:`delete-${t.slug}-modal`,isOpen:C,functions:{onOpen:()=>{},onClose:()=>A(!1)},forceShow:{error:H==="delete-error"?b.formatMessage({id:"discussion_delete_error"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:b.formatMessage({id:"discussion_delete_title"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>A(!1),children:b.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ae,children:b.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(M.FormattedMessage,{id:"discussion_delete_text",values:{p:R=>s.jsx("p",{children:R}),action:b.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const vt="discussion_responses_",Fr=({type:e="answer",responses:t=0})=>{const n=M.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${vt}title`},{action:n.formatMessage({id:`${vt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:me(n.formatMessage,`${vt}empty`,e,e)})]})};const Pr=({isOpen:e=!1,count:t=0,children:n})=>{const r=M.useIntl(),o=h.useRef(null),[l,m]=h.useState(e),[a,i]=h.useState("closed");h.useEffect(()=>{const p=o.current;if(p)return p.addEventListener("transitionend",c),()=>{p.removeEventListener("transitionend",c)}},[]),be(()=>{a==="closed"&&!l||i(["opening","open"].includes(a)?"ready-to-close":"opening")},[l]),h.useEffect(()=>{a==="ready-to-close"&&i("closing")},[a]);const c=({propertyName:p})=>{p==="max-height"&&i(g=>g==="opening"?"open":g==="closing"?"closed":g)},u=["opening","open"].includes(a),f=_n(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[s.jsx(Q,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${u?"left":"right"}`},onClick:()=>{m(!l)},children:r.formatMessage({id:`discussion_thread_${u?"hide":"show"}`},{count:t})}),s.jsx("ul",{ref:o,className:S("thread",a),hidden:!l,children:f})]})},Rr=({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}),Dr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:a})=>{if(!n)return;const i=Rr({user:n,content:a,verb:"post"});await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);return e.setQueryData(t,u=>[...u,i]),{previousActivities:c}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ir=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:m,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t),c=i==null?void 0:i.map(u=>((u==null?void 0:u.id)===(m==null?void 0:m.activityId)&&(u.content=a),u));return e.setQueryData(t,()=>c&&[...c]),{previousActivities:c}},onError:(m,a,i)=>{e.setQueryData(t,i.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Lr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:a})=>{await e.cancelQueries({queryKey:t});const i=e.getQueryData(t),c=i==null?void 0:i.map(u=>{var f;return(u==null?void 0:u.id)===a&&((f=u.reaction_counts)!=null&&f.like?u.reaction_counts.like+=1:u.reaction_counts.like=1),u});return e.setQueryData(t,()=>c&&[...c]),{previousActivities:c}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivities)},onSuccess:a=>{const i=e.getQueryData(t),c=i==null?void 0:i.map(u=>((u==null?void 0:u.id)===(a==null?void 0:a.activity_id)&&(u.latest_reactions.like?u.latest_reactions.like.push(a):u.latest_reactions.like=[a]),u));return e.setQueryData(t,()=>c&&[...c]),{previousActivities:i}},onSettled:(a,i,c)=>{e.invalidateQueries({queryKey:[...t,c.activityId]})}}),Br=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:i})=>{await e.cancelQueries({queryKey:t});const c=e.getQueryData(t),u=c==null?void 0:c.map(f=>{var p;return(f==null?void 0:f.id)===i&&(p=f.reaction_counts)!=null&&p.like&&(f.reaction_counts.like-=1),f});return e.setQueryData(t,()=>u&&[...u]),{previousActivities:u}},onError:(i,c,u)=>{e.setQueryData(t,u.previousActivities)},onSuccess:(i,{activityId:c})=>{const u=e.getQueryData(t),f=u==null?void 0:u.map(p=>{var g,x,b,_;if(p.id===c){const E=(b=(x=(g=p.latest_reactions)==null?void 0:g.like)==null?void 0:x.find(v=>v.user_id===(n==null?void 0:n.id)))==null?void 0:b.id;return p.latest_reactions.like=(_=p.latest_reactions.like)==null?void 0:_.filter(v=>v.id!==E),p}else return p});return e.setQueryData(t,()=>f&&[...f]),{previousActivities:u}},onSettled:(i,c,u)=>{e.invalidateQueries({queryKey:[...t,u.activityId]})}}),Or=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:o,edit:l,like:m,unlike:a,join:i,leave:c}})=>{const u=M.useIntl(),f=J.useQueryClient(),p=h.useContext(ve),{data:g,error:x,isLoading:b,isFetching:_}=J.useQuery({queryKey:[e,t],queryFn:r}),E=Dr({queryClient:f,queryKey:[e,t],user:p,mutationFn:o}),{mutate:v}=J.useMutation(E),$=Ir({queryClient:f,queryKey:[e,t],mutationFn:async y=>await l(y)}),{mutate:C}=J.useMutation($),A=Lr({queryClient:f,queryKey:[e,t],mutationFn:m}),{mutate:H}=J.useMutation(A),W=Br({queryClient:f,queryKey:[e,t],user:p,mutationFn:async({activityId:y})=>{var I,U,V;const z=g&&(g==null?void 0:g.find(X=>X.id===y)),L=(V=(U=(I=z==null?void 0:z.latest_reactions)==null?void 0:I.like)==null?void 0:U.find(X=>X.user_id===(p==null?void 0:p.id)))==null?void 0:V.id;await a({reactionId:L||"",activityId:y})}}),{mutate:k}=J.useMutation(W),P=h.useCallback(({activityId:y})=>H({activityId:y}),[H]),q=h.useCallback(({activityId:y})=>k({activityId:y}),[k]);return x?s.jsx(De,{variant:"error",text:x.message}):b?s.jsx(fe,{style:{height:"400px"}}):s.jsxs(s.Fragment,{children:[s.jsx(Rt,{contentType:"post",createPost:v,membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:c,notMemberStateText:u.formatMessage({id:"community_joinToPost"})}}),!_&&Array.isArray(g)&&(g==null?void 0:g.map(y=>{var I,U,V,X,oe,ae,ne,R,Z,se,ie,K;const z=((I=y==null?void 0:y.actor)==null?void 0:I.id)===(p==null?void 0:p.id),L=Lt(n,z);return s.jsx(et,{content:{type:"post",body:y==null?void 0:y.content,canLike:L,createdAt:(y==null?void 0:y.time)||"",slugs:{parentId:t,activityId:y==null?void 0:y.id},slug:y==null?void 0:y.id,author:{id:(U=y==null?void 0:y.actor)==null?void 0:U.id,name:`${(X=(V=y==null?void 0:y.actor)==null?void 0:V.data)==null?void 0:X.name}`,organization:(ae=(oe=y==null?void 0:y.actor)==null?void 0:oe.data)==null?void 0:ae.organization,jobTitle:(R=(ne=y==null?void 0:y.actor)==null?void 0:ne.data)==null?void 0:R.jobTitle,image:{thumbnail:((se=(Z=y==null?void 0:y.actor)==null?void 0:Z.data)==null?void 0:se.thumbnail)||void 0}},userLiked:((ie=y==null?void 0:y.own_reactions)==null?void 0:ie.like)&&((K=y==null?void 0:y.own_reactions)==null?void 0:K.like.length)>0,likes:(y==null?void 0:y.reaction_counts.like)||0,comments:(y==null?void 0:y.reaction_counts.reply)||0},links:{post:`${e}/${t}/${y==null?void 0:y.id}`,comments:`${e}/${t}/${y==null?void 0:y.id}`},functions:{content:{createContent:()=>null,deleteContent:()=>null,updateContent:(le,ue)=>C({activityInfo:le,content:ue})},likes:{createLike:()=>{P({activityId:y==null?void 0:y.id})},deleteLike:()=>{q({activityId:y==null?void 0:y.id})}},comments:{openComments:()=>null}}},y==null?void 0:y.id)}))]})},Hr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:a=>{var c;const i=e.getQueryData(t);if(i)return(c=i==null?void 0:i.latest_reactions)!=null&&c.reply?(i.latest_reactions.reply.unshift(a),i&&(i.reaction_counts={reply:i.latest_reactions.reply.length})):(i.latest_reactions={reply:[a]},i.reaction_counts={reply:1}),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Qr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:l,content:{body:m}})=>{var c,u,f;if(m.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((c=a==null?void 0:a.latest_reactions)!=null&&c.reply))return;const i=(f=(u=a==null?void 0:a.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(p=>(p.id===l.replySlug&&(p.data.content=m),p));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:i}})),{previousActivity:a}},onError:(l,m,a)=>{e.setQueryData(t,a.previousActivity)}}),Ur=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:m})=>{var c,u;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),i=(u=(c=a==null?void 0:a.latest_reactions)==null?void 0:c.reply)==null?void 0:u.map(f=>{var p;return f.id===m&&((p=f.children_counts)!=null&&p.like?f.children_counts.like+=1:f.children_counts={like:1}),f});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:i}})),{previousActivity:a}},onError:(m,a,i)=>{e.setQueryData(t,i.previousActivity)},onSuccess:m=>{var c;const a=e.getQueryData(t),i=(c=a==null?void 0:a.latest_reactions.reply)==null?void 0:c.map(u=>(u.id===m.id&&(u.latest_children.like?u.latest_children.like.push(m):u.latest_children.like=[m]),u));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:i}})),{previousActivity:a}}}),Wr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var u;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);if(!i)return;const c=(u=i.latest_reactions.reply)==null?void 0:u.map(f=>(f.id===a&&f.children_counts.like&&(f.children_counts.like-=1),f));return e.setQueryData(t,()=>({...i,latest_reactions:{reply:c}})),{previousActivity:i}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:(a,{replyId:i})=>{var f;const c=e.getQueryData(t);if(!c)return;const u=(f=c.latest_reactions.reply)==null?void 0:f.map(p=>{var g;return p.id===i?(g=p.latest_children.reply)==null?void 0:g.filter(b=>b.user_id!==(n==null?void 0:n.id)):p});return e.setQueryData(t,()=>({...c,latest_reactions:{reply:u}})),{previousActivity:c}}}),Wn=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:o,functions:{createReply:l,editReply:m,like:a,unlike:i,join:c,leave:u}})=>{const f=M.useIntl(),p=J.useQueryClient(),g=h.useContext(ve),x=Hr({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:b}=J.useMutation(x),_=Qr({queryClient:p,queryKey:[e,t,n],mutationFn:async k=>m(k)}),{mutate:E}=J.useMutation(_),v=Ur({queryClient:p,queryKey:[e,t,n],mutationFn:a}),{mutate:$}=J.useMutation(v),C=Wr({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:i}),{mutate:A}=J.useMutation(C),H=h.useCallback(({replyId:k})=>$({replyId:k}),[$]),W=h.useCallback(({replyId:k})=>A({replyId:k}),[A]);return s.jsxs(s.Fragment,{children:[s.jsx(Rt,{contentType:"post",createPost:b,membershipRequiredToPost:{isMember:o,required:!0,join:c,leave:u,notMemberStateText:f.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(k=>{var z,L,I,U,V,X,oe,ae,ne,R,Z,se,ie,K,le,ue,de;const P=((z=k==null?void 0:k.latest_children)==null?void 0:z.like)&&((L=k==null?void 0:k.latest_children)==null?void 0:L.like.filter(pe=>pe.user_id===(g==null?void 0:g.id))),q=((I=k==null?void 0:k.user)==null?void 0:I.id)===(g==null?void 0:g.id),y=Lt(o,q);return s.jsx(et,{content:{type:"post",body:typeof k.data.content=="string"?(U=k==null?void 0:k.data)==null?void 0:U.content:((X=(V=k==null?void 0:k.data)==null?void 0:V.content)==null?void 0:X.text)||"",canLike:y,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}/${n}`,parentId:t,reply:k==null?void 0:k.id},slug:`${e}/${t}/${n}#${k==null?void 0:k.id}`,author:{id:(oe=k==null?void 0:k.user)==null?void 0:oe.id,name:(ne=(ae=k==null?void 0:k.user)==null?void 0:ae.data)==null?void 0:ne.name,organization:(Z=(R=k==null?void 0:k.user)==null?void 0:R.data)==null?void 0:Z.organization,jobTitle:(ie=(se=k==null?void 0:k.user)==null?void 0:se.data)==null?void 0:ie.jobTitle,image:{thumbnail:((le=(K=k==null?void 0:k.user)==null?void 0:K.data)==null?void 0:le.thumbnail)||void 0}},userLiked:!!(P!=null&&P.length),likes:((ue=k==null?void 0:k.children_counts)==null?void 0:ue.like)||0,comments:((de=k==null?void 0:k.children_counts)==null?void 0:de.reply)||0},functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(pe,we)=>E({replyInfo:pe,content:we})},likes:{createLike:()=>H({replyId:k==null?void 0:k.id}),deleteLike:()=>W({replyId:k==null?void 0:k.id})},comments:{openComments:()=>{}}}},k==null?void 0:k.id)}))]})},zr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:m,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return i&&i.id===(m==null?void 0:m.activityId)&&(i.content=a),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onError:(m,a,i)=>{e.setQueryData(t,i.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Vr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var i;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(i=a==null?void 0:a.reaction_counts)!=null&&i.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:a=>{const i=e.getQueryData(t);return i!=null&&i.latest_reactions.like?i.latest_reactions.like.push(a):i&&(i.latest_reactions={like:[a]}),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Yr=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:o})=>({mutationFn:o,onMutate:async()=>{var u;await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);return(u=c==null?void 0:c.reaction_counts)!=null&&u.like&&c.reaction_counts.like>0&&(c.reaction_counts.like-=1),e.setQueryData(t,()=>({...c})),{previousActivity:c}},onError:(c,u,f)=>{e.setQueryData(t,f.previousActivity)},onSuccess:()=>{var f,p,g;if(!r)return;const c=(g=(p=(f=r.latest_reactions)==null?void 0:f.like)==null?void 0:p.find(x=>x.user_id===(n==null?void 0:n.id)))==null?void 0:g.id,u=e.getQueryData(t);if(u!=null&&u.latest_reactions.like)return u.latest_reactions.like=u.latest_reactions.like.filter(x=>x.id!==c),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Gr=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:o,editActivity:l,likeActivity:m,unlikeActivity:a,createReply:i,editReply:c,likeReply:u,unlikeReply:f,join:p,leave:g}})=>{var I,U,V,X,oe,ae,ne,R,Z,se,ie;const x=h.useContext(ve),b=J.useQueryClient(),{data:_,error:E,isLoading:v,isFetching:$}=J.useQuery({queryKey:[e,t,n],queryFn:o}),C=zr({queryClient:b,queryKey:[e,t,n],mutationFn:async K=>await l(K)}),{mutate:A}=J.useMutation(C),H=Vr({queryClient:b,queryKey:[e,t,n],mutationFn:m}),{mutate:W}=J.useMutation(H),k=Yr({queryClient:b,queryKey:[e,t,n],user:x,mutationFn:async()=>{var le,ue,de;const K=(de=(ue=(le=_==null?void 0:_.latest_reactions)==null?void 0:le.like)==null?void 0:ue.find(pe=>pe.user_id===(x==null?void 0:x.id)))==null?void 0:de.id;await a({activityId:n,reactionId:K})},activity:_}),{mutate:P}=J.useMutation(k),q=h.useCallback(({activityId:K})=>W({activityId:K}),[W]),y=h.useCallback(async({activityId:K})=>P({activityId:K}),[P]);if(E)return s.jsx(De,{variant:"error",text:E.message});if(v||$)return s.jsx(fe,{style:{height:"400px"}});const z=((I=_==null?void 0:_.actor)==null?void 0:I.id)===(x==null?void 0:x.id),L=Lt(r,z);return s.jsx(et,{content:{type:"post",body:_==null?void 0:_.content,canLike:L,createdAt:(_==null?void 0:_.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:_==null?void 0:_.id},slug:n,author:{id:(U=_==null?void 0:_.actor)==null?void 0:U.id,name:(V=_==null?void 0:_.actor)==null?void 0:V.data.name,organization:(X=_==null?void 0:_.actor)==null?void 0:X.data.organization,jobTitle:(oe=_==null?void 0:_.actor)==null?void 0:oe.data.jobTitle,image:{thumbnail:((ae=_==null?void 0:_.actor)==null?void 0:ae.data.thumbnail)||void 0}},userLiked:((ne=_==null?void 0:_.own_reactions)==null?void 0:ne.like)&&((R=_==null?void 0:_.own_reactions)==null?void 0:R.like.length)>0,likes:_&&(_==null?void 0:_.reaction_counts.like),comments:_&&(_==null?void 0:_.reaction_counts.reply)},originalAuthorId:(Z=_==null?void 0:_.actor)==null?void 0:Z.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(K,le)=>A({activityInfo:K,content:le})},likes:{createLike:()=>q({activityId:n}),deleteLike:()=>y({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((se=_==null?void 0:_.reaction_counts)==null?void 0:se.reply)||0,")"]}),s.jsx(Wn,{basePath:e,parentId:t,activityId:n,repliesList:(ie=_==null?void 0:_.latest_reactions)==null?void 0:ie.reply,isMember:r,functions:{createReply:i,like:u,unlike:f,editReply:c,join:p,leave:g}})]})},n)},Jr=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:o}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:o}});exports.ASSETS_BUCKET=Ye;exports.ActivitiesFeed=Or;exports.ActivitySection=Gr;exports.AddPost=Rt;exports.BannerSection=zs;exports.Breadcrumbs=dr;exports.Button=Q;exports.ButtonWrapper=Pe;exports.CacheProvider=Mn;exports.CollapsibleSection=$t;exports.Columns=gr;exports.CommunityDetails=ur;exports.Contributors=$n;exports.ConversationContext=Dt;exports.CookieBanner=Rn;exports.DiscussionConversation=Mr;exports.DiscussionForm=Pt;exports.DiscussionLikes=Hn;exports.DiscussionPost=et;exports.DiscussionThread=Pr;exports.Divider=Ee;exports.DownloadSection=Hs;exports.EMAILS=je;exports.EmailHelperTextBox=_r;exports.EmptyStateBox=De;exports.Filters=mr;exports.FlagsProvider=Cn;exports.Footer=Nt;exports.FullWidthSection=Tt;exports.GlobalProviders=cr;exports.Header=Ft;exports.HelperTextBox=wn;exports.HiddenFromScreenReaders=St;exports.HideShowTextBox=Gs;exports.HighlightedTextBox=xe;exports.IntlProvider=An;exports.InviteForm=On;exports.InviteModal=Nr;exports.JoinButton=Ct;exports.LanguageSwitcher=pr;exports.Link=Re;exports.LoadMore=Fn;exports.LoadingBlock=rr;exports.LoadingPlaceholder=fe;exports.LoadingState=En;exports.Logo=At;exports.LogoSection=Qs;exports.MarkdownText=kt;exports.MarketingBox=Vs;exports.Member=Ke;exports.MembersList=Tr;exports.Modal=Qn;exports.MoreMenu=Pn;exports.NUMBER_OF_USERS=Ys;exports.Overlay=It;exports.PageLayout=jr;exports.PasswordRules=br;exports.Pill=yn;exports.ProfilePicture=Ze;exports.ProgressBar=jn;exports.Rating=wr;exports.RepliesFeed=Wn;exports.ResponsesHeading=Fr;exports.ResponsiveImage=xn;exports.SearchForm=Bn;exports.Span=kn;exports.StatusBanner=Ge;exports.Tags=Er;exports.Tooltip=vn;exports.UserContext=ve;exports.UserProvider=Nn;exports.VisuallyHidden=ee;exports.addAriaProps=Un;exports.getMember=Mt;exports.headerData=Ne;exports.mapGetStreamData=Jr;exports.useCurrentPath=mn;exports.useEffectAfterMount=be;exports.useScreenWidth=Fe;exports.useScrollListener=pn;exports.useScrollToHash=$s;
|
|
37
|
+
`))},[r]),h.useEffect(()=>{c==="ready-to-close"&&u("closing")},[c]);const f=({propertyName:g})=>{g==="max-height"&&u(x=>x==="opening"?"open":x==="closing"?"closed":x)};if(!r)return null;const p=["opening","open"].includes(c);return s.jsxs(xe,{variant:"subtle",className:S("hide-show-text-box",e),children:[s.jsxs("div",{ref:d,className:S("content",c),children:[s.jsx(Ze,{options:{forceBlock:!0},children:c==="closed"?a:r}),c!=="closed"&&o]}),s.jsx("p",{className:"cta",children:s.jsx(Q,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:S({"rotate-180":p}),onClick:()=>{u(p?"ready-to-close":"opening")},children:p?n||l.formatMessage({id:"hideShowTextBox_hide"}):t||l.formatMessage({id:"hideShowTextBox_show"})})})]})},Js=()=>h.Fragment,qs=({children:e})=>s.jsx(xe,{variant:"secondary",children:e}),Xs=["span","strong","h1","h2","h3","h4","h5","h6","p"],Zs=({children:e})=>{const t=M.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const l of h.Children.toArray(e))if(!(!l||typeof l=="string"||typeof l=="number"))if(h.isValidElement(l)&&l.type==="summary"){if(l.props&&l.props.children){for(const d of h.Children.toArray(l.props.children))if(!(!d||typeof d=="string"||typeof d=="number")&&h.isValidElement(d)){const a=d.type;if(Xs.includes(a)){for(n=d.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(l);const o=n?n.toString():"";return s.jsx($t,{label:o,className:["Sources","Resources"].includes(o)?"discrete-links":"",children:r.map(l=>l)})},Ks=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return s.jsx(xe,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return s.jsx(xe,{variant:"primary",children:e});case"pink-textbox":return s.jsx(xe,{variant:"tertiary",children:e});default:return s.jsx("div",{...t,children:e})}return s.jsx("div",{...t,children:e})},er=e=>{const t=M.useIntl(),n=Date.now().toString();let r="default";const o=e.src;return o.includes("youtube")||o.includes("vimeo")?r="video":o.includes("riddle")||o.includes("sli.do")?r="poll":o.includes("padlet")&&(r="padlet"),s.jsxs(s.Fragment,{children:[s.jsx(K,{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})]})},nn=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},tr=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,o=!1;for(const l of h.Children.toArray(e))if(!(!l||typeof l=="string"||typeof l=="number")&&h.isValidElement(l)){const d=l.type;if(["button","center","span","strong"].includes(d)&&l.props&&l.props.children&&l.props.children[0])for((d==="button"||nn(l.props.children[0])==="button")&&(o=!0),r=l.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!h.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&nn(r)==="button"&&(o=!0);else break}return o?(n={...n,className:"button primary medium"},s.jsx("p",{className:"center",children:s.jsx(Q,{variant:"primary",size:"medium",...n,children:r})})):s.jsx("a",{...n,children:r})},kn=({children:e})=>s.jsx("span",{children:e});const yt=({className:e="",options:t={},children:n})=>{n=n.replace(/^<br\/?>/,"");const r={wrapper:h.Fragment,forceBlock:!0,overrides:{a:tr,CollapsibleSection:$t,TextBox:xe,CaseStudy:qs,style:Js,details:Zs,div:Ks,iframe:er}};return s.jsx("div",{className:S("markdown-text",e),children:s.jsx(Ze,{options:{...r,...t},children:n})})};const yn=({size:e="medium",variant:t="default",className:n="",children:r})=>s.jsx("span",{className:S("pill",e,t,n),children:r});const Ge=({element:e="p",children:t=null,className:n="",...r})=>h.createElement(e,{...r,className:S("status-banner text-small",n),"aria-live":"assertive"},t);const nr=({progress:e=0,text:t=!1,className:n=""})=>{const r=M.useIntl(),o=e>75?100:e>50?75:e>25?50:e>5?25:0,l={"--progress":`${e}%`};return s.jsx("span",{className:S(`progress-bar section-${o}`,n),style:l,children:s.jsx(K,{children:t?`${e} ${t}`:r.formatMessage({id:"progressBar"},{number:e})})})},jn=h.memo(nr);const ct="loadingBlock_",sr=({progress:e=0,steps:t=!1,className:n=""})=>{const r=M.useIntl();t||(t={0:{text:r.formatMessage({id:`${ct}loading`})},75:{text:r.formatMessage({id:`${ct}almostDone`})},100:{text:r.formatMessage({id:`${ct}complete`})}});let o=null;const l=Object.keys(t);for(let a=0;a<l.length&&!(e<parseInt(l[a]));a++)o=l[a];const d=o&&t[o].icon?{"--icon":`url(${Ye}icons/${t[o].icon}.svg)`}:{};return s.jsxs(xe,{className:S("loading-block",n,{"has-icon":o&&t[o].icon}),variant:"subtle",style:d,children:[o&&s.jsx("span",{className:"step",children:t[o].text}),s.jsx(jn,{progress:e})]})},rr=h.memo(sr);const fe=({element:e="div",className:t="",...n})=>s.jsx(St,{element:e,className:S("loading-placeholder",t),...n});const jt={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],cards:["card","card","card","card"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"]},Sn=(e,t)=>e in jt?s.jsx("div",{className:e,children:jt[e].map((n,r)=>Sn(n,r))},t):s.jsx(fe,{className:e},t),En=({layout:e="overview-page"})=>s.jsx("div",{className:S("loading-state",e),children:jt[e].map((t,n)=>Sn(t,n))}),Tn=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):""},Oe=["#5AB6A3","#A2D7AF","#806056","#3962B3"],or=e=>{const t=Math.ceil(26/Oe.length),n=Tn(e).toLowerCase();if(n==="")return Oe[0];const r=n.charCodeAt(0)-96;for(let o=0;o<Oe.length;o++)if(r<=t*(o+1))return Oe[o]};const sn=256,Ke=({className:e="",src:t="",name:n,alt:r,width:o=sn,height:l=sn,...d})=>{const[a,i]=h.useState(!1),c=h.useRef(null);h.useEffect(()=>{const f=c.current;if(!f)return;const p=f.getContext("2d");if(!p)return;const g=o,x=l;typeof window<"u"&&window.devicePixelRatio&&(f.width=g*window.devicePixelRatio,f.height=x*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=or(n),p.fillRect(0,0,g,x),p.font=`${g/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(Tn(n),g/2,x/1.6)},[n]);let u=!1;return t&&t!==""&&!a&&(t.includes("http")||t.includes("//"))&&(u=!0),s.jsx("figure",{className:S("profile-picture",e,{error:a}),...d,children:u?s.jsx("img",{src:t,alt:r||n,onError:()=>{i(!0)},width:o,height:l}):s.jsx("canvas",{ref:c})})},Mt=e=>e==="apolitical"?{image:`${Ye}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ye}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},ar=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const o=e!=="",l=t!=="",d=n!=="";if(!o&&!l&&!d)return"";const a=`${e}${o&&l?` — ${t}`:t}`;let i=`${a}${(o||l)&&d?`, ${n}`:n}`;return i.length>r&&(i=a),i.length>r&&(i=Xe(i,r)),i};const et=({element:e="div",member:t="community",additionalContent:n=!1,gtmContext:r="member",gtmType:o="member-click",className:l=""})=>{const d=M.useIntl(),a=Mt(t);a.name||(a.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:i,url:c,image:u}=a,f=ar(a),p=n&&n.createdAt?As(n.createdAt):!1,g=n&&n.createdAt?Cs(n.createdAt):"";return h.createElement(e,{className:S("member text-medium",l),children:s.jsxs(Re,{href:c,gtmType:o,gtmContext:r,onClick:x=>{x==null||x.stopPropagation()},children:[s.jsx(Ke,{name:i,src:u}),s.jsxs("p",{className:"details",children:[s.jsx("strong",{children:i}),n&&s.jsxs("span",{className:"additional-content",children:[n.createdAt&&p&&s.jsx("span",{className:"date",title:g,"aria-label":g,children:d.formatMessage({id:`dates_${p.path}`},{number:p.number})}),n.didEdit&&s.jsx("em",{children:d.formatMessage({id:"discussion_edited"})})]}),f&&s.jsx("small",{children:f})]})]})})};const rn={small:24,medium:48},$n=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:o,showGap:l,showPlaceholders:d}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:a=2,className:i=""})=>{const c=M.useIntl();return!n||n.length===0?null:h.createElement(e,{className:S("contributors",i,o,{"has-gap":l}),children:s.jsxs(s.Fragment,{children:[s.jsx("ul",{children:n.map((u,f)=>{let p,g="";if(f<a){const{name:x="",image:y=""}=Mt(u);if(d)return s.jsx(fe,{element:"li",className:"contributor"},f);p=s.jsx(Ke,{name:x,src:y,width:rn[o||"medium"],height:rn[o||"medium"]})}else if(f===a){const x=(t||n.length)-a;p=s.jsxs("small",{className:S({"large-number":x>99}),children:["+",Is(x,0)]}),g="number-left"}return p?s.jsx("li",{className:S("contributor",g),children:p},f):null})}),r&&s.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?c.formatMessage({id:`member_${n[0]}`}):Xe(n[0].name||"",20):null})]})})},Mn=({showDevTools:e=!0,children:t})=>{const n=new Z.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return s.jsxs(Z.QueryClientProvider,{client:n,children:[t,e&&s.jsx(gs.ReactQueryDevtools,{initialIsOpen:!1})]})};var ir=h.createContext({client:Ve});function lr(e){var t=e.children,n=e.client,r=e.apiKey,o=e.options,l=h.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&&o&&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&&(Ve.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Ve.init(r,o)),Ve)},[n,r]);return h.createElement(ir.Provider,{value:{client:l}},t)}const Cn=({children:e,user:t})=>t.isLoading?s.jsx(s.Fragment,{}):process.env.REACT_APP_PUBLIC_POSTHOG_KEY?s.jsx(lr,{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,An=({children:e,locale:t,messages:n})=>{const r=t||"en",o={...Ds[r],...n||{}};return s.jsx(M.IntlProvider,{locale:r,messages:o,children:e})},ve=h.createContext(null),Nn=({children:e,user:t})=>s.jsx(ve.Provider,{value:t,children:e}),cr=({bootstrap:e,children:t,intl:n})=>{const[r,o]=h.useState({isLoading:!0});return h.useEffect(()=>{e().then(l=>o({...l,isLoading:!1})).catch(()=>o({isLoading:!1}))},[]),s.jsx(An,{locale:n==null?void 0:n.locale,messages:n==null?void 0:n.messages,children:s.jsx(Nn,{user:r,children:s.jsx(Mn,{children:s.jsx(Cn,{user:r,children:t})})})})};const ut="joinCommunityButton",Ct=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const o=M.useIntl(),l=h.useContext(ve),d=l&&typeof l.id=="string",[a,i]=h.useState(e),[c,u]=h.useState(e?"joined":"notJoined");h.useEffect(()=>{c==="joining"?u("joined"):c==="leaving"&&u("notJoined")},[a]);const f={},p={};return a&&c!=="leaving"&&(f["data-hover-text"]=o.formatMessage({id:`${ut}_leave`}),f["aria-label"]=o.formatMessage({id:`${ut}_member_aria`}),p["aria-hidden"]="true"),s.jsx(Q,{variant:a?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:a&&c!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async g=>{d&&(g.currentTarget.blur(),a?(u("leaving"),typeof r=="function"&&await r()):(u("joining"),typeof n=="function"&&await n()),i(!a))},className:S("join-community-button",c,{active:c==="joining"}),disabled:!d,...f,children:s.jsx("span",{className:"text",...p,children:o.formatMessage({id:`${ut}${["joining","leaving"].includes(c)?`_${c}`:a?"_member":t?"_short":""}`})})})};const dt="communityDetails_",ur=({isMember:e=!1,slug:t,members:{number:n,data:r}={number:void 0,data:[]},className:o="",...l})=>{const d=M.useIntl(),a=n||(r==null?void 0:r.length)||0;return s.jsxs("div",{className:S("community-details",o),children:[s.jsx(we,{}),s.jsxs("div",{className:"member-details",children:[s.jsxs("div",{className:"top",children:[s.jsxs("h3",{children:[d.formatMessage({id:`${dt}members`}),s.jsx("span",{className:"count",children:a})]}),s.jsx("p",{className:"text-small",children:s.jsx("a",{href:`/communities/${t}/members`,children:d.formatMessage({id:`${dt}viewAll`})})})]}),s.jsx($n,{contributors:{total:n,data:r!=null&&r.length?r:[{},{},{},{},{}]},styling:{size:"medium",showGap:!0,showPlaceholders:a===0},cutoff:5})]}),s.jsx(Ct,{isMember:e,...l}),e&&s.jsx(Q,{variant:"primary",icon:{icon:"plus"},styling:{fullWidth:!0},children:d.formatMessage({id:`${dt}invite`})})]})};const dr=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(K,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),s.jsx("ul",{className:S("breadcrumbs text-small",n),children:e.map(({text:o,href:l,current:d=!1},a)=>s.jsxs("li",{children:[d&&s.jsx(K,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),s.jsx(Re,{href:d?void 0:l,children:Xe(o,t)})]},`${window.btoa(o)}_${a}`))})]})};const mr=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:o=""})=>{const l=M.useIntl(),d=t?[{id:"all",text:typeof t!="boolean"&&t.text||l.formatMessage({id:"filters_all"})},...e]:e,[a,i]=h.useState(t?["all"]:[]),c=(u,f)=>{let p=[];a.includes(u)?p=a.filter(g=>g!==u):u==="all"?p=["all"]:n?p=[...a.filter(g=>g!=="all"),u]:p=[u],i(g=>(r&&typeof r=="function"&&r({current:p,previous:g}),p)),f&&typeof f=="function"&&f()};return s.jsx("ul",{className:S("filters",o),children:d.map(({id:u,text:f,disabled:p=!1,callback:g=()=>{}})=>{let x={};return p&&(x={disabled:!0,"aria-label":l.formatMessage({id:"filters_disabled"},{name:f})}),s.jsx("li",{children:s.jsx("button",{className:S(u,{selected:a.includes(u)}),onClick:y=>{y.preventDefault(),y.stopPropagation(),c(u,g)},...x,children:f})},u)})})},fr=(e,t)=>{const n=String(e);if(!t||!t.length)return`/${n}`;let r="";return t.forEach(({url:o,position:l})=>{l==="before-lang"?r+=`/${o}`:(r.includes(`/${n}/`)||(r+=`/${n}`),r+=`/${o}`)}),r.includes(`/${n}/`)||(r+=`/${n}`),r};const mt={en:"English",es:"Español",fr:"Français",pt:"Português"},He="languageSwitcher_",pr=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:o=()=>{},urlParts:l,variant:d="default",label:a,className:i=""})=>{const c=M.useIntl(),[u,f]=h.useState(e);if(h.useEffect(()=>{e!==u&&f(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),x=u!==e;return s.jsxs("div",{className:S("language-switcher text-small",d,i),children:[s.jsxs("nav",{children:[d!=="short"&&s.jsx("p",{children:a||c.formatMessage({id:`${He}label`})}),s.jsx("ul",{children:g.map(y=>{if(!mt[y])return null;let _={className:y};return u===y?_["aria-label"]=c.formatMessage({id:`${He}selected`},{language:mt[y]}):_={..._,href:fr(y,l),onClick:E=>{E.preventDefault(),E.stopPropagation(),f(y),o(y)}},s.jsx("li",{children:s.jsx(Re,{..._,fallbackElement:"span",children:mt[y]})},y)})}),d!=="short"&&!x&&s.jsx("p",{children:c.formatMessage({id:`${He}translation_${t?"original":n?"human":"machine"}`})})]}),d!=="short"&&!x&&!t&&!n&&s.jsx("small",{children:c.formatMessage({id:`${He}disclaimer`},{email:Se.support,link:y=>{const _=`mailto:${y}`;return s.jsx("a",{href:_,children:y})}})})]})};const ft=M.createIntl({locale:"en",messages:Et}),Fn=({page:e=1,length:t=0,limit:n=10,loadNextPage:r=()=>{},icon:o=!1,messages:l={button:ft.formatMessage({id:"loadMore_button"}),endOfFeed:ft.formatMessage({id:"loadMore_endOfFeed"}),error:ft.formatMessage({id:"loadMore_error"})},className:d="",gtmContext:a="LoadMore"})=>{const[i,c]=h.useState(!1),[u,f]=h.useState(!1);if(t<=0||t<n*e)return null;const p=async g=>{try{await r(g)}catch(x){x instanceof Error&&x.message&&x.message.includes("Cannot read items")?f(!0):c(!0)}};return s.jsxs("footer",{className:S("load-more",d),children:[i&&s.jsx("p",{className:"error",children:l.error}),u?s.jsx("p",{children:l.endOfFeed}):s.jsx(Q,{variant:"secondary",icon:o,onClick:p,"data-gtm-event-context":a,"data-gtm-event-type":"load-more-click",className:"gtm-trackable","data-testid":"load-more-button",children:l.button})]})};let Qe=!1;const Pn=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const o=M.useIntl(),l=h.useRef(null),[d,a]=h.useState(!1),i=c=>{l.current&&c.target instanceof HTMLElement&&!l.current.contains(c.target)&&a(!1)};return h.useEffect(()=>(document.addEventListener("click",i,!0),()=>{document.removeEventListener("click",i,!0)})),h.createElement(e,{ref:l,className:S("more-menu text-medium",r),children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>a(!d),"aria-haspopup":"true","aria-expanded":d,"aria-controls":t,screenreaderText:o.formatMessage({id:"moreMenu"})}),s.jsx("ul",{id:t,hidden:!d,children:n.map(({href:c,onClick:u,text:f,icon:p,...g},x)=>{const y={...g,onClick:_=>{a(!1),typeof u=="function"&&u(_)},onFocus:()=>{Qe&&(clearTimeout(Qe),Qe=!1)},onBlur:()=>{Qe=setTimeout(()=>{a(!1)},100)}};return c&&(y.href=c),s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...y,children:f})},`${window.btoa(f)}_${x}`)})})]})})};const At=({variant:e="default",version:t="default",className:n="",...r})=>s.jsx("p",{className:"logo-wrapper",children:s.jsx("a",{href:"/home/",className:S("logo",e,t,n),...r,children:s.jsx(K,{children:s.jsx(M.FormattedMessage,{id:"apolitical"})})})});const hr={"2-1":901},gr=({layout:e="2-1",hideOnMobile:t=!1,className:n="",children:r})=>{const o=Fe(!0);let l=r;return h.Children.count(r)===1&&(l=h.Children.toArray(r)[0],l.props&&(l=l.props.children)),s.jsx("section",{className:S("columns",`layout-${e}`,n),children:h.Children.map(l,(d,a)=>t!==!1&&a===t&&o&&o<hr[e]?null:d)})};const pt="cookieBanner_",ht=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],gt=new Date(Date.now()+12*30*24*60*60*1e3),Rn=()=>{const e=M.useIntl(),[t,n,r]=cn.useCookies(ht),[o,l]=h.useState(!t["apol-cookie-banner"]),d=()=>{ht.forEach(u=>{n(u,!0,{path:"/",expires:gt,domain:u==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),l(!1),window.location.reload()},a=()=>{n("apol-cookie-banner",!0,{path:"/",expires:gt}),ht.forEach(u=>{if(u==="apol-cookie-banner"){n(u,!0,{path:"/",expires:gt});return}r(u)}),l(!1)};if(!o)return null;const i=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:a,gtmType:"reject-all"},{id:"accept",onClick:d,gtmType:"accepted-all"}],c=[];return i.forEach(u=>{c.push({variant:u.href?"tertiary":"primary",href:u.href,onClick:u.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${u.gtmType}-click`,children:e.formatMessage({id:`${pt}buttons_${u.id}`})})}),s.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[s.jsx("h6",{children:e.formatMessage({id:`${pt}title`})}),s.jsx("p",{children:e.formatMessage({id:`${pt}text`})}),s.jsx(Pe,{buttons:c})]})},_e={platform:{order:["events","courses","qanda","articles"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},qanda:{href:"/questions-answers/",gtmType:"q-and-a-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["story","team","careers","partner","contact"],story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Se["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Se["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:Se.support,gtmType:"concierge-email-click"},business:{email:Se.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 Ee="footer_",Je="SiteFooter",on=({group:e})=>{const t=_e[e].order||[];let n=!1;return"text"in _e[e]&&(n=_e[e].text),s.jsxs(h.Fragment,{children:[s.jsx("p",{className:"pre-title",children:s.jsx(M.FormattedMessage,{id:`${Ee}${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:o,gtmType:l}=_e[e][r],d={};return["legal"].includes(e)&&(d.target="_blank",d.rel="noopener"),s.jsx("li",{children:s.jsx("a",{href:o,className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":l,...d,children:s.jsx(M.FormattedMessage,{id:`${Ee}${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(h.Fragment,{children:[s.jsx("dt",{children:s.jsx(M.FormattedMessage,{id:`${Ee}${e}_${r}`})}),s.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&s.jsx("address",{children:s.jsx(M.FormattedMessage,{id:`${Ee}${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":Je,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Nt=()=>s.jsx("div",{id:"footer",children:s.jsxs("div",{className:"wrapper",children:[s.jsx(St,{element:"hr"}),s.jsx(At,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Je,"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(on,{group:e}),Object.keys(_e[e]).includes("child")&&s.jsx(on,{group:_e[e].child})]},e))}),s.jsx("hr",{}),s.jsxs("div",{className:"sub-footer",children:[s.jsx("ul",{children:Array.isArray(_e.social.order)&&_e.social.order.map(e=>{const t=_e.social[e];return s.jsx("li",{className:e,children:s.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Je,"data-gtm-event-type":"social-click",children:s.jsx("span",{className:"hidden",children:s.jsx(M.FormattedMessage,{id:`${Ee}social_${e}`})})})},e)})}),s.jsx("small",{children:s.jsx(M.FormattedMessage,{id:`${Ee}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})});const Ue="emailHelperTextBox_",_r=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const o=M.useIntl(),[l,d]=h.useState({path:`${Ue}default`,type:"default",link:{},mail:{},error:""}),[a,i]=h.useState(!1),c=h.useCallback(g=>{g.preventDefault(),g.stopPropagation();const x=y=>{d({path:`${Ue}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>c(_),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:y})};if(typeof r!="function"){x(o.formatMessage({id:`${Ue}error_noFunction`}));return}i(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(y=>{x(y.message)}).finally(()=>{i(!1)})},[t,n,r]);h.useEffect(()=>{let g=Ue,x="default",y={},_={};switch(e){case"gov":g+="autoApproved",x="success";break;case"nonGov":g+="unrecognisedEmail",x="error",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",x="error",_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",x="error",y={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>c(E),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",x="error",y={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},_={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}d({...l,path:g,type:x,link:y,mail:_})},[e]);const u={};return["link","mail"].forEach(g=>{u[g]=Object.keys(l[g]).length?x=>s.jsx("a",{...l[g],children:x}):x=>x}),s.jsx(wn,{type:l.type,heading:a?!1:o.formatMessage({id:`${l.path}_title`}),children:a?s.jsxs(s.Fragment,{children:[s.jsx(fe,{element:"span"}),s.jsx(fe,{element:"span"})]}):o.formatMessage({id:`${l.path}_text`},{...u,strong:g=>s.jsx("strong",{children:g}),em:g=>s.jsx("em",{children:g}),br:s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{})]}),error:l.error})})};const We="passwordRules_",Dn="isMoreThanEightCharacters",In="includesNumberAndSymbol",Ln="includesLowerAndUppercase",xr={[Dn]:"8Characters",[In]:"numberSymbol",[Ln]:"lowercaseUppercase"},vr=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=M.useIntl();return s.jsxs("aside",{className:S("password-rules",t),children:[s.jsx("small",{children:n.formatMessage({id:`${We}intro`})}),s.jsx("ul",{children:[Dn,In,Ln].map(r=>s.jsxs("li",{className:S({matches:e[r]}),children:[s.jsxs(K,{children:[n.formatMessage({id:`${We}rule_label`})," "]}),s.jsx("span",{children:n.formatMessage({id:`${We}rule_${xr[r]}`})}),!e[r]&&s.jsxs(K,{element:"strong",children:[" "," ",n.formatMessage({id:`${We}notMet`})]})]},`rule-${r}`))})]})},br=h.memo(vr);const wr=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:o=()=>{}},className:l="",hasLoaded:d=!1})=>{const a=M.useIntl(),[i,c]=h.useState({setUp:!1,id:null,rating:null,disabled:!0}),u=async()=>{try{const E=await n();c(w=>({...w,setUp:!0,id:E&&E.id,disabled:!1}))}catch(E){c(w=>({...w,setUp:!0,disabled:!0})),o(E)}};if(h.useEffect(()=>{d&&!i.setUp&&u()},[d]),!d)return s.jsx(fe,{className:"rating-placeholder"});const{id:f,rating:p,disabled:g}=i,x="ratings_",y={text:a.formatMessage({id:`${x}text`}),low:a.formatMessage({id:`${x}low`}),high:a.formatMessage({id:`${x}high`}),success:a.formatMessage({id:`${x}success`}),...e},_=async E=>{if(!(!f||g))try{c(w=>({...w,rating:E,disabled:!0})),await r({id:f,value:E})}catch(w){c(T=>({...T,rating:null})),o(w)}finally{c(w=>({...w,disabled:!1}))}};return s.jsxs("div",{className:S("rating",l),children:[s.jsx("span",{className:"label",children:y[p?"success":"text"]}),s.jsx("ol",{children:Array.from(new Array(t).keys()).map(E=>{const w=E+1;return s.jsx("li",{className:S({selected:p&&w<=p}),children:s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:`star${!p||w>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${a.formatMessage({id:`${x}stars`},{number:w,total:t})}${w===1||w===t?` - ${y[w===1?"low":"high"]}`:""}`,onClick:T=>{T.preventDefault(),T.stopPropagation(),_(w)},disabled:g})},`rating-${w}`)})})]})};const Bn=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:o="search-bar",gtmEvent:l="form-submission"})=>{const{searchIsOpen:d=!0,isDesktopVersion:a=!1}=n||{},i=M.useIntl(),c=h.useRef(null);be(()=>{!n||a||!d||c.current&&c.current.focus()},[d]);const u=f=>{f.preventDefault(),f.stopPropagation(),!(!c.current||!c.current.value||c.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(c.current.value)}`)};return s.jsx("form",{onSubmit:u,className:S("search-form gtm-trackable",t),"data-gtm-event-context":o,"data-gtm-event-type":l,children:s.jsx("fieldset",{id:`${e}-form`,hidden:n?!d:!1,role:"search",children:s.jsxs("p",{children:[s.jsx(K,{element:"label",htmlFor:e,children:i.formatMessage({id:"search_label"})}),s.jsx("input",{ref:c,type:"search",id:e,name:e,defaultValue:r,placeholder:i.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&u(f)}}),s.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),c.current&&c.current.value&&(c.current.value="")},children:s.jsx(K,{children:i.formatMessage({id:"search_clear"})})}),s.jsx("button",{className:"search",onClick:u,children:s.jsx(K,{children:i.formatMessage({id:"search_cta"})})})]})})})};const On=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:o,backgroundColor:l,onClose:d,reportError:a,sendInvites:i,initialFormStatus:c="NOT_SUBMITTED"})=>{const[u,f]=h.useState([]),[p,g]=h.useState(!0),[x,y]=h.useState(c),{formatMessage:_}=M.useIntl(),E=async C=>{C.preventDefault();try{await i(u),f([]),y("SUCCESS")}catch(A){y("ERROR"),a(A)}},w=C=>{C.preventDefault(),y("NOT_SUBMITTED"),g(!0),f([])},T=C=>{C.preventDefault(),d(),y("CLOSED")};return x==="CLOSED"?null:x==="ERROR"||x==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"content centred",children:x==="SUCCESS"?s.jsx("h2",{className:"success-title",children:_({id:"inviteForm_success"})}):s.jsxs("h2",{className:"error-title",children:[" ",_({id:"inviteForm_error"})]})}),s.jsx(we,{}),s.jsx("div",{className:"footer",children:x==="SUCCESS"?s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"secondary",onClick:w,children:_({id:"inviteForm_ctaSendMoreInvites"})}),s.jsx(Q,{onClick:T,children:_({id:"inviteForm_ctaDone"})})]}):s.jsx(Q,{onClick:w,children:_({id:"inviteForm_ctaTryAgain"})})})]}):s.jsxs("form",{style:{backgroundColor:l},onSubmit:E,className:S("invite-form gtm-trackable"),children:[s.jsxs("fieldset",{className:"content",children:[s.jsx("h2",{className:"title",style:{color:r},children:e}),s.jsx("label",{htmlFor:"email-input",className:"label",style:{color:o},children:t}),s.jsx(_s.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:_({id:"inviteForm_email_placeholder"}),emails:u,onChange:C=>{f(C),g(!C.length)},autoFocus:!1,getLabel:(C,A,H)=>s.jsxs("div",{className:"email text-medium",children:[s.jsx("div",{"data-tag-item":!0,children:C}),s.jsx(Q,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{H(A),g(!u.length)},className:"remove-email-button",screenreaderText:_({id:"overlay_close"})})]},A)})]}),s.jsx(we,{}),s.jsx("fieldset",{className:"footer",children:s.jsx(Q,{className:"sendEmailsButton",disabled:p,children:n})})]})},B={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=l=>{const d=`logged${e?"In":"Out"}`;return t>=n[l][d]};let o={};return["navigation","search"].forEach(l=>{o[l]=r(l)}),o},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(o=>o===!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 o=Date.now();if(!t&&B.handlerCalled[e]&&o-B.handlerCalled[e]<500)return;B.handlerCalled[e]=o;let l=[{type:`menus.${e}`,value:t}];t===!0&&Object.keys(n).forEach(d=>{d===e||n[d]===!1||l.push({type:`menus.${d}`,value:!1})}),r(l)},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 o=un(e[r],t);if(!(typeof o>"u")&&(!n||o[t]&&o[t].includes(n)||o.value&&o.value.includes(n)||o.toString().includes(n)))return e[r]}return e[0].children?B.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:o})=>{if(!t.current||!t.current.children)return;const l=n?"desktop":"default";if(r[e][l]){r[e][l].focus();return}let d,a;switch(e){case"navigation":if(n){const i=B.findFirstChild(t.current.children,"attributes.aria-controls","navigation");d=B.findFirstChild(i.children,"href")}else d=B.findFirstChild(t.current.children,"href");d||(d=t.current);break;case"account":if(a=B.findFirstChild(t.current.children,"className","account"),!a||!a.children)return;d=B.findFirstChild(a.children,"href");break;default:return}d&&(o([{type:`focusElements.${e}.${l}`,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(B.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(B.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(B.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{B.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Ne={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"}}}},qe=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:o=()=>{},doTrack:l=null})=>{const d=M.useIntl(),a=un(Ne,e);if(!a||a.onlyShow&&(a.onlyShow==="logged-in"&&!t||a.onlyShow==="logged-out"&&t))return null;const i="doTrack"in a,c=l===null?i?a.doTrack:!0:l,u=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;a.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(a.href){let w=a.gtmType||`${e}-click`;if(w.includes(".")){const T=w.split("."),C=T[T.length-2];w=`${C==="topics"?`${C}-`:""}${T[T.length-1]}`}p={href:a.href,role:"menuitem"},c&&(p={...p,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),u&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...a.props||{}})}const g=a.order&&a.order[0]&&a[a.order[0]],x=g&&a[a.order[0]].order,y=p&&window.location.pathname===a.href;let _={},E={};if(g){const w=a.menuId||e,T={onClick:C=>B.events.onClick(C,{id:w,callback:o,isOpen:r[w]}),onFocus:()=>B.events.onFocus({id:w}),onBlur:()=>B.events.onBlur({id:w,callback:o}),onMouseLeave:()=>B.events.onBlur({id:w,callback:o}),onMouseEnter:()=>B.events.onMouseEnter({id:w,callback:o})};n&&(x&&(_={...T,onKeyPress:C=>{C.key==="Enter"&&B.events.onClick(C,{id:w,callback:o,isOpen:r[w]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),E={hidden:w in r?!r[w]:!0}),x||(E={...E,...T})}return s.jsxs("li",{className:S({[a.className]:a.className,"has-submenu":g,parent:x,active:y}),role:"none",..._,children:[p?h.createElement(u?Q:"a",p,d.formatMessage({id:f})):d.formatMessage({id:f}),a.order&&s.jsx("ul",{...E,children:a.order.map(w=>{if(!a[w])return null;const T={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:o,doTrack:i?c:null};return a[w].order?s.jsxs("li",{className:S({[a[w].className]:a[w].className}),children:[d.formatMessage({id:`${f}_${w}`}),s.jsx("ul",{children:a[w].order.map(C=>s.jsx(qe,{id:`${e}.${w}.${C}`,...T},C))})]},w):s.jsx(qe,{id:`${e}.${w}`,...T},w)})})]},e)};const kr={height:67,height_desktop:83},Ft=()=>{const e=M.useIntl(),t=h.useContext(ve),n=Fe(!0,!0),r=t&&typeof t.id=="string",o=h.useMemo(()=>B.getIsDesktopVersion(r,n),[r,n]),[l,d]=h.useReducer(Ms,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:a,menus:i,focusElements:c}=l;pn({scrollPosition:kr[`height${o.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{!o&&i.navigation||B.shouldChangeHeaderIsVisible(!0,i,d)},scrollDown:()=>{!o&&i.navigation||B.shouldChangeHeaderIsVisible(!1,i,d)}}});const u=(p,g)=>{B.handleMenus({id:p,value:g,menus:i,dispatch:d})},f=h.useRef(null);return be(()=>{i.navigation&&B.autoFocus({menu:"navigation",navigationRef:f,isDesktopVersion:o.navigation,focusElements:c,dispatch:d})},[i.navigation]),be(()=>{i.account&&B.autoFocus({menu:"account",navigationRef:f,isDesktopVersion:o.navigation,focusElements:c,dispatch:d})},[i.account]),t&&t.isLoading?null:s.jsxs(s.Fragment,{children:[s.jsxs("nav",{id:"header",className:S({"logged-in":r,"logged-out":!r,visible:a}),children:[s.jsx(K,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),s.jsx(At,{}),!o.navigation&&s.jsx("button",{className:"menu-button gtm-trackable",onClick:p=>{p.preventDefault(),p.stopPropagation(),u("navigation",!i.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":i.navigation,"aria-controls":"navigation",children:s.jsx(K,{children:e.formatMessage({id:`header_menu_${i.navigation?"hide":"show"}`})})}),s.jsx("ul",{ref:f,id:"navigation",hidden:o.navigation||i.account?!1:!i.navigation,role:"menu","data-showing":!o.navigation&&i.account?"account":"default",children:Ne.order.map(p=>s.jsx(qe,{id:p,isLoggedIn:r,isDesktopVersion:o.navigation,menus:{navigation:i.navigation,account:i.account},callback:u},p))}),!o.search&&s.jsx("button",{className:"search toggle-search-button",onClick:p=>{p.preventDefault(),p.stopPropagation(),u("search",!i.search)},"aria-haspopup":"true","aria-expanded":i.search,"aria-controls":"search-form",children:s.jsx(K,{children:e.formatMessage({id:`header_search_${i.search?"hide":"show"}`})})}),s.jsx(Bn,{id:"global-search",handleToggle:{searchIsOpen:i.search,isDesktopVersion:o.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),r?s.jsxs("button",{className:"account-button",onClick:p=>B.events.onClick(p,{id:"account",callback:u,isOpen:i.account}),onMouseEnter:()=>B.events.onMouseEnter({id:"account",callback:u}),onMouseLeave:()=>B.events.onBlur({id:"account",callback:u}),"aria-haspopup":"true","aria-expanded":i.account,"aria-controls":"navigation",children:[s.jsx(K,{children:e.formatMessage({id:`header_account_${i.account?"hide":"show"}`})}),s.jsx(Ke,{name:t&&t.name||"",src:t&&t.image&&t.image.thumbnail||""})]}):s.jsx("ul",{className:"sign-in-buttons",children:Ne.buttons.order.map(p=>s.jsx(qe,{id:`buttons.${p}`},p))})]}),s.jsx("hr",{id:"content-of-page"}),s.jsx("div",{className:S("overlay",{open:i.navigation||i.account||!o.search&&i.search})})]})};const yr=()=>{const e=M.useIntl();return s.jsxs(s.Fragment,{children:[s.jsx(Ft,{}),s.jsx("div",{className:"content",children:s.jsx(De,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),s.jsx(Nt,{})]})},jr=({children:e,reportError:t,showFooter:n=!0,background:r="default",className:o="",locale:l="en"})=>{const d=mn();h.useEffect(()=>{window.scrollTo(0,0)},[d]);const a=_n(e,{locale:l});return s.jsx(xs.ErrorBoundary,{onError:t,fallback:s.jsx(yr,{}),children:s.jsx(h.Suspense,{fallback:s.jsx(En,{layout:"overview-page"}),children:s.jsx("div",{id:"wrapper",className:S(o,{[r]:r!=="default"}),children:s.jsxs(cn.CookiesProvider,{children:[s.jsx(Ft,{}),s.jsx("div",{className:"content",children:a}),n&&s.jsx(Nt,{}),s.jsx(Rn,{})]})})})})},an={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"},Sr={getTagDetails:e=>{if(e.includes("topic_")){if(e=_t.topic[e.replace("topic_","")],e){const t=Ne.topics.topics[e].href;return t?{id:e,href:t,text:`${an.headerTopics}${e}`}:null}return null}return _t[e]?(e=_t[e],{id:e,text:`${an.default}${e}`}):null}};const Er=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:o="",gtmType:l="tag-click",gtmContext:d="tags"})=>{const a=M.useIntl();if(!e||e.length<1)return null;const i=[];return e.forEach(c=>{if(!c)return;const u=Sr.getTagDetails(c);u&&i.push(u)}),i.length<1?null:s.jsx("ul",{className:S("tags text-small",t,o,{"one-line":n}),children:i.map(c=>{const u=a.formatMessage({id:c.text});return s.jsx("li",{children:c.href&&r?s.jsx("a",{href:c.href,className:"gtm-trackable","data-gtm-event-type":l,"data-gtm-event-context":d,children:u}):u},c.id)})})};const Tr=({members:{total:e,data:t=[]},pagination:n,gtmContext:r="member",gtmType:o="member-click",className:l=""})=>{const d=M.useIntl();return t.length===0?null:(e||(e=t.length),s.jsxs("div",{className:S("members-list",l),children:[s.jsxs("h1",{children:[d.formatMessage({id:"membersList"}),s.jsx("span",{className:"count",children:e})]}),s.jsx("ul",{children:t.map((a,i)=>s.jsxs("li",{children:[s.jsx(et,{member:a,gtmContext:r,gtmType:o}),a.isAdmin&&s.jsx(yn,{children:d.formatMessage({id:"membersList_admin"})})]},i))}),n&&s.jsx(Fn,{...n,icon:{icon:"arrow-down",position:"right"},gtmContext:r})]}))};let ze=null;const re="discussion_form_",Pt=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1},inputRef:r,maxLength:o=5e4,minRows:l=4,forceShow:d={cancel:!1,error:!1},functions:a={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:i="DiscussionForm"})=>{var F,q;const c=M.useIntl(),u=h.useContext(ve),[f,p]=h.useState(n.isEditing&&n.isEditing.text||""),[g,x]=h.useState(d.error||!1),[y,_]=h.useState(!1),E=h.useRef(null);if(r||(r=E),n.isLoading)return s.jsx(fe,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const w=k=>{const V=k.target.value;p(V);let I;!u||!u.id?I=me(c.formatMessage,`${re}error_loggedOut`,e.type,"action"):t?V.length>=o&&(I=`${re}error_tooLong`):I=me(c.formatMessage,`${re}error_noPermission`,e.type,"action"),I?x(I):g&&x(!1)};let T=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const k=e.type==="response"?((F=e.slugs)==null?void 0:F.question)||"":((q=e.slugs)==null?void 0:q.answer)||"";k&&(T=`${T}-${k.slice(-15)}`)}const C=async k=>{var I;if(k.preventDefault(),k.stopPropagation(),!u||!u.id||!t||H)return;ze&&clearTimeout(ze),_("submitting");const V=window.location.pathname;try{let L;switch(e.type){case"post":L=await a.create({content:f});break;case"question":L=await a.create({title:f,authorId:u&&u.id,...(I=a.props)==null?void 0:I.create});break;case"response":L=await a.create({question:e.slugs.question},{body:f,authorId:u&&u.id,contentPath:V});break;case"reply":L=await a.create({question:e.slugs.question,answer:e.slugs.answer},{body:f,authorId:u&&u.id,contentPath:V});break;default:break}await Ns(1e3),a.callback&&await a.callback(L),ze=setTimeout(()=>{p(""),_("submitted"),A()},500)}catch(L){const U=L;let z=`${re}error`;U.message.includes("entry already exists")&&(z=me(c.formatMessage,`${re}error_alreadyExists`,e.type,"action")),U.message.includes("429")?z=me(c.formatMessage,`${re}error_tooMany`,e.type,"action"):U.message.includes("400")&&(z=`${re}error`),x(z),A()}},A=()=>{ze=setTimeout(()=>{x(!1),_(!1)},5e3)},H=!f||!Ls(f),W=y==="submitting",b=[];return(n.isEditing&&!W||d.cancel)&&b.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:a.handleCancel,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!d.cancel&&(!u||!u.id||!f),children:c.formatMessage({id:`${re}cancel`})}),b.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:k=>{if(n.isEditing){_("submitting"),a.handleSaveEdit&&a.handleSaveEdit(E.current&&"value"in E.current?E.current.value:"");return}C(k)},className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!u||!u.id||!t||H||W||n.isEditing&&f===n.isEditing.text,children:c.formatMessage({id:`${re}${W?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),s.jsxs("form",{id:T,className:S("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&s.jsx("h2",{children:me(c.formatMessage,`${re}title`,e.type,"action")}),s.jsx(et,{member:u||"community",gtmContext:i,gtmType:"profile-click"}),s.jsx(K,{element:"label",showOnFocus:!1,htmlFor:`${T}-input`,children:me(c.formatMessage,`${re}label`,e.type,"action")}),s.jsx(vs,{ref:r,id:`${T}-input`,name:e.type,placeholder:me(c.formatMessage,`${re}placeholder`,e.type,"action"),onChange:w,value:f,maxLength:o,"aria-invalid":!!g,"aria-errormessage":"error-message",minRows:l,autoFocus:!!n.isEditing}),s.jsx("small",{children:me(c.formatMessage,`${re}explainer`,e.type,"action",{a:k=>s.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:k})})}),s.jsx(Pe,{buttons:b}),y==="submitted"&&s.jsx(Ge,{className:"success","data-testid":"success",children:me(c.formatMessage,`${re}success`,e.type,"action")}),g&&s.jsx(Ge,{id:"error-message",className:"error","data-testid":"error",children:d.error?d.error:typeof g=="string"?g.includes(" ")?g:c.formatMessage({id:g},{action:c.formatMessage({id:`discussion_action_${e.type}`}),maxLength:o}):g})]})},Rt=({contentType:e,createPost:t,membershipRequiredToPost:{isMember:n,required:r,join:o,leave:l,notMemberStateText:d}})=>r&&!n?s.jsx(De,{text:d,button:{component:s.jsx(Ct,{functions:{join:o,leave:l}})}}):s.jsx(Pt,{content:{type:e,slugs:{}},functions:{create:t}}),$r={showThread:!1,showForm:!1},Dt=h.createContext($r),Mr=({children:e})=>{const[t,n]=h.useState({showThread:!1,showForm:!1});return s.jsx(Dt.Provider,{value:{...t,updateConversation:n},children:e})},Cr=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Ar=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);let Ae=!1;const xt=()=>{Ae!==!1&&(clearTimeout(Ae),Ae=!1)},vt=10,Hn=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:o=!1,content:l={type:"reply",slugs:{}},canLike:d=!0,functions:{createLike:a=()=>{},deleteLike:i=()=>{}}={}})=>{const c=M.useIntl();h.useEffect(()=>{g(o)},[o]);const[u,f]=h.useState(t),[p,g]=h.useState(o),[x,y]=h.useState(!1),[_,E]=h.useState(!1),w=h.useMemo(()=>Ar(n,vt),[n]),T=A=>{if(A.preventDefault(),A.stopPropagation(),E(!1),Ae)return xt(),!1;if(xt(),x||!d)return!1;Ae=setTimeout(C,350)},C=async()=>{if(xt(),x||!d)return!1;let A=p?u-1:u+1;A<0&&(A=0),y(!0),f(A),g(!p);try{if(l&&l.slugs){const H=Cr(l.slugs);p?await i(H):await a(H,{contentPath:window.location.pathname})}}catch{f(t),g(o)}finally{y(!1)}};return h.createElement(e,{className:S("likes-wrapper text-medium action-button",{"show-spinner":x,"is-liked":p,disabled:!d}),onClick:T,onMouseEnter:()=>{E(!0)},onMouseLeave:()=>{E(!1)},onFocus:()=>{E(!0)},onBlur:()=>{E(!1)},children:s.jsxs(s.Fragment,{children:[s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:p?"heart":"heart_empty",animate:"bounce"},className:S({"do-animation":p&&!o}),screenreaderText:d?c.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:c.formatMessage({id:`discussion_action_${l.type}`})}):!1,onClick:T,disabled:!d,"aria-hidden":!d,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${l.type}-click`}),s.jsx("span",{className:S("number-of-likes",{"no-likes":u===0}),"data-testid":"number-of-likes",children:c.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:u})}),n&&s.jsx(vn,{isOpen:_,isLoading:n.length===0,children:n.length&&s.jsxs("ul",{children:[w.map(A=>typeof A=="string"||!A.name?null:s.jsx("li",{children:s.jsx(Re,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",children:A.name})},A.id||window.btoa(A.name))),n.length>vt&&s.jsx("li",{children:c.formatMessage({id:"discussion_likes_more"},{number:n.length-vt})})]})})]})})};const Qn=({element:e="section",children:t,className:n,...r})=>h.createElement(e,{className:S("modal",n),children:typeof t=="string"?s.jsx("p",{children:t}):t,...r});const It=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:o=()=>{},onClose:l=()=>{}}={},forceShow:{error:d=!1}={},title:a,children:i,buttons:c,className:u="",gtmContext:f="Modal"})=>{const p=M.useIntl(),[g,x]=h.useState(t),y=E=>{x(E),E?(o(),document.body.classList.add("has-overlay")):(l(),document.body.classList.remove("has-overlay"))};h.useEffect(()=>{y(t)},[t]);const _=r?{"--max-width":`${r/16}rem`}:{};return s.jsx("div",{className:S("overlay",{open:g}),children:s.jsx(Qn,{id:e,className:S("overlay-modal",u,{"has-max-width":r}),hidden:!g,style:_,children:t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"top",children:[a&&s.jsx("h2",{className:"modal-title",children:a}),s.jsx(Q,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>y(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&s.jsx(we,{}),i,c&&s.jsxs("div",{className:"bottom",children:[s.jsx(we,{}),s.jsx(Pe,{buttons:c})]}),d&&s.jsx(Ge,{className:"error",children:d})]})})})},Un=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Nr=({className:e,showModal:t=!0,title:n,formTitle:r="Know someone who might like to join this workshop?",formLabel:o="Send an invitation to your colleagues below",ctaMessage:l="Send invites",showIcon:d,onClose:a,reportError:i=()=>{},sendInvites:c})=>s.jsx(It,{title:n,isOpen:t,showDivider:!1,showIcon:d,className:S("invite-modal",e,{success:!!n}),children:s.jsx(On,{title:r,label:o,ctaMessage:l,onClose:a,sendInvites:c,reportError:i})}),ln=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Lt=(e,t)=>e&&!t;const ge="discussion_",Fr=280,tt=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:o,functions:{content:{createContent:l,deleteContent:d,updateContent:a}={createContent:()=>{},deleteContent:()=>{},updateContent:()=>{}},likes:{createLike:i,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:u}={openComments:()=>{}}},links:f={},className:p,gtmContext:g="DiscussionAnswer",children:x,isTruncated:y=!1})=>{const _=M.useIntl(),E=h.useContext(ve),w=h.useContext(Dt),[T,C]=h.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[A,H]=h.useState(!1),[W,b]=h.useState("");if(h.useEffect(()=>{C({...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(fe,{className:"discussion-card discussion-post"});const{author:F,canLike:q,createdAt:k,id:V,likes:I=0,userLiked:L,comments:U=0}=t,z=y?Xe(T.body,Fr):T.body,X=E&&E.id&&typeof F!="string"&&F.id&&F.id===E.id||!1,oe=typeof q=="boolean"?q:n?!X:!1,ae=async R=>{R||(R=""),b("");try{if(!bs(R,T.body)){const ee=t.type==="question"?{title:R}:{body:R};await a(ln(t.slugs),ee)}C({body:R,isEditing:!1,didEdit:!0})}catch{b(`${ge}form_error`)}},ie=()=>{w&&w.updateConversation&&w.updateConversation({showThread:!0,showForm:!0}),setTimeout(()=>{const ee=`reply-form-${(t.type==="answer"?t.slug:t.slugs.answer||"").toLowerCase().slice(-15)}`,G=document.getElementById(ee),te=document.getElementById(`${ee}-input`);te&&te.focus(),G&&G.scrollIntoView({behavior:"smooth"})},0)},le=()=>{try{d(ln(t.slugs))}catch{b("delete-error")}},se=[{text:_.formatMessage({id:`${ge}moreMenu_report`}),href:`mailto:community@apolitical.co?subject=${encodeURI(_.formatMessage({id:`${ge}report_subject`}))}&body=${encodeURI(_.formatMessage({id:`${ge}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&&X&&se.push({text:_.formatMessage({id:`${ge}moreMenu_edit`}),onClick:()=>C({...T,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:_.formatMessage({id:`${ge}moreMenu_delete`}),onClick:R=>{R.preventDefault(),R.stopPropagation(),H(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...Un(`delete-${t.slug}-modal`,A)}),h.createElement(e,{className:S("discussion-post",p),"data-testid":`discussion-${t.type}-thread`,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{id:V||t.slug,className:S("discussion-card",t.type,{editing:T.isEditing,"has-link":f.post&&!T.isEditing}),onClick:R=>{!f.post||T.isEditing||(R.preventDefault(),R.stopPropagation(),window.location.href=f.post)},children:[!T.isEditing&&s.jsx(et,{member:F,additionalContent:{createdAt:k,didEdit:T.didEdit},className:typeof F!="string"&&F.id===o?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),T.isEditing?s.jsx(Pt,{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:W!==""&&W!=="delete-error"?_.formatMessage({id:W},{action:_.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:l,handleSaveEdit:ae,handleCancel:()=>{b(""),C({...T,isEditing:!1})}},gtmContext:`${g}Form`}):f.post?s.jsx("a",{href:f.post,className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":"title-click",children:s.jsx(yt,{options:{overrides:{a:kn}},children:z})}):s.jsx(yt,{options:{wrapper:t.type==="question"?"h1":h.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:z}),!T.isEditing&&s.jsxs("ul",{className:S("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[s.jsx(Hn,{element:"li",likes:I,isShort:!1,userLiked:L,content:{type:t.type,slugs:t.slugs},canLike:oe,functions:{createLike:i,deleteLike:c}}),(["question","post"].includes(t.type)||f.comments||typeof u=="function")&&s.jsxs("li",{className:"action-button",onClick:R=>{R.preventDefault(),R.stopPropagation(),f.comments&&(window.location.href=f.comments),typeof u=="function"&&u()},children:[s.jsx(Q,{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":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:_.formatMessage({id:`${ge}comments_screenReader`},{count:U})}),s.jsx("span",{children:_.formatMessage({id:`${ge}comments`},{count:U})})]}),(t.type==="answer"||t.type==="reply")&&s.jsx("li",{children:s.jsx(Q,{variant:"tertiary",size:"medium",styling:{muted:!0},onClick:ie,children:_.formatMessage({id:`${ge}reply`})})}),s.jsx(Pn,{element:"li",id:`more-${t.slug}`,options:se})]})]}),x,s.jsx(It,{id:`delete-${t.slug}-modal`,isOpen:A,functions:{onOpen:()=>{},onClose:()=>H(!1)},forceShow:{error:W==="delete-error"?_.formatMessage({id:"discussion_delete_error"},{action:_.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:_.formatMessage({id:"discussion_delete_title"},{action:_.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>H(!1),children:_.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:le,children:_.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:s.jsx(M.FormattedMessage,{id:"discussion_delete_text",values:{p:R=>s.jsx("p",{children:R}),action:_.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const bt="discussion_responses_",Pr=({type:e="answer",responses:t=0})=>{const n=M.useIntl();return s.jsxs("div",{className:"responses-heading",children:[s.jsx("h3",{children:n.formatMessage({id:`${bt}title`},{action:n.formatMessage({id:`${bt}${e}`}),count:t})}),t===0&&s.jsx("p",{children:me(n.formatMessage,`${bt}empty`,e,e)})]})};const Rr=({isOpen:e=!1,count:t=0,children:n})=>{const r=M.useIntl(),o=h.useRef(null),[l,d]=h.useState(e),[a,i]=h.useState("closed");h.useEffect(()=>{const p=o.current;if(p)return p.addEventListener("transitionend",c),()=>{p.removeEventListener("transitionend",c)}},[]),be(()=>{a==="closed"&&!l||i(["opening","open"].includes(a)?"ready-to-close":"opening")},[l]),h.useEffect(()=>{a==="ready-to-close"&&i("closing")},[a]);const c=({propertyName:p})=>{p==="max-height"&&i(g=>g==="opening"?"open":g==="closing"?"closed":g)},u=["opening","open"].includes(a),f=_n(n,{element:"li"});return s.jsxs("div",{className:"thread-wrapper",children:[s.jsx(Q,{variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-down_${u?"left":"right"}`},onClick:()=>{d(!l)},children:r.formatMessage({id:`discussion_thread_${u?"hide":"show"}`},{count:t})}),s.jsx("ul",{ref:o,className:S("thread",a),hidden:!l,children:f})]})},Dr=({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}),Ir=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({content:a})=>{if(!n)return;const i=Dr({user:n,content:a,verb:"post"});await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);return e.setQueryData(t,u=>[...u,i]),{previousActivities:c}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Lr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t),c=i==null?void 0:i.map(u=>((u==null?void 0:u.id)===(d==null?void 0:d.activityId)&&(u.content=a),u));return e.setQueryData(t,()=>c&&[...c]),{previousActivities:c}},onError:(d,a,i)=>{e.setQueryData(t,i.previousActivities)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Br=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityId:a})=>{await e.cancelQueries({queryKey:t});const i=e.getQueryData(t),c=i==null?void 0:i.map(u=>{var f;return(u==null?void 0:u.id)===a&&((f=u.reaction_counts)!=null&&f.like?u.reaction_counts.like+=1:u.reaction_counts.like=1),u});return e.setQueryData(t,()=>c&&[...c]),{previousActivities:c}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivities)},onSuccess:a=>{const i=e.getQueryData(t),c=i==null?void 0:i.map(u=>((u==null?void 0:u.id)===(a==null?void 0:a.activity_id)&&(u.latest_reactions.like?u.latest_reactions.like.push(a):u.latest_reactions.like=[a]),u));return e.setQueryData(t,()=>c&&[...c]),{previousActivities:i}},onSettled:(a,i,c)=>{e.invalidateQueries({queryKey:[...t,c.activityId]})}}),Or=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({activityId:i})=>{await e.cancelQueries({queryKey:t});const c=e.getQueryData(t),u=c==null?void 0:c.map(f=>{var p;return(f==null?void 0:f.id)===i&&(p=f.reaction_counts)!=null&&p.like&&(f.reaction_counts.like-=1),f});return e.setQueryData(t,()=>u&&[...u]),{previousActivities:u}},onError:(i,c,u)=>{e.setQueryData(t,u.previousActivities)},onSuccess:(i,{activityId:c})=>{const u=e.getQueryData(t),f=u==null?void 0:u.map(p=>{var g,x,y,_;if(p.id===c){const E=(y=(x=(g=p.latest_reactions)==null?void 0:g.like)==null?void 0:x.find(w=>w.user_id===(n==null?void 0:n.id)))==null?void 0:y.id;return p.latest_reactions.like=(_=p.latest_reactions.like)==null?void 0:_.filter(w=>w.id!==E),p}else return p});return e.setQueryData(t,()=>f&&[...f]),{previousActivities:u}},onSettled:(i,c,u)=>{e.invalidateQueries({queryKey:[...t,u.activityId]})}}),Hr=({basePath:e,parentId:t,isMember:n,functions:{list:r,create:o,edit:l,like:d,unlike:a,join:i,leave:c}})=>{const u=M.useIntl(),f=Z.useQueryClient(),p=h.useContext(ve),{data:g,error:x,isLoading:y,isFetching:_}=Z.useQuery({queryKey:[e,t],queryFn:r}),E=Ir({queryClient:f,queryKey:[e,t],user:p,mutationFn:o}),{mutate:w}=Z.useMutation(E),T=Lr({queryClient:f,queryKey:[e,t],mutationFn:async k=>await l(k)}),{mutate:C}=Z.useMutation(T),A=Br({queryClient:f,queryKey:[e,t],mutationFn:d}),{mutate:H}=Z.useMutation(A),W=Or({queryClient:f,queryKey:[e,t],user:p,mutationFn:async({activityId:k})=>{var L,U,z;const V=g&&(g==null?void 0:g.find(X=>X.id===k)),I=(z=(U=(L=V==null?void 0:V.latest_reactions)==null?void 0:L.like)==null?void 0:U.find(X=>X.user_id===(p==null?void 0:p.id)))==null?void 0:z.id;await a({reactionId:I||"",activityId:k})}}),{mutate:b}=Z.useMutation(W),F=h.useCallback(({activityId:k})=>H({activityId:k}),[H]),q=h.useCallback(({activityId:k})=>b({activityId:k}),[b]);return x?s.jsx(De,{variant:"error",text:x.message}):y?s.jsx(fe,{style:{height:"400px"}}):s.jsxs(s.Fragment,{children:[s.jsx(Rt,{contentType:"post",createPost:w,membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:c,notMemberStateText:u.formatMessage({id:"community_joinToPost"})}}),!_&&Array.isArray(g)&&(g==null?void 0:g.map(k=>{var L,U,z,X,oe,ae,ie,le,se,R,ee,G;const V=((L=k==null?void 0:k.actor)==null?void 0:L.id)===(p==null?void 0:p.id),I=Lt(n,V);return s.jsxs(h.Fragment,{children:[s.jsx(tt,{content:{type:"post",body:k==null?void 0:k.content,canLike:I,createdAt:(k==null?void 0:k.time)||"",slugs:{parentId:t,activityId:k==null?void 0:k.id},slug:k==null?void 0:k.id,author:{id:(U=k==null?void 0:k.actor)==null?void 0:U.id,name:`${(X=(z=k==null?void 0:k.actor)==null?void 0:z.data)==null?void 0:X.name}`,organization:(ae=(oe=k==null?void 0:k.actor)==null?void 0:oe.data)==null?void 0:ae.organization,jobTitle:(le=(ie=k==null?void 0:k.actor)==null?void 0:ie.data)==null?void 0:le.jobTitle,image:{thumbnail:((R=(se=k==null?void 0:k.actor)==null?void 0:se.data)==null?void 0:R.thumbnail)||void 0}},userLiked:((ee=k==null?void 0:k.own_reactions)==null?void 0:ee.like)&&((G=k==null?void 0:k.own_reactions)==null?void 0:G.like.length)>0,likes:(k==null?void 0:k.reaction_counts.like)||0,comments:(k==null?void 0:k.reaction_counts.reply)||0},links:{post:`${e}/${t}/${k==null?void 0:k.id}`,comments:`${e}/${t}/${k==null?void 0:k.id}`},functions:{content:{createContent:()=>null,deleteContent:()=>null,updateContent:(te,ue)=>C({activityInfo:te,content:ue})},likes:{createLike:()=>{F({activityId:k==null?void 0:k.id})},deleteLike:()=>{q({activityId:k==null?void 0:k.id})}},comments:{openComments:()=>null}},isTruncated:!0}),s.jsx(we,{})]},k==null?void 0:k.id)}))]})},Qr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{await e.cancelQueries({queryKey:t})},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:a=>{var c;const i=e.getQueryData(t);if(i)return(c=i==null?void 0:i.latest_reactions)!=null&&c.reply?(i.latest_reactions.reply.unshift(a),i&&(i.reaction_counts={reply:i.latest_reactions.reply.length})):(i.latest_reactions={reply:[a]},i.reaction_counts={reply:1}),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Ur=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyInfo:l,content:{body:d}})=>{var c,u,f;if(d.length===0)return;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);if(!a||!((c=a==null?void 0:a.latest_reactions)!=null&&c.reply))return;const i=(f=(u=a==null?void 0:a.latest_reactions)==null?void 0:u.reply)==null?void 0:f.map(p=>(p.id===l.replySlug&&(p.data.content=d),p));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:i}})),{previousActivity:a}},onError:(l,d,a)=>{e.setQueryData(t,a.previousActivity)}}),Wr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({replyId:d})=>{var c,u;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t),i=(u=(c=a==null?void 0:a.latest_reactions)==null?void 0:c.reply)==null?void 0:u.map(f=>{var p;return f.id===d&&((p=f.children_counts)!=null&&p.like?f.children_counts.like+=1:f.children_counts={like:1}),f});return e.setQueryData(t,()=>({...a,latest_reactions:{reply:i}})),{previousActivity:a}},onError:(d,a,i)=>{e.setQueryData(t,i.previousActivity)},onSuccess:d=>{var c;const a=e.getQueryData(t),i=(c=a==null?void 0:a.latest_reactions.reply)==null?void 0:c.map(u=>(u.id===d.id&&(u.latest_children.like?u.latest_children.like.push(d):u.latest_children.like=[d]),u));return e.setQueryData(t,()=>({...a,latest_reactions:{reply:i}})),{previousActivity:a}}}),zr=({queryClient:e,queryKey:t,user:n,mutationFn:r})=>({mutationFn:r,onMutate:async({replyId:a})=>{var u;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);if(!i)return;const c=(u=i.latest_reactions.reply)==null?void 0:u.map(f=>(f.id===a&&f.children_counts.like&&(f.children_counts.like-=1),f));return e.setQueryData(t,()=>({...i,latest_reactions:{reply:c}})),{previousActivity:i}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:(a,{replyId:i})=>{var f;const c=e.getQueryData(t);if(!c)return;const u=(f=c.latest_reactions.reply)==null?void 0:f.map(p=>{var g;return p.id===i?(g=p.latest_children.reply)==null?void 0:g.filter(y=>y.user_id!==(n==null?void 0:n.id)):p});return e.setQueryData(t,()=>({...c,latest_reactions:{reply:u}})),{previousActivity:c}}}),Wn=({basePath:e,parentId:t,activityId:n,repliesList:r,isMember:o,functions:{createReply:l,editReply:d,like:a,unlike:i,join:c,leave:u}})=>{const f=M.useIntl(),p=Z.useQueryClient(),g=h.useContext(ve),x=Qr({queryClient:p,queryKey:[e,t,n],mutationFn:l}),{mutate:y}=Z.useMutation(x),_=Ur({queryClient:p,queryKey:[e,t,n],mutationFn:async b=>d(b)}),{mutate:E}=Z.useMutation(_),w=Wr({queryClient:p,queryKey:[e,t,n],mutationFn:a}),{mutate:T}=Z.useMutation(w),C=zr({queryClient:p,queryKey:[e,t,n],user:g,mutationFn:i}),{mutate:A}=Z.useMutation(C),H=h.useCallback(({replyId:b})=>T({replyId:b}),[T]),W=h.useCallback(({replyId:b})=>A({replyId:b}),[A]);return s.jsxs(s.Fragment,{children:[s.jsx(Rt,{contentType:"post",createPost:y,membershipRequiredToPost:{isMember:o,required:!0,join:c,leave:u,notMemberStateText:f.formatMessage({id:"community_joinToPost"})}}),(r==null?void 0:r.length)===0||(r==null?void 0:r.map(b=>{var V,I,L,U,z,X,oe,ae,ie,le,se,R,ee,G,te,ue,de;const F=((V=b==null?void 0:b.latest_children)==null?void 0:V.like)&&((I=b==null?void 0:b.latest_children)==null?void 0:I.like.filter(pe=>pe.user_id===(g==null?void 0:g.id))),q=((L=b==null?void 0:b.user)==null?void 0:L.id)===(g==null?void 0:g.id),k=Lt(o,q);return s.jsx(tt,{content:{type:"post",body:typeof b.data.content=="string"?(U=b==null?void 0:b.data)==null?void 0:U.content:((X=(z=b==null?void 0:b.data)==null?void 0:z.content)==null?void 0:X.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:(oe=b==null?void 0:b.user)==null?void 0:oe.id,name:(ie=(ae=b==null?void 0:b.user)==null?void 0:ae.data)==null?void 0:ie.name,organization:(se=(le=b==null?void 0:b.user)==null?void 0:le.data)==null?void 0:se.organization,jobTitle:(ee=(R=b==null?void 0:b.user)==null?void 0:R.data)==null?void 0:ee.jobTitle,image:{thumbnail:((te=(G=b==null?void 0:b.user)==null?void 0:G.data)==null?void 0:te.thumbnail)||void 0}},userLiked:!!(F!=null&&F.length),likes:((ue=b==null?void 0:b.children_counts)==null?void 0:ue.like)||0,comments:((de=b==null?void 0:b.children_counts)==null?void 0:de.reply)||0},functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(pe,ke)=>E({replyInfo:pe,content:ke})},likes:{createLike:()=>H({replyId:b==null?void 0:b.id}),deleteLike:()=>W({replyId:b==null?void 0:b.id})},comments:{openComments:()=>{}}}},b==null?void 0:b.id)}))]})},Vr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async({activityInfo:d,content:{body:a}})=>{if(a.length===0)return;await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return i&&i.id===(d==null?void 0:d.activityId)&&(i.content=a),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onError:(d,a,i)=>{e.setQueryData(t,i.previousActivity)},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Yr=({queryClient:e,queryKey:t,mutationFn:n})=>({mutationFn:n,onMutate:async()=>{var i;await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return(i=a==null?void 0:a.reaction_counts)!=null&&i.like?a.reaction_counts.like+=1:a&&(a.reaction_counts={like:1}),e.setQueryData(t,()=>({...a})),{previousActivity:a}},onError:(a,i,c)=>{e.setQueryData(t,c.previousActivity)},onSuccess:a=>{const i=e.getQueryData(t);return i!=null&&i.latest_reactions.like?i.latest_reactions.like.push(a):i&&(i.latest_reactions={like:[a]}),e.setQueryData(t,()=>({...i})),{previousActivity:i}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Gr=({queryClient:e,queryKey:t,user:n,activity:r,mutationFn:o})=>({mutationFn:o,onMutate:async()=>{var u;await e.cancelQueries({queryKey:t});const c=e.getQueryData(t);return(u=c==null?void 0:c.reaction_counts)!=null&&u.like&&c.reaction_counts.like>0&&(c.reaction_counts.like-=1),e.setQueryData(t,()=>({...c})),{previousActivity:c}},onError:(c,u,f)=>{e.setQueryData(t,f.previousActivity)},onSuccess:()=>{var f,p,g;if(!r)return;const c=(g=(p=(f=r.latest_reactions)==null?void 0:f.like)==null?void 0:p.find(x=>x.user_id===(n==null?void 0:n.id)))==null?void 0:g.id,u=e.getQueryData(t);if(u!=null&&u.latest_reactions.like)return u.latest_reactions.like=u.latest_reactions.like.filter(x=>x.id!==c),e.setQueryData(t,()=>({...u})),{previousActivity:u}},onSettled:()=>{e.invalidateQueries({queryKey:t})}}),Jr=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{get:o,editActivity:l,likeActivity:d,unlikeActivity:a,createReply:i,editReply:c,likeReply:u,unlikeReply:f,join:p,leave:g}})=>{var L,U,z,X,oe,ae,ie,le,se,R,ee;const x=h.useContext(ve),y=Z.useQueryClient(),{data:_,error:E,isLoading:w,isFetching:T}=Z.useQuery({queryKey:[e,t,n],queryFn:o}),C=Vr({queryClient:y,queryKey:[e,t,n],mutationFn:async G=>await l(G)}),{mutate:A}=Z.useMutation(C),H=Yr({queryClient:y,queryKey:[e,t,n],mutationFn:d}),{mutate:W}=Z.useMutation(H),b=Gr({queryClient:y,queryKey:[e,t,n],user:x,mutationFn:async()=>{var te,ue,de;const G=(de=(ue=(te=_==null?void 0:_.latest_reactions)==null?void 0:te.like)==null?void 0:ue.find(pe=>pe.user_id===(x==null?void 0:x.id)))==null?void 0:de.id;await a({activityId:n,reactionId:G})},activity:_}),{mutate:F}=Z.useMutation(b),q=h.useCallback(({activityId:G})=>W({activityId:G}),[W]),k=h.useCallback(async({activityId:G})=>F({activityId:G}),[F]);if(E)return s.jsx(De,{variant:"error",text:E.message});if(w||T)return s.jsx(fe,{style:{height:"400px"}});const V=((L=_==null?void 0:_.actor)==null?void 0:L.id)===(x==null?void 0:x.id),I=Lt(r,V);return s.jsx(tt,{content:{type:"post",body:_==null?void 0:_.content,canLike:I,createdAt:(_==null?void 0:_.time)||"",slugs:{question:`${t}/${n}`,parentId:t,activityId:_==null?void 0:_.id},slug:n,author:{id:(U=_==null?void 0:_.actor)==null?void 0:U.id,name:(z=_==null?void 0:_.actor)==null?void 0:z.data.name,organization:(X=_==null?void 0:_.actor)==null?void 0:X.data.organization,jobTitle:(oe=_==null?void 0:_.actor)==null?void 0:oe.data.jobTitle,image:{thumbnail:((ae=_==null?void 0:_.actor)==null?void 0:ae.data.thumbnail)||void 0}},userLiked:((ie=_==null?void 0:_.own_reactions)==null?void 0:ie.like)&&((le=_==null?void 0:_.own_reactions)==null?void 0:le.like.length)>0,likes:_&&(_==null?void 0:_.reaction_counts.like),comments:_&&(_==null?void 0:_.reaction_counts.reply)},originalAuthorId:(se=_==null?void 0:_.actor)==null?void 0:se.id,functions:{content:{createContent:()=>console.log("create"),deleteContent:()=>console.log("delete"),updateContent:(G,te)=>A({activityInfo:G,content:te})},likes:{createLike:()=>q({activityId:n}),deleteLike:()=>k({activityId:n})},comments:{openComments:()=>{}}},children:s.jsxs(s.Fragment,{children:[s.jsxs("h3",{children:["Comments (",((R=_==null?void 0:_.reaction_counts)==null?void 0:R.reply)||0,")"]}),s.jsx(Wn,{basePath:e,parentId:t,activityId:n,repliesList:(ee=_==null?void 0:_.latest_reactions)==null?void 0:ee.reply,isMember:r,functions:{createReply:i,like:u,unlike:f,editReply:c,join:p,leave:g}})]})},n)},qr=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:o}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:o}});exports.ASSETS_BUCKET=Ye;exports.ActivitiesFeed=Hr;exports.ActivitySection=Jr;exports.AddPost=Rt;exports.BannerSection=zs;exports.Breadcrumbs=dr;exports.Button=Q;exports.ButtonWrapper=Pe;exports.CacheProvider=Mn;exports.CollapsibleSection=$t;exports.Columns=gr;exports.CommunityDetails=ur;exports.Contributors=$n;exports.ConversationContext=Dt;exports.CookieBanner=Rn;exports.DiscussionConversation=Mr;exports.DiscussionForm=Pt;exports.DiscussionLikes=Hn;exports.DiscussionPost=tt;exports.DiscussionThread=Rr;exports.Divider=we;exports.DownloadSection=Hs;exports.EMAILS=Se;exports.EmailHelperTextBox=_r;exports.EmptyStateBox=De;exports.Filters=mr;exports.FlagsProvider=Cn;exports.Footer=Nt;exports.FullWidthSection=Tt;exports.GlobalProviders=cr;exports.Header=Ft;exports.HelperTextBox=wn;exports.HiddenFromScreenReaders=St;exports.HideShowTextBox=Gs;exports.HighlightedTextBox=xe;exports.IntlProvider=An;exports.InviteForm=On;exports.InviteModal=Nr;exports.JoinButton=Ct;exports.LanguageSwitcher=pr;exports.Link=Re;exports.LoadMore=Fn;exports.LoadingBlock=rr;exports.LoadingPlaceholder=fe;exports.LoadingState=En;exports.Logo=At;exports.LogoSection=Qs;exports.MarkdownText=yt;exports.MarketingBox=Vs;exports.Member=et;exports.MembersList=Tr;exports.Modal=Qn;exports.MoreMenu=Pn;exports.NUMBER_OF_USERS=Ys;exports.Overlay=It;exports.PageLayout=jr;exports.PasswordRules=br;exports.Pill=yn;exports.ProfilePicture=Ke;exports.ProgressBar=jn;exports.Rating=wr;exports.RepliesFeed=Wn;exports.ResponsesHeading=Pr;exports.ResponsiveImage=xn;exports.SearchForm=Bn;exports.Span=kn;exports.StatusBanner=Ge;exports.Tags=Er;exports.Tooltip=vn;exports.UserContext=ve;exports.UserProvider=Nn;exports.VisuallyHidden=K;exports.addAriaProps=Un;exports.getMember=Mt;exports.headerData=Ne;exports.mapGetStreamData=qr;exports.useCurrentPath=mn;exports.useEffectAfterMount=be;exports.useScreenWidth=Fe;exports.useScrollListener=pn;exports.useScrollToHash=$s;
|