@apolitical/component-library 4.0.6 → 4.1.0-beta.10
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/accessibility/visually-hidden/visually-hidden.d.ts +19 -1
- package/discussion/components/form/form.d.ts +3 -6
- package/discussion/components/likes/likes.d.ts +7 -1
- package/form/components/form/components/field-wrapper/field-wrapper.d.ts +1 -1
- package/form/components/form/components/fields/checkbox/checkbox.d.ts +4 -0
- package/form/components/form/components/fields/input/input.d.ts +4 -0
- package/form/components/form/form.d.ts +1 -1
- package/form/components/form/form.types.d.ts +11 -1
- package/form/components/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/context/context.d.ts +19 -0
- package/form/components/rich-text-editor/components/context/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/editor/element/element.d.ts +3 -0
- package/form/components/rich-text-editor/components/editor/element/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/editor/index.d.ts +2 -0
- package/form/components/rich-text-editor/components/editor/leaf/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/editor/leaf/leaf.d.ts +3 -0
- package/form/components/rich-text-editor/components/index.d.ts +3 -0
- package/form/components/rich-text-editor/components/toolbar/components/block-option/block-option.d.ts +3 -0
- package/form/components/rich-text-editor/components/toolbar/components/block-option/block-option.helpers.d.ts +3 -0
- package/form/components/rich-text-editor/components/toolbar/components/block-option/index.d.ts +2 -0
- package/form/components/rich-text-editor/components/toolbar/components/index.d.ts +4 -0
- package/form/components/rich-text-editor/components/toolbar/components/link-editor/index.d.ts +2 -0
- package/form/components/rich-text-editor/components/toolbar/components/link-editor/link-editor.d.ts +2 -0
- package/form/components/rich-text-editor/components/toolbar/components/link-editor/link-editor.helpers.d.ts +5 -0
- package/form/components/rich-text-editor/components/toolbar/components/link-option/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/toolbar/components/link-option/link-option.d.ts +2 -0
- package/form/components/rich-text-editor/components/toolbar/components/mark-option/index.d.ts +2 -0
- package/form/components/rich-text-editor/components/toolbar/components/mark-option/mark-option.d.ts +3 -0
- package/form/components/rich-text-editor/components/toolbar/components/mark-option/mark-option.helpers.d.ts +5 -0
- package/form/components/rich-text-editor/components/toolbar/components/option/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/toolbar/components/option/option.d.ts +15 -0
- package/form/components/rich-text-editor/components/toolbar/index.d.ts +3 -0
- package/form/components/rich-text-editor/components/toolbar/toolbar.d.ts +4 -0
- package/form/components/rich-text-editor/components/toolbar/toolbar.data.d.ts +3 -0
- package/form/components/rich-text-editor/helpers/ast-types/ast-types.d.ts +156 -0
- package/form/components/rich-text-editor/helpers/ast-types/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/deserialize/deserialize.d.ts +3 -0
- package/form/components/rich-text-editor/helpers/deserialize/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/helpers.data.d.ts +97 -0
- package/form/components/rich-text-editor/helpers/hot-keys/hot-keys.d.ts +4 -0
- package/form/components/rich-text-editor/helpers/hot-keys/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/index.d.ts +5 -0
- package/form/components/rich-text-editor/helpers/serialize/do-serialize.d.ts +3 -0
- package/form/components/rich-text-editor/helpers/serialize/index.d.ts +2 -0
- package/form/components/rich-text-editor/helpers/serialize/serialize.d.ts +8 -0
- package/form/components/rich-text-editor/helpers/transform/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/transform/transform.d.ts +21 -0
- package/form/components/rich-text-editor/hooks/index.d.ts +2 -0
- package/form/components/rich-text-editor/hooks/use-positioned-element/index.d.ts +1 -0
- package/form/components/rich-text-editor/hooks/use-positioned-element/use-positioned-element.d.ts +4 -0
- package/form/components/rich-text-editor/hooks/use-selected-link/index.d.ts +1 -0
- package/form/components/rich-text-editor/hooks/use-selected-link/use-selected-link.d.ts +6 -0
- package/form/components/rich-text-editor/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/with-linlines/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/with-linlines/with-inlines.d.ts +5 -0
- package/form/components/rich-text-editor/rich-text-editor.d.ts +18 -0
- package/form/components/rich-text-editor/rich-text-editor.types.d.ts +24 -0
- package/general/buttons/button/button.d.ts +7 -1
- package/general/buttons/button-wrapper/button-wrapper.d.ts +5 -1
- package/general/index.d.ts +1 -0
- package/general/link/link.d.ts +6 -0
- package/general/portal/index.d.ts +1 -0
- package/general/portal/portal.d.ts +5 -0
- package/general/tooltip/tooltip.d.ts +27 -1
- package/helpers/intl.d.ts +17 -0
- package/helpers/validation.d.ts +1 -1
- package/index.js +116 -21
- package/index.mjs +19386 -5809
- package/package.json +11 -3
- package/style.css +1 -1
- package/styles/base/_accessibility.scss +5 -0
- package/styles/base/_links.scss +12 -3
- package/styles/base/form/_fields.scss +1 -1
- package/styles/variables/colors/theme/_form.scss +10 -0
- package/testing/__mocks__/remark-parse.d.ts +2 -0
- package/testing/__mocks__/unified.d.ts +6 -0
- package/text/markdown-text/components/span/span.d.ts +2 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),cn=require("lodash.clonedeep"),Qf=require("lodash.set"),nc=require("react-dom"),oe=require("react-intl"),Lt=require("markdown-to-jsx"),$n=require("truncate"),qe=require("@tanstack/react-query"),Jf=require("@tanstack/react-query-devtools"),na=require("posthog-js"),ks=require("react-cookie"),rc=require("lodash.isequal"),Xf=require("react-multi-email"),ac=require("lodash.get"),eh=require("react-error-boundary");var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ic(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var sc={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(
|
|
5
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(sc);var th=sc.exports;const V=bn(th),nh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>C.createElement(e,{...a,className:V("hidden",r,{"show-on-focus":t}),children:n}),Ie=C.memo(nh),rh=({element:e="span",children:t=null,...n})=>C.createElement(e,{...n,"aria-hidden":!0},t),Pa=C.memo(rh);var Yi={exports:{}},er={};/**
|
|
6
6
|
* @license React
|
|
7
7
|
* react-jsx-runtime.production.min.js
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/var
|
|
13
|
+
*/var wo;function ah(){if(wo)return er;wo=1;var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,h={},m=null,p=null;u!==void 0&&(m=""+u),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)r.call(l,c)&&!i.hasOwnProperty(c)&&(h[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:t,type:o,key:m,ref:p,props:h,_owner:a.current}}return er.Fragment=n,er.jsx=s,er.jsxs=s,er}var tr={};/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.development.js
|
|
16
16
|
*
|
|
@@ -18,47 +18,142 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var
|
|
22
|
-
`+
|
|
23
|
-
`),be
|
|
24
|
-
`),
|
|
25
|
-
`+
|
|
21
|
+
*/var Eo;function ih(){return Eo||(Eo=1,process.env.NODE_ENV!=="production"&&function(){var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function y(O){if(O===null||typeof O!="object")return null;var re=g&&O[g]||O[f];return typeof re=="function"?re:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(O){{for(var re=arguments.length,le=new Array(re>1?re-1:0),be=1;be<re;be++)le[be-1]=arguments[be];B("error",O,le)}}function B(O,re,le){{var be=v.ReactDebugCurrentFrame,ke=be.getStackAddendum();ke!==""&&(re+="%s",le=le.concat([ke]));var Oe=le.map(function(Ee){return String(Ee)});Oe.unshift("Warning: "+re),Function.prototype.apply.call(console[O],console,Oe)}}var E=!1,_=!1,A=!1,S=!1,q=!1,$;$=Symbol.for("react.module.reference");function j(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||q||O===a||O===u||O===c||S||O===p||E||_||A||typeof O=="object"&&O!==null&&(O.$$typeof===m||O.$$typeof===h||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===$||O.getModuleId!==void 0))}function N(O,re,le){var be=O.displayName;if(be)return be;var ke=re.displayName||re.name||"";return ke!==""?le+"("+ke+")":le}function w(O){return O.displayName||"Context"}function F(O){if(O==null)return null;if(typeof O.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var re=O;return w(re)+".Consumer";case s:var le=O;return w(le._context)+".Provider";case l:return N(O,O.render,"ForwardRef");case h:var be=O.displayName||null;return be!==null?be:F(O.type)||"Memo";case m:{var ke=O,Oe=ke._payload,Ee=ke._init;try{return F(Ee(Oe))}catch{return null}}}return null}var R=Object.assign,M=0,Y,K,se,ne,D,z,J;function k(){}k.__reactDisabledLog=!0;function T(){{if(M===0){Y=console.log,K=console.info,se=console.warn,ne=console.error,D=console.group,z=console.groupCollapsed,J=console.groupEnd;var O={configurable:!0,enumerable:!0,value:k,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}M++}}function L(){{if(M--,M===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},O,{value:Y}),info:R({},O,{value:K}),warn:R({},O,{value:se}),error:R({},O,{value:ne}),group:R({},O,{value:D}),groupCollapsed:R({},O,{value:z}),groupEnd:R({},O,{value:J})})}M<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=v.ReactCurrentDispatcher,U;function te(O,re,le){{if(U===void 0)try{throw Error()}catch(ke){var be=ke.stack.trim().match(/\n( *(at )?)/);U=be&&be[1]||""}return`
|
|
22
|
+
`+U+O}}var ee=!1,Z;{var ue=typeof WeakMap=="function"?WeakMap:Map;Z=new ue}function Q(O,re){if(!O||ee)return"";{var le=Z.get(O);if(le!==void 0)return le}var be;ee=!0;var ke=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Oe;Oe=I.current,I.current=null,T();try{if(re){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(Nt){be=Nt}Reflect.construct(O,[],Ee)}else{try{Ee.call()}catch(Nt){be=Nt}O.call(Ee.prototype)}}else{try{throw Error()}catch(Nt){be=Nt}O()}}catch(Nt){if(Nt&&be&&typeof Nt.stack=="string"){for(var we=Nt.stack.split(`
|
|
23
|
+
`),nt=be.stack.split(`
|
|
24
|
+
`),ze=we.length-1,He=nt.length-1;ze>=1&&He>=0&&we[ze]!==nt[He];)He--;for(;ze>=1&&He>=0;ze--,He--)if(we[ze]!==nt[He]){if(ze!==1||He!==1)do if(ze--,He--,He<0||we[ze]!==nt[He]){var gt=`
|
|
25
|
+
`+we[ze].replace(" at new "," at ");return O.displayName&>.includes("<anonymous>")&&(gt=gt.replace("<anonymous>",O.displayName)),typeof O=="function"&&Z.set(O,gt),gt}while(ze>=1&&He>=0);break}}}finally{ee=!1,I.current=Oe,L(),Error.prepareStackTrace=ke}var wn=O?O.displayName||O.name:"",xo=wn?te(wn):"";return typeof O=="function"&&Z.set(O,xo),xo}function ge(O,re,le){return Q(O,!1)}function me(O){var re=O.prototype;return!!(re&&re.isReactComponent)}function _e(O,re,le){if(O==null)return"";if(typeof O=="function")return Q(O,me(O));if(typeof O=="string")return te(O);switch(O){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return ge(O.render);case h:return _e(O.type,re,le);case m:{var be=O,ke=be._payload,Oe=be._init;try{return _e(Oe(ke),re,le)}catch{}}}return""}var Se=Object.prototype.hasOwnProperty,Pe={},Ge=v.ReactDebugCurrentFrame;function Ke(O){if(O){var re=O._owner,le=_e(O.type,O._source,re?re.type:null);Ge.setExtraStackFrame(le)}else Ge.setExtraStackFrame(null)}function Ze(O,re,le,be,ke){{var Oe=Function.call.bind(Se);for(var Ee in O)if(Oe(O,Ee)){var we=void 0;try{if(typeof O[Ee]!="function"){var nt=Error((be||"React class")+": "+le+" type `"+Ee+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Ee]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw nt.name="Invariant Violation",nt}we=O[Ee](re,Ee,be,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ze){we=ze}we&&!(we instanceof Error)&&(Ke(ke),x("%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).",be||"React class",le,Ee,typeof we),Ke(null)),we instanceof Error&&!(we.message in Pe)&&(Pe[we.message]=!0,Ke(ke),x("Failed %s type: %s",le,we.message),Ke(null))}}}var tt=Array.isArray;function Ae(O){return tt(O)}function We(O){{var re=typeof Symbol=="function"&&Symbol.toStringTag,le=re&&O[Symbol.toStringTag]||O.constructor.name||"Object";return le}}function Le(O){try{return H(O),!1}catch{return!0}}function H(O){return""+O}function ae(O){if(Le(O))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",We(O)),H(O)}var fe=v.ReactCurrentOwner,pe={key:!0,ref:!0,__self:!0,__source:!0},De,Ue,Ve;Ve={};function ft(O){if(Se.call(O,"ref")){var re=Object.getOwnPropertyDescriptor(O,"ref").get;if(re&&re.isReactWarning)return!1}return O.ref!==void 0}function Pt(O){if(Se.call(O,"key")){var re=Object.getOwnPropertyDescriptor(O,"key").get;if(re&&re.isReactWarning)return!1}return O.key!==void 0}function xt(O,re){if(typeof O.ref=="string"&&fe.current&&re&&fe.current.stateNode!==re){var le=F(fe.current.type);Ve[le]||(x('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',F(fe.current.type),O.ref),Ve[le]=!0)}}function Qe(O,re){{var le=function(){De||(De=!0,x("%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)",re))};le.isReactWarning=!0,Object.defineProperty(O,"key",{get:le,configurable:!0})}}function _t(O,re){{var le=function(){Ue||(Ue=!0,x("%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)",re))};le.isReactWarning=!0,Object.defineProperty(O,"ref",{get:le,configurable:!0})}}var ht=function(O,re,le,be,ke,Oe,Ee){var we={$$typeof:t,type:O,key:re,ref:le,props:Ee,_owner:Oe};return we._store={},Object.defineProperty(we._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(we,"_self",{configurable:!1,enumerable:!1,writable:!1,value:be}),Object.defineProperty(we,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.freeze&&(Object.freeze(we.props),Object.freeze(we)),we};function Ga(O,re,le,be,ke){{var Oe,Ee={},we=null,nt=null;le!==void 0&&(ae(le),we=""+le),Pt(re)&&(ae(re.key),we=""+re.key),ft(re)&&(nt=re.ref,xt(re,ke));for(Oe in re)Se.call(re,Oe)&&!pe.hasOwnProperty(Oe)&&(Ee[Oe]=re[Oe]);if(O&&O.defaultProps){var ze=O.defaultProps;for(Oe in ze)Ee[Oe]===void 0&&(Ee[Oe]=ze[Oe])}if(we||nt){var He=typeof O=="function"?O.displayName||O.name||"Unknown":O;we&&Qe(Ee,He),nt&&_t(Ee,He)}return ht(O,we,nt,ke,be,fe.current,Ee)}}var Xn=v.ReactCurrentOwner,Pr=v.ReactDebugCurrentFrame;function xn(O){if(O){var re=O._owner,le=_e(O.type,O._source,re?re.type:null);Pr.setExtraStackFrame(le)}else Pr.setExtraStackFrame(null)}var Qa;Qa=!1;function Ja(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function vo(){{if(Xn.current){var O=F(Xn.current.type);if(O)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+
|
|
27
|
+
Check the render method of \``+O+"`."}return""}}function Wf(O){{if(O!==void 0){var re=O.fileName.replace(/^.*[\\\/]/,""),le=O.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+
|
|
29
|
+
Check your code at `+re+":"+le+"."}return""}}var bo={};function Hf(O){{var re=vo();if(!re){var le=typeof O=="string"?O:O.displayName||O.name;le&&(re=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+q+">.")}return R}}function Tr(v,R){{if(!v._store||v._store.validated||v.key!=null)return;v._store.validated=!0;var q=Ws(R);if(jr[q])return;jr[q]=!0;var te="";v&&v._owner&&v._owner!==fn.current&&(te=" It was passed a child from "+T(v._owner.type)+"."),ze(v),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',q,te),ze(null)}}function Er(v,R){{if(typeof v!="object")return;if(un(v))for(var q=0;q<v.length;q++){var te=v[q];pn(te)&&Tr(te,R)}else if(pn(v))v._store&&(v._store.validated=!0);else if(v){var oe=y(v);if(typeof oe=="function"&&oe!==v.entries)for(var de=oe.call(v),ie;!(ie=de.next()).done;)pn(ie.value)&&Tr(ie.value,R)}}}function zs(v){{var R=v.type;if(R==null||typeof R=="string")return;var q;if(typeof R=="function")q=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===u||R.$$typeof===m))q=R.propTypes;else return;if(q){var te=T(R);Ps(q,v.props,"prop",te,v)}else if(R.PropTypes!==void 0&&!mn){mn=!0;var oe=T(R);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",oe||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Zs(v){{for(var R=Object.keys(v.props),q=0;q<R.length;q++){var te=R[q];if(te!=="children"&&te!=="key"){ze(v),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),ze(null);break}}v.ref!==null&&(ze(v),k("Invalid attribute `ref` supplied to `React.Fragment`."),ze(null))}}function Sr(v,R,q,te,oe,de){{var ie=N(v);if(!ie){var se="";(v===void 0||typeof v=="object"&&v!==null&&Object.keys(v).length===0)&&(se+=" 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 be=Us(oe);be?se+=be:se+=kr();var me;v===null?me="null":un(v)?me="array":v!==void 0&&v.$$typeof===e?(me="<"+(T(v.type)||"Unknown")+" />",se=" Did you accidentally export a JSX literal instead of a component?"):me=typeof v,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",me,se)}var he=qs(v,R,q,oe,de);if(he==null)return he;if(ie){var xe=R.children;if(xe!==void 0)if(te)if(un(xe)){for(var Ze=0;Ze<xe.length;Ze++)Er(xe[Ze],v);Object.freeze&&Object.freeze(xe)}else k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Er(xe,v)}return v===r?Zs(he):zs(he),he}}function Hs(v,R,q){return Sr(v,R,q,!0)}function Vs(v,R,q){return Sr(v,R,q,!1)}var Ys=Vs,Ks=Hs;ct.Fragment=r,ct.jsx=Ys,ct.jsxs=Ks}()),ct}process.env.NODE_ENV==="production"?Ln.exports=si():Ln.exports=ii();var a=Ln.exports;const ga=()=>{const[t,e]=g.useState(window.location.pathname),n=()=>{const r=window.location.pathname;e(r)};return g.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),t},Je=(t,e)=>{const n=g.useRef(!1);g.useEffect(()=>{n.current?t():n.current=!0},e)};function oi(t,e,n){var r=this,s=g.useRef(null),i=g.useRef(0),o=g.useRef(null),c=g.useRef([]),u=g.useRef(),l=g.useRef(),d=g.useRef(t),m=g.useRef(!0);d.current=t;var f=typeof window<"u",p=!e&&e!==0&&f;if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var b=!!(n=n||{}).leading,h=!("trailing"in n)||!!n.trailing,y="maxWait"in n,x="debounceOnServer"in n&&!!n.debounceOnServer,k=y?Math.max(+n.maxWait||0,e):null;g.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var C=g.useMemo(function(){var _=function(N){var $=c.current,j=u.current;return c.current=u.current=null,i.current=N,l.current=d.current.apply(j,$)},w=function(N,$){p&&cancelAnimationFrame(o.current),o.current=p?requestAnimationFrame(N):setTimeout(N,$)},D=function(N){if(!m.current)return!1;var $=N-s.current;return!s.current||$>=e||$<0||y&&N-i.current>=k},F=function(N){return o.current=null,h&&c.current?_(N):(c.current=u.current=null,l.current)},G=function N(){var $=Date.now();if(D($))return F($);if(m.current){var j=e-($-s.current),T=y?Math.min(j,k-($-i.current)):j;w(N,T)}},U=function(){if(f||x){var N=Date.now(),$=D(N);if(c.current=[].slice.call(arguments),u.current=r,s.current=N,$){if(!o.current&&m.current)return i.current=s.current,w(G,e),b?_(s.current):l.current;if(y)return w(G,e),_(s.current)}return o.current||w(G,e),l.current}};return U.cancel=function(){o.current&&(p?cancelAnimationFrame(o.current):clearTimeout(o.current)),i.current=0,c.current=s.current=u.current=o.current=null},U.isPending=function(){return!!o.current},U.flush=function(){return o.current?F(Date.now()):l.current},U},[b,y,e,k,h,p,f,x]);return C}function va(t,e,n){var r=n===void 0?{}:n,s=r.leading,i=r.trailing;return oi(t,e,{maxWait:e,leading:s===void 0||s,trailing:i===void 0||i})}let hn;const nt=(t=!0,e=!1,n="window")=>{if(!t)return;const[r,s]=g.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];g.useEffect(()=>(c(),window.addEventListener("resize",l),window.addEventListener("hashchange",l),window.addEventListener("hiddenSectionVisible",u),()=>{clearTimeout(hn),l.flush(),window.removeEventListener("resize",l),window.removeEventListener("hashchange",l),window.removeEventListener("hiddenSectionVisible",u)}),i);const o=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},c=()=>{s(o())},u=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||o()===r||c()},l=va(()=>{o()!==r&&(e&&(clearTimeout(hn),document.body.classList.add("is-resizing"),hn=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),c())},500,{leading:!0});return r},ba=({scrollPosition:t=0,offset:e={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[s,i]=g.useState({current:0,past:0})||[!1,()=>{}],[o,c]=g.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];g.useEffect(()=>(u(),window.addEventListener("scroll",l),()=>{l.flush(),window.removeEventListener("scroll",l)}),[]);const u=()=>{const d=window.scrollY,m=s.current,f=d-m,p=f>0?"down":"up";if(i({current:d,past:m}),p==="down"){d>=t+e.down&&!o.scrollDown&&(!o.scrollUp||f>e.up)&&(n(),c({scrollUp:!1,scrollDown:!0}));return}Math.abs(f)>=e.up&&!o.scrollUp&&(r(),c({scrollUp:!0,scrollDown:!1}))},l=va(()=>{u()},250);return s},Gn=(t=[],e=!0)=>{t=Array.isArray(t)?t:[t];const n=g.useRef(!1);Je(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(e?{behavior:"smooth"}:null),n.current=!0)}},t)},Qn=(t,e)=>{Array.isArray(e)||(e=[e]);const n=ht(t);return e.forEach(({type:r,value:s})=>{Gs(n,r,s)}),n},ya=t=>{const e=[];return t.forEach(n=>{const r=parseInt(n);isNaN(r)||e.push(r)}),e.sort((n,r)=>n-r)},_a=(t,e,n)=>{let r=n.mobile;for(const s in e){const i=parseInt(String(e[s]));if(t>=i)r=n[i];else if(t<i)break}return r},xa=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),wa=(t="")=>t.replace(/(?:^\w|[A-Z]|\b\w)/g,e=>e.toUpperCase()).replace(/[&\s]+/g,""),ka=(t="")=>t.charAt(0).toUpperCase()+t.slice(1),$e="https://storage.googleapis.com/apolitical-assets/",Ye={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},mt={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ja="Invalid token error: Logging user out...",ci="200,000+",li="160+";function Ta(t){return t?{"--icon":`url(${$e}icons/${t}.svg)`}:{}}const qe={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Ea=(t,e="en")=>new Date(t).toLocaleString(e,{day:"numeric",month:"short"}),Jn=(t,e="en")=>new Date(t).toLocaleString(e,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Bn=t=>{let e;const n=Wt(),r=Wt(new Date(t));try{e=n.getTime()-r.getTime()}catch{return""}const s=e/qe.milliseconds.inHour,i=Math.floor(e/qe.milliseconds.inDay);if(i<1)return s<1?{path:"now"}:{path:"hours",number:Math.floor(s)};if(i<7)return{path:"days",number:i};const o=Math.floor(i/7);return o<=qe.year.weeks?{path:"weeks",number:o}:{path:"years",number:Math.floor(i/qe.year.days)}},Wt=t=>{const n=(t||new Date).toUTCString();return new Date(n)},ui=(t,e,n)=>{let r;const s=Wt(),i=Wt(new Date(t));try{r=s.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/qe.milliseconds.inSecond<=e;case"minutes":return r/qe.milliseconds.inMinute<=e;case"hours":return r/qe.milliseconds.inHour<=e}return!1},di=t=>new Promise(e=>setTimeout(e,t)),rt={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",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_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
31
|
+
Check the top-level render call using <`+le+">.")}return re}}function yo(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=Hf(re);if(bo[le])return;bo[le]=!0;var be="";O&&O._owner&&O._owner!==Xn.current&&(be=" It was passed a child from "+F(O._owner.type)+"."),xn(O),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,be),xn(null)}}function Do(O,re){{if(typeof O!="object")return;if(Ae(O))for(var le=0;le<O.length;le++){var be=O[le];Ja(be)&&yo(be,re)}else if(Ja(O))O._store&&(O._store.validated=!0);else if(O){var ke=y(O);if(typeof ke=="function"&&ke!==O.entries)for(var Oe=ke.call(O),Ee;!(Ee=Oe.next()).done;)Ja(Ee.value)&&yo(Ee.value,re)}}}function Uf(O){{var re=O.type;if(re==null||typeof re=="string")return;var le;if(typeof re=="function")le=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===h))le=re.propTypes;else return;if(le){var be=F(re);Ze(le,O.props,"prop",be,O)}else if(re.PropTypes!==void 0&&!Qa){Qa=!0;var ke=F(re);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ke||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vf(O){{for(var re=Object.keys(O.props),le=0;le<re.length;le++){var be=re[le];if(be!=="children"&&be!=="key"){xn(O),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",be),xn(null);break}}O.ref!==null&&(xn(O),x("Invalid attribute `ref` supplied to `React.Fragment`."),xn(null))}}function Co(O,re,le,be,ke,Oe){{var Ee=j(O);if(!Ee){var we="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(we+=" 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 nt=Wf(ke);nt?we+=nt:we+=vo();var ze;O===null?ze="null":Ae(O)?ze="array":O!==void 0&&O.$$typeof===t?(ze="<"+(F(O.type)||"Unknown")+" />",we=" Did you accidentally export a JSX literal instead of a component?"):ze=typeof O,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ze,we)}var He=Ga(O,re,le,ke,Oe);if(He==null)return He;if(Ee){var gt=re.children;if(gt!==void 0)if(be)if(Ae(gt)){for(var wn=0;wn<gt.length;wn++)Do(gt[wn],O);Object.freeze&&Object.freeze(gt)}else x("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 Do(gt,O)}return O===r?Vf(He):Uf(He),He}}function Kf(O,re,le){return Co(O,re,le,!0)}function Zf(O,re,le){return Co(O,re,le,!1)}var Yf=Zf,Gf=Kf;tr.Fragment=r,tr.jsx=Yf,tr.jsxs=Gf}()),tr}process.env.NODE_ENV==="production"?Yi.exports=ah():Yi.exports=ih();var d=Yi.exports;const oc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Ln=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function sh(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),h=C.useRef(!0);c.current=e;var m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,y="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,x=y?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var B=C.useMemo(function(){var E=function(j){var N=o.current,w=l.current;return o.current=l.current=null,i.current=j,u.current=c.current.apply(w,N)},_=function(j,N){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(j):setTimeout(j,N)},A=function(j){if(!h.current)return!1;var N=j-a.current;return!a.current||N>=t||N<0||y&&j-i.current>=x},S=function(j){return s.current=null,f&&o.current?E(j):(o.current=l.current=null,u.current)},q=function j(){var N=Date.now();if(A(N))return S(N);if(h.current){var w=t-(N-a.current),F=y?Math.min(w,x-(N-i.current)):w;_(j,F)}},$=function(){if(m||v){var j=Date.now(),N=A(j);if(o.current=[].slice.call(arguments),l.current=r,a.current=j,N){if(!s.current&&h.current)return i.current=a.current,_(q,t),g?E(a.current):u.current;if(y)return _(q,t),E(a.current)}return s.current||_(q,t),u.current}};return $.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},$.isPending=function(){return!!s.current},$.flush=function(){return s.current?S(Date.now()):u.current},$},[g,y,t,x,f,p,m,v]);return B}function uc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return sh(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Xa;const Kn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Xa),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:h}=c;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=uc(()=>{s()!==r&&(t&&(clearTimeout(Xa),document.body.classList.add("is-resizing"),Xa=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},lc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,h=a.current,m=c-h,p=m>0?"down":"up";if(i({current:c,past:h}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=uc(()=>{l()},250);return a},Bs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);Ln(()=>{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)},Ar=(e,t)=>{Array.isArray(t)||(t=[t]);const n=cn(e);return t.forEach(({type:r,value:a})=>{Qf(n,r,a)}),n},cc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},dc=(e,t,n)=>{let r=n.mobile;for(const a in t){const i=parseInt(String(t[a]));if(e>=i)r=n[i];else if(e<i)break}return r},fc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),hc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),mc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),zt="https://storage.googleapis.com/apolitical-assets/",Fn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},ur={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},pc="Invalid token error: Logging user out...",oh="200,000+",uh="160+";function gc(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const un={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},vc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),As=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Gi=e=>{let t;const n=ha(),r=ha(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/un.milliseconds.inHour,i=Math.floor(t/un.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=un.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/un.year.days)}},ha=e=>{const n=(e||new Date).toUTCString();return new Date(n)},lh=(e,t,n)=>{let r;const a=ha(),i=ha(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/un.milliseconds.inSecond<=t;case"minutes":return r/un.milliseconds.inMinute<=t;case"hours":return r/un.milliseconds.inHour<=t}return!1},ch=e=>new Promise(t=>setTimeout(t,e)),Zn={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",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_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",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:"Write a {action}...",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_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",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",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",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.",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_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",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",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",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",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",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",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",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>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",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",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",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_news:"News",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_ai:"AI principles",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",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_explore_communities:"Communities",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",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",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.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",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"},fi={...rt,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>"},mi={...rt,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>",collapsibleSection_summary:"En savoir plus"},pi={...rt,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>"},hi=Object.freeze(Object.defineProperty({__proto__:null,en:rt,es:fi,fr:mi,pt:pi},Symbol.toStringTag,{value:"Module"})),nn=(t,e=rt)=>t in e,Te=(t,e,n,r,s={})=>{let i="";return nn(`${e}_${n}`)?i=t({id:`${e}_${n}`},s):i=t({id:e},{[r]:n,...s}),i},gi=(t,e,n)=>{if(!t||t===0)return"0";e||(e=0),n||(n=["k","m","b","t"]);let r=t.toString();e=Math.pow(10,e);for(let s=n.length-1;s>=0;s--){const i=Math.pow(10,(s+1)*3);if(i<=t){t=Math.round(t*e/i)/e,t===1e3&&s<n.length-1&&(t=1,s++),r=`${t}${n[s]}`;break}}return r},Lt=(t,e)=>g.Children.map(t,n=>Object.is(n,null)?n:g.cloneElement(n,{...e})),Sa=(t=0)=>{setTimeout(()=>{const e=document.querySelector(".splash-screen");e&&e.remove(),window.prerenderReady=!0},t)},vi=t=>t.replace(/\s+/g,"").length>0,qn=t=>{const e=t.length>8,n=/[0-9]/.test(t)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(t),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(t);return{isValid:e&&n&&r,matchingRules:{isMoreThanEightCharacters:e,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}},ae=({variant:t="primary",size:e="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:s=!1,element:i="button",onClick:o=!1,className:c="",disabled:u=!1,screenreaderText:l=!1,children:d=!1,...m})=>{const p=nt(typeof e=="object");if(typeof e=="object"&&typeof p=="number"){const y=Object.assign({},e),x=ya(Object.keys(y));e=_a(p,x,y)}const b=[];typeof e=="string"&&b.push(e),r&&(b.push("icon"),typeof r=="object"?(b.push(r.icon),r.position?b.push(r.position):b.push("left"),r.hover&&b.push(`hover_${r.hover}`),r.animate&&(b.push("animate"),typeof r.animate=="string"&&b.push(r.animate))):(b.push(r),!r.includes("right")&&!r.includes("left")&&b.push("left"))),n.muted&&b.push("muted"),n.fullWidth&&b.push("full-width");const h={...m,className:S(t,c,b,{"no-text":!d,disabled:u,button:s}),onClick:y=>{(!s||s[0]==="#")&&o&&(y.preventDefault(),y.stopPropagation()),o&&o(y)},disabled:typeof u=="object"&&"isClickable"in u?!u.isClickable:u};return s&&(i="a",h.href=s),g.createElement(i,h,d||(l?a.jsx(ge,{showOnFocus:!1,children:l}):null))},at=({buttons:t,className:e="",...n})=>{const r=t.length>1?"ul":"p",s=t.map((i,o)=>r==="p"?a.jsx(ae,{...i},o):a.jsx("li",{children:a.jsx(ae,{...i})},o));return g.createElement(r,{className:S("button-wrapper",e),...n,children:s})};const Fe=({className:t="",maxWidth:e=!1})=>{const n=e?{"--max-width":`${e/16}rem`}:{};return a.jsx("hr",{className:S(t,{"has-max-width":e}),style:n})},$r={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"}},bi=({aspect:t,range:e,sizes:n})=>{const{range:r,sizes:s}=t?$r[t]:$r.fallback;return{range:e&&e.length>0?e:r,sizes:n||s}},yi=({format:t,height:e,query:n,width:r})=>{let s=`w=${r}&h=${e}`;return s=t?`${s}&fm=${t}`:s,s=n?`${s}&${n}`:s,s},gn=({format:t,range:e,url:n,query:r})=>e.map(({height:s,width:i})=>`${n}?${yi({format:t,height:s,query:r,width:i})} ${i}w`).join(", ");const st=({image:t,className:e,testId:n})=>{const{description:r,height:s,type:i,query:o,url:c,width:u,loading:l,decoding:d,fetchPriority:m}=t,{range:f,sizes:p}=bi(t),b=gn({format:"avif",query:o,range:f,url:c}),h=gn({format:"webp",query:o,range:f,url:c}),y=gn({format:"",query:o,range:f,url:c});return i&&i.includes("svg")?a.jsx("picture",{className:e,children:a.jsx("img",{src:c,alt:r,loading:l||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:u,height:s,"data-testid":n||"image"})}):a.jsxs("picture",{className:e,children:[i!=="image/gif"&&a.jsx("source",{type:"image/avif",srcSet:b,sizes:p,"data-testid":"source"}),a.jsx("source",{type:"image/webp",srcSet:h,sizes:p,"data-testid":"source"}),a.jsx("img",{srcSet:y,sizes:p,src:c,alt:r,loading:l||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:u,height:s,"data-testid":n||"image"})]})};const _i=({image:t,className:e="",testId:n})=>a.jsx("div",{className:`image-container ${e}`,"data-testid":n||"image-container",children:t&&a.jsx(st,{image:{...t},className:"image"})}),We=({href:t,children:e,fallbackElement:n,className:r="",onClick:s,gtmContext:i,gtmType:o,...c})=>{if(t){const u={...c};return s&&(u.onClick=s),i&&(u["data-gtm-event-context"]=i),o&&(u["data-gtm-event-type"]=o),a.jsx("a",{href:t,className:S("gtm-trackable",r),...u,children:e})}return n?g.createElement(n,{children:e,className:r,...c}):a.jsx(a.Fragment,{children:e})};const xi=({currentStep:t=1,steps:e=1})=>a.jsxs(a.Fragment,{children:[a.jsx(ge,{children:a.jsx(I.FormattedMessage,{id:"progressTracker",values:{current:t,total:e}})}),a.jsx("div",{className:"progress-tracker",children:a.jsx("div",{className:"dots-wrapper",children:new Array(e).fill("").map((n,r)=>{const s=r+1;return a.jsxs("div",{className:"dot-wrapper",children:[a.jsx("div",{className:S("dot",{active:s===t,completed:s<t}),"data-testid":"progress-dot"}),a.jsx("div",{className:S("line",{active:s<t})})]},r)})})})]});const wi=({elementId:t,offset:e=20})=>{const n=I.useIntl(),r=()=>{const s=document.getElementById(t);if(!s)return;const i=document.getElementById("header");i&&window.scrollTo({top:s.offsetTop-i.clientHeight-e})};return a.jsx(ae,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const ki=({items:t,className:e="",...n})=>a.jsx("ul",{className:S("buckets",e),...n,children:t.map(({title:r,text:s,link:i,...o},c)=>a.jsx("li",{className:"bucket text-medium",children:a.jsxs("a",{href:i,...o,children:[a.jsx("p",{className:"title",children:r}),a.jsx("p",{children:s})]})},c))}),Mr=300,Rr="ease-in-out";class ji{constructor(e){this.el=e,this.summary=e.querySelector("summary"),this.content=e.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",e=>this.onClick(e))}onClick(e){e.preventDefault(),e.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const e=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[e,n]},{duration:Mr,easing:Rr}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const e=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[e,n]},{duration:Mr,easing:Rr}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(e){this.el.open=e,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const rn=({label:t=!1,className:e="",children:n,shouldAnimate:r=!1})=>{const s=I.useIntl(),i=g.useRef(null);return g.useEffect(()=>{let o;return r&&(o=new ji(i.current)),()=>{r&&o&&o.cleanUp()}},[]),a.jsxs("details",{ref:i,className:S("collapsible-section",e,{"should-animate":r}),children:[a.jsx("summary",{children:t||s.formatMessage({id:"collapsibleSection_summary"})}),a.jsx("div",{className:"content",children:n})]})},Fr={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Ti=t=>{let e=t;return Object.keys(Fr).includes(t)&&(e=Fr[t]),`url(${$e}icons/${e}.svg)`};const Or={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Ca=({contentType:t,customIcon:e,customLabel:n,className:r=""})=>{const s=I.useIntl(),i=e?{"--custom-icon":Ti(e)}:{},o=nn(`contentTypeLabel_${t}`)?s.formatMessage({id:`contentTypeLabel_${t}`}):!1;return!n&&!o?null:a.jsx("small",{className:S("content-type-label text-small",t in Or?Or[t]:t,r,{"has-custom-icon":e}),style:i,"data-testid":"content-type-label",children:n||o})};const Ee=({variant:t="primary",icon:e,styling:n={},className:r="",children:s,...i})=>{const{showHighlight:o=!1,background:c="default"}=n,u=e?{"--icon":`url(${$e}icons/${e}.svg)`}:{};return a.jsx("div",{className:S("highlighted-text-box",t,r,{"has-icon":e,"show-highlight":o,[c]:c!=="default"}),style:u,...i,children:s})};const Ae=({variant:t="empty",text:e=!1,button:n=!1,className:r=""})=>{let s=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,o=nt(i);if(i&&typeof n=="object"&&typeof o=="number"){const m=Object.assign({},n.breakpoints),f=ya(Object.keys(m));s=_a(o,f,m)}const{breakpoints:c,text:u="",component:l,...d}=n;return a.jsx(Ee,{variant:"subtle",className:S("empty-state-box",t,r),children:a.jsxs(a.Fragment,{children:[e&&typeof e=="string"?a.jsx(Re,{options:{forceBlock:!0},children:e}):e,s&&typeof n=="object"&&(l||a.jsx(ae,{...d,variant:n.variant?n.variant:"secondary",children:u}))]})})};const Un=({children:t,...e})=>a.jsx("p",{...e,children:t}),Na={q:Un,blockquote:Un};for(let t=1;t<=6;t++)Na[`h${t}`]={component:Un,props:{className:"title"}};const Pa=({type:t="default",className:e="",heading:n=!1,children:r})=>a.jsxs("div",{className:S("helper-text-box text-small",t,e),children:[n&&a.jsx("p",{className:"title",children:n}),typeof r=="string"?a.jsx(Re,{options:{wrapper:g.Fragment,forceBlock:!0,overrides:Na},children:r}):a.jsx("p",{children:r})]});const $a=({id:t,className:e="",show:n=!1,hide:r=!1,text:s,markdownOptions:i,children:o})=>{const c=I.useIntl(),u=g.useRef(null);t||(t=Date.now().toString());const[l,d]=g.useState(""),[m,f]=g.useState("closed");g.useEffect(()=>{const h=u.current;if(h)return h.addEventListener("transitionend",p),()=>{h.removeEventListener("transitionend",p)}},[]),g.useEffect(()=>{if(!s||typeof s!="string")return;const h=s.split(`
|
|
36
|
-
`);
|
|
37
|
-
`))},[s]),g.useEffect(()=>{m==="ready-to-close"&&f("closing")},[m]);const p=({propertyName:h})=>{h==="max-height"&&f(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!s)return null;const b=["opening","open"].includes(m);return a.jsxs(Ee,{variant:"subtle",className:S("hide-show-text-box",e),children:[a.jsxs("div",{ref:u,id:t,className:S("content",m),children:[a.jsx(Re,{options:{forceBlock:!0,...i},children:m==="closed"?l:s}),m!=="closed"&&o]}),a.jsx("p",{className:"cta",children:a.jsx(ae,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:S({"rotate-180":b}),onClick:()=>{f(b?"ready-to-close":"opening")},"aria-expanded":b,"aria-controls":t,children:b?r||c.formatMessage({id:"hideShowTextBox_hide"}):n||c.formatMessage({id:"hideShowTextBox_show"})})})]})};const Ei=({element:t="ul",layout:e="vertical",variant:n="default",items:r=[],styling:s={},className:i=""})=>{const{hasBorder:o=!1,zebraStriping:c=!1}=s;return g.createElement(t,{className:S("icon-bulleted-list text-medium",n,i,{"has-border":o,"has-zebra-stripes":c,[e]:t!=="dl"}),children:r.map((u,l)=>{const d={wrapper:g.Fragment,forceInline:!0},m={"--icon":`url(${$e}icons/${u.icon}.svg)`};return t==="dl"?a.jsxs(g.Fragment,{children:[a.jsx("dt",{style:m,children:a.jsx(Re,{options:d,children:u.dt||""})},`dt-${l}`),a.jsx("dd",{children:typeof u.text=="string"?a.jsx(Re,{options:d,children:u.text}):u.text},`dd-${l}`)]},`dl-${l}`):a.jsx("li",{style:m,children:typeof u.text=="string"?a.jsx(Re,{options:d,children:u.text}):u.text},l)})})},ve=()=>g.Fragment,Si=({children:t})=>a.jsx(Ee,{variant:"secondary",children:t}),Ci=({children:t})=>typeof t=="object"&&Object.keys(t||{}).length===1?a.jsx("p",{className:"center",children:t}):a.jsx("div",{className:"center",children:t}),Ni=["span","strong","h1","h2","h3","h4","h5","h6","p"],Pi=({children:t})=>{const e=I.useIntl();if(!t)return null;let n=e.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of g.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number"))if(g.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const o of g.Children.toArray(i.props.children))if(!(!o||typeof o=="string"||typeof o=="number")&&g.isValidElement(o)){const c=o.type;if(Ni.includes(c)){for(n=o.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const s=n?n.toString():"";return a.jsx(rn,{label:s,className:["Sources","Resources"].includes(s)?"discrete-links":"",children:r.map(i=>i)})},$i=({children:t,...e})=>{if(e.class)switch(e.class){case"casestudy":return a.jsx(Ee,{variant:"secondary",children:t});case"general-textbox":case"highlight-box":return a.jsx(Ee,{variant:"primary",children:t});case"pink-textbox":return a.jsx(Ee,{variant:"tertiary",children:t});case"content":return typeof t=="object"&&Object.keys(t||{}).length===1?a.jsx("p",{children:t}):t;default:return a.jsx("div",{...e,children:t})}return a.jsx("div",{...e,children:t})},Mi=t=>{const e=I.useIntl(),n=Date.now().toString();let r="default";const s=t.src;return s.includes("youtube")||s.includes("vimeo")?r="video":s.includes("riddle")||s.includes("sli.do")?r="poll":s.includes("padlet")&&(r="padlet"),a.jsxs(a.Fragment,{children:[a.jsx(ge,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var o;i.preventDefault(),i.stopPropagation(),(o=document.getElementById(`content-after-iframe-${n}`))==null||o.scrollIntoView({behavior:"smooth"})},children:e.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),a.jsx("iframe",{...t,title:e.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),a.jsx("span",{id:`content-after-iframe-${n}`})]})},Ar=t=>{let e="";return t&&typeof t!="string"&&typeof t!="number"&&typeof t!="boolean"&&"type"in t&&(e=t.type),e},Ri=({children:t,...e})=>{let n={...e};e.href&&(e.href.includes("http:")||e.href.includes("https:"))&&!e.target&&(n.target="_blank");let r=t,s=!1;for(const i of g.Children.toArray(t))if(!(!i||typeof i=="string"||typeof i=="number")&&g.isValidElement(i)){const o=i.type;if(["button","center","span","strong"].includes(o)&&i.props&&i.props.children&&i.props.children[0])for((o==="button"||Ar(i.props.children[0])==="button")&&(s=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!g.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Ar(r)==="button"&&(s=!0);else break}return s?(n={...n,className:"button primary medium"},a.jsx("p",{className:"center",children:a.jsx(ae,{variant:"primary",size:"medium",...n,children:r})})):a.jsx("a",{...n,children:r})},Wn=({children:t})=>a.jsx("span",{children:t});const Fi={default:{a:Ri,CollapsibleSection:rn,TextBox:Ee,CaseStudy:Si,style:ve,details:Pi,div:$i,iframe:Mi,center:Ci},"text-only":{h1:ve,h2:ve,h3:ve,h4:ve,h5:ve,h6:ve,style:ve,details:ve,div:ve,TextBox:ve,CollapsibleSection:ve,CaseStudy:ve,blockquote:ve,iframe:ve,button:ve}},Xe=({className:t="",options:e={},children:n,overrideType:r="default",styling:s={}})=>{const{highlightTitles:i=!1}=s;n=n.replace(/^<br\/?>/,"");const o={wrapper:g.Fragment,forceBlock:!0,overrides:Fi[r]};return a.jsx("div",{className:S("markdown-text",t,{"highlight-titles":i}),children:a.jsx(Re,{options:{...o,...e},children:n})})};const Ma=({maxWidth:t=!1,title:e,subtitle:n,children:r,className:s=""})=>{const i=t?{"--max-width":`${t/16}rem`}:{};return a.jsxs("section",{className:S("page-heading",s),children:[a.jsxs("div",{className:S("content",{"has-max-width":t}),style:i,children:[e&&e.text&&g.createElement(e.element||"h1",{className:"title"},e.text),n&&n.text&&g.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Ge=({size:t="medium",variant:e="default",className:n="",icon:r,children:s,...i})=>{const o={"--icon":`url(${$e}icons/${r}.svg)`};return a.jsx("span",{className:S("pill",t,e,n,{"has-icon":r}),style:o,...i,children:s})};const yt=({element:t="p",children:e=null,className:n="",...r})=>g.createElement(t,{...r,className:S("status-banner text-small",n),"aria-live":"assertive"},e);const Oi=({styling:t={},progress:e=0,text:n=!1,className:r=""})=>{const s=I.useIntl(),{showText:i=!1,layout:o="bar",size:c="default",color:u="default"}=t,l=e>75?100:e>50?75:e>25?50:e>5?25:0,d={"--progress":`${e}%`};return a.jsx("span",{className:S(`progress-bar section-${l}`,o,r,{[c]:c!=="default",[u!=="default"?u:""]:u!=="default"}),style:d,children:g.createElement(i?"span":ge,{className:i?"text":"",children:n||s.formatMessage({id:"progressBar"},{number:e})})})},Xn=g.memo(Oi);const vn="loadingBlock_",Ai=({progress:t=0,steps:e=!1,className:n=""})=>{const r=I.useIntl();e||(e={0:{text:r.formatMessage({id:`${vn}loading`})},75:{text:r.formatMessage({id:`${vn}almostDone`})},100:{text:r.formatMessage({id:`${vn}complete`})}});let s=null;const i=Object.keys(e);for(let c=0;c<i.length&&!(t<parseInt(i[c]));c++)s=i[c];const o=s&&e[s].icon?{"--icon":`url(${$e}icons/${e[s].icon}.svg)`}:{};return a.jsxs(Ee,{className:S("loading-block",n,{"has-icon":s&&e[s].icon}),variant:"subtle",style:o,children:[s&&a.jsx("span",{className:"step",children:e[s].text}),a.jsx(Xn,{progress:t})]})},Di=g.memo(Ai);const ke=({element:t="div",className:e="",...n})=>a.jsx(tn,{element:t,className:S("loading-placeholder",e),...n});const zn={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Ra=(t,e)=>t in zn?a.jsx("div",{className:t,children:zn[t].map((n,r)=>Ra(n,r))},e):a.jsx(ke,{className:t},e),er=({layout:t="overview-page",...e})=>a.jsx("div",{className:S("loading-state",t),...e,children:zn[t].map((n,r)=>Ra(n,r))}),Fa=t=>{const e=t&&t.toUpperCase().trim().split(" ");return Array.isArray(e)&&e.length>1&&e[0]!==""?e[1]===""?e[0][0]:e[0][0]+e[e.length-1][0]:t?t.substr(0,1):""},St=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Ii=t=>{const e=Math.ceil(26/St.length),n=Fa(t).toLowerCase();if(n==="")return St[0];const r=n.charCodeAt(0)-96;for(let s=0;s<St.length;s++)if(r<=e*(s+1))return St[s]};const Dr=256,De=({className:t="",src:e="",name:n,alt:r,width:s=Dr,height:i=Dr,...o})=>{const[c,u]=g.useState(!1),l=g.useRef(null);g.useEffect(()=>{const m=l.current;if(!m)return;const f=m.getContext("2d");if(!f)return;const p=s,b=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=p*window.devicePixelRatio,m.height=b*window.devicePixelRatio,f.scale(window.devicePixelRatio,window.devicePixelRatio)),f.fillStyle=Ii(n),f.fillRect(0,0,p,b),f.font=`${p/3}px Arial`,f.textAlign="center",f.fillStyle="white",f.fillText(Fa(n),p/2,b/1.6)},[n]);let d=!1;return e&&e!==""&&!c&&(e.includes("http")||e.includes("//"))&&(d=!0),a.jsx("figure",{className:S("profile-picture",t,{error:c}),...o,children:d?a.jsx("img",{src:e,alt:r||n,onError:()=>{u(!0)},width:s,height:i}):a.jsx("canvas",{ref:l})})},tr=t=>t==="apolitical"?{image:`${$e}logos/member_apolitical.svg`}:t==="community"||typeof t=="object"&&!t.name?{image:`${$e}logos/member_community.svg`}:{name:t.name,role:t.jobTitle||"",organisation:t.organization||"",country:t.location&&t.location.country||"",url:`/profiles/${t.id}`,image:t.image&&t.image.thumbnail},Li=({role:t="",organisation:e="",country:n="",maximumCharacters:r=80})=>{const s=t!=="",i=e!=="",o=n!=="";if(!s&&!i&&!o)return"";const c=`${t}${s&&i?` — ${e}`:e}`;let u=`${c}${(s||i)&&o?`, ${n}`:n}`;return u.length>r&&(u=c),u.length>r&&(u=Qe(u,r)),u};const xt=({element:t="div",member:e="community",additionalContent:n=!1,styling:r={},gtmContext:s="member",gtmType:i="member-click",className:o=""})=>{const c=I.useIntl(),{size:u="medium"}=r,l=tr(e);l.name||(l.name=c.formatMessage({id:`member_${typeof e=="string"?e:"community"}`}));const{name:d,image:m}=l;let{url:f}=l;e.link!==void 0&&(e.link===!1?f=void 0:f=e.link);const p=Li(l),b=n&&n.createdAt?Bn(n.createdAt):!1,h=n&&n.createdAt?Jn(n.createdAt):"";return g.createElement(t,{className:S("member text-medium",u,o),children:a.jsxs(We,{href:f,gtmType:i,gtmContext:s,onClick:y=>{y==null||y.stopPropagation()},children:[a.jsx(De,{name:d,src:m}),a.jsxs("p",{className:"details",children:[a.jsx("strong",{children:d}),n&&a.jsxs("span",{className:"additional-content",children:[n.createdAt&&b&&a.jsx("span",{className:"date",title:h,"aria-label":h,children:c.formatMessage({id:`dates_${b.path}`},{number:b.number})}),n.didEdit&&a.jsx("em",{children:c.formatMessage({id:"discussion_edited"})})]}),p&&a.jsx("small",{className:S({"text-medium":u==="large"}),children:p})]})]})})};const Ir={small:24,medium:48},nr=({element:t="div",contributors:{total:e,data:n}={total:void 0,data:[]},styling:{showText:r,size:s,showGap:i,showPlaceholders:o}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:c=2,multipleText:u,className:l="",...d})=>{const m=I.useIntl();return!n||n.length===0?null:g.createElement(t,{...d,className:S("contributors",l,s,{"has-gap":i}),children:a.jsxs(a.Fragment,{children:[a.jsx("ul",{children:n.map((f,p)=>{let b,h="";if(p<c){const{name:y="",image:x=""}=tr(f);if(o)return a.jsx(ke,{element:"li",className:"contributor"},p);b=a.jsx(De,{name:y,src:x,width:Ir[s||"medium"],height:Ir[s||"medium"]})}else if(p===c){const y=(e||n.length)-c;b=a.jsxs("small",{className:S({"large-number":y>99}),children:["+",gi(y,0)]}),h="number-left"}return b?a.jsx("li",{className:S("contributor",h),children:b},p):null})}),r&&a.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Qe(n[0].name||"",20):u||null})]})})};const Ct="emailHelperTextBox_",Oa=({type:t,email:e,redirectPath:n,resendVerificationCode:r})=>{const s=I.useIntl(),[i,o]=g.useState({path:`${Ct}default`,type:"default",link:{},mail:{},error:""}),[c,u]=g.useState(!1),l=g.useCallback(p=>{p.preventDefault(),p.stopPropagation();const b=h=>{o({path:`${Ct}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>l(y),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:h})};if(typeof r!="function"){b(s.formatMessage({id:`${Ct}error_noFunction`}));return}u(!0),r(e).then(()=>{localStorage.setItem("email",e),window.location.href=n||"/signup/verify-email"}).catch(h=>{b(h.message)}).finally(()=>{u(!1)})},[e,n,r]);g.useEffect(()=>{let p=Ct,b="default",h={},y={};switch(t){case"gov":p+="autoApproved",b="success";break;case"nonGov":p+="unrecognisedEmail",b="error",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",b="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",b="error",h={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>l(x),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",b="error",h={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...i,path:p,type:b,link:h,mail:y})},[t]);const d={};return["link","mail"].forEach(p=>{d[p]=Object.keys(i[p]).length?b=>a.jsx("a",{...i[p],children:b}):b=>b}),a.jsx(Pa,{type:i.type,heading:c?!1:s.formatMessage({id:`${i.path}_title`}),children:c?a.jsxs(a.Fragment,{children:[a.jsx(ke,{element:"span"}),a.jsx(ke,{element:"span"})]}):s.formatMessage({id:`${i.path}_text`},{...d,strong:p=>a.jsx("strong",{children:p}),em:p=>a.jsx("em",{children:p}),br:a.jsxs(a.Fragment,{children:[a.jsx("br",{}),a.jsx("br",{})]}),error:i.error})})},gt=({className:t="",element:e="input",id:n,inputRef:r,functions:s={onChange:()=>{}},name:i=n,placeholder:o,type:c="text",value:u,...l})=>{const d=g.useRef(),m=r||d;return g.createElement(e,{ref:m,...l,type:c,id:n,name:i,className:S(t,e,{"has-scrollbar":c==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:u,placeholder:o,...s,onChange:f=>{const p=f.target;s.onChange(p.value)}})};const He={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Bi=500,qi=({id:t,name:e=t,value:n,placeholder:r,functions:s={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:o=()=>{},onKeyInput:c=async()=>{}}=s,[{input:u,displayInput:l,debouncedInput:d},m]=g.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:f,activePredictionIndex:p,isPredictionSelected:b},h]=g.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=I.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),g.useEffect(()=>{const _=setTimeout(()=>{b||m(w=>({...w,debouncedInput:u}))},Bi);return()=>{clearTimeout(_)}},[u,b]),g.useEffect(()=>{d&&!b?(async()=>{try{const w=await c(d)||[];h(D=>({...D,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),h(D=>({...D,predictions:[]}))}})():h(_=>({..._,predictions:[]}))},[d,b]),g.useEffect(()=>{p>=0&&f[p]&&m(_=>({..._,displayInput:f[p].description}))},[p,f]);const x=_=>{[He.DOWN,He.UP,He.ENTER].includes(_.key)&&(_.preventDefault(),_.key===He.DOWN&&p<f.length-1?h(w=>({...w,activePredictionIndex:p+1})):_.key===He.UP&&p>0?h(w=>({...w,activePredictionIndex:p-1})):_.key===He.ENTER&&p>-1&&(o(f[p].description),m(w=>({...w,input:f[p].description})),h(w=>({...w,predictions:[],isPredictionSelected:!0}))))},k=_=>{o(_.target.value),m(w=>({...w,input:_.target.value,displayInput:_.target.value})),h(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},C=_=>{o(_.description),m(w=>({...w,input:_.description,displayInput:_.description})),h(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"text",value:l,onChange:k,onKeyDown:x,placeholder:r,name:e,id:t,...i}),a.jsx("ul",{className:"predictions-list",children:f.map((_,w)=>a.jsx("li",{onClick:()=>C(_),onMouseEnter:()=>h(D=>({...D,activePredictionIndex:w})),className:S("predictions-list-item",{active:w===p}),children:_.description},w))})]})};const Aa=({className:t="",disabled:e,element:n="p",functions:r={onChange:()=>{}},id:s,inputRef:i,intlPath:o=!1,label:c,shownValue:u=!0,type:l="checkbox",value:d,...m})=>{const f=I.useIntl(),{onChange:p,...b}=r,h=()=>{e||p(d?null:u)},y=a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:i,id:s,name:s,type:l,value:u,checked:d,onKeyDown:x=>{(x.key==="Enter"||x.code==="Space")&&(x.preventDefault(),x.stopPropagation(),h())},readOnly:!0,disabled:e}),a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("label",{htmlFor:s,children:c||f.formatMessage({id:o?`${o}_${s}`:s})})]});return g.createElement(n,{onClick:x=>{const k=x.target;k.nodeName.toLowerCase()==="a"||k.parentNode&&k.parentNode.nodeName.toLowerCase()==="a"||(x.preventDefault(),x.stopPropagation(),h())},className:S("checkbox-wrapper",t),...m,...b},y)};const Ui=g.memo(function({direction:e="down"}){return a.jsx(tn,{className:S("rotating-chevron",`direction-${e}`)})});const Wi=({className:t,options:e,initialValue:n,value:r,functions:s={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:o,multiSelect:c,multiSelectOptions:u,id:l})=>{const d=I.useIntl(),[m,f]=g.useState(!1),p=r||n,b=Array.isArray(p)?[...p]:p?[p]:[],[h,y]=g.useState(b);let x;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?x=e&&h?e.find(F=>F.id===h[0]):e?e[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?x=h[0]:x={id:"",label:""},g.useEffect(()=>{y(b)},[r,n]);const{onChange:k,onMultiSelectSubmit:C,..._}=s,w=F=>{if(c){let G=[];h!=null&&h.includes(F.id)?G=h.filter(U=>U!==F.id):G=[...h,F.id],y([...G]),k&&k([...G])}else y([F]),k&&k(F.id),f(!1)},D=F=>{if(F==="all"){const G=(e==null?void 0:e.map(U=>U.id))||[];y(G),k&&k(G)}else y([]),k&&k([])};return a.jsxs("div",{className:S("dropdown-wrapper",t),children:[a.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:F=>{F.preventDefault(),F.stopPropagation(),f(!m)},"data-testid":"dropdown-selector",..._,children:[c?`${o} · ${h.length}`:x.label,a.jsx(Ui,{direction:m?"up":"down"})]}),a.jsx("select",{defaultValue:x.id,onChange:F=>{F.preventDefault(),F.stopPropagation();const G=e&&e.find(U=>U.id===F.target.value);w(G)},hidden:!m,..._,children:e==null?void 0:e.map(F=>a.jsx("option",{value:F.id,children:F.label},F.id))}),a.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[a.jsxs("div",{className:"dropdown-menu-list",children:[(u==null?void 0:u.topbar)&&a.jsxs("div",{className:"action-bar",children:[a.jsx("p",{children:`${h==null?void 0:h.length} selected`}),a.jsxs("ul",{children:[a.jsx("li",{children:a.jsx(ae,{variant:"tertiary",size:"small",onClick:()=>D("all"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),a.jsx("li",{children:a.jsx(ae,{variant:"tertiary",size:"small",onClick:()=>D("none"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),a.jsx("ul",{children:e==null?void 0:e.map(F=>{const G=F.id===x.id||(h==null?void 0:h.includes(F))||(h==null?void 0:h.includes(F.id));return a.jsx("li",{"data-testid":"dropdown-options",children:a.jsxs("button",{className:S("gtm-trackable",{selected:G,"selected-single":G&&!c}),"data-gtm-event-type":`${F}-click`,"data-gtm-event-context":i,onClick:U=>{U.preventDefault(),U.stopPropagation(),w(F)},role:"menuitem","aria-current":G,"data-testid":G?"current-selection":"",children:[c&&a.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),a.jsx("span",{className:S({"menu-option-label":c}),children:F.label})]})},F.id)})})]}),(u==null?void 0:u.submitSection)&&a.jsx("p",{className:"submit",children:a.jsx(ae,{variant:"secondary",onClick:()=>{C&&C(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:l||"dropdown-multi-select",value:h}})),f(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const zi=({className:t="",functions:e={onChange:()=>{}},intlPath:n=!1,id:r,label:s,multiSelect:i=!1,name:o,options:c,required:u,type:l="checkboxes",value:d,...m})=>{const f=I.useIntl(),p=i?d:[],b=d;return a.jsx("ul",{...m,className:S("options-wrapper",t),"data-testid":`ul-${r}`,children:c==null?void 0:c.map(({id:h,label:y=!1,value:x=h,disabled:k=!1})=>{const C=`${r}_${h}`,_=()=>{if(k)return;let w;if(i){const D=p==null?void 0:p.indexOf(x);Array.isArray(p)&&D>=0?(w=p,w.splice(D,1)):(!p||p.length===0?w=[]:w=p,w.push(x))}else w=b===x?void 0:x;e.onChange(w)};return a.jsx(Aa,{element:"li",id:C,type:l==="checkboxes"?"checkbox":"radio",shownValue:x,value:i?p==null?void 0:p.includes(x):b===x,functions:{...e,onChange:_},intlPath:n,label:y||f.formatMessage({id:n?`${n}_${h}`:h}),disabled:k},C)})})};const Zi=({inputRef:t,type:e="password",gtm:{context:n}={context:void 0},...r})=>{const s=I.useIntl(),i=g.useRef(),o=t||i,[c,u]=g.useState(!1),[l,d]=g.useState(e),m=()=>{var f;u(!c),d(c?"password":"text"),(f=o.current)==null||f.focus()};return a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:S("show-password gtm-trackable",{"password-visible":c}),"data-gtm-event-context":n,"data-gtm-event-type":`${c?"hide":"show"}-password-click`,onClick:m,"aria-label":s.formatMessage({id:`showpassword_aria_${c?"hide":"show"}`}),children:s.formatMessage({id:`showpassword_${c?"hide":"show"}`})}),a.jsx(gt,{inputRef:o,type:l,...r})]})};const Ve={text:{component:gt},email:{component:gt},textarea:{component:gt,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Aa},checkboxes:{component:zi,props:{multiSelect:!0}},select:{component:Wi},password:{component:Zi},autocomplete:{component:qi}},Hi=({id:t,intlPath:e=!1,className:n="",error:r,functions:s={onChange:()=>{}},limit:i=0,showRequiredLabels:o=!0,type:c,validation:u,value:l,...d})=>{const m=I.useIntl(),f=u&&u.some(({condition:_})=>_==="required"),p=(l==null?void 0:l.toString().length)||0,b=c&&Ve[c]&&Ve[c].component?Ve[c].component:gt,h={};c&&["checkboxes"].includes(c)?h.element="span":h.htmlFor=t;let y={...d,id:t,name:t,className:r?"error":"",type:c,required:f,"aria-required":f,functions:ht(s),value:l};i>0&&(y["data-character-limit"]=i,y.functions&&(y.functions.onChange=_=>{((_==null?void 0:_.toString().length)||0)>i&&(_=_==null?void 0:_.toString().slice(0,i)),s.onChange(_)})),c&&Ve[c]&&Ve[c].props&&(y={...y,...Ve[c].props}),c&&["checkboxes"].includes(c)&&(y.intlPath=`${e}_${t}`),r&&(y["aria-invalid"]=!0,y["aria-describedby"]=`error-${t}`);const x=d.label||m.formatMessage({id:e?`${e}_${t}`:t}),k=({..._})=>r?g.createElement(_.as||"dd",{id:`error-${t}`,className:"error text-small",role:"alert","aria-live":"assertive",..._},r):null;if(c&&["checkbox"].includes(c))return a.jsxs(a.Fragment,{children:[a.jsx(b,{...y,label:x,className:S("field-wrapper",n)}),a.jsx(k,{as:"p"})]});const C=_=>g.createElement(_.element||"label",{..._,className:"checkboxes-label text-small","data-testid":`label-${t}`});return a.jsxs("dl",{className:S("field-wrapper text-medium",n),children:[a.jsx("dt",{children:a.jsxs(C,{...h,children:[x,f&&o&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),a.jsxs("dd",{children:[a.jsx(b,{...y}),i>0?a.jsxs("small",{className:S("character-limit",{"near-limit":p>=.99*i,"approaching-limit":p>=.9*i&&p<.99*i}),children:[a.jsx("span",{className:"hidden",children:m.formatMessage({id:"form_fieldWrapper_characterLimit"})}),p," / ",i]}):null]}),a.jsx(k,{})]})},Vi=(t,e)=>{const{type:n,payload:r}=e,s=t.errors?ht(t.errors):{},i=t.values?ht(t.values):{};switch(n){case"toggleSubmitting":return{...t,isSubmitting:!t.isSubmitting};case"updateValue":if(r!=null&&r.key&&s[r==null?void 0:r.key]&&delete s[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...t,errors:s,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...t,errors:s,values:i};case"addError":return r!=null&&r.key&&!s[r==null?void 0:r.key]&&(s[r==null?void 0:r.key]=r==null?void 0:r.value),{...t,errors:s};case"removeError":return r!=null&&r.key&&s[r==null?void 0:r.key]&&delete s[r==null?void 0:r.key],{...t,errors:s};case"submitForm":{const{fields:o=[],dispatch:c=()=>{},onSuccess:u=()=>{},onFailure:l=()=>{},intl:d}=r,m=ht(Object.keys(s));for(const f of o)if(f.validation)for(let p=0;p<f.validation.length;p++){const{condition:b="required",error:h=!1}=f.validation[p];let y=!1;if(typeof b=="function"){const x=b(i);x&&(y=h||x)}else{const x=i[f.id];switch(b){case"required":(!x||typeof x=="string"&&x.trim().length===0)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{x&&!/^([^0-9]*)$/.test(x)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{x&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(x)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{x&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(x)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){c({type:"addError",payload:{key:f.id,value:y}}),m.push(f.id);break}}return m.length===0?u(i):l(i,m),{...t,isSubmitting:!1}}case"formSubmitted":return{...t,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return t}};let bn=null;const wt=({fields:t,className:e="",id:n=t.length?`form__${t[0].id}`:"form",formRef:r,intlPath:s=!1,button:i={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:c,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:l=async()=>{},onCancel:d=()=>{},onCatch:m=()=>{},onFailure:f=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...p})=>{const{customOnSubmit:b,hideButton:h,...y}=i,x=40,{shouldShowCancelButton:k=!1,shouldReset:C=!0,showRequiredLabels:_=!0,showSuccessMessage:w=!1}=c||{},D=I.useIntl(),F={};t.length&&t.forEach(H=>{const Y=H.id||H.name;Y&&(F[Y]=H.value||"")});const[G,U]=g.useReducer(Vi,{isSubmitting:!1,formSubmitted:!1,errors:{},values:F}),{errors:N,isSubmitting:$,formSubmitted:j,values:T}=G;g.useEffect(()=>{C&&j&&(bn=setTimeout(()=>{U({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[j]),g.useEffect(()=>()=>{bn&&clearTimeout(bn)},[]),g.useEffect(()=>{const H=Y=>{U({type:"updateValue",payload:{key:Y.detail.id,value:Y.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",H),()=>{document.removeEventListener("dropdownMultiSelectSubmit",H)}},[]);const P=g.useRef(null),O=r||P;if(!t.length)return null;i.text||(i.text=D.formatMessage({id:"form_submit"}));const V=[{...y,icon:j?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:H=>{var M;if(H.preventDefault(),H.stopPropagation(),$)return;let Y=0;if((M=O==null?void 0:O.current)!=null&&M.id){const B=document.getElementById(O.current.id);B&&(Y=B.getBoundingClientRect().top+window.scrollY)}const E=document.getElementById("header");if(E&&(Y=Y-E.offsetHeight-x),Y<0&&(Y=0),window.scrollTo({top:Y,behavior:"smooth"}),U({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&U({type:"submitForm",payload:{fields:t,dispatch:U,intl:D}});return}U({type:"submitForm",payload:{fields:t,dispatch:U,onSuccess:async B=>{try{await l(B),U({type:C?"formSubmittedAndReset":"formSubmitted"})}catch(W){m(W),U({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(B,W)=>{f(B,W),U({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:D}})},disabled:$||j||i.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:$||j?D.formatMessage({id:`form_${$?"submitting":"submitted"}`}):i.text}];return k&&V.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:$||j,onClick:d,children:o.text||D.formatMessage({id:"form_cancel"})}),a.jsxs(a.Fragment,{children:[a.jsxs("form",{...p,id:n,className:S("form",e),ref:O,children:[N!=null&&N.general?a.jsx(Ae,{variant:"error",text:D.formatMessage({id:"form_error_generalError"})}):null,(!C||!$&&!j||b)&&t.map((H,Y)=>{const{id:E=H.name||Y,component:M,functions:B={onChange:()=>{}}}=H;if(M)return a.jsx(M,{...H.props||{}},`component-${E}-${Y}`);const W=T?T[E]:"";return a.jsx(Hi,{intlPath:s,...H,showRequiredLabels:_,value:W,error:N==null?void 0:N[E],functions:{...B,onChange:Z=>{U({type:"updateValue",payload:{key:E,value:Z}}),B.onChange(Z&&Z.toString(),U)}}},E)}),h?null:($||j)&&b?b:a.jsx(at,{className:S("cta",{center:$||j,submitted:j}),buttons:V})]}),w&&j&&a.jsx(yt,{className:"success",children:typeof w=="string"?w:D.formatMessage({id:"form_success"})})]})};const Nt="passwordRules_",Da="isMoreThanEightCharacters",Ia="includesNumberAndSymbol",La="includesLowerAndUppercase",Yi={[Da]:"8Characters",[Ia]:"numberSymbol",[La]:"lowercaseUppercase"},Ki=({matchingRules:t={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:e=""})=>{const n=I.useIntl();return a.jsxs("aside",{className:S("password-rules",e),children:[a.jsx("small",{children:n.formatMessage({id:`${Nt}intro`})}),a.jsx("ul",{children:[Da,Ia,La].map(r=>a.jsxs("li",{className:S({matches:t[r]}),children:[a.jsxs(ge,{children:[n.formatMessage({id:`${Nt}rule_label`})," "]}),a.jsx("span",{children:n.formatMessage({id:`${Nt}rule_${Yi[r]}`})}),!t[r]&&a.jsxs(ge,{element:"strong",children:[" ",n.formatMessage({id:`${Nt}notMet`})]})]},`rule-${r}`))})]})},Ba=g.memo(Ki);const Gi=({text:t={},topRating:e=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:s=()=>{}},className:i="",hasLoaded:o=!1})=>{const c=I.useIntl(),[u,l]=g.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const x=await n();l(k=>({...k,setUp:!0,id:x&&x.id,disabled:!1}))}catch(x){l(k=>({...k,setUp:!0,disabled:!0})),s(x)}};if(g.useEffect(()=>{o&&!u.setUp&&d()},[o]),!o)return a.jsx(ke,{className:"rating-placeholder"});const{id:m,rating:f,disabled:p}=u,b="ratings_",h={text:c.formatMessage({id:`${b}text`}),low:c.formatMessage({id:`${b}low`}),high:c.formatMessage({id:`${b}high`}),success:c.formatMessage({id:`${b}success`}),...t},y=async x=>{if(!(!m||p))try{l(k=>({...k,rating:x,disabled:!0})),await r({id:m,value:x})}catch(k){l(C=>({...C,rating:null})),s(k)}finally{l(k=>({...k,disabled:!1}))}};return a.jsxs("div",{className:S("rating",i),children:[a.jsx("span",{className:"label",children:h[f?"success":"text"]}),a.jsx("ol",{children:Array.from(new Array(e).keys()).map(x=>{const k=x+1;return a.jsx("li",{className:S({selected:f&&k<=f}),children:a.jsx(ae,{variant:"tertiary",size:"small",icon:{icon:`star${!f||k>f?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${c.formatMessage({id:`${b}stars`},{number:k,total:e})}${k===1||k===e?` - ${h[k===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),y(k)},disabled:p})},`rating-${k}`)})})]})};const Qi=({id:t="form-toggle",label:e,options:n,initialValue:r,functions:{onChange:s=()=>{}},isDisabled:i=!1,className:o=""})=>{const[c,u]=g.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);g.useEffect(()=>{r&&u(r)},[r]);const l=d=>{i||(u(d),s(d))};return a.jsxs("div",{className:S("toggle",o),onClick:d=>{d.preventDefault(),d.stopPropagation(),l(c===n[0].value?n[1].value:n[0].value)},children:[a.jsx("p",{children:e}),a.jsx("ul",{className:S("toggle-options",{disabled:i,on:c===n[1].value}),children:n.map(d=>{const m=`${t}-${d.value}`;return a.jsxs("li",{className:"hidden",children:[a.jsx("input",{type:"radio",id:m,name:t,value:d.value,checked:c===d.value,onChange:()=>l(d.value),disabled:i}),a.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function Ji({className:t="",userId:e,userName:n,src:r,setUserImage:s,uploadImage:i}){const[o,c]=g.useState(!1),[u,l]=g.useState(!1),d=g.useRef(null),m=async f=>{c(!0),l(!1);try{const p=f.target.files&&f.target.files[0];if(!p||!e)throw c(!1),new Error("Image file or userID is missing");const b=await i({fileObject:p,userId:e});s(h=>({...h,image:{thumbnail:b.thumbnailURL,full:b.originalURL}}))}catch{l(!0)}finally{c(!1)}c(!1)};return a.jsxs("div",{className:S("profile-image-change-figure",t),children:[a.jsx(De,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),u&&a.jsx("p",{className:"error text-small",children:a.jsx(I.FormattedMessage,{id:"profile_image_change_error"})}),a.jsx("input",{id:"file",type:"file",accept:"image/*",ref:d,onChange:m,hidden:!0,"data-testid":"file-input"}),a.jsx(ae,{onClick:()=>d.current&&d.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:o,children:a.jsx(I.FormattedMessage,{id:o?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const qa=({gtm:t,functions:{onSuccess:e=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:s="contact-form-submit-click"}=t||{};return a.jsx(wt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:s},functions:{onSuccess:e,onFailure:n}})};const Ua=({title:t,label:e,ctaMessage:n,titleColor:r,labelColor:s,backgroundColor:i,onClose:o,reportError:c,sendInvites:u,initialFormStatus:l="NOT_SUBMITTED"})=>{const[d,m]=g.useState([]),[f,p]=g.useState(!0),[b,h]=g.useState(l),{formatMessage:y}=I.useIntl(),x=async _=>{_.preventDefault();try{await u(d),m([]),h("SUCCESS")}catch(w){h("ERROR"),c(w)}},k=_=>{_.preventDefault(),h("NOT_SUBMITTED"),p(!0),m([])},C=_=>{_.preventDefault(),o(),h("CLOSED")};return b==="CLOSED"?null:b==="ERROR"||b==="SUCCESS"?a.jsxs("div",{className:"invite-form-wrapper",children:[a.jsx("div",{className:"content centred",children:b==="SUCCESS"?a.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):a.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),a.jsx(Fe,{}),a.jsx("div",{className:"footer",children:b==="SUCCESS"?a.jsxs(a.Fragment,{children:[a.jsx(ae,{variant:"secondary",onClick:k,children:y({id:"inviteForm_ctaSendMoreInvites"})}),a.jsx(ae,{onClick:C,children:y({id:"inviteForm_ctaDone"})})]}):a.jsx(ae,{onClick:k,children:y({id:"inviteForm_ctaTryAgain"})})})]}):a.jsx("div",{className:"invite-form-wrapper",children:a.jsxs("form",{style:{backgroundColor:i},onSubmit:x,className:S("invite-form gtm-trackable"),children:[a.jsxs("fieldset",{className:"content",children:[a.jsx("h2",{className:"title",style:{color:r},children:t}),a.jsx("label",{htmlFor:"email-input",className:"label",style:{color:s},children:e}),a.jsx(Js.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:d,onChange:_=>{m(_),p(!_.length)},autoFocus:!1,getLabel:(_,w,D)=>a.jsxs("div",{className:"email text-medium",children:[a.jsx("div",{"data-tag-item":!0,children:_}),a.jsx(ae,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{D(w),p(!d.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},w)})]}),a.jsx(Fe,{}),a.jsx("fieldset",{className:"footer",children:a.jsx(ae,{className:"sendEmailsButton",disabled:f,children:n})})]})})},Bt=t=>t.map(e=>({condition:e})),we={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Xi=({functions:t,...e})=>{const{formatMessage:n}=I.useIntl(),[r,s]=g.useState(null),[i,o]=g.useState(!1),[c,u]=g.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),l=p=>p[we.NEW_PASSWORD]!==p[we.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!qn(p[we.NEW_PASSWORD]).isValid,m=[{"data-testid":we.NEW_PASSWORD,id:we.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Bt(["required",d]),functions:{onChange:p=>u(qn(p).matchingRules),onFocus:()=>o(!0),onBlur:()=>o(!1)}},{"data-testid":we.CONFIRMED_PASSWORD,id:we.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Bt(["required",l])}];e.isPasswordChange&&m.unshift({"data-testid":we.CURRENT_PASSWORD,id:we.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Bt(["required"])}),i&&m.push({component:Ba,props:{matchingRules:c}});const f={id:we.FORM_ID,fields:m,functions:{...t,onSuccess:async p=>(t.createPassword(p),t.onSuccess&&t.onSuccess(p)),onCatch:p=>s(p==null?void 0:p.statusCode),onFailure:(p,b)=>{(b.includes(we.NEW_PASSWORD)||b.includes(we.CONFIRMED_PASSWORD))&&o(!0)}},meta:{shouldReset:!0},...e};return a.jsxs(a.Fragment,{children:[a.jsx(wt,{...f}),r&&a.jsx(Ae,{variant:"error",text:r})]})};const Wa=({id:t="search",className:e="",handleToggle:n=!1,defaultValue:r="",gtmContext:s="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:o=!0,isDesktopVersion:c=!1}=n||{},u=I.useIntl(),l=g.useRef(null);Je(()=>{!n||c||!o||l.current&&l.current.focus()},[o]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return a.jsx("form",{onSubmit:d,className:S("search-form gtm-trackable",e),role:"search","data-gtm-event-context":s,"data-gtm-event-type":i,children:a.jsx("fieldset",{id:`${t}-form`,hidden:n?!o:!1,children:a.jsxs("p",{children:[a.jsx(ge,{element:"label",htmlFor:t,children:u.formatMessage({id:"search_label"})}),a.jsx("input",{ref:l,type:"search",id:t,name:t,defaultValue:r,placeholder:u.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),a.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:a.jsx(ge,{children:u.formatMessage({id:"search_clear"})})}),a.jsx("button",{className:"search",onClick:d,children:a.jsx(ge,{children:u.formatMessage({id:"search_cta"})})})]})})})},Lr=async({ref:t,validateEmail:e,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!t.current.validity.valid||!r.test(t.current.value))return n([{type:"validFields.email",value:!1}]);const s=t.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let o=Object.assign({},i);try{o=await e(s),o===void 0&&(o=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:s,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:c=!1,autoApproved:u=!1,exists:l}=o;let d="";return c?d=u?"gov":"nonGov":l.registration?l.engagement&&!l.user?d=l.auth?"verify":"pending":d="exists":l.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!u},{type:"emailDetails",value:{email:s,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(s)}},{type:"validFields.email",value:!0}])},eo=t=>{const e={};for(const n of t.entries())e[n[0]]=n[1];return{name:e.full_name.toString().trim(),email:e.email_address.toString().toLowerCase().trim(),jobTitle:e.job_title,organization:e.organization,bioLink:e.url,optIn:!0,expectation:e.expectation,page:window.location.pathname,"g-recaptcha-response":e["g-recaptcha-response"]}},to=async({refs:t,dataToSubmit:e,createAccount:n,onSuccess:r,dispatch:s,state:i})=>{if(!t.form||!t.form.current)throw new Error("No refs.form");if(!t.form.current.checkValidity()){t.hiddenValidation&&t.hiddenValidation.current&&t.hiddenValidation.current.click();return}const o=eo(new FormData(t.form.current)),c=Object.assign(o,e);await n(c),localStorage.setItem("email",o.email),r&&r({...o,...i.values}),s([{type:"showSuccessMessage",value:!0}])},no=({shouldShow:t,placeholders:e,labels:n,functions:{validateEmail:r,resendVerificationCode:s},refs:i,state:o,dispatch:c,dataToSubmit:u,intl:l})=>{const{emailDetails:d}=o,m=(p,b)=>{p.current&&o.validFields[b]!==p.current.validity.valid&&c([{type:`validFields.${b}`,value:p.current.validity.valid}])},f=[{id:"full_name",type:"text",inputRef:i.name,placeholder:l.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>c([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:l.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Lr({ref:i.email,validateEmail:r,dispatch:c})},onChange:(p,b)=>{c([{type:"shouldDisableButton",value:!0}]),b&&b({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>c([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Oa,props:{email:d.email,type:d.boxType,resendVerificationCode:s}}];return o.shouldManuallyApprove&&(f.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:l.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:l.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),t.url&&f.push({id:"url",type:"text",label:l.formatMessage({id:"signup_url"},{small:p=>a.jsx("small",{children:p})}),placeholder:l.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),t.expectation&&f.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||l.formatMessage({id:"signup_expectation"},{small:p=>a.jsx("small",{className:"notes text-small",children:p})}),placeholder:(e==null?void 0:e.expectation)||l.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),f.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:l.formatMessage({id:"signup_terms"},{terms:p=>a.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>a.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const b=[];["name","email"].forEach(h=>{o.validFields[h]!==i[h].current.validity.valid&&(b.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Lr({ref:i.email,validateEmail:r,dispatch:c}))}),b.length&&c(b)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),f};const ro=({className:t=""})=>a.jsxs("div",{className:S("success-message",t),"data-testid":"success-message",children:[a.jsx("p",{className:"success-title",children:a.jsx(I.FormattedMessage,{id:"signup_success_title"})}),a.jsx(I.FormattedMessage,{id:"signup_success_text",values:{p:e=>a.jsx("p",{children:e})}})]});const ao={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},so=({className:t="",labels:e={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:s={},submitButton:i,dataToSubmit:o={ref:"sign-up-form"},...c})=>{const u=I.useIntl(),{title:l=!0,expectation:d=!1,url:m=!0,logInButton:f=!0,successMessage:p=!0}=s,b={title:l,expectation:d,url:m,logInButton:f,successMessage:p},[h,y]=g.useReducer(Qn,ao),{validFields:x,emailDetails:k,shouldManuallyApprove:C,shouldDisableButton:_,showSuccessMessage:w,showError:D}=h,[F,G]=Kn.useCookies(["signup-this-session","functional-cookie-consent"]),U={form:g.createRef(),name:g.createRef(),email:g.createRef(),jobTitle:g.createRef(),organisation:g.createRef(),tc:g.createRef(),hiddenValidation:g.createRef()};g.useEffect(()=>{C===!0&&U.jobTitle.current&&U.jobTitle.current.focus()},[C]),g.useEffect(()=>{F["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[F]),g.useEffect(()=>{w&&F["functional-cookie-consent"]&&G("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const N=g.useMemo(()=>no({placeholders:n,labels:e,shouldShow:b,functions:r,refs:U,state:h,dispatch:y,dataToSubmit:o,intl:u}),[o,r,u,U,b,h]),$=_?!0:C?!Object.values(x).every(j=>j===!0):!x.name||!x.email||["exists","pending","verify"].includes(k.boxType);return b.successMessage&&w?a.jsx(ro,{className:t}):a.jsxs("fieldset",{className:S("signup-form-fieldset",t),"data-testid":"signup-form",children:[b.title&&a.jsx("p",{className:"signup-title",children:a.jsx(I.FormattedMessage,{id:"signup_title"})}),D&&a.jsx(Ae,{variant:"error",text:u.formatMessage({id:"signup_error"})}),a.jsx(wt,{className:"signup-form",formRef:U.form,id:"sign-up-form",fields:N,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||u.formatMessage({id:"signup_button_join"}),disabled:$?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:u.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:b.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await to({refs:U,dataToSubmit:o,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:h})},onCatch:j=>{r.handleError(j),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),a.jsx("button",{className:"validation-button",ref:U.hiddenValidation})]})};var Zn={exports:{}},Pt={exports:{}},ce={};/** @license React v16.13.1
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",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_likes_show:"Show who liked this {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_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",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",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",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.",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_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",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",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",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",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",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!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",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>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",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",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",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_news:"News",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_ai:"AI principles",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",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_explore_communities:"Communities",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",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",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.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",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"},dh={...Zn,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>"},fh={...Zn,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>",collapsibleSection_summary:"En savoir plus"},hh={...Zn,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>"},mh=Object.freeze(Object.defineProperty({__proto__:null,en:Zn,es:dh,fr:fh,pt:hh},Symbol.toStringTag,{value:"Module"})),Na=(e,t=Zn)=>e in t,Bt=(e,t,n,r,a={})=>{let i="";return Na(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},ph=(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 a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},ra=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),bc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},gh=(e="")=>e.replace(/\s+/g,"").length>0,Qi=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}},xe=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,screenreaderText:u=!1,children:c=!1,...h})=>{const p=Kn(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const y=Object.assign({},t),v=cc(Object.keys(y));t=dc(p,v,y)}const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left"))),n.muted&&g.push("muted"),n.fullWidth&&g.push("full-width");const f={...h,className:V(e,o,g,{"no-text":!c,disabled:l,button:a}),onClick:y=>{(!a||a[0]==="#")&&s&&(y.preventDefault(),y.stopPropagation()),s&&s(y)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return a&&(i="a",f.href=a),C.createElement(i,f,c||(u?d.jsx(Ie,{showOnFocus:!1,children:u}):null))},yn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(xe,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(xe,{...s})},o)});return C.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const Qt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},_o={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"}},vh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?_o[e]:_o.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},bh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},ei=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${bh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Yn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:h}=e,{range:m,sizes:p}=vh(e),g=ei({format:"avif",query:s,range:m,url:o}),f=ei({format:"webp",query:s,range:m,url:o}),y=ei({format:"",query:s,range:m,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const yh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(Yn,{image:{...e},className:"image"})}),Dn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:V("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})},yc=({children:e})=>typeof document=="object"?nc.createPortal(e,document.body):null;const Dh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Ie,{children:d.jsx(oe.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const Ch=({elementId:e,offset:t=20})=>{const n=oe.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(xe,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const xh=({items:e,className:t="",...n})=>d.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),ko=300,Bo="ease-in-out";class wh{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:ko,easing:Bo}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:ko,easing:Bo}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const Ra=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=oe.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new wh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},Ao={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Eh=e=>{let t=e;return Object.keys(Ao).includes(e)&&(t=Ao[e]),`url(${zt}icons/${t}.svg)`};const Fo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Dc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=oe.useIntl(),i=t?{"--custom-icon":Eh(t)}:{},s=Na(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:V("content-type-label text-small",e in Fo?Fo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const St=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${zt}icons/${t}.svg)`}:{};return d.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const en=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=Kn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),m=cc(Object.keys(h));a=dc(s,m,h)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(St,{variant:"subtle",className:V("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Lt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(xe,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ji=({children:e,...t})=>d.jsx("p",{...t,children:e}),Cc={q:Ji,blockquote:Ji};for(let e=1;e<=6;e++)Cc[`h${e}`]={component:Ji,props:{className:"title"}};const xc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:V("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Lt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:Cc},children:r}):d.jsx("p",{children:r})]});const wc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=oe.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[h,m]=C.useState("closed");C.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",p),()=>{f.removeEventListener("transitionend",p)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
|
|
36
|
+
`);c(f.length<3?`${a.substring(0,400)}...`:f.slice(0,3).join(`
|
|
37
|
+
`))},[a]),C.useEffect(()=>{h==="ready-to-close"&&m("closing")},[h]);const p=({propertyName:f})=>{f==="max-height"&&m(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(h);return d.jsxs(St,{variant:"subtle",className:V("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:V("content",h),children:[d.jsx(Lt,{options:{forceBlock:!0,...i},children:h==="closed"?u:a}),h!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(xe,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":g}),onClick:()=>{m(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const _h=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:V("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},h={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:h,children:d.jsx(Lt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Lt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:h,children:typeof l.text=="string"?d.jsx(Lt,{options:c,children:l.text}):l.text},u)})})},Xe=()=>C.Fragment,kh=({children:e})=>d.jsx(St,{variant:"secondary",children:e}),Bh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Ah=["span","strong","h1","h2","h3","h4","h5","h6","p"],Fh=({children:e})=>{const t=oe.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Ah.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Ra,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Th=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(St,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(St,{variant:"primary",children:e});case"pink-textbox":return d.jsx(St,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},Sh=e=>{const t=oe.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},To=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},jh=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||To(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&To(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(xe,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},Xi=({children:e,...t})=>d.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const Oh={default:{a:jh,CollapsibleSection:Ra,TextBox:St,CaseStudy:kh,style:Xe,details:Fh,div:Th,iframe:Sh,center:Bh},"text-only":{h1:Xe,h2:Xe,h3:Xe,h4:Xe,h5:Xe,h6:Xe,style:Xe,details:Xe,div:Xe,TextBox:Xe,CollapsibleSection:Xe,CaseStudy:Xe,blockquote:Xe,iframe:Xe,button:Xe}},zn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0,overrides:Oh[r]};return d.jsx("div",{className:V("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Lt,{options:{...s,...t},children:n})})};const Ec=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:V("page-heading",a),children:[d.jsxs("div",{className:V("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Rn=({size:e="medium",variant:t="default",className:n="",icon:r,children:a,...i})=>{const s={"--icon":`url(${zt}icons/${r}.svg)`};return d.jsx("span",{className:V("pill",e,t,n,{"has-icon":r}),style:s,...i,children:a})};const yr=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t);const Ph=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=oe.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:V(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Fs=C.memo(Ph);const ti="loadingBlock_",Nh=({progress:e=0,steps:t=!1,className:n=""})=>{const r=oe.useIntl();t||(t={0:{text:r.formatMessage({id:`${ti}loading`})},75:{text:r.formatMessage({id:`${ti}almostDone`})},100:{text:r.formatMessage({id:`${ti}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${zt}icons/${t[a].icon}.svg)`}:{};return d.jsxs(St,{className:V("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(Fs,{progress:e})]})},Rh=C.memo(Nh);const Ct=({element:e="div",className:t="",...n})=>d.jsx(Pa,{element:e,className:V("loading-placeholder",t),...n});const es={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},_c=(e,t)=>e in es?d.jsx("div",{className:e,children:es[e].map((n,r)=>_c(n,r))},t):d.jsx(Ct,{className:e},t),Ts=({layout:e="overview-page",...t})=>d.jsx("div",{className:V("loading-state",e),...t,children:es[e].map((n,r)=>_c(n,r))}),kc=e=>{const t=e&&e.toUpperCase().trim().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):""},Rr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Mh=e=>{const t=Math.ceil(26/Rr.length),n=kc(e).toLowerCase();if(n==="")return Rr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Rr.length;a++)if(r<=t*(a+1))return Rr[a]};const So=256,tn=({className:e="",src:t="",name:n,alt:r,width:a=So,height:i=So,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const h=u.current;if(!h)return;const m=h.getContext("2d");if(!m)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(h.width=p*window.devicePixelRatio,h.height=g*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=Mh(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(kc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:V("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Ss=e=>e==="apolitical"?{image:`${zt}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${zt}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},Ih=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=$n(l,r)),l};const Fr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl(),{size:l="medium"}=r,u=Ss(t);u.name||(u.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:c,image:h}=u;let{url:m}=u;t.link!==void 0&&(t.link===!1?m=void 0:m=t.link);const p=Ih(u),g=n&&n.createdAt?Gi(n.createdAt):!1,f=n&&n.createdAt?As(n.createdAt):"";return C.createElement(e,{className:V("member text-medium",l,s),children:d.jsxs(Dn,{href:m,gtmType:i,gtmContext:a,onClick:y=>{y==null||y.stopPropagation()},children:[d.jsx(tn,{name:c,src:h}),d.jsxs("p",{className:"details",children:[d.jsx("strong",{children:c}),n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&g&&d.jsx("span",{className:"date",title:f,"aria-label":f,children:o.formatMessage({id:`dates_${g.path}`},{number:g.number})}),n.didEdit&&d.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),p&&d.jsx("small",{className:V({"text-medium":l==="large"}),children:p})]})]})})};const jo={small:24,medium:48},js=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const h=oe.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:V("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((m,p)=>{let g,f="";if(p<o){const{name:y="",image:v=""}=Ss(m);if(s)return d.jsx(Ct,{element:"li",className:"contributor"},p);g=d.jsx(tn,{name:y,src:v,width:jo[a||"medium"],height:jo[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:V({"large-number":y>99}),children:["+",ph(y,0)]}),f="number-left"}return g?d.jsx("li",{className:V("contributor",f),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):$n(n[0].name||"",20):l||null})]})})};const Mr="emailHelperTextBox_",Bc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=oe.useIntl(),[i,s]=C.useState({path:`${Mr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=f=>{s({path:`${Mr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),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:f})};if(typeof r!="function"){g(a.formatMessage({id:`${Mr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(f=>{g(f.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=Mr,g="default",f={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",f={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",f={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:f,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(xc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(Ct,{element:"span"}),d.jsx(Ct,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Tn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),h=r||c;return C.createElement(t,{ref:h,...u,type:o,id:n,name:i,className:V(e,t,{"has-scrollbar":o==="textarea"&&h.current&&h.current.clientHeight<h.current.scrollHeight}),value:l,placeholder:s,...a,onChange:m=>{const p=m.target;a.onChange(p.value)}})};const En={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},$h=500,Lh=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},h]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},f]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=oe.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const E=setTimeout(()=>{g||h(_=>({..._,debouncedInput:l}))},$h);return()=>{clearTimeout(E)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const _=await o(c)||[];f(A=>({...A,predictions:_}))}catch(_){console.error("Error fetching predictions:",_),f(A=>({...A,predictions:[]}))}})():f(E=>({...E,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&h(E=>({...E,displayInput:m[p].description}))},[p,m]);const v=E=>{[En.DOWN,En.UP,En.ENTER].includes(E.key)&&(E.preventDefault(),E.key===En.DOWN&&p<m.length-1?f(_=>({..._,activePredictionIndex:p+1})):E.key===En.UP&&p>0?f(_=>({..._,activePredictionIndex:p-1})):E.key===En.ENTER&&p>-1&&(s(m[p].description),h(_=>({..._,input:m[p].description})),f(_=>({..._,predictions:[],isPredictionSelected:!0}))))},x=E=>{s(E.target.value),h(_=>({..._,input:E.target.value,displayInput:E.target.value})),f(_=>({..._,activePredictionIndex:-1,isPredictionSelected:!1}))},B=E=>{s(E.description),h(_=>({..._,input:E.description,displayInput:E.description})),f(_=>({..._,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:m.map((E,_)=>d.jsx("li",{onClick:()=>B(E),onMouseEnter:()=>f(A=>({...A,activePredictionIndex:_})),className:V("predictions-list-item",{active:_===p}),children:E.description},_))})]})};const Ac=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...h})=>{const m=oe.useIntl(),{onChange:p,...g}=r,f=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:v=>{const x=v.target;x.nodeName.toLowerCase()==="a"||x.parentNode&&x.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:V("checkbox-wrapper",e),...h,...g},y)};const zh=C.memo(function({direction:t="down"}){return d.jsx(Pa,{className:V("rotating-chevron",`direction-${t}`)})});const qh=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=oe.useIntl(),[h,m]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,y]=C.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},C.useEffect(()=>{y(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:B,...E}=a,_=S=>{if(o){let q=[];f!=null&&f.includes(S.id)?q=f.filter($=>$!==S.id):q=[...f,S.id],y([...q]),x&&x([...q])}else y([S]),x&&x(S.id),m(!1)},A=S=>{if(S==="all"){const q=(t==null?void 0:t.map($=>$.id))||[];y(q),x&&x(q)}else y([]),x&&x([])};return d.jsxs("div",{className:V("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),m(!h)},"data-testid":"dropdown-selector",...E,children:[o?`${s} · ${f.length}`:v.label,d.jsx(zh,{direction:h?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const q=t&&t.find($=>$.id===S.target.value);_(q)},hidden:!h,...E,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${f==null?void 0:f.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(xe,{variant:"tertiary",size:"small",onClick:()=>A("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(xe,{variant:"tertiary",size:"small",onClick:()=>A("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const q=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:V("gtm-trackable",{selected:q,"selected-single":q&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:$=>{$.preventDefault(),$.stopPropagation(),_(S)},role:"menuitem","aria-current":q,"data-testid":q?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:V({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(xe,{variant:"secondary",onClick:()=>{B&&B(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const Wh=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...h})=>{const m=oe.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...h,className:V("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:y=!1,value:v=f,disabled:x=!1})=>{const B=`${r}_${f}`,E=()=>{if(x)return;let _;if(i){const A=p==null?void 0:p.indexOf(v);Array.isArray(p)&&A>=0?(_=p,_.splice(A,1)):(!p||p.length===0?_=[]:_=p,_.push(v))}else _=g===v?void 0:v;t.onChange(_)};return d.jsx(Ac,{element:"li",id:B,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?p==null?void 0:p.includes(v):g===v,functions:{...t,onChange:E},intlPath:n,label:y||m.formatMessage({id:n?`${n}_${f}`:f}),disabled:x},B)})})};const Hh=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=oe.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),h=()=>{var m;l(!o),c(o?"password":"text"),(m=s.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:V("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:h,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Tn,{inputRef:s,type:u,...r})]})};const _n={text:{component:Tn},email:{component:Tn},url:{component:Tn},textarea:{component:Tn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ac},checkboxes:{component:Wh,props:{multiSelect:!0}},select:{component:qh},password:{component:Hh},autocomplete:{component:Lh}},Uh=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...h})=>{const m=oe.useIntl(),p=l&&l.some(({condition:_})=>_==="required"),g=(u==null?void 0:u.toString().length)||0,f=o&&_n[o]&&_n[o].component?_n[o].component:Tn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let v={...h,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:cn(a),value:u};i>0&&(v["data-character-limit"]=i,v.functions&&(v.functions.onChange=_=>{((_==null?void 0:_.toString().length)||0)>i&&(_=_==null?void 0:_.toString().slice(0,i)),a.onChange(_)})),o&&_n[o]&&_n[o].props&&(v={...v,..._n[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const x=h.label||m.formatMessage({id:t?`${t}_${e}`:e}),B=({..._})=>r?C.createElement(_.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",..._},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...v,label:x,className:V("field-wrapper",n)}),d.jsx(B,{as:"p"})]});const E=_=>C.createElement(_.element||"label",{..._,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:V("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(E,{...y,children:[x,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(f,{...v}),i>0?d.jsxs("small",{className:V("character-limit",{"near-limit":g>=.99*i,"approaching-limit":g>=.9*i&&g<.99*i}),children:[d.jsx("span",{className:"hidden",children:m.formatMessage({id:"form_fieldWrapper_characterLimit"})}),g," / ",i]}):null]}),d.jsx(B,{})]})},Vh=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?cn(e.errors):{},i=e.values?cn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,h=cn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:f=!1}=m.validation[p];let y=!1;if(typeof g=="function"){const v=g(i);v&&(y=f||v)}else{const v=i[m.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:m.id,value:y}}),h.push(m.id);break}}return h.length===0?l(i):u(i,h),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let ni=null;const Gn=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:h=()=>{},onCatch:m=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:f,hideButton:y,...v}=s,x=40,{shouldShowCancelButton:B=!1,shouldReset:E=!0,showRequiredLabels:_=!0,showSuccessMessage:A=!1}=l||{},S=oe.useIntl(),q={};t.length&&t.forEach(D=>{const z=D.id||D.name;z&&(q[z]=D.value||"")});const[$,j]=C.useReducer(Vh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:q}),{errors:N,isSubmitting:w,formSubmitted:F,values:R}=$;C.useEffect(()=>{E&&F&&(ni=setTimeout(()=>{j({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[F]),C.useEffect(()=>()=>{ni&&clearTimeout(ni)},[]),C.useEffect(()=>{const D=z=>{j({type:"updateValue",payload:{key:z.detail.id,value:z.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",D),()=>{document.removeEventListener("dropdownMultiSelectSubmit",D)}},[]);const M=C.useRef(null),Y=a||M;if(!t.length)return null;s.text||(s.text=S.formatMessage({id:"form_submit"}));const K=()=>{if(!w){if(j({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&j({type:"submitForm",payload:{fields:t,dispatch:j,intl:S}});return}j({type:"submitForm",payload:{fields:t,dispatch:j,onSuccess:async D=>{try{await c(D),j({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(z){m(z),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(D,z)=>{p(D,z),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},ne=[{...v,icon:F?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var k;if(D.preventDefault(),D.stopPropagation(),w)return;let z=0;if((k=Y==null?void 0:Y.current)!=null&&k.id){const T=document.getElementById(Y.current.id);T&&(z=T.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");J&&(z=z-J.offsetHeight-x),z<0&&(z=0),window.scrollTo({top:z,behavior:"smooth"}),K()},disabled:w||F||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||F?S.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return B&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:w||F,onClick:h,children:o.text||S.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:V("form",n),ref:Y},d.jsxs(d.Fragment,{children:[N!=null&&N.general?d.jsx(en,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,(!E||!w&&!F||f)&&t.map((D,z)=>{const{id:J=D.name||z,component:k,functions:T={onChange:()=>{}},submitOnEnter:L=!1}=D;if(k)return d.jsx(k,{...D.props||{}},`component-${J}-${z}`);const I=R?R[J]:"",U={...T,onChange:te=>{j({type:"updateValue",payload:{key:J,value:te}}),T.onChange(te&&te.toString(),j)}};return L&&(U.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),K()),T.onKeyDown&&T.onKeyDown(te)}),d.jsx(Uh,{intlPath:i,...D,showRequiredLabels:_,value:I,error:N==null?void 0:N[J],functions:U},J)}),y?null:(w||F)&&f?f:d.jsx(yn,{className:V("cta",{center:w||F,submitted:F}),buttons:ne})]})),A&&F&&d.jsx(yr,{className:"success",children:typeof A=="string"?A:S.formatMessage({id:"form_success"})})]})};const Ir="passwordRules_",Fc="isMoreThanEightCharacters",Tc="includesNumberAndSymbol",Sc="includesLowerAndUppercase",Kh={[Fc]:"8Characters",[Tc]:"numberSymbol",[Sc]:"lowercaseUppercase"},Zh=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=oe.useIntl();return d.jsxs("aside",{className:V("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Ir}intro`})}),d.jsx("ul",{children:[Fc,Tc,Sc].map(r=>d.jsxs("li",{className:V({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${Ir}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Ir}rule_${Kh[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${Ir}notMet`})]})]},`rule-${r}`))})]})},jc=C.memo(Zh);const Yh=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=oe.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(x=>({...x,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(x=>({...x,setUp:!0,disabled:!0})),a(v)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(Ct,{className:"rating-placeholder"});const{id:h,rating:m,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async v=>{if(!(!h||p))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:h,value:v})}catch(x){u(B=>({...B,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return d.jsxs("div",{className:V("rating",i),children:[d.jsx("span",{className:"label",children:f[m?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const x=v+1;return d.jsx("li",{className:V({selected:m&&x<=m}),children:d.jsx(xe,{variant:"tertiary",size:"small",icon:{icon:`star${!m||x>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:x,total:t})}${x===1||x===t?` - ${f[x===1?"low":"high"]}`:""}`,onClick:B=>{B.preventDefault(),B.stopPropagation(),y(x)},disabled:p})},`rating-${x}`)})})]})};var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});var Gh=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ri={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Oc={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Gh?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Os={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var $r=1;$r<20;$r++)Os["f"+$r]=111+$r;function Ma(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Pc(s,t)}),a=function(o){return r.some(function(l){return Nc(l,o)})},i=n==null?a:a(n);return i}function Qh(e,t){return Ma(e,t)}function Jh(e,t){return Ma(e,{byKey:!0},t)}function Pc(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ri)r[ri[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),h;!(o=(h=c.next()).done);o=!0){var m=h.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=Ps(m),f=ri[g];if(m.length>1&&!f&&!Oc[m]&&!Os[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!f)&&(n?r.key=g:r.which=Rc(m)),f&&(r[f]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Nc(e,t){for(var n in e){var r=e[n],a=void 0;if(r!=null&&(n==="key"&&t.key!=null?a=t.key.toLowerCase():n==="which"?a=r===91&&t.which===93?91:t.which:a=t[n],!(a==null&&r===!1)&&a!==r))return!1}return!0}function Rc(e){e=Ps(e);var t=Os[e]||e.toUpperCase().charCodeAt(0);return t}function Ps(e){return e=e.toLowerCase(),e=Oc[e]||e,e}var Xh=Wt.default=Ma,ai=Wt.isHotkey=Ma;Wt.isCodeHotkey=Qh;Wt.isKeyHotkey=Jh;Wt.parseHotkey=Pc;Wt.compareHotkey=Nc;Wt.toKeyCode=Rc;Wt.toKeyName=Ps;function em(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function ts(e,t){return Array(t+1).join(e)}function tm(e){return e.replace(/^\n*/,"")}function nm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
|
+
`;)t--;return e.substring(0,t)}var rm=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Ns(e){return Rs(e,rm)}var Mc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Ic(e){return Rs(e,Mc)}function am(e){return Lc(e,Mc)}var $c=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function im(e){return Rs(e,$c)}function sm(e){return Lc(e,$c)}function Rs(e,t){return t.indexOf(e.nodeName)>=0}function Lc(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var et={};et.paragraph={filter:"p",replacement:function(e){return`
|
|
39
|
+
|
|
40
|
+
`+e+`
|
|
41
|
+
|
|
42
|
+
`}};et.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
|
|
43
|
+
`}};et.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=ts(r===1?"=":"-",e.length);return`
|
|
44
|
+
|
|
45
|
+
`+e+`
|
|
46
|
+
`+a+`
|
|
47
|
+
|
|
48
|
+
`}else return`
|
|
49
|
+
|
|
50
|
+
`+ts("#",r)+" "+e+`
|
|
51
|
+
|
|
52
|
+
`}};et.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
|
|
53
|
+
|
|
54
|
+
`+e+`
|
|
55
|
+
|
|
56
|
+
`}};et.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
|
|
57
|
+
`+e:`
|
|
58
|
+
|
|
59
|
+
`+e+`
|
|
60
|
+
|
|
61
|
+
`}};et.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
|
|
62
|
+
`).replace(/\n/gm,`
|
|
63
|
+
`);var r=n.bulletListMarker+" ",a=t.parentNode;if(a.nodeName==="OL"){var i=a.getAttribute("start"),s=Array.prototype.indexOf.call(a.children,t);r=(i?Number(i)+s:s+1)+". "}return r+e+(t.nextSibling&&!/\n$/.test(e)?`
|
|
64
|
+
`:"")}};et.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
|
|
65
|
+
|
|
66
|
+
`+t.firstChild.textContent.replace(/\n/g,`
|
|
67
|
+
`)+`
|
|
68
|
+
|
|
69
|
+
`}};et.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var c=ts(s,o);return`
|
|
70
|
+
|
|
71
|
+
`+c+a+`
|
|
72
|
+
`+i.replace(/\n$/,"")+`
|
|
73
|
+
`+c+`
|
|
74
|
+
|
|
75
|
+
`}};et.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
|
|
76
|
+
|
|
77
|
+
`+n.hr+`
|
|
78
|
+
|
|
79
|
+
`}};et.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=ma(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};et.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=ma(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
|
|
80
|
+
|
|
81
|
+
`+this.references.join(`
|
|
82
|
+
`)+`
|
|
83
|
+
|
|
84
|
+
`,this.references=[]),t}};et.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};et.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};et.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};et.image={filter:"img",replacement:function(e,t){var n=ma(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ma(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"":""}};function ma(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
85
|
+
`):""}function zc(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}zc.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ii(this.array,e,this.options))||(t=ii(this._keep,e,this.options))||(t=ii(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ii(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(om(a,t,n))return a}}function om(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function um(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Oo(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=si(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=si(l);continue}var c=Oo(o,l,a);o=l,l=c}i&&(i.data=i.data.replace(/ $/,""),i.data||si(i))}}function si(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Oo(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Ms=typeof window<"u"?window:{};function lm(){var e=Ms.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function cm(){var e=function(){};return dm()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function dm(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Ms.ActiveXObject&&(e=!0)}return e}var fm=lm()?Ms.DOMParser:cm();function hm(e,t){var n;if(typeof e=="string"){var r=mm().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return um({element:n,isBlock:Ns,isVoid:Ic,isPre:t.preformattedCode?pm:null}),n}var oi;function mm(){return oi=oi||new fm,oi}function pm(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function gm(e,t){return e.isBlock=Ns(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=vm(e),e.flankingWhitespace=bm(e,t),e}function vm(e){return!Ic(e)&&!im(e)&&/^\s*$/i.test(e.textContent)&&!am(e)&&!sm(e)}function bm(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=ym(e.textContent);return n.leadingAscii&&Po("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Po("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function ym(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Po(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Ns(r)&&(i=a.test(r.textContent))),i}var Dm=Array.prototype.reduce,Cm=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function pa(e){if(!(this instanceof pa))return new pa(e);var t={rules:et,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
|
|
86
|
+
|
|
87
|
+
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
88
|
+
|
|
89
|
+
`+r.outerHTML+`
|
|
90
|
+
|
|
91
|
+
`:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?`
|
|
92
|
+
|
|
93
|
+
`+n+`
|
|
94
|
+
|
|
95
|
+
`:n}};this.options=em({},t,e),this.rules=new zc(this.options)}pa.prototype={turndown:function(e){if(!Em(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=qc.call(this,new hm(e,this.options));return xm.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return Cm.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function qc(e){var t=this;return Dm.call(e.childNodes,function(n,r){r=new gm(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=wm.call(t,r)),Wc(n,a)},"")}function xm(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Wc(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function wm(e){var t=this.rules.forNode(e),n=qc.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function Wc(e,t){var n=nm(e),r=tm(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
|
|
96
|
+
|
|
97
|
+
`.substring(0,a);return n+i+r}function Em(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
|
|
98
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
99
|
+
*
|
|
100
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
101
|
+
* Released under the MIT License.
|
|
102
|
+
*/function No(e){return Object.prototype.toString.call(e)==="[object Object]"}function Je(e){var t,n;return No(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(No(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Hc=Symbol.for("immer-nothing"),Ro=Symbol.for("immer-draftable"),mt=Symbol.for("immer-state"),_m=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function lt(e,...t){if(process.env.NODE_ENV!=="production"){const n=_m[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qn=Object.getPrototypeOf;function mn(e){return!!e&&!!e[mt]}function pn(e){var t;return e?Uc(e)||Array.isArray(e)||!!e[Ro]||!!((t=e.constructor)!=null&&t[Ro])||$a(e)||La(e):!1}var km=Object.prototype.constructor.toString();function Uc(e){if(!e||typeof e!="object")return!1;const t=qn(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===km}function ga(e,t){Ia(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ia(e){const t=e[mt];return t?t.type_:Array.isArray(e)?1:$a(e)?2:La(e)?3:0}function ns(e,t){return Ia(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Vc(e,t,n){const r=Ia(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Bm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function $a(e){return e instanceof Map}function La(e){return e instanceof Set}function sn(e){return e.copy_||e.base_}function rs(e,t){if($a(e))return new Map(e);if(La(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Uc(e))return qn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[mt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(qn(e),n)}function Is(e,t=!1){return za(e)||mn(e)||!pn(e)||(Ia(e)>1&&(e.set=e.add=e.clear=e.delete=Am),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Is(r,!0))),e}function Am(){lt(2)}function za(e){return Object.isFrozen(e)}var Fm={};function gn(e){const t=Fm[e];return t||lt(0,e),t}var Dr;function Kc(){return Dr}function Tm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Mo(e,t){t&&(gn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function as(e){is(e),e.drafts_.forEach(Sm),e.drafts_=null}function is(e){e===Dr&&(Dr=e.parent_)}function Io(e){return Dr=Tm(Dr,e)}function Sm(e){const t=e[mt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $o(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[mt].modified_&&(as(t),lt(4)),pn(e)&&(e=va(t,e),t.parent_||ba(t,e)),t.patches_&&gn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=va(t,n,[]),as(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Hc?e:void 0}function va(e,t,n){if(za(t))return t;const r=t[mt];if(!r)return ga(t,(a,i)=>Lo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return ba(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),ga(i,(o,l)=>Lo(e,r,a,o,l,n,s)),ba(e,a,!1),n&&e.patches_&&gn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Lo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&<(5),mn(a)){const o=i&&t&&t.type_!==3&&!ns(t.assigned_,r)?i.concat(r):void 0,l=va(e,a,o);if(Vc(n,r,l),mn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(pn(a)&&!za(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;va(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&ba(e,a)}}function ba(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Is(t,n)}function jm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Kc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=$s;n&&(a=[r],i=Cr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var $s={get(e,t){if(t===mt)return e;const n=sn(e);if(!ns(n,t))return Om(e,n,t);const r=n[t];return e.finalized_||!pn(r)?r:r===ui(e.base_,t)?(li(e),e.copy_[t]=os(r,e)):r},has(e,t){return t in sn(e)},ownKeys(e){return Reflect.ownKeys(sn(e))},set(e,t,n){const r=Zc(sn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ui(sn(e),t),i=a==null?void 0:a[mt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Bm(n,a)&&(n!==void 0||ns(e.base_,t)))return!0;li(e),ss(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return ui(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,li(e),ss(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=sn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){lt(11)},getPrototypeOf(e){return qn(e.base_)},setPrototypeOf(){lt(12)}},Cr={};ga($s,(e,t)=>{Cr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Cr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&<(13),Cr.set.call(this,e,t,void 0)};Cr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&<(14),$s.set.call(this,e[0],t,n,e[0])};function ui(e,t){const n=e[mt];return(n?sn(n):e)[t]}function Om(e,t,n){var a;const r=Zc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Zc(e,t){if(!(t in e))return;let n=qn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=qn(n)}}function ss(e){e.modified_||(e.modified_=!0,e.parent_&&ss(e.parent_))}function li(e){e.copy_||(e.copy_=rs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Pm=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&<(6),r!==void 0&&typeof r!="function"&<(7);let a;if(pn(t)){const i=Io(this),s=os(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?as(i):is(i)}return Mo(i,r),$o(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Hc&&(a=void 0),this.autoFreeze_&&Is(a,!0),r){const i=[],s=[];gn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else lt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){pn(e)||lt(8),mn(e)&&(e=Nm(e));const t=Io(this),n=os(e,void 0);return n[mt].isManual_=!0,is(t),n}finishDraft(e,t){const n=e&&e[mt];(!n||!n.isManual_)&<(9);const{scope_:r}=n;return Mo(r,t),$o(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=gn("Patches").applyPatches_;return mn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function os(e,t){const n=$a(e)?gn("MapSet").proxyMap_(e,t):La(e)?gn("MapSet").proxySet_(e,t):jm(e,t);return(t?t.scope_:Kc()).drafts_.push(n),n}function Nm(e){return mn(e)||lt(10,e),Yc(e)}function Yc(e){if(!pn(e)||za(e))return e;const t=e[mt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=rs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=rs(e,!0);return ga(n,(r,a)=>{Vc(n,r,Yc(a))}),t&&(t.finalized_=!1),n}var pt=new Pm,Ls=pt.produce;pt.produceWithPatches.bind(pt);pt.setAutoFreeze.bind(pt);pt.setUseStrictShallowCopy.bind(pt);pt.applyPatches.bind(pt);var zo=pt.createDraft.bind(pt),qo=pt.finishDraft.bind(pt),Rm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=P.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Mm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ce.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Im={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=W.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ya=new WeakMap,Da=new WeakMap,dr=new WeakMap,Gc=new WeakMap,Wo=new WeakMap,Ho=new WeakMap,Uo=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:h,newPath:m}=t;if(P.equals(h,m))return r;if(P.isAncestor(h,r)||P.equals(h,r)){var p=m.slice();return P.endsBefore(h,m)&&h.length<m.length&&(p[h.length-1]-=1),p.concat(r.slice(h.length))}else P.isSibling(h,m)&&(P.isAncestor(m,r)||P.equals(m,r))?P.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:P.endsBefore(m,r)||P.equals(m,r)||P.isAncestor(m,r)?(P.endsBefore(h,r)&&(r[h.length-1]-=1),r[m.length-1]+=1):P.endsBefore(h,r)&&(P.equals(m,r)&&(r[m.length-1]+=1),r[h.length-1]-=1);break}}return r}};function xr(e){"@babel/helpers - typeof";return xr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xr(e)}function $m(e,t){if(xr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(xr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lm(e){var t=$m(e,"string");return xr(t)==="symbol"?t:String(t)}function it(e,t,n){return t=Lm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function nr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var zm=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ie.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of W.points(t))t[l]=Ce.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:h}=n;if(h.length===0)break;var m=ie.leaf(e,u),p=m.text.slice(0,c),g=m.text.slice(c);if(m.text=p+h+g,t)for(var[f,y]of W.points(t))t[y]=Ce.transform(f,n);break}case"merge_node":{var{path:v}=n,x=ie.get(e,v),B=P.previous(v),E=ie.get(e,B),_=ie.parent(e,v),A=v[v.length-1];if(de.isText(x)&&de.isText(E))E.text+=x.text;else if(!de.isText(x)&&!de.isText(E))E.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Ye.stringify(x)," ").concat(Ye.stringify(E)));if(_.children.splice(A,1),t)for(var[S,q]of W.points(t))t[q]=Ce.transform(S,n);break}case"move_node":{var{path:$,newPath:j}=n;if(P.isAncestor($,j))throw new Error("Cannot move a path [".concat($,"] to new path [").concat(j,"] because the destination is inside itself."));var N=ie.get(e,$),w=ie.parent(e,$),F=$[$.length-1];w.children.splice(F,1);var R=P.transform($,n),M=ie.get(e,P.parent(R)),Y=R[R.length-1];if(M.children.splice(Y,0,N),t)for(var[K,se]of W.points(t))t[se]=Ce.transform(K,n);break}case"remove_node":{var{path:ne}=n,D=ne[ne.length-1],z=ie.parent(e,ne);if(z.children.splice(D,1),t)for(var[J,k]of W.points(t)){var T=Ce.transform(J,n);if(t!=null&&T!=null)t[k]=T;else{var L=void 0,I=void 0;for(var[U,te]of ie.texts(e))if(P.compare(te,ne)===-1)L=[U,te];else{I=[U,te];break}var ee=!1;L&&I&&(P.equals(I[1],ne)?ee=!P.hasPrevious(I[1]):ee=P.common(L[1],ne).length<P.common(I[1],ne).length),L&&!ee?(J.path=L[1],J.offset=L[0].text.length):I?(J.path=I[1],J.offset=0):t=null}}break}case"remove_text":{var{path:Z,offset:ue,text:Q}=n;if(Q.length===0)break;var ge=ie.leaf(e,Z),me=ge.text.slice(0,ue),_e=ge.text.slice(ue+Q.length);if(ge.text=me+_e,t)for(var[Se,Pe]of W.points(t))t[Pe]=Ce.transform(Se,n);break}case"set_node":{var{path:Ge,properties:Ke,newProperties:Ze}=n;if(Ge.length===0)throw new Error("Cannot set properties on the root node!");var tt=ie.get(e,Ge);for(var Ae in Ze){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var We=Ze[Ae];We==null?delete tt[Ae]:tt[Ae]=We}for(var Le in Ke)Ze.hasOwnProperty(Le)||delete tt[Le];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!W.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ye.stringify(H)," when there is no current selection."));t=nr({},H)}for(var ae in H){var fe=H[ae];if(fe==null){if(ae==="anchor"||ae==="focus")throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=fe}}break}case"split_node":{var{path:pe,position:De,properties:Ue}=n;if(pe.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(pe,"] because the root node cannot be split."));var Ve=ie.get(e,pe),ft=ie.parent(e,pe),Pt=pe[pe.length-1],xt;if(de.isText(Ve)){var Qe=Ve.text.slice(0,De),_t=Ve.text.slice(De);Ve.text=Qe,xt=nr(nr({},Ue),{},{text:_t})}else{var ht=Ve.children.slice(0,De),Ga=Ve.children.slice(De);Ve.children=ht,xt=nr(nr({},Ue),{},{children:Ga})}if(ft.children.splice(Pt+1,0,xt),t)for(var[Xn,Pr]of W.points(t))t[Pr]=Ce.transform(Xn,n);break}}return t},qm={transform(e,t){e.children=zo(e.children);var n=e.selection&&zo(e.selection);try{n=zm(e,n,t)}finally{e.children=qo(e.children),n?e.selection=mn(n)?qo(n):n:e.selection=null}}},Wm={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Hm={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Qc=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!Qc(r,a))return!1}else if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==a[i])return!1}else if(r!==a)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function Um(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function qt(e,t){if(e==null)return{};var n=Um(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var Vm=["anchor","focus"];function Ko(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Km(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ko(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ko(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var W={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return W.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=W.edges(e);return t},equals(e,t){return Ce.equals(e.anchor,t.anchor)&&Ce.equals(e.focus,t.focus)},includes(e,t){if(W.isRange(t)){if(W.includes(e,t.anchor)||W.includes(e,t.focus))return!0;var[n,r]=W.edges(e),[a,i]=W.edges(t);return Ce.isBefore(n,a)&&Ce.isAfter(r,i)}var[s,o]=W.edges(e),l=!1,u=!1;return Ce.isPoint(t)?(l=Ce.compare(t,s)>=0,u=Ce.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=qt(e,Vm),[r,a]=W.edges(e),[i,s]=W.edges(t),o=Ce.isBefore(r,i)?i:r,l=Ce.isBefore(a,s)?a:s;return Ce.isBefore(l,o)?null:Km({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ce.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ce.equals(t,n)},isExpanded(e){return!W.isCollapsed(e)},isForward(e){return!W.isBackward(e)},isRange(e){return Je(e)&&Ce.isPoint(e.anchor)&&Ce.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=W.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ls(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=W.isCollapsed(r);W.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?W.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ce.transform(r.anchor,t,{affinity:i}),u=Ce.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Zo=e=>Je(e)&&ie.isNodeList(e.children)&&!b.isEditor(e),ce={isAncestor(e){return Je(e)&&ie.isNodeList(e.children)},isElement:Zo,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return Zo(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Zm=["children"],Ym=["text"],Yo=new WeakMap,ie={ancestor(e,t){var n=ie.get(e,t);if(de.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Ye.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=ie.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(de.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Ye.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ye.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=ie.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ie.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=ie.get(e,r);return[a,r]},descendant(e,t){var n=ie.get(e,t);if(b.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ye.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=qt(e,Zm);return t}else{var t=qt(e,Ym);return t}},first(e,t){for(var n=t.slice(),r=ie.get(e,n);r&&!(de.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(de.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Ye.stringify(e)));var n=Ls({children:e.children},r=>{var[a,i]=W.edges(t),s=ie.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!W.includes(t,p)}});for(var[,o]of s){if(!W.includes(t,o)){var l=ie.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=ie.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.equals(o,a.path)){var h=ie.leaf(r,o);h.text=h.text.slice(a.offset)}}b.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Ye.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return de.isText(e)||ce.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Yo.get(e);if(t!==void 0)return t;var n=e.every(r=>ie.isNode(r));return Yo.set(e,n),n},last(e,t){for(var n=t.slice(),r=ie.get(e,n);r&&!(de.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=ie.get(e,t);if(!de.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Ye.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=ie.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||de.isText(e)&&de.isTextProps(t)&&de.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!de.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ie.get(e,o);continue}if(o.length===0)break;if(!r){var c=P.next(o);if(ie.has(e,c)){o=c,l=ie.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=P.previous(o);o=h,l=ie.get(e,o);continue}o=P.parent(o),l=ie.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ie.get(e,n);if(de.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return de.isText(e)?e.text:e.children.map(ie.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function Go(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Go(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Go(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yt={isNodeOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!Je(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ie.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&Je(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ie.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&Je(e.properties)&&Je(e.newProperties);case"set_selection":return e.properties===null&&W.isRange(e.newProperties)||e.newProperties===null&&W.isRange(e.properties)||Je(e.properties)&&Je(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&Je(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Yt.isOperation(t))},isSelectionOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Re(Re({},e),{},{type:"remove_node"});case"insert_text":return Re(Re({},e),{},{type:"remove_text"});case"merge_node":return Re(Re({},e),{},{type:"split_node",path:P.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(P.equals(t,n))return e;if(P.isSibling(n,t))return Re(Re({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Re(Re({},e),{},{path:r,newPath:a})}case"remove_node":return Re(Re({},e),{},{type:"insert_node"});case"remove_text":return Re(Re({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Re(Re({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Re(Re({},e),{},{properties:l,newProperties:null}):l==null?Re(Re({},e),{},{properties:null,newProperties:o}):Re(Re({},e),{},{properties:l,newProperties:o})}case"split_node":return Re(Re({},e),{},{type:"merge_node",path:P.next(e.path)})}}},Qo=new WeakMap,Gm=e=>{var t=Qo.get(e);if(t!==void 0)return t;if(!Je(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||Je(e.marks))&&(e.selection===null||W.isRange(e.selection))&&ie.isNodeList(e.children)&&Yt.isOperationList(e.operations);return Qo.set(e,n),n},b={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return Gm(e)},isElementReadOnly(e,t){return e.isElementReadOnly(t)},isEmpty(e,t){return e.isEmpty(t)},isEnd(e,t,n){return e.isEnd(t,n)},isInline(e,t){return e.isInline(t)},isNormalizing(e){return e.isNormalizing()},isSelectable(e,t){return e.isSelectable(t)},isStart(e,t,n){return e.isStart(t,n)},isVoid(e,t){return e.isVoid(t)},last(e,t){return e.last(t)},leaf(e,t,n){return e.leaf(t,n)},levels(e,t){return e.levels(t)},marks(e){return e.getMarks()},next(e,t){return e.next(t)},node(e,t,n){return e.node(t,n)},nodes(e,t){return e.nodes(t)},normalize(e,t){e.normalize(t)},parent(e,t,n){return e.parent(t,n)},path(e,t,n){return e.path(t,n)},pathRef(e,t,n){return e.pathRef(t,n)},pathRefs(e){return e.pathRefs()},point(e,t,n){return e.point(t,n)},pointRef(e,t,n){return e.pointRef(t,n)},pointRefs(e){return e.pointRefs()},positions(e,t){return e.positions(t)},previous(e,t){return e.previous(t)},range(e,t,n){return e.range(t,n)},rangeRef(e,t,n){return e.rangeRef(t,n)},rangeRefs(e){return e.rangeRefs()},removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start(e,t){return e.start(t)},string(e,t,n){return e.string(t,n)},unhangRange(e,t,n){return e.unhangRange(t,n)},void(e,t){return e.void(t)},withoutNormalizing(e,t){e.withoutNormalizing(t)}},Qm={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function Jo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ce={compare(e,t){var n=P.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ce.compare(e,t)===1},isBefore(e,t){return Ce.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return Je(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ls(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=P.transform(i,t,n);break}case"insert_text":{P.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{P.equals(t.path,i)&&(r.offset+=t.position),r.path=P.transform(i,t,n);break}case"remove_text":{P.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(P.equals(t.path,i)||P.isAncestor(t.path,i))return null;r.path=P.transform(i,t,n);break}case"split_node":{if(P.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=P.transform(i,t,Xo(Xo({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},eu=void 0,Ye={setScrubber(e){eu=e},stringify(e){return JSON.stringify(e,eu)}},Jm=["text"],Xm=["anchor","focus"];function tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Rt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var de={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=qt(i,Jm);return s}return Qc(r?a(e):e,r?a(t):t)},isText(e){return Je(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>de.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[Rt({},e)];for(var r of t){var a=qt(r,Xm),[i,s]=W.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var h of n){var{length:m}=h.text,p=l;if(l+=m,u<=p&&l<=c){Object.assign(h,a),o.push(h);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(h);continue}var g=h,f=void 0,y=void 0;if(c<l){var v=c-p;y=Rt(Rt({},g),{},{text:g.text.slice(v)}),g=Rt(Rt({},g),{},{text:g.text.slice(0,v)})}if(u>p){var x=u-p;f=Rt(Rt({},g),{},{text:g.text.slice(0,x)}),g=Rt(Rt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),f&&o.push(f),o.push(g),y&&o.push(y)}n=o}return n}},zs=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],Qn=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},qs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?ip(t):t,i=ye.None,s=ye.None,o=0,l=null,u=null;for(var c of a){var h=c.codePointAt(0);if(!h)break;var m=vp(c,h);if([i,s]=r?[s,m]:[m,i],Sn(i,ye.ZWJ)&&Sn(s,ye.ExtPict)&&(r?l=nu(t.substring(0,o)):l=nu(t.substring(0,t.length-o)),!l)||Sn(i,ye.RI)&&Sn(s,ye.RI)&&(u!==null?u=!u:r?u=!0:u=xp(t.substring(0,t.length-o)),!u)||i!==ye.None&&s!==ye.None&&yp(i,s))break;o+=c.length}return o||1},ep=/\s/,tp=/[\u002B\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/,np=/['\u2018\u2019]/,rp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=qs(t,n),[s,o]=Ws(t,i,n);if(ap(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Ws=(e,t,n)=>{if(n){var r=e.length-t;return[e.slice(r,e.length),e.slice(0,r)]}return[e.slice(0,t),e.slice(t)]},ap=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(ep.test(t))return!1;if(np.test(t)){var a=qs(n,r),[i,s]=Ws(n,a,r);if(e(i,s,r))return!0}return!tp.test(t)},ip=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(op(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(sp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},sp=e=>e>=55296&&e<=56319,op=e=>e>=56320&&e<=57343,ye;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(ye||(ye={}));var up=/^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/,lp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,cp=/^(?:[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BF\u09C0\u09C7\u09C8\u09CB\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0\u0CC1\u0CC3\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0D02\u0D03\u0D3F\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82\u0D83\u0DD0\u0DD1\u0DD8-\u0DDE\u0DF2\u0DF3\u0E33\u0EB3\u0F3E\u0F3F\u0F7F\u1031\u103B\u103C\u1056\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF7\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC]|\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD45\uDD46\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDDCE\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB1\uDCB2\uDCB9\uDCBB\uDCBC\uDCBE\uDCC1\uDDB0\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF26]|\uD806[\uDC2C-\uDC2E\uDC38\uDD31-\uDD35\uDD37\uDD38\uDD3D\uDD40\uDD42\uDDD1-\uDDD3\uDDDC-\uDDDF\uDDE4\uDE39\uDE57\uDE58\uDE97]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4\uDD8A-\uDD8E\uDD93\uDD94\uDD96\uDEF5\uDEF6]|\uD81B[\uDF51-\uDF87\uDFF0\uDFF1]|\uD834[\uDD66\uDD6D])$/,dp=/^[\u1100-\u115F\uA960-\uA97C]$/,fp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,hp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,mp=/^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/,pp=/^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\uC2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/,gp=/^(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])$/,vp=(e,t)=>{var n=ye.Any;return e.search(up)!==-1&&(n|=ye.Extend),t===8205&&(n|=ye.ZWJ),t>=127462&&t<=127487&&(n|=ye.RI),e.search(lp)!==-1&&(n|=ye.Prepend),e.search(cp)!==-1&&(n|=ye.SpacingMark),e.search(dp)!==-1&&(n|=ye.L),e.search(fp)!==-1&&(n|=ye.V),e.search(hp)!==-1&&(n|=ye.T),e.search(mp)!==-1&&(n|=ye.LV),e.search(pp)!==-1&&(n|=ye.LVT),e.search(gp)!==-1&&(n|=ye.ExtPict),n};function Sn(e,t){return(e&t)!==0}var bp=[[ye.L,ye.L|ye.V|ye.LV|ye.LVT],[ye.LV|ye.V,ye.V|ye.T],[ye.LVT|ye.T,ye.T],[ye.Any,ye.Extend|ye.ZWJ],[ye.Any,ye.SpacingMark],[ye.Prepend,ye.Any],[ye.ZWJ,ye.ExtPict],[ye.RI,ye.RI]];function yp(e,t){return bp.findIndex(n=>Sn(e,n[0])&&Sn(t,n[1]))===-1}var Dp=/(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$/,nu=e=>e.search(Dp)!==-1,Cp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,xp=e=>{var t=e.match(Cp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},wp={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=zs(e)}=n;if(P.isPath(a)&&(a=b.range(e,a)),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var i=W.end(a);if(!r&&b.void(e,{at:i}))return;var s=W.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:h,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:m,text:t})}})}};function ru(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Lr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ru(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ru(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=Lr(Lr(Lr(Lr({},qm),Wm),Hm),wp),aa=new WeakMap,Ep=e=>aa.get(e)||!1,_p=(e,t,n)=>{var r=aa.get(e)||!1;aa.set(e,!0);try{t(),n()}finally{aa.set(e,r)}};function Jc(e,t,n){var r=ya.get(e)||[],a=Da.get(e)||new Set,i,s,o=h=>{if(h){var m=h.join(",");s.has(m)||(s.add(m),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);ya.set(e,i),Da.set(e,s)}var kp=(e,t)=>{for(var n of b.pathRefs(e))Rm.transform(n,t);for(var r of b.pointRefs(e))Mm.transform(r,t);for(var a of b.rangeRefs(e))Im.transform(a,t);if(!Ep(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;Jc(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),dr.get(e)||(dr.set(e,!0),Promise.resolve().then(()=>{dr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Bp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=de.isText(r)?[]:Array.from(ie.nodes(r),j=>{var[,N]=j;return a.concat(N)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:h}=t;if(P.equals(c,h))return[];var m=[],p=[];for(var g of P.ancestors(c)){var f=P.transform(g,t);m.push(f)}for(var y of P.ancestors(h)){var v=P.transform(y,t);p.push(v)}var x=p[p.length-1],B=h[h.length-1],E=x.concat(B);return[...m,...p,E]}case"remove_node":{var{path:_}=t,A=P.ancestors(_);return[...A]}case"split_node":{var{path:S}=t,q=P.levels(S),$=P.next(S);return[...q,$]}default:return[]}},Ap=e=>{var{selection:t}=e;return t?ie.fragment(e,t):[]},Fp=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||de.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ie.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],h=o===n.children.length-1,m=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(m!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!de.isText(c)){var p={text:""};X.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Tp=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,a=r*42;if(n>a)throw new Error("Could not completely normalize the editor after ".concat(a," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},Sp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=b.path(t,i),l=a==="lowest";for(var[u,c]of b.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(W.isRange(i)){if(P.isAncestor(c,i.anchor.path)&&P.isAncestor(c,i.focus.path))return[u,c]}else if(!P.equals(o,c))return[u,c]}}};function au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function iu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?au(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var jp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,m)=>{if(!de.isText(h))return!1;var[p,g]=b.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=W.isExpanded(r),s=!1;if(!i){var[o,l]=b.node(e,r);if(o&&a(o,l)){var[u]=b.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=iu(iu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,dr.get(e)||e.onChange()}}};function su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ou(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?su(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Op=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.point(t,n,{edge:"end"}),i=b.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,ou(ou({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function uu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function lu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Pp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.start(t,[]),i=b.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,lu(lu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},Np=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Rp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&X.delete(e,{unit:t})},Mp=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&W.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Ip=(e,t)=>[b.start(e,t),b.end(e,t)];function cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var $p=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,du(du({},n),{},{match:r=>ce.isElement(r)&&b.isElementReadOnly(t,r)}))},Lp=(e,t)=>b.point(e,t,{edge:"end"}),zp=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},qp=(e,t)=>{var n=b.range(e,t);return ie.fragment(e,n)};function fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Wp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,hu(hu({},n),{},{match:r=>ce.isElement(r)&&b.isVoid(t,r)}))},Hp=(e,t)=>t.children.some(n=>ce.isElement(n)&&b.isBlock(e,n)),Up=(e,t)=>t.children.some(n=>de.isText(n)||b.isInline(e,n)),Vp=(e,t)=>ie.has(e,t),Kp=(e,t)=>t.children.every(n=>de.isText(n)),Zp=e=>{X.splitNodes(e,{always:!0})},Yp=(e,t,n)=>{X.insertNodes(e,t,n)},Gp=e=>{X.splitNodes(e,{always:!0})};function mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Qp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Jp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a,marks:i}=t;if(a){if(i){var s=Qp({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},Xp=(e,t)=>!e.isInline(t),eg=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),tg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},ng=(e,t,n)=>{var r=b.end(e,n);return Ce.equals(t,r)},rg=e=>{var t=Gc.get(e);return t===void 0?!0:t},ag=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return Ce.equals(t,r)},ig=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},sg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=ie.leaf(t,a);return[i,a]};function og(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=b.path(e,n);for(var[l,u]of ie.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var ug=["text"],lg=["text"],cg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(W.isExpanded(r)){var s=b.isEnd(t,a,a.path);if(s){var o=b.after(t,a);o&&(a=o)}var[l]=b.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=qt(u,ug);return c}else return{}}var{path:h}=a,[m]=b.leaf(t,h);if(a.offset===0){var p=b.previous(t,{at:h,match:de.isText}),g=b.above(t,{match:E=>ce.isElement(E)&&b.isVoid(t,E)&&t.markableVoid(E)});if(!g){var f=b.above(t,{match:E=>ce.isElement(E)&&b.isBlock(t,E)});if(p&&f){var[y,v]=p,[,x]=f;P.isAncestor(x,v)&&(m=y)}}}var B=qt(m,lg);return B},dg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.after(t,s,{voids:a});if(o){var[,l]=b.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[h]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},fg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=ie.get(t,a);return[i,a]};function hg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(Qm.isSpan(n))u=n[0],c=n[1];else{var h=b.path(e,n,{edge:"start"}),m=b.path(e,n,{edge:"end"});u=i?m:h,c=i?h:m}var p=ie.nodes(e,{reverse:i,from:u,to:c,pass:E=>{var[_]=E;return ce.isElement(_)?!!(!s&&(b.isVoid(e,_)||b.isElementReadOnly(e,_))||o&&!b.isSelectable(e,_)):!1}}),g=[],f;for(var[y,v]of p)if(!(o&&ce.isElement(y)&&!b.isSelectable(e,y))){var x=f&&P.compare(v,f[1])===0;if(!(r==="highest"&&x)){if(!l(y,v)){if(a&&!x&&de.isText(y))return;continue}if(r==="lowest"&&x){f=[y,v];continue}var B=r==="lowest"?f:[y,v];B&&(a?g.push(B):yield B),f=[y,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var mg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>ya.get(c)||[],s=c=>Da.get(c)||new Set,o=c=>{var h=i(c).pop(),m=h.join(",");return s(c).delete(m),h};if(b.isNormalizing(t)){if(r){var l=Array.from(ie.nodes(t),c=>{var[,h]=c;return h}),u=new Set(l.map(c=>c.join(",")));ya.set(t,l),Da.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(ie.has(t,c)){var h=b.node(t,c),[m,p]=h;ce.isElement(m)&&m.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(ie.has(t,v)){var x=b.node(t,v);t.normalizeNode(x,{operation:a})}y++,g=i(t)}})}},pg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=P.parent(a),s=b.node(t,i);return s},gg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pathRefs(t);return l.delete(i),i.current=null,o}},s=b.pathRefs(t);return s.add(i),i},vg=e=>{var t=Wo.get(e);return t||(t=new Set,Wo.set(e,t)),t},bg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.isPath(n)){if(i==="start"){var[,s]=ie.first(t,n);n=s}else if(i==="end"){var[,o]=ie.last(t,n);n=o}}return W.isRange(n)&&(i==="start"?n=W.start(n):i==="end"?n=W.end(n):n=P.common(n.anchor.path,n.focus.path)),Ce.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pointRefs(t);return l.delete(i),i.current=null,o}},s=b.pointRefs(t);return s.add(i),i},Dg=e=>{var t=Ho.get(e);return t||(t=new Set,Ho.set(e,t)),t},Cg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.isPath(n)){var i;if(a==="end"){var[,s]=ie.last(t,n);i=s}else{var[,o]=ie.first(t,n);i=o}var l=ie.get(t,i);if(!de.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(W.isRange(n)){var[u,c]=W.edges(n);return a==="start"?u:c}return n};function xg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=b.range(e,n),[l,u]=W.edges(o),c=a?u:l,h=!1,m="",p=0,g=0,f=0;for(var[y,v]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield b.start(e,v);continue}if(e.isInline(y))continue;if(b.hasInlines(e,y)){var x=P.isAncestor(v,u.path)?u:b.end(e,v),B=P.isAncestor(v,l.path)?l:b.start(e,v);m=b.string(e,{anchor:B,focus:x},{voids:i}),h=!0}}if(de.isText(y)){var E=P.equals(v,c.path);for(E?(g=a?c.offset:y.text.length-c.offset,f=c.offset):(g=y.text.length,f=a?g:0),(E||h||r==="offset")&&(yield{path:v,offset:f},h=!1);;){if(p===0){if(m==="")break;p=_(m,r,a),m=Ws(m,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:f}}}}function _(A,S,q){return S==="character"?qs(A,q):S==="word"?rp(A,q):S==="line"||S==="block"?A.length:1}}()}var wg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.before(t,s,{voids:a});if(o){var[,l]=b.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[h]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},Eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.rangeRefs(t);return l.delete(i),i.current=null,o}},s=b.rangeRefs(t);return s.add(i),i},_g=e=>{var t=Uo.get(e);return t||(t=new Set,Uo.set(e,t)),t},kg=(e,t,n)=>{if(W.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};function pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ag=(e,t)=>{var{selection:n}=e;if(n){var r=(c,h)=>{if(!de.isText(c))return!1;var[m,p]=b.parent(e,h);return!e.isVoid(m)||e.markableVoid(m)},a=W.isExpanded(n),i=!1;if(!a){var[s,o]=b.node(e,n);if(s&&r(s,o)){var[l]=b.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Bg({},b.marks(e)||{});delete u[t],e.marks=u,dr.get(e)||e.onChange()}}},Fg=(e,t)=>{Gc.set(e,t)},Tg=(e,t)=>b.point(e,t,{edge:"start"}),Sg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=b.range(t,n),[s,o]=W.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:de.isText,voids:a})){var h=u.text;P.equals(c,o.path)&&(h=h.slice(0,o.offset)),P.equals(c,s.path)&&(h=h.slice(s.offset)),l+=h}return l},jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=W.edges(n);if(i.offset!==0||s.offset!==0||W.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>ce.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),c={anchor:u,focus:s},h=!0;for(var[m,p]of b.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(m.text!==""||P.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},Og=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},Pg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var h=!1;if(W.isRange(u)&&W.isCollapsed(u)&&(h=!0,u=u.anchor),Ce.isPoint(u)){var m=b.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},f=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:f},c=!0}}if(P.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,y]=W.edges(u),v=b.end(t,[]);Ce.equals(y,v)||(u=b.unhangRange(t,u,{voids:l}))}var[x,B]=W.edges(u),E=b.above(t,{match:me=>ce.isElement(me)&&b.isBlock(t,me),at:x,voids:l}),_=b.above(t,{match:me=>ce.isElement(me)&&b.isBlock(t,me),at:B,voids:l}),A=E&&_&&!P.equals(E[1],_[1]),S=P.equals(x.path,B.path),q=l?null:(r=b.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:x,mode:"highest"}),$=l?null:(a=b.void(t,{at:B,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:B,mode:"highest"});if(q){var j=b.before(t,x);j&&E&&P.isAncestor(E[1],j.path)&&(x=j)}if($){var N=b.after(t,B);N&&_&&P.isAncestor(_[1],N.path)&&(B=N)}var w=[],F;for(var R of b.nodes(t,{at:u,voids:l})){var[M,Y]=R;F&&P.compare(Y,F)===0||(!l&&ce.isElement(M)&&(b.isVoid(t,M)||b.isElementReadOnly(t,M))||!P.isCommon(Y,x.path)&&!P.isCommon(Y,B.path))&&(w.push(R),F=Y)}var K=Array.from(w,me=>{var[,_e]=me;return b.pathRef(t,_e)}),se=b.pointRef(t,x),ne=b.pointRef(t,B),D="";if(!S&&!q){var z=se.current,[J]=b.leaf(t,z),{path:k}=z,{offset:T}=x,L=J.text.slice(T);L.length>0&&(t.apply({type:"remove_text",path:k,offset:T,text:L}),D=L)}if(K.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>X.removeNodes(t,{at:me,voids:l})),!$){var I=ne.current,[U]=b.leaf(t,I),{path:te}=I,ee=S?x.offset:0,Z=U.text.slice(ee,B.offset);Z.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:Z}),D=Z)}!S&&A&&ne.current&&se.current&&X.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),h&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,D.slice(0,D.length-o));var ue=se.unref(),Q=ne.unref(),ge=i?ue||Q:Q||ue;n.at==null&&ge&&X.select(t,ge)}}})},Ng=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=zs(t),batchDirty:o=!0}=r;if(n.length){if(W.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),W.isCollapsed(s))s=s.anchor;else{var[,l]=W.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:L=>ce.isElement(L)&&b.isInline(t,L),mode:"highest",voids:i});if(c){var[,h]=c;if(b.isEnd(t,s,h)){var m=b.after(t,h);s=m}else if(b.isStart(t,s,h)){var p=b.before(t,h);s=p}}var g=b.above(t,{match:L=>ce.isElement(L)&&b.isBlock(t,L),at:s,voids:i}),[,f]=g,y=b.isStart(t,s,f),v=b.isEnd(t,s,f),x=y&&v,B=!y||y&&v,E=!v,[,_]=ie.first({children:n},[]),[,A]=ie.last({children:n},[]),S=[],q=L=>{var[I,U]=L,te=U.length===0;return te?!1:x?!0:!(B&&P.isAncestor(U,_)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||E&&P.isAncestor(U,A)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var $ of ie.nodes({children:n},{pass:q}))q($)&&S.push($);var j=[],N=[],w=[],F=!0,R=!1;for(var[M]of S)ce.isElement(M)&&!t.isInline(M)?(F=!1,R=!0,N.push(M)):F?j.push(M):w.push(M);var[Y]=b.nodes(t,{at:s,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i}),[,K]=Y,se=b.isStart(t,s,K),ne=b.isEnd(t,s,K),D=b.pathRef(t,v&&!w.length?P.next(f):f),z=b.pathRef(t,ne?P.next(K):K);X.splitNodes(t,{at:s,match:L=>R?ce.isElement(L)&&b.isBlock(t,L):de.isText(L)||b.isInline(t,L),mode:R?"lowest":"highest",always:R&&(!y||j.length>0)&&(!v||w.length>0),voids:i});var J=b.pathRef(t,!se||se&&ne?P.next(K):K);if(X.insertNodes(t,j,{at:J.current,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),x&&!j.length&&N.length&&!w.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,N,{at:D.current,match:L=>ce.isElement(L)&&b.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,w,{at:z.current,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var k;if(w.length>0&&z.current?k=P.previous(z.current):N.length>0&&D.current?k=P.previous(D.current):J.current&&(k=P.previous(J.current)),k){var T=b.end(t,k);X.select(t,T)}}J.unref(),D.unref(),z.unref()}}})},Rg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=W.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=W.edges(a);X.select(t,s)}}else return},Mg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=W.isBackward(r)?"focus":"anchor"),o==="end"&&(o=W.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var m=s?b.before(t,l,c):b.after(t,l,c);m&&(h.anchor=m)}if(o==null||o==="focus"){var p=s?b.before(t,u,c):b.after(t,u,c);p&&(h.focus=p)}X.setSelection(t,h)}},$g=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){X.setSelection(e,t);return}if(!W.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(Ye.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function vu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=W.isBackward(a)?"focus":"anchor"),i==="end"&&(i=W.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:vu(vu({},l),n)})}},zg=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ce.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ce.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},qg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(ie.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=zs(t),c!==!1&&(c=!0)),c==null&&(c=!1),W.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),W.isCollapsed(l))l=l.anchor;else{var[,m]=W.edges(l),p=b.pointRef(t,m);X.delete(t,{at:l}),l=p.unref()}if(Ce.isPoint(l)){u==null&&(de.isText(h)?u=j=>de.isText(j):t.isInline(h)?u=j=>de.isText(j)||b.isInline(t,j):u=j=>ce.isElement(j)&&b.isBlock(t,j));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,y=b.pathRef(t,f),v=b.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=y.unref();l=v?P.next(x):x}else return}var B=P.parent(l),E=l[l.length-1];if(!(!i&&b.void(t,{at:B}))){if(o){var _=[],A=P.levels(B);_p(t,()=>{var j=function(){var F=B.concat(E);E++;var R={type:"insert_node",path:F,node:N};t.apply(R),l=P.next(l),_.push(R),de.isText?A.push(...Array.from(ie.nodes(N),M=>{var[,Y]=M;return F.concat(Y)})):A.push(F)};for(var N of n)j()},()=>{Jc(t,A,j=>{var N=j;for(var w of _)if(P.operationCanTransformPath(w)&&(N=P.transform(N,w),!N))return null;return N})})}else for(var S of n){var q=B.concat(E);E++,t.apply({type:"insert_node",path:q,node:S}),l=P.next(l)}if(l=P.previous(l),c){var $=b.end(t,l);$&&X.select(t,$)}}}})},Wg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?Qn(t,r):E=>ce.isElement(E)&&b.isBlock(t,E)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,E=>{var[,_]=E;return b.pathRef(t,_)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var h=b.node(t,P.parent(c)),[m,p]=h,g=c[c.length-1],{length:f}=m.children;if(f===1){var y=P.next(p);X.moveNodes(t,{at:c,to:y,voids:i}),X.removeNodes(t,{at:p,voids:i})}else if(g===0)X.moveNodes(t,{at:c,to:p,voids:i});else if(g===f-1){var v=P.next(p);X.moveNodes(t,{at:c,to:v,voids:i})}else{var x=P.next(c),B=P.next(p);X.splitNodes(t,{at:x,voids:i}),X.moveNodes(t,{at:c,to:B,voids:i})}}}})},Hg=["text"],Ug=["children"],Xc=(e,t)=>{if(ce.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?Xc(e,n.children[0]):!1}else return!b.isEditor(t)},Vg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(P.isPath(a)){var[l]=b.parent(t,a);r=j=>l.children.includes(j)}else r=j=>ce.isElement(j)&&b.isBlock(t,j);if(!i&&W.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var[,u]=W.edges(a),c=b.pointRef(t,u);X.delete(t,{at:a}),a=c.unref(),n.at==null&&X.select(t,a)}var[h]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),m=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!m)){var[p,g]=h,[f,y]=m;if(!(g.length===0||y.length===0)){var v=P.next(y),x=P.common(g,y),B=P.isSibling(g,y),E=Array.from(b.levels(t,{at:g}),j=>{var[N]=j;return N}).slice(x.length).slice(0,-1),_=b.above(t,{at:g,mode:"highest",match:j=>E.includes(j)&&Xc(t,j)}),A=_&&b.pathRef(t,_[1]),S,q;if(de.isText(p)&&de.isText(f)){var $=qt(p,Hg);q=f.text.length,S=$}else if(ce.isElement(p)&&ce.isElement(f)){var $=qt(p,Ug);q=f.children.length,S=$}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Ye.stringify(p)," ").concat(Ye.stringify(f)));B||X.moveNodes(t,{at:g,to:v,voids:s}),A&&X.removeNodes(t,{at:A.current,voids:s}),ce.isElement(f)&&b.isEmpty(t,f)||de.isText(f)&&f.text===""&&y[y.length-1]!==0?X.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:v,position:q,properties:S}),A&&A.unref()}}}})},Kg=(e,t)=>{b.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=P.isPath(r)?Qn(e,r):p=>ce.isElement(p)&&b.isBlock(e,p));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(e,g)});for(var c of u){var h=c.unref(),m=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:m}),o.current&&P.isSibling(m,h)&&P.isAfter(m,h)&&(o.current=P.next(o.current))}o.unref()}})},Zg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?Qn(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),!r&&W.isRange(s)&&(s=b.unhangRange(t,s,{voids:a}));var l=b.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(t,g)});for(var c of u){var h=c.unref();if(h){var[m]=b.node(t,h);t.apply({type:"remove_node",path:h,node:m})}}}})},Yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:h=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?Qn(t,i):q=>ce.isElement(q)&&b.isBlock(t,q)),!l&&W.isRange(i)&&(i=b.unhangRange(t,i,{voids:h})),c&&W.isRange(i)){if(W.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var m=b.rangeRef(t,i,{affinity:"inward"}),[p,g]=W.edges(i),f=u==="lowest"?"lowest":"highest",y=b.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!y});var v=b.isStart(t,p,p.path);X.splitNodes(t,{at:p,match:a,mode:f,voids:h,always:!v}),i=m.unref(),r.at==null&&X.select(t,i)}s||(s=(q,$)=>q!==$);for(var[x,B]of b.nodes(t,{at:i,match:a,mode:u,voids:h})){var E={},_={};if(B.length!==0){var A=!1;for(var S in n)S==="children"||S==="text"||s(n[S],x[S])&&(A=!0,x.hasOwnProperty(S)&&(E[S]=x[S]),o?n[S]!=null&&(_[S]=o(x[S],n[S])):n[S]!=null&&(_[S]=n[S]));A&&t.apply({type:"set_node",path:B,properties:E,newProperties:_})}}}})},Gg=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=b.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},Qg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>ce.isElement(ne)&&b.isBlock(t,ne)),W.isRange(s)&&(s=Gg(t,s)),P.isPath(s)){var u=s,c=b.point(t,u),[h]=b.parent(t,u);i=ne=>ne===h,o=c.path.length-u.length+1,s=c,l=!0}if(s){var m=b.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=b.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=b.void(t,{at:s,mode:"highest"}),y=0;if(!a&&f){var[v,x]=f;if(ce.isElement(v)&&t.isInline(v)){var B=b.after(t,x);if(!B){var E={text:""},_=P.next(x);X.insertNodes(t,E,{at:_,voids:a}),B=b.point(t,_)}s=B,l=!0}var A=s.path.length-x.length;o=A+1,l=!0}p=b.pointRef(t,s);var S=s.path.length-o,[,q]=g,$=s.path.slice(0,S),j=o===0?s.offset:s.path[S]+y;for(var[N,w]of b.levels(t,{at:$,reverse:!0,voids:a})){var F=!1;if(w.length<q.length||w.length===0||!a&&ce.isElement(N)&&b.isVoid(t,N))break;var R=m.current,M=b.isEnd(t,R,w);if(l||!m||!b.isEdge(t,R,w)){F=!0;var Y=ie.extractProps(N);t.apply({type:"split_node",path:w,position:j,properties:Y})}j=w[w.length-1]+(F||M?1:0)}if(n.at==null){var K=p.current||b.end(t,[]);X.select(t,K)}}finally{var se;m.unref(),(se=p)===null||se===void 0||se.unref()}}})},Jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;X.setNodes(t,a,r)},Xg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?Qn(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),P.isPath(s)&&(s=b.range(t,s));var l=W.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return b.pathRef(t,g)}).reverse(),h=function(){var g=m.unref(),[f]=b.node(t,g),y=b.range(t,g);a&&l&&(y=W.intersection(l.current,y)),X.liftNodes(t,{at:y,match:v=>ce.isAncestor(f)&&f.children.includes(v),voids:i})};for(var m of c)h();l&&l.unref()}})};function bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ev=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(P.isPath(l)?o=Qn(t,l):t.isInline(n)?o=y=>ce.isElement(y)&&b.isInline(t,y)||de.isText(y):o=y=>ce.isElement(y)&&b.isBlock(t,y)),i&&W.isRange(l)){var[u,c]=W.edges(l),h=b.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:c,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&X.select(t,l)}var m=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?y=>ce.isElement(y)&&b.isBlock(t,y):y=>b.isEditor(y),mode:"lowest",voids:s})),p=function(){var v=W.isRange(l)?W.intersection(l,b.range(t,f)):l;if(!v)return 0;var x=Array.from(b.nodes(t,{at:v,match:o,mode:a,voids:s}));if(x.length>0){var[B]=x,E=x[x.length-1],[,_]=B,[,A]=E;if(_.length===0&&A.length===0)return 0;var S=P.equals(_,A)?P.parent(_):P.common(_,A),q=b.range(t,_,A),$=b.node(t,S),[j]=$,N=S.length+1,w=P.next(A.slice(0,N)),F=yu(yu({},n),{},{children:[]});X.insertNodes(t,F,{at:w,voids:s}),X.moveNodes(t,{at:q,match:R=>ce.isAncestor(j)&&j.children.includes(R),to:w.concat(0),voids:s})}},g;for(var[,f]of m)g=p()}})},tv=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ap(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Op(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pp(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)}};return e},nv={isHistory(e){return Je(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Yt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Yt.isOperationList(e.undos[0].operations))}},ci=new WeakMap,di=new WeakMap,jn={isHistoryEditor(e){return nv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return di.get(e)},isSaving(e){return ci.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=jn.isMerging(e);di.set(e,!1),t(),di.set(e,n)},withoutSaving(e,t){var n=jn.isSaving(e);ci.set(e,!1),t(),ci.set(e,n)}},rv=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&X.setSelection(t,i.selectionBefore),jn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];jn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(Yt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=jn.isSaving(t),c=jn.isMerging(t);if(u==null&&(u=iv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=av(r,l)),o&&c)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},av=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&P.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&P.equals(e.path,t.path)),iv=(e,t)=>e.type!=="set_selection",sv=lv,ed="֑-߿יִ-﷽ﹰ-ﻼ",td="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",ov=new RegExp("^[^"+td+"]*["+ed+"]"),uv=new RegExp("^[^"+ed+"]*["+td+"]");function lv(e){return e=String(e||""),ov.test(e)?"rtl":uv.test(e)?"ltr":"neutral"}const nd=bn(sv);function cv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Hs=cv,dv=typeof Nr=="object"&&Nr&&Nr.Object===Object&&Nr,fv=dv,hv=fv,mv=typeof self=="object"&&self&&self.Object===Object&&self,pv=hv||mv||Function("return this")(),rd=pv,gv=rd,vv=function(){return gv.Date.now()},bv=vv,yv=/\s/;function Dv(e){for(var t=e.length;t--&&yv.test(e.charAt(t)););return t}var Cv=Dv,xv=Cv,wv=/^\s+/;function Ev(e){return e&&e.slice(0,xv(e)+1).replace(wv,"")}var _v=Ev,kv=rd,Bv=kv.Symbol,ad=Bv,Du=ad,id=Object.prototype,Av=id.hasOwnProperty,Fv=id.toString,rr=Du?Du.toStringTag:void 0;function Tv(e){var t=Av.call(e,rr),n=e[rr];try{e[rr]=void 0;var r=!0}catch{}var a=Fv.call(e);return r&&(t?e[rr]=n:delete e[rr]),a}var Sv=Tv,jv=Object.prototype,Ov=jv.toString;function Pv(e){return Ov.call(e)}var Nv=Pv,Cu=ad,Rv=Sv,Mv=Nv,Iv="[object Null]",$v="[object Undefined]",xu=Cu?Cu.toStringTag:void 0;function Lv(e){return e==null?e===void 0?$v:Iv:xu&&xu in Object(e)?Rv(e):Mv(e)}var zv=Lv;function qv(e){return e!=null&&typeof e=="object"}var Wv=qv,Hv=zv,Uv=Wv,Vv="[object Symbol]";function Kv(e){return typeof e=="symbol"||Uv(e)&&Hv(e)==Vv}var Zv=Kv,Yv=_v,wu=Hs,Gv=Zv,Eu=0/0,Qv=/^[-+]0x[0-9a-f]+$/i,Jv=/^0b[01]+$/i,Xv=/^0o[0-7]+$/i,e0=parseInt;function t0(e){if(typeof e=="number")return e;if(Gv(e))return Eu;if(wu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=wu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Yv(e);var n=Jv.test(e);return n||Xv.test(e)?e0(e.slice(2),n?2:8):Qv.test(e)?Eu:+e}var n0=t0,r0=Hs,fi=bv,_u=n0,a0="Expected a function",i0=Math.max,s0=Math.min;function o0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(a0);t=_u(t)||0,r0(n)&&(c=!!n.leading,h="maxWait"in n,i=h?i0(_u(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(A){var S=r,q=a;return r=a=void 0,u=A,s=e.apply(q,S),s}function g(A){return u=A,o=setTimeout(v,t),c?p(A):s}function f(A){var S=A-l,q=A-u,$=t-S;return h?s0($,i-q):$}function y(A){var S=A-l,q=A-u;return l===void 0||S>=t||S<0||h&&q>=i}function v(){var A=fi();if(y(A))return x(A);o=setTimeout(v,f(A))}function x(A){return o=void 0,m&&r?p(A):(r=a=void 0,s)}function B(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function E(){return o===void 0?s:x(fi())}function _(){var A=fi(),S=y(A);if(r=arguments,a=this,l=A,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return _.cancel=B,_.flush=E,_}var sd=o0;const u0=bn(sd);var l0=sd,c0=Hs,d0="Expected a function";function f0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(d0);return c0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),l0(e,t,{leading:r,maxWait:t,trailing:a})}var h0=f0;const m0=bn(h0),ku=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Bu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",hi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Bu(n.overflowY,t)||Bu(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},zr=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,p0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Au=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,h=typeof u=="function"?u:Y=>Y!==u;if(!ku(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;ku(g)&&h(g);){if(g=p0(g),g===m){p.push(g);break}g!=null&&g===document.body&&hi(g)&&!hi(document.documentElement)||g!=null&&hi(g,c)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:x}=window,{height:B,width:E,top:_,right:A,bottom:S,left:q}=e.getBoundingClientRect(),{top:$,right:j,bottom:N,left:w}=(Y=>{const K=window.getComputedStyle(Y);return{top:parseFloat(K.scrollMarginTop)||0,right:parseFloat(K.scrollMarginRight)||0,bottom:parseFloat(K.scrollMarginBottom)||0,left:parseFloat(K.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?_-$:o==="end"?S+N:_+B/2-$+N,R=l==="center"?q+E/2-w+j:l==="end"?A+j:q-w;const M=[];for(let Y=0;Y<p.length;Y++){const K=p[Y],{height:se,width:ne,top:D,right:z,bottom:J,left:k}=K.getBoundingClientRect();if(s==="if-needed"&&_>=0&&q>=0&&S<=y&&A<=f&&_>=D&&S<=J&&q>=k&&A<=z)return M;const T=getComputedStyle(K),L=parseInt(T.borderLeftWidth,10),I=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),te=parseInt(T.borderBottomWidth,10);let ee=0,Z=0;const ue="offsetWidth"in K?K.offsetWidth-K.clientWidth-L-U:0,Q="offsetHeight"in K?K.offsetHeight-K.clientHeight-I-te:0,ge="offsetWidth"in K?K.offsetWidth===0?0:ne/K.offsetWidth:0,me="offsetHeight"in K?K.offsetHeight===0?0:se/K.offsetHeight:0;if(m===K)ee=o==="start"?F:o==="end"?F-y:o==="nearest"?zr(x,x+y,y,I,te,x+F,x+F+B,B):F-y/2,Z=l==="start"?R:l==="center"?R-f/2:l==="end"?R-f:zr(v,v+f,f,L,U,v+R,v+R+E,E),ee=Math.max(0,ee+x),Z=Math.max(0,Z+v);else{ee=o==="start"?F-D-I:o==="end"?F-J+te+Q:o==="nearest"?zr(D,J,se,I,te+Q,F,F+B,B):F-(D+se/2)+Q/2,Z=l==="start"?R-k-L:l==="center"?R-(k+ne/2)+ue/2:l==="end"?R-z+U+ue:zr(k,z,ne,L,U+ue,R,R+E,E);const{scrollLeft:_e,scrollTop:Se}=K;ee=me===0?0:Math.max(0,Math.min(Se+ee/me,K.scrollHeight-se/me+Q)),Z=ge===0?0:Math.max(0,Math.min(_e+Z/ge,K.scrollWidth-ne/ge+ue)),F+=Se-ee,R+=_e-Z}M.push({el:K,top:ee,left:Z})}return M},g0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function v0(e,t){if(!e.isConnected||!(a=>{let i=a;for(;i&&i.parentNode;){if(i.parentNode===document)return!0;i=i.parentNode instanceof ShadowRoot?i.parentNode.host:i.parentNode}return!1})(e))return;const n=(a=>{const i=window.getComputedStyle(a);return{top:parseFloat(i.scrollMarginTop)||0,right:parseFloat(i.scrollMarginRight)||0,bottom:parseFloat(i.scrollMarginBottom)||0,left:parseFloat(i.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(Au(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Au(e,g0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var dn=[],b0=function(){return dn.some(function(e){return e.activeTargets.length>0})},y0=function(){return dn.some(function(e){return e.skippedTargets.length>0})},Fu="ResizeObserver loop completed with undelivered notifications.",D0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Fu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Fu),window.dispatchEvent(e)},wr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(wr||(wr={}));var fn=function(e){return Object.freeze(e)},C0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,fn(this)}return e}(),od=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,fn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Us=function(e){return e instanceof SVGElement&&"getBBox"in e},ud=function(e){if(Us(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,s=a.offsetHeight;return!(i||s||e.getClientRects().length)},Tu=function(e){var t;if(e instanceof Element)return!0;var n=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(n&&e instanceof n.Element)},x0=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},fr=typeof window<"u"?window:{},qr=new WeakMap,Su=/auto|scroll/,w0=/^tb|vertical/,E0=/msie|trident/i.test(fr.navigator&&fr.navigator.userAgent),kt=function(e){return parseFloat(e||"0")},Mn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new C0((n?t:e)||0,(n?e:t)||0)},ju=fn({devicePixelContentBoxSize:Mn(),borderBoxSize:Mn(),contentBoxSize:Mn(),contentRect:new od(0,0,0,0)}),ld=function(e,t){if(t===void 0&&(t=!1),qr.has(e)&&!t)return qr.get(e);if(ud(e))return qr.set(e,ju),ju;var n=getComputedStyle(e),r=Us(e)&&e.ownerSVGElement&&e.getBBox(),a=!E0&&n.boxSizing==="border-box",i=w0.test(n.writingMode||""),s=!r&&Su.test(n.overflowY||""),o=!r&&Su.test(n.overflowX||""),l=r?0:kt(n.paddingTop),u=r?0:kt(n.paddingRight),c=r?0:kt(n.paddingBottom),h=r?0:kt(n.paddingLeft),m=r?0:kt(n.borderTopWidth),p=r?0:kt(n.borderRightWidth),g=r?0:kt(n.borderBottomWidth),f=r?0:kt(n.borderLeftWidth),y=h+u,v=l+c,x=f+p,B=m+g,E=o?e.offsetHeight-B-e.clientHeight:0,_=s?e.offsetWidth-x-e.clientWidth:0,A=a?y+x:0,S=a?v+B:0,q=r?r.width:kt(n.width)-A-_,$=r?r.height:kt(n.height)-S-E,j=q+y+_+x,N=$+v+E+B,w=fn({devicePixelContentBoxSize:Mn(Math.round(q*devicePixelRatio),Math.round($*devicePixelRatio),i),borderBoxSize:Mn(j,N,i),contentBoxSize:Mn(q,$,i),contentRect:new od(h,l,q,$)});return qr.set(e,w),w},cd=function(e,t,n){var r=ld(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case wr.DEVICE_PIXEL_CONTENT_BOX:return s;case wr.BORDER_BOX:return a;default:return i}},_0=function(){function e(t){var n=ld(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=fn([n.borderBoxSize]),this.contentBoxSize=fn([n.contentBoxSize]),this.devicePixelContentBoxSize=fn([n.devicePixelContentBoxSize])}return e}(),dd=function(e){if(ud(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},k0=function(){var e=1/0,t=[];dn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new _0(u.target),h=dd(u.target);o.push(c),u.lastReportedSize=cd(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Ou=function(e){dn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(dd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},B0=function(){var e=0;for(Ou(e);b0();)e=k0(),Ou(e);return y0()&&D0(),e>0},mi,fd=[],A0=function(){return fd.splice(0).forEach(function(e){return e()})},F0=function(e){if(!mi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return A0()}).observe(n,r),mi=function(){n.textContent="".concat(t?t--:t++)}}fd.push(e),mi()},T0=function(e){F0(function(){requestAnimationFrame(e)})},ia=0,S0=function(){return!!ia},j0=250,O0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Pu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Nu=function(e){return e===void 0&&(e=0),Date.now()+e},pi=!1,P0=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var n=this;if(t===void 0&&(t=j0),!pi){pi=!0;var r=Nu(t);T0(function(){var a=!1;try{a=B0()}finally{if(pi=!1,t=r-Nu(),!S0())return;a?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,O0)};document.body?n():fr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Pu.forEach(function(n){return fr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Pu.forEach(function(n){return fr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),us=new P0,Ru=function(e){!ia&&e>0&&us.start(),ia+=e,!ia&&us.stop()},N0=function(e){return!Us(e)&&!x0(e)&&getComputedStyle(e).display==="inline"},R0=function(){function e(t,n){this.target=t,this.observedBox=n||wr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=cd(this.target,this.observedBox,!0);return N0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),M0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Wr=new WeakMap,Mu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Hr=function(){function e(){}return e.connect=function(t,n){var r=new M0(t,n);Wr.set(t,r)},e.observe=function(t,n,r){var a=Wr.get(t),i=a.observationTargets.length===0;Mu(a.observationTargets,n)<0&&(i&&dn.push(a),a.observationTargets.push(new R0(n,r&&r.box)),Ru(1),us.schedule())},e.unobserve=function(t,n){var r=Wr.get(t),a=Mu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&dn.splice(dn.indexOf(r),1),r.observationTargets.splice(a,1),Ru(-1))},e.disconnect=function(t){var n=this,r=Wr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),I0=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Hr.connect(this,t)}return e.prototype.observe=function(t,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Tu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Hr.observe(this,t,n)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Tu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Hr.unobserve(this,t)},e.prototype.disconnect=function(){Hr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function $0(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Wn(e,t){if(e==null)return{};var n=$0(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Er(e){"@babel/helpers - typeof";return Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Er(e)}function L0(e,t){if(Er(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Er(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function z0(e){var t=L0(e,"string");return Er(t)==="symbol"?t:String(t)}function Dt(e,t,n){return t=z0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vs=C.createContext(null),nn=()=>{var e=C.useContext(Vs);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},hd=parseInt(C.version.split(".")[0],10),q0=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Iu=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),at=typeof navigator<"u"&&/Android/.test(navigator.userAgent),On=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),lr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),W0=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),md=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),H0=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),U0=at&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),V0=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),K0=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Z0=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),sa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ht=(!H0||!U0)&&!W0&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Ks=new WeakMap,Zs=new WeakMap,pd=new WeakMap,oa=new WeakMap,ls=new WeakMap,_r=new WeakMap,hn=new WeakMap,Ca=new WeakMap,qa=new WeakMap,cs=new WeakMap,Gt=new WeakMap,ln=new WeakMap,hr=new WeakMap,ds=new WeakMap,Ys=new WeakMap,wt=new WeakMap,$t=new WeakMap,ut=new WeakMap,Vt=new WeakMap,Kt=new WeakMap,gd=new WeakMap,Hn=Symbol("placeholder"),vd=Symbol("mark-placeholder"),Y0=globalThis.Text,Gs=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,G0=e=>Jt(e)&&e.nodeType===8,yt=e=>Jt(e)&&e.nodeType===1,Jt=e=>{var t=Gs(e);return!!t&&e instanceof t.Node},fs=e=>{var t=e&&e.anchorNode&&Gs(e.anchorNode);return!!t&&e instanceof t.Selection},bd=e=>Jt(e)&&e.nodeType===3,Q0=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,J0=e=>{var[t,n]=e;if(yt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=yd(t,a,r?"backward":"forward"),r=a<n;yt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=eb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},X0=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},yd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(G0(a)||yt(a)&&a.childNodes.length===0||yt(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},eb=(e,t,n)=>{var[r]=yd(e,t,n);return r},Dd=e=>{var t="";if(bd(e)&&e.nodeValue)return e.nodeValue;if(yt(e)){for(var n of Array.from(e.childNodes))t+=Dd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
103
|
+
`)}return t},tb=/data-slate-fragment="(.+?)"/m,nb=e=>{var t=e.getData("text/html"),[,n]=t.match(tb)||[];return n},Qs=(e,t,n)=>{var{target:r}=t;if(yt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=G.getWindow(e);if(a.contains(r))return G.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:Qs(e,i,n)},rb=0;class ab{constructor(){Dt(this,"id",void 0),this.id="".concat(rb++)}}var G={androidPendingDiffs:e=>ut.get(e),androidScheduleFlush:e=>{var t;(t=Ys.get(e))===null||t===void 0||t()},blur:e=>{var t=G.toDOMNode(e,e),n=G.findDocumentOrShadowRoot(e);Gt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=G.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=G.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=G.toSlateNode(e,t.target),s=G.findPath(e,i);if(ce.isElement(i)&&b.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=b.point(e,s,{edge:l?"start":"end"}),c=l?b.before(e,u):b.after(e,u);if(c){var h=b.range(e,c);return h}}var m,{document:p}=G.getWindow(e);if(p.caretRangeFromPoint)m=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(m=p.createRange(),m.setStart(g.offsetNode,g.offset),m.setEnd(g.offsetNode,g.offset))}if(!m)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=G.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Ca.get(t);return n||(n=new ab,Ca.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Zs.get(r);if(a==null){if(b.isEditor(r))return n;break}var i=Ks.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Ye.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!Gt.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{G.focus(t,{retries:n.retries-1})},10);return}var r=G.toDOMNode(t,t),a=G.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=G.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(X.select(t,b.start(t,[])),t.onChange()),Gt.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=pd.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=G.toDOMNode(t,t),s;try{s=yt(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>Jt(t)&&G.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return b.hasPath(e,n.path)&&b.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>G.hasEditableTarget(e,t)||G.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>Jt(t)&&G.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!ln.get(e),isFocused:e=>!!Gt.get(e),isReadOnly:e=>!!cs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(cs.get(e))return!1;var n=G.hasTarget(e,t)&&G.toSlateNode(e,t);return ce.isElement(n)&&b.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=qa.get(e),r=b.isEditor(t)?oa.get(e):n==null?void 0:n.get(G.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Ye.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=b.node(e,t.path),r=G.toDOMNode(e,n),a;b.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:h}=c.textContent,m=u.getAttribute("data-slate-length"),p=m==null?h:parseInt(m,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var y,v=f.childNodes[0];a=[v instanceof Y0?v:f,(y=f.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var x=Math.min(h,Math.max(0,t.offset-o));a=[c,x];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Ye.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=W.isBackward(t),i=G.toDOMPoint(e,n),s=W.isCollapsed(t)?i:G.toDOMPoint(e,r),o=G.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[h,m]=a?i:s,p=yt(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=yt(h)?h:h.parentElement,y=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(h,y?1:m),l},toSlateNode:(e,t)=>{var n=yt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?_r.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:a}=n,[i,s]=r?t:J0(t),o=i.parentNode,l=null,u=0;if(o){var c,h,m=G.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),y=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=G.getWindow(e),x=v.document.createRange();x.setStart(l,0),x.setEnd(i,s);var B=x.cloneContents(),E=[...Array.prototype.slice.call(B.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(B.querySelectorAll("[contenteditable=false]"))];E.forEach(R=>{if(at&&!r&&R.hasAttribute("data-slate-zero-width")&&R.textContent.length>0&&R.textContext!=="\uFEFF"){R.textContent.startsWith("\uFEFF")&&(R.textContent=R.textContent.slice(1));return}R.parentNode.removeChild(R)}),u=B.textContent.length,y=l}}else if(g){for(var _=g.querySelectorAll("[data-slate-leaf]"),A=0;A<_.length;A++){var S=_[A];if(G.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),y=f,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(R=>{u-=R.textContent.length})):u=1}y&&u===y.textContent.length&&at&&y.getAttribute("data-slate-zero-width")==="z"&&(c=y.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||On&&(h=y.textContent)!==null&&h!==void 0&&h.endsWith(`
|
|
104
|
+
|
|
105
|
+
`))&&u--}if(at&&!l&&!r){var q=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(q&&G.hasDOMNode(e,q,{editable:!0})){var $=G.toSlateNode(e,q),{path:j,offset:N}=b.start(e,G.findPath(e,$));return q.querySelector("[data-slate-leaf]")||(N=s),{path:j,offset:N}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var w=G.toSlateNode(e,l),F=G.findPath(e,w);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=fs(t)?t.anchorNode:t.startContainer,o,l,u,c,h;if(s)if(fs(t)){if(On&&t.rangeCount>1){u=t.focusNode;var m=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let A=function(S){return S.childElementCount>0?A(S.children[0]):S};var g=m.startContainer,f=p.startContainer,y=A(g.children[m.startOffset]),v=A(f.children[p.startOffset]);c=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,y.childNodes.length>0?u=y.childNodes[0]:u=y,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else m.startContainer===u?(o=p.endContainer,l=p.endOffset,c=m.startOffset):(o=m.startContainer,l=m.endOffset,c=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;md&&X0(o)||On?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||c==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(On&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
|
|
106
|
+
|
|
107
|
+
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,c=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var B=G.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!B)return null;var E=h?B:G.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!E)return null;var _={anchor:B,focus:E};return W.isExpanded(_)&&W.isForward(_)&&yt(u)&&b.void(e,{at:_.focus,mode:"highest"})&&(_=b.unhangRange(e,_,{voids:!0})),_}};function ib(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=ie.get(e,n);if(!de.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=P.next(n);if(!b.hasPath(e,i))return!1;var s=ie.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function Cd(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((a,i)=>a.slice(0,i.start)+i.text+a.slice(i.end),e)}function sb(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r))return r;return n}function ob(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function xd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=sb(i,a),o=Math.min(i.length-s,a.length-s),l=ob(i,a,o),u={start:n+s,end:r-l,text:a.slice(s,a.length-l)};return u.start===u.end&&u.text.length===0?null:u}function ub(e,t,n){var r=Math.min(t.start,n.start),a=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),i=Cd(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-a),o=i.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return xd(e,{start:r,end:l,text:o})}function lb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function hs(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=ie.get(e,n);if(!de.isText(a))return null;var i=b.above(e,{match:o=>ce.isElement(o)&&b.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=b.next(e,{at:n,match:de.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function $u(e,t){var n=hs(e,t.anchor);if(!n)return null;if(W.isCollapsed(t))return{anchor:n,focus:n};var r=hs(e,t.focus);return r?{anchor:n,focus:r}:null}function ms(e,t,n){var r=ut.get(e),a=r==null?void 0:r.find(c=>{var{path:h}=c;return P.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return Ce.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=Ce.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=Ce.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&P.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Lu(e,t,n){var r=ms(e,t.anchor,n);if(!r)return null;if(W.isCollapsed(t))return{anchor:r,focus:r};var a=ms(e,t.focus,n);return a?{anchor:r,focus:a}:null}function cb(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!P.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:P.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:P.transform(n,t,{affinity:"forward"})};case"merge_node":return P.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:P.transform(n,t)}:{diff:r,id:a,path:P.transform(n,t)}}var i=P.transform(n,t);return i?{diff:r,path:i,id:a}:null}function zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ur(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zu(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var db=25,fb=200,hb=function(){},mb=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function pb(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var w=Kt.get(t);if(Kt.delete(t),w){var{selection:F}=t,R=$u(t,w);R&&(!F||!W.equals(R,F))&&X.select(t,R)}},h=()=>{var w=Vt.get(t);if(Vt.delete(t),!!w){if(w.at){var F=Ce.isPoint(w.at)?hs(t,w.at):$u(t,w.at);if(!F)return;var R=b.range(t,F);(!t.selection||!W.equals(t.selection,R))&&X.select(t,F)}w.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!E()&&!B()){c();return}a||(a=!0,setTimeout(()=>a=!1)),B()&&(a="action");var w=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});$t.set(t,t.marks),hb("flush",Vt.get(t),ut.get(t));for(var F=E(),R;R=(M=ut.get(t))===null||M===void 0?void 0:M[0];){var M,Y,K=wt.get(t);K!==void 0&&(wt.delete(t),t.marks=K),K&&u===!1&&(u=null);var se=lb(R);(!t.selection||!W.equals(t.selection,se))&&X.select(t,se),R.diff.text?b.insertText(t,R.diff.text):b.deleteFragment(t),ut.set(t,(Y=ut.get(t))===null||Y===void 0?void 0:Y.filter(z=>{var{id:J}=z;return J!==R.id})),ib(t,R)||(F=!1,Vt.delete(t),$t.delete(t),a="action",Kt.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var ne=w==null?void 0:w.unref();if(ne&&!Kt.get(t)&&(!t.selection||!W.equals(ne,t.selection))&&X.select(t,ne),B()){h();return}F&&n(),n.flush(),r.flush(),c();var D=$t.get(t);$t.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=w=>{i&&clearTimeout(i),i=setTimeout(()=>{ln.set(t,!1),m()},db)},g=w=>{ln.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,R=ls.get(t);if(R){if(E()||F){R.style.display="none";return}R.style.removeProperty("display")}},y=(w,F)=>{var R,M=(R=ut.get(t))!==null&&R!==void 0?R:[];ut.set(t,M);var Y=ie.leaf(t,w),K=M.findIndex(D=>P.equals(D.path,w));if(K<0){var se=xd(Y.text,F);se&&M.push({path:w,diff:F,id:l++}),f();return}var ne=ub(Y.text,M[K].diff,F);if(!ne){M.splice(K,1),f();return}M[K]=Ur(Ur({},M[K]),{},{diff:ne})},v=function(F){var{at:R}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Kt.delete(t),n.cancel(),r.cancel(),B()&&m(),Vt.set(t,{at:R,run:F}),o=setTimeout(m)},x=w=>{var F;s&&(clearTimeout(s),s=null);var{inputType:R}=w,M=null,Y=w.dataTransfer||w.data||void 0;u!==!1&&R!=="insertText"&&R!=="insertCompositionText"&&(u=!1);var[K]=w.getTargetRanges();K&&(M=G.toSlateRange(t,K,{exactMatch:!1,suppressThrow:!0}));var se=G.getWindow(t),ne=se.getSelection();if(!M&&ne&&(K=ne,M=G.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),M=(F=M)!==null&&F!==void 0?F:t.selection,!!M){var D=!0;if(R.startsWith("delete")){if(W.isExpanded(M)){var[z,J]=W.edges(M),k=ie.leaf(t,z.path);if(k.text.length===z.offset&&J.offset===0){var T=b.next(t,{at:z.path,match:de.isText});T&&P.equals(T[1],J.path)&&(M={anchor:J,focus:J})}}var L=R.endsWith("Backward")?"backward":"forward",[I,U]=W.edges(M),[te,ee]=b.leaf(t,I.path),Z={text:"",start:I.offset,end:U.offset},ue=ut.get(t),Q=ue==null?void 0:ue.find(pe=>P.equals(pe.path,ee)),ge=Q?[Q.diff,Z]:[Z],me=Cd(te.text,...ge);if(me.length===0&&(D=!1),W.isExpanded(M)){if(D&&P.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:I.offset},Se=b.range(t,_e,_e);return S(Se),y(M.anchor.path,{text:"",end:U.offset,start:I.offset})}return v(()=>b.deleteFragment(t,{direction:L}),{at:M})}}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Pe}=M;if(D&&W.isCollapsed(M)){var Ge=ie.leaf(t,Pe.path);if(Pe.offset<Ge.text.length)return y(Pe.path,{text:"",start:Pe.offset,end:Pe.offset+1})}return v(()=>b.deleteForward(t),{at:M})}case"deleteContentBackward":{var Ke,{anchor:Ze}=M,tt=fs(K)?K.isCollapsed:!!((Ke=K)!==null&&Ke!==void 0&&Ke.collapsed);return D&&tt&&W.isCollapsed(M)&&Ze.offset>0?y(Ze.path,{text:"",start:Ze.offset-1,end:Ze.offset}):v(()=>b.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return v(()=>{b.deleteBackward(t,{unit:"line"}),b.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return v(()=>b.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return v(()=>b.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return v(()=>b.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return v(()=>b.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return v(()=>b.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return v(()=>b.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return v(()=>b.insertSoftBreak(t),{at:M});case"insertParagraph":return v(()=>b.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(mb(Y))return v(()=>G.insertData(t,Y),{at:M});var Ae=Y??"";if(wt.get(t)&&(Ae=Ae.replace("\uFEFF","")),R==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
108
|
+
`))return v(()=>{var pe=Ae.split(`
|
|
109
|
+
`);pe.forEach((De,Ue)=>{De&&b.insertText(t,De),Ue!==pe.length-1&&b.insertSoftBreak(t)})},{at:M});if(P.equals(M.anchor.path,M.focus.path)){var[We,Le]=W.edges(M),H={start:We.offset,end:Le.offset,text:Ae};if(Ae&&u&&R==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),fe=H.start+H.text.search(/\S|$/);fe===ae+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,j()):u=!1}else R==="insertText"?u===null?u=H:u&&W.isCollapsed(M)&&u.end+u.text.length===We.offset?u=Ur(Ur({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(D){y(We.path,H);return}}return v(()=>b.insertText(t,Ae),{at:M})}}}},B=()=>!!Vt.get(t),E=()=>{var w;return!!((w=ut.get(t))!==null&&w!==void 0&&w.length)},_=()=>B()||E(),A=()=>a,S=w=>{Kt.set(t,w),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(w){var R=!F||!P.equals(F.anchor.path,w.anchor.path),M=!F||!P.equals(F.anchor.path.slice(0,-1),w.anchor.path.slice(0,-1));(R&&u||M)&&(u=!1),(R||E())&&(s=setTimeout(m,fb))}},q=()=>{(B()||!E())&&m()},$=w=>{E()||(f(!0),setTimeout(f))},j=()=>{B()||(o=setTimeout(m))},N=w=>{if(!(E()||B())&&w.some(R=>Qs(t,R,w))){var F;(F=gd.get(t))===null||F===void 0||F()}};return{flush:m,scheduleFlush:j,hasPendingDiffs:E,hasPendingAction:B,hasPendingChanges:_,isFlushing:A,handleUserSelect:S,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:x,handleKeyDown:$,handleDomMutations:N,handleInput:q}}function gb(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var kr=sa?C.useLayoutEffect:C.useEffect;function vb(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));kr(()=>{r.takeRecords()}),C.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var bb=["node"];function qu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Db={subtree:!0,childList:!0,characterData:!0},Cb=at?e=>{var{node:t}=e,n=Wn(e,bb);if(!at)return null;var r=nn(),a=gb(),[i]=C.useState(()=>pb(yb({editor:r},n)));return vb(t,i.handleDomMutations,Db),Ys.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,xb=["anchor","focus"],wb=["anchor","focus"],Eb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),wd=(e,t)=>{var n=Wn(e,xb),r=Wn(t,wb);return e[Hn]===t[Hn]&&Eb(n,r)},_b=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!W.equals(r,a)||!wd(r,a))return!1}return!0},kb=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(r.anchor.offset!==a.anchor.offset||r.focus.offset!==a.focus.offset||!wd(r,a))return!1}return!0};function Wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wu(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ab=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=nn(),s=G.findPath(i,a),o=P.parent(s),l=!!n[vd];return i.isVoid(r)?C.createElement(gi,{length:ie.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&b.string(i,o)===""?C.createElement(gi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?C.createElement(gi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
|
|
110
|
+
`?C.createElement(Hu,{isTrailing:!0,text:n.text}):C.createElement(Hu,{text:n.text})},Hu=e=>{var{text:t,isTrailing:n=!1}=e,r=C.useRef(null),a=()=>"".concat(t??"").concat(n?`
|
|
111
|
+
`:""),[i]=C.useState(a);return kr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(Fb,{ref:r},i)},Fb=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),gi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),C.createElement("span",Bb({},a),!at||!n?"\uFEFF":null,n?C.createElement("br",null):null)};function Uu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ed(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Uu(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Tb=at?300:0;function Sb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Vu(e){e.current&&(clearTimeout(e.current),e.current=null)}var jb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Pb,Ed({},x))}=e,o=nn(),l=C.useRef(null),u=C.useRef(null),[c,h]=C.useState(!1),m=C.useRef(null),p=C.useCallback(x=>{if(Sb(l,x==null),x==null){var B;ls.delete(o),(B=t.onPlaceholderResize)===null||B===void 0||B.call(t,null)}else{if(ls.set(o,x),!l.current){var E=window.ResizeObserver||I0;l.current=new E(()=>{var _;(_=t.onPlaceholderResize)===null||_===void 0||_.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=C.createElement(Ab,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Hn];if(C.useEffect(()=>(f?m.current||(m.current=setTimeout(()=>{h(!0),m.current=null},Tb)):(Vu(m),h(!1)),()=>Vu(m)),[f,h]),f&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:lr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(y),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Ob=C.memo(jb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&de.equals(t.leaf,e.leaf)&&t.leaf[Hn]===e.leaf[Hn]),Pb=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Ed({},t),n)},Nb=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=nn(),l=C.useRef(null),u=de.decorations(s,t),c=G.findKey(o,s),h=[],m=0;m<u.length;m++){var p=u[m];h.push(C.createElement(Ob,{isLast:n&&m===u.length-1,key:"".concat(c.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(f=>{var y=qa.get(o);f?(y==null||y.set(c,f),hn.set(s,f),_r.set(f,s)):(y==null||y.delete(c),hn.delete(s),l.current&&_r.delete(l.current)),l.current=f},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},h)},_d=C.memo(Nb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&kb(t.decorations,e.decorations));function Ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ps(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ku(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ku(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rb=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(Ib,ps({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=nn(),l=zb(),u=o.isInline(n),c=G.findKey(o,n),h=C.useCallback(x=>{var B=qa.get(o);x?(B==null||B.set(c,x),hn.set(n,x),_r.set(x,n)):(B==null||B.delete(c),hn.delete(n))},[o,c,n]),m=Bd({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:h};if(u&&(p["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=ie.string(n),f=nd(g);f==="rtl"&&(p.dir=f)}if(b.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[v]]=ie.texts(n);m=C.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(_d,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Ks.set(v,0),Zs.set(v,n)}return r({attributes:p,children:m,element:n})},Mb=C.memo(Rb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&_b(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),Ib=e=>{var{attributes:t,children:n,element:r}=e,a=nn(),i=a.isInline(r)?"span":"div";return C.createElement(i,ps(ps({},t),{},{style:{position:"relative"}}),n)},kd=C.createContext(()=>[]),$b=()=>C.useContext(kd),Lb=C.createContext(!1),Bd=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=$b(),l=nn(),u=G.findPath(l,n),c=[],h=ce.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],f=G.findKey(l,g),y=b.range(l,p),v=s&&W.intersection(y,s),x=o([g,p]);for(var B of t){var E=W.intersection(B,y);E&&x.push(E)}ce.isElement(g)?c.push(C.createElement(Lb.Provider,{key:"provider-".concat(f.id),value:!!v},C.createElement(Mb,{decorations:x,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(_d,{decorations:x,key:f.id,isLast:h&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Ks.set(g,m),Zs.set(g,n)}return c},Ad=C.createContext(!1),zb=()=>C.useContext(Ad),Fd=C.createContext(null),Jn=()=>{var e=C.useContext(Fd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function qb(){var e=nn(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=G.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Wb=3,Hb={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},Ub={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Vb={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Me=e=>{var t=Hb[e],n=Ub[e],r=Vb[e],a=t&&ai(t),i=n&&ai(n),s=r&&ai(r);return o=>!!(a&&a(o)||Iu&&i&&i(o)||!Iu&&s&&s(o))},$e={isBold:Me("bold"),isCompose:Me("compose"),isMoveBackward:Me("moveBackward"),isMoveForward:Me("moveForward"),isDeleteBackward:Me("deleteBackward"),isDeleteForward:Me("deleteForward"),isDeleteLineBackward:Me("deleteLineBackward"),isDeleteLineForward:Me("deleteLineForward"),isDeleteWordBackward:Me("deleteWordBackward"),isDeleteWordForward:Me("deleteWordForward"),isExtendBackward:Me("extendBackward"),isExtendForward:Me("extendForward"),isExtendLineBackward:Me("extendLineBackward"),isExtendLineForward:Me("extendLineForward"),isItalic:Me("italic"),isMoveLineBackward:Me("moveLineBackward"),isMoveLineForward:Me("moveLineForward"),isMoveWordBackward:Me("moveWordBackward"),isMoveWordForward:Me("moveWordForward"),isRedo:Me("redo"),isSoftBreak:Me("insertSoftBreak"),isSplitBlock:Me("splitBlock"),isTransposeCharacter:Me("transposeCharacter"),isUndo:Me("undo")},Kb=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Qs(e,l,s));n.push(...o)}};function i(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:a,restoreDOM:i,clear:r}},Zb={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Td extends C.Component{constructor(){super(...arguments),Dt(this,"context",null),Dt(this,"manager",null),Dt(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,Zb)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Kb(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}Dt(Td,"contextType",Vs);var Yb=at?Td:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},Gb=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Qb=["text"];function Zu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function At(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Jb=e=>C.createElement(C.Fragment,null,Bd(e)),Xb=e=>{var t=C.useCallback(T=>C.createElement(ey,At({},T)),[]),{autoFocus:n,decorate:r=ty,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=ny,style:h={},as:m="div",disableDefaultStyles:p=!1}=e,g=Wn(e,Gb),f=Jn(),[y,v]=C.useState(!1),x=C.useRef(null),B=C.useRef([]),[E,_]=C.useState(),{onUserInput:A,receivedUserInput:S}=qb(),[,q]=C.useReducer(T=>T+1,0);gd.set(f,q),cs.set(f,s);var $=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var j=C.useRef(),N=C.useMemo(()=>m0(()=>{var T=j.current;if((at||!G.isComposing(f))&&(!$.isUpdatingSelection||T!=null&&T.isFlushing())&&!$.isDraggingInternally){var L=G.findDocumentOrShadowRoot(f),{activeElement:I}=L,U=G.toDOMNode(f,f),te=L.getSelection();if(I===U?($.latestElement=I,Gt.set(f,!0)):Gt.delete(f),!te)return X.deselect(f);var{anchorNode:ee,focusNode:Z}=te,ue=G.hasEditableTarget(f,ee)||G.isTargetInsideNonReadonlyVoid(f,ee),Q=G.hasEditableTarget(f,Z)||G.isTargetInsideNonReadonlyVoid(f,Z);if(ue&&Q){var ge=G.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});ge&&(!G.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?X.select(f,ge):T==null||T.handleUserSelect(ge))}s&&(!ue||!Q)&&X.deselect(f)}},100),[f,s,$]),w=C.useMemo(()=>u0(N,0),[N]);j.current=Cb({node:x,onDOMSelectionChange:N,scheduleOnDOMSelectionChange:w}),kr(()=>{var T,L,I;x.current&&(I=Gs(x.current))?(pd.set(f,I),oa.set(f,x.current),hn.set(f,x.current),_r.set(x.current,f)):hn.delete(f);var{selection:U}=f,te=G.findDocumentOrShadowRoot(f),ee=te.getSelection();if(!(!ee||!G.isFocused(f)||(T=j.current)!==null&&T!==void 0&&T.hasPendingAction())){var Z=me=>{var _e=ee.type!=="None";if(!(!U&&!_e)){var Se=ee.focusNode,Pe;if(On&&ee.rangeCount>1){var Ge=ee.getRangeAt(0),Ke=ee.getRangeAt(ee.rangeCount-1);Ge.startContainer===Se?Pe=Ke.endContainer:Pe=Ge.startContainer}else Pe=ee.anchorNode;var Ze=oa.get(f),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&U&&!me){var Ae=G.toSlateRange(f,ee,{exactMatch:!0,suppressThrow:!0});if(Ae&&W.equals(Ae,U)){var We;if(!$.hasMarkPlaceholder||(We=Pe)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!G.hasRange(f,U)){f.selection=G.toSlateRange(f,ee,{exactMatch:!1,suppressThrow:!0});return}$.isUpdatingSelection=!0;var Le=U&&G.toDOMRange(f,U);return Le?(G.isComposing(f)&&!at?ee.collapseToEnd():W.isBackward(U)?ee.setBaseAndExtent(Le.endContainer,Le.endOffset,Le.startContainer,Le.startOffset):ee.setBaseAndExtent(Le.startContainer,Le.startOffset,Le.endContainer,Le.endOffset),c(f,Le)):ee.removeAllRanges(),Le}};ee.rangeCount<=1&&Z();var ue=((L=j.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!at||!ue){setTimeout(()=>{$.isUpdatingSelection=!1});return}var Q=null,ge=requestAnimationFrame(()=>{if(ue){var me=_e=>{try{var Se=G.toDOMNode(f,f);Se.focus(),Z(_e)}catch{}};me(),Q=setTimeout(()=>{me(!0),$.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),Q&&clearTimeout(Q)}}});var F=C.useCallback(T=>{if(A(),!s&&G.hasEditableTarget(f,T.target)&&!ry(T,a)){var L;if(j.current)return j.current.handleDOMBeforeInput(T);w.flush(),N.flush();var{selection:I}=f,{inputType:U}=T,te=T.dataTransfer||T.data||void 0,ee=U==="insertCompositionText"||U==="deleteCompositionText";if(ee&&G.isComposing(f))return;var Z=!1;if(U==="insertText"&&I&&W.isCollapsed(I)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&I.anchor.offset!==0){var ue,Q;Z=!0,f.marks&&(Z=!1);var{anchor:ge}=I,[me,_e]=G.toDOMPoint(f,ge),Se=(ue=me.parentElement)===null||ue===void 0?void 0:ue.closest("a"),Pe=G.getWindow(f);if(Z&&Se&&G.hasDOMNode(f,Se)){var Ge,Ke=Pe==null?void 0:Pe.document.createTreeWalker(Se,NodeFilter.SHOW_TEXT).lastChild();Ke===me&&((Ge=Ke.textContent)===null||Ge===void 0?void 0:Ge.length)===_e&&(Z=!1)}if(Z&&me.parentElement&&(Pe==null||(Q=Pe.getComputedStyle(me.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Ze=b.above(f,{at:ge.path,match:ae=>ce.isElement(ae)&&b.isBlock(f,ae)});Ze&&ie.string(Ze[0]).includes(" ")&&(Z=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[tt]=T.getTargetRanges();if(tt){var Ae=G.toSlateRange(f,tt,{exactMatch:!1,suppressThrow:!1});if(!I||!W.equals(I,Ae)){Z=!1;var We=!ee&&f.selection&&b.rangeRef(f,f.selection);X.select(f,Ae),We&&hr.set(f,We)}}}if(ee)return;if(Z||T.preventDefault(),I&&W.isExpanded(I)&&U.startsWith("delete")){var Le=U.endsWith("Backward")?"backward":"forward";b.deleteFragment(f,{direction:Le});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(f);break}case"deleteContentBackward":{b.deleteBackward(f);break}case"deleteEntireSoftLine":{b.deleteBackward(f,{unit:"line"}),b.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(f,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(f);break;case"insertParagraph":{b.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&G.isComposing(f)&&(v(!1),ln.set(f,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?G.insertData(f,te):typeof te=="string"&&(Z?B.current.push(()=>b.insertText(f,te)):b.insertText(f,te));break}}var H=(L=hr.get(f))===null||L===void 0?void 0:L.unref();hr.delete(f),H&&(!f.selection||!W.equals(f.selection,H))&&X.select(f,H)}},[f,N,A,a,s,w]),R=C.useCallback(T=>{T==null?(N.cancel(),w.cancel(),oa.delete(f),hn.delete(f),x.current&&Ht&&x.current.removeEventListener("beforeinput",F)):Ht&&T.addEventListener("beforeinput",F),x.current=T},[N,w,f,F]);kr(()=>{var T=G.getWindow(f);return T.document.addEventListener("selectionchange",w),()=>{T.document.removeEventListener("selectionchange",w)}},[w]);var M=r([f,[]]),Y=i&&f.children.length===1&&Array.from(ie.texts(f)).length===1&&ie.string(f)===""&&!y,K=C.useCallback(T=>{if(T&&Y){var L;_((L=T.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else _(void 0)},[Y]);if(Y){var se=b.start(f,[]);M.push({[Hn]:!0,placeholder:i,onPlaceholderResize:K,anchor:se,focus:se})}var{marks:ne}=f;if($.hasMarkPlaceholder=!1,f.selection&&W.isCollapsed(f.selection)&&ne){var{anchor:D}=f.selection,z=ie.leaf(f,D.path),J=Wn(z,Qb);if(!de.equals(z,ne,{loose:!0})){$.hasMarkPlaceholder=!0;var k=Object.fromEntries(Object.keys(J).map(T=>[T,null]));M.push(At(At(At({[vd]:!0},k),ne),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:L}=T,I=ie.leaf(f,L.path);if(ne&&!de.equals(I,ne,{loose:!0})){wt.set(f,ne);return}}wt.delete(f)})}),C.createElement(Ad.Provider,{value:s},C.createElement(kd.Provider,{value:r},C.createElement(Yb,{node:x,receivedUserInput:S},C.createElement(m,At(At({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Ht||!sa?g.spellCheck:!1,autoCorrect:Ht||!sa?g.autoCorrect:"false",autoCapitalize:Ht||!sa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:R,style:At(At({},p?{}:At({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},E?{minHeight:E}:{})),h),onBeforeInput:C.useCallback(T=>{if(!Ht&&!s&&!rt(T,g.onBeforeInput)&&G.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!G.isComposing(f))){var L=T.data;b.insertText(f,L)}},[g.onBeforeInput,f,s]),onInput:C.useCallback(T=>{if(!rt(T,g.onInput)){if(j.current){j.current.handleInput();return}for(var L of B.current)L();B.current=[]}},[g.onInput]),onBlur:C.useCallback(T=>{if(!(s||$.isUpdatingSelection||!G.hasSelectableTarget(f,T.target)||rt(T,g.onBlur))){var L=G.findDocumentOrShadowRoot(f);if($.latestElement!==L.activeElement){var{relatedTarget:I}=T,U=G.toDOMNode(f,f);if(I!==U&&!(yt(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&Jt(I)&&G.hasDOMNode(f,I)){var te=G.toSlateNode(f,I);if(ce.isElement(te)&&!f.isVoid(te))return}if(lr){var ee=L.getSelection();ee==null||ee.removeAllRanges()}Gt.delete(f)}}}},[s,$.isUpdatingSelection,$.latestElement,f,g.onBlur]),onClick:C.useCallback(T=>{if(G.hasTarget(f,T.target)&&!rt(T,g.onClick)&&Jt(T.target)){var L=G.toSlateNode(f,T.target),I=G.findPath(f,L);if(!b.hasPath(f,I)||ie.get(f,I)!==L)return;if(T.detail===Wb&&I.length>=1){var U=I;if(!(ce.isElement(L)&&b.isBlock(f,L))){var te,ee=b.above(f,{match:Se=>ce.isElement(Se)&&b.isBlock(f,Se),at:I});U=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:I.slice(0,1)}var Z=b.range(f,U);X.select(f,Z);return}if(s)return;var ue=b.start(f,I),Q=b.end(f,I),ge=b.void(f,{at:ue}),me=b.void(f,{at:Q});if(ge&&me&&P.equals(ge[1],me[1])){var _e=b.range(f,ue);X.select(f,_e)}}},[f,g.onClick,s]),onCompositionEnd:C.useCallback(T=>{if(G.hasSelectableTarget(f,T.target)){var L;if(G.isComposing(f)&&Promise.resolve().then(()=>{v(!1),ln.set(f,!1)}),(L=j.current)===null||L===void 0||L.handleCompositionEnd(T),rt(T,g.onCompositionEnd)||at)return;if(!lr&&!V0&&!q0&&!Z0&&!K0&&T.data){var I=wt.get(f);wt.delete(f),I!==void 0&&($t.set(f,f.marks),f.marks=I),b.insertText(f,T.data);var U=$t.get(f);$t.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:C.useCallback(T=>{G.hasSelectableTarget(f,T.target)&&!rt(T,g.onCompositionUpdate)&&(G.isComposing(f)||(v(!0),ln.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:C.useCallback(T=>{if(G.hasSelectableTarget(f,T.target)){var L;if((L=j.current)===null||L===void 0||L.handleCompositionStart(T),rt(T,g.onCompositionStart)||at)return;v(!0);var{selection:I}=f;if(I&&W.isExpanded(I)){b.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:C.useCallback(T=>{G.hasSelectableTarget(f,T.target)&&!rt(T,g.onCopy)&&!Yu(T)&&(T.preventDefault(),G.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:C.useCallback(T=>{if(!s&&G.hasSelectableTarget(f,T.target)&&!rt(T,g.onCut)&&!Yu(T)){T.preventDefault(),G.setFragmentData(f,T.clipboardData,"cut");var{selection:L}=f;if(L)if(W.isExpanded(L))b.deleteFragment(f);else{var I=ie.parent(f,L.anchor.path);b.isVoid(f,I)&&X.delete(f)}}},[s,f,g.onCut]),onDragOver:C.useCallback(T=>{if(G.hasTarget(f,T.target)&&!rt(T,g.onDragOver)){var L=G.toSlateNode(f,T.target);ce.isElement(L)&&b.isVoid(f,L)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:C.useCallback(T=>{if(!s&&G.hasTarget(f,T.target)&&!rt(T,g.onDragStart)){var L=G.toSlateNode(f,T.target),I=G.findPath(f,L),U=ce.isElement(L)&&b.isVoid(f,L)||b.void(f,{at:I,voids:!0});if(U){var te=b.range(f,I);X.select(f,te)}$.isDraggingInternally=!0,G.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,$]),onDrop:C.useCallback(T=>{if(!s&&G.hasTarget(f,T.target)&&!rt(T,g.onDrop)){T.preventDefault();var L=f.selection,I=G.findEventRange(f,T),U=T.dataTransfer;X.select(f,I),$.isDraggingInternally&&L&&!W.equals(L,I)&&!b.void(f,{at:I,voids:!0})&&X.delete(f,{at:L}),G.insertData(f,U),G.isFocused(f)||G.focus(f)}$.isDraggingInternally=!1},[s,f,g.onDrop,$]),onDragEnd:C.useCallback(T=>{!s&&$.isDraggingInternally&&g.onDragEnd&&G.hasTarget(f,T.target)&&g.onDragEnd(T),$.isDraggingInternally=!1},[s,$,g,f]),onFocus:C.useCallback(T=>{if(!s&&!$.isUpdatingSelection&&G.hasEditableTarget(f,T.target)&&!rt(T,g.onFocus)){var L=G.toDOMNode(f,f),I=G.findDocumentOrShadowRoot(f);if($.latestElement=I.activeElement,On&&T.target!==L){L.focus();return}Gt.set(f,!0)}},[s,$,f,g.onFocus]),onKeyDown:C.useCallback(T=>{if(!s&&G.hasEditableTarget(f,T.target)){var L;(L=j.current)===null||L===void 0||L.handleKeyDown(T);var{nativeEvent:I}=T;if(G.isComposing(f)&&I.isComposing===!1&&(ln.set(f,!1),v(!1)),rt(T,g.onKeyDown)||G.isComposing(f))return;var{selection:U}=f,te=f.children[U!==null?U.focus.path[0]:0],ee=nd(ie.string(te))==="rtl";if($e.isRedo(I)){T.preventDefault();var Z=f;typeof Z.redo=="function"&&Z.redo();return}if($e.isUndo(I)){T.preventDefault();var ue=f;typeof ue.undo=="function"&&ue.undo();return}if($e.isMoveLineBackward(I)){T.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if($e.isMoveLineForward(I)){T.preventDefault(),X.move(f,{unit:"line"});return}if($e.isExtendLineBackward(I)){T.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if($e.isExtendLineForward(I)){T.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if($e.isMoveBackward(I)){T.preventDefault(),U&&W.isCollapsed(U)?X.move(f,{reverse:!ee}):X.collapse(f,{edge:ee?"end":"start"});return}if($e.isMoveForward(I)){T.preventDefault(),U&&W.isCollapsed(U)?X.move(f,{reverse:ee}):X.collapse(f,{edge:ee?"start":"end"});return}if($e.isMoveWordBackward(I)){T.preventDefault(),U&&W.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!ee});return}if($e.isMoveWordForward(I)){T.preventDefault(),U&&W.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:ee});return}if(Ht){if((md||lr)&&U&&($e.isDeleteBackward(I)||$e.isDeleteForward(I))&&W.isCollapsed(U)){var Q=ie.parent(f,U.anchor.path);if(ce.isElement(Q)&&b.isVoid(f,Q)&&(b.isInline(f,Q)||b.isBlock(f,Q))){T.preventDefault(),b.deleteBackward(f,{unit:"block"});return}}}else{if($e.isBold(I)||$e.isItalic(I)||$e.isTransposeCharacter(I)){T.preventDefault();return}if($e.isSoftBreak(I)){T.preventDefault(),b.insertSoftBreak(f);return}if($e.isSplitBlock(I)){T.preventDefault(),b.insertBreak(f);return}if($e.isDeleteBackward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f);return}if($e.isDeleteForward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f);return}if($e.isDeleteLineBackward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"line"});return}if($e.isDeleteLineForward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"line"});return}if($e.isDeleteWordBackward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"word"});return}if($e.isDeleteWordForward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:C.useCallback(T=>{!s&&G.hasEditableTarget(f,T.target)&&!rt(T,g.onPaste)&&(!Ht||Q0(T.nativeEvent)||lr)&&(T.preventDefault(),G.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),C.createElement(Jb,{decorations:M,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},ey=e=>{var{attributes:t,children:n}=e;return C.createElement("span",At({},t),n,at&&C.createElement("br",null))},ty=()=>[],ny=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),v0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},rt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Yu=e=>Jt(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),ry=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},ay=C.createContext(!1),iy=C.createContext({});function sy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var oy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],uy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Wn(e,oy),[l,u]=C.useState(()=>{if(!ie.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ye.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ye.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:h}=sy(t),m=C.useCallback(f=>{var y;switch(r&&r(t.children),f==null||(y=f.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),h(t)},[t,h,r,a,i]);C.useEffect(()=>(ds.set(t,m),()=>{ds.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(G.isFocused(t));return C.useEffect(()=>{g(G.isFocused(t))},[t]),kr(()=>{var f=()=>g(G.isFocused(t));return hd>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),C.createElement(iy.Provider,{value:c},C.createElement(Fd.Provider,{value:l},C.createElement(Vs.Provider,{value:l.editor},C.createElement(ay.Provider,{value:p},n))))},Gu=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Qu=(e,t,n)=>{var r=G.toDOMRange(e,t).getBoundingClientRect(),a=G.toDOMRange(e,n).getBoundingClientRect();return Gu(r,a)&&Gu(a,r)},ly=(e,t)=>{var n=b.range(e,W.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Qu(e,b.range(e,r[a]),n))return b.range(e,r[a],n);if(r.length<2)return b.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Qu(e,b.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return b.range(e,r[i],n)};function Ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ju(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var cy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return qa.set(r,new WeakMap),r.addMark=(u,c)=>{var h,m;(h=Ys.get(r))===null||h===void 0||h(),!wt.get(r)&&(m=ut.get(r))!==null&&m!==void 0&&m.length&&wt.set(r,null),$t.delete(r),o(u,c)},r.removeMark=u=>{var c;!wt.get(r)&&(c=ut.get(r))!==null&&c!==void 0&&c.length&&wt.set(r,null),$t.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&W.isCollapsed(r.selection)){var c=b.above(r,{match:g=>ce.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,h]=c,m=b.range(r,h,r.selection.anchor),p=ly(r,m);W.isCollapsed(p)||X.delete(r,{at:p})}}},r.apply=u=>{var c=[],h=[],m=ut.get(r);if(m!=null&&m.length){var p=m.map(R=>cb(R,u)).filter(Boolean);ut.set(r,p)}var g=Kt.get(r);g&&Kt.set(r,Lu(r,g,u));var f=Vt.get(r);if(f!=null&&f.at){var y=Ce.isPoint(f==null?void 0:f.at)?ms(r,f.at,u):Lu(r,f.at,u);Vt.set(r,y?Xu(Xu({},f),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...kn(r,u.path));break}case"set_selection":{var v;(v=hr.get(r))===null||v===void 0||v.unref(),hr.delete(r);break}case"insert_node":case"remove_node":{c.push(...kn(r,P.parent(u.path)));break}case"merge_node":{var x=P.previous(u.path);c.push(...kn(r,x));break}case"move_node":{var B=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...kn(r,B));var E;P.isBefore(u.path,u.newPath)?(c.push(...kn(r,P.parent(u.path))),E=u.newPath):(c.push(...kn(r,P.parent(u.newPath))),E=u.path);var _=ie.get(t,P.parent(E)),A=G.findKey(r,_),S=b.pathRef(r,P.parent(E));h.push([S,A]);break}}a(u);for(var[q,$]of c){var[j]=b.node(r,q);Ca.set(j,$)}for(var[N,w]of h)if(N.current){var[F]=b.node(r,N.current);Ca.set(F,w)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[h,m]=W.edges(c),p=b.void(r,{at:h.path}),g=b.void(r,{at:m.path});if(!(W.isCollapsed(c)&&!p)){var f=G.toDOMRange(r,c),y=f.cloneContents(),v=y.childNodes[0];if(y.childNodes.forEach(j=>{j.textContent&&j.textContent.trim()!==""&&(v=j)}),g){var[x]=g,B=f.cloneRange(),E=G.toDOMNode(r,x);B.setEndAfter(E),y=B.cloneContents()}if(p&&(v=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(j=>{var N=j.getAttribute("data-slate-zero-width")==="n";j.textContent=N?`
|
|
112
|
+
`:""}),bd(v)){var _=v.ownerDocument.createElement("span");_.style.whiteSpace="pre",_.appendChild(v),y.appendChild(_),v=_}var A=r.getFragment(),S=JSON.stringify(A),q=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",q),u.setData("application/".concat(n),q);var $=y.ownerDocument.createElement("div");return $.appendChild(y),$.setAttribute("hidden","true"),y.ownerDocument.body.appendChild($),u.setData("text/html",$.innerHTML),u.setData("text/plain",Dd($)),y.ownerDocument.body.removeChild($),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||nb(u);if(c){var h=decodeURIComponent(window.atob(c)),m=JSON.parse(h);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var h=c.split(/\r\n|\r|\n/),m=!1;for(var p of h)m&&X.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=hd<18?nc.unstable_batchedUpdates:h=>h();c(()=>{var h=ds.get(r);h&&h(u),i(u)})},r},kn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=G.findKey(e,r);n.push([a,i])}return n};const dy={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,lastAnchor:null,dispatch:()=>{}},Cn=C.createContext(dy),fy=({attributes:e,children:t,element:n})=>{switch(n.type){case"block_quote":return d.jsx("blockquote",{...e,children:t});case"link":return d.jsx("a",{...e,children:t});case"list_item":return d.jsx("li",{...e,children:t});case"ol_list":return d.jsx("ol",{...e,children:t});case"ul_list":return d.jsx("ul",{...e,children:t});case"span":return d.jsx("span",{...e,children:t});case"paragraph":return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},hy=({attributes:e,children:t,leaf:n})=>{const r=n;return r.bold&&(t=d.jsx("strong",{children:t})),r.italic&&(t=d.jsx("em",{children:t})),r.strikeThrough&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Js=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=oe.useIntl(),l=Jn(),{id:u,tabbableOption:c,setFocus:h,openTooltip:m,dispatch:p}=C.useContext(Cn),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:V(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:V(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var y,v,x,B;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const E=f.currentTarget.closest("li");let _=E==null?void 0:E.nextElementSibling;if(f.key==="ArrowLeft"){const q=E==null?void 0:E.previousElementSibling;q?_=q:_=(y=E==null?void 0:E.parentElement)==null?void 0:y.lastElementChild}else _||(_=(v=E==null?void 0:E.parentElement)==null?void 0:v.firstElementChild);const A=_==null?void 0:_.className.split(" ")[0];A&&(h(A),(x=_==null?void 0:_.querySelector("button"))==null||x.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(B=S==null?void 0:S.previousElementSibling)==null||B.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Va,{styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},el=["ol_list","ul_list"],Sd=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},jd=(e,t)=>{const n=Sd(e,t),r=el.includes(t);X.unwrapNodes(e,{match:s=>{const o=s;return!b.isEditor(s)&&ce.isElement(s)&&el.includes(o.type)},split:!0});const i={type:n?"paragraph":r?"list_item":t};if(X.setNodes(e,i),!n&&r){const s={type:t,children:[]};X.wrapNodes(e,s)}},my=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(Cn),r=Jn(),a=Sd(r,e);return d.jsx(Js,{id:e,active:a,hasDivider:t,callback:()=>{jd(r,e),n(a?null:e)}})},py=52,tl=16,gy=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a}=C.useContext(Cn),i=t==="link-editor"?a:!1;return C.useEffect(()=>{var h;if(!(r!=null&&r.current)||!i)return;const s=r==null?void 0:r.current;if(!s)return;const o=document.getSelection();let l;o!=null&&o.toString().trim().length?l=o==null?void 0:o.getRangeAt(0).getBoundingClientRect():l=(h=document.getElementById(n))==null?void 0:h.getBoundingClientRect();const u=((l==null?void 0:l.top)||0)+window.scrollY-py,c=Math.max(((l==null?void 0:l.left)||0)-(s.offsetWidth-((l==null?void 0:l.width)||0)),0);s.style.top=`${u/tl}rem`,s.style.left=`${c/tl}rem`},[i,e.selection]),r},vy=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=b.nodes(e,{at:r,match:i=>i.type==="link"});if(a){let s=a[0].link,o=s;s.includes("//")?o=s.split("//")[1]:s=`https://${s}`,o.includes("/")&&(o=o.split("/")[0]),n({full:s,pretty:o})}else n(null)},[e,e.selection]),t},mr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type==="link"}});return!!t},by=(e,t,n)=>{e.selection&&Od(e,t,n)},Od=(e,t,n)=>{mr(e)&&Pd(e);const{selection:r}=e,a=r&&W.isCollapsed(r),i={type:"link",link:t,children:a?[{text:t}]:[]};a?X.insertNodes(e,i):(X.wrapNodes(e,i,{split:!0}),X.collapse(e,{edge:"end"}));const s=document.getElementById(n);if(s){const o=s.querySelector(".input");o&&(o==null||o.focus())}},Pd=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};let vi=null;const yy=()=>{const e=oe.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a}=C.useContext(Cn),i=Jn(),{selection:s}=i,o=vy(i),[l,u]=C.useState(mr(i)),c=gy(i,"link-editor",`${n}-link`),h=C.useRef(null);C.useEffect(()=>{var f;!l&&r&&((f=h.current)==null||f.focus())},[l]),C.useEffect(()=>{vi&&clearTimeout(vi),vi=setTimeout(()=>{u(mr(i))},500)},[i.selection]);const m=s&&W.isCollapsed(s),p=[],g=["open","edit","remove"].map(f=>{const y={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${f}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:f}),f){case"open":y.href=(o==null?void 0:o.full)||"",y.onClick=v=>{v.preventDefault(),v.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},y.children=d.jsxs(d.Fragment,{children:[y.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${f}_text`})})]});break;case"edit":y.onClick=()=>{m||u(!1)},m&&(y.disabled=!0);break;case"remove":y.onClick=()=>{const v=[{type:"showLinkEditor",value:!1}];mr(i)&&(Pd(i),v.push({type:"lastAnchor",value:null})),a(v)};break}return y});return d.jsx(yc,{children:d.jsx(Va,{ref:c,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasPointer:"bottom",hasForm:!l},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var f;return(f=h.current)==null?void 0:f.focus()})}},children:l?d.jsx(yn,{wrappers:p,buttons:g}):d.jsx(Gn,{element:"fieldset",id:`${n}-link-editor`,meta:{shouldReset:!1},functions:{onSuccess:async f=>{setTimeout(()=>{const y=[{type:"showLinkEditor",value:!1}];f.url&&(by(i,f.url,n),y.push({type:"lastAnchor",value:null})),a(y)})}},fields:[{id:"url",type:"url",inputRef:h,label:e.formatMessage({id:`${t}placeholder`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}],button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},Dy=()=>{const e=Jn(),{setFocus:t,dispatch:n}=C.useContext(Cn),[r,a]=C.useState(!1);return C.useEffect(()=>{a(mr(e))},[e.selection]),d.jsx(Js,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},Cy=e=>["bold","italic","strikeThrough"].includes(e),Nd=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Rd=(e,t)=>{Nd(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)},xy=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(Cn),r=Jn(),a=Nd(r,e);return d.jsx(Js,{id:e,active:a,hasDivider:t,callback:()=>{Rd(r,e),n(a?null:e)}})},xa=["bold","italic","strikeThrough"],wy=["ol_list","ul_list","block_quote"];const Ey=({...e})=>{const t=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[xa.map((n,r)=>d.jsx(xy,{format:n,hasDivider:r===xa.length-1},n)),d.jsx(Dy,{}),wy.map((n,r)=>d.jsx(my,{format:n,hasDivider:r===1},n))]})]}),d.jsx(yy,{})]})},Pn={paragraph:"paragraph",block_quote:"block_quote",code_block:"code_block",link:"link",ul_list:"ul_list",ol_list:"ol_list",listItem:"list_item",heading:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},emphasis_mark:"italic",strong_mark:"bold",delete_mark:"strikeThrough",inline_code_mark:"code",thematic_break:"thematic_break",image:"image"};function nl(e){if(e)throw e}var ua=Object.prototype.hasOwnProperty,Md=Object.prototype.toString,rl=Object.defineProperty,al=Object.getOwnPropertyDescriptor,il=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Md.call(t)==="[object Array]"},sl=function(t){if(!t||Md.call(t)!=="[object Object]")return!1;var n=ua.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ua.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ua.call(t,a)},ol=function(t,n){rl&&n.name==="__proto__"?rl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ul=function(t,n){if(n==="__proto__")if(ua.call(t,n)){if(al)return al(t,n).value}else return;return t[n]},_y=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=ul(o,n),a=ul(t,n),o!==a&&(c&&a&&(sl(a)||(i=il(a)))?(i?(i=!1,s=r&&il(r)?r:[]):s=r&&sl(r)?r:{},ol(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&ol(o,{name:n,newValue:a}));return o};const bi=bn(_y);function gs(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ky(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,c?By(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function By(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function pr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ll(e.position):"start"in e||"end"in e?ll(e):"line"in e||"column"in e?vs(e):""}function vs(e){return cl(e&&e.line)+":"+cl(e&&e.column)}function ll(e){return vs(e&&e.start)+"-"+vs(e&&e.end)}function cl(e){return e&&typeof e=="number"?e:1}class dt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=pr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}dt.prototype.file="";dt.prototype.name="";dt.prototype.reason="";dt.prototype.message="";dt.prototype.stack="";dt.prototype.column=void 0;dt.prototype.line=void 0;dt.prototype.ancestors=void 0;dt.prototype.cause=void 0;dt.prototype.fatal=void 0;dt.prototype.place=void 0;dt.prototype.ruleId=void 0;dt.prototype.source=void 0;const Ft={basename:Ay,dirname:Fy,extname:Ty,join:Sy,sep:"/"};function Ay(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Tr(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Fy(e){if(Tr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Ty(e){Tr(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function Sy(...e){let t=-1,n;for(;++t<e.length;)Tr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":jy(n)}function jy(e){Tr(e);const t=e.codePointAt(0)===47;let n=Oy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Oy(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Tr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Py={cwd:Ny};function Ny(){return"/"}function bs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ry(e){if(typeof e=="string")e=new URL(e);else if(!bs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return My(e)}function My(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const yi=["history","path","basename","stem","extname","dirname"];class Iy{constructor(t){let n;t?bs(t)?n={path:t}:typeof t=="string"||$y(t)?n={value:t}:n=t:n={},this.cwd=Py.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yi.length;){const i=yi[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)yi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ft.basename(this.path):void 0}set basename(t){Ci(t,"basename"),Di(t,"basename"),this.path=Ft.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ft.dirname(this.path):void 0}set dirname(t){dl(this.basename,"dirname"),this.path=Ft.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ft.extname(this.path):void 0}set extname(t){if(Di(t,"extname"),dl(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ft.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){bs(t)&&(t=Ry(t)),Ci(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ft.basename(this.path,this.extname):void 0}set stem(t){Ci(t,"stem"),Di(t,"stem"),this.path=Ft.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new dt(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Di(e,t){if(e&&e.includes(Ft.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ft.sep+"`")}function Ci(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function dl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function $y(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ly=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};Object.setPrototypeOf(i,r);const s=Object.getOwnPropertyNames(a);for(const o of s){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(i,o,l)}return i},zy={}.hasOwnProperty;class Xs extends Ly{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ky()}copy(){const t=new Xs;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(bi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ei("data",this.frozen),this.namespace[t]=n,this):zy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ei("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Vr(t),r=this.parser||this.Parser;return xi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),xi("process",this.parser||this.Parser),wi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Vr(t),l=r.parse(o);r.run(l,o,function(c,h,m){if(c||!h||!m)return u(c);const p=h,g=r.stringify(p,m);Hy(g)?m.value=g:m.result=g,u(c,m)});function u(c,h){c||!h?s(c):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),xi("processSync",this.parser||this.Parser),wi("processSync",this.compiler||this.Compiler),this.process(t,a),hl("processSync","process",n),r;function a(i,s){n=!0,nl(i),r=s}}run(t,n,r){fl(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=Vr(n);a.run(t,l,u);function u(c,h,m){const p=h||t;c?o(c):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),hl("runSync","run",r),a;function i(s,o){nl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Vr(n),a=this.compiler||this.Compiler;return wi("stringify",a),fl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ei("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...h]=u;l(c,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=bi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const h=u[c];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===u){m=h;break}if(m===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const f=r[m][1];gs(f)&&gs(p)&&(p=bi(!0,f,p)),r[m]=[u,p,...g]}}}}const qy=new Xs().freeze();function xi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function wi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ei(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function fl(e){if(!gs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Vr(e){return Wy(e)?e:new Iy(e)}function Wy(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Hy(e){return typeof e=="string"||Uy(e)}function Uy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vy={};function Ky(e,t){const n=t||Vy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Id(e,r,a)}function Id(e,t,n){if(Zy(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ml(e.children,t,n)}return Array.isArray(e)?ml(e,t,n):""}function ml(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Id(e[a],t,n);return r.join("")}function Zy(e){return!!(e&&typeof e=="object")}const pl=document.createElement("i");function eo(e){const t="&"+e+";";pl.innerHTML=t;const n=pl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function jt(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function bt(e,t){return e.length>0?(jt(e,e.length,0,t),e):t}const gl={}.hasOwnProperty;function Yy(e){const t={};let n=-1;for(;++n<e.length;)Gy(t,e[n]);return t}function Gy(e,t){let n;for(n in t){const a=(gl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){gl.call(a,s)||(a[s]=[]);const o=i[s];Qy(a[s],Array.isArray(o)?o:o?[o]:[])}}}function Qy(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);jt(e,0,0,r)}function $d(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function In(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tt=rn(/[A-Za-z]/),Et=rn(/[\dA-Za-z]/),Jy=rn(/[#-'*+\--9=?A-Z^-~]/);function ys(e){return e!==null&&(e<32||e===127)}const Ds=rn(/\d/),Xy=rn(/[\dA-Fa-f]/),e1=rn(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function Be(e){return e===-2||e===-1||e===32}const t1=rn(/\p{P}|\p{S}/u),n1=rn(/\s/);function rn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ne(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Be(l)?(e.enter(n),o(l)):t(l)}function o(l){return Be(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const r1={tokenize:a1};function a1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ne(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ve(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const i1={tokenize:s1},vl={tokenize:o1};function s1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(B){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,l,u)(B)}return u(B)}function l(B){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const E=t.events.length;let _=E,A;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){A=t.events[_][1].end;break}v(r);let S=E;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},A),S++;return jt(t.events,_+1,0,t.events.slice(E)),t.events.length=S,u(B)}return o(B)}function u(B){if(r===n.length){if(!a)return m(B);if(a.currentConstruct&&a.currentConstruct.concrete)return g(B);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(vl,c,h)(B)}function c(B){return a&&x(),v(r),m(B)}function h(B){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(B)}function m(B){return t.containerState={},e.attempt(vl,p,g)(B)}function p(B){return r++,n.push([t.currentConstruct,t.containerState]),m(B)}function g(B){if(B===null){a&&x(),v(0),e.consume(B);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(B)}function f(B){if(B===null){y(e.exit("chunkFlow"),!0),v(0),e.consume(B);return}return ve(B)?(e.consume(B),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(B),f)}function y(B,E){const _=t.sliceStream(B);if(E&&_.push(null),B.previous=i,i&&(i.next=B),i=B,a.defineSkip(B.start),a.write(_),t.parser.lazy[B.start.line]){let A=a.events.length;for(;A--;)if(a.events[A][1].start.offset<s&&(!a.events[A][1].end||a.events[A][1].end.offset>s))return;const S=t.events.length;let q=S,$,j;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if($){j=t.events[q][1].end;break}$=!0}for(v(r),A=S;A<t.events.length;)t.events[A][1].end=Object.assign({},j),A++;jt(t.events,q+1,0,t.events.slice(S)),t.events.length=A}}function v(B){let E=n.length;for(;E-- >B;){const _=n[E];t.containerState=_[1],_[0].exit.call(t,e)}n.length=B}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function o1(e,t,n){return Ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function bl(e){if(e===null||ct(e)||n1(e))return 1;if(t1(e))return 2}function to(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Cs={name:"attention",tokenize:l1,resolveAll:u1};function u1(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),m=Object.assign({},e[n][1].start);yl(h,-l),yl(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=bt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=bt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=bt(u,to(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=bt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=bt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,jt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function l1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=bl(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=bl(l),h=!c||c===2&&a||n.includes(l),m=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?h:h&&(a||!m)),u._close=!!(i===42?m:m&&(c||!h)),t(l)}}function yl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const c1={name:"autolink",tokenize:d1};function d1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Tt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||Et(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Et(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ys(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):Jy(p)?(e.consume(p),u):n(p)}function c(p){return Et(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Et(p))&&r++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const Wa={tokenize:f1,partial:!0};function f1(e,t,n){return r;function r(i){return Be(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ve(i)?t(i):n(i)}}const Ld={name:"blockQuote",tokenize:h1,continuation:{tokenize:m1},exit:p1};function h1(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Be(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function m1(e,t,n){const r=this;return a;function a(s){return Be(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Ld,t,n)(s)}}function p1(e){e.exit("blockQuote")}const zd={name:"characterEscape",tokenize:g1};function g1(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return e1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const qd={name:"characterReference",tokenize:v1};function v1(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Et,c(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=Xy,c):(e.enter("characterReferenceValue"),i=7,s=Ds,c(h))}function c(h){if(h===59&&a){const m=e.exit("characterReferenceValue");return s===Et&&!eo(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),c):n(h)}}const Dl={tokenize:y1,partial:!0},Cl={name:"codeFenced",tokenize:b1,concrete:!0};function b1(e,t,n){const r=this,a={tokenize:_,partial:!0};let i=0,s=0,o;return l;function l(A){return u(A)}function u(A){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(A)}function c(A){return A===o?(s++,e.consume(A),c):s<3?n(A):(e.exit("codeFencedFenceSequence"),Be(A)?Ne(e,h,"whitespace")(A):h(A))}function h(A){return A===null||ve(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(Dl,f,E)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===null||ve(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(A)):Be(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,p,"whitespace")(A)):A===96&&A===o?n(A):(e.consume(A),m)}function p(A){return A===null||ve(A)?h(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(A))}function g(A){return A===null||ve(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(A)):A===96&&A===o?n(A):(e.consume(A),g)}function f(A){return e.attempt(a,E,y)(A)}function y(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),v}function v(A){return i>0&&Be(A)?Ne(e,x,"linePrefix",i+1)(A):x(A)}function x(A){return A===null||ve(A)?e.check(Dl,f,E)(A):(e.enter("codeFlowValue"),B(A))}function B(A){return A===null||ve(A)?(e.exit("codeFlowValue"),x(A)):(e.consume(A),B)}function E(A){return e.exit("codeFenced"),t(A)}function _(A,S,q){let $=0;return j;function j(M){return A.enter("lineEnding"),A.consume(M),A.exit("lineEnding"),N}function N(M){return A.enter("codeFencedFence"),Be(M)?Ne(A,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M)}function w(M){return M===o?(A.enter("codeFencedFenceSequence"),F(M)):q(M)}function F(M){return M===o?($++,A.consume(M),F):$>=s?(A.exit("codeFencedFenceSequence"),Be(M)?Ne(A,R,"whitespace")(M):R(M)):q(M)}function R(M){return M===null||ve(M)?(A.exit("codeFencedFence"),S(M)):q(M)}}}function y1(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const _i={name:"codeIndented",tokenize:C1},D1={tokenize:x1,partial:!0};function C1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ne(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ve(u)?e.attempt(D1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ve(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function x1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ve(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ne(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ve(s)?a(s):n(s)}}const w1={name:"codeText",tokenize:k1,resolve:E1,previous:_1};function E1(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function _1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function k1(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,c(h)):ve(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||ve(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function c(h){return h===96?(e.consume(h),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}function Wd(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,B1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),jt(e,a,n-a+1,o))}}return!u}function B1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,h,m=-1,p=n,g=0,f=0;const y=[f];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),h&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,y.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),m=y.length;m--;){const v=o.slice(y[m],y[m+1]),x=i.pop();l.unshift([x,x+v.length-1]),jt(e,x,2,v)}for(m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const A1={tokenize:S1,resolve:T1},F1={tokenize:j1,partial:!0};function T1(e){return Wd(e),e}function S1(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):ve(o)?e.check(F1,s,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function j1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ne(e,i,"linePrefix")}function i(s){if(s===null||ve(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Hd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),m):v===null||v===32||v===41||ys(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(v))}function m(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(o),m(v)):v===null||v===60||ve(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function f(v){return!c&&(v===null||v===41||ct(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,f):v===41?(e.consume(v),c--,f):v===null||v===32||v===40||ys(v)?n(v):(e.consume(v),v===92?y:f)}function y(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Ud(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):ve(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||ve(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Be(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function Vd(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):ve(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===s||m===null||ve(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:c)}function h(m){return m===s||m===92?(e.consume(m),c):c(m)}}function gr(e,t){let n;return r;function r(a){return ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Be(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const O1={name:"definition",tokenize:N1},P1={tokenize:R1,partial:!0};function N1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Ud.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ct(p)?gr(e,u)(p):u(p)}function u(p){return Hd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(P1,h,h)(p)}function h(p){return Be(p)?Ne(e,m,"whitespace")(p):m(p)}function m(p){return p===null||ve(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function R1(e,t,n){return r;function r(o){return ct(o)?gr(e,a)(o):n(o)}function a(o){return Vd(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Be(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ve(o)?t(o):n(o)}}const M1={name:"hardBreakEscape",tokenize:I1};function I1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ve(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const $1={name:"headingAtx",tokenize:z1,resolve:L1};function L1(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},jt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function z1(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ct(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ve(c)?(e.exit("atxHeading"),t(c)):Be(c)?Ne(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ct(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const q1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xl=["pre","script","style","textarea"],W1={name:"htmlFlow",tokenize:K1,resolveTo:V1,concrete:!0},H1={tokenize:Y1,partial:!0},U1={tokenize:Z1,partial:!0};function V1(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function K1(e,t,n){const r=this;let a,i,s,o,l;return u;function u(k){return c(k)}function c(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),h}function h(k){return k===33?(e.consume(k),m):k===47?(e.consume(k),i=!0,f):k===63?(e.consume(k),a=3,r.interrupt?t:D):Tt(k)?(e.consume(k),s=String.fromCharCode(k),y):n(k)}function m(k){return k===45?(e.consume(k),a=2,p):k===91?(e.consume(k),a=5,o=0,g):Tt(k)?(e.consume(k),a=4,r.interrupt?t:D):n(k)}function p(k){return k===45?(e.consume(k),r.interrupt?t:D):n(k)}function g(k){const T="CDATA[";return k===T.charCodeAt(o++)?(e.consume(k),o===T.length?r.interrupt?t:w:g):n(k)}function f(k){return Tt(k)?(e.consume(k),s=String.fromCharCode(k),y):n(k)}function y(k){if(k===null||k===47||k===62||ct(k)){const T=k===47,L=s.toLowerCase();return!T&&!i&&xl.includes(L)?(a=1,r.interrupt?t(k):w(k)):q1.includes(s.toLowerCase())?(a=6,T?(e.consume(k),v):r.interrupt?t(k):w(k)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):i?x(k):B(k))}return k===45||Et(k)?(e.consume(k),s+=String.fromCharCode(k),y):n(k)}function v(k){return k===62?(e.consume(k),r.interrupt?t:w):n(k)}function x(k){return Be(k)?(e.consume(k),x):j(k)}function B(k){return k===47?(e.consume(k),j):k===58||k===95||Tt(k)?(e.consume(k),E):Be(k)?(e.consume(k),B):j(k)}function E(k){return k===45||k===46||k===58||k===95||Et(k)?(e.consume(k),E):_(k)}function _(k){return k===61?(e.consume(k),A):Be(k)?(e.consume(k),_):B(k)}function A(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,S):Be(k)?(e.consume(k),A):q(k)}function S(k){return k===l?(e.consume(k),l=null,$):k===null||ve(k)?n(k):(e.consume(k),S)}function q(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||ct(k)?_(k):(e.consume(k),q)}function $(k){return k===47||k===62||Be(k)?B(k):n(k)}function j(k){return k===62?(e.consume(k),N):n(k)}function N(k){return k===null||ve(k)?w(k):Be(k)?(e.consume(k),N):n(k)}function w(k){return k===45&&a===2?(e.consume(k),Y):k===60&&a===1?(e.consume(k),K):k===62&&a===4?(e.consume(k),z):k===63&&a===3?(e.consume(k),D):k===93&&a===5?(e.consume(k),ne):ve(k)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(H1,J,F)(k)):k===null||ve(k)?(e.exit("htmlFlowData"),F(k)):(e.consume(k),w)}function F(k){return e.check(U1,R,J)(k)}function R(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),M}function M(k){return k===null||ve(k)?F(k):(e.enter("htmlFlowData"),w(k))}function Y(k){return k===45?(e.consume(k),D):w(k)}function K(k){return k===47?(e.consume(k),s="",se):w(k)}function se(k){if(k===62){const T=s.toLowerCase();return xl.includes(T)?(e.consume(k),z):w(k)}return Tt(k)&&s.length<8?(e.consume(k),s+=String.fromCharCode(k),se):w(k)}function ne(k){return k===93?(e.consume(k),D):w(k)}function D(k){return k===62?(e.consume(k),z):k===45&&a===2?(e.consume(k),D):w(k)}function z(k){return k===null||ve(k)?(e.exit("htmlFlowData"),J(k)):(e.consume(k),z)}function J(k){return e.exit("htmlFlow"),t(k)}}function Z1(e,t,n){const r=this;return a;function a(s){return ve(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Y1(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Wa,t,n)}}const G1={name:"htmlText",tokenize:Q1};function Q1(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),_):D===63?(e.consume(D),B):Tt(D)?(e.consume(D),q):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):Tt(D)?(e.consume(D),x):n(D)}function c(D){return D===45?(e.consume(D),p):n(D)}function h(D){return D===null?n(D):D===45?(e.consume(D),m):ve(D)?(s=h,K(D)):(e.consume(D),h)}function m(D){return D===45?(e.consume(D),p):h(D)}function p(D){return D===62?Y(D):D===45?m(D):h(D)}function g(D){const z="CDATA[";return D===z.charCodeAt(i++)?(e.consume(D),i===z.length?f:g):n(D)}function f(D){return D===null?n(D):D===93?(e.consume(D),y):ve(D)?(s=f,K(D)):(e.consume(D),f)}function y(D){return D===93?(e.consume(D),v):f(D)}function v(D){return D===62?Y(D):D===93?(e.consume(D),v):f(D)}function x(D){return D===null||D===62?Y(D):ve(D)?(s=x,K(D)):(e.consume(D),x)}function B(D){return D===null?n(D):D===63?(e.consume(D),E):ve(D)?(s=B,K(D)):(e.consume(D),B)}function E(D){return D===62?Y(D):B(D)}function _(D){return Tt(D)?(e.consume(D),A):n(D)}function A(D){return D===45||Et(D)?(e.consume(D),A):S(D)}function S(D){return ve(D)?(s=S,K(D)):Be(D)?(e.consume(D),S):Y(D)}function q(D){return D===45||Et(D)?(e.consume(D),q):D===47||D===62||ct(D)?$(D):n(D)}function $(D){return D===47?(e.consume(D),Y):D===58||D===95||Tt(D)?(e.consume(D),j):ve(D)?(s=$,K(D)):Be(D)?(e.consume(D),$):Y(D)}function j(D){return D===45||D===46||D===58||D===95||Et(D)?(e.consume(D),j):N(D)}function N(D){return D===61?(e.consume(D),w):ve(D)?(s=N,K(D)):Be(D)?(e.consume(D),N):$(D)}function w(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,F):ve(D)?(s=w,K(D)):Be(D)?(e.consume(D),w):(e.consume(D),R)}function F(D){return D===a?(e.consume(D),a=void 0,M):D===null?n(D):ve(D)?(s=F,K(D)):(e.consume(D),F)}function R(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ct(D)?$(D):(e.consume(D),R)}function M(D){return D===47||D===62||ct(D)?$(D):n(D)}function Y(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function K(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),se}function se(D){return Be(D)?Ne(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ne(D)}function ne(D){return e.enter("htmlTextData"),s(D)}}const no={name:"labelEnd",tokenize:rD,resolveTo:nD,resolveAll:tD},J1={tokenize:aD},X1={tokenize:iD},eD={tokenize:sD};function tD(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function nD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=bt(o,e.slice(i+1,i+r+3)),o=bt(o,[["enter",c,t]]),o=bt(o,to(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=bt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=bt(o,e.slice(s+1)),o=bt(o,[["exit",l,t]]),jt(e,i,e.length,o),e}function rD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?h(m):(s=r.parser.defined.includes(In(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(J1,c,s?c:h)(m):m===91?e.attempt(X1,c,s?u:h)(m):s?c(m):h(m)}function u(m){return e.attempt(eD,c,h)(m)}function c(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function aD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return ct(h)?gr(e,i)(h):i(h)}function i(h){return h===41?c(h):Hd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return ct(h)?gr(e,l)(h):c(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?Vd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return ct(h)?gr(e,c)(h):c(h)}function c(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function iD(e,t,n){const r=this;return a;function a(o){return Ud.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function sD(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const oD={name:"labelStartImage",tokenize:uD,resolveAll:no.resolveAll};function uD(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const lD={name:"labelStartLink",tokenize:cD,resolveAll:no.resolveAll};function cD(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const ki={name:"lineEnding",tokenize:dD};function dD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const la={name:"thematicBreak",tokenize:fD};function fD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ve(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Be(u)?Ne(e,o,"whitespace")(u):o(u))}}const ot={name:"list",tokenize:pD,continuation:{tokenize:gD},exit:bD},hD={tokenize:yD,partial:!0},mD={tokenize:vD,partial:!0};function pD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ds(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(la,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Ds(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Wa,r.interrupt?n:c,e.attempt(hD,m,h))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Be(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function gD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Wa,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Be(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(e,e.attempt(ot,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function vD(e,t,n){const r=this;return Ne(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function bD(e){e.exit(this.containerState.type)}function yD(e,t,n){const r=this;return Ne(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Be(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const wl={name:"setextUnderline",tokenize:CD,resolveTo:DD};function DD(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function CD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,h;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){h=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Be(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ve(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const xD={tokenize:wD};function wD(e){const t=this,n=e.attempt(Wa,r,e.attempt(this.parser.constructs.flowInitial,a,Ne(e,e.attempt(this.parser.constructs.flow,a,e.attempt(A1,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ED={resolveAll:Zd()},_D=Kd("string"),kD=Kd("text");function Kd(e){return{tokenize:t,resolveAll:Zd(e==="text"?BD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const h=a[c];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Zd(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function BD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,s=-1,o=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(u===-2)l=!0,o++;else if(u!==-1){i++;break}}if(o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-o,offset:r.end.offset-o,_index:r.start._index+i,_bufferIndex:i?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},u.start),r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}function AD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:x,enter:B,exit:E,attempt:S(_),check:S(A),interrupt:S(A,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:f,write:h};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(N){return s=bt(s,N),y(),s[s.length-1]!==null?[]:(q(t,0),u.events=to(i,u.events,u),u.events)}function m(N,w){return TD(p(N),w)}function p(N){return FD(s,N)}function g(){const{line:N,column:w,offset:F,_index:R,_bufferIndex:M}=r;return{line:N,column:w,offset:F,_index:R,_bufferIndex:M}}function f(N){a[N.line]=N.column,j()}function y(){let N;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(N=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===N&&r._bufferIndex<w.length;)v(w.charCodeAt(r._bufferIndex));else v(w)}}function v(N){c=c(N)}function x(N){ve(N)?(r.line++,r.column=1,r.offset+=N===-3?2:1,j()):N!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=N}function B(N,w){const F=w||{};return F.type=N,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function E(N){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function _(N,w){q(N,w.from)}function A(N,w){w.restore()}function S(N,w){return F;function F(R,M,Y){let K,se,ne,D;return Array.isArray(R)?J(R):"tokenize"in R?J([R]):z(R);function z(I){return U;function U(te){const ee=te!==null&&I[te],Z=te!==null&&I.null,ue=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return J(ue)(te)}}function J(I){return K=I,se=0,I.length===0?Y:k(I[se])}function k(I){return U;function U(te){return D=$(),ne=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?L():I.tokenize.call(w?Object.assign(Object.create(u),w):u,l,T,L)(te)}}function T(I){return N(ne,D),M}function L(I){return D.restore(),++se<K.length?k(K[se]):Y}}}function q(N,w){N.resolveAll&&!i.includes(N)&&i.push(N),N.resolve&&jt(u.events,w,u.events.length-w,N.resolve(u.events.slice(w),u)),N.resolveTo&&(u.events=N.resolveTo(u.events,u))}function $(){const N=g(),w=u.previous,F=u.currentConstruct,R=u.events.length,M=Array.from(o);return{restore:Y,from:R};function Y(){r=N,u.previous=w,u.currentConstruct=F,u.events.length=R,o=M,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function FD(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function TD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
113
|
+
`;break}case-3:{s=`\r
|
|
114
|
+
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const SD={42:ot,43:ot,45:ot,48:ot,49:ot,50:ot,51:ot,52:ot,53:ot,54:ot,55:ot,56:ot,57:ot,62:Ld},jD={91:O1},OD={[-2]:_i,[-1]:_i,32:_i},PD={35:$1,42:la,45:[wl,la],60:W1,61:wl,95:la,96:Cl,126:Cl},ND={38:qd,92:zd},RD={[-5]:ki,[-4]:ki,[-3]:ki,33:oD,38:qd,42:Cs,60:[c1,G1],91:lD,92:[M1,zd],93:no,95:Cs,96:w1},MD={null:[Cs,ED]},ID={null:[42,95]},$D={null:[]},LD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ID,contentInitial:jD,disable:$D,document:SD,flow:PD,flowInitial:OD,insideSpan:MD,string:ND,text:RD},Symbol.toStringTag,{value:"Module"}));function zD(e){const n=Yy([LD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(r1),document:a(i1),flow:a(xD),string:a(_D),text:a(kD)};return r;function a(i){return s;function s(o){return AD(r,i,o)}}}function qD(e){for(;!Wd(e););return e}const El=/[\0\t\n\r]/g;function WD(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,h,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(El.lastIndex=h,u=El.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<m&&(l.push(i.slice(h,m)),e+=m-h),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const HD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function UD(e){return e.replace(HD,VD)}function VD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return $d(n.slice(i?2:1),i?16:10)}return eo(n)||e}const Yd={}.hasOwnProperty;function KD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),ZD(n)(qD(zD(n).document().write(WD()(e,t,!0))))}function ZD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:$,autolinkEmail:$,atxHeading:i(me),blockQuote:i(ee),characterEscape:$,characterReference:$,codeFenced:i(Z),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Z,s),codeText:i(ue,s),codeTextData:$,data:$,codeFlowValue:$,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Se,s),htmlFlowData:$,htmlText:i(Se,s),htmlTextData:$,image:i(Pe),label:s,link:i(Ge),listItem:i(Ze),listItemValue:m,listOrdered:i(Ke,h),listUnordered:i(Ke),paragraph:i(tt),reference:k,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(Ae),thematicBreak:i(Le)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:te,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:I,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:l(v),codeText:l(M),codeTextData:j,data:j,definition:l(),definitionDestinationString:E,definitionLabelString:x,definitionTitleString:B,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(F),htmlFlowData:j,htmlText:l(R),htmlTextData:j,image:l(K),label:ne,labelText:se,lineEnding:N,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:D,resourceTitleString:z,resource:J,setextHeading:l(q),setextHeadingLineSequence:S,setextHeadingText:A,strong:l(),thematicBreak:l()}};Gd(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ae={type:"root",children:[]};const fe={stack:[ae],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},pe=[];let De=-1;for(;++De<H.length;)if(H[De][1].type==="listOrdered"||H[De][1].type==="listUnordered")if(H[De][0]==="enter")pe.push(De);else{const Ue=pe.pop();De=a(H,Ue,De)}for(De=-1;++De<H.length;){const Ue=t[H[De][0]];Yd.call(Ue,H[De][1].type)&&Ue[H[De][1].type].call(Object.assign({sliceSerialize:H[De][2].sliceSerialize},fe),H[De][1])}if(fe.tokenStack.length>0){const Ue=fe.tokenStack[fe.tokenStack.length-1];(Ue[1]||_l).call(fe,void 0,Ue[0])}for(ae.position={start:Ut(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Ut(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De<t.transforms.length;)ae=t.transforms[De](ae)||ae;return ae}function a(H,ae,fe){let pe=ae-1,De=-1,Ue=!1,Ve,ft,Pt,xt;for(;++pe<=fe;){const Qe=H[pe];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?De++:De--,xt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Ve&&!xt&&!De&&!Pt&&(Pt=pe),xt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:xt=void 0}if(!De&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||De===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Ve){let _t=pe;for(ft=void 0;_t--;){const ht=H[_t];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;ft&&(H[ft][1].type="lineEndingBlank",Ue=!0),ht[1].type="lineEnding",ft=_t}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}Pt&&(!ft||Pt<ft)&&(Ve._spread=!0),Ve.end=Object.assign({},ft?H[ft][1].start:Qe[1].end),H.splice(ft||pe,0,["exit",Ve,Qe[2]]),pe++,fe++}if(Qe[1].type==="listItemPrefix"){const _t={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Ve=_t,H.splice(pe,0,["enter",_t,Qe[2]]),pe++,fe++,Pt=void 0,xt=!0}}}return H[ae][1]._spread=Ue,fe}function i(H,ae){return fe;function fe(pe){o.call(this,H(pe),pe),ae&&ae.call(this,pe)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ae,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ae,fe]),H.position={start:Ut(ae.start),end:void 0}}function l(H){return ae;function ae(fe){H&&H.call(this,fe),u.call(this,fe)}}function u(H,ae){const fe=this.stack.pop(),pe=this.tokenStack.pop();if(pe)pe[0].type!==H.type&&(ae?ae.call(this,H,pe[0]):(pe[1]||_l).call(this,H,pe[0]));else throw new Error("Cannot close `"+H.type+"` ("+pr({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Ut(H.end)}function c(){return Ky(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(H){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=H}function g(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=H}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/(\r?\n|\r)$/g,"")}function x(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=In(this.sliceSerialize(H)).toLowerCase()}function B(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function E(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function _(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const fe=this.sliceSerialize(H).length;ae.depth=fe}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function S(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function $(H){const fe=this.stack[this.stack.length-1].children;let pe=fe[fe.length-1];(!pe||pe.type!=="text")&&(pe=We(),pe.position={start:Ut(H.start),end:void 0},fe.push(pe)),this.stack.push(pe)}function j(H){const ae=this.stack.pop();ae.value+=this.sliceSerialize(H),ae.position.end=Ut(H.end)}function N(H){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=ae.children[ae.children.length-1];fe.position.end=Ut(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&($.call(this,H),j.call(this,H))}function w(){this.data.atHardBreak=!0}function F(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function R(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function M(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function Y(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function K(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function se(H){const ae=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=UD(ae),fe.identifier=In(ae).toLowerCase()}function ne(){const H=this.stack[this.stack.length-1],ae=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const pe=H.children;fe.children=pe}else fe.alt=ae}function D(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function z(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function J(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function T(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=In(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function L(H){this.data.characterReferenceType=H.type}function I(H){const ae=this.sliceSerialize(H),fe=this.data.characterReferenceType;let pe;fe?(pe=$d(ae,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=eo(ae);const De=this.stack.pop();De.value+=pe,De.position.end=Ut(H.end)}function U(H){j.call(this,H);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(H)}function te(H){j.call(this,H);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(H)}function ee(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function ue(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function Ge(){return{type:"link",title:null,url:"",children:[]}}function Ke(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ze(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function Le(){return{type:"thematicBreak"}}}function Ut(e){return{line:e.line,column:e.column,offset:e.offset}}function Gd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Gd(e,r):YD(e,r)}}function YD(e,t){let n;for(n in t)if(Yd.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function _l(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+pr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+pr({start:t.start,end:t.end})+") is still open")}function GD(e){const t=this;t.parser=n;function n(r){return KD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Qd(e,t){var l,u,c;const n={...Pn,...t==null?void 0:t.nodeTypes,heading:{...Pn.heading,...(l=t==null?void 0:t.nodeTypes)==null?void 0:l.heading}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>Qd({...h,ordered:e.ordered||!1},t))),e.type){case"heading":return{type:n.heading[e.depth||1],children:s};case"list":return{type:e.ordered?n.ol_list:n.ul_list,children:s};case"listItem":return{type:n.listItem,children:s};case"paragraph":return{type:n.paragraph,children:s};case"link":return{type:n.link,[r]:e.url,children:s};case"image":return{type:n.image,children:[{text:""}],[a]:e.url,[i]:e.alt};case"blockquote":return{type:n.block_quote,children:s};case"code":return{type:n.code_block,language:e.lang,children:[{text:e.value}]};case"html":return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n.paragraph,children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:"paragraph",children:[{text:e.value||""}]};case"emphasis":return{[n.emphasis_mark]:!0,...Bi(s),...Kr(s)};case"strong":return{[n.strong_mark]:!0,...Bi(s),...Kr(s)};case"delete":return{[n.delete_mark]:!0,...Bi(s),...Kr(s)};case"inlineCode":return{[n.inline_code_mark]:!0,text:e.value,...Kr(s)};case"thematicBreak":return{type:n.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Bi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Kr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const QD=function(t){const n=r=>r.children.map(a=>Qd(a,t));this.Compiler=n},JD=(e,t=n=>{})=>{qy().use(GD).use(QD).process(e).then(n=>{const r=cn(n.result);r.map(a=>{"children"in a&&a.children&&a.children.map((i,s)=>{if("text"in i&&i.text){const o=i.text.match(/~~(.*?)~~/g);o&&o.map(l=>{const u=l.replace(/~~/g,""),c=i.text.indexOf(l),h=i.text.substring(0,c),m=i.text.substring(c+l.length),p=[{text:h},{text:u,strikeThrough:!0},{text:m}];a.children.splice(s,1,...p)})}})}),t(r)})},kl={"mod+b":"bold","mod+i":"italic","mod+shift+x":"strikeThrough","mod+k":"link","mod+shift+7":"ol_list","mod+shift+8":"ul_list","mod+shift+9":"block_quote"},Bn=e=>typeof e.text=="string",XD=["thematic_break","image"],Bl="<br>";function Jd(e,t={nodeTypes:Pn}){const{nodeTypes:n=Pn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Pn,...n,heading:{...Pn.heading,...n.heading}},l=[o.ul_list,o.ol_list];let u=i;if(Bn(e)||(u=e.children.map(c=>{const h=Bn(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!Bn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Bn(g)&&g.type===o.link)),Jd({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a})}).join("")),!r&&(i===""||i===`
|
|
115
|
+
`)&&e.parentType===o.paragraph&&(s=o.paragraph,u=Bl),!(u===""&&!XD.find(c=>o[c]===s)))switch(u!==Bl&&Bn(e)&&(e.strikeThrough&&e.bold&&e.italic?u=An(u,"~~***"):e.bold&&e.italic?u=An(u,"***"):(e.bold&&(u=An(u,"**")),e.italic&&(u=An(u,"_")),e.strikeThrough&&(u=An(u,"~~")),e.code&&(u=An(u,"`")))),s){case o.heading[1]:return`# ${u}
|
|
116
|
+
`;case o.heading[2]:return`## ${u}
|
|
117
|
+
`;case o.heading[3]:return`### ${u}
|
|
118
|
+
`;case o.heading[4]:return`#### ${u}
|
|
119
|
+
`;case o.heading[5]:return`##### ${u}
|
|
120
|
+
`;case o.heading[6]:return`###### ${u}
|
|
121
|
+
`;case o.block_quote:return`> ${u}
|
|
122
|
+
|
|
123
|
+
`;case o.code_block:return`\`\`\`${e.language||""}
|
|
124
|
+
${u}
|
|
125
|
+
\`\`\`
|
|
126
|
+
`;case o.link:return`[${u}](${e.link||""})`;case o.image:return``;case o.ul_list:case o.ol_list:return`
|
|
127
|
+
${u}
|
|
128
|
+
`;case o.listItem:const c=e&&e.parentType===o.ol_list,h=e.children.length===1&&Bn(e.children[0]);let m="";for(let p=0;a>p;p++)c?m+=" ":m+=" ";return`${m}${c?"1.":"-"} ${u}${h?`
|
|
129
|
+
`:""}`;case o.paragraph:return`${u}
|
|
130
|
+
|
|
131
|
+
`;case o.thematic_break:return`---
|
|
132
|
+
`;default:return u}}function An(e,t){const n=e.trim(),r=n,a=`${t}${r}${Al(t)}`;if(r.length===e.length)return a;const i=t+r+Al(t);return e.replace(n,i)}const Al=e=>e.split("").reverse().join(""),eC=e=>e.map(t=>Jd(t)).join("").trim();var tC=iC,nC=/^(?:\w+:)?\/\/(\S+)$/,rC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,aC=/^[^\s\.]+\.\S{2,}$/;function iC(e){if(typeof e!="string")return!1;var t=e.match(nC);if(!t)return!1;var n=t[1];return n?!!(rC.test(n)||aC.test(n)):!1}const sC=bn(tC),oC=(e,t)=>{const{insertText:n,isInline:r}=e;return e.isInline=a=>{const i=a;return["link"].includes(i.type)||r(a)},e.insertText=a=>{a&&sC(a)?Od(e,a,t):n(a)},e};const Xd=({id:e="rich-text-editor",value:t,placeholder:n,onChange:r=()=>{},autoFocus:a=!0,...i})=>{const s=oe.useIntl(),o=[{type:"paragraph",children:[{text:""}]}],l={originalValue:t||"",initialValue:t?null:o,tabbableOption:xa[0],openTooltip:null,showLinkEditor:!1,lastAnchor:null,hasInteracted:!1},[u,c]=C.useReducer(Ar,l),{originalValue:h,initialValue:m,lastAnchor:p,hasInteracted:g}=u,f=E=>{const _=E||xa[0];E&&c([{type:"tabbableOption",value:_}])};C.useEffect(()=>{if(t){let E=cn(t);E.includes("<")&&(E=new pa().turndown(E)),JD(E,_=>{c([{type:"initialValue",value:_}])})}},[]),C.useEffect(()=>{t!==""||!B||rc(h,t)&&!g||(b.withoutNormalizing(B,()=>{X.delete(B,{at:{anchor:b.start(B,[]),focus:b.end(B,[])}}),X.deselect(B),B.children.length!==0&&X.unwrapNodes(B,{at:[0]}),X.insertNodes(B,o,{at:[0]})}),c([{type:"initialValue",value:o},{type:"lastAnchor",value:null}]))},[t]);const y=`rte-${e}`,v=C.useCallback(E=>d.jsx(fy,{...E}),[]),x=C.useCallback(E=>d.jsx(hy,{...E}),[]),B=C.useMemo(()=>oC(rv(cy(tv())),y),[]);return m?d.jsx("div",{id:y,className:"rich-text-editor",children:d.jsx(Cn.Provider,{value:{...u,id:y,setFocus:f,dispatch:c},children:d.jsxs(uy,{editor:B,initialValue:m,onChange:E=>{if(B.operations.some(A=>A.type!=="set_selection")){const A=eC(E);r(A),g||c([{type:"hasInteracted",value:!0}])}},...i,children:[d.jsx(Xb,{className:"input",renderElement:v,renderLeaf:x,placeholder:n||s.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:0,onKeyDown:E=>{for(const _ in kl)if(Xh(_,E)){E.stopPropagation(),E.preventDefault();const A=kl[_];if(A==="link"){c([{type:"showLinkEditor",value:!0}]);return}if(Cy(A)){Rd(B,A);return}jd(B,A)}},onBlur:()=>{B.selection&&c([{type:"lastAnchor",value:B.selection.anchor}])},onFocus:()=>{if(p){if(!P.isPath(p.path)||!ie.has(B,p.path))return;const E=ie.get(B,p.path);let _=0;if(de.isText(E)?_=E.text.length:E.children&&(_=E.children.length),p.offset>_)return;X.select(B,{anchor:p,focus:p})}}}),d.jsx(Ey,{})]})})}):null};const uC=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:V("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:V("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const h=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:h,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:h,children:c.label})]},h)})})]})};function lC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),h=async m=>{o(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:V("profile-image-change-figure",e),children:[d.jsx(tn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(oe.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:h,hidden:!0,"data-testid":"file-input"}),d.jsx(xe,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(oe.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const ef=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Gn,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const tf=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,h]=C.useState([]),[m,p]=C.useState(!0),[g,f]=C.useState(u),{formatMessage:y}=oe.useIntl(),v=async E=>{E.preventDefault();try{await l(c),h([]),f("SUCCESS")}catch(_){f("ERROR"),o(_)}},x=E=>{E.preventDefault(),f("NOT_SUBMITTED"),p(!0),h([])},B=E=>{E.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(Qt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(xe,{variant:"secondary",onClick:x,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(xe,{onClick:B,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(xe,{onClick:x,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:V("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Xf.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:E=>{h(E),p(!E.length)},autoFocus:!1,getLabel:(E,_,A)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:E}),d.jsx(xe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{A(_),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},_)})]}),d.jsx(Qt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(xe,{className:"sendEmailsButton",disabled:m,children:n})})]})})},ca=e=>e.map(t=>({condition:t})),vt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},cC=({functions:e,...t})=>{const{formatMessage:n}=oe.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[vt.NEW_PASSWORD]!==p[vt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!Qi(p[vt.NEW_PASSWORD]).isValid,h=[{"data-testid":vt.NEW_PASSWORD,id:vt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ca(["required",c]),functions:{onChange:p=>l(Qi(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":vt.CONFIRMED_PASSWORD,id:vt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ca(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":vt.CURRENT_PASSWORD,id:vt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ca(["required"])}),i&&h.push({component:jc,props:{matchingRules:o}});const m={id:vt.FORM_ID,fields:h,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(vt.NEW_PASSWORD)||g.includes(vt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(Gn,{...m}),r&&d.jsx(en,{variant:"error",text:r})]})};const nf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=oe.useIntl(),u=C.useRef(null);Ln(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:V("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&c(h)}}),d.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Fl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},dC=e=>{const t={};for(const n of e.entries())t[n[0]]=n[1];return{name:t.full_name.toString().trim(),email:t.email_address.toString().toLowerCase().trim(),jobTitle:t.job_title,organization:t.organization,bioLink:t.url,optIn:!0,expectation:t.expectation,page:window.location.pathname,"g-recaptcha-response":t["g-recaptcha-response"]}},fC=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=dC(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},hC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,h=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Fl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Bc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Fl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const mC=({className:e=""})=>d.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(oe.FormattedMessage,{id:"signup_success_title"})}),d.jsx(oe.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const pC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},gC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=oe.useIntl(),{title:u=!0,expectation:c=!1,url:h=!0,logInButton:m=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:h,logInButton:m,successMessage:p},[f,y]=C.useReducer(Ar,pC),{validFields:v,emailDetails:x,shouldManuallyApprove:B,shouldDisableButton:E,showSuccessMessage:_,showError:A}=f,[S,q]=ks.useCookies(["signup-this-session","functional-cookie-consent"]),$={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{B===!0&&$.jobTitle.current&&$.jobTitle.current.focus()},[B]),C.useEffect(()=>{S["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[S]),C.useEffect(()=>{_&&S["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[_]);const j=C.useMemo(()=>hC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:$,state:f,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,$,g,f]),N=E?!0:B?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&_?d.jsx(mC,{className:e}):d.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(oe.FormattedMessage,{id:"signup_title"})}),A&&d.jsx(en,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Gn,{className:"signup-form",formRef:$.form,id:"sign-up-form",fields:j,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:N?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await fC({refs:$,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:f})},onCatch:w=>{r.handleError(w),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:$.hiddenValidation})]})};var xs={exports:{}},Zr={exports:{}},Fe={};/** @license React v16.13.1
|
|
38
133
|
* react-is.production.min.js
|
|
39
134
|
*
|
|
40
135
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
136
|
*
|
|
42
137
|
* This source code is licensed under the MIT license found in the
|
|
43
138
|
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/var
|
|
139
|
+
*/var Tl;function vC(){if(Tl)return Fe;Tl=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function B(_){if(typeof _=="object"&&_!==null){var A=_.$$typeof;switch(A){case t:switch(_=_.type,_){case l:case u:case r:case i:case a:case h:return _;default:switch(_=_&&_.$$typeof,_){case o:case c:case g:case p:case s:return _;default:return A}}case n:return A}}}function E(_){return B(_)===u}return Fe.AsyncMode=l,Fe.ConcurrentMode=u,Fe.ContextConsumer=o,Fe.ContextProvider=s,Fe.Element=t,Fe.ForwardRef=c,Fe.Fragment=r,Fe.Lazy=g,Fe.Memo=p,Fe.Portal=n,Fe.Profiler=i,Fe.StrictMode=a,Fe.Suspense=h,Fe.isAsyncMode=function(_){return E(_)||B(_)===l},Fe.isConcurrentMode=E,Fe.isContextConsumer=function(_){return B(_)===o},Fe.isContextProvider=function(_){return B(_)===s},Fe.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},Fe.isForwardRef=function(_){return B(_)===c},Fe.isFragment=function(_){return B(_)===r},Fe.isLazy=function(_){return B(_)===g},Fe.isMemo=function(_){return B(_)===p},Fe.isPortal=function(_){return B(_)===n},Fe.isProfiler=function(_){return B(_)===i},Fe.isStrictMode=function(_){return B(_)===a},Fe.isSuspense=function(_){return B(_)===h},Fe.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===u||_===i||_===a||_===h||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===g||_.$$typeof===p||_.$$typeof===s||_.$$typeof===o||_.$$typeof===c||_.$$typeof===y||_.$$typeof===v||_.$$typeof===x||_.$$typeof===f)},Fe.typeOf=B,Fe}var Te={};/** @license React v16.13.1
|
|
45
140
|
* react-is.development.js
|
|
46
141
|
*
|
|
47
142
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
48
143
|
*
|
|
49
144
|
* This source code is licensed under the MIT license found in the
|
|
50
145
|
* LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/var
|
|
146
|
+
*/var Sl;function bC(){return Sl||(Sl=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function B(Q){return typeof Q=="string"||typeof Q=="function"||Q===r||Q===u||Q===i||Q===a||Q===h||Q===m||typeof Q=="object"&&Q!==null&&(Q.$$typeof===g||Q.$$typeof===p||Q.$$typeof===s||Q.$$typeof===o||Q.$$typeof===c||Q.$$typeof===y||Q.$$typeof===v||Q.$$typeof===x||Q.$$typeof===f)}function E(Q){if(typeof Q=="object"&&Q!==null){var ge=Q.$$typeof;switch(ge){case t:var me=Q.type;switch(me){case l:case u:case r:case i:case a:case h:return me;default:var _e=me&&me.$$typeof;switch(_e){case o:case c:case g:case p:case s:return _e;default:return ge}}case n:return ge}}}var _=l,A=u,S=o,q=s,$=t,j=c,N=r,w=g,F=p,R=n,M=i,Y=a,K=h,se=!1;function ne(Q){return se||(se=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(Q)||E(Q)===l}function D(Q){return E(Q)===u}function z(Q){return E(Q)===o}function J(Q){return E(Q)===s}function k(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===t}function T(Q){return E(Q)===c}function L(Q){return E(Q)===r}function I(Q){return E(Q)===g}function U(Q){return E(Q)===p}function te(Q){return E(Q)===n}function ee(Q){return E(Q)===i}function Z(Q){return E(Q)===a}function ue(Q){return E(Q)===h}Te.AsyncMode=_,Te.ConcurrentMode=A,Te.ContextConsumer=S,Te.ContextProvider=q,Te.Element=$,Te.ForwardRef=j,Te.Fragment=N,Te.Lazy=w,Te.Memo=F,Te.Portal=R,Te.Profiler=M,Te.StrictMode=Y,Te.Suspense=K,Te.isAsyncMode=ne,Te.isConcurrentMode=D,Te.isContextConsumer=z,Te.isContextProvider=J,Te.isElement=k,Te.isForwardRef=T,Te.isFragment=L,Te.isLazy=I,Te.isMemo=U,Te.isPortal=te,Te.isProfiler=ee,Te.isStrictMode=Z,Te.isSuspense=ue,Te.isValidElementType=B,Te.typeOf=E}()),Te}var jl;function rf(){return jl||(jl=1,process.env.NODE_ENV==="production"?Zr.exports=vC():Zr.exports=bC()),Zr.exports}/*
|
|
52
147
|
object-assign
|
|
53
148
|
(c) Sindre Sorhus
|
|
54
149
|
@license MIT
|
|
55
|
-
*/var
|
|
56
|
-
Valid keys: `+JSON.stringify(Object.keys(
|
|
150
|
+
*/var Ai,Ol;function yC(){if(Ol)return Ai;Ol=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ai=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var m=0;m<u.length;m++)n.call(o,u[m])&&(l[u[m]]=o[u[m]])}}return l},Ai}var Fi,Pl;function ro(){if(Pl)return Fi;Pl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Fi=e,Fi}var Ti,Nl;function af(){return Nl||(Nl=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Rl;function DC(){if(Rl)return Si;Rl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ro(),n={},r=af();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var h;try{if(typeof i[c]!="function"){var m=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}h=i[c](s,c,l,o,null,t)}catch(g){h=g}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var p=u?u():"";e("Failed "+o+" type: "+h.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Si=a,Si}var ji,Ml;function CC(){if(Ml)return ji;Ml=1;var e=rf(),t=yC(),n=ro(),r=af(),a=DC(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return ji=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function h(D){var z=D&&(u&&D[u]||D[c]);if(typeof z=="function")return z}var m="<<anonymous>>",p={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:x(),arrayOf:B,element:E(),elementType:_(),instanceOf:A,node:j(),objectOf:q,oneOf:S,oneOfType:$,shape:w,exact:F};function g(D,z){return D===z?D!==0||1/D===1/z:D!==D&&z!==z}function f(D,z){this.message=D,this.data=z&&typeof z=="object"?z:{},this.stack=""}f.prototype=Error.prototype;function y(D){if(process.env.NODE_ENV!=="production")var z={},J=0;function k(L,I,U,te,ee,Z,ue){if(te=te||m,Z=Z||U,ue!==n){if(l){var Q=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw Q.name="Invariant Violation",Q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ge=te+":"+U;!z[ge]&&J<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Z+"` prop on `"+te+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),z[ge]=!0,J++)}}return I[U]==null?L?I[U]===null?new f("The "+ee+" `"+Z+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new f("The "+ee+" `"+Z+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:D(I,U,te,ee,Z)}var T=k.bind(null,!1);return T.isRequired=k.bind(null,!0),T}function v(D){function z(J,k,T,L,I,U){var te=J[k],ee=Y(te);if(ee!==D){var Z=K(te);return new f("Invalid "+L+" `"+I+"` of type "+("`"+Z+"` supplied to `"+T+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return y(z)}function x(){return y(s)}function B(D){function z(J,k,T,L,I){if(typeof D!="function")return new f("Property `"+I+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var U=J[k];if(!Array.isArray(U)){var te=Y(U);return new f("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+T+"`, expected an array."))}for(var ee=0;ee<U.length;ee++){var Z=D(U,ee,T,L,I+"["+ee+"]",n);if(Z instanceof Error)return Z}return null}return y(z)}function E(){function D(z,J,k,T,L){var I=z[J];if(!o(I)){var U=Y(I);return new f("Invalid "+T+" `"+L+"` of type "+("`"+U+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return y(D)}function _(){function D(z,J,k,T,L){var I=z[J];if(!e.isValidElementType(I)){var U=Y(I);return new f("Invalid "+T+" `"+L+"` of type "+("`"+U+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return y(D)}function A(D){function z(J,k,T,L,I){if(!(J[k]instanceof D)){var U=D.name||m,te=ne(J[k]);return new f("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+T+"`, expected ")+("instance of `"+U+"`."))}return null}return y(z)}function S(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function z(J,k,T,L,I){for(var U=J[k],te=0;te<D.length;te++)if(g(U,D[te]))return null;var ee=JSON.stringify(D,function(ue,Q){var ge=K(Q);return ge==="symbol"?String(Q):Q});return new f("Invalid "+L+" `"+I+"` of value `"+String(U)+"` "+("supplied to `"+T+"`, expected one of "+ee+"."))}return y(z)}function q(D){function z(J,k,T,L,I){if(typeof D!="function")return new f("Property `"+I+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var U=J[k],te=Y(U);if(te!=="object")return new f("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+T+"`, expected an object."));for(var ee in U)if(r(U,ee)){var Z=D(U,ee,T,L,I+"."+ee,n);if(Z instanceof Error)return Z}return null}return y(z)}function $(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var z=0;z<D.length;z++){var J=D[z];if(typeof J!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+se(J)+" at index "+z+"."),s}function k(T,L,I,U,te){for(var ee=[],Z=0;Z<D.length;Z++){var ue=D[Z],Q=ue(T,L,I,U,te,n);if(Q==null)return null;Q.data&&r(Q.data,"expectedType")&&ee.push(Q.data.expectedType)}var ge=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new f("Invalid "+U+" `"+te+"` supplied to "+("`"+I+"`"+ge+"."))}return y(k)}function j(){function D(z,J,k,T,L){return R(z[J])?null:new f("Invalid "+T+" `"+L+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return y(D)}function N(D,z,J,k,T){return new f((D||"React class")+": "+z+" type `"+J+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function w(D){function z(J,k,T,L,I){var U=J[k],te=Y(U);if(te!=="object")return new f("Invalid "+L+" `"+I+"` of type `"+te+"` "+("supplied to `"+T+"`, expected `object`."));for(var ee in D){var Z=D[ee];if(typeof Z!="function")return N(T,L,I,ee,K(Z));var ue=Z(U,ee,T,L,I+"."+ee,n);if(ue)return ue}return null}return y(z)}function F(D){function z(J,k,T,L,I){var U=J[k],te=Y(U);if(te!=="object")return new f("Invalid "+L+" `"+I+"` of type `"+te+"` "+("supplied to `"+T+"`, expected `object`."));var ee=t({},J[k],D);for(var Z in ee){var ue=D[Z];if(r(D,Z)&&typeof ue!="function")return N(T,L,I,Z,K(ue));if(!ue)return new f("Invalid "+L+" `"+I+"` key `"+Z+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(J[k],null," ")+`
|
|
151
|
+
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var Q=ue(U,Z,T,L,I+"."+Z,n);if(Q)return Q}return null}return y(z)}function R(D){switch(typeof D){case"number":case"string":case"undefined":return!0;case"boolean":return!D;case"object":if(Array.isArray(D))return D.every(R);if(D===null||o(D))return!0;var z=h(D);if(z){var J=z.call(D),k;if(z!==D.entries){for(;!(k=J.next()).done;)if(!R(k.value))return!1}else for(;!(k=J.next()).done;){var T=k.value;if(T&&!R(T[1]))return!1}}else return!1;return!0;default:return!1}}function M(D,z){return D==="symbol"?!0:z?z["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&z instanceof Symbol:!1}function Y(D){var z=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":M(z,D)?"symbol":z}function K(D){if(typeof D>"u"||D===null)return""+D;var z=Y(D);if(z==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return z}function se(D){var z=K(D);switch(z){case"array":case"object":return"an "+z;case"boolean":case"date":case"regexp":return"a "+z;default:return z}}function ne(D){return!D.constructor||!D.constructor.name?m:D.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},ji}var Oi,Il;function xC(){if(Il)return Oi;Il=1;var e=ro();function t(){}function n(){}return n.resetWarningCache=t,Oi=function(){function r(s,o,l,u,c,h){if(h!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Oi}if(process.env.NODE_ENV!=="production"){var wC=rf(),EC=!0;xs.exports=CC()(wC.isElement,EC)}else xs.exports=xC()();var _C=xs.exports;/*!
|
|
57
152
|
* tabbable 6.2.0
|
|
58
153
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
59
|
-
*/var
|
|
154
|
+
*/var sf=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],wa=sf.join(","),of=typeof Element>"u",vn=of?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ea=!of&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},_a=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},kC=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},uf=function(t,n,r){if(_a(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(wa));return n&&vn.call(t,wa)&&a.unshift(t),a=a.filter(r),a},lf=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!_a(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=vn.call(s,wa);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!_a(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&m){var p=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},cf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Zt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||kC(t))&&!cf(t)?0:t.tabIndex},BC=function(t,n){var r=Zt(t);return r<0&&n&&!cf(t)?0:r},AC=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},df=function(t){return t.tagName==="INPUT"},FC=function(t){return df(t)&&t.type==="hidden"},TC=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},SC=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},jC=function(t){if(!t.name)return!0;var n=t.form||Ea(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=SC(a,t.form);return!i||i===t},OC=function(t){return df(t)&&t.type==="radio"},PC=function(t){return OC(t)&&!jC(t)},NC=function(t){var n,r=t&&Ea(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,c,h;r=Ea(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(h=c.ownerDocument)!==null&&h!==void 0&&h.contains(a))}}return i},$l=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},RC=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=vn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(vn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=Ea(t);if(l&&!l.shadowRoot&&a(l)===!0)return $l(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(NC(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return $l(t);return!1},MC=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var a=n.children.item(r);if(a.tagName==="LEGEND")return vn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},ka=function(t,n){return!(n.disabled||_a(n)||FC(n)||RC(n,t)||TC(n)||MC(n))},ws=function(t,n){return!(PC(n)||Zt(n)<0||!ka(t,n))},IC=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},$C=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=BC(o,s),u=s?e(a.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:l,item:a,isScope:s,content:u})}),r.sort(AC).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},ff=function(t,n){n=n||{};var r;return n.getShadowRoot?r=lf([t],n.includeContainer,{filter:ws.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:IC}):r=uf(t,n.includeContainer,ws.bind(null,n)),$C(r)},hf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=lf([t],n.includeContainer,{filter:ka.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=uf(t,n.includeContainer,ka.bind(null,n)),r},on=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return vn.call(t,wa)===!1?!1:ws(n,t)},LC=sf.concat("iframe").join(","),da=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return vn.call(t,LC)===!1?!1:ka(n,t)};const zC=Object.freeze(Object.defineProperty({__proto__:null,focusable:hf,getTabIndex:Zt,isFocusable:da,isTabbable:on,tabbable:ff},Symbol.toStringTag,{value:"Module"}));/*!
|
|
60
155
|
* focus-trap 7.5.4
|
|
61
156
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
62
|
-
*/function Gr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Qr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gr(Object(n),!0).forEach(function(r){Mo(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gr(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Mo(t,e,n){return e=Fo(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ro(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fo(t){var e=Ro(t,"string");return typeof e=="symbol"?e:String(e)}var Jr={activateTrap:function(e,n){if(e.length>0){var r=e[e.length-1];r!==n&&r.pause()}var s=e.indexOf(n);s===-1||e.splice(s,1),e.push(n)},deactivateTrap:function(e,n){var r=e.indexOf(n);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},Oo=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Ao=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},vt=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Do=function(e){return vt(e)&&!e.shiftKey},Io=function(e){return vt(e)&&e.shiftKey},Xr=function(e){return setTimeout(e,0)},ea=function(e,n){var r=-1;return e.every(function(s,i){return n(s)?(r=i,!1):!0}),r},lt=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return typeof e=="function"?e.apply(void 0,r):e},$t=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Lo=[],Bo=function(e,n){var r=(n==null?void 0:n.document)||document,s=(n==null?void 0:n.trapStack)||Lo,i=Qr({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Do,isKeyBackward:Io},n),o={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},c,u=function(j,T,P){return j&&j[T]!==void 0?j[T]:i[P||T]},l=function(j,T){var P=typeof(T==null?void 0:T.composedPath)=="function"?T.composedPath():void 0;return o.containerGroups.findIndex(function(O){var z=O.container,V=O.tabbableNodes;return z.contains(j)||(P==null?void 0:P.includes(z))||V.find(function(H){return H===j})})},d=function(j){var T=i[j];if(typeof T=="function"){for(var P=arguments.length,O=new Array(P>1?P-1:0),z=1;z<P;z++)O[z-1]=arguments[z];T=T.apply(void 0,O)}if(T===!0&&(T=void 0),!T){if(T===void 0||T===!1)return T;throw new Error("`".concat(j,"` was specified but was not a node, or did not return a node"))}var V=T;if(typeof T=="string"&&(V=r.querySelector(T),!V))throw new Error("`".concat(j,"` as selector refers to no known node"));return V},m=function(){var j=d("initialFocus");if(j===!1)return!1;if(j===void 0||!qt(j,i.tabbableOptions))if(l(r.activeElement)>=0)j=r.activeElement;else{var T=o.tabbableGroups[0],P=T&&T.firstTabbableNode;j=P||d("fallbackFocus")}if(!j)throw new Error("Your focus-trap needs to have at least one focusable element");return j},f=function(){if(o.containerGroups=o.containers.map(function(j){var T=Ja(j,i.tabbableOptions),P=Xa(j,i.tabbableOptions),O=T.length>0?T[0]:void 0,z=T.length>0?T[T.length-1]:void 0,V=P.find(function(E){return Be(E)}),H=P.slice().reverse().find(function(E){return Be(E)}),Y=!!T.find(function(E){return Me(E)>0});return{container:j,tabbableNodes:T,focusableNodes:P,posTabIndexesFound:Y,firstTabbableNode:O,lastTabbableNode:z,firstDomTabbableNode:V,lastDomTabbableNode:H,nextTabbableNode:function(M){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,W=T.indexOf(M);return W<0?B?P.slice(P.indexOf(M)+1).find(function(Z){return Be(Z)}):P.slice(0,P.indexOf(M)).reverse().find(function(Z){return Be(Z)}):T[W+(B?1:-1)]}}}),o.tabbableGroups=o.containerGroups.filter(function(j){return j.tabbableNodes.length>0}),o.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(o.containerGroups.find(function(j){return j.posTabIndexesFound})&&o.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function $(j){var T=j.activeElement;if(T)return T.shadowRoot&&T.shadowRoot.activeElement!==null?$(T.shadowRoot):T},b=function $(j){if(j!==!1&&j!==p(document)){if(!j||!j.focus){$(m());return}j.focus({preventScroll:!!i.preventScroll}),o.mostRecentlyFocusedNode=j,Oo(j)&&j.select()}},h=function(j){var T=d("setReturnFocus",j);return T||(T===!1?!1:j)},y=function(j){var T=j.target,P=j.event,O=j.isBackward,z=O===void 0?!1:O;T=T||$t(P),f();var V=null;if(o.tabbableGroups.length>0){var H=l(T,P),Y=H>=0?o.containerGroups[H]:void 0;if(H<0)z?V=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:V=o.tabbableGroups[0].firstTabbableNode;else if(z){var E=ea(o.tabbableGroups,function(K){var Q=K.firstTabbableNode;return T===Q});if(E<0&&(Y.container===T||qt(T,i.tabbableOptions)&&!Be(T,i.tabbableOptions)&&!Y.nextTabbableNode(T,!1))&&(E=H),E>=0){var M=E===0?o.tabbableGroups.length-1:E-1,B=o.tabbableGroups[M];V=Me(T)>=0?B.lastTabbableNode:B.lastDomTabbableNode}else vt(P)||(V=Y.nextTabbableNode(T,!1))}else{var W=ea(o.tabbableGroups,function(K){var Q=K.lastTabbableNode;return T===Q});if(W<0&&(Y.container===T||qt(T,i.tabbableOptions)&&!Be(T,i.tabbableOptions)&&!Y.nextTabbableNode(T))&&(W=H),W>=0){var Z=W===o.tabbableGroups.length-1?0:W+1,X=o.tabbableGroups[Z];V=Me(T)>=0?X.firstTabbableNode:X.firstDomTabbableNode}else vt(P)||(V=Y.nextTabbableNode(T))}}else V=d("fallbackFocus");return V},x=function(j){var T=$t(j);if(!(l(T,j)>=0)){if(lt(i.clickOutsideDeactivates,j)){c.deactivate({returnFocus:i.returnFocusOnDeactivate});return}lt(i.allowOutsideClick,j)||j.preventDefault()}},k=function(j){var T=$t(j),P=l(T,j)>=0;if(P||T instanceof Document)P&&(o.mostRecentlyFocusedNode=T);else{j.stopImmediatePropagation();var O,z=!0;if(o.mostRecentlyFocusedNode)if(Me(o.mostRecentlyFocusedNode)>0){var V=l(o.mostRecentlyFocusedNode),H=o.containerGroups[V].tabbableNodes;if(H.length>0){var Y=H.findIndex(function(E){return E===o.mostRecentlyFocusedNode});Y>=0&&(i.isKeyForward(o.recentNavEvent)?Y+1<H.length&&(O=H[Y+1],z=!1):Y-1>=0&&(O=H[Y-1],z=!1))}}else o.containerGroups.some(function(E){return E.tabbableNodes.some(function(M){return Me(M)>0})})||(z=!1);else z=!1;z&&(O=y({target:o.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(o.recentNavEvent)})),b(O||o.mostRecentlyFocusedNode||m())}o.recentNavEvent=void 0},C=function(j){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;o.recentNavEvent=j;var P=y({event:j,isBackward:T});P&&(vt(j)&&j.preventDefault(),b(P))},_=function(j){if(Ao(j)&<(i.escapeDeactivates,j)!==!1){j.preventDefault(),c.deactivate();return}(i.isKeyForward(j)||i.isKeyBackward(j))&&C(j,i.isKeyBackward(j))},w=function(j){var T=$t(j);l(T,j)>=0||lt(i.clickOutsideDeactivates,j)||lt(i.allowOutsideClick,j)||(j.preventDefault(),j.stopImmediatePropagation())},D=function(){if(o.active)return Jr.activateTrap(s,c),o.delayInitialFocusTimer=i.delayInitialFocus?Xr(function(){b(m())}):b(m()),r.addEventListener("focusin",k,!0),r.addEventListener("mousedown",x,{capture:!0,passive:!1}),r.addEventListener("touchstart",x,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),c},F=function(){if(o.active)return r.removeEventListener("focusin",k,!0),r.removeEventListener("mousedown",x,!0),r.removeEventListener("touchstart",x,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",_,!0),c},G=function(j){var T=j.some(function(P){var O=Array.from(P.removedNodes);return O.some(function(z){return z===o.mostRecentlyFocusedNode})});T&&b(m())},U=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(G):void 0,N=function(){U&&(U.disconnect(),o.active&&!o.paused&&o.containers.map(function(j){U.observe(j,{subtree:!0,childList:!0})}))};return c={get active(){return o.active},get paused(){return o.paused},activate:function(j){if(o.active)return this;var T=u(j,"onActivate"),P=u(j,"onPostActivate"),O=u(j,"checkCanFocusTrap");O||f(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,T==null||T();var z=function(){O&&f(),D(),N(),P==null||P()};return O?(O(o.containers.concat()).then(z,z),this):(z(),this)},deactivate:function(j){if(!o.active)return this;var T=Qr({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},j);clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,F(),o.active=!1,o.paused=!1,N(),Jr.deactivateTrap(s,c);var P=u(T,"onDeactivate"),O=u(T,"onPostDeactivate"),z=u(T,"checkCanReturnFocus"),V=u(T,"returnFocus","returnFocusOnDeactivate");P==null||P();var H=function(){Xr(function(){V&&b(h(o.nodeFocusedBeforeActivation)),O==null||O()})};return V&&z?(z(h(o.nodeFocusedBeforeActivation)).then(H,H),this):(H(),this)},pause:function(j){if(o.paused||!o.active)return this;var T=u(j,"onPause"),P=u(j,"onPostPause");return o.paused=!0,T==null||T(),F(),N(),P==null||P(),this},unpause:function(j){if(!o.paused||!o.active)return this;var T=u(j,"onUnpause"),P=u(j,"onPostUnpause");return o.paused=!1,T==null||T(),f(),D(),N(),P==null||P(),this},updateContainerElements:function(j){var T=[].concat(j).filter(Boolean);return o.containers=T.map(function(P){return typeof P=="string"?r.querySelector(P):P}),o.active&&f(),N(),this}},c.updateContainerElements(e),c};const qo=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Bo},Symbol.toStringTag,{value:"Module"})),Uo=pa(qo),Wo=pa($o);function et(t){"@babel/helpers - typeof";return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},et(t)}function zo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ta(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,es(r.key),r)}}function Zo(t,e,n){return e&&ta(t.prototype,e),n&&ta(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ho(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vn(t,e)}function Vn(t,e){return Vn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Vn(t,e)}function Vo(t){var e=Ko();return function(){var r=Yt(t),s;if(e){var i=Yt(this).constructor;s=Reflect.construct(r,arguments,i)}else s=r.apply(this,arguments);return Yo(this,s)}}function Yo(t,e){if(e&&(et(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pt(t)}function pt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ko(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Yt(t)}function Go(t,e,n){return e=es(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function es(t){var e=Qo(t,"string");return et(e)==="symbol"?e:String(e)}function Qo(t,e){if(et(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(et(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mt=g,J=ho,Jo=Uo,Xo=Jo.createFocusTrap,ec=Wo,tc=ec.isFocusable,ar=function(t){Ho(n,t);var e=Vo(n);function n(r){var s;zo(this,n),s=e.call(this,r),Go(pt(s),"getNodeForOption",function(c){var u,l=(u=this.internalOptions[c])!==null&&u!==void 0?u:this.originalOptions[c];if(typeof l=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),f=1;f<d;f++)m[f-1]=arguments[f];l=l.apply(void 0,m)}if(l===!0&&(l=void 0),!l){if(l===void 0||l===!1)return l;throw new Error("`".concat(c,"` was specified but was not a node, or did not return a node"))}var p=l;if(typeof l=="string"){var b;if(p=(b=this.getDocument())===null||b===void 0?void 0:b.querySelector(l),!p)throw new Error("`".concat(c,"` as selector refers to no known node"))}return p}),s.handleDeactivate=s.handleDeactivate.bind(pt(s)),s.handlePostDeactivate=s.handlePostDeactivate.bind(pt(s)),s.handleClickOutsideDeactivates=s.handleClickOutsideDeactivates.bind(pt(s)),s.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:s.handleDeactivate,onPostDeactivate:s.handlePostDeactivate,clickOutsideDeactivates:s.handleClickOutsideDeactivates},s.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)){if(o==="returnFocusOnDeactivate"||o==="onDeactivate"||o==="onPostDeactivate"||o==="checkCanReturnFocus"||o==="clickOutsideDeactivates"){s.originalOptions[o]=i[o];continue}s.internalOptions[o]=i[o]}return s.outsideClick=null,s.focusTrapElements=r.containerElements||[],s.updatePreviousElement(),s}return Zo(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var s=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return s||(s===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var s=this.getDocument();s&&(this.previouslyFocusedElement=s.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(s){var i=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,s):this.originalOptions.clickOutsideDeactivates;return i&&(this.outsideClick={target:s.target,allowDeactivation:i}),i}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var s=this,i=function(){var c=s.getReturnFocusNode(),u=!!(s.originalOptions.returnFocusOnDeactivate&&c!==null&&c!==void 0&&c.focus&&(!s.outsideClick||s.outsideClick.allowDeactivation&&!tc(s.outsideClick.target,s.internalOptions.tabbableOptions))),l=s.internalOptions.preventScroll,d=l===void 0?!1:l;u&&c.focus({preventScroll:d}),s.originalOptions.onPostDeactivate&&s.originalOptions.onPostDeactivate.call(null),s.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var s=this.focusTrapElements.some(Boolean);s&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(s){if(this.focusTrap){s.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!s.active&&this.props.active,o=s.active&&!this.props.active,c=!s.paused&&this.props.paused,u=s.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),o){this.deactivateTrap();return}c&&this.focusTrap.pause(),u&&this.focusTrap.unpause()}else s.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var s=this,i=this.props.children?Mt.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Mt.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var o=function(l){var d=s.props.containerElements;i&&(typeof i.ref=="function"?i.ref(l):i.ref&&(i.ref.current=l)),s.focusTrapElements=d||[l]},c=Mt.cloneElement(i,{ref:o});return c}return null}}]),n}(Mt.Component),ut=typeof Element>"u"?Function:Element;ar.propTypes={active:J.bool,paused:J.bool,focusTrapOptions:J.shape({document:J.object,onActivate:J.func,onPostActivate:J.func,checkCanFocusTrap:J.func,onPause:J.func,onPostPause:J.func,onUnpause:J.func,onPostUnpause:J.func,onDeactivate:J.func,onPostDeactivate:J.func,checkCanReturnFocus:J.func,initialFocus:J.oneOfType([J.instanceOf(ut),J.string,J.bool,J.func]),fallbackFocus:J.oneOfType([J.instanceOf(ut),J.string,J.func]),escapeDeactivates:J.oneOfType([J.bool,J.func]),clickOutsideDeactivates:J.oneOfType([J.bool,J.func]),returnFocusOnDeactivate:J.bool,setReturnFocus:J.oneOfType([J.instanceOf(ut),J.string,J.bool,J.func]),allowOutsideClick:J.oneOfType([J.bool,J.func]),preventScroll:J.bool,tabbableOptions:J.shape({displayCheck:J.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:J.oneOfType([J.bool,J.func])}),trapStack:J.array,isKeyForward:J.func,isKeyBackward:J.func}),containerElements:J.arrayOf(J.instanceOf(ut)),children:J.oneOfType([J.element,J.instanceOf(ut)])};ar.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Xo};var nc=ar;const rc=ma(nc),ts=({showDevTools:t=!0,children:e})=>{const n=new pe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return a.jsxs(pe.QueryClientProvider,{client:n,children:[e,t&&a.jsx(Qs.ReactQueryDevtools,{initialIsOpen:!1})]})};var ac=g.createContext({client:It});function sc(t){var e=t.children,n=t.client,r=t.apiKey,s=t.options,i=g.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&&s&&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&&(It.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),It.init(r,s)),It)},[n,r]);return g.createElement(ac.Provider,{value:{client:i}},e)}const ns=({children:t,user:e})=>e.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?a.jsx(sc,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:e.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!e.id}},children:t}):a.jsx(a.Fragment,{children:t}),rs=({children:t,locale:e,messages:n})=>{const r=e||"en",s={...hi[r],...n||{}};return a.jsx(I.IntlProvider,{locale:r,messages:s,children:t})},sr=g.createContext({}),Ut={en:"English",es:"Español",fr:"Français",pt:"Português"},Se=g.createContext({isLoading:!0});function an(){return g.useContext(Se)}const as=({children:t,user:e})=>a.jsx(Se.Provider,{value:e,children:t}),ir=g.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),ss=()=>g.useContext(ir),is=({children:t})=>{const[e,n]=g.useState([]);g.useEffect(()=>{e.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[e]);const r=g.useCallback(i=>{n(o=>[...o,i])},[]),s=g.useCallback(i=>{n(o=>o.filter(c=>c!==i))},[]);return a.jsx(ir.Provider,{value:{registerOverlay:r,unregisterOverlay:s},children:t})},ic=({bootstrap:t,children:e,intl:n,showDevTools:r})=>{const[s,i]=g.useState({isLoading:!0}),o=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[c,u]=g.useState(o),l=d=>{localStorage.setItem("language",d),u(d)};return g.useEffect(()=>{t().then(d=>{i({...d,isLoading:!1}),Sa(5e3)}).catch(d=>{d.message===ja&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),a.jsx(sr.Provider,{value:{language:c,updateLanguage:l},children:a.jsx(rs,{locale:c,messages:n==null?void 0:n.messages,children:a.jsx(Kn.CookiesProvider,{children:a.jsx(as,{user:s,children:a.jsx(is,{children:a.jsx(ts,{showDevTools:r,children:a.jsx(ns,{user:s,children:e})})})})})})})};const or=({element:t="section",children:e,className:n,...r})=>g.createElement(t,{className:S("modal",n),children:typeof e=="string"?a.jsx("p",{children:e}):e,...r});const kt=({id:t="content-overlay",isOpen:e=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:s=()=>{},onClose:i=()=>{}}={},forceShow:{error:o=!1}={},title:c,children:u,buttons:l,className:d="",gtmContext:m="Modal"})=>{const f=I.useIntl(),{registerOverlay:p,unregisterOverlay:b}=ss(),[h,y]=g.useState(e),x=_=>{_.key==="Escape"&&k(!1)};g.useEffect(()=>(window.addEventListener("keyup",x),()=>{window.removeEventListener("keyup",x)}));const k=_=>{y(_),_?(s(),p(t)):(i(),b(t))};g.useEffect(()=>(k(e),()=>{h&&b(t)}),[e]);const C=r?{"--max-width":`${r/16}rem`}:{};return a.jsx("div",{className:S("overlay",{open:h}),role:"dialog",children:a.jsx(or,{id:t,className:S("overlay-modal",d,{"has-max-width":r}),hidden:!h,style:C,children:e&&a.jsx(rc,{children:a.jsxs("div",{className:"overlay-content",children:[a.jsxs("div",{className:"top",children:[c&&a.jsx("h2",{className:"modal-title",children:c}),a.jsx(ae,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>k(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:f.formatMessage({id:"overlay_close"})})]}),n&&a.jsx(Fe,{}),u,l&&a.jsxs("div",{className:"bottom",children:[a.jsx(Fe,{}),a.jsx(at,{buttons:l})]}),o&&a.jsx(yt,{className:"error",children:o})]})})})})},os=(t,e)=>({"aria-haspopup":!0,"aria-expanded":e,"aria-controls":t});const oc=({className:t,showModal:e=!0,title:n,formTitle:r,formLabel:s,ctaMessage:i,showIcon:o,onClose:c,reportError:u=()=>{},sendInvites:l})=>{const d=I.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),s||(s=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),a.jsx(kt,{title:n,isOpen:e,showDivider:!1,showIcon:o,functions:{onClose:c},className:S("invite-modal",t,{success:!!n}),children:a.jsx(Ua,{title:r,label:s,ctaMessage:i,onClose:c,sendInvites:l,reportError:u})})};const cc=({members:t})=>{const[e,n]=g.useState(!1),r=s=>{const{fullName:i,jobTitle:o,organisation:c,photo:u}=s||{};return a.jsxs(a.Fragment,{children:[a.jsx(De,{name:i,src:u}),a.jsx("p",{children:i}),a.jsx("small",{className:"text-medium",children:c?`${o}, ${c}`:o})]})};return a.jsxs("div",{className:"directory-wrapper",children:[a.jsx("ul",{className:"directory",children:t.map(s=>a.jsx("li",{children:a.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(s)},children:r(s)})},s.fullName))}),a.jsx(kt,{isOpen:e!==!1,children:e===!1?"":a.jsxs(a.Fragment,{children:[r(e),a.jsx(Xe,{children:e.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const lc=({author:t,authorCite:e,content:n,member:r,className:s=""})=>a.jsxs("blockquote",{className:S("testimonial-block",s),children:[a.jsx(Re,{className:"testimonial",children:n}),r?a.jsx(xt,{member:r,styling:{size:"large"}}):a.jsxs(a.Fragment,{children:[t&&a.jsx("p",{className:S("author",{"text-small":!s.includes("new")}),children:t}),e&&a.jsx("p",{className:S("author-cite",{"text-small":!s.includes("new")}),children:a.jsx("cite",{children:e})})]})]}),uc=g.memo(lc);const dc=({items:t=[],selector:e="",className:n=""})=>{const r=I.useIntl(),[s,i]=g.useState(t);return g.useEffect(()=>{if(t.length)return;let o="";Array(6).fill(0).forEach((l,d)=>{o+=`${d>0?", ":""}${e} h${d+1}`});const u=Array.from(document.querySelectorAll(o)).filter(l=>l.id).map(l=>({id:l.id,text:l.textContent||""}));i(u)},[]),s&&s.length>0&&a.jsxs(Ee,{variant:"subtle",className:S("table-of-contents",n),children:[a.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),a.jsx("nav",{children:a.jsx("ul",{children:s.map(({id:o,text:c})=>a.jsx("li",{children:a.jsx("a",{href:`#${o}`,children:c})},o))})})]})};const sn=({time:t,rangeTime:e,prependedText:n,appendedText:r,className:s=""})=>{const i=I.useIntl(),o="timeToComplete_";if(!t||typeof t!="number")return null;const c=d=>{const m=d/60,f=Math.floor(m),p=(m-f)*60,b=Math.round(p),h=`${i.formatMessage({id:`${o}hours`},{time:f})}${f>0&&b>0?", ":""}${i.formatMessage({id:`${o}minutes`},{time:b})}`;return{text:`${f>0?`${i.formatMessage({id:`${o}hours_short`},{time:f})} `:""}${b>0?i.formatMessage({id:`${o}minutes_short`},{time:b}):""}`,ariaText:h}};let{text:u,ariaText:l}=c(t);if(e){const{text:d,ariaText:m}=c(t+e);u=i.formatMessage({id:`${o}range`},{early:u,late:d}),l=i.formatMessage({id:`${o}range_aria`},{early:l,late:m})}return n&&(l=`${n} ${l}`,u=`${n} ${u}`),r&&(l=`${l} ${r}`,u=`${u} ${r}`),a.jsx("span",{className:S("time-to-complete",s),"aria-label":l,children:u})};let dt=!1;const cs=({isOpen:t=!1,isLoading:e=!1,children:n})=>{const r=I.useIntl(),s=g.useRef(null),[i,o]=g.useState(t?"open":"hidden");g.useEffect(()=>{const u=s.current;if(u)return u.addEventListener("transitionend",c),()=>{u.removeEventListener("transitionend",c)}},[]);const c=({propertyName:u})=>{u==="opacity"&&(dt!==!1&&clearTimeout(dt),o(l=>l==="opening"?"open":l==="closing"?"closed":l==="closed"?"hidden":l))};return Je(()=>{dt!==!1&&clearTimeout(dt);let u="open";t?o("opening"):(o("closing"),u="hidden"),dt=setTimeout(()=>{o(u)},300)},[t]),a.jsx("aside",{ref:s,className:S("tooltip text-medium",i,{loading:e}),hidden:i==="hidden",children:e?a.jsx("p",{children:r.formatMessage({id:"tooltip_loading"})}):typeof n=="string"?a.jsx("p",{children:n}):n})};const fc=({className:t="",image:e,...n})=>e?(typeof e=="string"&&(e={width:1080,height:200,type:"image/png",url:e}),e.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],e.query="fit=thumb&f=center",a.jsx(st,{...n,className:S("banner",t),image:{...e,aspect:"banner"}})):null;const Ie=({children:t,className:e="",styling:n={},...r})=>{const{background:s="default"}=n;return a.jsx("section",{className:S("full-width-section",e,{[s]:s!=="default"}),...r,children:t})};const mc=({text:t,buttons:e,className:n=""})=>{const r=[];return e.forEach(s=>{r.push({href:s.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":s.eventContext||"Download",target:"_blank",children:s.text})}),a.jsx(Ie,{className:S("download-section",n),children:a.jsxs("div",{className:"content-default",children:[g.createElement(typeof t=="string"?"h2":t.element,{className:"text"},typeof t=="string"?t:t.text),a.jsx(at,{buttons:r})]})})};function ls({href:t,setShowModal:e}){typeof t!="string"&&e(!0)}const pc=({icon:t,description:e,ctaMessage:n,href:r,showEditButton:s,setShowModal:i})=>{const{formatMessage:o}=I.useIntl();return a.jsxs("div",{className:S("edit-section-placeholder",{"has-icon":!!t}),style:Ta(t),children:[a.jsx("p",{children:e||o({id:"edit_section_placeholder_description"})}),s&&a.jsx(ae,{href:r,variant:"secondary",size:"small",onClick:()=>ls({href:r,setShowModal:i}),children:n||o({id:"edit_section_placeholder_cta"})})]})},hc=({children:t,className:e="",formProps:n,href:r,title:s,modalTitle:i,placeholder:o,showDivider:c=!0})=>{const[u,l]=g.useState(!1),d=typeof r=="string"||!!n,m=()=>l(!1);return a.jsxs("section",{className:S("edit-section",e),children:[n&&a.jsx(kt,{title:i||`Edit ${s}`,isOpen:u,showDivider:!1,showIcon:!1,functions:{onClose:m},className:S("edit-section-modal"),children:a.jsx(wt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async f=>{var p,b;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((b=n==null?void 0:n.functions)==null?void 0:b.onSuccess(f)),l(!1)},onCancel:m}})}),a.jsxs("div",{className:"edit-section-header",children:[a.jsx("h2",{className:"edit-section-header-title",children:s}),d&&a.jsx(ae,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>ls({href:r,setShowModal:l}),children:"Edit"})]}),t||a.jsx(pc,{...o,href:r,setShowModal:l,showEditButton:d}),c&&a.jsx(Fe,{})]})};const gc=({title:t=!1,text:e,logos:n=[],styling:r={},className:s=""})=>{const i=n.length;if(i===0)return null;const o={element:typeof t=="object"?t.element:"h2",text:typeof t=="string"?t:typeof t=="object"?t.text:"",className:typeof t=="object"?t.className:""},{wrapLogos:c=!1,align:u="center",display:l="block"}=r;return a.jsxs("div",{className:S("logos",s,`align-${u}`,{[l]:l!=="block","wrap-logos":c}),children:[t&&g.createElement(o.element,{className:S("title",o.className)},o.text),e&&a.jsx("p",{children:e}),a.jsx("ul",{className:S({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:f=!1,description:p=!1},b)=>{if(!d||!d.url)return null;const h=a.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});return a.jsxs("li",{children:[a.jsx("p",{className:"img-wrapper",children:f?a.jsx("a",{href:f,target:"_blank",rel:"nofollow noreferrer noopener",children:h}):h}),p&&a.jsx("small",{children:p})]},window.btoa(`${d.url}_${b}`))})})]})};const vc=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],bc=({className:t="",content:e,image:n,variant:r,spacing:s="normal",styling:i,hideElements:o={eyebrow:!1,title:!1,text:!1},cta:c,children:u})=>{var b,h;const l={imageFullWidth:!0,...i};r||(r=l.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},f={};d.forEach(y=>{if(!e[y]){f[y]=!1;return}if(!o[y]){if(typeof e[y]=="object"){f[y]=e[y];const{text:x,element:k}=e[y];if(k&&vc.includes(k.toLowerCase()))return;f[y]={text:x,element:m[y]};return}f[y]={text:e[y],element:m[y]}}});const p=c&&c.text&&c.link;return p&&c.link[0]==="#"&&(c.props||(c.props={}),c.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const x=document.getElementById(c.link.substring(1));x&&x.scrollIntoView({behavior:"smooth"})}),a.jsx(Ie,{className:S("banner-section",r,s,t,{"has-image":n,"image-full-width":n&&l.imageFullWidth,"image-inline":n&&!l.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&s==="normal"&&f.eyebrow&&f.title}),children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"content-wrapper",children:[d.map(y=>{if(f[y]&&typeof f[y]=="object"){const{text:x,element:k=""}=f[y];return y==="text"?a.jsx(Xe,{overrideType:"text-only",className:"text",children:x},y):g.createElement(k,{key:y,className:y},x)}return null}),u,p&&a.jsx(ae,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:c.link,...c.props,className:S({new:r==="subtle",[(b=c.props)==null?void 0:b.className]:(h=c.props)==null?void 0:h.className}),children:c.text})]}),n&&a.jsx(st,{image:{...n,aspect:l.imageFullWidth?"banner":n.aspect||void 0}})]})})},yc=g.memo(bc);const _c=({image:t,variant:e="default",children:n,className:r=""})=>{const s={};return t&&(s["--image"]=`url(${t})`),a.jsx(Ie,{className:S("custom-content-banner",e,r,{"has-image":t}),style:s,children:a.jsx("div",{className:"content-slim",children:n})})};const xc=({alignImage:t="left",className:e,content:n,image:r})=>{const s=typeof n=="string"?a.jsx(Xe,{children:n}):n;return a.jsxs(Ie,{className:S("highlight-section",e),children:[r&&a.jsx("div",{className:S("highlight-container highlight-image",{[`highlight-image-${t}`]:t==="right"}),children:a.jsx(st,{image:r})}),a.jsx("div",{className:S("highlight-container highlight-content-wrapper",{"no-image":!r}),children:a.jsx("div",{className:S("highlight-content",{"highlight-content-right":t==="left"}),children:r?s:a.jsx("div",{className:"content-default",children:s})})})]})},wc=g.memo(xc);const kc=({variant:t="primary",button:e=null,title:n,text:r,gtmContext:s})=>!n&&!r?null:a.jsxs("aside",{className:S("marketing-block",t),children:[n&&a.jsx("p",{className:"title",children:n}),r&&a.jsx("p",{children:r}),e&&a.jsx(ae,{variant:"secondary",size:"medium",href:e.link,className:"gtm-trackable","data-gtm-event-context":s,"data-gtm-event-type":"learn-more-click",children:e.text})]}),jc=({type:t,data:e})=>{const n=I.useIntl(),{answers:r,createdAt:s,dateHasPassed:i,isOngoingEvent:o,pill:c,readingTime:u,publishedDate:l,startDate:d}=e;if(t==="question"){const m=s&&Bn(s);return a.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),s&&a.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||o)return a.jsx("p",{className:"details",children:o?n.formatMessage({id:"card_bootcamp"}):Jn(d)});if(c)return a.jsx(Ge,{variant:c==="free"?"subtle":"highlighted",className:c,"data-testid":"course-type",children:c});if(u||l){const m=l&&Bn(l);return a.jsxs("ul",{className:"details",children:[u&&a.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:u})}),l&&a.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},Kt={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Tc=({data:t,cta:e,link:n,gtmContext:r})=>{var h,y;const s=I.useIntl(),[i,o]=g.useState({loading:!1,registered:t.registered||!1});g.useEffect(()=>{t.registered&&o(x=>({...x,registered:!0}))},[t.registered]);const{customLinkText:c,startDate:u,dateHasPassed:l,pill:d,slug:m}=t,f=t.contentType;let p="";if((h=Kt[f])!=null&&h.gtmEvent&&(p=Kt[f].gtmEvent),u&&l)return n?a.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:c||s.formatMessage({id:"card_watch"})}):null;if(f==="people")return n?a.jsx(ae,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:c||s.formatMessage({id:"card_cta_people"})}):null;const b=["communityPage","microcourse","event"];if(e&&e.onClick&&b.includes(f)&&d!=="premium"){const x=i.loading||i.registered||((y=t==null?void 0:t.members)==null?void 0:y.isMember),k=async C=>{if(C.preventDefault(),C.stopPropagation(),!(x||!e||!e.onClick)){o(_=>({..._,loading:!0}));try{const _=await e.onClick(t);o(_==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{o(w=>({...w,loading:!1}))}}};return a.jsx("p",{className:S("cta-wrapper",{"has-member-section":t==null?void 0:t.members}),children:a.jsx(ae,{onClick:k,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:x,"data-gtm-event-context":`${r}Page-${f}: ${m}`,"data-gtm-event-type":`${r}-${f}-register-click`,"data-testid":"in-card-button",children:c||s.formatMessage({id:`card_cta_${f}${x?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const Ec={title:66,text:3e3,secondaryText:1e3,partner:25},cr=({id:t="",card:e,buildCardData:n,cta:r,gtmContext:s="Carousel",className:i="",handleCardClick:o})=>{var F,G,U;const c=I.useIntl(),u=g.useContext(Se),l=u&&typeof u.id=="string",[d,m]=g.useState({data:null,isLoading:!0}),{data:f,isLoading:p}=d,b=g.useCallback(()=>{n(e,l).then(N=>{m(()=>({data:N,isLoading:!1}))}).catch(()=>m(N=>({...N,isLoading:!1})))},[t]);if(g.useEffect(()=>{b()},[]),p||!f)return a.jsx(ke,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!r&&(r={text:c.formatMessage({id:`card_cta_${e.contentType}`}),onClick:o});const{contentType:h}=f;if(!h||!Kt[h])return a.jsx(ke,{element:"li",className:"card-wrapper"});const{basePath:y="",className:x,length:k,gtmEvent:C}=Kt[h];let _=f.slug?`${y}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(_=f.slug);const w={...Ec,...k};let D={className:"card"};return _&&(D={href:_,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${C}-click`,"data-testid":"link"},f.openInNewTab&&(D.target="_blank")),a.jsx("li",{className:S("card-wrapper text-medium",x,i,{"has-link":_,"no-link":!_,"has-image":f.banner}),"data-testid":`${h}-card`,children:g.createElement(_?"a":"div",D,a.jsxs(a.Fragment,{children:[a.jsx(Ca,{className:"card-label",contentType:h,customIcon:f.customIcon,customLabel:f.customLabel}),f.startDate&&!f.isOngoingEvent&&a.jsx(Ge,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?c.formatMessage({id:"card_ended"}):Ea(f.startDate)}),f.banner?a.jsxs("p",{className:"img",children:[f.registered&&a.jsx(Ge,{size:"small",variant:"registered",children:c.formatMessage({id:"card_registered"})}),a.jsx(st,{image:f.banner})]}):x==="people"?a.jsx(De,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&a.jsx(nr,{contributors:{data:f.contributors},styling:{size:"small",showGap:x!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(h)?c.formatMessage({id:`card_contributors_${h}`}):void 0,"data-testid":"contributors"}),f.partner&&a.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?c.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Qe(f.partner[0],w.partner)}),["title","text","secondaryText"].map(N=>{const $=f[N];if(!$)return null;const j=xa(N);return a.jsx("p",{className:j,"data-testid":j,children:Qe($,w[N])},N)}),(u==null?void 0:u.id)&&(f==null?void 0:f.members)&&a.jsxs("span",{className:"member-information",children:[((F=f==null?void 0:f.members)==null?void 0:F.isMember)&&a.jsx(Ge,{size:"small",variant:"registered",icon:((G=f==null?void 0:f.members)==null?void 0:G.memberType)==="owner"?"user":"tick",children:c.formatMessage({id:`card_member_type_${(U=f==null?void 0:f.members)==null?void 0:U.memberType}`})}),a.jsx("br",{}),a.jsx("span",{className:"label member-count",children:c.formatMessage({id:"card_member_count"},{count:f==null?void 0:f.members.count})})]}),a.jsx(jc,{type:x||"",data:f}),a.jsx(Tc,{data:f,cta:r,link:_||"",gtmContext:s})]}))})};const us=({cards:t,cardTypes:e,className:n="",...r})=>a.jsx("ul",{className:S("card-block",n),children:t.map((s,i)=>{const o=s.slug?`${s.slug}-${e[i]}`:`${e[i]}-${i}`;return a.jsx(cr,{id:o,card:{...s,contentType:e[i]},...r},o)})}),Sc=(t,e,n,r)=>{const s=e*n<=t,i=t<e*(n+1),o=r.includes(Math.floor(t/e));return s&&i||o},Cc=({id:t,title:e})=>{const n=I.useIntl();if(!e||!e.text)return null;const{text:r,element:s="h2",variant:i="default",size:o="medium",link:c}=e;return g.createElement(s,{className:S("title",i,o,{"highlighted-title":i==="highlighted"}),children:a.jsxs(a.Fragment,{children:[r,c&&a.jsx("a",{href:c,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${t||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Tn={fourCards:1024,threeCards:769,twoCards:480};let Rt=null;const Nc=({id:t,cards:e,cardTypes:n,buildCardData:r,title:s,className:i,gtmContext:o,...c})=>{const u=I.useIntl(),[l,d]=g.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:f}=l,[p,b]=g.useState({currentPage:0,loadedPages:[0]}),{currentPage:h,loadedPages:y}=p,x=e.length,k=Math.ceil(x/m),C=g.useRef(null),_=nt(!0,!0,C==null?void 0:C.current);g.useEffect(()=>{let N=1;_&&(_>=Tn.fourCards?N=4:_>=Tn.threeCards?N=3:_>=Tn.twoCards&&(N=2),N>x&&(N=x)),d($=>({...$,cardsPerPage:N,isLoading:!1}))},[_,x]);const w=(N="next")=>{let $=h;if(typeof N=="string")if(N==="next")if(h<k-1)$=h+1;else return;else if(h>0)$=h-1;else return;else $=N;b(j=>({...j,currentPage:$,loadedPages:[...new Set([...y,$])]}))},D=N=>{Rt=N.touches[0].clientX},F=N=>{if(Rt===null)return;const $=N.touches[0].clientX,j=Rt-$;j>5?w("next"):j<-5&&w("previous"),Rt=null},G={"--width":`${_||0}px`,"--total-cards":x,"--cards-per-page":m,"--page":h};if(f)return a.jsx(er,{layout:`carousel${s?"-with-title":""}`});const U=(N,$)=>{var T;let j=null;return(T=N==null?void 0:N.sys)!=null&&T.id?j=`card-${N.sys.id}`:N!=null&&N.slug?j=`card-${N.slug}`:[n[$],N.contentType].includes("customCard")&&(j=`card-${window.btoa(`${N.title} ${N.createdAt}`)}-${$}`),j};return a.jsxs("section",{ref:C,className:S("carousel-wrapper",i),"data-testid":"carousel",children:[a.jsx(Cc,{id:t,title:s}),a.jsx("ul",{className:"carousel",onTouchStart:D,onTouchMove:F,style:G,"data-testid":"carousel-list",children:e.map((N,$)=>{let j=U(N,$);return j&&Sc($,m,h,y)?a.jsx(cr,{id:j,card:{...N,contentType:n[$]},buildCardData:r,gtmContext:o,...c},j):(j=j||`${t}-card-${$}`,a.jsx(ke,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),k<=1?null:a.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[a.jsx("li",{className:"arrow previous",children:a.jsx(ae,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:N=>{N.preventDefault(),N.stopPropagation(),w("previous")},screenreaderText:u.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(k)].map((N,$)=>a.jsx("li",{"data-testid":"carousel-controls-button",children:a.jsx("button",{className:S("page-indicator",{selected:$===h}),onClick:j=>{j.preventDefault(),j.stopPropagation(),w($)},children:a.jsx(ge,{showOnFocus:!1,children:u.formatMessage({id:"carousel_pagination_page"},{number:$+1,total:k})})})},`page-indicator-${$}`)),a.jsx("li",{className:"arrow next",children:a.jsx(ae,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:N=>{N.preventDefault(),N.stopPropagation(),w("next")},screenreaderText:u.formatMessage({id:"carousel_pagination_next"}),disabled:h>=k-1})})]})]})},Pc=({carousels:t=[],isLoading:e,title:n,className:r="",...s})=>!t||!t.length?null:t.map(({title:i,viewAllUrl:o,cards:c,cardsTypes:u},l)=>{const d=i?window.btoa(i):`carousel-${l}`,m=l===t.length-1;return e?a.jsxs(g.Fragment,{children:[a.jsx(er,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:a.jsx(Fe,{})]},`placeholder-${d}`):a.jsxs(g.Fragment,{children:[a.jsx(Nc,{cards:c,cardTypes:u,title:n!=null&&n.hidden?{}:{...n,text:i,link:o},...s}),m?null:a.jsx(Fe,{})]},`carousel-${d}`)});const En="joinCommunityButton",lr=({isMember:t=!1,isShort:e=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const s=I.useIntl(),i=g.useContext(Se),o=i&&typeof i.id=="string",[c,u]=g.useState(t),[l,d]=g.useState(t?"joined":"notJoined");g.useEffect(()=>{l==="joining"?d("joined"):l==="leaving"&&d("notJoined")},[c]);const m={},f={};return c&&l!=="leaving"&&(m["data-hover-text"]=s.formatMessage({id:`${En}_leave`}),m["aria-label"]=s.formatMessage({id:`${En}_member_aria`}),f["aria-hidden"]="true"),a.jsx(ae,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&l!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{o&&(p.currentTarget.blur(),c?(d("leaving"),typeof r=="function"&&await r()):(d("joining"),typeof n=="function"&&await n()),u(!c))},className:S("join-community-button",l,{active:l==="joining"}),disabled:!o,...m,children:a.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${En}${["joining","leaving"].includes(l)?`_${l}`:c?"_member":e?"_short":""}`})})})};const Sn="communityDetails_",$c=({className:t="",isMember:e=!1,slug:n,members:{number:r=0,data:s=[]}={number:0,data:[]},functions:{invite:i,...o}})=>{const c=I.useIntl(),u=5,l=r||s.length,d=s.length?s:Array(u).fill({}),m=`/communities/${n}/members`===window.location.pathname;return a.jsxs("div",{className:S("community-details",t),children:[a.jsxs("div",{className:"member-details",children:[a.jsxs("div",{className:"top",children:[a.jsxs("h4",{children:[c.formatMessage({id:`${Sn}members`}),a.jsx("span",{className:"count",children:l})]}),!m&&a.jsx("p",{className:"text-small",children:a.jsx("a",{href:`/communities/${n}/members`,children:c.formatMessage({id:`${Sn}viewAll`})})})]}),a.jsx(nr,{contributors:{total:r,data:d},styling:{size:"medium",showGap:!0,showPlaceholders:l===0},cutoff:u})]}),a.jsx(lr,{isMember:e,functions:{...o}}),e&&a.jsx(ae,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:c.formatMessage({id:`${Sn}invite`})})]})};const Mc=({breadcrumbs:t,cutoff:e=20,className:n=""})=>{const r=I.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(ge,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),a.jsx("ul",{className:S("breadcrumbs text-small",n),children:t.map(({text:s,href:i,current:o=!1},c)=>{const u={};return o&&(u["aria-current"]="location"),a.jsxs("li",{children:[o&&a.jsx(ge,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),a.jsx(We,{href:o?void 0:i,...u,children:Qe(s,e)})]},`${window.btoa(s)}_${c}`)})})]})};const Rc=({options:t,allOption:e=!1,allowMultiple:n=!0,onChange:r=()=>{},className:s=""})=>{const i=I.useIntl(),o=e?[{id:"all",text:typeof e!="boolean"&&e.text||i.formatMessage({id:"filters_all"})},...t]:t,[c,u]=g.useState(e?["all"]:[]),l=(d,m)=>{let f=[];c.includes(d)?f=c.filter(p=>p!==d):d==="all"?f=["all"]:n?f=[...c.filter(p=>p!=="all"),d]:f=[d],u(p=>(r&&typeof r=="function"&&r({current:f,previous:p}),f)),m&&typeof m=="function"&&m()};return a.jsx("ul",{className:S("filters",s),children:o.map(({id:d,text:m,disabled:f=!1,callback:p=()=>{}})=>{let b={};return f&&(b={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),a.jsx("li",{children:a.jsx("button",{className:S(d,{selected:c.includes(d)}),onClick:h=>{h.preventDefault(),h.stopPropagation(),l(d,p)},...b,children:m})},d)})})},Fc=(t,e,n)=>{const r=String(t);if(!n||!n.length)return e?`/${r}/${e}`:`/${r}`;let s="",i=!1;return n.forEach(({url:o,position:c})=>{c==="before-lang"?(s+=`/${o}`,i=!0):(s.includes(`/${r}/`)||(s+=`/${r}`),s+=`/${o}`)}),s.includes(`/${r}/`)||(s+=`/${r}`),e&&(s+=`/${e}`),i?{url:s,urlForRouter:`/${s.split("/").slice(2).join("/")}`}:s};const Ft="languageSwitcher_",Oc=({currentLanguage:t,isOriginalLanguage:e=!1,isHumanTranslation:n=!1,translations:r,onChange:s,urlParts:i,variant:o="default",label:c,className:u=""})=>{const l=I.useIntl(),{updateLanguage:d=()=>{}}=g.useContext(sr),[m,f]=g.useState(t);if(g.useEffect(()=>{t!==m&&f(t)},[t]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const b=Object.keys(r),h=m!==t;return a.jsxs("div",{className:S("language-switcher text-small",o,u),children:[a.jsxs("nav",{children:[o!=="short"&&a.jsx("p",{children:c||l.formatMessage({id:`${Ft}label`})}),a.jsx("ul",{children:b.map(y=>{var C;if(!Ut[y])return null;const x=(C=r[y])==null?void 0:C.post_name;let k={className:y};if(m===y)k["aria-label"]=l.formatMessage({id:`${Ft}selected`},{language:Ut[y]});else{const _=Fc(y,x,i);k={...k,href:typeof _=="string"?_:_.url,onClick:w=>{f(y),d(y),typeof s<"u"&&(w.preventDefault(),w.stopPropagation(),s(y,typeof _=="string"?_:_.urlForRouter))}}}return a.jsx("li",{children:a.jsx(We,{...k,fallbackElement:"span",children:Ut[y]})},y)})}),o!=="short"&&!h&&a.jsx("p",{children:l.formatMessage({id:`${Ft}translation_${e?"original":n?"human":"machine"}`})})]}),o!=="short"&&!h&&!e&&!n&&a.jsx("small",{children:l.formatMessage({id:`${Ft}disclaimer`},{email:Ye.support,link:y=>{const x=`mailto:${y}`;return a.jsx("a",{href:x,children:y})}})})]})};const Cn=I.createIntl({locale:"en",messages:rt}),jt=({hasNextPage:t=!0,loadNextPage:e=()=>{},isLoading:n=!1,variant:r="secondary",size:s="medium",styling:i={muted:!1,fullWidth:!1},icon:o=!1,messages:c={button:Cn.formatMessage({id:"loadMore_button"}),endOfFeed:Cn.formatMessage({id:"loadMore_endOfFeed"}),error:Cn.formatMessage({id:"loadMore_error"})},className:u="",gtmContext:l="LoadMore"})=>{const[d,m]=g.useState(""),f=async p=>{if(!n)try{await e(p)}catch(b){b instanceof Error?m(b.message):m("Unknown error")}};return!d&&!t&&!c.endOfFeed?null:a.jsx("footer",{className:S("load-more",u),children:!d&&t?a.jsx(ae,{variant:r,size:s,styling:i,icon:o,onClick:f,"data-gtm-event-context":l,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:c.button}):c.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?a.jsx("p",{children:c.endOfFeed}):d&&a.jsx("p",{className:"error",children:c.error})})};const ur=({variant:t="default",version:e="default",className:n="",...r})=>a.jsx("p",{className:"logo-wrapper",children:a.jsx("a",{href:"/home/",className:S("logo",t,e,n),...r,children:a.jsx(ge,{children:a.jsx(I.FormattedMessage,{id:"apolitical"})})})});let Ot=!1;const ds=({element:t="div",id:e="more-menu",options:n,className:r=""})=>{const s=I.useIntl(),i=g.useRef(null),[o,c]=g.useState(!1),u=l=>{i.current&&l.target instanceof HTMLElement&&!i.current.contains(l.target)&&c(!1)};return g.useEffect(()=>(document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)})),g.createElement(t,{ref:i,className:S("more-menu text-medium",r),children:a.jsxs(a.Fragment,{children:[a.jsx(ae,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>c(!o),"aria-haspopup":"true","aria-expanded":o,"aria-controls":e,screenreaderText:s.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),a.jsx("ul",{id:e,hidden:!o,children:n.map(({href:l,onClick:d,text:m,icon:f,...p},b)=>{const h={...p,onClick:y=>{c(!1),typeof d=="function"&&d(y)},onFocus:()=>{Ot&&(clearTimeout(Ot),Ot=!1)},onBlur:()=>{Ot=setTimeout(()=>{c(!1)},100)}};return l&&(h.href=l),a.jsx("li",{className:"more-menu-list-item",children:a.jsx(ae,{variant:"tertiary",size:"medium",icon:f?{icon:f,position:"left"}:!1,...h,children:m})},`${window.btoa(m)}_${b}`)})})]})})},Ac=(t,e=!1)=>e?t.replaceAll("/","")===e:typeof window<"u"&&window.location&&window.location.pathname===t;const Dc=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],fs=({activeLink:t})=>{const e=I.useIntl(),n=g.useContext(Se),r=n&&typeof n.id=="string";return a.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Dc.map(({key:s,href:i})=>{const o=Ac(i,t),c={};return o&&(c["aria-current"]="page"),a.jsx("li",{className:S(s,{active:o}),children:a.jsx("a",{href:i,"data-gtm-event-type":`${s}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...c,children:e.formatMessage({id:`navigationMenu_links_${s}`})})},s)}),r&&a.jsx("li",{className:"profile","data-testid":"profile-link",children:a.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[a.jsx(De,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),a.jsx("span",{children:e.formatMessage({id:"navigationMenu_profile"})})]})})]})},ft=(t,e,n)=>`${t}?share=${e}${n?`&uuid=${n}`:""}`,Ic=({title:t,link:e,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${ft(e,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(t)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${ft(e,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(t)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${ft(e,"facebook",n)}`)}&t=${t}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(`${t}
|
|
157
|
+
*/function Ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function zl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ll(Object(n),!0).forEach(function(r){qC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ll(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qC(e,t,n){return t=HC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WC(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HC(e){var t=WC(e,"string");return typeof t=="symbol"?t:String(t)}var ql={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var a=t.indexOf(n);a===-1||t.splice(a,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},UC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},VC=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},vr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},KC=function(t){return vr(t)&&!t.shiftKey},ZC=function(t){return vr(t)&&t.shiftKey},Wl=function(t){return setTimeout(t,0)},Hl=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},ar=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},Yr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},YC=[],GC=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||YC,i=zl({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:KC,isKeyBackward:ZC},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,F,R){return w&&w[F]!==void 0?w[F]:i[R||F]},u=function(w,F){var R=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(M){var Y=M.container,K=M.tabbableNodes;return Y.contains(w)||(R==null?void 0:R.includes(Y))||K.find(function(se){return se===w})})},c=function(w){var F=i[w];if(typeof F=="function"){for(var R=arguments.length,M=new Array(R>1?R-1:0),Y=1;Y<R;Y++)M[Y-1]=arguments[Y];F=F.apply(void 0,M)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var K=F;if(typeof F=="string"&&(K=r.querySelector(F),!K))throw new Error("`".concat(w,"` as selector refers to no known node"));return K},h=function(){var w=c("initialFocus");if(w===!1)return!1;if(w===void 0||!da(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var F=s.tabbableGroups[0],R=F&&F.firstTabbableNode;w=R||c("fallbackFocus")}if(!w)throw new Error("Your focus-trap needs to have at least one focusable element");return w},m=function(){if(s.containerGroups=s.containers.map(function(w){var F=ff(w,i.tabbableOptions),R=hf(w,i.tabbableOptions),M=F.length>0?F[0]:void 0,Y=F.length>0?F[F.length-1]:void 0,K=R.find(function(D){return on(D)}),se=R.slice().reverse().find(function(D){return on(D)}),ne=!!F.find(function(D){return Zt(D)>0});return{container:w,tabbableNodes:F,focusableNodes:R,posTabIndexesFound:ne,firstTabbableNode:M,lastTabbableNode:Y,firstDomTabbableNode:K,lastDomTabbableNode:se,nextTabbableNode:function(z){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,k=F.indexOf(z);return k<0?J?R.slice(R.indexOf(z)+1).find(function(T){return on(T)}):R.slice(0,R.indexOf(z)).reverse().find(function(T){return on(T)}):F[k+(J?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(w){return w.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(w){return w.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function N(w){var F=w.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?N(F.shadowRoot):F},g=function N(w){if(w!==!1&&w!==p(document)){if(!w||!w.focus){N(h());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,UC(w)&&w.select()}},f=function(w){var F=c("setReturnFocus",w);return F||(F===!1?!1:w)},y=function(w){var F=w.target,R=w.event,M=w.isBackward,Y=M===void 0?!1:M;F=F||Yr(R),m();var K=null;if(s.tabbableGroups.length>0){var se=u(F,R),ne=se>=0?s.containerGroups[se]:void 0;if(se<0)Y?K=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:K=s.tabbableGroups[0].firstTabbableNode;else if(Y){var D=Hl(s.tabbableGroups,function(I){var U=I.firstTabbableNode;return F===U});if(D<0&&(ne.container===F||da(F,i.tabbableOptions)&&!on(F,i.tabbableOptions)&&!ne.nextTabbableNode(F,!1))&&(D=se),D>=0){var z=D===0?s.tabbableGroups.length-1:D-1,J=s.tabbableGroups[z];K=Zt(F)>=0?J.lastTabbableNode:J.lastDomTabbableNode}else vr(R)||(K=ne.nextTabbableNode(F,!1))}else{var k=Hl(s.tabbableGroups,function(I){var U=I.lastTabbableNode;return F===U});if(k<0&&(ne.container===F||da(F,i.tabbableOptions)&&!on(F,i.tabbableOptions)&&!ne.nextTabbableNode(F))&&(k=se),k>=0){var T=k===s.tabbableGroups.length-1?0:k+1,L=s.tabbableGroups[T];K=Zt(F)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else vr(R)||(K=ne.nextTabbableNode(F))}}else K=c("fallbackFocus");return K},v=function(w){var F=Yr(w);if(!(u(F,w)>=0)){if(ar(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ar(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var F=Yr(w),R=u(F,w)>=0;if(R||F instanceof Document)R&&(s.mostRecentlyFocusedNode=F);else{w.stopImmediatePropagation();var M,Y=!0;if(s.mostRecentlyFocusedNode)if(Zt(s.mostRecentlyFocusedNode)>0){var K=u(s.mostRecentlyFocusedNode),se=s.containerGroups[K].tabbableNodes;if(se.length>0){var ne=se.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<se.length&&(M=se[ne+1],Y=!1):ne-1>=0&&(M=se[ne-1],Y=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(z){return Zt(z)>0})})||(Y=!1);else Y=!1;Y&&(M=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},B=function(w){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var R=y({event:w,isBackward:F});R&&(vr(w)&&w.preventDefault(),g(R))},E=function(w){if(VC(w)&&ar(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&B(w,i.isKeyBackward(w))},_=function(w){var F=Yr(w);u(F,w)>=0||ar(i.clickOutsideDeactivates,w)||ar(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},A=function(){if(s.active)return ql.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Wl(function(){g(h())}):g(h()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",_,{capture:!0,passive:!1}),r.addEventListener("keydown",E,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",_,!0),r.removeEventListener("keydown",E,!0),o},q=function(w){var F=w.some(function(R){var M=Array.from(R.removedNodes);return M.some(function(Y){return Y===s.mostRecentlyFocusedNode})});F&&g(h())},$=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(q):void 0,j=function(){$&&($.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){$.observe(w,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(w){if(s.active)return this;var F=l(w,"onActivate"),R=l(w,"onPostActivate"),M=l(w,"checkCanFocusTrap");M||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var Y=function(){M&&m(),A(),j(),R==null||R()};return M?(M(s.containers.concat()).then(Y,Y),this):(Y(),this)},deactivate:function(w){if(!s.active)return this;var F=zl({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,j(),ql.deactivateTrap(a,o);var R=l(F,"onDeactivate"),M=l(F,"onPostDeactivate"),Y=l(F,"checkCanReturnFocus"),K=l(F,"returnFocus","returnFocusOnDeactivate");R==null||R();var se=function(){Wl(function(){K&&g(f(s.nodeFocusedBeforeActivation)),M==null||M()})};return K&&Y?(Y(f(s.nodeFocusedBeforeActivation)).then(se,se),this):(se(),this)},pause:function(w){if(s.paused||!s.active)return this;var F=l(w,"onPause"),R=l(w,"onPostPause");return s.paused=!0,F==null||F(),S(),j(),R==null||R(),this},unpause:function(w){if(!s.paused||!s.active)return this;var F=l(w,"onUnpause"),R=l(w,"onPostUnpause");return s.paused=!1,F==null||F(),m(),A(),j(),R==null||R(),this},updateContainerElements:function(w){var F=[].concat(w).filter(Boolean);return s.containers=F.map(function(R){return typeof R=="string"?r.querySelector(R):R}),s.active&&m(),j(),this}},o.updateContainerElements(t),o};const QC=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:GC},Symbol.toStringTag,{value:"Module"})),JC=ic(QC),XC=ic(zC);function Un(e){"@babel/helpers - typeof";return Un=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(e)}function ex(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ul(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,mf(r.key),r)}}function tx(e,t,n){return t&&Ul(e.prototype,t),n&&Ul(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function nx(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Es(e,t)}function Es(e,t){return Es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Es(e,t)}function rx(e){var t=ix();return function(){var r=Ba(e),a;if(t){var i=Ba(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return ax(this,a)}}function ax(e,t){if(t&&(Un(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cr(e)}function cr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ix(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ba(e){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ba(e)}function sx(e,t,n){return t=mf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mf(e){var t=ox(e,"string");return Un(t)==="symbol"?t:String(t)}function ox(e,t){if(Un(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Un(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gr=C,he=_C,ux=JC,lx=ux.createFocusTrap,cx=XC,dx=cx.isFocusable,ao=function(e){nx(n,e);var t=rx(n);function n(r){var a;ex(this,n),a=t.call(this,r),sx(cr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,h=new Array(c>1?c-1:0),m=1;m<c;m++)h[m-1]=arguments[m];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(cr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(cr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(cr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return tx(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var a=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return a||(a===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var a=this.getDocument();a&&(this.previouslyFocusedElement=a.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(a){var i=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,a):this.originalOptions.clickOutsideDeactivates;return i&&(this.outsideClick={target:a.target,allowDeactivation:i}),i}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var a=this,i=function(){var o=a.getReturnFocusNode(),l=!!(a.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!a.outsideClick||a.outsideClick.allowDeactivation&&!dx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Gr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Gr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Gr.cloneElement(i,{ref:s});return o}return null}}]),n}(Gr.Component),ir=typeof Element>"u"?Function:Element;ao.propTypes={active:he.bool,paused:he.bool,focusTrapOptions:he.shape({document:he.object,onActivate:he.func,onPostActivate:he.func,checkCanFocusTrap:he.func,onPause:he.func,onPostPause:he.func,onUnpause:he.func,onPostUnpause:he.func,onDeactivate:he.func,onPostDeactivate:he.func,checkCanReturnFocus:he.func,initialFocus:he.oneOfType([he.instanceOf(ir),he.string,he.bool,he.func]),fallbackFocus:he.oneOfType([he.instanceOf(ir),he.string,he.func]),escapeDeactivates:he.oneOfType([he.bool,he.func]),clickOutsideDeactivates:he.oneOfType([he.bool,he.func]),returnFocusOnDeactivate:he.bool,setReturnFocus:he.oneOfType([he.instanceOf(ir),he.string,he.bool,he.func]),allowOutsideClick:he.oneOfType([he.bool,he.func]),preventScroll:he.bool,tabbableOptions:he.shape({displayCheck:he.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:he.oneOfType([he.bool,he.func])}),trapStack:he.array,isKeyForward:he.func,isKeyBackward:he.func}),containerElements:he.arrayOf(he.instanceOf(ir)),children:he.oneOfType([he.element,he.instanceOf(ir)])};ao.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:lx};var fx=ao;const hx=bn(fx),pf=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&d.jsx(Jf.ReactQueryDevtools,{initialIsOpen:!1})]})};var mx=C.createContext({client:na});function px(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&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&&(na.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),na.init(r,a)),na)},[n,r]);return C.createElement(mx.Provider,{value:{client:i}},t)}const gf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(px,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):d.jsx(d.Fragment,{children:e}),vf=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...mh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},io=C.createContext({}),fa={en:"English",es:"Español",fr:"Français",pt:"Português"},Ot=C.createContext({isLoading:!0});function Ha(){return C.useContext(Ot)}const bf=({children:e,user:t})=>d.jsx(Ot.Provider,{value:t,children:e}),so=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),yf=()=>C.useContext(so),Df=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(so.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},gx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),bc(5e3)}).catch(c=>{c.message===pc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(io.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(vf,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(ks.CookiesProvider,{children:d.jsx(bf,{user:a,children:d.jsx(Df,{children:d.jsx(pf,{showDevTools:r,children:d.jsx(gf,{user:a,children:t})})})})})})})};const oo=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:V("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Sr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:h="Modal"})=>{const m=oe.useIntl(),{registerOverlay:p,unregisterOverlay:g}=yf(),[f,y]=C.useState(t),v=E=>{E.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",v),()=>{window.removeEventListener("keyup",v)}));const x=E=>{y(E),E?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{f&&g(e)}),[t]);const B=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:V("overlay",{open:f}),role:"dialog",children:d.jsx(oo,{id:e,className:V("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:B,children:t&&d.jsx(hx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(xe,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(Qt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(Qt,{}),d.jsx(yn,{buttons:u})]}),s&&d.jsx(yr,{className:"error",children:s})]})})})})},Cf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const vx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=oe.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Sr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:d.jsx(tf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const bx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(tn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Sr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(zn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const yx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:V("testimonial-block",a),children:[d.jsx(Lt,{className:"testimonial",children:n}),r?d.jsx(Fr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:V("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Dx=C.memo(yx);const Cx=({items:e=[],selector:t="",className:n=""})=>{const r=oe.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(St,{variant:"subtle",className:V("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Ua=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=oe.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const h=c/60,m=Math.floor(h),p=(h-m)*60,g=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};let sr=!1;const Va=C.forwardRef(({styling:e={},isOpen:t=!1,isLoading:n=!1,children:r,className:a="",functions:i={},callbacks:s={},...o},l)=>{const u=oe.useIntl(),c=C.useRef(null),h=l||c,[m,p]=C.useState(t?"open":"hidden"),{extraPadding:g=!0,hasPointer:f=!1,hasForm:y=!1}=e,{onOpen:v=()=>{},onClose:x=()=>{}}=s;C.useEffect(()=>{const A=h==null?void 0:h.current;if(A)return A.addEventListener("transitionend",B),A.addEventListener("keydown",E),()=>{A.removeEventListener("transitionend",B),A.removeEventListener("keydown",E)}},[]);const B=({propertyName:A})=>{A==="opacity"&&(sr!==!1&&clearTimeout(sr),p(S=>(S==="open"?v():S==="closed"&&x(),S==="opening"?"open":S==="closing"?"closed":S==="closed"?"hidden":S)))},E=A=>{A.key==="Escape"&&(A.stopPropagation(),A.preventDefault(),p("closing"))};Ln(()=>{sr!==!1&&clearTimeout(sr);let A="open";t?p("opening"):(p("closing"),A="hidden"),sr=setTimeout(()=>{p(A)},300)},[t]);const _={...o};return i&&i.onBlur&&(_.onBlur=i.onBlur),d.jsx("aside",{ref:h,className:V("tooltip text-medium",m,a,{loading:n,"extra-padding":g,"has-pointer":f,bottom:f==="bottom","has-form":y}),..._,children:d.jsx("div",{className:"content",hidden:m==="hidden",children:n?d.jsx("p",{children:u.formatMessage({id:"tooltip_loading"})}):typeof r=="string"?d.jsx("p",{children:r}):r})})});const xx=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(Yn,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const an=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:V("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const wx=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(an,{className:V("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(yn,{buttons:r})]})})};function xf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Ex=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=oe.useIntl();return d.jsxs("div",{className:V("edit-section-placeholder",{"has-icon":!!e}),style:gc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(xe,{href:r,variant:"secondary",size:"small",onClick:()=>xf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},_x=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,h=()=>u(!1);return d.jsxs("section",{className:V("edit-section",t),children:[n&&d.jsx(Sr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:V("edit-section-modal"),children:d.jsx(Gn,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async m=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(m)),u(!1)},onCancel:h}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(xe,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>xf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(Ex,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Qt,{})]})};const kx=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:V("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:V("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:V({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:h,link:m=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const f=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:h});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:m?d.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const Bx=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ax=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},m={};c.forEach(y=>{if(!t[y]){m[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){m[y]=t[y];const{text:v,element:x}=t[y];if(x&&Bx.includes(x.toLowerCase()))return;m[y]={text:v,element:h[y]};return}m[y]={text:t[y],element:h[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(an,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(m[y]&&typeof m[y]=="object"){const{text:v,element:x=""}=m[y];return y==="text"?d.jsx(zn,{overrideType:"text-only",className:"text",children:v},y):C.createElement(x,{key:y,className:y},v)}return null}),l,p&&d.jsx(xe,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&d.jsx(Yn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Fx=C.memo(Ax);const Tx=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(an,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const Sx=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(zn,{children:n}):n;return d.jsxs(an,{className:V("highlight-section",t),children:[r&&d.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(Yn,{image:r})}),d.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},jx=C.memo(Sx);const Ox=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:V("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(xe,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Px=({type:e,data:t})=>{const n=oe.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const h=a&&Gi(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):As(c)});if(o)return d.jsx(Rn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&Gi(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},Aa={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Nx=({data:e,cta:t,link:n,gtmContext:r})=>{var f,y;const a=oe.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:h}=e,m=e.contentType;let p="";if((f=Aa[m])!=null&&f.gtmEvent&&(p=Aa[m].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?d.jsx(xe,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&c!=="premium"){const v=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),x=async B=>{if(B.preventDefault(),B.stopPropagation(),!(v||!t||!t.onClick)){s(E=>({...E,loading:!0}));try{const E=await t.onClick(e);s(E==="success"?()=>({registered:!0,loading:!1}):_=>({..._,loading:!1}))}catch{s(_=>({..._,loading:!1}))}}};return d.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(xe,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${m}: ${h}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const Rx={title:66,text:3e3,secondaryText:1e3,partner:25},uo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var S,q,$;const o=oe.useIntl(),l=C.useContext(Ot),u=l&&typeof l.id=="string",[c,h]=C.useState({data:null,isLoading:!0}),{data:m,isLoading:p}=c,g=C.useCallback(()=>{n(t,u).then(j=>{h(()=>({data:j,isLoading:!1}))}).catch(()=>h(j=>({...j,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),p||!m)return d.jsx(Ct,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:f}=m;if(!f||!Aa[f])return d.jsx(Ct,{element:"li",className:"card-wrapper"});const{basePath:y="",className:v,length:x,gtmEvent:B}=Aa[f];let E=m.slug?`${y}${m.slug}`:!1;m.slug&&(m.slug.slice(0,4)==="http"||m.slug.slice(0,2)==="//"||m.slug.slice(0,6)==="mailto"||m.slug.slice(0,3)==="tel")&&(E=m.slug);const _={...Rx,...x};let A={className:"card"};return E&&(A={href:E,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${B}-click`,"data-testid":"link"},m.openInNewTab&&(A.target="_blank")),d.jsx("li",{className:V("card-wrapper text-medium",v,i,{"has-link":E,"no-link":!E,"has-image":m.banner}),"data-testid":`${f}-card`,children:C.createElement(E?"a":"div",A,d.jsxs(d.Fragment,{children:[d.jsx(Dc,{className:"card-label",contentType:f,customIcon:m.customIcon,customLabel:m.customLabel}),m.startDate&&!m.isOngoingEvent&&d.jsx(Rn,{size:"small",variant:m.dateHasPassed?"default":"information","data-testid":"date",children:m.dateHasPassed?o.formatMessage({id:"card_ended"}):vc(m.startDate)}),m.banner?d.jsxs("p",{className:"img",children:[m.registered&&d.jsx(Rn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Yn,{image:m.banner})]}):v==="people"?d.jsx(tn,{name:m.title||"",src:m.profile,"data-testid":"people-profile-picture"}):null,m.contributors&&d.jsx(js,{contributors:{data:m.contributors},styling:{size:"small",showGap:v!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(f)?o.formatMessage({id:`card_contributors_${f}`}):void 0,"data-testid":"contributors"}),m.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:m.partner.length>1?o.formatMessage({id:"card_partner"},{partner:m.partner[0],number:m.partner.length-1}):$n(m.partner[0],_.partner)}),["title","text","secondaryText"].map(j=>{const N=m[j];if(!N)return null;const w=fc(j);return d.jsx(Lt,{className:w,options:{wrapper:"p",forceWrapper:!0,forceInline:!0},"data-testid":w,children:$n(N,_[j])},j)}),(l==null?void 0:l.id)&&(m==null?void 0:m.members)&&d.jsxs("span",{className:"member-information",children:[((S=m==null?void 0:m.members)==null?void 0:S.isMember)&&d.jsx(Rn,{size:"small",variant:"registered",icon:((q=m==null?void 0:m.members)==null?void 0:q.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${($=m==null?void 0:m.members)==null?void 0:$.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:m==null?void 0:m.members.count})})]}),d.jsx(Px,{type:v||"",data:m}),d.jsx(Nx,{data:m,cta:r,link:E||"",gtmContext:a})]}))})};const wf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(uo,{id:s,card:{...a,contentType:t[i]},...r},s)})}),Mx=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},Ix=({id:e,title:t})=>{const n=oe.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Pi={fourCards:1024,threeCards:769,twoCards:480};let Qr=null;const $x=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=oe.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:m}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:y}=p,v=t.length,x=Math.ceil(v/h),B=C.useRef(null),E=Kn(!0,!0,B==null?void 0:B.current);C.useEffect(()=>{let j=1;E&&(E>=Pi.fourCards?j=4:E>=Pi.threeCards?j=3:E>=Pi.twoCards&&(j=2),j>v&&(j=v)),c(N=>({...N,cardsPerPage:j,isLoading:!1}))},[E,v]);const _=(j="next")=>{let N=f;if(typeof j=="string")if(j==="next")if(f<x-1)N=f+1;else return;else if(f>0)N=f-1;else return;else N=j;g(w=>({...w,currentPage:N,loadedPages:[...new Set([...y,N])]}))},A=j=>{Qr=j.touches[0].clientX},S=j=>{if(Qr===null)return;const N=j.touches[0].clientX,w=Qr-N;w>5?_("next"):w<-5&&_("previous"),Qr=null},q={"--width":`${E||0}px`,"--total-cards":v,"--cards-per-page":h,"--page":f};if(m)return d.jsx(Ts,{layout:`carousel${a?"-with-title":""}`});const $=(j,N)=>{var F;let w=null;return(F=j==null?void 0:j.sys)!=null&&F.id?w=`card-${j.sys.id}`:j!=null&&j.slug?w=`card-${j.slug}`:[n[N],j.contentType].includes("customCard")&&(w=`card-${window.btoa(`${j.title} ${j.createdAt}`)}-${N}`),w};return d.jsxs("section",{ref:B,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(Ix,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:A,onTouchMove:S,style:q,"data-testid":"carousel-list",children:t.map((j,N)=>{let w=$(j,N);return w&&Mx(N,h,f,y)?d.jsx(uo,{id:w,card:{...j,contentType:n[N]},buildCardData:r,gtmContext:s,...o},w):(w=w||`${e}-card-${N}`,d.jsx(Ct,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},w))})}),x<=1?null:d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(xe,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:j=>{j.preventDefault(),j.stopPropagation(),_("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(x)].map((j,N)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:V("page-indicator",{selected:N===f}),onClick:w=>{w.preventDefault(),w.stopPropagation(),_(N)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:N+1,total:x})})})},`page-indicator-${N}`)),d.jsx("li",{className:"arrow next",children:d.jsx(xe,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:j=>{j.preventDefault(),j.stopPropagation(),_("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=x-1})})]})]})},Lx=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ts,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:d.jsx(Qt,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx($x,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:d.jsx(Qt,{})]},`carousel-${c}`)});const Ni="joinCommunityButton",lo=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const a=oe.useIntl(),i=C.useContext(Ot),s=i&&typeof i.id=="string",[o,l]=C.useState(e),[u,c]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{u==="joining"?c("joined"):u==="leaving"&&c("notJoined")},[o]);const h={},m={};return o&&u!=="leaving"&&(h["data-hover-text"]=a.formatMessage({id:`${Ni}_leave`}),h["aria-label"]=a.formatMessage({id:`${Ni}_member_aria`}),m["aria-hidden"]="true"),d.jsx(xe,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&u!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{s&&(p.currentTarget.blur(),o?(c("leaving"),typeof r=="function"&&await r()):(c("joining"),typeof n=="function"&&await n()),l(!o))},className:V("join-community-button",u,{active:u==="joining"}),disabled:!s,...h,children:d.jsx("span",{className:"text",...m,children:a.formatMessage({id:`${Ni}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Ri="communityDetails_",zx=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:a=[]}={number:0,data:[]},functions:{invite:i,...s}})=>{const o=oe.useIntl(),l=5,u=r||a.length,c=a.length?a:Array(l).fill({}),h=`/communities/${n}/members`===window.location.pathname;return d.jsxs("div",{className:V("community-details",e),children:[d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[o.formatMessage({id:`${Ri}members`}),d.jsx("span",{className:"count",children:u})]}),!h&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${n}/members`,children:o.formatMessage({id:`${Ri}viewAll`})})})]}),d.jsx(js,{contributors:{total:r,data:c},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:l})]}),d.jsx(lo,{isMember:t,functions:{...s}}),t&&d.jsx(xe,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${Ri}invite`})})]})};const qx=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:V("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(Dn,{href:s?void 0:i,...l,children:$n(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Wx=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=oe.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,h)=>{let m=[];o.includes(c)?m=o.filter(p=>p!==c):c==="all"?m=["all"]:n?m=[...o.filter(p=>p!=="all"),c]:m=[c],l(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),h&&typeof h=="function"&&h()};return d.jsx("ul",{className:V("filters",a),children:s.map(({id:c,text:h,disabled:m=!1,callback:p=()=>{}})=>{let g={};return m&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),d.jsx("li",{children:d.jsx("button",{className:V(c,{selected:o.includes(c)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(c,p)},...g,children:h})},c)})})},Hx=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const Jr="languageSwitcher_",Ux=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=oe.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(io),[h,m]=C.useState(e);if(C.useEffect(()=>{e!==h&&m(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),f=h!==e;return d.jsxs("div",{className:V("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${Jr}label`})}),d.jsx("ul",{children:g.map(y=>{var B;if(!fa[y])return null;const v=(B=r[y])==null?void 0:B.post_name;let x={className:y};if(h===y)x["aria-label"]=u.formatMessage({id:`${Jr}selected`},{language:fa[y]});else{const E=Hx(y,v,i);x={...x,href:typeof E=="string"?E:E.url,onClick:_=>{m(y),c(y),typeof a<"u"&&(_.preventDefault(),_.stopPropagation(),a(y,typeof E=="string"?E:E.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Dn,{...x,fallbackElement:"span",children:fa[y]})},y)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${Jr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Jr}disclaimer`},{email:Fn.support,link:y=>{const v=`mailto:${y}`;return d.jsx("a",{href:v,children:y})}})})]})};const Mi=oe.createIntl({locale:"en",messages:Zn}),jr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Mi.formatMessage({id:"loadMore_button"}),endOfFeed:Mi.formatMessage({id:"loadMore_endOfFeed"}),error:Mi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,h]=C.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:V("load-more",l),children:!c&&e?d.jsx(xe,{variant:r,size:a,styling:i,icon:s,onClick:m,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const co=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:V("logo",e,t,n),...r,children:d.jsx(Ie,{children:d.jsx(oe.FormattedMessage,{id:"apolitical"})})})});let Xr=!1;const Ef=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=oe.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:V("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(xe,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:h,icon:m,...p},g)=>{const f={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{Xr&&(clearTimeout(Xr),Xr=!1)},onBlur:()=>{Xr=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(xe,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Vx=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Kx=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],_f=({activeLink:e})=>{const t=oe.useIntl(),n=C.useContext(Ot),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Kx.map(({key:a,href:i})=>{const s=Vx(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:V(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(tn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},or=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Zx=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${or(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${or(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${or(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
63
158
|
|
|
64
|
-
${ft(e,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ft(e,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,s)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(s))}];const Lc="shareLinks_",Bc=({title:t,link:e,referrer:n,gtmContext:r="ShareLinks",size:s="large",variant:i="default",className:o=""})=>{const c=I.useIntl(),u=Ic({title:t,link:e,referrer:n});return a.jsxs("aside",{className:S("share-links",s,i,o),children:[a.jsx("p",{className:"text-small",children:c.formatMessage({id:"shareLinks_label"})}),a.jsx("ul",{children:u.map(({key:l,icon:d,url:m,shouldRender:f=!0,onClick:p})=>{if(typeof f=="function"&&!f())return null;const b={};return p&&(b.onClick=h=>p(h,m)),a.jsx("li",{children:a.jsx(ae,{size:s,variant:"tertiary",icon:{icon:d||l},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${l}-click`,"data-testid":"link",screenreaderText:c.formatMessage({id:`${Lc}link_${l}`}),...b})},l)})})]})};const qc=({tabs:t,className:e="",preventLocationChange:n})=>{var l;const r=(d,m,f)=>(d||(d=`panel-${window.btoa(m)}-${f}`),d);let s=t.findIndex(d=>d.current===!0);if(s<0&&(s=0),window.location.hash){const d=window.location.hash.replace("#","");if(t.find(f=>f.id===d)){for(let f=0;f<t.length;f++)if(r(t[f].id,t[f].text,f)===d){s=f;break}}}const[i,o]=g.useState((l=t[s])!=null&&l.id?t[s].id:r(t[s].id,t[s].text,s));g.useEffect(()=>{if(t[s].hasCarousel){const d=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(d)}},[i]);const c=[],u=[];return t.forEach(({id:d,text:m,content:f,href:p,hasCarousel:b},h)=>{d=r(d,m,h);const y=i===d,x={};p||(x["aria-controls"]=d,x.onClick=k=>{k.preventDefault(),k.stopPropagation(),o(d),!n&&(window.location.hash=`#${d}`)},u.push(a.jsx("section",{id:d,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${d}`,"aria-live":y?"assertive":"off",children:typeof f=="string"?a.jsx("p",{children:f}):f},`section-${d}`))),c.push(a.jsx("li",{"data-testid":"navigation-tab",children:a.jsx("a",{href:p||`#${d}`,id:`tab-${d}`,className:S({selected:y}),role:"tab","aria-selected":y,...x,children:m})},`tab-${d}`))}),a.jsxs("div",{className:S("tabs-wrapper",e),children:[a.jsx("ul",{className:"tabs",role:"tablist",children:c}),a.jsx("div",{className:"tab-content",children:u})]})};const Uc={"2-1":901,"1-3":769,"1-1":769},ms=({layout:t="2-1",hideOnMobile:e=!1,hasCSSContainers:n=!1,className:r="",children:s})=>{const i=nt(!0);let o=s;return g.Children.count(s)===1&&(o=g.Children.toArray(s)[0],o.props&&(o=o.props.children)),a.jsx("section",{className:S("columns",`layout-${t}`,r,{"has-containers":n}),children:g.Children.map(o,(c,u)=>e!==!1&&u===e&&i&&i<Uc[t]?null:c)})};let Nn;const Pn="contactFooter_",Wc=({onSuccess:t=async()=>{},onFailure:e=()=>{}})=>{const n=g.useRef(null),[r,s]=g.useState(0),[i,o]=g.useState(!1),c=()=>{n.current&&s(n.current.clientHeight)},u=()=>{i||(o(!0),clearTimeout(Nn),Nn=setTimeout(()=>{c(),o(!1)},500))};return g.useEffect(()=>(c(),window.addEventListener("resize",u),()=>{clearTimeout(Nn),window.removeEventListener("resize",u)}),[]),a.jsx(Ie,{id:"contactForm",className:"contact-footer",children:a.jsxs("div",{className:"inner-wrapper",children:[a.jsx("h2",{children:a.jsx(I.FormattedMessage,{id:`${Pn}title`})}),a.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[a.jsxs("aside",{children:[a.jsx("p",{children:a.jsx(I.FormattedMessage,{id:`${Pn}text`})}),a.jsx(We,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:a.jsx(I.FormattedMessage,{id:`${Pn}email`})})]}),a.jsx(qa,{functions:{onSuccess:t,onFailure:e},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},zc=({activeLink:t,...e})=>a.jsx(Ie,{children:a.jsx(ms,{layout:"1-3",children:a.jsxs(a.Fragment,{children:[a.jsx(fs,{activeLink:t}),a.jsx(Ma,{...e})]})})});const $n="cookieBanner_",Mn=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Rn=new Date(Date.now()+12*30*24*60*60*1e3),ps=()=>{const t=I.useIntl(),[e,n,r]=Kn.useCookies(Mn),[s,i]=g.useState(!e["apol-cookie-banner"]),o=()=>{Mn.forEach(d=>{n(d,!0,{path:"/",expires:Rn,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},c=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Rn}),Mn.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Rn});return}r(d)}),i(!1)};if(!s)return null;const u=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:c,gtmType:"reject-all"},{id:"accept",onClick:o,gtmType:"accepted-all"}],l=[];return u.forEach(d=>{l.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:t.formatMessage({id:`${$n}buttons_${d.id}`})})}),a.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[a.jsx("h6",{children:t.formatMessage({id:`${$n}title`})}),a.jsx("p",{children:t.formatMessage({id:`${$n}text`})}),a.jsx(at,{buttons:l})]})},Pe={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-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:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},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","ai"],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"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Ye["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Ye["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:Ye.support,gtmType:"concierge-email-click"},business:{email:Ye.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 Ke="footer_",Gt="SiteFooter",na=({group:t})=>{const e=Pe[t].order||[];let n=!1;return"text"in Pe[t]&&(n=Pe[t].text),a.jsxs(g.Fragment,{children:[a.jsx("p",{className:"pre-title",children:a.jsx(I.FormattedMessage,{id:`${Ke}${t}`})}),Array.isArray(e)&&e.length>0&&a.jsx("ul",{className:"text-medium",children:e.map(r=>{if(["order","child","text"].includes(r))return null;const{href:s,gtmType:i}=Pe[t][r],o={};return["legal"].includes(t)&&(o.target="_blank",o.rel="noopener"),a.jsx("li",{children:a.jsx("a",{href:s,className:"gtm-trackable","data-gtm-event-context":Gt,"data-gtm-event-type":i,...o,children:a.jsx(I.FormattedMessage,{id:`${Ke}${t}_${r}`})})},`${t}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&a.jsx("dl",{className:"text-medium",children:n.order.map(r=>a.jsxs(g.Fragment,{children:[a.jsx("dt",{children:a.jsx(I.FormattedMessage,{id:`${Ke}${t}_${r}`})}),a.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&a.jsx("address",{children:a.jsx(I.FormattedMessage,{id:`${Ke}${t}_${r}_address`,values:{br:a.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&a.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Gt,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${t}-${r}`))})]},t)},dr=()=>a.jsx("div",{id:"footer",children:a.jsxs("div",{className:"wrapper",children:[a.jsx(tn,{element:"hr"}),a.jsx(ur,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Gt,"data-gtm-event-type":"logo-homepage-link"}),a.jsx("footer",{children:["platform","community","company","contact"].map(t=>a.jsxs("div",{className:"group",children:[a.jsx(na,{group:t}),Object.keys(Pe[t]).includes("child")&&a.jsx(na,{group:Pe[t].child})]},t))}),a.jsx("hr",{}),a.jsxs("div",{className:"sub-footer",children:[a.jsx("ul",{children:Array.isArray(Pe.social.order)&&Pe.social.order.map(t=>{const e=Pe.social[t];return a.jsx("li",{className:t,children:a.jsx("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Gt,"data-gtm-event-type":"social-click",children:a.jsx("span",{className:"hidden",children:a.jsx(I.FormattedMessage,{id:`${Ke}social_${t}`})})})},t)})}),a.jsx("small",{children:a.jsx(I.FormattedMessage,{id:`${Ke}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),ue={timeouts:{},handlerCalled:{},getIsDesktopVersion:(t,e)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const o=`logged${t?"In":"Out"}`;return e>=n[i][o]};let s={};return["navigation","search"].forEach(i=>{s[i]=r(i)}),s},shouldChangeHeaderIsVisible:(t,e,n)=>{Object.values(e).filter(s=>s===!0).length||n([{type:"headerIsVisible",value:t}])},handleMenus:({id:t,value:e,menus:n,dispatch:r,forceHandle:s=!1})=>{if(!s&&n[t]===e||!s&&t==="account"&&e===!1&&n.navigation===!0)return;const i=Date.now();if(!s&&!e&&ue.handlerCalled[t]&&i-ue.handlerCalled[t]<500)return;ue.handlerCalled[t]=i;let o=[{type:`menus.${t}`,value:e}];if(e===!0)Object.keys(n).forEach(c=>{c===t||n[c]===!1||o.push({type:`menus.${c}`,value:!1})});else{let c=null;switch(t){case"navigation":c=document.querySelector("#header .menu-button"),c||(c=document.querySelector("#navigation > li.parent"));break;case"search":c=document.querySelector("#header .toggle-search-button");break;case"account":c=document.querySelector("#header .account-button");break;default:return}c&&c.focus()}r(o)},findFirstChild:(t,e,n=!1)=>{if(!t||!t[0])return!1;for(let r=0;r<=t.length;r++){if(!t[r])continue;if(t[r][e]&&(!n||t[r][e].includes(n)))return t[r];if(!e.includes("."))continue;const s=fa(t[r],e);if(!(typeof s>"u")&&(!n||s[e]&&s[e].includes(n)||s.value&&s.value.includes(n)||s.toString().includes(n)))return t[r]}return t[0].children?ue.findFirstChild(t[0].children,e,n):!1},autoFocus:({menu:t,navigationRef:e,isDesktopVersion:n,focusElements:r,dispatch:s})=>{var u;if(!e.current||!e.current.children)return;const i=n?"desktop":"default";if(r[t][i]){(u=document.querySelector(`#header ul a[href="${r[t][i]}"]:last-child`))==null||u.focus();return}let o,c;switch(t){case"navigation":if(n){const l=ue.findFirstChild(e.current.children,"attributes.aria-controls","navigation");o=ue.findFirstChild(l.children,"href")}else o=ue.findFirstChild(e.current.children,"href");break;case"account":if(c=ue.findFirstChild(e.current.children,"className","account"),!c||!c.children)return;o=ue.findFirstChild(c.children,"href");break;default:return}o&&(s([{type:`focusElements.${t}.${i}`,value:o.attributes.href.value}]),o.focus())},events:{onClick:(t,{id:e,callback:n,isOpen:r})=>{t.target&&t.target.attributes&&t.target.attributes.href||(t.preventDefault(),t.stopPropagation(),clearTimeout(ue.timeouts[e]),n(e,!r))},onFocus:({id:t})=>{clearTimeout(ue.timeouts[t])},onMouseEnter:({id:t,callback:e})=>{clearTimeout(ue.timeouts[t]),e(t,!0)},onBlur:({id:t,callback:e})=>{ue.timeouts[t]=setTimeout(()=>{e(t,!1)},250)}}},_t={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},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"}}}},Qt=({id:t,isLoggedIn:e=!1,isDesktopVersion:n=!1,menus:r={},callback:s=()=>{},doTrack:i=null})=>{const o=I.useIntl(),c=fa(_t,t);if(!c||c.onlyShow&&(c.onlyShow==="logged-in"&&!e||c.onlyShow==="logged-out"&&e))return null;const u="doTrack"in c,l=i===null?u?c.doTrack:!0:i,d=t.includes("buttons.");let m=`header_${t.replaceAll(".","_")}`;c.hasVariantText&&(m+=`_logged${e?"In":"Out"}`);let f=!1;if(c.href){let k=c.gtmType||`${t}-click`;if(k.includes(".")){const C=k.split("."),_=C[C.length-2];k=`${_==="topics"?`${_}-`:""}${C[C.length-1]}`}f={href:c.href},l&&(f={...f,className:"gtm-trackable","data-gtm-event-type":k,"data-gtm-event-context":"HeaderButtons"}),d&&(f={...f,variant:"secondary",size:{mobile:"small",881:"large"},...c.props||{}})}const p=c.order&&c.order[0]&&c[c.order[0]],b=p&&c[c.order[0]].order,h=f&&window.location.pathname===c.href;let y={},x={};if(h&&(y={...y,"aria-current":"page"}),p){const k=c.menuId||t,C={onClick:_=>ue.events.onClick(_,{id:k,callback:s,isOpen:r[k]}),onFocus:()=>ue.events.onFocus({id:k}),onBlur:()=>ue.events.onBlur({id:k,callback:s}),onMouseLeave:()=>ue.events.onBlur({id:k,callback:s}),onMouseEnter:()=>ue.events.onMouseEnter({id:k,callback:s})};n&&(b&&(y={...C,onKeyPress:_=>{_.key==="Enter"&&ue.events.onClick(_,{id:k,callback:s,isOpen:r[k]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),x={hidden:k in r?!r[k]:!0}),b||(x={...x,...C})}return a.jsxs("li",{className:S({[c.className]:c.className,"has-submenu":p,parent:b,active:h}),...y,children:[f?g.createElement(d?ae:"a",f,o.formatMessage({id:m})):o.formatMessage({id:m}),c.order&&a.jsx("ul",{...x,children:c.order.map(k=>{if(!c[k])return null;const C={isLoggedIn:e,isDesktopVersion:n,menus:r,callback:s,doTrack:u?l:null};return c[k].order?a.jsxs("li",{className:S({[c[k].className]:c[k].className}),children:[o.formatMessage({id:`${m}_${k}`}),a.jsx("ul",{children:c[k].order.map(_=>a.jsx(Qt,{id:`${t}.${k}.${_}`,...C},_))})]},k):a.jsx(Qt,{id:`${t}.${k}`,...C},k)})})]},t)};const Zc={height:67,height_desktop:83},fr=({showNavigation:t=!0})=>{const e=I.useIntl(),n=g.useContext(Se),r=nt(!0,!0),s=n&&typeof n.id=="string",i=g.useMemo(()=>ue.getIsDesktopVersion(s,r),[s,r]),[o,c]=g.useReducer(Qn,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:u,menus:l,focusElements:d}=o,m=g.useRef(o);g.useEffect(()=>{m.current=o},[o]),ba({scrollPosition:Zc[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const h=m.current.menus;!i&&h.navigation||ue.shouldChangeHeaderIsVisible(!0,h,c)},scrollDown:()=>{const h=m.current.menus;!i&&h.navigation||ue.shouldChangeHeaderIsVisible(!1,h,c)}}});const f=(h,y,x=!1)=>{ue.handleMenus({id:h,value:y,menus:m.current.menus,dispatch:c,forceHandle:x})},p=g.useRef(null),b=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(y=>{m.current.menus[y]&&f(y,!1,!0)})};return g.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.addEventListener("keydown",b),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",b)}},[]),Je(()=>{l.navigation&&ue.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:c})},[l.navigation]),Je(()=>{l.account&&ue.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:c})},[l.account]),n&&n.isLoading?null:a.jsxs(a.Fragment,{children:[a.jsxs("nav",{id:"header",className:S({"logged-in":s,"logged-out":!s,visible:u}),children:[a.jsx(ge,{element:"a",href:"#content-of-page",children:e.formatMessage({id:"header_skip"})}),a.jsx(ur,{variant:"monochrome"}),t&&a.jsxs(a.Fragment,{children:[!i.navigation&&a.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.stopPropagation(),f("navigation",!l.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":l.navigation,"aria-controls":"navigation",children:a.jsx(ge,{children:e.formatMessage({id:`header_menu_${l.navigation?"hide":"show"}`})})}),a.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||l.account?!1:!l.navigation,"data-showing":!i.navigation&&l.account?"account":"default",children:_t.order.map(h=>a.jsx(Qt,{id:h,isLoggedIn:s,isDesktopVersion:i.navigation,menus:{navigation:l.navigation,account:l.account},callback:f},h))}),!i.search&&a.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),f("search",!l.search)},"aria-haspopup":"true","aria-expanded":l.search,"aria-controls":"search-form",children:a.jsx(ge,{children:e.formatMessage({id:`header_search_${l.search?"hide":"show"}`})})}),a.jsx(Wa,{id:"global-search",handleToggle:{searchIsOpen:l.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),s?a.jsxs("button",{className:"account-button",onClick:h=>ue.events.onClick(h,{id:"account",callback:f,isOpen:l.account}),onMouseEnter:()=>ue.events.onMouseEnter({id:"account",callback:f}),onMouseLeave:()=>ue.events.onBlur({id:"account",callback:f}),"aria-haspopup":"true","aria-expanded":l.account,"aria-controls":"navigation",children:[a.jsx(ge,{children:e.formatMessage({id:`header_account_${l.account?"hide":"show"}`})}),a.jsx(De,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):a.jsx("ul",{className:"sign-in-buttons",children:_t.buttons.order.map(h=>a.jsx(Qt,{id:`buttons.${h}`},h))})]})]}),a.jsx("hr",{id:"content-of-page"}),a.jsx("div",{className:S("overlay",{open:l.navigation||l.account||!i.search&&l.search})})]})};const Hc=()=>{const t=I.useIntl();return a.jsxs(a.Fragment,{children:[a.jsx(fr,{}),a.jsx("div",{id:"content",children:a.jsx(Ae,{variant:"error",text:t.formatMessage({id:"pageLayout_error"})})}),a.jsx(dr,{})]})},hs=({children:t,additionalContent:{prepended:e,appended:n}={},reportError:r,forceShow:s={},styling:i={},className:o="",locale:c="en"})=>{const{navigation:u=!0,footer:l=!0}=s,{background:d="default",variant:m="default",circle:f="default",modal:p="default"}=i,b=ga();g.useEffect(()=>{window.scrollTo(0,0)},[b]);const h=Lt(t,{locale:c}),y=Lt(e,{locale:c}),x=Lt(n,{locale:c}),k={};return d!=="default"&&(k[d]=!0),m!=="default"&&(k[m]=!0),f!=="default"&&(k[f]=!0),a.jsx(Xs.ErrorBoundary,{onError:r,fallback:a.jsx(Hc,{}),children:a.jsx(g.Suspense,{fallback:null,children:a.jsxs("div",{id:"wrapper",className:S(o,k,{"has-footer":l}),children:[a.jsx(fr,{showNavigation:u}),a.jsxs("main",{id:"content-wrapper",children:[y&&a.jsx("div",{className:S("additional-content prepended",{"large-modal":p==="large"}),children:y}),g.createElement(d==="bold"?or:"div",{id:"content",children:h,className:S({"large-modal":p==="large"})})]}),x&&a.jsx("div",{className:"additional-content appended",children:x}),l&&a.jsx(dr,{}),a.jsx(ps,{})]})})})},ra={default:"tags_",headerTopics:"header_topics_topics_"},Fn={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"},Vc={getTagDetails:t=>{if(t.includes("topic_")){if(t=Fn.topic[t.replace("topic_","")],t){const e=_t.topics.topics[t].href;return e?{id:t,href:e,text:`${ra.headerTopics}${t}`}:null}return null}return Fn[t]?(t=Fn[t],{id:t,text:`${ra.default}${t}`}):null}};const Yc=({tags:t=[],color:e="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:s="",gtmType:i="tag-click",gtmContext:o="tags"})=>{const c=I.useIntl();if(!t||t.length<1)return null;const u=[];return t.forEach(l=>{if(!l)return;const d=Vc.getTagDetails(l);d&&u.push(d)}),u.length<1?null:a.jsx("ul",{className:S("tags text-small",e,s,{"one-line":n}),children:u.map(l=>{const d=c.formatMessage({id:l.text});return a.jsx("li",{children:l.href&&r?a.jsx("a",{href:l.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":o,children:d}):d},l.id)})})};const Kc=({members:{data:t=[],total:e=t.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:s="member",gtmType:i="member-click",className:o=""})=>{const c=I.useIntl();return t.length===0?null:a.jsxs("div",{className:S("members-list",o),children:[a.jsxs("h1",{children:[c.formatMessage({id:"membersList"}),a.jsx("span",{className:"count",children:e})]}),a.jsx("ul",{children:t.map((u,l)=>a.jsxs("li",{children:[a.jsx(xt,{member:u,gtmContext:s,gtmType:i}),u.isAdmin&&a.jsx(Ge,{children:c.formatMessage({id:"membersList_admin"})})]},l))}),n&&a.jsx(jt,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:s})]})};const Gc=({element:t="p",data:{timeLeftToFinish:e,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:s=!0},graph:i,styling:o={},className:c=""})=>{const u=I.useIntl();let l=s?n:r;l>99?l=100:l<1&&(l=0);const{highlightPercentage:d=!1}=o;return g.createElement(t,{className:S("course-progression",c,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"percentage",children:u.formatMessage({id:"courseProgression_done"},{percent:m=>a.jsx("strong",{children:m}),number:l})}),l<100&&s&&a.jsx(sn,{time:e,appendedText:u.formatMessage({id:"courseProgression_timeLeft"})}),a.jsx(Xn,{progress:l,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const gs=({element:t="span",sectionId:e,subsectionId:n,title:r,className:s=""})=>g.createElement(t,{className:S("lesson-name",s),"data-number":`${e}.${n}`,children:r});const vs=({size:t="default",completionTime:e,icon:n,optional:r,type:s,children:i})=>{const o=I.useIntl(),c=nn(`lessonType_${s}`)?o.formatMessage({id:`lessonType_${s}`}):ka(s||"");return a.jsxs("small",{className:S("content-type",{[t]:t!=="default"}),children:[a.jsx("span",{className:S("type",n),children:c})," ",e>0&&!r&&a.jsx(sn,{time:e})," ",i?a.jsx("span",{className:"additional",children:i}):null]})};const Qc=({course:{articles:t,canAccessCourse:e,description:n,hideTimes:r,isEnrolled:s,sectionId:i,sectionTime:o,slug:c,timeLeft:u,title:l},quizScores:d})=>{const m=I.useIntl(),f="courseStructure_",p=l.toLowerCase().includes("course conclusion");return a.jsxs(rn,{className:"course-structure",label:a.jsxs(a.Fragment,{children:[a.jsxs("small",{children:[m.formatMessage({id:`${f}section${p?"_end":""}`},{number:i})," ",!r&&o>=0&&a.jsx("span",{className:"time",children:s&&u===0?m.formatMessage({id:`${f}time_completed`}):a.jsx(sn,{time:o,appendedText:s?m.formatMessage({id:`${f}time_left`}):""})})]}),a.jsx("h3",{children:l})]}),shouldAnimate:!0,children:[a.jsx("p",{children:n}),a.jsx("ol",{children:t&&t.length>0&&t.map(({completed:b,completionTime:h,contentType:y,icon:x,image:k,isIntroduction:C,optional:_,slug:w,subsectionId:D,title:F,type:G})=>{const U=s&&e||C,N={};return k&&(N.style={"--image":`url(${k})`}),a.jsx("li",{className:S({article:y===mt.ARTICLE,discussion:y===mt.DISCUSSION,quiz:y===mt.QUIZ,completed:b&&y===mt.ARTICLE,locked:!U}),...N,children:a.jsx(We,{href:U?`/microcourses/en/${c}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${wa(F)}`,gtmType:"article-click",children:a.jsxs(a.Fragment,{children:[a.jsx(gs,{sectionId:i,subsectionId:D,title:F,className:"course-title"})," ",a.jsx(vs,{completionTime:h,icon:x,optional:_,type:G,children:d&&d[w]&&a.jsx("span",{className:"quiz-score",children:`${d[w]}%`})})]})})},w)})})]})};const Jc=({isComplete:t=!1,onClick:e,...n})=>{const r=I.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),a.jsx(ae,{...n,variant:"tertiary",icon:t?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:e,className:S("mark-complete-button center gtm-trackable",{completed:t}),"data-gtm-event-type":"mark-as-complete",disabled:t,children:r.formatMessage({id:`markCompleteButton${t?"_completed":""}`})})};let At=null;const ye="discussion_form_",on=({content:t={type:"response",slugs:{}},userHasPermissions:e=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},inputRef:r,placeholder:s,maxLength:i=5e4,minRows:o=4,forceShow:c={cancel:!1,error:!1},functions:u={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var N,$,j;const d=I.useIntl(),m=g.useContext(Se),[f,p]=g.useState(n.isEditing&&n.isEditing.text||""),[b,h]=g.useState(c.error||!1),[y,x]=g.useState(!1),k=g.useRef(null);if(r||(r=k),n.isLoading)return a.jsx(ke,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const C=T=>{const P=T.target.value;p(P);let O;!m||!m.id?O=Te(d.formatMessage,`${ye}error_loggedOut`,t.type,"action"):e?P.length>=i&&(O=`${ye}error_tooLong`):O=Te(d.formatMessage,`${ye}error_noPermission`,t.type,"action"),O?h(O):b&&h(!1)};let _=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const T=((N=t.slugs)==null?void 0:N.reply)||(($=t.slugs)==null?void 0:$.answer)||((j=t.slugs)==null?void 0:j.question)||"";T&&(_=`${_}-${T.slice(-15)}`)}const w=async T=>{var O;if(T.preventDefault(),T.stopPropagation(),!m||!m.id||!e||F)return;At&&clearTimeout(At),x("submitting");const P=window.location.pathname;try{let z;switch(t.type){case"post":z=await u.create({content:f});break;case"question":z=await u.create({title:f,authorId:m&&m.id,...(O=u.props)==null?void 0:O.create});break;case"response":z=await u.create({questionSlug:t.slugs.question},{body:f,authorId:m&&m.id,contentPath:P});break;case"reply":z=await u.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:f,authorId:m&&m.id,contentPath:P});break;default:break}await di(1e3),u.callback&&await u.callback(z),At=setTimeout(()=>{p(""),x("submitted");const V=new Event("discussionFormSubmitted");document.dispatchEvent(V),D()},500)}catch(z){const V=z;let H=`${ye}error`;V!=null&&V.message.includes("entry already exists")&&(H=Te(d.formatMessage,`${ye}error_alreadyExists`,t.type,"action")),V!=null&&V.message.includes("429")?H=Te(d.formatMessage,`${ye}error_tooMany`,t.type,"action"):V!=null&&V.message.includes("400")&&(H=`${ye}error`),h(H),D()}},D=()=>{At=setTimeout(()=>{h(!1),x(!1)},5e3)},F=!f||!vi(f),G=y==="submitting",U=[];return(n.isEditing&&!G||c.cancel)&&U.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:u.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!c.cancel&&(!m||!m.id||!f),children:d.formatMessage({id:`${ye}cancel`})}),U.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:T=>{if(n.isEditing){x("submitting"),u.handleSaveEdit&&u.handleSaveEdit(k.current&&"value"in k.current?k.current.value:"");return}w(T)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!e||F||G||n.isEditing&&f===n.isEditing.text,children:d.formatMessage({id:`${ye}${G?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),a.jsxs("form",{id:_,className:S("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(t.type)&&a.jsx("h2",{children:Te(d.formatMessage,`${ye}title`,t.type,"action")}),a.jsx(xt,{member:m||"community",gtmContext:l,gtmType:"profile-click"}),a.jsx(ge,{element:"label",showOnFocus:!1,htmlFor:`${_}-input`,children:Te(d.formatMessage,`${ye}label`,t.type,"action")}),a.jsx(ei,{ref:r,id:`${_}-input`,name:t.type,placeholder:s||Te(d.formatMessage,`${ye}placeholder`,t.type,"action"),onChange:C,value:y==="submitting"&&!b?"":f,maxLength:i,"aria-invalid":!!b,"aria-errormessage":"error-message",minRows:o,autoFocus:!!n.isEditing}),a.jsx("small",{children:Te(d.formatMessage,`${ye}explainer`,t.type,"action",{a:T=>a.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:T})})}),a.jsx(at,{buttons:U}),y==="submitted"&&n.showSuccessMessage&&a.jsx(yt,{className:"success","data-testid":"success",children:Te(d.formatMessage,`${ye}success`,t.type,"action")}),b&&a.jsx(yt,{id:"error-message",className:"error","data-testid":"error",children:c.error?c.error:typeof b=="string"?b.includes(" ")?b:d.formatMessage({id:b},{action:d.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):b})]})},mr=({form:t,membershipRequiredToPost:{isMember:e,required:n,join:r,leave:s,notMemberStateText:i}})=>{if(n&&!e)return a.jsx(Ae,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:a.jsx(lr,{isShort:!0,functions:{join:r,leave:s}})}});const{content:o,functions:c,meta:u,...l}=t;return a.jsx(on,{content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...c,create:(c==null?void 0:c.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,showSuccessMessage:!1},...l})},Xc={showForm:!1},cn=g.createContext(Xc),bs=({children:t})=>{const[e,n]=g.useState({showForm:!1});return a.jsx(cn.Provider,{value:{...e,updateConversation:n},children:t})},el=({question:t,answer:e,reply:n})=>({...t&&{questionSlug:t},...e&&{answerSlug:e},...n&&{replySlug:n}}),tl=(t,e=10)=>!t||t.length===0?[]:t.slice(0,e);const Yn=({icon:t,...e})=>a.jsx(ae,{className:"discussion-button",variant:"tertiary",icon:t,...e});let bt=!1;const On=()=>{bt!==!1&&(clearTimeout(bt),bt=!1)},An=5,ys=({element:t="div",likes:e=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:s=!1,content:i={type:"reply",slugs:{}},canLike:o=!0,functions:{createLike:c=()=>{},deleteLike:u=()=>{}}={}})=>{const l=I.useIntl();g.useEffect(()=>{p(s)},[s]);const[d,m]=g.useState(e),[f,p]=g.useState(s),[b,h]=g.useState(!1),[y,x]=g.useState(!1),k=g.useMemo(()=>tl(n,An),[n]),C=w=>{if(w.preventDefault(),w.stopPropagation(),x(!1),bt)return On(),!1;if(On(),b||!o)return!1;bt=setTimeout(_,350)},_=async()=>{if(On(),b||!o)return!1;let w=f?d-1:d+1;w<0&&(w=0),h(!0),m(w),p(!f);try{if(i&&i.slugs){const D=el(i.slugs);f?await u(D):await c({...D,payload:{contentPath:window.location.pathname}})}}catch{m(e),p(s)}finally{h(!1)}};return a.jsxs("div",{className:"likes-wrapper",onMouseEnter:()=>{x(!0)},onMouseLeave:()=>{x(!1)},onFocus:()=>{x(!0)},onBlur:()=>{x(!1)},children:[a.jsx(Yn,{className:S("discussion-button text-medium action-button",{"show-spinner":b,"is-liked":f,disabled:!o}),icon:{icon:f?"heart":"heart_empty",animate:"bounce"},disabled:!o,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:C,screenreaderText:o?l.formatMessage({id:`discussion_likes_${f?"unlike":"like"}`},{action:l.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":f,children:a.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:l.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:d})})}),n&&a.jsx(cs,{isOpen:y,isLoading:n.length===0,children:n.length&&a.jsxs("ul",{children:[k.map(w=>typeof w=="string"||!w.name?null:a.jsx("li",{children:a.jsx(We,{href:w.id?`/profiles/${w.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:D=>D==null?void 0:D.stopPropagation(),children:w.name})},w.id||window.btoa(w.name))),e>An&&a.jsx("li",{children:l.formatMessage({id:"discussion_likes_more"},{number:e-An})})]})})]})},aa=t=>{const e={};return Object.keys(t).forEach(n=>n.includes("Id")?e[n]=t[n]:e[`${n}Slug`]=t[n]),e},ln=(t,e)=>t&&!e;const Ne="discussion_",nl=280,Tt=({element:t="div",content:e,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:s,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:o,deleteContent:c,updateContent:u}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:l,deleteLike:d}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}}},links:f={},className:p,gtmContext:b="DiscussionAnswer",children:h,isTruncated:y=!1})=>{const x=I.useIntl(),k=g.useContext(Se),C=g.useContext(cn),{author:_,canLike:w,createdAt:D,id:F,likes:G=0,userLiked:U,comments:N=0}=e,$=k&&k.id&&typeof _!="string"&&_.id&&_.id===k.id||!1,j=typeof w=="boolean"?w:n?!$:!1,T=$&&(!e.createdAt||ui(e.createdAt,10,"seconds")),P=g.useRef(null),[O,z]=g.useState({body:e&&e.body||"",isEditing:!1,didEdit:e&&e.isEdited||!1}),[V,H]=g.useState(!1),[Y,E]=g.useState(T?"highlighted":"default"),[M,B]=g.useState("");g.useEffect(()=>{const L=P.current;if(!(!L||Y==="default"))return document.addEventListener("discussionFormSubmitted",W),L.addEventListener("transitionend",Z),()=>{document.removeEventListener("discussionFormSubmitted",W),L.removeEventListener("transitionend",Z)}},[]),g.useEffect(()=>{z({...O,body:e&&e.body||"",didEdit:e&&e.isEdited||!1})},[e.isEdited]);const W=()=>{setTimeout(()=>{E("fading")},1e3)},Z=({propertyName:L})=>{L==="background-color"&&E(ee=>(ee==="default"&&(document.removeEventListener("discussionFormSubmitted",W),P.current&&P.current.removeEventListener("transitionend",Z)),ee==="fading"?"default":ee))};if(r||!e||e.type==="answer"&&(!e.slugs||!e.slugs.question))return a.jsx(ke,{className:"discussion-card discussion-post"});const X=y?Qe(O.body,nl):O.body,K=async L=>{L||(L=""),B("");try{if(!ti(L,O.body)){const ee=e.type==="question"?{title:L}:{body:L};await u(aa(e.slugs),ee)}z({body:L,isEditing:!1,didEdit:!0})}catch{B(`${Ne}form_error`)}},Q=()=>{C&&C.updateConversation&&C.updateConversation({showForm:!0}),setTimeout(()=>{var _e,je,Le;const ee=`reply-form-${(e.type==="answer"?e.slug:((_e=e.slugs)==null?void 0:_e.reply)||((je=e.slugs)==null?void 0:je.answer)||((Le=e.slugs)==null?void 0:Le.question)||"").toLowerCase().slice(-15)}`,A=document.getElementById(ee),fe=document.getElementById(`${ee}-input`);fe&&fe.focus(),A&&A.scrollIntoView({behavior:"smooth"})},0)},ne=async()=>{H(!1);try{await c(aa(e.slugs))}catch{B("delete-error")}},re=[{text:x.formatMessage({id:`${Ne}moreMenu_report`}),onClick:L=>{L.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(x.formatMessage({id:`${Ne}report_subject`}))}&body=${encodeURI(x.formatMessage({id:`${Ne}report_body`},{contentType:e.type||"",contentSlug:e.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${e.slugs.question||""}`}))}`,icon:"flag"}];return n&&$&&re.push({text:x.formatMessage({id:`${Ne}moreMenu_edit`}),onClick:()=>z({...O,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`edit-${e.type}-click`},{text:x.formatMessage({id:`${Ne}moreMenu_delete`}),onClick:L=>{L.preventDefault(),L.stopPropagation(),H(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":b,"data-gtm-event-type":`delete-${e.type}-click`,...os(`delete-${e.slug}-modal`,V)}),g.createElement(t,{className:S("discussion-post",p,{[Y]:!p||!p.includes("highlighted-text-box"),"has-link":f.post&&!O.isEditing}),ref:P,"data-testid":`discussion-${e.type}-thread`,"data-gtm-event-context":`${b}-post-click`,onClick:L=>{!f.post||O.isEditing||(L.preventDefault(),L.stopPropagation(),window.location.href=f.post)},children:a.jsxs(a.Fragment,{children:[a.jsxs("div",{id:F||e.slug,className:S("discussion-card",e.type,{editing:O.isEditing,"has-link":f.post&&!O.isEditing}),children:[!O.isEditing&&a.jsx(xt,{member:_,additionalContent:{createdAt:D,didEdit:O.didEdit},className:typeof _!="string"&&_.id===s?"highlighted":"",gtmContext:b,gtmType:"profile-click"}),O.isEditing?a.jsx(on,{content:{type:e.type,slugs:e.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:O.body}},maxLength:e.type==="question"?250:5e4,forceShow:{error:M!==""&&M!=="delete-error"?x.formatMessage({id:M},{action:x.formatMessage({id:`discussion_action_${e.type}`})}):!1},functions:{create:o,handleSaveEdit:K,handleCancel:()=>{B(""),z({...O,isEditing:!1})}},gtmContext:`${b}Form`}):f.post?a.jsxs("a",{href:f.post,children:[(e==null?void 0:e.title)&&a.jsx("p",{className:"content-title",children:e.title}),e!=null&&e.body&&(e==null?void 0:e.body.length)>195?a.jsx($a,{text:e==null?void 0:e.body,markdownOptions:{overrides:{a:Wn}}}):a.jsx(Xe,{options:{overrides:{a:Wn}},children:X})]}):a.jsx(Xe,{options:{wrapper:e.type==="question"?"h1":g.Fragment,forceWrapper:e.type==="question",forceInline:e.type==="question",forceBlock:e.type!=="question"},children:X}),!O.isEditing&&!(i!=null&&i.actionBar)&&a.jsxs("ul",{className:S("actions text-medium",e.type),"data-testid":`${e.type}-actions`,children:[!i.likes&&a.jsx(ys,{element:"li",likes:G,isShort:!1,userLiked:U,content:{type:e.type,slugs:e.slugs},canLike:j,peopleWhoLiked:e.peopleWhoLiked,functions:{createLike:l,deleteLike:d}}),!i.comments&&(["question","post"].includes(e.type)||f.comments||typeof m=="function")&&a.jsx(Yn,{onClick:L=>{L.preventDefault(),L.stopPropagation(),f.comments&&(window.location.href=f.comments),typeof m=="function"&&m()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":b,"data-gtm-event-type":`answer-${e.type}-click`,screenreaderText:x.formatMessage({id:`${Ne}comments_screenReader`},{count:N}),children:x.formatMessage({id:`${Ne}comments`},{count:N})}),(e.type==="answer"||e.type==="reply")&&a.jsx("li",{children:a.jsx(Yn,{styling:{muted:!0},onClick:Q,icon:{icon:"speech-bubble_square_thick"},children:x.formatMessage({id:`${Ne}reply`})})}),a.jsx(ds,{element:"li",id:`more-${e.slug}`,options:re})]})]}),h,a.jsx(kt,{id:`delete-${e.slug}-modal`,isOpen:V,functions:{onOpen:()=>{},onClose:()=>H(!1)},forceShow:{error:M==="delete-error"?x.formatMessage({id:"discussion_delete_error"},{action:x.formatMessage({id:`discussion_action_${e.type}`})}):!1},title:x.formatMessage({id:"discussion_delete_title"},{action:x.formatMessage({id:`discussion_action_${e.type}`})}),buttons:[{variant:"secondary",onClick:()=>H(!1),children:x.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ne,children:x.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}:${e.slug}`,children:a.jsx(I.FormattedMessage,{id:"discussion_delete_text",values:{p:L=>a.jsx("p",{children:L}),action:x.formatMessage({id:`discussion_action_${e.type}`})}})})]})})};const Dn="discussion_responses_",_s=({type:t="answer",responses:e=0})=>{const n=I.useIntl();return e=parseInt(e),a.jsxs("div",{className:"responses-heading",children:[a.jsx("h4",{children:n.formatMessage({id:`${Dn}title`},{action:n.formatMessage({id:`${Dn}${t}`}),count:e})}),e===0&&a.jsx("p",{children:Te(n.formatMessage,`${Dn}empty`,t,t)})]})};const xs=({loadMore:{isLoading:t,hasNextPage:e,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:s})=>{const i=I.useIntl(),o=g.useContext(cn),c=Lt(s,{element:"li"});return a.jsxs("div",{className:S("thread-wrapper",{"empty-thread":!c}),children:[!Object.is(c,null)&&a.jsx("ul",{className:"thread",children:c}),!t&&a.jsx(jt,{hasNextPage:e,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&o.showForm&&a.jsx(on,{...r})]})},rl="post",al="reply",ws="00000000-0000-0000-0000-000000000000";function pr({queryClient:t,queryKey:e}){function n(r,s,i){t.setQueryData(e,i)}return n}function hr({queryClient:t,queryKey:e}){async function n(r){await t.cancelQueries({queryKey:e});const s=t.getQueryData(e);return t.setQueryData(e,r),s}return n}function sl(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function il(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function ks(t){const{id:e="",name:n="",organization:r="",jobTitle:s="",image:i={}}=t,{thumbnail:o=""}=i;return{id:e,data:{name:n,organization:r,jobTitle:s,thumbnail:o}}}function ol({content:t}){return{content:t,id:ws,time:new Date().toISOString(),verb:rl}}function sa({activity:t,user:e}){return{...t,actor:ks(e),...sl()}}function Jt({activity:t,reaction:e}){var n,r,s;e?(t.latest_reactions={...t.latest_reactions||{},like:[...((r=t.latest_reactions)==null?void 0:r.like)||[],e]},t.own_reactions={...t.own_reactions||{},like:[...((s=t.own_reactions)==null?void 0:s.like)||[],e]}):t.reaction_counts={...t.reaction_counts||{},like:(n=t.reaction_counts)!=null&&n.like?t.reaction_counts.like+1:1}}function js({activity:t,user:e}){var n,r,s;t.reaction_counts={...t.reaction_counts||{},like:(n=t.reaction_counts)!=null&&n.like?t.reaction_counts.like-1:0},e!=null&&e.id&&(t.latest_reactions={...t.latest_reactions||{},like:(((r=t.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==e.id)},t.own_reactions={...t.own_reactions||{},like:(((s=t.own_reactions)==null?void 0:s.like)||[]).filter(({user_id:i})=>i!==e.id)})}function cl({activityId:t,replyId:e,content:n}){return{activity_id:t,data:{content:n},id:ws,kind:al,parent:e||""}}function ia({reply:t,user:e}){const n=ks(e);return{...t,user_id:n.id,user:n,...il()}}function oa({reply:t,reaction:e}){var n,r,s;e?(t.latest_children={...t.latest_children||{},like:[...((r=t.latest_children)==null?void 0:r.like)||[],e]},t.own_children={...t.own_children||{},like:[...((s=t.own_children)==null?void 0:s.like)||[],e]}):t.children_counts={...t.children_counts||{},like:(n=t.children_counts)!=null&&n.like?t.children_counts.like+1:1}}function ll({reply:t,user:e}){var n,r,s;t.children_counts={...t.children_counts||{},like:(n=t.children_counts)!=null&&n.like?t.children_counts.like-1:0},e!=null&&e.id&&(t.latest_children={...t.latest_children||{},like:(((r=t.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==e.id)},t.own_children={...t.own_children||{},like:(((s=t.own_children)==null?void 0:s.like)||[]).filter(({user_id:i})=>i!==e.id)})}const Ts=t=>{const e=new CustomEvent("discussionPostAdded",{detail:t});document.dispatchEvent(e)};let ca,In=0;const Es=()=>{g.useEffect(()=>(document.addEventListener("discussionPostAdded",t),()=>{document.removeEventListener("discussionPostAdded",t)}),[]);const t=e=>{const n=e.detail;if(!n)return;clearTimeout(ca);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),In=0;return}In++,!(In>10)&&(ca=setTimeout(()=>{t(e)},50))}},tt=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),Oe=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Ss=Object.freeze({actor:`SU:${tt.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),ul=Object.freeze({actor:`SU:${Oe.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),dl=Object.freeze({actor:`SU:${tt.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),fl=Object.freeze({actor:`SU:${Oe.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Ss.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Oe.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Oe.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:Oe.id,user:{id:Oe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ss.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:tt.id,user:{id:tt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ul.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Oe.id,user:{id:Oe.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:dl.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:tt.id,user:{id:tt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:fl.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function ml({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:s,user:i}){const{mutate:o}=pe.useMutation({mutationFn:t,onMutate:c=>e(u=>{const l=sa({activity:ol(c),user:i});return la(l,u)}),onError:n,onSuccess:(c,u,l)=>{const d=sa({activity:c,user:i});r.setQueryData(s,la(d,l,!0)),setTimeout(()=>{Ts(d.id)},0)}});return o}function pl({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=pe.useMutation({mutationFn:t,onMutate:({activityId:s,content:i})=>e(o=>{const c=Xt(s,o);return c&&(c.content=i),o}),onError:n});return r}function hl({queryFns:{create:t,edit:e,like:n,list:r,remove:s,unlike:i},queryKey:o}){const c=pe.useQueryClient(),u=an(),l={queryClient:c,queryKey:o},d={mutationHandlers:{error:pr(l),mutate:hr(l)},user:u,...l},m=ml({...d,mutationFn:t}),f=pl({...d,mutationFn:e}),p=gl({...d,mutationFn:n}),b=bl({...d,mutationFn:s}),h=yl({...d,mutationFn:i}),{activities:y,...x}=vl({queryKey:o,queryFn:r});return{activities:y,mutations:{create:m,edit:f,remove:b,like:p,unlike:h},user:u,...x}}function gl({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:s}){const{mutate:i}=pe.useMutation({mutationFn:t,onMutate:({activityId:o})=>e(c=>{const u=Xt(o,c);return u&&Jt({activity:u}),c}),onError:n,onSuccess:(o,{activityId:c},u)=>{const l=Xt(c,u);l&&Jt({activity:l,reaction:o}),r.setQueryData(s,u)}});return i}function vl({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}=pe.useInfiniteQuery({queryKey:e,queryFn:t,initialPageParam:{next:null},getNextPageParam:c=>(c==null?void 0:c.next)||null});return{activities:xl(n),error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}}function bl({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=pe.useMutation({mutationFn:t,onMutate:({activityId:s})=>e(i=>_l(s,i)),onError:n});return r}function yl({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:s}=pe.useMutation({mutationFn:t,onMutate:({activityId:i})=>e(o=>{const c=Xt(i,o);return c&&js({activity:c,user:r}),o}),onError:n});return s}function la(t,e,n=!1){return e?(n?e.pages[0].results[0]=t:e.pages[0].results=[t,...e.pages[0].results],e):{pages:[{next:"",results:[t]}],pageParams:[""]}}function Xt(t,e){if(e)for(const{results:n}of e.pages){const r=n.find(({id:s})=>s===t);if(r)return r}}function _l(t,e){for(const{results:n}of e.pages){const r=n.findIndex(({id:s})=>s===t);if(r!==-1){n.splice(r,1);break}}return e}function xl(t){var e;return((e=t==null?void 0:t.pages)==null?void 0:e.reduce((n,{results:r})=>[...n,...r],[]))||[]}const wl=({basePath:t,parentId:e,isMember:n,functions:{activities:r,join:s,leave:i}})=>{const o=I.useIntl(),{activities:c,error:u,fetchNextPage:l,hasNextPage:d,isLoading:m,mutations:{create:f,edit:p,remove:b,like:h,unlike:y},user:x}=hl({queryKey:[t,e,"activities"],queryFns:r});return Es(),u?a.jsx(Ae,{variant:"error",text:u.message}):a.jsxs("section",{children:[a.jsx(mr,{form:{content:{type:"post",slugs:{}},functions:{create:f},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:i,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),c==null?void 0:c.map((k,C)=>{var P,O,z,V,H,Y,E,M;const{id:_,own_reactions:w,latest_reactions:D,reaction_counts:F}=k,G=(((P=D==null?void 0:D.like)==null?void 0:P.length)||0)>0,U=(((O=w==null?void 0:w.like)==null?void 0:O.length)||0)>0,N=U?w==null?void 0:w.like[0].id:"",$=G?(z=D==null?void 0:D.like)==null?void 0:z.map(B=>{var W,Z,X;return{id:(W=B==null?void 0:B.user)==null?void 0:W.id,name:(X=(Z=B==null?void 0:B.user)==null?void 0:Z.data)==null?void 0:X.name}}):!1,j=k==null?void 0:k.actor,T=(j==null?void 0:j.id)===(x==null?void 0:x.id);return a.jsx(g.Fragment,{children:a.jsx(Tt,{content:{type:"post",title:k==null?void 0:k.title,body:k==null?void 0:k.content,canLike:ln(n,T),createdAt:(k==null?void 0:k.time)||"",slugs:{question:`${t}/${e}`,answer:_},slug:_,author:{id:j==null?void 0:j.id,name:(V=j==null?void 0:j.data)==null?void 0:V.name,organization:(H=j==null?void 0:j.data)==null?void 0:H.organization,jobTitle:(Y=j==null?void 0:j.data)==null?void 0:Y.jobTitle,location:(E=j==null?void 0:j.data)==null?void 0:E.location,image:{thumbnail:((M=j==null?void 0:j.data)==null?void 0:M.thumbnail)||void 0}},userLiked:U,likes:(F==null?void 0:F.like)||0,comments:(F==null?void 0:F.reply)||0,peopleWhoLiked:$},links:{post:`${t}/${e}/${_}`,comments:`${t}/${e}/${_}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>b({activityId:_}),updateContent:(B,{body:W})=>p({activityId:_,content:W})},likes:{createLike:()=>h({activityId:_}),deleteLike:()=>y({activityId:_,reactionId:N})},comments:{openComments:()=>null}},isTruncated:!0})},_)}),!m&&a.jsx(jt,{hasNextPage:d,loadNextPage:()=>l(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},kl={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function jl({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:s,user:i}){const{mutate:o}=pe.useMutation({mutationFn:t,onMutate:c=>e(u=>{const l=ia({reply:cl(c),user:i});return ua(l,u,{replace:!1,append:(c==null?void 0:c.replyId)!==void 0})}),onError:n,onSuccess:(c,u,l)=>{const d=ia({reply:c,user:i});r.setQueryData(s,ua(d,l,{replace:!0,append:(u==null?void 0:u.replyId)!==void 0})),setTimeout(()=>{Ts(d.id)},0)}});return o}function Tl({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=pe.useMutation({mutationFn:t,onMutate:({replyId:s,content:i})=>e(o=>{const c=en(s,o);return c&&(c.data.content=i),o}),onError:n});return r}function Cs({queryFns:{create:t,edit:e,like:n,list:r,remove:s,unlike:i},queryKey:o}){const c=pe.useQueryClient(),u=an(),l={queryClient:c,queryKey:o},d={mutationHandlers:{error:pr(l),mutate:hr(l)},user:u,...l},m=jl({...d,mutationFn:t}),f=Tl({...d,mutationFn:e}),p=El({...d,mutationFn:n}),b=Cl({...d,mutationFn:s}),h=Nl({...d,mutationFn:i}),{replies:y,...x}=Sl({queryKey:o,queryFn:r});return{replies:y,mutations:{create:m,edit:f,remove:b,like:p,unlike:h},user:u,...x}}function El({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:s}){const{mutate:i}=pe.useMutation({mutationFn:t,onMutate:({replyId:o})=>e(c=>{const u=en(o,c);return u&&oa({reply:u}),c}),onError:n,onSuccess:(o,{replyId:c},u)=>{const l=en(c,u);l&&oa({reply:l,reaction:o}),r.setQueryData(s,u)}});return i}function Sl({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}=pe.useInfiniteQuery({queryKey:e,queryFn:t,initialPageParam:{next:""},getNextPageParam:l=>(l==null?void 0:l.next)||null}),c=Fl(n),u=`${c.length||0}${i?"+":""}`;return{replies:c,repliesCount:u,error:r,isLoading:s,hasNextPage:i,fetchNextPage:o}}function Cl({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=pe.useMutation({mutationFn:t,onMutate:({replyId:s})=>e(i=>Rl(s,i)),onError:n});return r}function Nl({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:s}=pe.useMutation({mutationFn:t,onMutate:({replyId:i})=>e(o=>{const c=en(i,o);return c&&ll({reply:c,user:r}),o}),onError:n});return s}function Pl(t){return{pages:[{next:"",results:[t]}],pageParams:[""]}}function $l(t,e,n){const r=e.pages.length-1,s=e.pages[r].results.length-1;return n!=null&&n.replace?e.pages[r].results[s]=t:e.pages[r].results.push(t),e}function Ml(t,e,n){return n!=null&&n.replace?e.pages[0].results[0]=t:e.pages[0].results=[t,...e.pages[0].results],e}function ua(t,e,n){return e?n!=null&&n.append?$l(t,e,n):Ml(t,e,n):Pl(t)}function en(t,e){if(e)for(const{results:n}of e.pages){const r=n.find(({id:s})=>s===t);if(r)return r}}function Rl(t,e){for(const{results:n}of e.pages){const r=n.findIndex(({id:s})=>s===t);if(r!==-1){n.splice(r,1);break}}return e}function Fl(t){var e;return((e=t==null?void 0:t.pages)==null?void 0:e.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const Ol=({basePath:t,parentId:e,activityId:n,replyId:r,isMember:s,functions:i})=>{const o=I.useIntl(),c=3,{replies:u,fetchNextPage:l,hasNextPage:d,isLoading:m,mutations:{create:f,edit:p,like:b,remove:h,unlike:y},user:x}=Cs({queryKey:[t,e,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Gn([m]);const[k,C]=g.useState(!0);return a.jsxs(a.Fragment,{children:[(u==null?void 0:u.length)>=c&&a.jsx(ae,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${k?"up_left":"down_right"}`,position:"left"},onClick:()=>C(!k),children:o.formatMessage({id:`discussion_thread_${k?"hide":"show"}`},{count:u==null?void 0:u.length})}),k&&a.jsx(xs,{loadMore:{isLoading:m,hasNextPage:d,loadNextPage:()=>l()},form:{content:{type:"reply",slugs:{question:`${t}/${e}`,answer:n,reply:r}},functions:{create:(_,{body:w})=>f({activityId:n,replyId:r,content:w})},meta:{isEditing:!1,showSuccessMessage:!1}},children:u&&u.length>0?u==null?void 0:u.map(_=>{var Y,E,M,B,W,Z,X,K,Q,ne,re,L;const{id:w,own_children:D,latest_children:F,children_counts:G}=_,N=(((Y=D==null?void 0:D.like)==null?void 0:Y.length)||0)>0?(E=D==null?void 0:D.like)==null?void 0:E.find(ee=>{var A;return((A=ee==null?void 0:ee.user)==null?void 0:A.id)===(x==null?void 0:x.id)}):!1,$=N?N==null?void 0:N.id:"",j=!!N,P=(((M=F==null?void 0:F.like)==null?void 0:M.length)||0)>0?(B=F==null?void 0:F.like)==null?void 0:B.map(ee=>{var A,fe,_e;return{id:(A=ee==null?void 0:ee.user)==null?void 0:A.id,name:(_e=(fe=ee==null?void 0:ee.user)==null?void 0:fe.data)==null?void 0:_e.name}}):!1,O=_==null?void 0:_.user,z=(O==null?void 0:O.id)===(x==null?void 0:x.id),V=ln(s,z),H=typeof _.data.content=="string"?(W=_==null?void 0:_.data)==null?void 0:W.content:((X=(Z=_==null?void 0:_.data)==null?void 0:Z.content)==null?void 0:X.text)||"";return a.jsx(Tt,{content:{id:w,type:"reply",body:H,canLike:V,createdAt:_==null?void 0:_.created_at,slugs:{question:`${t}/${e}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:{id:O==null?void 0:O.id,name:(K=O.data)==null?void 0:K.name,organization:(Q=O.data)==null?void 0:Q.organization,jobTitle:(ne=O.data)==null?void 0:ne.jobTitle,location:(re=O.data)==null?void 0:re.location,image:{thumbnail:((L=O.data)==null?void 0:L.thumbnail)||void 0}},userLiked:j,likes:(G==null?void 0:G.like)||0,peopleWhoLiked:P},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:w}),updateContent:(ee,{body:A})=>p({replyId:w,content:A})},likes:{createLike:()=>b({replyId:w}),deleteLike:()=>y({replyId:w,reactionId:$})},comments:{}}},w)}):null})]})};const Ns=({basePath:t,parentId:e,activityId:n,isMember:r,functions:{reactions:s,join:i,leave:o}})=>{const c=I.useIntl(),{replies:u,repliesCount:l,fetchNextPage:d,hasNextPage:m,isLoading:f,mutations:{create:p,edit:b,like:h,remove:y,unlike:x},user:k}=Cs({queryKey:[t,e,n,"replies"],queryFns:s});return Gn([f]),Es(),a.jsxs("section",{className:"replies-feed",children:[a.jsx(_s,{type:"comment",responses:l}),a.jsx(mr,{form:{content:{type:"reply",slugs:{}},functions:{create:(C,{body:_})=>p({activityId:n,content:_})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:c.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:o,notMemberStateText:c.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map(C=>{var H,Y,E,M,B,W,Z,X,K,Q,ne,re;const{id:_,own_children:w,latest_children:D,children_counts:F}=C,U=(((H=w==null?void 0:w.like)==null?void 0:H.length)||0)>0?(Y=w==null?void 0:w.like)==null?void 0:Y.find(L=>{var ee;return((ee=L==null?void 0:L.user)==null?void 0:ee.id)===(k==null?void 0:k.id)}):!1,N=U?U==null?void 0:U.id:"",$=!!U,T=(((E=D==null?void 0:D.like)==null?void 0:E.length)||0)>0?(M=D==null?void 0:D.like)==null?void 0:M.map(L=>{var ee,A,fe;return{id:(ee=L==null?void 0:L.user)==null?void 0:ee.id,name:(fe=(A=L==null?void 0:L.user)==null?void 0:A.data)==null?void 0:fe.name}}):!1,P=C==null?void 0:C.user,O=(P==null?void 0:P.id)===(k==null?void 0:k.id),z=ln(r,O),V=typeof C.data.content=="string"?(B=C==null?void 0:C.data)==null?void 0:B.content:((Z=(W=C==null?void 0:C.data)==null?void 0:W.content)==null?void 0:Z.text)||"";return a.jsx(bs,{children:a.jsx(Tt,{content:{id:_,type:"reply",body:V,canLike:z,createdAt:C==null?void 0:C.created_at,slugs:{question:`${t}/${e}`,answer:n,reply:_},slug:_,author:{id:P==null?void 0:P.id,name:(X=P.data)==null?void 0:X.name,organization:(K=P.data)==null?void 0:K.organization,jobTitle:(Q=P.data)==null?void 0:Q.jobTitle,location:(ne=P.data)==null?void 0:ne.location,image:{thumbnail:((re=P.data)==null?void 0:re.thumbnail)||void 0}},userLiked:$,likes:(F==null?void 0:F.like)||0,peopleWhoLiked:T},functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:_}),updateContent:(L,{body:ee})=>b({replyId:_,content:ee})},likes:{createLike:()=>h({replyId:_}),deleteLike:()=>x({replyId:_,reactionId:N})},comments:{}},children:a.jsx(Ol,{basePath:t,parentId:e,activityId:n,replyId:_,isMember:r,functions:{...s}})},_)},_)}),!f&&a.jsx(jt,{hasNextPage:m,loadNextPage:()=>d(),icon:{icon:"arrow-down",position:"right"},messages:{button:c.formatMessage({id:"loadMore_button"}),error:c.formatMessage({id:"loadMore_error"})}})]})};function Al({mutationFn:t,mutationHandlers:{mutate:e,error:n}}){const{mutate:r}=pe.useMutation({mutationFn:t,onMutate:({content:s})=>e(i=>(i&&(i.content=s),i)),onError:n});return r}function Dl({queryFn:t,queryKey:e}){const{data:n,error:r,isLoading:s,isFetching:i}=pe.useQuery({queryFn:t,queryKey:e});return{activity:n,error:r,isLoading:s,isFetching:i}}function Il({queryFns:{read:t,edit:e,like:n,unlike:r},queryKey:s}){const i=pe.useQueryClient(),o=an(),c={queryClient:i,queryKey:s},u={mutationHandlers:{error:pr(c),mutate:hr(c)},user:o,...c},l=Al({...u,mutationFn:e}),d=Ll({...u,mutationFn:n}),m=Bl({...u,mutationFn:r}),{activity:f,...p}=Dl({queryKey:s,queryFn:t});return{activity:f,mutations:{edit:l,like:d,unlike:m},user:o,...p}}function Ll({mutationFn:t,mutationHandlers:{mutate:e,error:n},queryClient:r,queryKey:s}){const{mutate:i}=pe.useMutation({mutationFn:t,onMutate:o=>e(c=>(c&&Jt({activity:c}),c)),onError:n,onSuccess:(o,c,u)=>{u&&Jt({activity:u,reaction:o}),r.setQueryData(s,u)}});return i}function Bl({mutationFn:t,mutationHandlers:{mutate:e,error:n},user:r}){const{mutate:s}=pe.useMutation({mutationFn:t,onMutate:i=>e(o=>(o&&js({activity:o,user:r}),o)),onError:n});return s}const ql=({basePath:t,parentId:e,activityId:n,isMember:r,functions:{activities:{remove:s,...i},reactions:o,join:c,leave:u}})=>{var U,N,$,j,T,P,O,z,V,H;const l=I.useIntl(),d=g.useContext(Se),{activity:m,error:f,isLoading:p,mutations:{edit:b,like:h,unlike:y}}=Il({queryFns:i,queryKey:[t,e,n]});if(p)return a.jsx(ke,{style:{height:"400px"}});if(f||!m)return a.jsx(Ae,{variant:"error",text:l.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:x,latest_reactions:k}=m,C=(((U=k==null?void 0:k.like)==null?void 0:U.length)||0)>0,_=(((N=x==null?void 0:x.like)==null?void 0:N.length)||0)>0,w=_?x==null?void 0:x.like[0].id:"",D=C?($=k==null?void 0:k.like)==null?void 0:$.map(Y=>{var E,M,B;return{id:(E=Y==null?void 0:Y.user)==null?void 0:E.id,name:(B=(M=Y==null?void 0:Y.user)==null?void 0:M.data)==null?void 0:B.name}}):!1,F=m==null?void 0:m.actor,G=(F==null?void 0:F.id)===(d==null?void 0:d.id);return a.jsxs("section",{className:"activity-section",children:[a.jsx(Tt,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:m==null?void 0:m.content,canLike:ln(r,G),createdAt:(m==null?void 0:m.time)||"",slugs:{question:`${t}/${e}`,answer:m==null?void 0:m.id},slug:n,author:{id:F.id,name:(j=F.data)==null?void 0:j.name,organization:(T=F.data)==null?void 0:T.organization,jobTitle:(P=F.data)==null?void 0:P.jobTitle,location:(O=F.data)==null?void 0:O.location,image:{thumbnail:((z=F.data)==null?void 0:z.thumbnail)||void 0}},userLiked:_,likes:((V=m==null?void 0:m.reaction_counts)==null?void 0:V.like)||0,comments:((H=m==null?void 0:m.reaction_counts)==null?void 0:H.reply)||0,peopleWhoLiked:D},originalAuthorId:F==null?void 0:F.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:s,updateContent:(Y,{body:E})=>b({content:E})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:w})},comments:{openComments:()=>{}}}},n),a.jsx(Ns,{basePath:t,parentId:e,activityId:n,isMember:r,functions:{reactions:o,join:c,leave:u}})]})},Ul=({id:t,data:{jobTitle:e,name:n,organization:r,thumbnail:s}})=>({id:t,name:n,jobTitle:e,organization:r,image:{thumbnail:s}}),da=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const Dt="notFoundError_",Wl=()=>{const t=I.useIntl(),e=[];return da.forEach((n,r)=>{n.title=t.formatMessage({id:`${Dt}post_${r+1}`}),e.push("solutionArticle")}),a.jsxs(hs,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:a.jsxs(Ie,{children:[a.jsx(us,{cards:da,cardTypes:e,buildCardData:n=>new Promise((r,s)=>{r(n)})}),a.jsx(ae,{href:"/solution-articles/",children:t.formatMessage({id:`${Dt}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[a.jsx("h1",{children:t.formatMessage({id:`${Dt}title`})}),a.jsx("p",{children:t.formatMessage({id:`${Dt}text`})})]})};exports.ASSETS_BUCKET=$e;exports.ActivitiesFeed=wl;exports.ActivitySection=ql;exports.AddPost=mr;exports.Banner=fc;exports.BannerSection=yc;exports.Breadcrumbs=Mc;exports.Buckets=ki;exports.Button=ae;exports.ButtonWrapper=at;exports.COURSE_CONTENT_TYPES=mt;exports.CacheProvider=ts;exports.Card=cr;exports.CardBlock=us;exports.Carousel=Pc;exports.CollapsibleSection=rn;exports.Columns=ms;exports.CommunityDetails=$c;exports.ContactFooter=Wc;exports.ContactForm=qa;exports.ContentTypeLabel=Ca;exports.Contributors=nr;exports.ConversationContext=cn;exports.CookieBanner=ps;exports.CourseProgression=Gc;exports.CourseStructure=Qc;exports.CustomContentBanner=_c;exports.Directory=cc;exports.DiscussionConversation=bs;exports.DiscussionForm=on;exports.DiscussionLikes=ys;exports.DiscussionPost=Tt;exports.DiscussionThread=xs;exports.Divider=Fe;exports.DownloadSection=mc;exports.EMAILS=Ye;exports.EditSection=hc;exports.EmailHelperTextBox=Oa;exports.EmptyStateBox=Ae;exports.Filters=Rc;exports.FlagsProvider=ns;exports.Footer=dr;exports.Form=wt;exports.FullWidthSection=Ie;exports.GlobalProviders=ic;exports.Header=fr;exports.HelperTextBox=Pa;exports.HiddenFromScreenReaders=tn;exports.HideShowTextBox=$a;exports.HighlightSection=wc;exports.HighlightedTextBox=Ee;exports.INVALID_TOKEN=ja;exports.IconBulletedList=Ei;exports.ImageContainer=_i;exports.IntlProvider=rs;exports.InviteForm=Ua;exports.InviteModal=oc;exports.JoinButton=lr;exports.LanguageContext=sr;exports.LanguageSwitcher=Oc;exports.LessonName=gs;exports.LessonType=vs;exports.Link=We;exports.LoadMore=jt;exports.LoadingBlock=Di;exports.LoadingPlaceholder=ke;exports.LoadingState=er;exports.Logo=ur;exports.LogoSection=gc;exports.MarkCompleteButton=Jc;exports.MarkdownText=Xe;exports.MarketingBlock=kc;exports.Member=xt;exports.MembersList=Kc;exports.Modal=or;exports.MoreMenu=ds;exports.NUMBER_OF_COUNTRIES=li;exports.NUMBER_OF_USERS=ci;exports.NavigationMenu=fs;exports.NotFoundError=Wl;exports.Overlay=kt;exports.OverlayContext=ir;exports.OverlayProvider=is;exports.PageHeading=Ma;exports.PageLayout=hs;exports.PasswordForm=Xi;exports.PasswordRules=Ba;exports.Pill=Ge;exports.ProfileImageChange=Ji;exports.ProfilePicture=De;exports.ProgressBar=Xn;exports.ProgressTracker=xi;exports.Rating=Gi;exports.RepliesFeed=Ns;exports.ResponsesHeading=_s;exports.ResponsiveImage=st;exports.ReturnToNavButton=wi;exports.SearchForm=Wa;exports.ShareLinks=Bc;exports.SignupForm=so;exports.Span=Wn;exports.StatusBanner=yt;exports.TableOfContents=dc;exports.Tabs=qc;exports.Tags=Yc;exports.TestimonialBlock=uc;exports.TimeToComplete=sn;exports.Toggle=Qi;exports.Tooltip=cs;exports.TopLevelPage=zc;exports.UserContext=Se;exports.UserProvider=as;exports.VisuallyHidden=ge;exports.addAriaProps=os;exports.basicReducer=Qn;exports.camelCaseToDashCase=xa;exports.checkIntlPathExists=nn;exports.generateConditions=Bt;exports.generateCssIcon=Ta;exports.getLongDate=Jn;exports.getMember=tr;exports.getShortDate=Ea;exports.headerData=_t;exports.mapGetStreamData=Ul;exports.pageReady=Sa;exports.passwordValidator=qn;exports.repliesFeedMock=kl;exports.supportedLanguages=Ut;exports.toCamelCase=wa;exports.toSentenceCase=ka;exports.useCurrentPath=ga;exports.useEffectAfterMount=Je;exports.useElementWidth=nt;exports.useOverlay=ss;exports.useScrollListener=ba;exports.useScrollToHash=Gn;exports.useUser=an;
|
|
159
|
+
${or(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:or(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Yx="shareLinks_",Gx=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=Zx({title:e,link:t,referrer:n});return d.jsxs("aside",{className:V("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:h,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=f=>p(f,h)),d.jsx("li",{children:d.jsx(xe,{size:a,variant:"tertiary",icon:{icon:c||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Yx}link_${u}`}),...g})},u)})})]})};const Qx=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,h,m)=>(c||(c=`panel-${window.btoa(h)}-${m}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(m=>m.id===c)){for(let m=0;m<e.length;m++)if(r(e[m].id,e[m].text,m)===c){a=m;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:h,content:m,href:p,hasCarousel:g},f)=>{c=r(c,h,f);const y=i===c,v={};p||(v["aria-controls"]=c,v.onClick=x=>{x.preventDefault(),x.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:V({selected:y}),role:"tab","aria-selected":y,...v,children:h})},`tab-${c}`))}),d.jsxs("div",{className:V("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Jx={"2-1":901,"1-3":769,"1-1":769},kf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Kn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:V("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Jx[e]?null:o)})};let Ii;const $i="contactFooter_",Xx=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Ii),Ii=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Ii),window.removeEventListener("resize",l)}),[]),d.jsx(an,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(oe.FormattedMessage,{id:`${$i}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(oe.FormattedMessage,{id:`${$i}text`})}),d.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${$i}email`})})]}),d.jsx(ef,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},ew=({activeLink:e,...t})=>d.jsx(an,{children:d.jsx(kf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(_f,{activeLink:e}),d.jsx(Ec,{...t})]})})});const Li="cookieBanner_",zi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],qi=new Date(Date.now()+12*30*24*60*60*1e3),Bf=()=>{const e=oe.useIntl(),[t,n,r]=ks.useCookies(zi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{zi.forEach(c=>{n(c,!0,{path:"/",expires:qi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:qi}),zi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:qi});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Li}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Li}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Li}text`})}),d.jsx(yn,{buttons:u})]})},It={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-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:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},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","ai"],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"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Fn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Fn["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:Fn.support,gtmType:"concierge-email-click"},business:{email:Fn.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 Nn="footer_",Fa="SiteFooter",Vl=({group:e})=>{const t=It[e].order||[];let n=!1;return"text"in It[e]&&(n=It[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=It[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":i,...s,children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},fo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Pa,{element:"hr"}),d.jsx(co,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(Vl,{group:e}),Object.keys(It[e]).includes("child")&&d.jsx(Vl,{group:It[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(It.social.order)&&It.social.order.map(e=>{const t=It.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Fa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(oe.FormattedMessage,{id:`${Nn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(oe.FormattedMessage,{id:`${Nn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),je={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&je.handlerCalled[e]&&i-je.handlerCalled[e]<500)return;je.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},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 a=ac(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?je.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=je.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=je.findFirstChild(u.children,"href")}else s=je.findFirstChild(t.current.children,"href");break;case"account":if(o=je.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=je.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(je.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(je.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(je.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{je.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Br={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},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"}}}},Ta=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=oe.useIntl(),o=ac(Br,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const B=x.split("."),E=B[B.length-2];x=`${E==="topics"?`${E}-`:""}${B[B.length-1]}`}m={href:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=m&&window.location.pathname===o.href;let y={},v={};if(f&&(y={...y,"aria-current":"page"}),p){const x=o.menuId||e,B={onClick:E=>je.events.onClick(E,{id:x,callback:a,isOpen:r[x]}),onFocus:()=>je.events.onFocus({id:x}),onBlur:()=>je.events.onBlur({id:x,callback:a}),onMouseLeave:()=>je.events.onBlur({id:x,callback:a}),onMouseEnter:()=>je.events.onMouseEnter({id:x,callback:a})};n&&(g&&(y={...B,onKeyPress:E=>{E.key==="Enter"&&je.events.onClick(E,{id:x,callback:a,isOpen:r[x]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[x],"aria-controls":x}),v={hidden:x in r?!r[x]:!0}),g||(v={...v,...B})}return d.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...y,children:[m?C.createElement(c?xe:"a",m,s.formatMessage({id:h})):s.formatMessage({id:h}),o.order&&d.jsx("ul",{...v,children:o.order.map(x=>{if(!o[x])return null;const B={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[x].order?d.jsxs("li",{className:V({[o[x].className]:o[x].className}),children:[s.formatMessage({id:`${h}_${x}`}),d.jsx("ul",{children:o[x].order.map(E=>d.jsx(Ta,{id:`${e}.${x}.${E}`,...B},E))})]},x):d.jsx(Ta,{id:`${e}.${x}`,...B},x)})})]},e)};const tw={height:67,height_desktop:83},ho=({showNavigation:e=!0})=>{const t=oe.useIntl(),n=C.useContext(Ot),r=Kn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>je.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Ar,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,h=C.useRef(s);C.useEffect(()=>{h.current=s},[s]),lc({scrollPosition:tw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const f=h.current.menus;!i&&f.navigation||je.shouldChangeHeaderIsVisible(!0,f,o)},scrollDown:()=>{const f=h.current.menus;!i&&f.navigation||je.shouldChangeHeaderIsVisible(!1,f,o)}}});const m=(f,y,v=!1)=>{je.handleMenus({id:f,value:y,menus:h.current.menus,dispatch:o,forceHandle:v})},p=C.useRef(null),g=f=>{f.key==="Escape"&&["navigation","search","account"].forEach(y=>{h.current.menus[y]&&m(y,!1,!0)})};return C.useEffect(()=>{var f;return(f=document.getElementById("header"))==null||f.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Ln(()=>{u.navigation&&je.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Ln(()=>{u.account&&je.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:V({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(co,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:f=>{f.preventDefault(),f.stopPropagation(),m("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Br.order.map(f=>d.jsx(Ta,{id:f,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:m},f))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:f=>{f.preventDefault(),f.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(nf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:f=>je.events.onClick(f,{id:"account",callback:m,isOpen:u.account}),onMouseEnter:()=>je.events.onMouseEnter({id:"account",callback:m}),onMouseLeave:()=>je.events.onBlur({id:"account",callback:m}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Ie,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(tn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Br.buttons.order.map(f=>d.jsx(Ta,{id:`buttons.${f}`},f))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:V("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const nw=()=>{const e=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(ho,{}),d.jsx("div",{id:"content",children:d.jsx(en,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(fo,{})]})},Af=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:h="default",circle:m="default",modal:p="default"}=i,g=oc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const f=ra(e,{locale:o}),y=ra(t,{locale:o}),v=ra(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),h!=="default"&&(x[h]=!0),m!=="default"&&(x[m]=!0),d.jsx(eh.ErrorBoundary,{onError:r,fallback:d.jsx(nw,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:V(s,x,{"has-footer":u}),children:[d.jsx(ho,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[y&&d.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:y}),C.createElement(c==="bold"?oo:"div",{id:"content",children:f,className:V({"large-modal":p==="large"})})]}),v&&d.jsx("div",{className:"additional-content appended",children:v}),u&&d.jsx(fo,{}),d.jsx(Bf,{})]})})})},Kl={default:"tags_",headerTopics:"header_topics_topics_"},Wi={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"},rw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Wi.topic[e.replace("topic_","")],e){const t=Br.topics.topics[e].href;return t?{id:e,href:t,text:`${Kl.headerTopics}${e}`}:null}return null}return Wi[e]?(e=Wi[e],{id:e,text:`${Kl.default}${e}`}):null}};const aw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=oe.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=rw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:V("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const iw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl();return e.length===0?null:d.jsxs("div",{className:V("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(Fr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(Rn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(jr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const sw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=oe.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:V("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>d.jsx("strong",{children:h}),number:u})}),u<100&&a&&d.jsx(Ua,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(Fs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Ff=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Tf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=oe.useIntl(),o=Na(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):mc(a||"");return d.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&d.jsx(Ua,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const ow=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const h=oe.useIntl(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(Ra,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[h.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${m}time_completed`}):d.jsx(Ua,{time:s,appendedText:a?h.formatMessage({id:`${m}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:y,icon:v,image:x,isIntroduction:B,optional:E,slug:_,subsectionId:A,title:S,type:q})=>{const $=a&&t||B,j={};return x&&(j.style={"--image":`url(${x})`}),d.jsx("li",{className:V({article:y===ur.ARTICLE,discussion:y===ur.DISCUSSION,quiz:y===ur.QUIZ,completed:g&&y===ur.ARTICLE,locked:!$}),...j,children:d.jsx(Dn,{href:$?`/microcourses/en/${o}/${_}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${hc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Ff,{sectionId:i,subsectionId:A,title:S,className:"course-title"})," ",d.jsx(Tf,{completionTime:f,icon:v,optional:E,type:q,children:c&&c[_]&&d.jsx("span",{className:"quiz-score",children:`${c[_]}%`})})]})})},_)})})]})};const uw=({isComplete:e=!1,onClick:t,...n})=>{const r=oe.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(xe,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:V("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let ea=null;const st="discussion_form_",Ka=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=1e11,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var q,$,j;const u=oe.useIntl(),c=C.useContext(Ot),[h,m]=C.useState(r.isEditing&&r.isEditing.text||""),[p,g]=C.useState(s.error||!1),[f,y]=C.useState(!1);if(r.isLoading)return d.jsx(Ct,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const v=N=>{m(N);let w;!c||!c.id?w=Bt(u.formatMessage,`${st}error_loggedOut`,t.type,"action"):n?N.length>=i&&(w=`${st}error_tooLong`):w=Bt(u.formatMessage,`${st}error_noPermission`,t.type,"action"),w?g(w):p&&g(!1)};let x=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const N=((q=t.slugs)==null?void 0:q.reply)||(($=t.slugs)==null?void 0:$.answer)||((j=t.slugs)==null?void 0:j.question)||"";N&&(x=`${x}-${N.slice(-15)}`)}e&&(x=`${e}-${x}`);const B=async N=>{var F;if(N.preventDefault(),N.stopPropagation(),!c||!c.id||!n||_)return;ea&&clearTimeout(ea),y("submitting");const w=window.location.pathname;try{let R;switch(t.type){case"post":R=await o.create({content:h});break;case"question":R=await o.create({title:h,authorId:c&&c.id,...(F=o.props)==null?void 0:F.create});break;case"response":R=await o.create({questionSlug:t.slugs.question},{body:h,authorId:c&&c.id,contentPath:w});break;case"reply":R=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:h,authorId:c&&c.id,contentPath:w});break;default:break}await ch(1e3),o.callback&&await o.callback(R),ea=setTimeout(()=>{m(""),y("submitted");const M=new Event("discussionFormSubmitted");document.dispatchEvent(M),E()},500)}catch(R){const M=R;let Y=`${st}error`;M!=null&&M.message.includes("entry already exists")&&(Y=Bt(u.formatMessage,`${st}error_alreadyExists`,t.type,"action")),M!=null&&M.message.includes("429")?Y=Bt(u.formatMessage,`${st}error_tooMany`,t.type,"action"):M!=null&&M.message.includes("400")&&(Y=`${st}error`),g(Y),E()}},E=()=>{ea=setTimeout(()=>{g(!1),y(!1)},5e3)},_=!h||!gh(h),A=f==="submitting",S=[];return(r.isEditing&&!A||s.cancel)&&S.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!c||!c.id||!h),children:u.formatMessage({id:`${st}cancel`})}),S.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:N=>{if(r.isEditing){y("submitting"),o.handleSaveEdit&&o.handleSaveEdit(h);return}B(N)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!n||_||A||r.isEditing&&h===r.isEditing.text,children:u.formatMessage({id:`${st}${A?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs("form",{id:x,className:V("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:Bt(u.formatMessage,`${st}title`,t.type,"action")}),d.jsx(Fr,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:Bt(u.formatMessage,`${st}label`,t.type,"action")}),d.jsx(Xd,{id:`${x}-input`,value:f==="submitting"&&!p?"":h,placeholder:a||Bt(u.formatMessage,`${st}placeholder`,t.type,"action"),onChange:v,autoFocus:!!r.isEditing,"aria-invalid":!!p,"aria-errormessage":"error-message"}),d.jsx("small",{children:Bt(u.formatMessage,`${st}explainer`,t.type,"action",{a:N=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:N})})}),d.jsx(yn,{buttons:S}),f==="submitted"&&r.showSuccessMessage&&d.jsx(yr,{className:"success","data-testid":"success",children:Bt(u.formatMessage,`${st}success`,t.type,"action")}),p&&d.jsx(yr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof p=="string"?p.includes(" ")?p:u.formatMessage({id:p},{action:u.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):p})]})},mo=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(en,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(lo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ka,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},lw={showForm:!1},Za=C.createContext(lw),Sf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Za.Provider,{value:{...t,updateConversation:n},children:e})},cw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),dw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const _s=({icon:e,...t})=>d.jsx(xe,{className:"discussion-button",variant:"tertiary",icon:e,...t});let br=!1;const Hi=()=>{br!==!1&&(clearTimeout(br),br=!1)},Ui=5;let Vi=null;const jf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=oe.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,m]=C.useReducer(Ar,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:f,showLikers:y,tabbableLink:v}=h;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const x=C.useMemo(()=>dw(n,Ui),[n]),B=S=>{if(S.preventDefault(),S.stopPropagation(),m([{type:"showLikers",value:!1}]),br)return Hi(),!1;if(Hi(),f||!s)return!1;br=setTimeout(E,350)},E=async()=>{if(Hi(),f||!s)return!1;let S=g?p-1:p+1;S<0&&(S=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const q=cw(i.slugs);g?await l(q):await o({...q,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},_=()=>{Vi=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},A=()=>{Vi&&clearTimeout(Vi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{A(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{_()}},d.jsxs(d.Fragment,{children:[d.jsx(_s,{className:V("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:B,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{A()},onBlur:()=>_,onClick:S=>{var $;S.preventDefault(),S.stopPropagation(),A(),m([{type:"showLikers",value:!0}]);const q=($=S.currentTarget.nextSibling)==null?void 0:$.childNodes[0];if(q){const j=q.querySelector("li:first-child a");j&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{j.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),_())},"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(Va,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map((S,q)=>{if(typeof S=="string"||!S.name)return null;const $={};return v!==q&&($.tabIndex=-1),d.jsx("li",{"data-index":q,children:d.jsx(Dn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:j=>j==null?void 0:j.stopPropagation(),onFocus:()=>A(),onKeyDown:j=>{var M,Y,K,se;if(!j||!["ArrowUp","ArrowDown"].includes(j.key||""))return;j.stopPropagation(),j.preventDefault();const N=j.key==="ArrowUp"?"up":"down",w=(M=j.currentTarget)==null?void 0:M.parentElement;let F=w==null?void 0:w.nextElementSibling;if(N==="up"){const ne=w==null?void 0:w.previousElementSibling;ne?F=ne:(F=(Y=w==null?void 0:w.parentElement)==null?void 0:Y.lastElementChild,(F==null?void 0:F.getAttribute("data-index"))==="-1"&&(F=F==null?void 0:F.previousElementSibling))}else(!F||(F==null?void 0:F.getAttribute("data-index"))==="-1")&&(F=(K=w==null?void 0:w.parentElement)==null?void 0:K.firstElementChild);if(!F)return;const R=(F==null?void 0:F.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:R}]),(se=F==null?void 0:F.querySelector("a"))==null||se.focus()},...$,children:S.name})},S.id||window.btoa(S.name))}),t>Ui&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Ui})})]})})]})]}))},Zl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Ya=(e,t)=>e&&!t;const Mt="discussion_",fw=280,Or=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:h}={openComments:()=>{}}},links:m={},className:p,gtmContext:g="DiscussionAnswer",children:f,isTruncated:y=!1})=>{const v=oe.useIntl(),x=C.useContext(Ot),B=C.useContext(Za),{author:E,canLike:_,createdAt:A,id:S,likes:q=0,userLiked:$,comments:j=0}=t,N=x&&x.id&&typeof E!="string"&&E.id&&E.id===x.id||!1,w=typeof _=="boolean"?_:n?!N:!1,F=N&&(!t.createdAt||lh(t.createdAt,10,"seconds")),R=C.useRef(null),[M,Y]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[K,se]=C.useState(!1),[ne,D]=C.useState(F?"highlighted":"default"),[z,J]=C.useState("");C.useEffect(()=>{const Z=R.current;if(!(!Z||ne==="default"))return document.addEventListener("discussionFormSubmitted",k),Z.addEventListener("transitionend",T),()=>{document.removeEventListener("discussionFormSubmitted",k),Z.removeEventListener("transitionend",T)}},[]),C.useEffect(()=>{Y({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const k=()=>{setTimeout(()=>{D("fading")},1e3)},T=({propertyName:Z})=>{Z==="background-color"&&D(ue=>(ue==="default"&&(document.removeEventListener("discussionFormSubmitted",k),R.current&&R.current.removeEventListener("transitionend",T)),ue==="fading"?"default":ue))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return d.jsx(Ct,{className:"discussion-card discussion-post"});const L=y?$n(M.body,fw):M.body,I=async Z=>{Z||(Z=""),J("");try{if(!rc(Z,M.body)){const ue=t.type==="question"?{title:Z}:{body:Z};await l(Zl(t.slugs),ue)}Y({body:Z,isEditing:!1,didEdit:!0})}catch{J(`${Mt}form_error`)}},U=()=>{B&&B.updateConversation&&B.updateConversation({showForm:!0}),setTimeout(()=>{var me,_e,Se;const ue=`reply-form-${(t.type==="answer"?t.slug:((me=t.slugs)==null?void 0:me.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((Se=t.slugs)==null?void 0:Se.question)||"").toLowerCase().slice(-15)}`,Q=document.getElementById(ue),ge=document.getElementById(`${ue}-input`);ge&&ge.focus(),Q&&Q.scrollIntoView({behavior:"smooth"})},0)},te=async()=>{se(!1);try{await o(Zl(t.slugs))}catch{J("delete-error")}},ee=[{text:v.formatMessage({id:`${Mt}moreMenu_report`}),onClick:Z=>{Z.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Mt}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${Mt}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&&N&&ee.push({text:v.formatMessage({id:`${Mt}moreMenu_edit`}),onClick:()=>Y({...M,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${Mt}moreMenu_delete`}),onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),se(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...Cf(`delete-${t.slug}-modal`,K)}),C.createElement(e,{className:V("discussion-post",p,{[ne]:!p||!p.includes("highlighted-text-box"),"has-link":m.post&&!M.isEditing}),ref:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Z=>{!m.post||M.isEditing||(Z.preventDefault(),Z.stopPropagation(),window.location.href=m.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:S||t.slug,className:V("discussion-card",t.type,{editing:M.isEditing,"has-link":m.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(Fr,{member:E,additionalContent:{createdAt:A,didEdit:M.didEdit},className:typeof E!="string"&&E.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Ka,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:M.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:z!==""&&z!=="delete-error"?v.formatMessage({id:z},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:I,handleCancel:()=>{J(""),Y({...M,isEditing:!1})}},gtmContext:`${g}Form`}):m.post?d.jsxs("a",{href:m.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t.title}),t!=null&&t.body&&(t==null?void 0:t.body.length)>195?d.jsx(wc,{text:t==null?void 0:t.body.trim(),markdownOptions:{overrides:{a:Xi}}}):d.jsx(zn,{options:{overrides:{a:Xi}},children:L.trim()})]}):d.jsx(zn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:L.trim()}),!M.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:V("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(jf,{element:"li",likes:q,isShort:!1,userLiked:$,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:w,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||m.comments||typeof h=="function")&&d.jsx("li",{children:d.jsx(_s,{onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof h=="function"&&h()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${Mt}comments_screenReader`},{count:j}),children:v.formatMessage({id:`${Mt}comments`},{count:j})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(_s,{styling:{muted:!0},onClick:U,icon:{icon:"speech-bubble_square_thick"},children:v.formatMessage({id:`${Mt}reply`})})}),d.jsx(Ef,{element:"li",id:`more-${t.slug}`,options:ee})]})]}),f,d.jsx(Sr,{id:`delete-${t.slug}-modal`,isOpen:K,functions:{onOpen:()=>{},onClose:()=>se(!1)},forceShow:{error:z==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>se(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:te,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(oe.FormattedMessage,{id:"discussion_delete_text",values:{p:Z=>d.jsx("p",{children:Z}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Ki="discussion_responses_",Of=({type:e="answer",responses:t=0})=>{const n=oe.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Ki}title`},{action:n.formatMessage({id:`${Ki}${e}`}),count:t})}),t===0&&d.jsx("p",{children:Bt(n.formatMessage,`${Ki}empty`,e,e)})]})};const Pf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=oe.useIntl(),s=C.useContext(Za),o=ra(a,{element:"li"});return d.jsxs("div",{className:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx(jr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Ka,{...r})]})},hw="post",mw="reply",Nf="00000000-0000-0000-0000-000000000000";function po({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function go({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function pw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function gw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Rf(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function vw({content:e}){return{content:e,id:Nf,time:new Date().toISOString(),verb:hw}}function Yl({activity:e,user:t}){return{...e,actor:Rf(t),...pw()}}function Sa({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Mf({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function bw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Nf,kind:mw,parent:t||""}}function Gl({reply:e,user:t}){const n=Rf(t);return{...e,user_id:n.id,user:n,...gw()}}function Ql({reply:e,reaction:t}){var n,r,a;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((a=e.own_children)==null?void 0:a.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function yw({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const If=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Jl,Zi=0;const $f=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(Jl);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Zi=0;return}Zi++,!(Zi>10)&&(Jl=setTimeout(()=>{e(t)},50))}},Vn=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),Xt=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Lf=Object.freeze({actor:`SU:${Vn.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),Dw=Object.freeze({actor:`SU:${Xt.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Cw=Object.freeze({actor:`SU:${Vn.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),xw=Object.freeze({actor:`SU:${Xt.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Lf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Xt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Xt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:Xt.id,user:{id:Xt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Lf.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Vn.id,user:{id:Vn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Dw.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Xt.id,user:{id:Xt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Cw.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Vn.id,user:{id:Vn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xw.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function ww({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Yl({activity:vw(o),user:i});return Xl(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Yl({activity:o,user:i});r.setQueryData(a,Xl(c,u,!0)),setTimeout(()=>{If(c.id)},0)}});return s}function Ew({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=ja(a,s);return o&&(o.content=i),s}),onError:n});return r}function _w({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:po(u),mutate:go(u)},user:l,...u},h=ww({...c,mutationFn:e}),m=Ew({...c,mutationFn:t}),p=kw({...c,mutationFn:n}),g=Aw({...c,mutationFn:a}),f=Fw({...c,mutationFn:i}),{activities:y,...v}=Bw({queryKey:s,queryFn:r});return{activities:y,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...v}}function kw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=ja(s,o);return l&&Sa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=ja(o,l);u&&Sa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Bw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:Sw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Aw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Tw(a,i)),onError:n});return r}function Fw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=ja(i,s);return o&&Mf({activity:o,user:r}),s}),onError:n});return a}function Xl(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function ja(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Tw(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function Sw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const jw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:a,leave:i}})=>{const s=oe.useIntl(),{activities:o,error:l,fetchNextPage:u,hasNextPage:c,isLoading:h,mutations:{create:m,edit:p,remove:g,like:f,unlike:y},user:v}=_w({queryKey:[e,t,"activities"],queryFns:r});return $f(),l?d.jsx(en,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(mo,{form:{content:{type:"post",slugs:{}},functions:{create:m},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:i,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}}),o==null?void 0:o.map((x,B)=>{var R,M,Y,K,se,ne,D,z;const{id:E,own_reactions:_,latest_reactions:A,reaction_counts:S}=x,q=(((R=A==null?void 0:A.like)==null?void 0:R.length)||0)>0,$=(((M=_==null?void 0:_.like)==null?void 0:M.length)||0)>0,j=$?_==null?void 0:_.like[0].id:"",N=q?(Y=A==null?void 0:A.like)==null?void 0:Y.map(J=>{var k,T,L;return{id:(k=J==null?void 0:J.user)==null?void 0:k.id,name:(L=(T=J==null?void 0:J.user)==null?void 0:T.data)==null?void 0:L.name}}):!1,w=x==null?void 0:x.actor,F=(w==null?void 0:w.id)===(v==null?void 0:v.id);return d.jsx(C.Fragment,{children:d.jsx(Or,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Ya(n,F),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:w==null?void 0:w.id,name:(K=w==null?void 0:w.data)==null?void 0:K.name,organization:(se=w==null?void 0:w.data)==null?void 0:se.organization,jobTitle:(ne=w==null?void 0:w.data)==null?void 0:ne.jobTitle,location:(D=w==null?void 0:w.data)==null?void 0:D.location,image:{thumbnail:((z=w==null?void 0:w.data)==null?void 0:z.thumbnail)||void 0}},userLiked:$,likes:(S==null?void 0:S.like)||0,comments:(S==null?void 0:S.reply)||0,peopleWhoLiked:N},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:E}),updateContent:(J,{body:k})=>p({activityId:E,content:k})},likes:{createLike:()=>f({activityId:E}),deleteLike:()=>y({activityId:E,reactionId:j})},comments:{openComments:()=>null}},isTruncated:!0})},E)}),!h&&d.jsx(jr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},Ow={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function Pw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Gl({reply:bw(o),user:i});return ec(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Gl({reply:o,user:i});r.setQueryData(a,ec(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{If(c.id)},0)}});return s}function Nw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Oa(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function zf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:po(u),mutate:go(u)},user:l,...u},h=Pw({...c,mutationFn:e}),m=Nw({...c,mutationFn:t}),p=Rw({...c,mutationFn:n}),g=Iw({...c,mutationFn:a}),f=$w({...c,mutationFn:i}),{replies:y,...v}=Mw({queryKey:s,queryFn:r});return{replies:y,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...v}}function Rw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Oa(s,o);return l&&Ql({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Oa(o,l);u&&Ql({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Mw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=Hw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Iw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Ww(a,i)),onError:n});return r}function $w({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Oa(i,s);return o&&yw({reply:o,user:r}),s}),onError:n});return a}function Lw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function zw(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function qw(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function ec(e,t,n){return t?n!=null&&n.append?zw(e,t,n):qw(e,t,n):Lw(e)}function Oa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Ww(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function Hw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const Uw=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=oe.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:h,mutations:{create:m,edit:p,like:g,remove:f,unlike:y},user:v}=zf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:r})}});Bs([h]);const[x,B]=C.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(xe,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${x?"up_left":"down_right"}`,position:"left"},onClick:()=>B(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&d.jsx(Pf,{loadMore:{isLoading:h,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(E,{body:_})=>m({activityId:n,replyId:r,content:_})},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(E=>{var ne,D,z,J,k,T,L,I,U,te,ee,Z;const{id:_,own_children:A,latest_children:S,children_counts:q}=E,j=(((ne=A==null?void 0:A.like)==null?void 0:ne.length)||0)>0?(D=A==null?void 0:A.like)==null?void 0:D.find(ue=>{var Q;return((Q=ue==null?void 0:ue.user)==null?void 0:Q.id)===(v==null?void 0:v.id)}):!1,N=j?j==null?void 0:j.id:"",w=!!j,R=(((z=S==null?void 0:S.like)==null?void 0:z.length)||0)>0?(J=S==null?void 0:S.like)==null?void 0:J.map(ue=>{var Q,ge,me;return{id:(Q=ue==null?void 0:ue.user)==null?void 0:Q.id,name:(me=(ge=ue==null?void 0:ue.user)==null?void 0:ge.data)==null?void 0:me.name}}):!1,M=E==null?void 0:E.user,Y=(M==null?void 0:M.id)===(v==null?void 0:v.id),K=Ya(a,Y),se=typeof E.data.content=="string"?(k=E==null?void 0:E.data)==null?void 0:k.content:((L=(T=E==null?void 0:E.data)==null?void 0:T.content)==null?void 0:L.text)||"";return d.jsx(Or,{content:{id:_,type:"reply",body:se,canLike:K,createdAt:E==null?void 0:E.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E==null?void 0:E.parent},slug:"",author:{id:M==null?void 0:M.id,name:(I=M.data)==null?void 0:I.name,organization:(U=M.data)==null?void 0:U.organization,jobTitle:(te=M.data)==null?void 0:te.jobTitle,location:(ee=M.data)==null?void 0:ee.location,image:{thumbnail:((Z=M.data)==null?void 0:Z.thumbnail)||void 0}},userLiked:w,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:R},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:_}),updateContent:(ue,{body:Q})=>p({replyId:_,content:Q})},likes:{createLike:()=>g({replyId:_}),deleteLike:()=>y({replyId:_,reactionId:N})},comments:{}}},_)}):null})]})};const qf=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,join:i,leave:s}})=>{const o=oe.useIntl(),{replies:l,repliesCount:u,fetchNextPage:c,hasNextPage:h,isLoading:m,mutations:{create:p,edit:g,like:f,remove:y,unlike:v},user:x}=zf({queryKey:[e,t,n,"replies"],queryFns:a});return Bs([m]),$f(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Of,{type:"comment",responses:u}),d.jsx(mo,{form:{content:{type:"reply",slugs:{}},functions:{create:(B,{body:E})=>p({activityId:n,content:E})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:o.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map(B=>{var se,ne,D,z,J,k,T,L,I,U,te,ee;const{id:E,own_children:_,latest_children:A,children_counts:S}=B,$=(((se=_==null?void 0:_.like)==null?void 0:se.length)||0)>0?(ne=_==null?void 0:_.like)==null?void 0:ne.find(Z=>{var ue;return((ue=Z==null?void 0:Z.user)==null?void 0:ue.id)===(x==null?void 0:x.id)}):!1,j=$?$==null?void 0:$.id:"",N=!!$,F=(((D=A==null?void 0:A.like)==null?void 0:D.length)||0)>0?(z=A==null?void 0:A.like)==null?void 0:z.map(Z=>{var ue,Q,ge;return{id:(ue=Z==null?void 0:Z.user)==null?void 0:ue.id,name:(ge=(Q=Z==null?void 0:Z.user)==null?void 0:Q.data)==null?void 0:ge.name}}):!1,R=B==null?void 0:B.user,M=(R==null?void 0:R.id)===(x==null?void 0:x.id),Y=Ya(r,M),K=typeof B.data.content=="string"?(J=B==null?void 0:B.data)==null?void 0:J.content:((T=(k=B==null?void 0:B.data)==null?void 0:k.content)==null?void 0:T.text)||"";return d.jsx(Sf,{children:d.jsx(Or,{content:{id:E,type:"reply",body:K,canLike:Y,createdAt:B==null?void 0:B.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:R==null?void 0:R.id,name:(L=R.data)==null?void 0:L.name,organization:(I=R.data)==null?void 0:I.organization,jobTitle:(U=R.data)==null?void 0:U.jobTitle,location:(te=R.data)==null?void 0:te.location,image:{thumbnail:((ee=R.data)==null?void 0:ee.thumbnail)||void 0}},userLiked:N,likes:(S==null?void 0:S.like)||0,peopleWhoLiked:F},functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:E}),updateContent:(Z,{body:ue})=>g({replyId:E,content:ue})},likes:{createLike:()=>f({replyId:E}),deleteLike:()=>v({replyId:E,reactionId:j})},comments:{}},children:d.jsx(Uw,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a}})},E)},E)}),!m&&d.jsx(jr,{hasNextPage:h,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Vw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function Kw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function Zw({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=qe.useQueryClient(),s=Ha(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:po(o),mutate:go(o)},user:s,...o},u=Vw({...l,mutationFn:t}),c=Yw({...l,mutationFn:n}),h=Gw({...l,mutationFn:r}),{activity:m,...p}=Kw({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:h},user:s,...p}}function Yw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Sa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Sa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function Gw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Mf({activity:s,user:r}),s)),onError:n});return a}const Qw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var $,j,N,w,F,R,M,Y,K,se;const u=oe.useIntl(),c=C.useContext(Ot),{activity:h,error:m,isLoading:p,mutations:{edit:g,like:f,unlike:y}}=Zw({queryFns:i,queryKey:[e,t,n]});if(p)return d.jsx(Ct,{style:{height:"400px"}});if(m||!h)return d.jsx(en,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:x}=h,B=((($=x==null?void 0:x.like)==null?void 0:$.length)||0)>0,E=(((j=v==null?void 0:v.like)==null?void 0:j.length)||0)>0,_=E?v==null?void 0:v.like[0].id:"",A=B?(N=x==null?void 0:x.like)==null?void 0:N.map(ne=>{var D,z,J;return{id:(D=ne==null?void 0:ne.user)==null?void 0:D.id,name:(J=(z=ne==null?void 0:ne.user)==null?void 0:z.data)==null?void 0:J.name}}):!1,S=h==null?void 0:h.actor,q=(S==null?void 0:S.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Or,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:h==null?void 0:h.content,canLike:Ya(r,q),createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:S.id,name:(w=S.data)==null?void 0:w.name,organization:(F=S.data)==null?void 0:F.organization,jobTitle:(R=S.data)==null?void 0:R.jobTitle,location:(M=S.data)==null?void 0:M.location,image:{thumbnail:((Y=S.data)==null?void 0:Y.thumbnail)||void 0}},userLiked:E,likes:((K=h==null?void 0:h.reaction_counts)==null?void 0:K.like)||0,comments:((se=h==null?void 0:h.reaction_counts)==null?void 0:se.reply)||0,peopleWhoLiked:A},originalAuthorId:S==null?void 0:S.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ne,{body:D})=>g({content:D})},likes:{createLike:()=>f({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:_})},comments:{openComments:()=>{}}}},n),d.jsx(qf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},Jw=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),tc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ta="notFoundError_",Xw=()=>{const e=oe.useIntl(),t=[];return tc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ta}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Af,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(an,{children:[d.jsx(wf,{cards:tc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(xe,{href:"/solution-articles/",children:e.formatMessage({id:`${ta}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ta}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ta}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=jw;exports.ActivitySection=Qw;exports.AddPost=mo;exports.Banner=xx;exports.BannerSection=Fx;exports.Breadcrumbs=qx;exports.Buckets=xh;exports.Button=xe;exports.ButtonWrapper=yn;exports.COURSE_CONTENT_TYPES=ur;exports.CacheProvider=pf;exports.Card=uo;exports.CardBlock=wf;exports.Carousel=Lx;exports.CollapsibleSection=Ra;exports.Columns=kf;exports.CommunityDetails=zx;exports.ContactFooter=Xx;exports.ContactForm=ef;exports.ContentTypeLabel=Dc;exports.Contributors=js;exports.ConversationContext=Za;exports.CookieBanner=Bf;exports.CourseProgression=sw;exports.CourseStructure=ow;exports.CustomContentBanner=Tx;exports.Directory=bx;exports.DiscussionConversation=Sf;exports.DiscussionForm=Ka;exports.DiscussionLikes=jf;exports.DiscussionPost=Or;exports.DiscussionThread=Pf;exports.Divider=Qt;exports.DownloadSection=wx;exports.EMAILS=Fn;exports.EditSection=_x;exports.EmailHelperTextBox=Bc;exports.EmptyStateBox=en;exports.Filters=Wx;exports.FlagsProvider=gf;exports.Footer=fo;exports.Form=Gn;exports.FullWidthSection=an;exports.GlobalProviders=gx;exports.Header=ho;exports.HelperTextBox=xc;exports.HiddenFromScreenReaders=Pa;exports.HideShowTextBox=wc;exports.HighlightSection=jx;exports.HighlightedTextBox=St;exports.INVALID_TOKEN=pc;exports.IconBulletedList=_h;exports.ImageContainer=yh;exports.IntlProvider=vf;exports.InviteForm=tf;exports.InviteModal=vx;exports.JoinButton=lo;exports.LanguageContext=io;exports.LanguageSwitcher=Ux;exports.LessonName=Ff;exports.LessonType=Tf;exports.Link=Dn;exports.LoadMore=jr;exports.LoadingBlock=Rh;exports.LoadingPlaceholder=Ct;exports.LoadingState=Ts;exports.Logo=co;exports.LogoSection=kx;exports.MarkCompleteButton=uw;exports.MarkdownText=zn;exports.MarketingBlock=Ox;exports.Member=Fr;exports.MembersList=iw;exports.Modal=oo;exports.MoreMenu=Ef;exports.NUMBER_OF_COUNTRIES=uh;exports.NUMBER_OF_USERS=oh;exports.NavigationMenu=_f;exports.NotFoundError=Xw;exports.Overlay=Sr;exports.OverlayContext=so;exports.OverlayProvider=Df;exports.PageHeading=Ec;exports.PageLayout=Af;exports.PasswordForm=cC;exports.PasswordRules=jc;exports.Pill=Rn;exports.Portal=yc;exports.ProfileImageChange=lC;exports.ProfilePicture=tn;exports.ProgressBar=Fs;exports.ProgressTracker=Dh;exports.Rating=Yh;exports.RepliesFeed=qf;exports.ResponsesHeading=Of;exports.ResponsiveImage=Yn;exports.ReturnToNavButton=Ch;exports.RichTextEditor=Xd;exports.SearchForm=nf;exports.ShareLinks=Gx;exports.SignupForm=gC;exports.Span=Xi;exports.StatusBanner=yr;exports.TableOfContents=Cx;exports.Tabs=Qx;exports.Tags=aw;exports.TestimonialBlock=Dx;exports.TimeToComplete=Ua;exports.Toggle=uC;exports.Tooltip=Va;exports.TopLevelPage=ew;exports.UserContext=Ot;exports.UserProvider=bf;exports.VisuallyHidden=Ie;exports.addAriaProps=Cf;exports.basicReducer=Ar;exports.camelCaseToDashCase=fc;exports.checkIntlPathExists=Na;exports.generateConditions=ca;exports.generateCssIcon=gc;exports.getLongDate=As;exports.getMember=Ss;exports.getShortDate=vc;exports.headerData=Br;exports.mapGetStreamData=Jw;exports.pageReady=bc;exports.passwordValidator=Qi;exports.repliesFeedMock=Ow;exports.supportedLanguages=fa;exports.toCamelCase=hc;exports.toSentenceCase=mc;exports.useCurrentPath=oc;exports.useEffectAfterMount=Ln;exports.useElementWidth=Kn;exports.useOverlay=yf;exports.useScrollListener=lc;exports.useScrollToHash=Bs;exports.useUser=Ha;
|