@apolitical/component-library 4.1.0-beta.2 → 4.1.0-beta.4
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/discussion/components/form/form.d.ts +1 -4
- package/discussion/components/likes/likes.d.ts +8 -1
- package/form/components/form/form.d.ts +1 -1
- package/form/components/form/form.types.d.ts +2 -0
- package/form/components/rich-text-editor/components/context/context.d.ts +5 -7
- package/form/components/rich-text-editor/components/toolbar/components/block-option/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/toolbar/components/mark-option/mark-option.helpers.d.ts +2 -0
- package/form/components/rich-text-editor/components/toolbar/index.d.ts +1 -1
- 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/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/index.d.ts +1 -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/rich-text-editor.d.ts +1 -2
- package/general/buttons/button/button.d.ts +7 -1
- package/general/link/link.d.ts +2 -0
- package/general/tooltip/tooltip.d.ts +2 -0
- package/index.js +58 -62
- package/index.mjs +7093 -7036
- package/package.json +1 -2
- package/style.css +1 -1
- package/styles/base/_links.scss +12 -3
- package/styles/base/buttons/_icons.scss +2 -0
- package/text/markdown-text/components/span/span.d.ts +2 -1
- package/form/components/rich-text-editor/rich-text-editor.helpers.d.ts +0 -5
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),cn=require("lodash.clonedeep"),Gf=require("lodash.set"),se=require("react-intl"),Lt=require("markdown-to-jsx"),$n=require("truncate"),qe=require("@tanstack/react-query"),Qf=require("@tanstack/react-query-devtools"),ta=require("posthog-js"),Bs=require("react-cookie"),nc=require("lodash.isequal"),Jf=require("react-multi-email"),rc=require("lodash.get"),Xf=require("react-error-boundary"),eh=require("react-dom");var Pr=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 ac(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 ic={exports:{}};/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],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})()})(
|
|
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})()})(ic);var th=ic.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}),Le=C.memo(nh),rh=({element:e="span",children:t=null,...n})=>C.createElement(e,{...n,"aria-hidden":!0},t),Oa=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,f={},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)&&(f[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)f[c]===void 0&&(f[c]=l[c]);return{$$typeof:t,type:o,key:m,ref:p,props:f,_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,36 +18,36 @@
|
|
|
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
|
-
`),nt=
|
|
24
|
-
`),ze=
|
|
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"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,h="@@iterator";function y(S){if(S===null||typeof S!="object")return null;var re=g&&S[g]||S[h];return typeof re=="function"?re:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(S){{for(var re=arguments.length,le=new Array(re>1?re-1:0),be=1;be<re;be++)le[be-1]=arguments[be];k("error",S,le)}}function k(S,re,le){{var be=v.ReactDebugCurrentFrame,Be=be.getStackAddendum();Be!==""&&(re+="%s",le=le.concat([Be]));var Oe=le.map(function(Ee){return String(Ee)});Oe.unshift("Warning: "+re),Function.prototype.apply.call(console[S],console,Oe)}}var E=!1,w=!1,A=!1,P=!1,U=!1,$;$=Symbol.for("react.module.reference");function j(S){return!!(typeof S=="string"||typeof S=="function"||S===r||S===i||U||S===a||S===u||S===c||P||S===p||E||w||A||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===f||S.$$typeof===s||S.$$typeof===o||S.$$typeof===l||S.$$typeof===$||S.getModuleId!==void 0))}function R(S,re,le){var be=S.displayName;if(be)return be;var Be=re.displayName||re.name||"";return Be!==""?le+"("+Be+")":le}function _(S){return S.displayName||"Context"}function T(S){if(S==null)return null;if(typeof S.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof S=="function")return S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){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 S=="object")switch(S.$$typeof){case o:var re=S;return _(re)+".Consumer";case s:var le=S;return _(le._context)+".Provider";case l:return R(S,S.render,"ForwardRef");case f:var be=S.displayName||null;return be!==null?be:T(S.type)||"Memo";case m:{var Be=S,Oe=Be._payload,Ee=Be._init;try{return T(Ee(Oe))}catch{return null}}}return null}var N=Object.assign,M=0,Q,Z,oe,ne,D,z,J;function B(){}B.__reactDisabledLog=!0;function F(){{if(M===0){Q=console.log,Z=console.info,oe=console.warn,ne=console.error,D=console.group,z=console.groupCollapsed,J=console.groupEnd;var S={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:S,log:S,warn:S,error:S,group:S,groupCollapsed:S,groupEnd:S})}M++}}function L(){{if(M--,M===0){var S={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},S,{value:Q}),info:N({},S,{value:Z}),warn:N({},S,{value:oe}),error:N({},S,{value:ne}),group:N({},S,{value:D}),groupCollapsed:N({},S,{value:z}),groupEnd:N({},S,{value:J})})}M<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=v.ReactCurrentDispatcher,H;function te(S,re,le){{if(H===void 0)try{throw Error()}catch(Be){var be=Be.stack.trim().match(/\n( *(at )?)/);H=be&&be[1]||""}return`
|
|
22
|
+
`+H+S}}var ee=!1,K;{var ue=typeof WeakMap=="function"?WeakMap:Map;K=new ue}function G(S,re){if(!S||ee)return"";{var le=K.get(S);if(le!==void 0)return le}var be;ee=!0;var Be=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Oe;Oe=I.current,I.current=null,F();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(S,[],Ee)}else{try{Ee.call()}catch(Nt){be=Nt}S.call(Ee.prototype)}}else{try{throw Error()}catch(Nt){be=Nt}S()}}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 S.displayName&>.includes("<anonymous>")&&(gt=gt.replace("<anonymous>",S.displayName)),typeof S=="function"&&K.set(S,gt),gt}while(ze>=1&&He>=0);break}}}finally{ee=!1,I.current=Oe,L(),Error.prepareStackTrace=Be}var wn=S?S.displayName||S.name:"",xo=wn?te(wn):"";return typeof S=="function"&&K.set(S,xo),xo}function ge(S,re,le){return G(S,!1)}function me(S){var re=S.prototype;return!!(re&&re.isReactComponent)}function _e(S,re,le){if(S==null)return"";if(typeof S=="function")return G(S,me(S));if(typeof S=="string")return te(S);switch(S){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof S=="object")switch(S.$$typeof){case l:return ge(S.render);case f:return _e(S.type,re,le);case m:{var be=S,Be=be._payload,Oe=be._init;try{return _e(Oe(Be),re,le)}catch{}}}return""}var Se=Object.prototype.hasOwnProperty,Pe={},Ge=v.ReactDebugCurrentFrame;function Ke(S){if(S){var re=S._owner,le=_e(S.type,S._source,re?re.type:null);Ge.setExtraStackFrame(le)}else Ge.setExtraStackFrame(null)}function Ze(S,re,le,be,Be){{var Oe=Function.call.bind(Se);for(var Ee in S)if(Oe(S,Ee)){var we=void 0;try{if(typeof S[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 S[Ee]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw nt.name="Invariant Violation",nt}we=S[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(Be),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(Be),x("Failed %s type: %s",le,we.message),Ke(null))}}}var tt=Array.isArray;function Ae(S){return tt(S)}function We(S){{var re=typeof Symbol=="function"&&Symbol.toStringTag,le=re&&S[Symbol.toStringTag]||S.constructor.name||"Object";return le}}function $e(S){try{return W(S),!1}catch{return!0}}function W(S){return""+S}function ae(S){if($e(S))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",We(S)),W(S)}var fe=v.ReactCurrentOwner,pe={key:!0,ref:!0,__self:!0,__source:!0},De,Ue,Ve;Ve={};function ft(S){if(Se.call(S,"ref")){var re=Object.getOwnPropertyDescriptor(S,"ref").get;if(re&&re.isReactWarning)return!1}return S.ref!==void 0}function Pt(S){if(Se.call(S,"key")){var re=Object.getOwnPropertyDescriptor(S,"key").get;if(re&&re.isReactWarning)return!1}return S.key!==void 0}function xt(S,re){if(typeof S.ref=="string"&&fe.current&&re&&fe.current.stateNode!==re){var le=T(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',T(fe.current.type),S.ref),Ve[le]=!0)}}function Qe(S,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(S,"key",{get:le,configurable:!0})}}function _t(S,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(S,"ref",{get:le,configurable:!0})}}var ht=function(S,re,le,be,Be,Oe,Ee){var we={$$typeof:t,type:S,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:Be}),Object.freeze&&(Object.freeze(we.props),Object.freeze(we)),we};function Ga(S,re,le,be,Be){{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,Be));for(Oe in re)Se.call(re,Oe)&&!pe.hasOwnProperty(Oe)&&(Ee[Oe]=re[Oe]);if(S&&S.defaultProps){var ze=S.defaultProps;for(Oe in ze)Ee[Oe]===void 0&&(Ee[Oe]=ze[Oe])}if(we||nt){var He=typeof S=="function"?S.displayName||S.name||"Unknown":S;we&&Qe(Ee,He),nt&&_t(Ee,He)}return ht(S,we,nt,Be,be,fe.current,Ee)}}var Xn=v.ReactCurrentOwner,Or=v.ReactDebugCurrentFrame;function xn(S){if(S){var re=S._owner,le=_e(S.type,S._source,re?re.type:null);Or.setExtraStackFrame(le)}else Or.setExtraStackFrame(null)}var Qa;Qa=!1;function Ja(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function vo(){{if(Xn.current){var S=T(Xn.current.type);if(S)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+S+"`."}return""}}function
|
|
27
|
+
Check the render method of \``+S+"`."}return""}}function qf(S){{if(S!==void 0){var re=S.fileName.replace(/^.*[\\\/]/,""),le=S.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+re+":"+
|
|
29
|
+
Check your code at `+re+":"+le+"."}return""}}var bo={};function Wf(S){{var re=vo();if(!re){var le=typeof S=="string"?S:S.displayName||S.name;le&&(re=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+ue+">.")}return re}}function bo(S,re){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var ue=Lf(re);if(vo[ue])return;vo[ue]=!0;var ve="";S&&S._owner&&S._owner!==er.current&&(ve=" It was passed a child from "+T(S._owner.type)+"."),wn(S),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ue,ve),wn(null)}}function yo(S,re){{if(typeof S!="object")return;if(Ae(S))for(var ue=0;ue<S.length;ue++){var ve=S[ue];Ja(ve)&&bo(ve,re)}else if(Ja(S))S._store&&(S._store.validated=!0);else if(S){var Be=b(S);if(typeof Be=="function"&&Be!==S.entries)for(var Oe=Be.call(S),Ee;!(Ee=Oe.next()).done;)Ja(Ee.value)&&bo(Ee.value,re)}}}function zf(S){{var re=S.type;if(re==null||typeof re=="string")return;var ue;if(typeof re=="function")ue=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===f))ue=re.propTypes;else return;if(ue){var ve=T(re);Ze(ue,S.props,"prop",ve,S)}else if(re.PropTypes!==void 0&&!Qa){Qa=!0;var Be=T(re);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"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 qf(S){{for(var re=Object.keys(S.props),ue=0;ue<re.length;ue++){var ve=re[ue];if(ve!=="children"&&ve!=="key"){wn(S),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ve),wn(null);break}}S.ref!==null&&(wn(S),x("Invalid attribute `ref` supplied to `React.Fragment`."),wn(null))}}function Do(S,re,ue,ve,Be,Oe){{var Ee=N(S);if(!Ee){var xe="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).length===0)&&(xe+=" 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=$f(Be);nt?xe+=nt:xe+=go();var ze;S===null?ze="null":Ae(S)?ze="array":S!==void 0&&S.$$typeof===t?(ze="<"+(T(S.type)||"Unknown")+" />",xe=" Did you accidentally export a JSX literal instead of a component?"):ze=typeof S,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,xe)}var He=Ga(S,re,ue,Be,Oe);if(He==null)return He;if(Ee){var gt=re.children;if(gt!==void 0)if(ve)if(Ae(gt)){for(var En=0;En<gt.length;En++)yo(gt[En],S);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 yo(gt,S)}return S===r?qf(He):zf(He),He}}function Wf(S,re,ue){return Do(S,re,ue,!0)}function Hf(S,re,ue){return Do(S,re,ue,!1)}var Uf=Hf,Vf=Wf;nr.Fragment=r,nr.jsx=Uf,nr.jsxs=Vf}()),nr}process.env.NODE_ENV==="production"?Zi.exports=nh():Zi.exports=rh();var d=Zi.exports;const rc=()=>{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},zn=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function ah(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),f=C.useRef(!0);c.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,x=b?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var A=C.useMemo(function(){var k=function(N){var O=o.current,w=l.current;return o.current=l.current=null,i.current=N,u.current=c.current.apply(w,O)},E=function(N,O){h&&cancelAnimationFrame(s.current),s.current=h?requestAnimationFrame(N):setTimeout(N,O)},B=function(N){if(!f.current)return!1;var O=N-a.current;return!a.current||O>=t||O<0||b&&N-i.current>=x},P=function(N){return s.current=null,m&&o.current?k(N):(o.current=l.current=null,u.current)},z=function N(){var O=Date.now();if(B(O))return P(O);if(f.current){var w=t-(O-a.current),T=b?Math.min(w,x-(O-i.current)):w;E(N,T)}},I=function(){if(p||v){var N=Date.now(),O=B(N);if(o.current=[].slice.call(arguments),l.current=r,a.current=N,O){if(!s.current&&f.current)return i.current=a.current,E(z,t),g?k(a.current):u.current;if(b)return E(z,t),k(a.current)}return s.current||E(z,t),u.current}};return I.cancel=function(){s.current&&(h?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},I.isPending=function(){return!!s.current},I.flush=function(){return s.current?P(Date.now()):u.current},I},[g,b,t,x,m,h,p,v]);return A}function ac(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return ah(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Xa;const Zn=(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:f}=c;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=ac(()=>{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},ic=({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,f=a.current,p=c-f,h=p>0?"down":"up";if(i({current:c,past:f}),h==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=ac(()=>{l()},250);return a},sc=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);zn(()=>{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)},Bs=(e,t)=>{Array.isArray(t)||(t=[t]);const n=fn(e);return t.forEach(({type:r,value:a})=>{Kf(n,r,a)}),n},oc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},uc=(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},lc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),cc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),dc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),zt="https://storage.googleapis.com/apolitical-assets/",Tn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},lr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},fc="Invalid token error: Logging user out...",ih="200,000+",sh="160+";function hc(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const cn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},mc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),ks=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Yi=e=>{let t;const n=ha(),r=ha(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/cn.milliseconds.inHour,i=Math.floor(t/cn.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<=cn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/cn.year.days)}},ha=e=>{const n=(e||new Date).toUTCString();return new Date(n)},oh=(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/cn.milliseconds.inSecond<=t;case"minutes":return r/cn.milliseconds.inMinute<=t;case"hours":return r/cn.milliseconds.inHour<=t}return!1},uh=e=>new Promise(t=>setTimeout(t,e)),Yn={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(S,re){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var le=Wf(re);if(bo[le])return;bo[le]=!0;var be="";S&&S._owner&&S._owner!==Xn.current&&(be=" It was passed a child from "+T(S._owner.type)+"."),xn(S),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(S,re){{if(typeof S!="object")return;if(Ae(S))for(var le=0;le<S.length;le++){var be=S[le];Ja(be)&&yo(be,re)}else if(Ja(S))S._store&&(S._store.validated=!0);else if(S){var Be=y(S);if(typeof Be=="function"&&Be!==S.entries)for(var Oe=Be.call(S),Ee;!(Ee=Oe.next()).done;)Ja(Ee.value)&&yo(Ee.value,re)}}}function Hf(S){{var re=S.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===f))le=re.propTypes;else return;if(le){var be=T(re);Ze(le,S.props,"prop",be,S)}else if(re.PropTypes!==void 0&&!Qa){Qa=!0;var Be=T(re);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"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 Uf(S){{for(var re=Object.keys(S.props),le=0;le<re.length;le++){var be=re[le];if(be!=="children"&&be!=="key"){xn(S),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",be),xn(null);break}}S.ref!==null&&(xn(S),x("Invalid attribute `ref` supplied to `React.Fragment`."),xn(null))}}function Co(S,re,le,be,Be,Oe){{var Ee=j(S);if(!Ee){var we="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).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=qf(Be);nt?we+=nt:we+=vo();var ze;S===null?ze="null":Ae(S)?ze="array":S!==void 0&&S.$$typeof===t?(ze="<"+(T(S.type)||"Unknown")+" />",we=" Did you accidentally export a JSX literal instead of a component?"):ze=typeof S,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(S,re,le,Be,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],S);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,S)}return S===r?Uf(He):Hf(He),He}}function Vf(S,re,le){return Co(S,re,le,!0)}function Kf(S,re,le){return Co(S,re,le,!1)}var Zf=Kf,Yf=Vf;tr.Fragment=r,tr.jsx=Zf,tr.jsxs=Yf}()),tr}process.env.NODE_ENV==="production"?Yi.exports=ah():Yi.exports=ih();var d=Yi.exports;const sc=()=>{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),f=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,h=!("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 f.current=!0,function(){f.current=!1}},[]);var k=C.useMemo(function(){var E=function(j){var R=o.current,_=l.current;return o.current=l.current=null,i.current=j,u.current=c.current.apply(_,R)},w=function(j,R){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(j):setTimeout(j,R)},A=function(j){if(!f.current)return!1;var R=j-a.current;return!a.current||R>=t||R<0||y&&j-i.current>=x},P=function(j){return s.current=null,h&&o.current?E(j):(o.current=l.current=null,u.current)},U=function j(){var R=Date.now();if(A(R))return P(R);if(f.current){var _=t-(R-a.current),T=y?Math.min(_,x-(R-i.current)):_;w(j,T)}},$=function(){if(m||v){var j=Date.now(),R=A(j);if(o.current=[].slice.call(arguments),l.current=r,a.current=j,R){if(!s.current&&f.current)return i.current=a.current,w(U,t),g?E(a.current):u.current;if(y)return w(U,t),E(a.current)}return s.current||w(U,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?P(Date.now()):u.current},$},[g,y,t,x,h,p,m,v]);return k}function oc(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:f}=c;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=oc(()=>{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},uc=({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,f=a.current,m=c-f,p=m>0?"down":"up";if(i({current:c,past:f}),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=oc(()=>{l()},250);return a},ks=(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)},Pa=(e,t)=>{Array.isArray(t)||(t=[t]);const n=cn(e);return t.forEach(({type:r,value:a})=>{Gf(n,r,a)}),n},lc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},cc=(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},dc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),fc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),hc=(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"},mc="Invalid token error: Logging user out...",oh="200,000+",uh="160+";function pc(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}},gc=(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=fa(),r=fa(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)}},fa=e=>{const n=(e||new Date).toUTCString();return new Date(n)},lh=(e,t,n)=>{let r;const a=fa(),i=fa(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!",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_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"},lh={...Yn,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>"},ch={...Yn,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"},dh={...Yn,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>"},fh=Object.freeze(Object.defineProperty({__proto__:null,en:Yn,es:lh,fr:ch,pt:dh},Symbol.toStringTag,{value:"Module"})),Na=(e,t=Yn)=>e in t,At=(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},hh=(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})),pc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},mh=(e="")=>e.replace(/\s+/g,"").length>0,Gi=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}}},we=({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,...f})=>{const h=Zn(typeof t=="object");if(typeof t=="object"&&typeof h=="number"){const b=Object.assign({},t),v=oc(Object.keys(b));t=uc(h,v,b)}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 m={...f,className:Y(e,o,g,{"no-text":!c,disabled:l,button:a}),onClick:b=>{(!a||a[0]==="#")&&s&&(b.preventDefault(),b.stopPropagation()),s&&s(b)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return a&&(i="a",m.href=a),C.createElement(i,m,c||(u?d.jsx(Le,{showOnFocus:!1,children:u}):null))},Dn=({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(we,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(we,{...s})},o)});return C.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const Jt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Y(e,{"has-max-width":t}),style:n})},Eo={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"}},ph=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Eo[e]:Eo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},gh=({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}?${gh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Gn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:f}=e,{range:p,sizes:h}=ph(e),g=ei({format:"avif",query:s,range:p,url:o}),m=ei({format:"webp",query:s,range:p,url:o}),b=ei({format:"",query:s,range:p,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:f||"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:h,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:m,sizes:h,"data-testid":"source"}),d.jsx("img",{srcSet:b,sizes:h,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const vh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(Gn,{image:{...e},className:"image"})}),Cn=({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:Y("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const bh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Le,{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:Y("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Y("line",{active:a<e})})]},r)})})})]});const yh=({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(we,{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 Dh=({items:e,className:t="",...n})=>d.jsx("ul",{className:Y("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))}),_o=300,Bo="ease-in-out";class Ch{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:_o,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:_o,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 Ch(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Y("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},ko={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},xh=e=>{let t=e;return Object.keys(ko).includes(e)&&(t=ko[e]),`url(${zt}icons/${t}.svg)`};const Ao={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},gc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=oe.useIntl(),i=t?{"--custom-icon":xh(t)}:{},s=Na(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in Ao?Ao[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const jt=({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:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const nn=({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=Zn(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),p=oc(Object.keys(f));a=uc(s,p,f)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(jt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Qt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(we,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Qi=({children:e,...t})=>d.jsx("p",{...t,children:e}),vc={q:Qi,blockquote:Qi};for(let e=1;e<=6;e++)vc[`h${e}`]={component:Qi,props:{className:"title"}};const bc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Qt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:vc},children:r}):d.jsx("p",{children:r})]});const yc=({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(""),[f,p]=C.useState("closed");C.useEffect(()=>{const m=l.current;if(m)return m.addEventListener("transitionend",h),()=>{m.removeEventListener("transitionend",h)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const m=a.split(`
|
|
36
|
-
`);c(
|
|
37
|
-
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&p("closing")},[f]);const h=({propertyName:m})=>{m==="max-height"&&p(b=>b==="opening"?"open":b==="closing"?"closed":b)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(jt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",f),children:[d.jsx(Qt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(we,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(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 wh=({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:Y("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},f={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Qt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Qt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Qt,{options:c,children:l.text}):l.text},u)})})},Xe=()=>C.Fragment,Eh=({children:e})=>d.jsx(jt,{variant:"secondary",children:e}),_h=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Bh=["span","strong","h1","h2","h3","h4","h5","h6","p"],kh=({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(Bh.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)})},Ah=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(jt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(jt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(jt,{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})},Fh=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(Le,{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}`})]})},Fo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Th=({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"||Fo(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&&Fo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(we,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},Ji=({children:e})=>d.jsx("span",{children:e});const Sh={default:{a:Th,CollapsibleSection:Ra,TextBox:jt,CaseStudy:Eh,style:Xe,details:kh,div:Ah,iframe:Fh,center:_h},"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}},qn=({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:Sh[r]};return d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Qt,{options:{...s,...t},children:n})})};const Dc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("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 Mn=({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:Y("pill",e,t,n,{"has-icon":r}),style:s,...i,children:a})};const Dr=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const jh=({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:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Le,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},As=C.memo(jh);const ti="loadingBlock_",Oh=({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(jt,{className:Y("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(As,{progress:e})]})},Ph=C.memo(Oh);const xt=({element:e="div",className:t="",...n})=>d.jsx(Pa,{element:e,className:Y("loading-placeholder",t),...n});const Xi={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"]},Cc=(e,t)=>e in Xi?d.jsx("div",{className:e,children:Xi[e].map((n,r)=>Cc(n,r))},t):d.jsx(xt,{className:e},t),Fs=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:Xi[e].map((n,r)=>Cc(n,r))}),xc=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"],Nh=e=>{const t=Math.ceil(26/Rr.length),n=xc(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 To=256,rn=({className:e="",src:t="",name:n,alt:r,width:a=To,height:i=To,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const f=u.current;if(!f)return;const p=f.getContext("2d");if(!p)return;const h=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=h*window.devicePixelRatio,f.height=g*window.devicePixelRatio,p.scale(window.devicePixelRatio,window.devicePixelRatio)),p.fillStyle=Nh(n),p.fillRect(0,0,h,g),p.font=`${h/3}px Arial`,p.textAlign="center",p.fillStyle="white",p.fillText(xc(n),h/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Y("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})})},Ts=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},Rh=({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=Ln(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=Ts(t);u.name||(u.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:c,image:f}=u;let{url:p}=u;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const h=Rh(u),g=n&&n.createdAt?Yi(n.createdAt):!1,m=n&&n.createdAt?ks(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",l,s),children:d.jsxs(Cn,{href:p,gtmType:i,gtmContext:a,onClick:b=>{b==null||b.stopPropagation()},children:[d.jsx(rn,{name:c,src:f}),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:m,"aria-label":m,children:o.formatMessage({id:`dates_${g.path}`},{number:g.number})}),n.didEdit&&d.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),h&&d.jsx("small",{className:Y({"text-medium":l==="large"}),children:h})]})]})})};const So={small:24,medium:48},Ss=({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 f=oe.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,h)=>{let g,m="";if(h<o){const{name:b="",image:v=""}=Ts(p);if(s)return d.jsx(xt,{element:"li",className:"contributor"},h);g=d.jsx(rn,{name:b,src:v,width:So[a||"medium"],height:So[a||"medium"]})}else if(h===o){const b=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":b>99}),children:["+",hh(b,0)]}),m="number-left"}return g?d.jsx("li",{className:Y("contributor",m),children:g},h):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Ln(n[0].name||"",20):l||null})]})})};const Mr="emailHelperTextBox_",wc=({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(h=>{h.preventDefault(),h.stopPropagation();const g=m=>{s({path:`${Mr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>u(b),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:m})};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(m=>{g(m.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let h=Mr,g="default",m={},b={};switch(e){case"gov":h+="autoApproved",g="success";break;case"nonGov":h+="unrecognisedEmail",g="error",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":h+="pendingApproval",g="error",b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":h+="emailUnverified",g="error",m={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":h+="emailAlreadyExists",g="error",m={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:h+="default",m={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:h,type:g,link:m,mail:b})},[e]);const c={};return["link","mail"].forEach(h=>{c[h]=Object.keys(i[h]).length?g=>d.jsx("a",{...i[h],children:g}):g=>g}),d.jsx(bc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(xt,{element:"span"}),d.jsx(xt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:h=>d.jsx("strong",{children:h}),em:h=>d.jsx("em",{children:h}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Sn=({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(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:p=>{const h=p.target;a.onChange(h.value)}})};const _n={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Mh=500,Ih=({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},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},m]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=oe.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const k=setTimeout(()=>{g||f(E=>({...E,debouncedInput:l}))},Mh);return()=>{clearTimeout(k)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const E=await o(c)||[];m(B=>({...B,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),m(B=>({...B,predictions:[]}))}})():m(k=>({...k,predictions:[]}))},[c,g]),C.useEffect(()=>{h>=0&&p[h]&&f(k=>({...k,displayInput:p[h].description}))},[h,p]);const v=k=>{[_n.DOWN,_n.UP,_n.ENTER].includes(k.key)&&(k.preventDefault(),k.key===_n.DOWN&&h<p.length-1?m(E=>({...E,activePredictionIndex:h+1})):k.key===_n.UP&&h>0?m(E=>({...E,activePredictionIndex:h-1})):k.key===_n.ENTER&&h>-1&&(s(p[h].description),f(E=>({...E,input:p[h].description})),m(E=>({...E,predictions:[],isPredictionSelected:!0}))))},x=k=>{s(k.target.value),f(E=>({...E,input:k.target.value,displayInput:k.target.value})),m(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},A=k=>{s(k.description),f(E=>({...E,input:k.description,displayInput:k.description})),m(E=>({...E,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:p.map((k,E)=>d.jsx("li",{onClick:()=>A(k),onMouseEnter:()=>m(B=>({...B,activePredictionIndex:E})),className:Y("predictions-list-item",{active:E===h}),children:k.description},E))})]})};const Ec=({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,...f})=>{const p=oe.useIntl(),{onChange:h,...g}=r,m=()=>{t||h(c?null:l)},b=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(),m())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.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(),m())},className:Y("checkbox-wrapper",e),...f,...g},b)};const $h=C.memo(function({direction:t="down"}){return d.jsx(Pa,{className:Y("rotating-chevron",`direction-${t}`)})});const Lh=({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(),[f,p]=C.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[m,b]=C.useState(g);let v;Array.isArray(m)&&m.length===1&&typeof m[0]=="string"?v=t&&m?t.find(P=>P.id===m[0]):t?t[0]:{id:"",label:""}:Array.isArray(m)&&m.length===1&&typeof m[0]!="string"?v=m[0]:v={id:"",label:""},C.useEffect(()=>{b(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:A,...k}=a,E=P=>{if(o){let z=[];m!=null&&m.includes(P.id)?z=m.filter(I=>I!==P.id):z=[...m,P.id],b([...z]),x&&x([...z])}else b([P]),x&&x(P.id),p(!1)},B=P=>{if(P==="all"){const z=(t==null?void 0:t.map(I=>I.id))||[];b(z),x&&x(z)}else b([]),x&&x([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:P=>{P.preventDefault(),P.stopPropagation(),p(!f)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${m.length}`:v.label,d.jsx($h,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:P=>{P.preventDefault(),P.stopPropagation();const z=t&&t.find(I=>I.id===P.target.value);E(z)},hidden:!f,...k,children:t==null?void 0:t.map(P=>d.jsx("option",{value:P.id,children:P.label},P.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,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:`${m==null?void 0:m.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>B("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(P=>{const z=P.id===v.id||(m==null?void 0:m.includes(P))||(m==null?void 0:m.includes(P.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${P}-click`,"data-gtm-event-context":i,onClick:I=>{I.preventDefault(),I.stopPropagation(),E(P)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:P.label})]})},P.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(we,{variant:"secondary",onClick:()=>{A&&A(m),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:m}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const zh=({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,...f})=>{const p=oe.useIntl(),h=i?c:[],g=c;return d.jsx("ul",{...f,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:m,label:b=!1,value:v=m,disabled:x=!1})=>{const A=`${r}_${m}`,k=()=>{if(x)return;let E;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(E=h,E.splice(B,1)):(!h||h.length===0?E=[]:E=h,E.push(v))}else E=g===v?void 0:v;t.onChange(E)};return d.jsx(Ec,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:k},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${m}`:m}),disabled:x},A)})})};const qh=({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),f=()=>{var p;l(!o),c(o?"password":"text"),(p=s.current)==null||p.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Sn,{inputRef:s,type:u,...r})]})};const Bn={text:{component:Sn},email:{component:Sn},url:{component:Sn},textarea:{component:Sn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ec},checkboxes:{component:zh,props:{multiSelect:!0}},select:{component:Lh},password:{component:qh},autocomplete:{component:Ih}},Wh=({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,...f})=>{const p=oe.useIntl(),h=l&&l.some(({condition:E})=>E==="required"),g=(u==null?void 0:u.toString().length)||0,m=o&&Bn[o]&&Bn[o].component?Bn[o].component:Sn,b={};o&&["checkboxes"].includes(o)?b.element="span":b.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:fn(a),value:u};i>0&&(v["data-character-limit"]=i,v.functions&&(v.functions.onChange=E=>{((E==null?void 0:E.toString().length)||0)>i&&(E=E==null?void 0:E.toString().slice(0,i)),a.onChange(E)})),o&&Bn[o]&&Bn[o].props&&(v={...v,...Bn[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const x=f.label||p.formatMessage({id:t?`${t}_${e}`:e}),A=({...E})=>r?C.createElement(E.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(m,{...v,label:x,className:Y("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const k=E=>C.createElement(E.element||"label",{...E,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(k,{...b,children:[x,h&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(m,{...v}),i>0?d.jsxs("small",{className:Y("character-limit",{"near-limit":g>=.99*i,"approaching-limit":g>=.9*i&&g<.99*i}),children:[d.jsx("span",{className:"hidden",children:p.formatMessage({id:"form_fieldWrapper_characterLimit"})}),g," / ",i]}):null]}),d.jsx(A,{})]})},Hh=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?fn(e.errors):{},i=e.values?fn(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,f=fn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:m=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=m||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=m||(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)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=m||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),f.push(p.id);break}}return f.length===0?l(i):u(i,f),{...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 Qn=({fields:e,className:t="",id:n=e.length?`form__${e[0].id}`:"form",formRef:r,intlPath:a=!1,button:i={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:s={variant:"secondary",size:"large"},meta:o,gtm:l={context:"Form",event:"form-submit-click"},functions:{onSuccess:u=async()=>{},onCancel:c=()=>{},onCatch:f=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...h})=>{const{customOnSubmit:g,hideButton:m,...b}=i,v=40,{shouldShowCancelButton:x=!1,shouldReset:A=!0,showRequiredLabels:k=!0,showSuccessMessage:E=!1}=o||{},B=oe.useIntl(),P={};e.length&&e.forEach(Q=>{const D=Q.id||Q.name;D&&(P[D]=Q.value||"")});const[z,I]=C.useReducer(Hh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:P}),{errors:N,isSubmitting:O,formSubmitted:w,values:T}=z;C.useEffect(()=>{A&&w&&(ni=setTimeout(()=>{I({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[w]),C.useEffect(()=>()=>{ni&&clearTimeout(ni)},[]),C.useEffect(()=>{const Q=D=>{I({type:"updateValue",payload:{key:D.detail.id,value:D.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",Q),()=>{document.removeEventListener("dropdownMultiSelectSubmit",Q)}},[]);const R=C.useRef(null),M=r||R;if(!e.length)return null;i.text||(i.text=B.formatMessage({id:"form_submit"}));const K=()=>{if(!O){if(I({type:"toggleSubmitting"}),i.disabled){typeof i.disabled=="object"&&i.disabled.isClickable&&I({type:"submitForm",payload:{fields:e,dispatch:I,intl:B}});return}I({type:"submitForm",payload:{fields:e,dispatch:I,onSuccess:async Q=>{try{await u(Q),I({type:A?"formSubmittedAndReset":"formSubmitted"})}catch(D){f(D),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(Q,D)=>{p(Q,D),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:B}})}},ie=[{...b,icon:w?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:Q=>{var X;if(Q.preventDefault(),Q.stopPropagation(),O)return;let D=0;if((X=M==null?void 0:M.current)!=null&&X.id){const _=document.getElementById(M.current.id);_&&(D=_.getBoundingClientRect().top+window.scrollY)}const U=document.getElementById("header");U&&(D=D-U.offsetHeight-v),D<0&&(D=0),window.scrollTo({top:D,behavior:"smooth"}),K()},disabled:O||w||i.disabled,"data-gtm-event-context":l.context,"data-gtm-event-type":l.event,children:O||w?B.formatMessage({id:`form_${O?"submitting":"submitted"}`}):i.text}];return x&&ie.unshift({...s,className:"gtm-trackable","data-gtm-event-context":l.context,"data-gtm-event-type":l.event,disabled:O||w,onClick:c,children:s.text||B.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[d.jsxs("form",{...h,id:n,className:Y("form",t),ref:M,children:[N!=null&&N.general?d.jsx(nn,{variant:"error",text:B.formatMessage({id:"form_error_generalError"})}):null,(!A||!O&&!w||g)&&e.map((Q,D)=>{const{id:U=Q.name||D,component:X,functions:_={onChange:()=>{}},submitOnEnter:F=!1}=Q;if(X)return d.jsx(X,{...Q.props||{}},`component-${U}-${D}`);const L=T?T[U]:"",$={..._,onChange:q=>{I({type:"updateValue",payload:{key:U,value:q}}),_.onChange(q&&q.toString(),I)}};return F&&($.onKeyDown=q=>{q.key==="Enter"&&(q.stopPropagation(),q.preventDefault(),K()),_.onKeyDown&&_.onKeyDown(q)}),d.jsx(Wh,{intlPath:a,...Q,showRequiredLabels:k,value:L,error:N==null?void 0:N[U],functions:$},U)}),m?null:(O||w)&&g?g:d.jsx(Dn,{className:Y("cta",{center:O||w,submitted:w}),buttons:ie})]}),E&&w&&d.jsx(Dr,{className:"success",children:typeof E=="string"?E:B.formatMessage({id:"form_success"})})]})};const Ir="passwordRules_",_c="isMoreThanEightCharacters",Bc="includesNumberAndSymbol",kc="includesLowerAndUppercase",Uh={[_c]:"8Characters",[Bc]:"numberSymbol",[kc]:"lowercaseUppercase"},Vh=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=oe.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Ir}intro`})}),d.jsx("ul",{children:[_c,Bc,kc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Le,{children:[n.formatMessage({id:`${Ir}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Ir}rule_${Uh[r]}`})}),!e[r]&&d.jsxs(Le,{element:"strong",children:[" ",n.formatMessage({id:`${Ir}notMet`})]})]},`rule-${r}`))})]})},Ac=C.memo(Vh);const Kh=({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(xt,{className:"rating-placeholder"});const{id:f,rating:p,disabled:h}=l,g="ratings_",m={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},b=async v=>{if(!(!f||h))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:f,value:v})}catch(x){u(A=>({...A,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:m[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const x=v+1;return d.jsx("li",{className:Y({selected:p&&x<=p}),children:d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:`star${!p||x>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:x,total:t})}${x===1||x===t?` - ${m[x===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),b(x)},disabled:h})},`rating-${x}`)})})]})};var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});var Zh=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ri={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Fc={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Zh?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},js={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++)js["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 Tc(s,t)}),a=function(o){return r.some(function(l){return Sc(l,o)})},i=n==null?a:a(n);return i}function Yh(e,t){return Ma(e,t)}function Gh(e,t){return Ma(e,{byKey:!0},t)}function Tc(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](),f;!(o=(f=c.next()).done);o=!0){var p=f.value,h=p.endsWith("?")&&p.length>1;h&&(p=p.slice(0,-1));var g=Os(p),m=ri[g];if(p.length>1&&!m&&!Fc[p]&&!js[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!m)&&(n?r.key=g:r.which=jc(p)),m&&(r[m]=h?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Sc(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 jc(e){e=Os(e);var t=js[e]||e.toUpperCase().charCodeAt(0);return t}function Os(e){return e=e.toLowerCase(),e=Fc[e]||e,e}var Qh=Wt.default=Ma,ai=Wt.isHotkey=Ma;Wt.isCodeHotkey=Yh;Wt.isKeyHotkey=Gh;Wt.parseHotkey=Tc;Wt.compareHotkey=Sc;Wt.toKeyCode=jc;Wt.toKeyName=Os;function Jh(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 es(e,t){return Array(t+1).join(e)}function Xh(e){return e.replace(/^\n*/,"")}function em(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
|
-
`;)t--;return e.substring(0,t)}var
|
|
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!",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_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,kt=(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},na=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),vc=(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,...f})=>{const p=Kn(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const y=Object.assign({},t),v=lc(Object.keys(y));t=cc(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 h={...f,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",h.href=a),C.createElement(i,h,c||(u?d.jsx(Le,{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:f}=e,{range:m,sizes:p}=vh(e),g=ei({format:"avif",query:s,range:m,url:o}),h=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:f||"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:h,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"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})};const Dh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Le,{children:d.jsx(se.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=se.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))}),Bo=300,ko="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:Bo,easing:ko}),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:Bo,easing:ko}),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=se.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"},bc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=se.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 f=Object.assign({},n.breakpoints),m=lc(Object.keys(f));a=cc(s,m,f)}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}),yc={q:Ji,blockquote:Ji};for(let e=1;e<=6;e++)yc[`h${e}`]={component:Ji,props:{className:"title"}};const Dc=({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:yc},children:r}):d.jsx("p",{children:r})]});const Cc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=se.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[f,m]=C.useState("closed");C.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",p),()=>{h.removeEventListener("transitionend",p)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const h=a.split(`
|
|
36
|
+
`);c(h.length<3?`${a.substring(0,400)}...`:h.slice(0,3).join(`
|
|
37
|
+
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&m("closing")},[f]);const p=({propertyName:h})=>{h==="max-height"&&m(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(St,{variant:"subtle",className:V("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:V("content",f),children:[d.jsx(Lt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="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},f={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,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:f,children:typeof l.text=="string"?d.jsx(Lt,{options:c,children:l.text}):l.text},u)})})},Xe=()=>C.Fragment,Bh=({children:e})=>d.jsx(St,{variant:"secondary",children:e}),kh=({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=se.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=se.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(Le,{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:Bh,style:Xe,details:Fh,div:Th,iframe:Sh,center:kh},"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 xc=({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=se.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":Le,{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=se.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(Oa,{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"]},wc=(e,t)=>e in es?d.jsx("div",{className:e,children:es[e].map((n,r)=>wc(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)=>wc(n,r))}),Ec=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):""},Nr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Mh=e=>{const t=Math.ceil(26/Nr.length),n=Ec(e).toLowerCase();if(n==="")return Nr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Nr.length;a++)if(r<=t*(a+1))return Nr[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 f=u.current;if(!f)return;const m=f.getContext("2d");if(!m)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=p*window.devicePixelRatio,f.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(Ec(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 Ar=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=se.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:f}=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,h=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:f}),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:h,"aria-label":h,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 f=se.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,h="";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)]}),h="number-left"}return g?d.jsx("li",{className:V("contributor",h),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):$n(n[0].name||"",20):l||null})]})})};const Rr="emailHelperTextBox_",_c=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=se.useIntl(),[i,s]=C.useState({path:`${Rr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=h=>{s({path:`${Rr}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:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Rr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(h=>{g(h.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=Rr,g="default",h={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="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",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",h={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",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}s({...i,path:p,type:g,link:h,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(Dc,{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(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:V(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.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},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},h]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=se.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const E=setTimeout(()=>{g||f(w=>({...w,debouncedInput:l}))},$h);return()=>{clearTimeout(E)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const w=await o(c)||[];h(A=>({...A,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),h(A=>({...A,predictions:[]}))}})():h(E=>({...E,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&f(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?h(w=>({...w,activePredictionIndex:p+1})):E.key===En.UP&&p>0?h(w=>({...w,activePredictionIndex:p-1})):E.key===En.ENTER&&p>-1&&(s(m[p].description),f(w=>({...w,input:m[p].description})),h(w=>({...w,predictions:[],isPredictionSelected:!0}))))},x=E=>{s(E.target.value),f(w=>({...w,input:E.target.value,displayInput:E.target.value})),h(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},k=E=>{s(E.description),f(w=>({...w,input:E.description,displayInput:E.description})),h(w=>({...w,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,w)=>d.jsx("li",{onClick:()=>k(E),onMouseEnter:()=>h(A=>({...A,activePredictionIndex:w})),className:V("predictions-list-item",{active:w===p}),children:E.description},w))})]})};const Bc=({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,...f})=>{const m=se.useIntl(),{onChange:p,...g}=r,h=()=>{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(),h())},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(),h())},className:V("checkbox-wrapper",e),...f,...g},y)};const zh=C.memo(function({direction:t="down"}){return d.jsx(Oa,{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=se.useIntl(),[f,m]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[h,y]=C.useState(g);let v;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?v=t&&h?t.find(P=>P.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?v=h[0]:v={id:"",label:""},C.useEffect(()=>{y(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:k,...E}=a,w=P=>{if(o){let U=[];h!=null&&h.includes(P.id)?U=h.filter($=>$!==P.id):U=[...h,P.id],y([...U]),x&&x([...U])}else y([P]),x&&x(P.id),m(!1)},A=P=>{if(P==="all"){const U=(t==null?void 0:t.map($=>$.id))||[];y(U),x&&x(U)}else y([]),x&&x([])};return d.jsxs("div",{className:V("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:P=>{P.preventDefault(),P.stopPropagation(),m(!f)},"data-testid":"dropdown-selector",...E,children:[o?`${s} · ${h.length}`:v.label,d.jsx(zh,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:P=>{P.preventDefault(),P.stopPropagation();const U=t&&t.find($=>$.id===P.target.value);w(U)},hidden:!f,...E,children:t==null?void 0:t.map(P=>d.jsx("option",{value:P.id,children:P.label},P.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,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:`${h==null?void 0:h.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(P=>{const U=P.id===v.id||(h==null?void 0:h.includes(P))||(h==null?void 0:h.includes(P.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:V("gtm-trackable",{selected:U,"selected-single":U&&!o}),"data-gtm-event-type":`${P}-click`,"data-gtm-event-context":i,onClick:$=>{$.preventDefault(),$.stopPropagation(),w(P)},role:"menuitem","aria-current":U,"data-testid":U?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:V({"menu-option-label":o}),children:P.label})]})},P.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(xe,{variant:"secondary",onClick:()=>{k&&k(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),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,...f})=>{const m=se.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...f,className:V("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:h,label:y=!1,value:v=h,disabled:x=!1})=>{const k=`${r}_${h}`,E=()=>{if(x)return;let w;if(i){const A=p==null?void 0:p.indexOf(v);Array.isArray(p)&&A>=0?(w=p,w.splice(A,1)):(!p||p.length===0?w=[]:w=p,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return d.jsx(Bc,{element:"li",id:k,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}_${h}`:h}),disabled:x},k)})})};const Hh=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=se.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{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:f,"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:Bc},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,...f})=>{const m=se.useIntl(),p=l&&l.some(({condition:w})=>w==="required"),g=(u==null?void 0:u.toString().length)||0,h=o&&_n[o]&&_n[o].component?_n[o].component:Tn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let v={...f,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=w=>{((w==null?void 0:w.toString().length)||0)>i&&(w=w==null?void 0:w.toString().slice(0,i)),a.onChange(w)})),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=f.label||m.formatMessage({id:t?`${t}_${e}`:e}),k=({...w})=>r?C.createElement(w.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...w},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(h,{...v,label:x,className:V("field-wrapper",n)}),d.jsx(k,{as:"p"})]});const E=w=>C.createElement(w.element||"label",{...w,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(h,{...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(k,{})]})},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,f=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:h=!1}=m.validation[p];let y=!1;if(typeof g=="function"){const v=g(i);v&&(y=h||v)}else{const v=i[m.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(y=h||(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=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(y=h||(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}}),f.push(m.id);break}}return f.length===0?l(i):u(i,f),{...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:f=()=>{},onCatch:m=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:h,hideButton:y,...v}=s,x=40,{shouldShowCancelButton:k=!1,shouldReset:E=!0,showRequiredLabels:w=!0,showSuccessMessage:A=!1}=l||{},P=se.useIntl(),U={};t.length&&t.forEach(D=>{const z=D.id||D.name;z&&(U[z]=D.value||"")});const[$,j]=C.useReducer(Vh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:U}),{errors:R,isSubmitting:_,formSubmitted:T,values:N}=$;C.useEffect(()=>{E&&T&&(ni=setTimeout(()=>{j({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[T]),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),Q=a||M;if(!t.length)return null;s.text||(s.text=P.formatMessage({id:"form_submit"}));const Z=()=>{if(!_){if(j({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&j({type:"submitForm",payload:{fields:t,dispatch:j,intl:P}});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:P}})}},ne=[{...v,icon:T?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var B;if(D.preventDefault(),D.stopPropagation(),_)return;let z=0;if((B=Q==null?void 0:Q.current)!=null&&B.id){const F=document.getElementById(Q.current.id);F&&(z=F.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"}),Z()},disabled:_||T||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:_||T?P.formatMessage({id:`form_${_?"submitting":"submitted"}`}):s.text}];return k&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:_||T,onClick:f,children:o.text||P.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:V("form",n),ref:Q},d.jsxs(d.Fragment,{children:[R!=null&&R.general?d.jsx(en,{variant:"error",text:P.formatMessage({id:"form_error_generalError"})}):null,(!E||!_&&!T||h)&&t.map((D,z)=>{const{id:J=D.name||z,component:B,functions:F={onChange:()=>{}},submitOnEnter:L=!1}=D;if(B)return d.jsx(B,{...D.props||{}},`component-${J}-${z}`);const I=N?N[J]:"",H={...F,onChange:te=>{j({type:"updateValue",payload:{key:J,value:te}}),F.onChange(te&&te.toString(),j)}};return L&&(H.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),Z()),F.onKeyDown&&F.onKeyDown(te)}),d.jsx(Uh,{intlPath:i,...D,showRequiredLabels:w,value:I,error:R==null?void 0:R[J],functions:H},J)}),y?null:(_||T)&&h?h:d.jsx(yn,{className:V("cta",{center:_||T,submitted:T}),buttons:ne})]})),A&&T&&d.jsx(yr,{className:"success",children:typeof A=="string"?A:P.formatMessage({id:"form_success"})})]})};const Mr="passwordRules_",kc="isMoreThanEightCharacters",Ac="includesNumberAndSymbol",Fc="includesLowerAndUppercase",Kh={[kc]:"8Characters",[Ac]:"numberSymbol",[Fc]:"lowercaseUppercase"},Zh=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return d.jsxs("aside",{className:V("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Mr}intro`})}),d.jsx("ul",{children:[kc,Ac,Fc].map(r=>d.jsxs("li",{className:V({matches:e[r]}),children:[d.jsxs(Le,{children:[n.formatMessage({id:`${Mr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Mr}rule_${Kh[r]}`})}),!e[r]&&d.jsxs(Le,{element:"strong",children:[" ",n.formatMessage({id:`${Mr}notMet`})]})]},`rule-${r}`))})]})},Tc=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=se.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:f,rating:m,disabled:p}=l,g="ratings_",h={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(!(!f||p))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:f,value:v})}catch(x){u(k=>({...k,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:h[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?` - ${h[x===1?"low":"high"]}`:""}`,onClick:k=>{k.preventDefault(),k.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"},Sc={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 Ir=1;Ir<20;Ir++)Os["f"+Ir]=111+Ir;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 jc(s,t)}),a=function(o){return r.some(function(l){return Oc(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 jc(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](),f;!(o=(f=c.next()).done);o=!0){var m=f.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=Ps(m),h=ri[g];if(m.length>1&&!h&&!Sc[m]&&!Os[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!h)&&(n?r.key=g:r.which=Pc(m)),h&&(r[h]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Oc(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 Pc(e){e=Ps(e);var t=Os[e]||e.toUpperCase().charCodeAt(0);return t}function Ps(e){return e=e.toLowerCase(),e=Sc[e]||e,e}var Xh=Wt.default=Ma,ai=Wt.isHotkey=Ma;Wt.isCodeHotkey=Qh;Wt.isKeyHotkey=Jh;Wt.parseHotkey=jc;Wt.compareHotkey=Oc;Wt.toKeyCode=Pc;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 Nc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Rc(e){return Rs(e,Nc)}function am(e){return Ic(e,Nc)}var Mc=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function im(e){return Rs(e,Mc)}function sm(e){return Ic(e,Mc)}function Rs(e,t){return t.indexOf(e.nodeName)>=0}function Ic(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
39
|
|
|
40
40
|
`+e+`
|
|
41
41
|
|
|
42
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=
|
|
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
44
|
|
|
45
45
|
`+e+`
|
|
46
46
|
`+a+`
|
|
47
47
|
|
|
48
48
|
`}else return`
|
|
49
49
|
|
|
50
|
-
`+
|
|
50
|
+
`+ts("#",r)+" "+e+`
|
|
51
51
|
|
|
52
52
|
`}};et.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
|
|
53
53
|
|
|
@@ -66,7 +66,7 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
66
66
|
`+t.firstChild.textContent.replace(/\n/g,`
|
|
67
67
|
`)+`
|
|
68
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=
|
|
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
70
|
|
|
71
71
|
`+c+a+`
|
|
72
72
|
`+i.replace(/\n$/,"")+`
|
|
@@ -76,13 +76,13 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
76
76
|
|
|
77
77
|
`+n.hr+`
|
|
78
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=
|
|
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=ha(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=ha(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
80
|
|
|
81
81
|
`+this.references.join(`
|
|
82
82
|
`)+`
|
|
83
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=
|
|
85
|
-
`):""}function
|
|
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=ha(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ha(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"":""}};function ha(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
85
|
+
`):""}function $c(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])}$c.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(f){return f.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:Rc,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!Rc(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 ma(e){if(!(this instanceof ma))return new ma(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
86
|
|
|
87
87
|
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
88
88
|
|
|
@@ -92,71 +92,67 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
92
92
|
|
|
93
93
|
`+n+`
|
|
94
94
|
|
|
95
|
-
`:n}};this.options=
|
|
96
|
-
|
|
97
|
-
`.substring(0,a);return n+i+r}function
|
|
98
|
-
* escape-html
|
|
99
|
-
* Copyright(c) 2012-2013 TJ Holowaychuk
|
|
100
|
-
* Copyright(c) 2015 Andreas Lubbe
|
|
101
|
-
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
|
102
|
-
* MIT Licensed
|
|
103
|
-
*/var wm=/["'&<>]/,Em=_m;function _m(e){var t=""+e,n=wm.exec(t);if(!n)return t;var r,a="",i=0,s=0;for(i=n.index;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break;default:continue}s!==i&&(a+=t.substring(s,i)),s=i+1,a+=r}return s!==i?a+t.substring(s,i):a}const Bm=tn(Em);function bt(){return bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bt.apply(this,arguments)}var jn={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 Lc(e,t){var n,r,a,i,s,o,l,u,c,f,p,h=bt({},jn,t==null?void 0:t.nodeTypes,{heading:bt({},jn.heading,t==null||(n=t.nodeTypes)===null||n===void 0?void 0:n.heading)}),g=(r=t==null?void 0:t.linkDestinationKey)!==null&&r!==void 0?r:"link",m=(a=t==null?void 0:t.imageSourceKey)!==null&&a!==void 0?a:"link",b=(i=t==null?void 0:t.imageCaptionKey)!==null&&i!==void 0?i:"caption",v=[{text:""}],x=e.children;switch(x&&Array.isArray(x)&&x.length>0&&(v=x.flatMap(function(k){return Lc(bt({},k,{ordered:e.ordered||!1}),t)})),e.type){case"heading":return{type:h.heading[e.depth||1],children:v};case"list":return{type:e.ordered?h.ol_list:h.ul_list,children:v};case"listItem":return{type:h.listItem,children:v};case"paragraph":return{type:h.paragraph,children:v};case"link":return s={type:h.link},s[g]=e.url,s.children=v,s;case"image":return o={type:h.image,children:[{text:""}]},o[m]=e.url,o[b]=e.alt,o;case"blockquote":return{type:h.block_quote,children:v};case"code":return{type:h.code_block,language:e.lang,children:[{text:e.value}]};case"html":if((l=e.value)!==null&&l!==void 0&&l.includes("<br>")){var A;return{break:!0,type:h.paragraph,children:[{text:((A=e.value)===null||A===void 0?void 0:A.replace(/<br>/g,""))||""}]}}return{type:"paragraph",children:[{text:e.value||""}]};case"emphasis":return bt((u={},u[h.emphasis_mark]=!0,u),ui(v),Lr(v));case"strong":return bt((c={},c[h.strong_mark]=!0,c),ui(v),Lr(v));case"delete":return bt((f={},f[h.delete_mark]=!0,f),ui(v),Lr(v));case"inlineCode":return bt((p={},p[h.inline_code_mark]=!0,p.text=e.value,p),Lr(v));case"thematicBreak":return{type:h.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}var ui=function(t){return{text:t.map(function(n){return n==null?void 0:n.text}).join("")}};function Lr(e){return e.reduce(function(t,n){return Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t},{})}var kn=function(t){return typeof t.text=="string"},km=["thematic_break","image"],Po="<br>";function zc(e,t){t===void 0&&(t={nodeTypes:jn});var n=t,r=n.nodeTypes,a=r===void 0?jn:r,i=n.ignoreParagraphNewline,s=i===void 0?!1:i,o=n.listDepth,l=o===void 0?0:o,u=e.text||"",c=e.type||"",f=bt({},jn,a,{heading:bt({},jn.heading,a.heading)}),p=[f.ul_list,f.ol_list],h=u;if(kn(e)||(h=e.children.map(function(x){var A=kn(x)?!1:p.includes(x.type||""),k=p.includes(e.type||""),E=!1;return!kn(e)&&Array.isArray(e.children)&&(E=e.children.some(function(B){return!kn(B)&&B.type===f.link})),zc(bt({},x,{parentType:c}),{nodeTypes:f,ignoreParagraphNewline:(s||A||k||E)&&!x.break,listDepth:p.includes(x.type||"")?l+1:l})}).join("")),!s&&(u===""||u===`
|
|
104
|
-
`)&&e.parentType===f.paragraph&&(c=f.paragraph,h=Po),!(h===""&&!km.find(function(x){return f[x]===c})))switch(h!==Po&&kn(e)&&(e.strikeThrough&&e.bold&&e.italic?h=An(h,"~~***"):e.bold&&e.italic?h=An(h,"***"):(e.bold&&(h=An(h,"**")),e.italic&&(h=An(h,"_")),e.strikeThrough&&(h=An(h,"~~")),e.code&&(h=An(h,"`")))),c){case f.heading[1]:return"# "+h+`
|
|
105
|
-
`;case f.heading[2]:return"## "+h+`
|
|
106
|
-
`;case f.heading[3]:return"### "+h+`
|
|
107
|
-
`;case f.heading[4]:return"#### "+h+`
|
|
108
|
-
`;case f.heading[5]:return"##### "+h+`
|
|
109
|
-
`;case f.heading[6]:return"###### "+h+`
|
|
110
|
-
`;case f.block_quote:return"> "+h+`
|
|
111
|
-
|
|
112
|
-
`;case f.code_block:return"```"+(e.language||"")+`
|
|
113
|
-
`+h+"\n```\n";case f.link:return"["+h+"]("+(e.link||"")+")";case f.image:return"+")";case f.ul_list:case f.ol_list:return`
|
|
114
|
-
`+h+`
|
|
115
|
-
`;case f.listItem:for(var g=e&&e.parentType===f.ol_list,m=e.children.length===1&&kn(e.children[0]),b="",v=0;l>v;v++)g?b+=" ":b+=" ";return""+b+(g?"1.":"-")+" "+h+(m?`
|
|
116
|
-
`:"");case f.paragraph:return h+`
|
|
117
|
-
`;case f.thematic_break:return`---
|
|
118
|
-
`;default:return Bm(h)}}function An(e,t){var n=e.trim(),r=n,a=""+t+r+No(t);if(r.length===e.length)return a;var i=t+r+No(t);return e.replace(n,i)}var No=function(t){return t.split("").reverse().join("")};function Am(e){var t=function(r){return r.children.map(function(a){return Lc(a,e)})};this.Compiler=t}/*!
|
|
95
|
+
`:n}};this.options=em({},t,e),this.rules=new $c(this.options)}ma.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=Lc.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 Lc(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)),zc(n,a)},"")}function xm(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=zc(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=Lc.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 zc(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))}/*!
|
|
119
98
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
120
99
|
*
|
|
121
100
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
122
101
|
* Released under the MIT License.
|
|
123
|
-
*/function Ro(e){return Object.prototype.toString.call(e)==="[object Object]"}function Je(e){var t,n;return Ro(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Ro(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var qc=Symbol.for("immer-nothing"),Mo=Symbol.for("immer-draftable"),mt=Symbol.for("immer-state"),Fm=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=Fm[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 Wn=Object.getPrototypeOf;function gn(e){return!!e&&!!e[mt]}function vn(e){var t;return e?Wc(e)||Array.isArray(e)||!!e[Mo]||!!((t=e.constructor)!=null&&t[Mo])||$a(e)||La(e):!1}var Tm=Object.prototype.constructor.toString();function Wc(e){if(!e||typeof e!="object")return!1;const t=Wn(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)===Tm}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 ts(e,t){return Ia(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hc(e,t,n){const r=Ia(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Sm(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 un(e){return e.copy_||e.base_}function ns(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&&Wc(e))return Wn(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(Wn(e),n)}function Ms(e,t=!1){return za(e)||gn(e)||!vn(e)||(Ia(e)>1&&(e.set=e.add=e.clear=e.delete=jm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ms(r,!0))),e}function jm(){lt(2)}function za(e){return Object.isFrozen(e)}var Om={};function bn(e){const t=Om[e];return t||lt(0,e),t}var Cr;function Uc(){return Cr}function Pm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Io(e,t){t&&(bn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rs(e){as(e),e.drafts_.forEach(Nm),e.drafts_=null}function as(e){e===Cr&&(Cr=e.parent_)}function $o(e){return Cr=Pm(Cr,e)}function Nm(e){const t=e[mt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Lo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[mt].modified_&&(rs(t),lt(4)),vn(e)&&(e=va(t,e),t.parent_||ba(t,e)),t.patches_&&bn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=va(t,n,[]),rs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==qc?e:void 0}function va(e,t,n){if(za(t))return t;const r=t[mt];if(!r)return ga(t,(a,i)=>zo(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)=>zo(e,r,a,o,l,n,s)),ba(e,a,!1),n&&e.patches_&&bn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function zo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&<(5),gn(a)){const o=i&&t&&t.type_!==3&&!ts(t.assigned_,r)?i.concat(r):void 0,l=va(e,a,o);if(Hc(n,r,l),gn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(vn(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_&&Ms(t,n)}function Rm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Uc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Is;n&&(a=[r],i=xr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Is={get(e,t){if(t===mt)return e;const n=un(e);if(!ts(n,t))return Mm(e,n,t);const r=n[t];return e.finalized_||!vn(r)?r:r===li(e.base_,t)?(ci(e),e.copy_[t]=ss(r,e)):r},has(e,t){return t in un(e)},ownKeys(e){return Reflect.ownKeys(un(e))},set(e,t,n){const r=Vc(un(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=li(un(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(Sm(n,a)&&(n!==void 0||ts(e.base_,t)))return!0;ci(e),is(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 li(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ci(e),is(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=un(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 Wn(e.base_)},setPrototypeOf(){lt(12)}},xr={};ga(Is,(e,t)=>{xr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});xr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&<(13),xr.set.call(this,e,t,void 0)};xr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&<(14),Is.set.call(this,e[0],t,n,e[0])};function li(e,t){const n=e[mt];return(n?un(n):e)[t]}function Mm(e,t,n){var a;const r=Vc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Vc(e,t){if(!(t in e))return;let n=Wn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Wn(n)}}function is(e){e.modified_||(e.modified_=!0,e.parent_&&is(e.parent_))}function ci(e){e.copy_||(e.copy_=ns(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Im=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(vn(t)){const i=$o(this),s=ss(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?rs(i):as(i)}return Io(i,r),Lo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===qc&&(a=void 0),this.autoFreeze_&&Ms(a,!0),r){const i=[],s=[];bn("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){vn(e)||lt(8),gn(e)&&(e=$m(e));const t=$o(this),n=ss(e,void 0);return n[mt].isManual_=!0,as(t),n}finishDraft(e,t){const n=e&&e[mt];(!n||!n.isManual_)&<(9);const{scope_:r}=n;return Io(r,t),Lo(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=bn("Patches").applyPatches_;return gn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ss(e,t){const n=$a(e)?bn("MapSet").proxyMap_(e,t):La(e)?bn("MapSet").proxySet_(e,t):Rm(e,t);return(t?t.scope_:Uc()).drafts_.push(n),n}function $m(e){return gn(e)||lt(10,e),Kc(e)}function Kc(e){if(!vn(e)||za(e))return e;const t=e[mt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ns(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ns(e,!0);return ga(n,(r,a)=>{Hc(n,r,Kc(a))}),t&&(t.finalized_=!1),n}var pt=new Im,$s=pt.produce;pt.produceWithPatches.bind(pt);pt.setAutoFreeze.bind(pt);pt.setUseStrictShallowCopy.bind(pt);pt.applyPatches.bind(pt);var qo=pt.createDraft.bind(pt),Wo=pt.finishDraft.bind(pt),Lm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=j.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},zm={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()}}},qm={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,fr=new WeakMap,Zc=new WeakMap,Ho=new WeakMap,Uo=new WeakMap,Vo=new WeakMap,j={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=j.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 j.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return j.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 j.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 j.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&j.compare(e,t)===0},isBefore(e,t){return j.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&j.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&j.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&j.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&j.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&&j.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(!j.isAncestor(t,e)&&!j.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;(j.equals(i,r)||j.endsBefore(i,r)||j.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(j.equals(s,r)||j.isAncestor(s,r))return null;j.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;j.equals(o,r)||j.endsBefore(o,r)?r[o.length-1]-=1:j.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(j.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else j.endsBefore(u,r)?r[u.length-1]+=1:j.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:f,newPath:p}=t;if(j.equals(f,p))return r;if(j.isAncestor(f,r)||j.equals(f,r)){var h=p.slice();return j.endsBefore(f,p)&&f.length<p.length&&(h[f.length-1]-=1),h.concat(r.slice(f.length))}else j.isSibling(f,p)&&(j.isAncestor(p,r)||j.equals(p,r))?j.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:j.endsBefore(p,r)||j.equals(p,r)||j.isAncestor(p,r)?(j.endsBefore(f,r)&&(r[f.length-1]-=1),r[p.length-1]+=1):j.endsBefore(f,r)&&(j.equals(p,r)&&(r[p.length-1]+=1),r[f.length-1]-=1);break}}return r}};function wr(e){"@babel/helpers - typeof";return wr=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},wr(e)}function Wm(e,t){if(wr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(wr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hm(e){var t=Wm(e,"string");return wr(t)==="symbol"?t:String(t)}function it(e,t,n){return t=Hm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 rr(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 Um=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=se.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:f}=n;if(f.length===0)break;var p=se.leaf(e,u),h=p.text.slice(0,c),g=p.text.slice(c);if(p.text=h+f+g,t)for(var[m,b]of W.points(t))t[b]=Ce.transform(m,n);break}case"merge_node":{var{path:v}=n,x=se.get(e,v),A=j.previous(v),k=se.get(e,A),E=se.parent(e,v),B=v[v.length-1];if(de.isText(x)&&de.isText(k))k.text+=x.text;else if(!de.isText(x)&&!de.isText(k))k.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(k)));if(E.children.splice(B,1),t)for(var[P,z]of W.points(t))t[z]=Ce.transform(P,n);break}case"move_node":{var{path:I,newPath:N}=n;if(j.isAncestor(I,N))throw new Error("Cannot move a path [".concat(I,"] to new path [").concat(N,"] because the destination is inside itself."));var O=se.get(e,I),w=se.parent(e,I),T=I[I.length-1];w.children.splice(T,1);var R=j.transform(I,n),M=se.get(e,j.parent(R)),K=R[R.length-1];if(M.children.splice(K,0,O),t)for(var[V,ie]of W.points(t))t[ie]=Ce.transform(V,n);break}case"remove_node":{var{path:Q}=n,D=Q[Q.length-1],U=se.parent(e,Q);if(U.children.splice(D,1),t)for(var[X,_]of W.points(t)){var F=Ce.transform(X,n);if(t!=null&&F!=null)t[_]=F;else{var L=void 0,$=void 0;for(var[q,ne]of se.texts(e))if(j.compare(ne,Q)===-1)L=[q,ne];else{$=[q,ne];break}var te=!1;L&&$&&(j.equals($[1],Q)?te=!j.hasPrevious($[1]):te=j.common(L[1],Q).length<j.common($[1],Q).length),L&&!te?(X.path=L[1],X.offset=L[0].text.length):$?(X.path=$[1],X.offset=0):t=null}}break}case"remove_text":{var{path:Z,offset:le,text:J}=n;if(J.length===0)break;var be=se.leaf(e,Z),pe=be.text.slice(0,le),_e=be.text.slice(le+J.length);if(be.text=pe+_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=se.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 $e in Ke)Ze.hasOwnProperty($e)||delete tt[$e];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=rr({},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:me,position:De,properties:Ue}=n;if(me.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(me,"] because the root node cannot be split."));var Ve=se.get(e,me),ft=se.parent(e,me),Nt=me[me.length-1],wt;if(de.isText(Ve)){var Qe=Ve.text.slice(0,De),Bt=Ve.text.slice(De);Ve.text=Qe,wt=rr(rr({},Ue),{},{text:Bt})}else{var ht=Ve.children.slice(0,De),Ga=Ve.children.slice(De);Ve.children=ht,wt=rr(rr({},Ue),{},{children:Ga})}if(ft.children.splice(Nt+1,0,wt),t)for(var[er,Pr]of W.points(t))t[Pr]=Ce.transform(er,n);break}}return t},Vm={transform(e,t){e.children=qo(e.children);var n=e.selection&&qo(e.selection);try{n=Um(e,n,t)}finally{e.children=Wo(e.children),n?e.selection=gn(n)?Wo(n):n:e.selection=null}}},Km={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)}},Zm={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)}},Yc=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!Yc(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 Ym(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=Ym(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 Gm=["anchor","focus"];function Zo(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 Qm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zo(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=j.compare(t,s.path)>=0,u=j.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=qt(e,Gm),[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:Qm({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 $s(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})}},Yo=e=>Je(e)&&se.isNodeList(e.children)&&!y.isEditor(e),ce={isAncestor(e){return Je(e)&&se.isNodeList(e.children)},isElement:Yo,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 Yo(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Jm=["children"],Xm=["text"],Go=new WeakMap,se={ancestor(e,t){var n=se.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 j.ancestors(t,n)){var a=se.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=se.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=se.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=j.common(t,n),a=se.get(e,r);return[a,r]},descendant(e,t){var n=se.get(e,t);if(y.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 se.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 se.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=qt(e,Jm);return t}else{var t=qt(e,Xm);return t}},first(e,t){for(var n=t.slice(),r=se.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=$s({children:e.children},r=>{var[a,i]=W.edges(t),s=se.nodes(r,{reverse:!0,pass:p=>{var[,h]=p;return!W.includes(t,h)}});for(var[,o]of s){if(!W.includes(t,o)){var l=se.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(j.equals(o,i.path)){var c=se.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(j.equals(o,a.path)){var f=se.leaf(r,o);f.text=f.text.slice(a.offset)}}y.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)||y.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Go.get(e);if(t!==void 0)return t;var n=e.every(r=>se.isNode(r));return Go.set(e,n),n},last(e,t){for(var n=t.slice(),r=se.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=se.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 j.levels(t,n)){var a=se.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?j.isBefore(o,i):j.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;j.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=se.get(e,o);continue}if(o.length===0)break;if(!r){var c=j.next(o);if(se.has(e,c)){o=c,l=se.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=j.previous(o);o=f,l=se.get(e,o);continue}o=j.parent(o),l=se.get(e,o),s.add(l)}}()},parent(e,t){var n=j.parent(t),r=se.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(se.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function Qo(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?Qo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qo(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 j.isPath(e.path)&&se.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&j.isPath(e.path);case"merge_node":return typeof e.position=="number"&&j.isPath(e.path)&&Je(e.properties);case"move_node":return j.isPath(e.path)&&j.isPath(e.newPath);case"remove_node":return j.isPath(e.path)&&se.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&j.isPath(e.path);case"set_node":return j.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 j.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:j.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(j.equals(t,n))return e;if(j.isSibling(n,t))return Re(Re({},e),{},{path:t,newPath:n});var r=j.transform(n,e),a=j.transform(j.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:j.next(e.path)})}}},Jo=new WeakMap,ep=e=>{var t=Jo.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))&&se.isNodeList(e.children)&&Yt.isOperationList(e.operations);return Jo.set(e,n),n},y={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 ep(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)}},tp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(j.isPath)}};function Xo(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 eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ce={compare(e,t){var n=j.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&&j.equals(e.path,t.path)},isPoint(e){return Je(e)&&typeof e.offset=="number"&&j.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $s(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=j.transform(i,t,n);break}case"insert_text":{j.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{j.equals(t.path,i)&&(r.offset+=t.position),r.path=j.transform(i,t,n);break}case"remove_text":{j.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(j.equals(t.path,i)||j.isAncestor(t.path,i))return null;r.path=j.transform(i,t,n);break}case"split_node":{if(j.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=j.transform(i,t,eu(eu({},n),{},{affinity:"forward"})))}else r.path=j.transform(i,t,n);break}}})}},tu=void 0,Ye={setScrubber(e){tu=e},stringify(e){return JSON.stringify(e,tu)}},np=["text"],rp=["anchor","focus"];function nu(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 Mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nu(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,np);return s}return Yc(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=[Mt({},e)];for(var r of t){var a=qt(r,rp),[i,s]=W.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var f of n){var{length:p}=f.text,h=l;if(l+=p,u<=h&&l<=c){Object.assign(f,a),o.push(f);continue}if(u!==c&&(u===l||c===h)||u>l||c<h||c===h&&h!==0){o.push(f);continue}var g=f,m=void 0,b=void 0;if(c<l){var v=c-h;b=Mt(Mt({},g),{},{text:g.text.slice(v)}),g=Mt(Mt({},g),{},{text:g.text.slice(0,v)})}if(u>h){var x=u-h;m=Mt(Mt({},g),{},{text:g.text.slice(0,x)}),g=Mt(Mt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),m&&o.push(m),o.push(g),b&&o.push(b)}n=o}return n}},Ls=e=>e.selection?e.selection:e.children.length>0?y.end(e,[]):[0],Jn=(e,t)=>{var[n]=y.node(e,t);return r=>r===n},zs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?lp(t):t,i=ye.None,s=ye.None,o=0,l=null,u=null;for(var c of a){var f=c.codePointAt(0);if(!f)break;var p=Cp(c,f);if([i,s]=r?[s,p]:[p,i],On(i,ye.ZWJ)&&On(s,ye.ExtPict)&&(r?l=ru(t.substring(0,o)):l=ru(t.substring(0,t.length-o)),!l)||On(i,ye.RI)&&On(s,ye.RI)&&(u!==null?u=!u:r?u=!0:u=Bp(t.substring(0,t.length-o)),!u)||i!==ye.None&&s!==ye.None&&wp(i,s))break;o+=c.length}return o||1},ap=/\s/,ip=/[\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]/,sp=/['\u2018\u2019]/,op=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=zs(t,n),[s,o]=qs(t,i,n);if(up(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},qs=(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)]},up=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(ap.test(t))return!1;if(sp.test(t)){var a=zs(n,r),[i,s]=qs(n,a,r);if(e(i,s,r))return!0}return!ip.test(t)},lp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(dp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(cp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},cp=e=>e>=55296&&e<=56319,dp=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 fp=/^(?:[\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])$/,hp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,mp=/^(?:[\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])$/,pp=/^[\u1100-\u115F\uA960-\uA97C]$/,gp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,vp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,bp=/^[\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]$/,yp=/^[\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]$/,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])$/,Cp=(e,t)=>{var n=ye.Any;return e.search(fp)!==-1&&(n|=ye.Extend),t===8205&&(n|=ye.ZWJ),t>=127462&&t<=127487&&(n|=ye.RI),e.search(hp)!==-1&&(n|=ye.Prepend),e.search(mp)!==-1&&(n|=ye.SpacingMark),e.search(pp)!==-1&&(n|=ye.L),e.search(gp)!==-1&&(n|=ye.V),e.search(vp)!==-1&&(n|=ye.T),e.search(bp)!==-1&&(n|=ye.LV),e.search(yp)!==-1&&(n|=ye.LVT),e.search(Dp)!==-1&&(n|=ye.ExtPict),n};function On(e,t){return(e&t)!==0}var xp=[[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 wp(e,t){return xp.findIndex(n=>On(e,n[0])&&On(t,n[1]))===-1}var Ep=/(?:[\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$/,ru=e=>e.search(Ep)!==-1,_p=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Bp=e=>{var t=e.match(_p);if(t===null)return!1;var n=t[0].length/2;return n%2===1},kp={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]:{};y.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Ls(e)}=n;if(j.isPath(a)&&(a=y.range(e,a)),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var i=W.end(a);if(!r&&y.void(e,{at:i}))return;var s=W.start(a),o=y.pointRef(e,s),l=y.pointRef(e,i);ee.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,ee.setSelection(e,{anchor:a,focus:a})}if(!(!r&&y.void(e,{at:a})||y.elementReadOnly(e,{at:a}))){var{path:f,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:p,text:t})}})}};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 zr(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 ee=zr(zr(zr(zr({},Vm),Km),Zm),kp),aa=new WeakMap,Ap=e=>aa.get(e)||!1,Fp=(e,t,n)=>{var r=aa.get(e)||!1;aa.set(e,!0);try{t(),n()}finally{aa.set(e,r)}};function Gc(e,t,n){var r=ya.get(e)||[],a=Da.get(e)||new Set,i,s,o=f=>{if(f){var p=f.join(",");s.has(p)||(s.add(p),i.push(f))}};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 Tp=(e,t)=>{for(var n of y.pathRefs(e))Lm.transform(n,t);for(var r of y.pointRefs(e))zm.transform(r,t);for(var a of y.rangeRefs(e))qm.transform(a,t);if(!Ap(e)){var i=j.operationCanTransformPath(t)?s=>j.transform(s,t):void 0;Gc(e,e.getDirtyPaths(t),i)}ee.transform(e,t),e.operations.push(t),y.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),fr.get(e)||(fr.set(e,!0),Promise.resolve().then(()=>{fr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Sp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return j.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=j.levels(a),s=de.isText(r)?[]:Array.from(se.nodes(r),N=>{var[,O]=N;return a.concat(O)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=j.ancestors(o),u=j.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:f}=t;if(j.equals(c,f))return[];var p=[],h=[];for(var g of j.ancestors(c)){var m=j.transform(g,t);p.push(m)}for(var b of j.ancestors(f)){var v=j.transform(b,t);h.push(v)}var x=h[h.length-1],A=f[f.length-1],k=x.concat(A);return[...p,...h,k]}case"remove_node":{var{path:E}=t,B=j.ancestors(E);return[...B]}case"split_node":{var{path:P}=t,z=j.levels(P),I=j.next(P);return[...z,I]}default:return[]}},jp=e=>{var{selection:t}=e;return t?se.fragment(e,t):[]},Op=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};ee.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=y.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=se.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],f=o===n.children.length-1,p=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(p!==i)ee.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 h={text:""};ee.insertNodes(e,h,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};ee.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(ee.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(ee.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Pp=(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},Np=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=y.path(t,i),l=a==="lowest";for(var[u,c]of y.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(W.isRange(i)){if(j.isAncestor(c,i.anchor.path)&&j.isAncestor(c,i.focus.path))return[u,c]}else if(!j.equals(o,c))return[u,c]}}};function iu(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 su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?iu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,p)=>{if(!de.isText(f))return!1;var[h,g]=y.parent(e,p);return!e.isVoid(h)||e.markableVoid(h)},i=W.isExpanded(r),s=!1;if(!i){var[o,l]=y.node(e,r);if(o&&a(o,l)){var[u]=y.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)ee.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=su(su({},y.marks(e)||{}),{},{[t]:n});e.marks=c,fr.get(e)||e.onChange()}}};function ou(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 uu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Mp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.point(t,n,{edge:"end"}),i=y.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of y.positions(t,uu(uu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function lu(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 cu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ip=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.start(t,[]),i=y.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of y.positions(t,cu(cu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},$p=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},Lp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&ee.delete(e,{unit:t})},zp=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&W.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},qp=(e,t)=>[y.start(e,t),y.end(e,t)];function du(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 fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(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 y.above(t,fu(fu({},n),{},{match:r=>ce.isElement(r)&&y.isElementReadOnly(t,r)}))},Hp=(e,t)=>y.point(e,t,{edge:"end"}),Up=(e,t)=>{var n=y.path(e,t,{edge:"start"});return y.node(e,n)},Vp=(e,t)=>{var n=y.range(e,t);return se.fragment(e,n)};function hu(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 mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return y.above(t,mu(mu({},n),{},{match:r=>ce.isElement(r)&&y.isVoid(t,r)}))},Zp=(e,t)=>t.children.some(n=>ce.isElement(n)&&y.isBlock(e,n)),Yp=(e,t)=>t.children.some(n=>de.isText(n)||y.isInline(e,n)),Gp=(e,t)=>se.has(e,t),Qp=(e,t)=>t.children.every(n=>de.isText(n)),Jp=e=>{ee.splitNodes(e,{always:!0})},Xp=(e,t,n)=>{ee.insertNodes(e,t,n)},eg=e=>{ee.splitNodes(e,{always:!0})};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 tg(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 ng=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=tg({text:n},i);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},rg=(e,t)=>!e.isInline(t),ag=(e,t,n)=>y.isStart(e,t,n)||y.isEnd(e,t,n),ig=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},sg=(e,t,n)=>{var r=y.end(e,n);return Ce.equals(t,r)},og=e=>{var t=Zc.get(e);return t===void 0?!0:t},ug=(e,t,n)=>{if(t.offset!==0)return!1;var r=y.start(e,n);return Ce.equals(t,r)},lg=(e,t)=>{var n=y.path(e,t,{edge:"end"});return y.node(e,n)},cg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=se.leaf(t,a);return[i,a]};function dg(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=y.path(e,n);for(var[l,u]of se.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&y.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var fg=["text"],hg=["text"],mg=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=y.isEnd(t,a,a.path);if(s){var o=y.after(t,a);o&&(a=o)}var[l]=y.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=qt(u,fg);return c}else return{}}var{path:f}=a,[p]=y.leaf(t,f);if(a.offset===0){var h=y.previous(t,{at:f,match:de.isText}),g=y.above(t,{match:k=>ce.isElement(k)&&y.isVoid(t,k)&&t.markableVoid(k)});if(!g){var m=y.above(t,{match:k=>ce.isElement(k)&&y.isBlock(t,k)});if(h&&m){var[b,v]=h,[,x]=m;j.isAncestor(x,v)&&(p=b)}}}var A=qt(p,hg);return A},pg=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=y.after(t,s,{voids:a});if(o){var[,l]=y.last(t,[]),u=[o.path,l];if(j.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(j.isPath(s)){var[c]=y.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[f]=y.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},gg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=se.get(t,a);return[i,a]};function vg(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(tp.isSpan(n))u=n[0],c=n[1];else{var f=y.path(e,n,{edge:"start"}),p=y.path(e,n,{edge:"end"});u=i?p:f,c=i?f:p}var h=se.nodes(e,{reverse:i,from:u,to:c,pass:k=>{var[E]=k;return ce.isElement(E)?!!(!s&&(y.isVoid(e,E)||y.isElementReadOnly(e,E))||o&&!y.isSelectable(e,E)):!1}}),g=[],m;for(var[b,v]of h)if(!(o&&ce.isElement(b)&&!y.isSelectable(e,b))){var x=m&&j.compare(v,m[1])===0;if(!(r==="highest"&&x)){if(!l(b,v)){if(a&&!x&&de.isText(b))return;continue}if(r==="lowest"&&x){m=[b,v];continue}var A=r==="lowest"?m:[b,v];A&&(a?g.push(A):yield A),m=[b,v]}}r==="lowest"&&m&&(a?g.push(m):yield m),a&&(yield*g)}}()}var bg=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 f=i(c).pop(),p=f.join(",");return s(c).delete(p),f};if(y.isNormalizing(t)){if(r){var l=Array.from(se.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));ya.set(t,l),Da.set(t,u)}i(t).length!==0&&y.withoutNormalizing(t,()=>{for(var c of i(t))if(se.has(t,c)){var f=y.node(t,c),[p,h]=f;ce.isElement(p)&&p.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),m=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:m,operation:a}))return;var v=o(t);if(se.has(t,v)){var x=y.node(t,v);t.normalizeNode(x,{operation:a})}b++,g=i(t)}})}},yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=j.parent(a),s=y.node(t,i);return s},Dg=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=y.pathRefs(t);return l.delete(i),i.current=null,o}},s=y.pathRefs(t);return s.add(i),i},Cg=e=>{var t=Ho.get(e);return t||(t=new Set,Ho.set(e,t)),t},xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(j.isPath(n)){if(i==="start"){var[,s]=se.first(t,n);n=s}else if(i==="end"){var[,o]=se.last(t,n);n=o}}return W.isRange(n)&&(i==="start"?n=W.start(n):i==="end"?n=W.end(n):n=j.common(n.anchor.path,n.focus.path)),Ce.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},wg=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=y.pointRefs(t);return l.delete(i),i.current=null,o}},s=y.pointRefs(t);return s.add(i),i},Eg=e=>{var t=Uo.get(e);return t||(t=new Set,Uo.set(e,t)),t},_g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(j.isPath(n)){var i;if(a==="end"){var[,s]=se.last(t,n);i=s}else{var[,o]=se.first(t,n);i=o}var l=se.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 Bg(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=y.range(e,n),[l,u]=W.edges(o),c=a?u:l,f=!1,p="",h=0,g=0,m=0;for(var[b,v]of y.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield y.start(e,v);continue}if(e.isInline(b))continue;if(y.hasInlines(e,b)){var x=j.isAncestor(v,u.path)?u:y.end(e,v),A=j.isAncestor(v,l.path)?l:y.start(e,v);p=y.string(e,{anchor:A,focus:x},{voids:i}),f=!0}}if(de.isText(b)){var k=j.equals(v,c.path);for(k?(g=a?c.offset:b.text.length-c.offset,m=c.offset):(g=b.text.length,m=a?g:0),(k||f||r==="offset")&&(yield{path:v,offset:m},f=!1);;){if(h===0){if(p==="")break;h=E(p,r,a),p=qs(p,h,a)[1]}if(m=a?m-h:m+h,g=g-h,g<0){h=-g;break}h=0,yield{path:v,offset:m}}}}function E(B,P,z){return P==="character"?zs(B,z):P==="word"?op(B,z):P==="line"||P==="block"?B.length:1}}()}var kg=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=y.before(t,s,{voids:a});if(o){var[,l]=y.first(t,[]),u=[o.path,l];if(j.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(j.isPath(s)){var[c]=y.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[f]=y.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},Ag=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=y.rangeRefs(t);return l.delete(i),i.current=null,o}},s=y.rangeRefs(t);return s.add(i),i},Fg=e=>{var t=Vo.get(e);return t||(t=new Set,Vo.set(e,t)),t},Tg=(e,t,n)=>{if(W.isRange(t)&&!n)return t;var r=y.start(e,t),a=y.end(e,n||t);return{anchor:r,focus:a}};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 Sg(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 jg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,f)=>{if(!de.isText(c))return!1;var[p,h]=y.parent(e,f);return!e.isVoid(p)||e.markableVoid(p)},a=W.isExpanded(n),i=!1;if(!a){var[s,o]=y.node(e,n);if(s&&r(s,o)){var[l]=y.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Sg({},y.marks(e)||{});delete u[t],e.marks=u,fr.get(e)||e.onChange()}}},Og=(e,t)=>{Zc.set(e,t)},Pg=(e,t)=>y.point(e,t,{edge:"start"}),Ng=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=y.range(t,n),[s,o]=W.edges(i),l="";for(var[u,c]of y.nodes(t,{at:i,match:de.isText,voids:a})){var f=u.text;j.equals(c,o.path)&&(f=f.slice(0,o.offset)),j.equals(c,s.path)&&(f=f.slice(s.offset)),l+=f}return l},Rg=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)||j.hasPrevious(s.path))return n;var o=y.above(t,{at:s,match:g=>ce.isElement(g)&&y.isBlock(t,g),voids:a}),l=o?o[1]:[],u=y.start(t,i),c={anchor:u,focus:s},f=!0;for(var[p,h]of y.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(p.text!==""||j.isBefore(h,l)){s={path:h,offset:p.text.length};break}}return{anchor:i,focus:s}},Mg=(e,t)=>{var n=y.isNormalizing(e);y.setNormalizing(e,!1);try{t()}finally{y.setNormalizing(e,n)}y.normalize(e)},Ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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 f=!1;if(W.isRange(u)&&W.isCollapsed(u)&&(f=!0,u=u.anchor),Ce.isPoint(u)){var p=y.void(t,{at:u,mode:"highest"});if(!l&&p){var[,h]=p;u=h}else{var g={unit:s,distance:o},m=i?y.before(t,u,g)||y.start(t,[]):y.after(t,u,g)||y.end(t,[]);u={anchor:u,focus:m},c=!0}}if(j.isPath(u)){ee.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,b]=W.edges(u),v=y.end(t,[]);Ce.equals(b,v)||(u=y.unhangRange(t,u,{voids:l}))}var[x,A]=W.edges(u),k=y.above(t,{match:pe=>ce.isElement(pe)&&y.isBlock(t,pe),at:x,voids:l}),E=y.above(t,{match:pe=>ce.isElement(pe)&&y.isBlock(t,pe),at:A,voids:l}),B=k&&E&&!j.equals(k[1],E[1]),P=j.equals(x.path,A.path),z=l?null:(r=y.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:y.elementReadOnly(t,{at:x,mode:"highest"}),I=l?null:(a=y.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:y.elementReadOnly(t,{at:A,mode:"highest"});if(z){var N=y.before(t,x);N&&k&&j.isAncestor(k[1],N.path)&&(x=N)}if(I){var O=y.after(t,A);O&&E&&j.isAncestor(E[1],O.path)&&(A=O)}var w=[],T;for(var R of y.nodes(t,{at:u,voids:l})){var[M,K]=R;T&&j.compare(K,T)===0||(!l&&ce.isElement(M)&&(y.isVoid(t,M)||y.isElementReadOnly(t,M))||!j.isCommon(K,x.path)&&!j.isCommon(K,A.path))&&(w.push(R),T=K)}var V=Array.from(w,pe=>{var[,_e]=pe;return y.pathRef(t,_e)}),ie=y.pointRef(t,x),Q=y.pointRef(t,A),D="";if(!P&&!z){var U=ie.current,[X]=y.leaf(t,U),{path:_}=U,{offset:F}=x,L=X.text.slice(F);L.length>0&&(t.apply({type:"remove_text",path:_,offset:F,text:L}),D=L)}if(V.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>ee.removeNodes(t,{at:pe,voids:l})),!I){var $=Q.current,[q]=y.leaf(t,$),{path:ne}=$,te=P?x.offset:0,Z=q.text.slice(te,A.offset);Z.length>0&&(t.apply({type:"remove_text",path:ne,offset:te,text:Z}),D=Z)}!P&&B&&Q.current&&ie.current&&ee.mergeNodes(t,{at:Q.current,hanging:!0,voids:l}),f&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,D.slice(0,D.length-o));var le=ie.unref(),J=Q.unref(),be=i?le||J:J||le;n.at==null&&be&&ee.select(t,be)}}})},$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Ls(t),batchDirty:o=!0}=r;if(n.length){if(W.isRange(s))if(a||(s=y.unhangRange(t,s,{voids:i})),W.isCollapsed(s))s=s.anchor;else{var[,l]=W.edges(s);if(!i&&y.void(t,{at:l}))return;var u=y.pointRef(t,l);ee.delete(t,{at:s}),s=u.unref()}else j.isPath(s)&&(s=y.start(t,s));if(!(!i&&y.void(t,{at:s}))){var c=y.above(t,{at:s,match:L=>ce.isElement(L)&&y.isInline(t,L),mode:"highest",voids:i});if(c){var[,f]=c;if(y.isEnd(t,s,f)){var p=y.after(t,f);s=p}else if(y.isStart(t,s,f)){var h=y.before(t,f);s=h}}var g=y.above(t,{match:L=>ce.isElement(L)&&y.isBlock(t,L),at:s,voids:i}),[,m]=g,b=y.isStart(t,s,m),v=y.isEnd(t,s,m),x=b&&v,A=!b||b&&v,k=!v,[,E]=se.first({children:n},[]),[,B]=se.last({children:n},[]),P=[],z=L=>{var[$,q]=L,ne=q.length===0;return ne?!1:x?!0:!(A&&j.isAncestor(q,E)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($)||k&&j.isAncestor(q,B)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var I of se.nodes({children:n},{pass:z}))z(I)&&P.push(I);var N=[],O=[],w=[],T=!0,R=!1;for(var[M]of P)ce.isElement(M)&&!t.isInline(M)?(T=!1,R=!0,O.push(M)):T?N.push(M):w.push(M);var[K]=y.nodes(t,{at:s,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i}),[,V]=K,ie=y.isStart(t,s,V),Q=y.isEnd(t,s,V),D=y.pathRef(t,v&&!w.length?j.next(m):m),U=y.pathRef(t,Q?j.next(V):V);ee.splitNodes(t,{at:s,match:L=>R?ce.isElement(L)&&y.isBlock(t,L):de.isText(L)||y.isInline(t,L),mode:R?"lowest":"highest",always:R&&(!b||N.length>0)&&(!v||w.length>0),voids:i});var X=y.pathRef(t,!ie||ie&&Q?j.next(V):V);if(ee.insertNodes(t,N,{at:X.current,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),x&&!N.length&&O.length&&!w.length&&ee.delete(t,{at:m,voids:i}),ee.insertNodes(t,O,{at:D.current,match:L=>ce.isElement(L)&&y.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),ee.insertNodes(t,w,{at:U.current,match:L=>de.isText(L)||y.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(w.length>0&&U.current?_=j.previous(U.current):O.length>0&&D.current?_=j.previous(D.current):X.current&&(_=j.previous(X.current)),_){var F=y.end(t,_);ee.select(t,F)}}X.unref(),D.unref(),U.unref()}}})},Lg=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")ee.select(t,a.anchor);else if(r==="focus")ee.select(t,a.focus);else if(r==="start"){var[i]=W.edges(a);ee.select(t,i)}else if(r==="end"){var[,s]=W.edges(a);ee.select(t,s)}}else return},zg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},qg=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},f={};if(o==null||o==="anchor"){var p=s?y.before(t,l,c):y.after(t,l,c);p&&(f.anchor=p)}if(o==null||o==="focus"){var h=s?y.before(t,u,c):y.after(t,u,c);h&&(f.focus=h)}ee.setSelection(t,f)}},Wg=(e,t)=>{var{selection:n}=e;if(t=y.range(e,t),n){ee.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 vu(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 bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hg=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;ee.setSelection(t,{[i==="anchor"?"anchor":"focus"]:bu(bu({},l),n)})}},Ug=(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})}},Vg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(se.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=Ls(t),c!==!1&&(c=!0)),c==null&&(c=!1),W.isRange(l))if(a||(l=y.unhangRange(t,l,{voids:i})),W.isCollapsed(l))l=l.anchor;else{var[,p]=W.edges(l),h=y.pointRef(t,p);ee.delete(t,{at:l}),l=h.unref()}if(Ce.isPoint(l)){u==null&&(de.isText(f)?u=N=>de.isText(N):t.isInline(f)?u=N=>de.isText(N)||y.isInline(t,N):u=N=>ce.isElement(N)&&y.isBlock(t,N));var[g]=y.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,m]=g,b=y.pathRef(t,m),v=y.isEnd(t,l,m);ee.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=b.unref();l=v?j.next(x):x}else return}var A=j.parent(l),k=l[l.length-1];if(!(!i&&y.void(t,{at:A}))){if(o){var E=[],B=j.levels(A);Fp(t,()=>{var N=function(){var T=A.concat(k);k++;var R={type:"insert_node",path:T,node:O};t.apply(R),l=j.next(l),E.push(R),de.isText?B.push(...Array.from(se.nodes(O),M=>{var[,K]=M;return T.concat(K)})):B.push(T)};for(var O of n)N()},()=>{Gc(t,B,N=>{var O=N;for(var w of E)if(j.operationCanTransformPath(w)&&(O=j.transform(O,w),!O))return null;return O})})}else for(var P of n){var z=A.concat(k);k++,t.apply({type:"insert_node",path:z,node:P}),l=j.next(l)}if(l=j.previous(l),c){var I=y.end(t,l);I&&ee.select(t,I)}}}})},Kg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=j.isPath(r)?Jn(t,r):k=>ce.isElement(k)&&y.isBlock(t,k)),!!r){var o=y.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,k=>{var[,E]=k;return y.pathRef(t,E)});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 f=y.node(t,j.parent(c)),[p,h]=f,g=c[c.length-1],{length:m}=p.children;if(m===1){var b=j.next(h);ee.moveNodes(t,{at:c,to:b,voids:i}),ee.removeNodes(t,{at:h,voids:i})}else if(g===0)ee.moveNodes(t,{at:c,to:h,voids:i});else if(g===m-1){var v=j.next(h);ee.moveNodes(t,{at:c,to:v,voids:i})}else{var x=j.next(c),A=j.next(h);ee.splitNodes(t,{at:x,voids:i}),ee.moveNodes(t,{at:c,to:A,voids:i})}}}})},Zg=["text"],Yg=["children"],Qc=(e,t)=>{if(ce.isElement(t)){var n=t;return y.isVoid(e,t)?!0:n.children.length===1?Qc(e,n.children[0]):!1}else return!y.isEditor(t)},Gg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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(j.isPath(a)){var[l]=y.parent(t,a);r=N=>l.children.includes(N)}else r=N=>ce.isElement(N)&&y.isBlock(t,N);if(!i&&W.isRange(a)&&(a=y.unhangRange(t,a,{voids:s})),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var[,u]=W.edges(a),c=y.pointRef(t,u);ee.delete(t,{at:a}),a=c.unref(),n.at==null&&ee.select(t,a)}var[f]=y.nodes(t,{at:a,match:r,voids:s,mode:o}),p=y.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!p)){var[h,g]=f,[m,b]=p;if(!(g.length===0||b.length===0)){var v=j.next(b),x=j.common(g,b),A=j.isSibling(g,b),k=Array.from(y.levels(t,{at:g}),N=>{var[O]=N;return O}).slice(x.length).slice(0,-1),E=y.above(t,{at:g,mode:"highest",match:N=>k.includes(N)&&Qc(t,N)}),B=E&&y.pathRef(t,E[1]),P,z;if(de.isText(h)&&de.isText(m)){var I=qt(h,Zg);z=m.text.length,P=I}else if(ce.isElement(h)&&ce.isElement(m)){var I=qt(h,Yg);z=m.children.length,P=I}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(h)," ").concat(Ye.stringify(m)));A||ee.moveNodes(t,{at:g,to:v,voids:s}),B&&ee.removeNodes(t,{at:B.current,voids:s}),ce.isElement(m)&&y.isEmpty(t,m)||de.isText(m)&&m.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:z,properties:P}),B&&B.unref()}}}})},Qg=(e,t)=>{y.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=j.isPath(r)?Jn(e,r):h=>ce.isElement(h)&&y.isBlock(e,h));var o=y.pathRef(e,n),l=y.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,h=>{var[,g]=h;return y.pathRef(e,g)});for(var c of u){var f=c.unref(),p=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:p}),o.current&&j.isSibling(p,f)&&j.isAfter(p,f)&&(o.current=j.next(o.current))}o.unref()}})},Jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=j.isPath(s)?Jn(t,s):h=>ce.isElement(h)&&y.isBlock(t,h)),!r&&W.isRange(s)&&(s=y.unhangRange(t,s,{voids:a}));var l=y.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,h=>{var[,g]=h;return y.pathRef(t,g)});for(var c of u){var f=c.unref();if(f){var[p]=y.node(t,f);t.apply({type:"remove_node",path:f,node:p})}}}})},Xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:f=!1}=r;if(i){if(a==null&&(a=j.isPath(i)?Jn(t,i):z=>ce.isElement(z)&&y.isBlock(t,z)),!l&&W.isRange(i)&&(i=y.unhangRange(t,i,{voids:f})),c&&W.isRange(i)){if(W.isCollapsed(i)&&y.leaf(t,i.anchor)[0].text.length>0)return;var p=y.rangeRef(t,i,{affinity:"inward"}),[h,g]=W.edges(i),m=u==="lowest"?"lowest":"highest",b=y.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:a,mode:m,voids:f,always:!b});var v=y.isStart(t,h,h.path);ee.splitNodes(t,{at:h,match:a,mode:m,voids:f,always:!v}),i=p.unref(),r.at==null&&ee.select(t,i)}s||(s=(z,I)=>z!==I);for(var[x,A]of y.nodes(t,{at:i,match:a,mode:u,voids:f})){var k={},E={};if(A.length!==0){var B=!1;for(var P in n)P==="children"||P==="text"||s(n[P],x[P])&&(B=!0,x.hasOwnProperty(P)&&(k[P]=x[P]),o?n[P]!=null&&(E[P]=o(x[P],n[P])):n[P]!=null&&(E[P]=n[P]));B&&t.apply({type:"set_node",path:A,properties:k,newProperties:E})}}}})},ev=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=y.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=Q=>ce.isElement(Q)&&y.isBlock(t,Q)),W.isRange(s)&&(s=ev(t,s)),j.isPath(s)){var u=s,c=y.point(t,u),[f]=y.parent(t,u);i=Q=>Q===f,o=c.path.length-u.length+1,s=c,l=!0}if(s){var p=y.pointRef(t,s,{affinity:"backward"}),h;try{var[g]=y.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var m=y.void(t,{at:s,mode:"highest"}),b=0;if(!a&&m){var[v,x]=m;if(ce.isElement(v)&&t.isInline(v)){var A=y.after(t,x);if(!A){var k={text:""},E=j.next(x);ee.insertNodes(t,k,{at:E,voids:a}),A=y.point(t,E)}s=A,l=!0}var B=s.path.length-x.length;o=B+1,l=!0}h=y.pointRef(t,s);var P=s.path.length-o,[,z]=g,I=s.path.slice(0,P),N=o===0?s.offset:s.path[P]+b;for(var[O,w]of y.levels(t,{at:I,reverse:!0,voids:a})){var T=!1;if(w.length<z.length||w.length===0||!a&&ce.isElement(O)&&y.isVoid(t,O))break;var R=p.current,M=y.isEnd(t,R,w);if(l||!p||!y.isEdge(t,R,w)){T=!0;var K=se.extractProps(O);t.apply({type:"split_node",path:w,position:N,properties:K})}N=w[w.length-1]+(T||M?1:0)}if(n.at==null){var V=h.current||y.end(t,[]);ee.select(t,V)}}finally{var ie;p.unref(),(ie=h)===null||ie===void 0||ie.unref()}}})},nv=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;ee.setNodes(t,a,r)},rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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=j.isPath(s)?Jn(t,s):h=>ce.isElement(h)&&y.isBlock(t,h)),j.isPath(s)&&(s=y.range(t,s));var l=W.isRange(s)?y.rangeRef(t,s):null,u=y.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,h=>{var[,g]=h;return y.pathRef(t,g)}).reverse(),f=function(){var g=p.unref(),[m]=y.node(t,g),b=y.range(t,g);a&&l&&(b=W.intersection(l.current,b)),ee.liftNodes(t,{at:b,match:v=>ce.isAncestor(m)&&m.children.includes(v),voids:i})};for(var p of c)f();l&&l.unref()}})};function yu(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?yu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.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&&(j.isPath(l)?o=Jn(t,l):t.isInline(n)?o=b=>ce.isElement(b)&&y.isInline(t,b)||de.isText(b):o=b=>ce.isElement(b)&&y.isBlock(t,b)),i&&W.isRange(l)){var[u,c]=W.edges(l),f=y.rangeRef(t,l,{affinity:"inward"});ee.splitNodes(t,{at:c,match:o,voids:s}),ee.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&ee.select(t,l)}var p=Array.from(y.nodes(t,{at:l,match:t.isInline(n)?b=>ce.isElement(b)&&y.isBlock(t,b):b=>y.isEditor(b),mode:"lowest",voids:s})),h=function(){var v=W.isRange(l)?W.intersection(l,y.range(t,m)):l;if(!v)return 0;var x=Array.from(y.nodes(t,{at:v,match:o,mode:a,voids:s}));if(x.length>0){var[A]=x,k=x[x.length-1],[,E]=A,[,B]=k;if(E.length===0&&B.length===0)return 0;var P=j.equals(E,B)?j.parent(E):j.common(E,B),z=y.range(t,E,B),I=y.node(t,P),[N]=I,O=P.length+1,w=j.next(B.slice(0,O)),T=Du(Du({},n),{},{children:[]});ee.insertNodes(t,T,{at:w,voids:s}),ee.moveNodes(t,{at:z,match:R=>ce.isAncestor(N)&&N.children.includes(R),to:w.concat(0),voids:s})}},g;for(var[,m]of p)g=h()}})},iv=()=>{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 Tp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Op(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)}};return e},sv={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))}},di=new WeakMap,fi=new WeakMap,Pn={isHistoryEditor(e){return sv.isHistory(e.history)&&y.isEditor(e)},isMerging(e){return fi.get(e)},isSaving(e){return di.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Pn.isMerging(e);fi.set(e,!1),t(),fi.set(e,n)},withoutSaving(e,t){var n=Pn.isSaving(e);di.set(e,!1),t(),di.set(e,n)}},ov=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&&ee.setSelection(t,i.selectionBefore),Pn.withoutSaving(t,()=>{y.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];Pn.withoutSaving(t,()=>{y.withoutNormalizing(t,()=>{var s=i.operations.map(Yt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&ee.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=Pn.isSaving(t),c=Pn.isMerging(t);if(u==null&&(u=lv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=uv(r,l)),o&&c)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},uv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&j.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&j.equals(e.path,t.path)),lv=(e,t)=>e.type!=="set_selection",cv=hv,Jc="֑-߿יִ-﷽ﹰ-ﻼ",Xc="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",dv=new RegExp("^[^"+Xc+"]*["+Jc+"]"),fv=new RegExp("^[^"+Jc+"]*["+Xc+"]");function hv(e){return e=String(e||""),dv.test(e)?"rtl":fv.test(e)?"ltr":"neutral"}const ed=tn(cv);function mv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ws=mv,pv=typeof Nr=="object"&&Nr&&Nr.Object===Object&&Nr,gv=pv,vv=gv,bv=typeof self=="object"&&self&&self.Object===Object&&self,yv=vv||bv||Function("return this")(),td=yv,Dv=td,Cv=function(){return Dv.Date.now()},xv=Cv,wv=/\s/;function Ev(e){for(var t=e.length;t--&&wv.test(e.charAt(t)););return t}var _v=Ev,Bv=_v,kv=/^\s+/;function Av(e){return e&&e.slice(0,Bv(e)+1).replace(kv,"")}var Fv=Av,Tv=td,Sv=Tv.Symbol,nd=Sv,Cu=nd,rd=Object.prototype,jv=rd.hasOwnProperty,Ov=rd.toString,ar=Cu?Cu.toStringTag:void 0;function Pv(e){var t=jv.call(e,ar),n=e[ar];try{e[ar]=void 0;var r=!0}catch{}var a=Ov.call(e);return r&&(t?e[ar]=n:delete e[ar]),a}var Nv=Pv,Rv=Object.prototype,Mv=Rv.toString;function Iv(e){return Mv.call(e)}var $v=Iv,xu=nd,Lv=Nv,zv=$v,qv="[object Null]",Wv="[object Undefined]",wu=xu?xu.toStringTag:void 0;function Hv(e){return e==null?e===void 0?Wv:qv:wu&&wu in Object(e)?Lv(e):zv(e)}var Uv=Hv;function Vv(e){return e!=null&&typeof e=="object"}var Kv=Vv,Zv=Uv,Yv=Kv,Gv="[object Symbol]";function Qv(e){return typeof e=="symbol"||Yv(e)&&Zv(e)==Gv}var Jv=Qv,Xv=Fv,Eu=Ws,e0=Jv,_u=0/0,t0=/^[-+]0x[0-9a-f]+$/i,n0=/^0b[01]+$/i,r0=/^0o[0-7]+$/i,a0=parseInt;function i0(e){if(typeof e=="number")return e;if(e0(e))return _u;if(Eu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Eu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Xv(e);var n=n0.test(e);return n||r0.test(e)?a0(e.slice(2),n?2:8):t0.test(e)?_u:+e}var s0=i0,o0=Ws,hi=xv,Bu=s0,u0="Expected a function",l0=Math.max,c0=Math.min;function d0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,f=!1,p=!0;if(typeof e!="function")throw new TypeError(u0);t=Bu(t)||0,o0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?l0(Bu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(B){var P=r,z=a;return r=a=void 0,u=B,s=e.apply(z,P),s}function g(B){return u=B,o=setTimeout(v,t),c?h(B):s}function m(B){var P=B-l,z=B-u,I=t-P;return f?c0(I,i-z):I}function b(B){var P=B-l,z=B-u;return l===void 0||P>=t||P<0||f&&z>=i}function v(){var B=hi();if(b(B))return x(B);o=setTimeout(v,m(B))}function x(B){return o=void 0,p&&r?h(B):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function k(){return o===void 0?s:x(hi())}function E(){var B=hi(),P=b(B);if(r=arguments,a=this,l=B,P){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(v,t),h(l)}return o===void 0&&(o=setTimeout(v,t)),s}return E.cancel=A,E.flush=k,E}var ad=d0;const f0=tn(ad);var h0=ad,m0=Ws,p0="Expected a function";function g0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(p0);return m0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),h0(e,t,{leading:r,maxWait:t,trailing:a})}var v0=g0;const b0=tn(v0),ku=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Au=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",mi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Au(n.overflowY,t)||Au(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},qr=(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,y0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Fu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,f=typeof u=="function"?u:K=>K!==u;if(!ku(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,h=[];let g=e;for(;ku(g)&&f(g);){if(g=y0(g),g===p){h.push(g);break}g!=null&&g===document.body&&mi(g)&&!mi(document.documentElement)||g!=null&&mi(g,c)&&h.push(g)}const m=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:x}=window,{height:A,width:k,top:E,right:B,bottom:P,left:z}=e.getBoundingClientRect(),{top:I,right:N,bottom:O,left:w}=(K=>{const V=window.getComputedStyle(K);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let T=o==="start"||o==="nearest"?E-I:o==="end"?P+O:E+A/2-I+O,R=l==="center"?z+k/2-w+N:l==="end"?B+N:z-w;const M=[];for(let K=0;K<h.length;K++){const V=h[K],{height:ie,width:Q,top:D,right:U,bottom:X,left:_}=V.getBoundingClientRect();if(s==="if-needed"&&E>=0&&z>=0&&P<=b&&B<=m&&E>=D&&P<=X&&z>=_&&B<=U)return M;const F=getComputedStyle(V),L=parseInt(F.borderLeftWidth,10),$=parseInt(F.borderTopWidth,10),q=parseInt(F.borderRightWidth,10),ne=parseInt(F.borderBottomWidth,10);let te=0,Z=0;const le="offsetWidth"in V?V.offsetWidth-V.clientWidth-L-q:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-$-ne:0,be="offsetWidth"in V?V.offsetWidth===0?0:Q/V.offsetWidth:0,pe="offsetHeight"in V?V.offsetHeight===0?0:ie/V.offsetHeight:0;if(p===V)te=o==="start"?T:o==="end"?T-b:o==="nearest"?qr(x,x+b,b,$,ne,x+T,x+T+A,A):T-b/2,Z=l==="start"?R:l==="center"?R-m/2:l==="end"?R-m:qr(v,v+m,m,L,q,v+R,v+R+k,k),te=Math.max(0,te+x),Z=Math.max(0,Z+v);else{te=o==="start"?T-D-$:o==="end"?T-X+ne+J:o==="nearest"?qr(D,X,ie,$,ne+J,T,T+A,A):T-(D+ie/2)+J/2,Z=l==="start"?R-_-L:l==="center"?R-(_+Q/2)+le/2:l==="end"?R-U+q+le:qr(_,U,Q,L,q+le,R,R+k,k);const{scrollLeft:_e,scrollTop:Se}=V;te=pe===0?0:Math.max(0,Math.min(Se+te/pe,V.scrollHeight-ie/pe+J)),Z=be===0?0:Math.max(0,Math.min(_e+Z/be,V.scrollWidth-Q/be+le)),T+=Se-te,R+=_e-Z}M.push({el:V,top:te,left:Z})}return M},D0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function C0(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(Fu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Fu(e,D0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var hn=[],x0=function(){return hn.some(function(e){return e.activeTargets.length>0})},w0=function(){return hn.some(function(e){return e.skippedTargets.length>0})},Tu="ResizeObserver loop completed with undelivered notifications.",E0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Tu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Tu),window.dispatchEvent(e)},Er;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Er||(Er={}));var mn=function(e){return Object.freeze(e)},_0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,mn(this)}return e}(),id=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,mn(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}(),Hs=function(e){return e instanceof SVGElement&&"getBBox"in e},sd=function(e){if(Hs(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)},Su=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)},B0=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},hr=typeof window<"u"?window:{},Wr=new WeakMap,ju=/auto|scroll/,k0=/^tb|vertical/,A0=/msie|trident/i.test(hr.navigator&&hr.navigator.userAgent),kt=function(e){return parseFloat(e||"0")},In=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new _0((n?t:e)||0,(n?e:t)||0)},Ou=mn({devicePixelContentBoxSize:In(),borderBoxSize:In(),contentBoxSize:In(),contentRect:new id(0,0,0,0)}),od=function(e,t){if(t===void 0&&(t=!1),Wr.has(e)&&!t)return Wr.get(e);if(sd(e))return Wr.set(e,Ou),Ou;var n=getComputedStyle(e),r=Hs(e)&&e.ownerSVGElement&&e.getBBox(),a=!A0&&n.boxSizing==="border-box",i=k0.test(n.writingMode||""),s=!r&&ju.test(n.overflowY||""),o=!r&&ju.test(n.overflowX||""),l=r?0:kt(n.paddingTop),u=r?0:kt(n.paddingRight),c=r?0:kt(n.paddingBottom),f=r?0:kt(n.paddingLeft),p=r?0:kt(n.borderTopWidth),h=r?0:kt(n.borderRightWidth),g=r?0:kt(n.borderBottomWidth),m=r?0:kt(n.borderLeftWidth),b=f+u,v=l+c,x=m+h,A=p+g,k=o?e.offsetHeight-A-e.clientHeight:0,E=s?e.offsetWidth-x-e.clientWidth:0,B=a?b+x:0,P=a?v+A:0,z=r?r.width:kt(n.width)-B-E,I=r?r.height:kt(n.height)-P-k,N=z+b+E+x,O=I+v+k+A,w=mn({devicePixelContentBoxSize:In(Math.round(z*devicePixelRatio),Math.round(I*devicePixelRatio),i),borderBoxSize:In(N,O,i),contentBoxSize:In(z,I,i),contentRect:new id(f,l,z,I)});return Wr.set(e,w),w},ud=function(e,t,n){var r=od(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Er.DEVICE_PIXEL_CONTENT_BOX:return s;case Er.BORDER_BOX:return a;default:return i}},F0=function(){function e(t){var n=od(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=mn([n.borderBoxSize]),this.contentBoxSize=mn([n.contentBoxSize]),this.devicePixelContentBoxSize=mn([n.devicePixelContentBoxSize])}return e}(),ld=function(e){if(sd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},T0=function(){var e=1/0,t=[];hn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new F0(u.target),f=ld(u.target);o.push(c),u.lastReportedSize=ud(u.target,u.observedBox),f<e&&(e=f)}),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},Pu=function(e){hn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(ld(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},S0=function(){var e=0;for(Pu(e);x0();)e=T0(),Pu(e);return w0()&&E0(),e>0},pi,cd=[],j0=function(){return cd.splice(0).forEach(function(e){return e()})},O0=function(e){if(!pi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return j0()}).observe(n,r),pi=function(){n.textContent="".concat(t?t--:t++)}}cd.push(e),pi()},P0=function(e){O0(function(){requestAnimationFrame(e)})},ia=0,N0=function(){return!!ia},R0=250,M0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Nu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ru=function(e){return e===void 0&&(e=0),Date.now()+e},gi=!1,I0=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=R0),!gi){gi=!0;var r=Ru(t);P0(function(){var a=!1;try{a=S0()}finally{if(gi=!1,t=r-Ru(),!N0())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,M0)};document.body?n():hr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Nu.forEach(function(n){return hr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Nu.forEach(function(n){return hr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),os=new I0,Mu=function(e){!ia&&e>0&&os.start(),ia+=e,!ia&&os.stop()},$0=function(e){return!Hs(e)&&!B0(e)&&getComputedStyle(e).display==="inline"},L0=function(){function e(t,n){this.target=t,this.observedBox=n||Er.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=ud(this.target,this.observedBox,!0);return $0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),z0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Hr=new WeakMap,Iu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Ur=function(){function e(){}return e.connect=function(t,n){var r=new z0(t,n);Hr.set(t,r)},e.observe=function(t,n,r){var a=Hr.get(t),i=a.observationTargets.length===0;Iu(a.observationTargets,n)<0&&(i&&hn.push(a),a.observationTargets.push(new L0(n,r&&r.box)),Mu(1),os.schedule())},e.unobserve=function(t,n){var r=Hr.get(t),a=Iu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&hn.splice(hn.indexOf(r),1),r.observationTargets.splice(a,1),Mu(-1))},e.disconnect=function(t){var n=this,r=Hr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),q0=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.");Ur.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(!Su(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.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(!Su(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ur.unobserve(this,t)},e.prototype.disconnect=function(){Ur.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function W0(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 Hn(e,t){if(e==null)return{};var n=W0(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 _r(e){"@babel/helpers - typeof";return _r=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},_r(e)}function H0(e,t){if(_r(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(_r(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function U0(e){var t=H0(e,"string");return _r(t)==="symbol"?t:String(t)}function Ct(e,t,n){return t=U0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Us=C.createContext(null),an=()=>{var e=C.useContext(Us);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},dd=parseInt(C.version.split(".")[0],10),V0=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$u=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),at=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Nn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),cr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),K0=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),fd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Z0=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Y0=at&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),G0=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Q0=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),J0=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=(!Z0||!Y0)&&!K0&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Vs=new WeakMap,Ks=new WeakMap,hd=new WeakMap,oa=new WeakMap,us=new WeakMap,Br=new WeakMap,pn=new WeakMap,Ca=new WeakMap,qa=new WeakMap,ls=new WeakMap,Gt=new WeakMap,dn=new WeakMap,mr=new WeakMap,cs=new WeakMap,Zs=new WeakMap,Et=new WeakMap,Lt=new WeakMap,ut=new WeakMap,Vt=new WeakMap,Kt=new WeakMap,md=new WeakMap,Un=Symbol("placeholder"),pd=Symbol("mark-placeholder"),X0=globalThis.Text,Ys=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,eb=e=>Xt(e)&&e.nodeType===8,Dt=e=>Xt(e)&&e.nodeType===1,Xt=e=>{var t=Ys(e);return!!t&&e instanceof t.Node},ds=e=>{var t=e&&e.anchorNode&&Ys(e.anchorNode);return!!t&&e instanceof t.Selection},gd=e=>Xt(e)&&e.nodeType===3,tb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,nb=e=>{var[t,n]=e;if(Dt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=vd(t,a,r?"backward":"forward"),r=a<n;Dt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=ab(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},rb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},vd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(eb(a)||Dt(a)&&a.childNodes.length===0||Dt(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]},ab=(e,t,n)=>{var[r]=vd(e,t,n);return r},bd=e=>{var t="";if(gd(e)&&e.nodeValue)return e.nodeValue;if(Dt(e)){for(var n of Array.from(e.childNodes))t+=bd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
124
|
-
`)}return t},
|
|
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 qc=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?Wc(e)||Array.isArray(e)||!!e[Ro]||!!((t=e.constructor)!=null&&t[Ro])||$a(e)||La(e):!1}var Bm=Object.prototype.constructor.toString();function Wc(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)===Bm}function pa(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 Hc(e,t,n){const r=Ia(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function km(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&&Wc(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 Uc(){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=ga(t,e),t.parent_||va(t,e)),t.patches_&&gn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=ga(t,n,[]),as(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==qc?e:void 0}function ga(e,t,n){if(za(t))return t;const r=t[mt];if(!r)return pa(t,(a,i)=>Lo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return va(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),pa(i,(o,l)=>Lo(e,r,a,o,l,n,s)),va(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=ga(e,a,o);if(Hc(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;ga(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&va(e,a)}}function va(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_:Uc(),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=Vc(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(km(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={};pa($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=Vc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Vc(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===qc&&(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_:Uc()).drafts_.push(n),n}function Nm(e){return mn(e)||lt(10,e),Kc(e)}function Kc(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 pa(n,(r,a)=>{Hc(n,r,Kc(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=O.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=q.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ba=new WeakMap,ya=new WeakMap,dr=new WeakMap,Zc=new WeakMap,Wo=new WeakMap,Ho=new WeakMap,Uo=new WeakMap,O={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=O.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 O.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return O.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 O.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 O.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&O.compare(e,t)===0},isBefore(e,t){return O.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&O.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&O.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&O.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&O.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&&O.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(!O.isAncestor(t,e)&&!O.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;(O.equals(i,r)||O.endsBefore(i,r)||O.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(O.equals(s,r)||O.isAncestor(s,r))return null;O.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;O.equals(o,r)||O.endsBefore(o,r)?r[o.length-1]-=1:O.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(O.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else O.endsBefore(u,r)?r[u.length-1]+=1:O.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:f,newPath:m}=t;if(O.equals(f,m))return r;if(O.isAncestor(f,r)||O.equals(f,r)){var p=m.slice();return O.endsBefore(f,m)&&f.length<m.length&&(p[f.length-1]-=1),p.concat(r.slice(f.length))}else O.isSibling(f,m)&&(O.isAncestor(m,r)||O.equals(m,r))?O.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:O.endsBefore(m,r)||O.equals(m,r)||O.isAncestor(m,r)?(O.endsBefore(f,r)&&(r[f.length-1]-=1),r[m.length-1]+=1):O.endsBefore(f,r)&&(O.equals(m,r)&&(r[m.length-1]+=1),r[f.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 q.points(t))t[l]=Ce.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:f}=n;if(f.length===0)break;var m=ie.leaf(e,u),p=m.text.slice(0,c),g=m.text.slice(c);if(m.text=p+f+g,t)for(var[h,y]of q.points(t))t[y]=Ce.transform(h,n);break}case"merge_node":{var{path:v}=n,x=ie.get(e,v),k=O.previous(v),E=ie.get(e,k),w=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(w.children.splice(A,1),t)for(var[P,U]of q.points(t))t[U]=Ce.transform(P,n);break}case"move_node":{var{path:$,newPath:j}=n;if(O.isAncestor($,j))throw new Error("Cannot move a path [".concat($,"] to new path [").concat(j,"] because the destination is inside itself."));var R=ie.get(e,$),_=ie.parent(e,$),T=$[$.length-1];_.children.splice(T,1);var N=O.transform($,n),M=ie.get(e,O.parent(N)),Q=N[N.length-1];if(M.children.splice(Q,0,R),t)for(var[Z,oe]of q.points(t))t[oe]=Ce.transform(Z,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,B]of q.points(t)){var F=Ce.transform(J,n);if(t!=null&&F!=null)t[B]=F;else{var L=void 0,I=void 0;for(var[H,te]of ie.texts(e))if(O.compare(te,ne)===-1)L=[H,te];else{I=[H,te];break}var ee=!1;L&&I&&(O.equals(I[1],ne)?ee=!O.hasPrevious(I[1]):ee=O.common(L[1],ne).length<O.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:K,offset:ue,text:G}=n;if(G.length===0)break;var ge=ie.leaf(e,K),me=ge.text.slice(0,ue),_e=ge.text.slice(ue+G.length);if(ge.text=me+_e,t)for(var[Se,Pe]of q.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 $e in Ke)Ze.hasOwnProperty($e)||delete tt[$e];break}case"set_selection":{var{newProperties:W}=n;if(W==null)t=W;else{if(t==null){if(!q.isRange(W))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ye.stringify(W)," when there is no current selection."));t=nr({},W)}for(var ae in W){var fe=W[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,Or]of q.points(t))t[Or]=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)}},Yc=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!Yc(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 q={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return q.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=q.edges(e);return t},equals(e,t){return Ce.equals(e.anchor,t.anchor)&&Ce.equals(e.focus,t.focus)},includes(e,t){if(q.isRange(t)){if(q.includes(e,t.anchor)||q.includes(e,t.focus))return!0;var[n,r]=q.edges(e),[a,i]=q.edges(t);return Ce.isBefore(n,a)&&Ce.isAfter(r,i)}var[s,o]=q.edges(e),l=!1,u=!1;return Ce.isPoint(t)?(l=Ce.compare(t,s)>=0,u=Ce.compare(t,o)<=0):(l=O.compare(t,s.path)>=0,u=O.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=qt(e,Vm),[r,a]=q.edges(e),[i,s]=q.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!q.isCollapsed(e)},isForward(e){return!q.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]=q.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=q.isCollapsed(r);q.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?q.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 O.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=O.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]=q.edges(t),s=ie.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!q.includes(t,p)}});for(var[,o]of s){if(!q.includes(t,o)){var l=ie.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(O.equals(o,i.path)){var c=ie.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(O.equals(o,a.path)){var f=ie.leaf(r,o);f.text=f.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 O.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?O.isBefore(o,i):O.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;O.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=O.next(o);if(ie.has(e,c)){o=c,l=ie.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=O.previous(o);o=f,l=ie.get(e,o);continue}o=O.parent(o),l=ie.get(e,o),s.add(l)}}()},parent(e,t){var n=O.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 O.isPath(e.path)&&ie.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&O.isPath(e.path);case"merge_node":return typeof e.position=="number"&&O.isPath(e.path)&&Je(e.properties);case"move_node":return O.isPath(e.path)&&O.isPath(e.newPath);case"remove_node":return O.isPath(e.path)&&ie.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&O.isPath(e.path);case"set_node":return O.isPath(e.path)&&Je(e.properties)&&Je(e.newProperties);case"set_selection":return e.properties===null&&q.isRange(e.newProperties)||e.newProperties===null&&q.isRange(e.properties)||Je(e.properties)&&Je(e.newProperties);case"split_node":return O.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:O.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(O.equals(t,n))return e;if(O.isSibling(n,t))return Re(Re({},e),{},{path:t,newPath:n});var r=O.transform(n,e),a=O.transform(O.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:O.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||q.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(O.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=O.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&&O.equals(e.path,t.path)},isPoint(e){return Je(e)&&typeof e.offset=="number"&&O.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=O.transform(i,t,n);break}case"insert_text":{O.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{O.equals(t.path,i)&&(r.offset+=t.position),r.path=O.transform(i,t,n);break}case"remove_text":{O.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(O.equals(t.path,i)||O.isAncestor(t.path,i))return null;r.path=O.transform(i,t,n);break}case"split_node":{if(O.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=O.transform(i,t,Xo(Xo({},n),{},{affinity:"forward"})))}else r.path=O.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 Yc(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]=q.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var f of n){var{length:m}=f.text,p=l;if(l+=m,u<=p&&l<=c){Object.assign(f,a),o.push(f);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(f);continue}var g=f,h=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;h=Rt(Rt({},g),{},{text:g.text.slice(0,x)}),g=Rt(Rt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),h&&o.push(h),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 f=c.codePointAt(0);if(!f)break;var m=vp(c,f);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(O.isPath(a)&&(a=b.range(e,a)),q.isRange(a))if(q.isCollapsed(a))a=a.anchor;else{var i=q.end(a);if(!r&&b.void(e,{at:i}))return;var s=q.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:f,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:f,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 $r(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=$r($r($r($r({},qm),Wm),Hm),wp),ra=new WeakMap,Ep=e=>ra.get(e)||!1,_p=(e,t,n)=>{var r=ra.get(e)||!1;ra.set(e,!0);try{t(),n()}finally{ra.set(e,r)}};function Gc(e,t,n){var r=ba.get(e)||[],a=ya.get(e)||new Set,i,s,o=f=>{if(f){var m=f.join(",");s.has(m)||(s.add(m),i.push(f))}};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);ba.set(e,i),ya.set(e,s)}var Bp=(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=O.operationCanTransformPath(t)?s=>O.transform(s,t):void 0;Gc(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=[]}))},kp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return O.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=O.levels(a),s=de.isText(r)?[]:Array.from(ie.nodes(r),j=>{var[,R]=j;return a.concat(R)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=O.ancestors(o),u=O.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:f}=t;if(O.equals(c,f))return[];var m=[],p=[];for(var g of O.ancestors(c)){var h=O.transform(g,t);m.push(h)}for(var y of O.ancestors(f)){var v=O.transform(y,t);p.push(v)}var x=p[p.length-1],k=f[f.length-1],E=x.concat(k);return[...m,...p,E]}case"remove_node":{var{path:w}=t,A=O.ancestors(w);return[...A]}case"split_node":{var{path:P}=t,U=O.levels(P),$=O.next(P);return[...U,$]}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],f=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(f){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(q.isRange(i)){if(O.isAncestor(c,i.anchor.path)&&O.isAncestor(c,i.focus.path))return[u,c]}else if(!O.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=(f,m)=>{if(!de.isText(f))return!1;var[p,g]=b.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=q.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&&q.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Rp=(e,t)=>{var{selection:n}=e;n&&q.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&&q.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=Zc.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(q.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:f}=a,[m]=b.leaf(t,f);if(a.offset===0){var p=b.previous(t,{at:f,match:de.isText}),g=b.above(t,{match:E=>ce.isElement(E)&&b.isVoid(t,E)&&t.markableVoid(E)});if(!g){var h=b.above(t,{match:E=>ce.isElement(E)&&b.isBlock(t,E)});if(p&&h){var[y,v]=p,[,x]=h;O.isAncestor(x,v)&&(m=y)}}}var k=qt(m,lg);return k},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(O.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(O.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},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 f=b.path(e,n,{edge:"start"}),m=b.path(e,n,{edge:"end"});u=i?m:f,c=i?f:m}var p=ie.nodes(e,{reverse:i,from:u,to:c,pass:E=>{var[w]=E;return ce.isElement(w)?!!(!s&&(b.isVoid(e,w)||b.isElementReadOnly(e,w))||o&&!b.isSelectable(e,w)):!1}}),g=[],h;for(var[y,v]of p)if(!(o&&ce.isElement(y)&&!b.isSelectable(e,y))){var x=h&&O.compare(v,h[1])===0;if(!(r==="highest"&&x)){if(!l(y,v)){if(a&&!x&&de.isText(y))return;continue}if(r==="lowest"&&x){h=[y,v];continue}var k=r==="lowest"?h:[y,v];k&&(a?g.push(k):yield k),h=[y,v]}}r==="lowest"&&h&&(a?g.push(h):yield h),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=>ba.get(c)||[],s=c=>ya.get(c)||new Set,o=c=>{var f=i(c).pop(),m=f.join(",");return s(c).delete(m),f};if(b.isNormalizing(t)){if(r){var l=Array.from(ie.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));ba.set(t,l),ya.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(ie.has(t,c)){var f=b.node(t,c),[m,p]=f;ce.isElement(m)&&m.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),h=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:h,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=O.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(O.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 q.isRange(n)&&(i==="start"?n=q.start(n):i==="end"?n=q.end(n):n=O.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(O.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(q.isRange(n)){var[u,c]=q.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]=q.edges(o),c=a?u:l,f=!1,m="",p=0,g=0,h=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=O.isAncestor(v,u.path)?u:b.end(e,v),k=O.isAncestor(v,l.path)?l:b.start(e,v);m=b.string(e,{anchor:k,focus:x},{voids:i}),f=!0}}if(de.isText(y)){var E=O.equals(v,c.path);for(E?(g=a?c.offset:y.text.length-c.offset,h=c.offset):(g=y.text.length,h=a?g:0),(E||f||r==="offset")&&(yield{path:v,offset:h},f=!1);;){if(p===0){if(m==="")break;p=w(m,r,a),m=Ws(m,p,a)[1]}if(h=a?h-p:h+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:h}}}}function w(A,P,U){return P==="character"?qs(A,U):P==="word"?rp(A,U):P==="line"||P==="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(O.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(O.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},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},Bg=(e,t,n)=>{if(q.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 kg(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,f)=>{if(!de.isText(c))return!1;var[m,p]=b.parent(e,f);return!e.isVoid(m)||e.markableVoid(m)},a=q.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=kg({},b.marks(e)||{});delete u[t],e.marks=u,dr.get(e)||e.onChange()}}},Fg=(e,t)=>{Zc.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]=q.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:de.isText,voids:a})){var f=u.text;O.equals(c,o.path)&&(f=f.slice(0,o.offset)),O.equals(c,s.path)&&(f=f.slice(s.offset)),l+=f}return l},jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=q.edges(n);if(i.offset!==0||s.offset!==0||q.isCollapsed(n)||O.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},f=!0;for(var[m,p]of b.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(m.text!==""||O.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 f=!1;if(q.isRange(u)&&q.isCollapsed(u)&&(f=!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},h=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:h},c=!0}}if(O.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!q.isCollapsed(u)){if(!c){var[,y]=q.edges(u),v=b.end(t,[]);Ce.equals(y,v)||(u=b.unhangRange(t,u,{voids:l}))}var[x,k]=q.edges(u),E=b.above(t,{match:me=>ce.isElement(me)&&b.isBlock(t,me),at:x,voids:l}),w=b.above(t,{match:me=>ce.isElement(me)&&b.isBlock(t,me),at:k,voids:l}),A=E&&w&&!O.equals(E[1],w[1]),P=O.equals(x.path,k.path),U=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:k,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:k,mode:"highest"});if(U){var j=b.before(t,x);j&&E&&O.isAncestor(E[1],j.path)&&(x=j)}if($){var R=b.after(t,k);R&&w&&O.isAncestor(w[1],R.path)&&(k=R)}var _=[],T;for(var N of b.nodes(t,{at:u,voids:l})){var[M,Q]=N;T&&O.compare(Q,T)===0||(!l&&ce.isElement(M)&&(b.isVoid(t,M)||b.isElementReadOnly(t,M))||!O.isCommon(Q,x.path)&&!O.isCommon(Q,k.path))&&(_.push(N),T=Q)}var Z=Array.from(_,me=>{var[,_e]=me;return b.pathRef(t,_e)}),oe=b.pointRef(t,x),ne=b.pointRef(t,k),D="";if(!P&&!U){var z=oe.current,[J]=b.leaf(t,z),{path:B}=z,{offset:F}=x,L=J.text.slice(F);L.length>0&&(t.apply({type:"remove_text",path:B,offset:F,text:L}),D=L)}if(Z.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>X.removeNodes(t,{at:me,voids:l})),!$){var I=ne.current,[H]=b.leaf(t,I),{path:te}=I,ee=P?x.offset:0,K=H.text.slice(ee,k.offset);K.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:K}),D=K)}!P&&A&&ne.current&&oe.current&&X.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),f&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,D.slice(0,D.length-o));var ue=oe.unref(),G=ne.unref(),ge=i?ue||G:G||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(q.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),q.isCollapsed(s))s=s.anchor;else{var[,l]=q.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 O.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[,f]=c;if(b.isEnd(t,s,f)){var m=b.after(t,f);s=m}else if(b.isStart(t,s,f)){var p=b.before(t,f);s=p}}var g=b.above(t,{match:L=>ce.isElement(L)&&b.isBlock(t,L),at:s,voids:i}),[,h]=g,y=b.isStart(t,s,h),v=b.isEnd(t,s,h),x=y&&v,k=!y||y&&v,E=!v,[,w]=ie.first({children:n},[]),[,A]=ie.last({children:n},[]),P=[],U=L=>{var[I,H]=L,te=H.length===0;return te?!1:x?!0:!(k&&O.isAncestor(H,w)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||E&&O.isAncestor(H,A)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var $ of ie.nodes({children:n},{pass:U}))U($)&&P.push($);var j=[],R=[],_=[],T=!0,N=!1;for(var[M]of P)ce.isElement(M)&&!t.isInline(M)?(T=!1,N=!0,R.push(M)):T?j.push(M):_.push(M);var[Q]=b.nodes(t,{at:s,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i}),[,Z]=Q,oe=b.isStart(t,s,Z),ne=b.isEnd(t,s,Z),D=b.pathRef(t,v&&!_.length?O.next(h):h),z=b.pathRef(t,ne?O.next(Z):Z);X.splitNodes(t,{at:s,match:L=>N?ce.isElement(L)&&b.isBlock(t,L):de.isText(L)||b.isInline(t,L),mode:N?"lowest":"highest",always:N&&(!y||j.length>0)&&(!v||_.length>0),voids:i});var J=b.pathRef(t,!oe||oe&&ne?O.next(Z):Z);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&&R.length&&!_.length&&X.delete(t,{at:h,voids:i}),X.insertNodes(t,R,{at:D.current,match:L=>ce.isElement(L)&&b.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,_,{at:z.current,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(_.length>0&&z.current?B=O.previous(z.current):R.length>0&&D.current?B=O.previous(D.current):J.current&&(B=O.previous(J.current)),B){var F=b.end(t,B);X.select(t,F)}}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]=q.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=q.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=q.isBackward(r)?"focus":"anchor"),o==="end"&&(o=q.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},f={};if(o==null||o==="anchor"){var m=s?b.before(t,l,c):b.after(t,l,c);m&&(f.anchor=m)}if(o==null||o==="focus"){var p=s?b.before(t,u,c):b.after(t,u,c);p&&(f.focus=p)}X.setSelection(t,f)}},$g=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){X.setSelection(e,t);return}if(!q.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=q.isBackward(a)?"focus":"anchor"),i==="end"&&(i=q.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[f]=n;if(l||(l=zs(t),c!==!1&&(c=!0)),c==null&&(c=!1),q.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),q.isCollapsed(l))l=l.anchor;else{var[,m]=q.edges(l),p=b.pointRef(t,m);X.delete(t,{at:l}),l=p.unref()}if(Ce.isPoint(l)){u==null&&(de.isText(f)?u=j=>de.isText(j):t.isInline(f)?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[,h]=g,y=b.pathRef(t,h),v=b.isEnd(t,l,h);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=y.unref();l=v?O.next(x):x}else return}var k=O.parent(l),E=l[l.length-1];if(!(!i&&b.void(t,{at:k}))){if(o){var w=[],A=O.levels(k);_p(t,()=>{var j=function(){var T=k.concat(E);E++;var N={type:"insert_node",path:T,node:R};t.apply(N),l=O.next(l),w.push(N),de.isText?A.push(...Array.from(ie.nodes(R),M=>{var[,Q]=M;return T.concat(Q)})):A.push(T)};for(var R of n)j()},()=>{Gc(t,A,j=>{var R=j;for(var _ of w)if(O.operationCanTransformPath(_)&&(R=O.transform(R,_),!R))return null;return R})})}else for(var P of n){var U=k.concat(E);E++,t.apply({type:"insert_node",path:U,node:P}),l=O.next(l)}if(l=O.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=O.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[,w]=E;return b.pathRef(t,w)});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 f=b.node(t,O.parent(c)),[m,p]=f,g=c[c.length-1],{length:h}=m.children;if(h===1){var y=O.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===h-1){var v=O.next(p);X.moveNodes(t,{at:c,to:v,voids:i})}else{var x=O.next(c),k=O.next(p);X.splitNodes(t,{at:x,voids:i}),X.moveNodes(t,{at:c,to:k,voids:i})}}}})},Hg=["text"],Ug=["children"],Qc=(e,t)=>{if(ce.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?Qc(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(O.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&&q.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),q.isRange(a))if(q.isCollapsed(a))a=a.anchor;else{var[,u]=q.edges(a),c=b.pointRef(t,u);X.delete(t,{at:a}),a=c.unref(),n.at==null&&X.select(t,a)}var[f]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),m=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!m)){var[p,g]=f,[h,y]=m;if(!(g.length===0||y.length===0)){var v=O.next(y),x=O.common(g,y),k=O.isSibling(g,y),E=Array.from(b.levels(t,{at:g}),j=>{var[R]=j;return R}).slice(x.length).slice(0,-1),w=b.above(t,{at:g,mode:"highest",match:j=>E.includes(j)&&Qc(t,j)}),A=w&&b.pathRef(t,w[1]),P,U;if(de.isText(p)&&de.isText(h)){var $=qt(p,Hg);U=h.text.length,P=$}else if(ce.isElement(p)&&ce.isElement(h)){var $=qt(p,Ug);U=h.children.length,P=$}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(h)));k||X.moveNodes(t,{at:g,to:v,voids:s}),A&&X.removeNodes(t,{at:A.current,voids:s}),ce.isElement(h)&&b.isEmpty(t,h)||de.isText(h)&&h.text===""&&y[y.length-1]!==0?X.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:v,position:U,properties:P}),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=O.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 f=c.unref(),m=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:m}),o.current&&O.isSibling(m,f)&&O.isAfter(m,f)&&(o.current=O.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=O.isPath(s)?Qn(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),!r&&q.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 f=c.unref();if(f){var[m]=b.node(t,f);t.apply({type:"remove_node",path:f,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:f=!1}=r;if(i){if(a==null&&(a=O.isPath(i)?Qn(t,i):U=>ce.isElement(U)&&b.isBlock(t,U)),!l&&q.isRange(i)&&(i=b.unhangRange(t,i,{voids:f})),c&&q.isRange(i)){if(q.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var m=b.rangeRef(t,i,{affinity:"inward"}),[p,g]=q.edges(i),h=u==="lowest"?"lowest":"highest",y=b.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:h,voids:f,always:!y});var v=b.isStart(t,p,p.path);X.splitNodes(t,{at:p,match:a,mode:h,voids:f,always:!v}),i=m.unref(),r.at==null&&X.select(t,i)}s||(s=(U,$)=>U!==$);for(var[x,k]of b.nodes(t,{at:i,match:a,mode:u,voids:f})){var E={},w={};if(k.length!==0){var A=!1;for(var P in n)P==="children"||P==="text"||s(n[P],x[P])&&(A=!0,x.hasOwnProperty(P)&&(E[P]=x[P]),o?n[P]!=null&&(w[P]=o(x[P],n[P])):n[P]!=null&&(w[P]=n[P]));A&&t.apply({type:"set_node",path:k,properties:E,newProperties:w})}}}})},Gg=(e,t)=>{if(q.isCollapsed(t))return t.anchor;var[,n]=q.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)),q.isRange(s)&&(s=Gg(t,s)),O.isPath(s)){var u=s,c=b.point(t,u),[f]=b.parent(t,u);i=ne=>ne===f,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 h=b.void(t,{at:s,mode:"highest"}),y=0;if(!a&&h){var[v,x]=h;if(ce.isElement(v)&&t.isInline(v)){var k=b.after(t,x);if(!k){var E={text:""},w=O.next(x);X.insertNodes(t,E,{at:w,voids:a}),k=b.point(t,w)}s=k,l=!0}var A=s.path.length-x.length;o=A+1,l=!0}p=b.pointRef(t,s);var P=s.path.length-o,[,U]=g,$=s.path.slice(0,P),j=o===0?s.offset:s.path[P]+y;for(var[R,_]of b.levels(t,{at:$,reverse:!0,voids:a})){var T=!1;if(_.length<U.length||_.length===0||!a&&ce.isElement(R)&&b.isVoid(t,R))break;var N=m.current,M=b.isEnd(t,N,_);if(l||!m||!b.isEdge(t,N,_)){T=!0;var Q=ie.extractProps(R);t.apply({type:"split_node",path:_,position:j,properties:Q})}j=_[_.length-1]+(T||M?1:0)}if(n.at==null){var Z=p.current||b.end(t,[]);X.select(t,Z)}}finally{var oe;m.unref(),(oe=p)===null||oe===void 0||oe.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=O.isPath(s)?Qn(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),O.isPath(s)&&(s=b.range(t,s));var l=q.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(),f=function(){var g=m.unref(),[h]=b.node(t,g),y=b.range(t,g);a&&l&&(y=q.intersection(l.current,y)),X.liftNodes(t,{at:y,match:v=>ce.isAncestor(h)&&h.children.includes(v),voids:i})};for(var m of c)f();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&&(O.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&&q.isRange(l)){var[u,c]=q.edges(l),f=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=f.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=q.isRange(l)?q.intersection(l,b.range(t,h)):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[k]=x,E=x[x.length-1],[,w]=k,[,A]=E;if(w.length===0&&A.length===0)return 0;var P=O.equals(w,A)?O.parent(w):O.common(w,A),U=b.range(t,w,A),$=b.node(t,P),[j]=$,R=P.length+1,_=O.next(A.slice(0,R)),T=yu(yu({},n),{},{children:[]});X.insertNodes(t,T,{at:_,voids:s}),X.moveNodes(t,{at:U,match:N=>ce.isAncestor(j)&&j.children.includes(N),to:_.concat(0),voids:s})}},g;for(var[,h]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 Bp(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 kp(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 Bg(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 f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}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&&O.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&O.equals(e.path,t.path)),iv=(e,t)=>e.type!=="set_selection",sv=lv,Jc="֑-߿יִ-﷽ﹰ-ﻼ",Xc="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",ov=new RegExp("^[^"+Xc+"]*["+Jc+"]"),uv=new RegExp("^[^"+Jc+"]*["+Xc+"]");function lv(e){return e=String(e||""),ov.test(e)?"rtl":uv.test(e)?"ltr":"neutral"}const ed=bn(sv);function cv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Hs=cv,dv=typeof Pr=="object"&&Pr&&Pr.Object===Object&&Pr,fv=dv,hv=fv,mv=typeof self=="object"&&self&&self.Object===Object&&self,pv=hv||mv||Function("return this")(),td=pv,gv=td,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,Bv=td,kv=Bv.Symbol,nd=kv,Du=nd,rd=Object.prototype,Av=rd.hasOwnProperty,Fv=rd.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=nd,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,f=!1,m=!0;if(typeof e!="function")throw new TypeError(a0);t=_u(t)||0,r0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?i0(_u(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(A){var P=r,U=a;return r=a=void 0,u=A,s=e.apply(U,P),s}function g(A){return u=A,o=setTimeout(v,t),c?p(A):s}function h(A){var P=A-l,U=A-u,$=t-P;return f?s0($,i-U):$}function y(A){var P=A-l,U=A-u;return l===void 0||P>=t||P<0||f&&U>=i}function v(){var A=fi();if(y(A))return x(A);o=setTimeout(v,h(A))}function x(A){return o=void 0,m&&r?p(A):(r=a=void 0,s)}function k(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function E(){return o===void 0?s:x(fi())}function w(){var A=fi(),P=y(A);if(r=arguments,a=this,l=A,P){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=k,w.flush=E,w}var ad=o0;const u0=bn(ad);var l0=ad,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),Bu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ku=(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 ku(n.overflowY,t)||ku(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},Lr=(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,f=typeof u=="function"?u:Q=>Q!==u;if(!Bu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Bu(g)&&f(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 h=(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:k,width:E,top:w,right:A,bottom:P,left:U}=e.getBoundingClientRect(),{top:$,right:j,bottom:R,left:_}=(Q=>{const Z=window.getComputedStyle(Q);return{top:parseFloat(Z.scrollMarginTop)||0,right:parseFloat(Z.scrollMarginRight)||0,bottom:parseFloat(Z.scrollMarginBottom)||0,left:parseFloat(Z.scrollMarginLeft)||0}})(e);let T=o==="start"||o==="nearest"?w-$:o==="end"?P+R:w+k/2-$+R,N=l==="center"?U+E/2-_+j:l==="end"?A+j:U-_;const M=[];for(let Q=0;Q<p.length;Q++){const Z=p[Q],{height:oe,width:ne,top:D,right:z,bottom:J,left:B}=Z.getBoundingClientRect();if(s==="if-needed"&&w>=0&&U>=0&&P<=y&&A<=h&&w>=D&&P<=J&&U>=B&&A<=z)return M;const F=getComputedStyle(Z),L=parseInt(F.borderLeftWidth,10),I=parseInt(F.borderTopWidth,10),H=parseInt(F.borderRightWidth,10),te=parseInt(F.borderBottomWidth,10);let ee=0,K=0;const ue="offsetWidth"in Z?Z.offsetWidth-Z.clientWidth-L-H:0,G="offsetHeight"in Z?Z.offsetHeight-Z.clientHeight-I-te:0,ge="offsetWidth"in Z?Z.offsetWidth===0?0:ne/Z.offsetWidth:0,me="offsetHeight"in Z?Z.offsetHeight===0?0:oe/Z.offsetHeight:0;if(m===Z)ee=o==="start"?T:o==="end"?T-y:o==="nearest"?Lr(x,x+y,y,I,te,x+T,x+T+k,k):T-y/2,K=l==="start"?N:l==="center"?N-h/2:l==="end"?N-h:Lr(v,v+h,h,L,H,v+N,v+N+E,E),ee=Math.max(0,ee+x),K=Math.max(0,K+v);else{ee=o==="start"?T-D-I:o==="end"?T-J+te+G:o==="nearest"?Lr(D,J,oe,I,te+G,T,T+k,k):T-(D+oe/2)+G/2,K=l==="start"?N-B-L:l==="center"?N-(B+ne/2)+ue/2:l==="end"?N-z+H+ue:Lr(B,z,ne,L,H+ue,N,N+E,E);const{scrollLeft:_e,scrollTop:Se}=Z;ee=me===0?0:Math.max(0,Math.min(Se+ee/me,Z.scrollHeight-oe/me+G)),K=ge===0?0:Math.max(0,Math.min(_e+K/ge,Z.scrollWidth-ne/ge+ue)),T+=Se-ee,N+=_e-K}M.push({el:Z,top:ee,left:K})}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}(),id=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},sd=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:{},zr=new WeakMap,Su=/auto|scroll/,w0=/^tb|vertical/,E0=/msie|trident/i.test(fr.navigator&&fr.navigator.userAgent),Bt=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 id(0,0,0,0)}),od=function(e,t){if(t===void 0&&(t=!1),zr.has(e)&&!t)return zr.get(e);if(sd(e))return zr.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:Bt(n.paddingTop),u=r?0:Bt(n.paddingRight),c=r?0:Bt(n.paddingBottom),f=r?0:Bt(n.paddingLeft),m=r?0:Bt(n.borderTopWidth),p=r?0:Bt(n.borderRightWidth),g=r?0:Bt(n.borderBottomWidth),h=r?0:Bt(n.borderLeftWidth),y=f+u,v=l+c,x=h+p,k=m+g,E=o?e.offsetHeight-k-e.clientHeight:0,w=s?e.offsetWidth-x-e.clientWidth:0,A=a?y+x:0,P=a?v+k:0,U=r?r.width:Bt(n.width)-A-w,$=r?r.height:Bt(n.height)-P-E,j=U+y+w+x,R=$+v+E+k,_=fn({devicePixelContentBoxSize:Mn(Math.round(U*devicePixelRatio),Math.round($*devicePixelRatio),i),borderBoxSize:Mn(j,R,i),contentBoxSize:Mn(U,$,i),contentRect:new id(f,l,U,$)});return zr.set(e,_),_},ud=function(e,t,n){var r=od(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=od(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}(),ld=function(e){if(sd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},B0=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),f=ld(u.target);o.push(c),u.lastReportedSize=ud(u.target,u.observedBox),f<e&&(e=f)}),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()&&(ld(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},k0=function(){var e=0;for(Ou(e);b0();)e=B0(),Ou(e);return y0()&&D0(),e>0},mi,cd=[],A0=function(){return cd.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++)}}cd.push(e),mi()},T0=function(e){F0(function(){requestAnimationFrame(e)})},aa=0,S0=function(){return!!aa},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=k0()}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){!aa&&e>0&&us.start(),aa+=e,!aa&&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=ud(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}(),qr=new WeakMap,Mu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Wr=function(){function e(){}return e.connect=function(t,n){var r=new M0(t,n);qr.set(t,r)},e.observe=function(t,n,r){var a=qr.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=qr.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=qr.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.");Wr.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");Wr.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");Wr.unobserve(this,t)},e.prototype.disconnect=function(){Wr.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},dd=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),fd=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),ia=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,hd=new WeakMap,sa=new WeakMap,ls=new WeakMap,_r=new WeakMap,hn=new WeakMap,Da=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,md=new WeakMap,Hn=Symbol("placeholder"),pd=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},gd=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]=vd(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},vd=(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]=vd(e,t,n);return r},bd=e=>{var t="";if(gd(e)&&e.nodeValue)return e.nodeValue;if(yt(e)){for(var n of Array.from(e.childNodes))t+=bd(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}=Y.getWindow(e);if(a.contains(r))return Y.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 Y={androidPendingDiffs:e=>ut.get(e),androidScheduleFlush:e=>{var t;(t=Ys.get(e))===null||t===void 0||t()},blur:e=>{var t=Y.toDOMNode(e,e),n=Y.findDocumentOrShadowRoot(e);Gt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=Y.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=Y.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=Y.toSlateNode(e,t.target),s=Y.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 f=b.range(e,c);return f}}var m,{document:p}=Y.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 h=Y.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return h},findKey:(e,t)=>{var n=Da.get(t);return n||(n=new ab,Da.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(()=>{Y.focus(t,{retries:n.retries-1})},10);return}var r=Y.toDOMNode(t,t),a=Y.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=Y.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=hd.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=Y.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)&&Y.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)=>Y.hasEditableTarget(e,t)||Y.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>Jt(t)&&Y.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=Y.hasTarget(e,t)&&Y.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)?sa.get(e):n==null?void 0:n.get(Y.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=Y.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:f}=c.textContent,m=u.getAttribute("data-slate-length"),p=m==null?f:parseInt(m,10),g=o+p,h=s[l+1];if(t.offset===g&&h!==null&&h!==void 0&&h.hasAttribute("data-slate-mark-placeholder")){var y,v=h.childNodes[0];a=[v instanceof Y0?v:h,(y=h.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var x=Math.min(f,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=q.isBackward(t),i=Y.toDOMPoint(e,n),s=q.isCollapsed(t)?i:Y.toDOMPoint(e,r),o=Y.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[f,m]=a?i:s,p=yt(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),h=yt(f)?f:f.parentElement,y=!!h.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(f,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,f,m=Y.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,h=o.closest("[data-slate-leaf]"),y=null;if(h){if(l=h.closest('[data-slate-node="text"]'),l){var v=Y.getWindow(e),x=v.document.createRange();x.setStart(l,0),x.setEnd(i,s);var k=x.cloneContents(),E=[...Array.prototype.slice.call(k.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(k.querySelectorAll("[contenteditable=false]"))];E.forEach(N=>{if(at&&!r&&N.hasAttribute("data-slate-zero-width")&&N.textContent.length>0&&N.textContext!=="\uFEFF"){N.textContent.startsWith("\uFEFF")&&(N.textContent=N.textContent.slice(1));return}N.parentNode.removeChild(N)}),u=k.textContent.length,y=l}}else if(g){for(var w=g.querySelectorAll("[data-slate-leaf]"),A=0;A<w.length;A++){var P=w[A];if(Y.hasDOMNode(e,P)){h=P;break}}h?(l=h.closest('[data-slate-node="text"]'),y=h,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(N=>{u-=N.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&&(f=y.textContent)!==null&&f!==void 0&&f.endsWith(`
|
|
125
104
|
|
|
126
|
-
`))&&u--}if(at&&!l&&!r){var
|
|
105
|
+
`))&&u--}if(at&&!l&&!r){var U=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(U&&Y.hasDOMNode(e,U,{editable:!0})){var $=Y.toSlateNode(e,U),{path:j,offset:R}=b.start(e,Y.findPath(e,$));return U.querySelector("[data-slate-leaf]")||(R=s),{path:j,offset:R}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var _=Y.toSlateNode(e,l),T=Y.findPath(e,_);return{path:T,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=fs(t)?t.anchorNode:t.startContainer,o,l,u,c,f;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(P){return P.childElementCount>0?A(P.children[0]):P};var g=m.startContainer,h=p.startContainer,y=A(g.children[m.startOffset]),v=A(h.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;fd&&X0(o)||On?f=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:f=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,f=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(`
|
|
127
106
|
|
|
128
|
-
`)&&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 A=G.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var k=f?A:G.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!k)return null;var E={anchor:A,focus:k};return W.isExpanded(E)&&W.isForward(E)&&Dt(u)&&y.void(e,{at:E.focus,mode:"highest"})&&(E=y.unhangRange(e,E,{voids:!0})),E}};function lb(e,t){var{path:n,diff:r}=t;if(!y.hasPath(e,n))return!1;var a=se.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=j.next(n);if(!y.hasPath(e,i))return!1;var s=se.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function yd(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 cb(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 db(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 Dd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=cb(i,a),o=Math.min(i.length-s,a.length-s),l=db(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 fb(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=yd(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 Dd(e,{start:r,end:l,text:o})}function hb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function fs(e,t){var{path:n,offset:r}=t;if(!y.hasPath(e,n))return null;var a=se.get(e,n);if(!de.isText(a))return null;var i=y.above(e,{match:o=>ce.isElement(o)&&y.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=y.next(e,{at:n,match:de.isText});if(!s||!j.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Lu(e,t){var n=fs(e,t.anchor);if(!n)return null;if(W.isCollapsed(t))return{anchor:n,focus:n};var r=fs(e,t.focus);return r?{anchor:n,focus:r}:null}function hs(e,t,n){var r=ut.get(e),a=r==null?void 0:r.find(c=>{var{path:f}=c;return j.equals(f,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"&&j.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 zu(e,t,n){var r=hs(e,t.anchor,n);if(!r)return null;if(W.isCollapsed(t))return{anchor:r,focus:r};var a=hs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function mb(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!j.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!j.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!j.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:j.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:j.transform(n,t,{affinity:"forward"})};case"merge_node":return j.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:j.transform(n,t)}:{diff:r,id:a,path:j.transform(n,t)}}var i=j.transform(n,t);return i?{diff:r,path:i,id:a}:null}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 Vr(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){Ct(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 pb=25,gb=200,vb=function(){},bb=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function yb(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:T}=t,R=Lu(t,w);R&&(!T||!W.equals(R,T))&&ee.select(t,R)}},f=()=>{var w=Vt.get(t);if(Vt.delete(t),!!w){if(w.at){var T=Ce.isPoint(w.at)?fs(t,w.at):Lu(t,w.at);if(!T)return;var R=y.range(t,T);(!t.selection||!W.equals(t.selection,R))&&ee.select(t,T)}w.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var w=t.selection&&y.rangeRef(t,t.selection,{affinity:"forward"});Lt.set(t,t.marks),vb("flush",Vt.get(t),ut.get(t));for(var T=k(),R;R=(M=ut.get(t))===null||M===void 0?void 0:M[0];){var M,K,V=Et.get(t);V!==void 0&&(Et.delete(t),t.marks=V),V&&u===!1&&(u=null);var ie=hb(R);(!t.selection||!W.equals(t.selection,ie))&&ee.select(t,ie),R.diff.text?y.insertText(t,R.diff.text):y.deleteFragment(t),ut.set(t,(K=ut.get(t))===null||K===void 0?void 0:K.filter(U=>{var{id:X}=U;return X!==R.id})),lb(t,R)||(T=!1,Vt.delete(t),Lt.delete(t),a="action",Kt.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var Q=w==null?void 0:w.unref();if(Q&&!Kt.get(t)&&(!t.selection||!W.equals(Q,t.selection))&&ee.select(t,Q),A()){f();return}T&&n(),n.flush(),r.flush(),c();var D=Lt.get(t);Lt.delete(t),D!==void 0&&(t.marks=D,t.onChange())},h=w=>{i&&clearTimeout(i),i=setTimeout(()=>{dn.set(t,!1),p()},pb)},g=w=>{dn.set(t,!0),i&&(clearTimeout(i),i=null)},m=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,R=us.get(t);if(R){if(k()||T){R.style.display="none";return}R.style.removeProperty("display")}},b=(w,T)=>{var R,M=(R=ut.get(t))!==null&&R!==void 0?R:[];ut.set(t,M);var K=se.leaf(t,w),V=M.findIndex(D=>j.equals(D.path,w));if(V<0){var ie=Dd(K.text,T);ie&&M.push({path:w,diff:T,id:l++}),m();return}var Q=fb(K.text,M[V].diff,T);if(!Q){M.splice(V,1),m();return}M[V]=Vr(Vr({},M[V]),{},{diff:Q})},v=function(T){var{at:R}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Kt.delete(t),n.cancel(),r.cancel(),A()&&p(),Vt.set(t,{at:R,run:T}),o=setTimeout(p)},x=w=>{var T;s&&(clearTimeout(s),s=null);var{inputType:R}=w,M=null,K=w.dataTransfer||w.data||void 0;u!==!1&&R!=="insertText"&&R!=="insertCompositionText"&&(u=!1);var[V]=w.getTargetRanges();V&&(M=G.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var ie=G.getWindow(t),Q=ie.getSelection();if(!M&&Q&&(V=Q,M=G.toSlateRange(t,Q,{exactMatch:!1,suppressThrow:!0})),M=(T=M)!==null&&T!==void 0?T:t.selection,!!M){var D=!0;if(R.startsWith("delete")){if(W.isExpanded(M)){var[U,X]=W.edges(M),_=se.leaf(t,U.path);if(_.text.length===U.offset&&X.offset===0){var F=y.next(t,{at:U.path,match:de.isText});F&&j.equals(F[1],X.path)&&(M={anchor:X,focus:X})}}var L=R.endsWith("Backward")?"backward":"forward",[$,q]=W.edges(M),[ne,te]=y.leaf(t,$.path),Z={text:"",start:$.offset,end:q.offset},le=ut.get(t),J=le==null?void 0:le.find(me=>j.equals(me.path,te)),be=J?[J.diff,Z]:[Z],pe=yd(ne.text,...be);if(pe.length===0&&(D=!1),W.isExpanded(M)){if(D&&j.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:$.offset},Se=y.range(t,_e,_e);return P(Se),b(M.anchor.path,{text:"",end:q.offset,start:$.offset})}return v(()=>y.deleteFragment(t,{direction:L}),{at:M})}}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>y.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Pe}=M;if(D&&W.isCollapsed(M)){var Ge=se.leaf(t,Pe.path);if(Pe.offset<Ge.text.length)return b(Pe.path,{text:"",start:Pe.offset,end:Pe.offset+1})}return v(()=>y.deleteForward(t),{at:M})}case"deleteContentBackward":{var Ke,{anchor:Ze}=M,tt=ds(V)?V.isCollapsed:!!((Ke=V)!==null&&Ke!==void 0&&Ke.collapsed);return D&&tt&&W.isCollapsed(M)&&Ze.offset>0?b(Ze.path,{text:"",start:Ze.offset-1,end:Ze.offset}):v(()=>y.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return v(()=>{y.deleteBackward(t,{unit:"line"}),y.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return v(()=>y.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return v(()=>y.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return v(()=>y.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return v(()=>y.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return v(()=>y.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return v(()=>y.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return v(()=>y.insertSoftBreak(t),{at:M});case"insertParagraph":return v(()=>y.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(bb(K))return v(()=>G.insertData(t,K),{at:M});var Ae=K??"";if(Et.get(t)&&(Ae=Ae.replace("\uFEFF","")),R==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
129
|
-
`))return v(()=>{var
|
|
130
|
-
`);
|
|
131
|
-
`?C.createElement(
|
|
132
|
-
`:""),[i]=C.useState(a);return kr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(Ob,{ref:r},i)},Ob=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),vi=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",Sb({},a),!at||!n?"\uFEFF":null,n?C.createElement("br",null):null)};function Vu(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 xd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Pb=at?300:0;function Nb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ku(e){e.current&&(clearTimeout(e.current),e.current=null)}var Rb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Ib,xd({},x))}=e,o=an(),l=C.useRef(null),u=C.useRef(null),[c,f]=C.useState(!1),p=C.useRef(null),h=C.useCallback(x=>{if(Nb(l,x==null),x==null){var A;us.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(us.set(o,x),!l.current){var k=window.ResizeObserver||q0;l.current=new k(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=C.createElement(jb,{isLast:n,leaf:t,parent:a,text:r}),m=!!t[Un];if(C.useEffect(()=>(m?p.current||(p.current=setTimeout(()=>{f(!0),p.current=null},Pb)):(Ku(p),f(!1)),()=>Ku(p)),[m,f]),m&&c){var b={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:cr?"inherit":void 0},contentEditable:!1,ref:h}};g=C.createElement(C.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Mb=C.memo(Rb,(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[Un]===e.leaf[Un]),Ib=e=>{var{attributes:t,children:n}=e;return C.createElement("span",xd({},t),n)},$b=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=an(),l=C.useRef(null),u=de.decorations(s,t),c=G.findKey(o,s),f=[],p=0;p<u.length;p++){var h=u[p];f.push(C.createElement(Mb,{isLast:n&&p===u.length-1,key:"".concat(c.id,"-").concat(p),renderPlaceholder:a,leaf:h,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(m=>{var b=qa.get(o);m?(b==null||b.set(c,m),pn.set(s,m),Br.set(m,s)):(b==null||b.delete(c),pn.delete(s),l.current&&Br.delete(l.current)),l.current=m},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},wd=C.memo($b,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Tb(t.decorations,e.decorations));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 ms(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){Ct(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 Lb=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(qb,ms({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=an(),l=Ub(),u=o.isInline(n),c=G.findKey(o,n),f=C.useCallback(x=>{var A=qa.get(o);x?(A==null||A.set(c,x),pn.set(n,x),Br.set(x,n)):(A==null||A.delete(c),pn.delete(n))},[o,c,n]),p=_d({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),h={"data-slate-node":"element",ref:f};if(u&&(h["data-slate-inline"]=!0),!u&&y.hasInlines(o,n)){var g=se.string(n),m=ed(g);m==="rtl"&&(h.dir=m)}if(y.isVoid(o,n)){h["data-slate-void"]=!0,!l&&u&&(h.contentEditable=!1);var b=u?"span":"div",[[v]]=se.texts(n);p=C.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(wd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Vs.set(v,0),Ks.set(v,n)}return r({attributes:h,children:p,element:n})},zb=C.memo(Lb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Fb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),qb=e=>{var{attributes:t,children:n,element:r}=e,a=an(),i=a.isInline(r)?"span":"div";return C.createElement(i,ms(ms({},t),{},{style:{position:"relative"}}),n)},Ed=C.createContext(()=>[]),Wb=()=>C.useContext(Ed),Hb=C.createContext(!1),_d=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Wb(),l=an(),u=G.findPath(l,n),c=[],f=ce.isElement(n)&&!l.isInline(n)&&y.hasInlines(l,n),p=0;p<n.children.length;p++){var h=u.concat(p),g=n.children[p],m=G.findKey(l,g),b=y.range(l,h),v=s&&W.intersection(b,s),x=o([g,h]);for(var A of t){var k=W.intersection(A,b);k&&x.push(k)}ce.isElement(g)?c.push(C.createElement(Hb.Provider,{key:"provider-".concat(m.id),value:!!v},C.createElement(zb,{decorations:x,element:g,key:m.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(wd,{decorations:x,key:m.id,isLast:f&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Vs.set(g,p),Ks.set(g,n)}return c},Bd=C.createContext(!1),Ub=()=>C.useContext(Bd),kd=C.createContext(null),Xn=()=>{var e=C.useContext(kd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Vb(){var e=an(),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 Kb=3,Zb={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"},Yb={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"},Gb={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Me=e=>{var t=Zb[e],n=Yb[e],r=Gb[e],a=t&&ai(t),i=n&&ai(n),s=r&&ai(r);return o=>!!(a&&a(o)||$u&&i&&i(o)||!$u&&s&&s(o))},Ie={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")},Qb=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Gs(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}},Jb={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Ad extends C.Component{constructor(){super(...arguments),Ct(this,"context",null),Ct(this,"manager",null),Ct(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,Jb)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Qb(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}}Ct(Ad,"contextType",Us);var Xb=at?Ad:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},ey=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],ty=["text"];function Yu(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 Ft(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ny=e=>C.createElement(C.Fragment,null,_d(e)),ry=e=>{var t=C.useCallback(F=>C.createElement(ay,Ft({},F)),[]),{autoFocus:n,decorate:r=iy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=sy,style:f={},as:p="div",disableDefaultStyles:h=!1}=e,g=Hn(e,ey),m=Xn(),[b,v]=C.useState(!1),x=C.useRef(null),A=C.useRef([]),[k,E]=C.useState(),{onUserInput:B,receivedUserInput:P}=Vb(),[,z]=C.useReducer(F=>F+1,0);md.set(m,z),ls.set(m,s);var I=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var N=C.useRef(),O=C.useMemo(()=>b0(()=>{var F=N.current;if((at||!G.isComposing(m))&&(!I.isUpdatingSelection||F!=null&&F.isFlushing())&&!I.isDraggingInternally){var L=G.findDocumentOrShadowRoot(m),{activeElement:$}=L,q=G.toDOMNode(m,m),ne=L.getSelection();if($===q?(I.latestElement=$,Gt.set(m,!0)):Gt.delete(m),!ne)return ee.deselect(m);var{anchorNode:te,focusNode:Z}=ne,le=G.hasEditableTarget(m,te)||G.isTargetInsideNonReadonlyVoid(m,te),J=G.hasEditableTarget(m,Z)||G.isTargetInsideNonReadonlyVoid(m,Z);if(le&&J){var be=G.toSlateRange(m,ne,{exactMatch:!1,suppressThrow:!0});be&&(!G.isComposing(m)&&!(F!=null&&F.hasPendingChanges())&&!(F!=null&&F.isFlushing())?ee.select(m,be):F==null||F.handleUserSelect(be))}s&&(!le||!J)&&ee.deselect(m)}},100),[m,s,I]),w=C.useMemo(()=>f0(O,0),[O]);N.current=_b({node:x,onDOMSelectionChange:O,scheduleOnDOMSelectionChange:w}),kr(()=>{var F,L,$;x.current&&($=Ys(x.current))?(hd.set(m,$),oa.set(m,x.current),pn.set(m,x.current),Br.set(x.current,m)):pn.delete(m);var{selection:q}=m,ne=G.findDocumentOrShadowRoot(m),te=ne.getSelection();if(!(!te||!G.isFocused(m)||(F=N.current)!==null&&F!==void 0&&F.hasPendingAction())){var Z=pe=>{var _e=te.type!=="None";if(!(!q&&!_e)){var Se=te.focusNode,Pe;if(Nn&&te.rangeCount>1){var Ge=te.getRangeAt(0),Ke=te.getRangeAt(te.rangeCount-1);Ge.startContainer===Se?Pe=Ke.endContainer:Pe=Ge.startContainer}else Pe=te.anchorNode;var Ze=oa.get(m),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&q&&!pe){var Ae=G.toSlateRange(m,te,{exactMatch:!0,suppressThrow:!0});if(Ae&&W.equals(Ae,q)){var We;if(!I.hasMarkPlaceholder||(We=Pe)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(q&&!G.hasRange(m,q)){m.selection=G.toSlateRange(m,te,{exactMatch:!1,suppressThrow:!0});return}I.isUpdatingSelection=!0;var $e=q&&G.toDOMRange(m,q);return $e?(G.isComposing(m)&&!at?te.collapseToEnd():W.isBackward(q)?te.setBaseAndExtent($e.endContainer,$e.endOffset,$e.startContainer,$e.startOffset):te.setBaseAndExtent($e.startContainer,$e.startOffset,$e.endContainer,$e.endOffset),c(m,$e)):te.removeAllRanges(),$e}};te.rangeCount<=1&&Z();var le=((L=N.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!at||!le){setTimeout(()=>{I.isUpdatingSelection=!1});return}var J=null,be=requestAnimationFrame(()=>{if(le){var pe=_e=>{try{var Se=G.toDOMNode(m,m);Se.focus(),Z(_e)}catch{}};pe(),J=setTimeout(()=>{pe(!0),I.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(be),J&&clearTimeout(J)}}});var T=C.useCallback(F=>{if(B(),!s&&G.hasEditableTarget(m,F.target)&&!oy(F,a)){var L;if(N.current)return N.current.handleDOMBeforeInput(F);w.flush(),O.flush();var{selection:$}=m,{inputType:q}=F,ne=F.dataTransfer||F.data||void 0,te=q==="insertCompositionText"||q==="deleteCompositionText";if(te&&G.isComposing(m))return;var Z=!1;if(q==="insertText"&&$&&W.isCollapsed($)&&F.data&&F.data.length===1&&/[a-z ]/i.test(F.data)&&$.anchor.offset!==0){var le,J;Z=!0,m.marks&&(Z=!1);var{anchor:be}=$,[pe,_e]=G.toDOMPoint(m,be),Se=(le=pe.parentElement)===null||le===void 0?void 0:le.closest("a"),Pe=G.getWindow(m);if(Z&&Se&&G.hasDOMNode(m,Se)){var Ge,Ke=Pe==null?void 0:Pe.document.createTreeWalker(Se,NodeFilter.SHOW_TEXT).lastChild();Ke===pe&&((Ge=Ke.textContent)===null||Ge===void 0?void 0:Ge.length)===_e&&(Z=!1)}if(Z&&pe.parentElement&&(Pe==null||(J=Pe.getComputedStyle(pe.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ze=y.above(m,{at:be.path,match:ae=>ce.isElement(ae)&&y.isBlock(m,ae)});Ze&&se.string(Ze[0]).includes(" ")&&(Z=!1)}}if(!q.startsWith("delete")||q.startsWith("deleteBy")){var[tt]=F.getTargetRanges();if(tt){var Ae=G.toSlateRange(m,tt,{exactMatch:!1,suppressThrow:!1});if(!$||!W.equals($,Ae)){Z=!1;var We=!te&&m.selection&&y.rangeRef(m,m.selection);ee.select(m,Ae),We&&mr.set(m,We)}}}if(te)return;if(Z||F.preventDefault(),$&&W.isExpanded($)&&q.startsWith("delete")){var $e=q.endsWith("Backward")?"backward":"forward";y.deleteFragment(m,{direction:$e});return}switch(q){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{y.deleteFragment(m);break}case"deleteContent":case"deleteContentForward":{y.deleteForward(m);break}case"deleteContentBackward":{y.deleteBackward(m);break}case"deleteEntireSoftLine":{y.deleteBackward(m,{unit:"line"}),y.deleteForward(m,{unit:"line"});break}case"deleteHardLineBackward":{y.deleteBackward(m,{unit:"block"});break}case"deleteSoftLineBackward":{y.deleteBackward(m,{unit:"line"});break}case"deleteHardLineForward":{y.deleteForward(m,{unit:"block"});break}case"deleteSoftLineForward":{y.deleteForward(m,{unit:"line"});break}case"deleteWordBackward":{y.deleteBackward(m,{unit:"word"});break}case"deleteWordForward":{y.deleteForward(m,{unit:"word"});break}case"insertLineBreak":y.insertSoftBreak(m);break;case"insertParagraph":{y.insertBreak(m);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{q==="insertFromComposition"&&G.isComposing(m)&&(v(!1),dn.set(m,!1)),(ne==null?void 0:ne.constructor.name)==="DataTransfer"?G.insertData(m,ne):typeof ne=="string"&&(Z?A.current.push(()=>y.insertText(m,ne)):y.insertText(m,ne));break}}var H=(L=mr.get(m))===null||L===void 0?void 0:L.unref();mr.delete(m),H&&(!m.selection||!W.equals(m.selection,H))&&ee.select(m,H)}},[m,O,B,a,s,w]),R=C.useCallback(F=>{F==null?(O.cancel(),w.cancel(),oa.delete(m),pn.delete(m),x.current&&Ht&&x.current.removeEventListener("beforeinput",T)):Ht&&F.addEventListener("beforeinput",T),x.current=F},[O,w,m,T]);kr(()=>{var F=G.getWindow(m);return F.document.addEventListener("selectionchange",w),()=>{F.document.removeEventListener("selectionchange",w)}},[w]);var M=r([m,[]]),K=i&&m.children.length===1&&Array.from(se.texts(m)).length===1&&se.string(m)===""&&!b,V=C.useCallback(F=>{if(F&&K){var L;E((L=F.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else E(void 0)},[K]);if(K){var ie=y.start(m,[]);M.push({[Un]:!0,placeholder:i,onPlaceholderResize:V,anchor:ie,focus:ie})}var{marks:Q}=m;if(I.hasMarkPlaceholder=!1,m.selection&&W.isCollapsed(m.selection)&&Q){var{anchor:D}=m.selection,U=se.leaf(m,D.path),X=Hn(U,ty);if(!de.equals(U,Q,{loose:!0})){I.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(X).map(F=>[F,null]));M.push(Ft(Ft(Ft({[pd]:!0},_),Q),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:F}=m;if(F){var{anchor:L}=F,$=se.leaf(m,L.path);if(Q&&!de.equals($,Q,{loose:!0})){Et.set(m,Q);return}}Et.delete(m)})}),C.createElement(Bd.Provider,{value:s},C.createElement(Ed.Provider,{value:r},C.createElement(Xb,{node:x,receivedUserInput:P},C.createElement(p,Ft(Ft({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:Ft(Ft({},h?{}:Ft({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),f),onBeforeInput:C.useCallback(F=>{if(!Ht&&!s&&!rt(F,g.onBeforeInput)&&G.hasSelectableTarget(m,F.target)&&(F.preventDefault(),!G.isComposing(m))){var L=F.data;y.insertText(m,L)}},[g.onBeforeInput,m,s]),onInput:C.useCallback(F=>{if(!rt(F,g.onInput)){if(N.current){N.current.handleInput();return}for(var L of A.current)L();A.current=[]}},[g.onInput]),onBlur:C.useCallback(F=>{if(!(s||I.isUpdatingSelection||!G.hasSelectableTarget(m,F.target)||rt(F,g.onBlur))){var L=G.findDocumentOrShadowRoot(m);if(I.latestElement!==L.activeElement){var{relatedTarget:$}=F,q=G.toDOMNode(m,m);if($!==q&&!(Dt($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&Xt($)&&G.hasDOMNode(m,$)){var ne=G.toSlateNode(m,$);if(ce.isElement(ne)&&!m.isVoid(ne))return}if(cr){var te=L.getSelection();te==null||te.removeAllRanges()}Gt.delete(m)}}}},[s,I.isUpdatingSelection,I.latestElement,m,g.onBlur]),onClick:C.useCallback(F=>{if(G.hasTarget(m,F.target)&&!rt(F,g.onClick)&&Xt(F.target)){var L=G.toSlateNode(m,F.target),$=G.findPath(m,L);if(!y.hasPath(m,$)||se.get(m,$)!==L)return;if(F.detail===Kb&&$.length>=1){var q=$;if(!(ce.isElement(L)&&y.isBlock(m,L))){var ne,te=y.above(m,{match:Se=>ce.isElement(Se)&&y.isBlock(m,Se),at:$});q=(ne=te==null?void 0:te[1])!==null&&ne!==void 0?ne:$.slice(0,1)}var Z=y.range(m,q);ee.select(m,Z);return}if(s)return;var le=y.start(m,$),J=y.end(m,$),be=y.void(m,{at:le}),pe=y.void(m,{at:J});if(be&&pe&&j.equals(be[1],pe[1])){var _e=y.range(m,le);ee.select(m,_e)}}},[m,g.onClick,s]),onCompositionEnd:C.useCallback(F=>{if(G.hasSelectableTarget(m,F.target)){var L;if(G.isComposing(m)&&Promise.resolve().then(()=>{v(!1),dn.set(m,!1)}),(L=N.current)===null||L===void 0||L.handleCompositionEnd(F),rt(F,g.onCompositionEnd)||at)return;if(!cr&&!G0&&!V0&&!J0&&!Q0&&F.data){var $=Et.get(m);Et.delete(m),$!==void 0&&(Lt.set(m,m.marks),m.marks=$),y.insertText(m,F.data);var q=Lt.get(m);Lt.delete(m),q!==void 0&&(m.marks=q)}}},[g.onCompositionEnd,m]),onCompositionUpdate:C.useCallback(F=>{G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCompositionUpdate)&&(G.isComposing(m)||(v(!0),dn.set(m,!0)))},[g.onCompositionUpdate,m]),onCompositionStart:C.useCallback(F=>{if(G.hasSelectableTarget(m,F.target)){var L;if((L=N.current)===null||L===void 0||L.handleCompositionStart(F),rt(F,g.onCompositionStart)||at)return;v(!0);var{selection:$}=m;if($&&W.isExpanded($)){y.deleteFragment(m);return}}},[g.onCompositionStart,m]),onCopy:C.useCallback(F=>{G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCopy)&&!Gu(F)&&(F.preventDefault(),G.setFragmentData(m,F.clipboardData,"copy"))},[g.onCopy,m]),onCut:C.useCallback(F=>{if(!s&&G.hasSelectableTarget(m,F.target)&&!rt(F,g.onCut)&&!Gu(F)){F.preventDefault(),G.setFragmentData(m,F.clipboardData,"cut");var{selection:L}=m;if(L)if(W.isExpanded(L))y.deleteFragment(m);else{var $=se.parent(m,L.anchor.path);y.isVoid(m,$)&&ee.delete(m)}}},[s,m,g.onCut]),onDragOver:C.useCallback(F=>{if(G.hasTarget(m,F.target)&&!rt(F,g.onDragOver)){var L=G.toSlateNode(m,F.target);ce.isElement(L)&&y.isVoid(m,L)&&F.preventDefault()}},[g.onDragOver,m]),onDragStart:C.useCallback(F=>{if(!s&&G.hasTarget(m,F.target)&&!rt(F,g.onDragStart)){var L=G.toSlateNode(m,F.target),$=G.findPath(m,L),q=ce.isElement(L)&&y.isVoid(m,L)||y.void(m,{at:$,voids:!0});if(q){var ne=y.range(m,$);ee.select(m,ne)}I.isDraggingInternally=!0,G.setFragmentData(m,F.dataTransfer,"drag")}},[s,m,g.onDragStart,I]),onDrop:C.useCallback(F=>{if(!s&&G.hasTarget(m,F.target)&&!rt(F,g.onDrop)){F.preventDefault();var L=m.selection,$=G.findEventRange(m,F),q=F.dataTransfer;ee.select(m,$),I.isDraggingInternally&&L&&!W.equals(L,$)&&!y.void(m,{at:$,voids:!0})&&ee.delete(m,{at:L}),G.insertData(m,q),G.isFocused(m)||G.focus(m)}I.isDraggingInternally=!1},[s,m,g.onDrop,I]),onDragEnd:C.useCallback(F=>{!s&&I.isDraggingInternally&&g.onDragEnd&&G.hasTarget(m,F.target)&&g.onDragEnd(F),I.isDraggingInternally=!1},[s,I,g,m]),onFocus:C.useCallback(F=>{if(!s&&!I.isUpdatingSelection&&G.hasEditableTarget(m,F.target)&&!rt(F,g.onFocus)){var L=G.toDOMNode(m,m),$=G.findDocumentOrShadowRoot(m);if(I.latestElement=$.activeElement,Nn&&F.target!==L){L.focus();return}Gt.set(m,!0)}},[s,I,m,g.onFocus]),onKeyDown:C.useCallback(F=>{if(!s&&G.hasEditableTarget(m,F.target)){var L;(L=N.current)===null||L===void 0||L.handleKeyDown(F);var{nativeEvent:$}=F;if(G.isComposing(m)&&$.isComposing===!1&&(dn.set(m,!1),v(!1)),rt(F,g.onKeyDown)||G.isComposing(m))return;var{selection:q}=m,ne=m.children[q!==null?q.focus.path[0]:0],te=ed(se.string(ne))==="rtl";if(Ie.isRedo($)){F.preventDefault();var Z=m;typeof Z.redo=="function"&&Z.redo();return}if(Ie.isUndo($)){F.preventDefault();var le=m;typeof le.undo=="function"&&le.undo();return}if(Ie.isMoveLineBackward($)){F.preventDefault(),ee.move(m,{unit:"line",reverse:!0});return}if(Ie.isMoveLineForward($)){F.preventDefault(),ee.move(m,{unit:"line"});return}if(Ie.isExtendLineBackward($)){F.preventDefault(),ee.move(m,{unit:"line",edge:"focus",reverse:!0});return}if(Ie.isExtendLineForward($)){F.preventDefault(),ee.move(m,{unit:"line",edge:"focus"});return}if(Ie.isMoveBackward($)){F.preventDefault(),q&&W.isCollapsed(q)?ee.move(m,{reverse:!te}):ee.collapse(m,{edge:te?"end":"start"});return}if(Ie.isMoveForward($)){F.preventDefault(),q&&W.isCollapsed(q)?ee.move(m,{reverse:te}):ee.collapse(m,{edge:te?"start":"end"});return}if(Ie.isMoveWordBackward($)){F.preventDefault(),q&&W.isExpanded(q)&&ee.collapse(m,{edge:"focus"}),ee.move(m,{unit:"word",reverse:!te});return}if(Ie.isMoveWordForward($)){F.preventDefault(),q&&W.isExpanded(q)&&ee.collapse(m,{edge:"focus"}),ee.move(m,{unit:"word",reverse:te});return}if(Ht){if((fd||cr)&&q&&(Ie.isDeleteBackward($)||Ie.isDeleteForward($))&&W.isCollapsed(q)){var J=se.parent(m,q.anchor.path);if(ce.isElement(J)&&y.isVoid(m,J)&&(y.isInline(m,J)||y.isBlock(m,J))){F.preventDefault(),y.deleteBackward(m,{unit:"block"});return}}}else{if(Ie.isBold($)||Ie.isItalic($)||Ie.isTransposeCharacter($)){F.preventDefault();return}if(Ie.isSoftBreak($)){F.preventDefault(),y.insertSoftBreak(m);return}if(Ie.isSplitBlock($)){F.preventDefault(),y.insertBreak(m);return}if(Ie.isDeleteBackward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m);return}if(Ie.isDeleteForward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m);return}if(Ie.isDeleteLineBackward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m,{unit:"line"});return}if(Ie.isDeleteLineForward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m,{unit:"line"});return}if(Ie.isDeleteWordBackward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"backward"}):y.deleteBackward(m,{unit:"word"});return}if(Ie.isDeleteWordForward($)){F.preventDefault(),q&&W.isExpanded(q)?y.deleteFragment(m,{direction:"forward"}):y.deleteForward(m,{unit:"word"});return}}}},[s,m,g.onKeyDown]),onPaste:C.useCallback(F=>{!s&&G.hasEditableTarget(m,F.target)&&!rt(F,g.onPaste)&&(!Ht||tb(F.nativeEvent)||cr)&&(F.preventDefault(),G.insertData(m,F.clipboardData))},[s,m,g.onPaste])}),C.createElement(ny,{decorations:M,node:m,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:m.selection})))))},ay=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Ft({},t),n,at&&C.createElement("br",null))},iy=()=>[],sy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),C0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},rt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Gu=e=>Xt(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),oy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Fd=C.createContext(!1),uy=()=>C.useContext(Fd),ly=C.createContext({});function cy(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 dy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],fy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Hn(e,dy),[l,u]=C.useState(()=>{if(!se.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ye.stringify(s)));if(!y.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:f}=cy(t),p=C.useCallback(m=>{var b;switch(r&&r(t.children),m==null||(b=m.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(cs.set(t,p),()=>{cs.set(t,()=>{})}),[t,p]);var[h,g]=C.useState(G.isFocused(t));return C.useEffect(()=>{g(G.isFocused(t))},[t]),kr(()=>{var m=()=>g(G.isFocused(t));return dd>=17?(document.addEventListener("focusin",m),document.addEventListener("focusout",m),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",m)}):(document.addEventListener("focus",m,!0),document.addEventListener("blur",m,!0),()=>{document.removeEventListener("focus",m,!0),document.removeEventListener("blur",m,!0)})},[]),C.createElement(ly.Provider,{value:c},C.createElement(kd.Provider,{value:l},C.createElement(Us.Provider,{value:l.editor},C.createElement(Fd.Provider,{value:h},n))))},Qu=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ju=(e,t,n)=>{var r=G.toDOMRange(e,t).getBoundingClientRect(),a=G.toDOMRange(e,n).getBoundingClientRect();return Qu(r,a)&&Qu(a,r)},hy=(e,t)=>{var n=y.range(e,W.end(t)),r=Array.from(y.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Ju(e,y.range(e,r[a]),n))return y.range(e,r[a],n);if(r.length<2)return y.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Ju(e,y.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return y.range(e,r[i],n)};function Xu(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 el(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xu(Object(n),!0).forEach(function(r){Ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var my=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 f,p;(f=Zs.get(r))===null||f===void 0||f(),!Et.get(r)&&(p=ut.get(r))!==null&&p!==void 0&&p.length&&Et.set(r,null),Lt.delete(r),o(u,c)},r.removeMark=u=>{var c;!Et.get(r)&&(c=ut.get(r))!==null&&c!==void 0&&c.length&&Et.set(r,null),Lt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&W.isCollapsed(r.selection)){var c=y.above(r,{match:g=>ce.isElement(g)&&y.isBlock(r,g),at:r.selection});if(c){var[,f]=c,p=y.range(r,f,r.selection.anchor),h=hy(r,p);W.isCollapsed(h)||ee.delete(r,{at:h})}}},r.apply=u=>{var c=[],f=[],p=ut.get(r);if(p!=null&&p.length){var h=p.map(R=>mb(R,u)).filter(Boolean);ut.set(r,h)}var g=Kt.get(r);g&&Kt.set(r,zu(r,g,u));var m=Vt.get(r);if(m!=null&&m.at){var b=Ce.isPoint(m==null?void 0:m.at)?hs(r,m.at,u):zu(r,m.at,u);Vt.set(r,b?el(el({},m),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Fn(r,u.path));break}case"set_selection":{var v;(v=mr.get(r))===null||v===void 0||v.unref(),mr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Fn(r,j.parent(u.path)));break}case"merge_node":{var x=j.previous(u.path);c.push(...Fn(r,x));break}case"move_node":{var A=j.common(j.parent(u.path),j.parent(u.newPath));c.push(...Fn(r,A));var k;j.isBefore(u.path,u.newPath)?(c.push(...Fn(r,j.parent(u.path))),k=u.newPath):(c.push(...Fn(r,j.parent(u.newPath))),k=u.path);var E=se.get(t,j.parent(k)),B=G.findKey(r,E),P=y.pathRef(r,j.parent(k));f.push([P,B]);break}}a(u);for(var[z,I]of c){var[N]=y.node(r,z);Ca.set(N,I)}for(var[O,w]of f)if(O.current){var[T]=y.node(r,O.current);Ca.set(T,w)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[f,p]=W.edges(c),h=y.void(r,{at:f.path}),g=y.void(r,{at:p.path});if(!(W.isCollapsed(c)&&!h)){var m=G.toDOMRange(r,c),b=m.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(N=>{N.textContent&&N.textContent.trim()!==""&&(v=N)}),g){var[x]=g,A=m.cloneRange(),k=G.toDOMNode(r,x);A.setEndAfter(k),b=A.cloneContents()}if(h&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(N=>{var O=N.getAttribute("data-slate-zero-width")==="n";N.textContent=O?`
|
|
133
|
-
`:""}),gd(v)){var E=v.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(v),b.appendChild(E),v=E}var B=r.getFragment(),P=JSON.stringify(B),z=window.btoa(encodeURIComponent(P));v.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var I=b.ownerDocument.createElement("div");return I.appendChild(b),I.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(I),u.setData("text/html",I.innerHTML),u.setData("text/plain",bd(I)),b.ownerDocument.body.removeChild(I),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||sb(u);if(c){var f=decodeURIComponent(window.atob(c)),p=JSON.parse(f);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var f=c.split(/\r\n|\r|\n/),p=!1;for(var h of f)p&&ee.splitNodes(r,{always:!0}),r.insertText(h),p=!0;return!0}return!1},r.onChange=u=>{var c=dd<18?Yf.unstable_batchedUpdates:f=>f();c(()=>{var f=cs.get(r);f&&f(u),i(u)})},r},Fn=(e,t)=>{var n=[];for(var[r,a]of y.levels(e,{at:t})){var i=G.findKey(e,r);n.push([a,i])}return n};const py={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,setOpenTooltip:()=>{},showLinkEditor:!1,setShowLinkEditor:()=>{},lastAnchor:null,setLastAnchor:()=>{}},xn=C.createContext(py),gy=({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})}},vy=({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})},Qs=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=oe.useIntl(),l=Xn(),{id:u,tabbableOption:c,setFocus:f,openTooltip:p,setOpenTooltip:h,setLastAnchor:g}=C.useContext(xn),m={};return e!==c&&(m.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{h(e)},onMouseLeave:()=>{h(null)},onFocus:()=>{h(e)},onBlur:b=>{b.stopPropagation(),h(null),l.selection&&g(l.selection.anchor)},contentEditable:!1,children:[d.jsxs("button",{...s,...m,className:Y(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var v,x,A,k;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const E=b.currentTarget.closest("li");let B=E==null?void 0:E.nextElementSibling;if(b.key==="ArrowLeft"){const I=E==null?void 0:E.previousElementSibling;I?B=I:B=(v=E==null?void 0:E.parentElement)==null?void 0:v.lastElementChild}else B||(B=(x=E==null?void 0:E.parentElement)==null?void 0:x.firstElementChild);const P=B==null?void 0:B.className.split(" ")[0];P&&(f(P),(A=B==null?void 0:B.querySelector("button"))==null||A.focus());break;default:const z=b.currentTarget.closest("fieldset");if(z){(k=z==null?void 0:z.previousElementSibling)==null||k.focus();break}}},children:[d.jsx(Le,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Va,{styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},tl=["ol_list","ul_list"],Td=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(y.nodes(e,{at:y.unhangRange(e,n),match:a=>{const i=a;return!y.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},by=(e,t)=>{const n=Td(e,t),r=tl.includes(t);ee.unwrapNodes(e,{match:s=>{const o=s;return!y.isEditor(s)&&ce.isElement(s)&&tl.includes(o.type)},split:!0});const i={type:n?"paragraph":r?"list_item":t};if(ee.setNodes(e,i),!n&&r){const s={type:t,children:[]};ee.wrapNodes(e,s)}},yy=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(xn),r=Xn(),a=Td(r,e);return d.jsx(Qs,{id:e,active:a,hasDivider:t,callback:()=>{by(r,e),n(a?null:e)}})},Dy=70,Cy=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a}=C.useContext(xn),i=uy(),s=t==="link-editor"?a:!1,o=(l,u)=>{l.style.top=`${u.top+window.scrollY-l.offsetHeight-Dy}px`,l.style.left=`${u.left+window.scrollX-l.offsetWidth/2+u.width/2}px`};return C.useEffect(()=>{const l=r==null?void 0:r.current;if(!l||!a)return;const{selection:u}=e;if(!u||!i||W.isCollapsed(u)||y.string(e,u)===""){const h=document.getElementById(n);if(!h)return;o(l,h.getBoundingClientRect());return}const c=window.getSelection(),f=c==null?void 0:c.getRangeAt(0),p=f?f==null?void 0:f.getBoundingClientRect():{top:0,left:0,width:0};o(l,p)},[s,e.selection]),r},xy=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=y.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=`http://${s}`,o.includes("/")&&(o=o.split("/")[0]),n({full:s,pretty:o})}else n(null)},[e,e.selection]),t},pr=e=>{const[t]=y.nodes(e,{match:n=>{const r=n;return!y.isEditor(n)&&ce.isElement(n)&&r.type==="link"}});return!!t},wy=(e,t)=>{e.selection&&Sd(e,t)},Sd=(e,t)=>{pr(e)&&jd(e);const{selection:n}=e,r=n&&W.isCollapsed(n),a={type:"link",link:t,children:r?[{text:t}]:[]};r?ee.insertNodes(e,a):(ee.wrapNodes(e,a,{split:!0}),ee.collapse(e,{edge:"end"}))},jd=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!y.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};let bi=null;const Ey=()=>{const e=oe.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,setShowLinkEditor:a,setLastAnchor:i}=C.useContext(xn),s=Xn(),{selection:o}=s,l=xy(s),[u,c]=C.useState(pr(s)),f=Cy(s,"link-editor",`${n}-link`),p=C.useRef(null);C.useEffect(()=>{var b;!u&&r&&((b=p.current)==null||b.focus())},[u]),C.useEffect(()=>{bi&&clearTimeout(bi),bi=setTimeout(()=>{c(pr(s))},500)},[s.selection]);const h=o&&W.isCollapsed(o),g=[],m=["open","edit","remove"].map(b=>{const v={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${b}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:b}),b){case"open":v.href=(l==null?void 0:l.full)||"",v.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),a(!1)},v.children=d.jsxs(d.Fragment,{children:[v.children,d.jsx(Le,{children:e.formatMessage({id:`${t}${b}_text`})})]});break;case"edit":v.onClick=()=>{h||c(!1)},h&&(v.disabled=!0);break;case"remove":v.onClick=()=>{pr(s)&&(jd(s),i(null)),a(!1)};break}return v});return d.jsx(Va,{ref:f,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasPointer:"bottom",hasForm:!u},functions:{onBlur:()=>{a(!1)}},callbacks:{onOpen:()=>{setTimeout(()=>{var b;return(b=p.current)==null?void 0:b.focus()})}},children:r?u?d.jsx(Dn,{wrappers:g,buttons:m}):d.jsx(Qn,{id:`${n}-link-editor`,functions:{onSuccess:async b=>{setTimeout(()=>{b.url&&(wy(s,b.url),i(null)),a(!1)})}},fields:[{id:"url",type:"url",inputRef:p,label:e.formatMessage({id:`${t}placeholder`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.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"}}):null})},_y=()=>{const e=Xn(),{setFocus:t,setShowLinkEditor:n}=C.useContext(xn),[r,a]=C.useState(!1);return C.useEffect(()=>{a(pr(e))},[e.selection]),d.jsx(Qs,{id:"link",active:r,hasDivider:!0,callback:()=>{n(!0),t(r?null:"link"),a(!0)}})},Od=(e,t)=>{const n=y.marks(e);return n?n[t]===!0:!1},Pd=(e,t)=>{Od(e,t)?y.removeMark(e,t):y.addMark(e,t,!0)},By=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(xn),r=Xn(),a=Od(r,e);return d.jsx(Qs,{id:e,active:a,hasDivider:t,callback:()=>{Pd(r,e),n(a?null:e)}})},xa=["bold","italic","strikeThrough"],ky=["ol_list","ul_list","block_quote"];const Ay=({...e})=>{const t=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx(Le,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[xa.map((n,r)=>d.jsx(By,{format:n,hasDivider:r===xa.length-1},n)),d.jsx(_y,{}),ky.map((n,r)=>d.jsx(yy,{format:n,hasDivider:r===1},n))]})]}),d.jsx(Ey,{})]})};var Fy=Oy,Ty=/^(?:\w+:)?\/\/(\S+)$/,Sy=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,jy=/^[^\s\.]+\.\S{2,}$/;function Oy(e){if(typeof e!="string")return!1;var t=e.match(Ty);if(!t)return!1;var n=t[1];return n?!!(Sy.test(n)||jy.test(n)):!1}const Py=tn(Fy),Ny=e=>{const{insertText:t,isInline:n}=e;return e.isInline=r=>{const a=r;return["link"].includes(a.type)||n(r)},e.insertText=r=>{r&&Py(r)?Sd(e,r):t(r)},e};function nl(e){if(e)throw e}var ua=Object.prototype.hasOwnProperty,Nd=Object.prototype.toString,rl=Object.defineProperty,al=Object.getOwnPropertyDescriptor,il=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Nd.call(t)==="[object Array]"},sl=function(t){if(!t||Nd.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]},Ry=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 yi=tn(Ry);function ps(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 My(){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 f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,c?Iy(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 Iy(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 gr(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?gs(e):""}function gs(e){return cl(e&&e.line)+":"+cl(e&&e.column)}function ll(e){return gs(e&&e.start)+"-"+gs(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=gr(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 Tt={basename:$y,dirname:Ly,extname:zy,join:qy,sep:"/"};function $y(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 Ly(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 zy(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 qy(...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?".":Wy(n)}function Wy(e){Tr(e);const t=e.codePointAt(0)===47;let n=Hy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Hy(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 Uy={cwd:Vy};function Vy(){return"/"}function vs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ky(e){if(typeof e=="string")e=new URL(e);else if(!vs(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 Zy(e)}function Zy(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 Di=["history","path","basename","stem","extname","dirname"];class Yy{constructor(t){let n;t?vs(t)?n={path:t}:typeof t=="string"||Gy(t)?n={value:t}:n=t:n={},this.cwd=Uy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Di.length;){const i=Di[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)Di.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Tt.basename(this.path):void 0}set basename(t){xi(t,"basename"),Ci(t,"basename"),this.path=Tt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Tt.dirname(this.path):void 0}set dirname(t){dl(this.basename,"dirname"),this.path=Tt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Tt.extname(this.path):void 0}set extname(t){if(Ci(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=Tt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){vs(t)&&(t=Ky(t)),xi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Tt.basename(this.path,this.extname):void 0}set stem(t){xi(t,"stem"),Ci(t,"stem"),this.path=Tt.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 Ci(e,t){if(e&&e.includes(Tt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Tt.sep+"`")}function xi(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 Gy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Qy=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},Jy={}.hasOwnProperty;class Js extends Qy{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=My()}copy(){const t=new Js;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(yi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_i("data",this.frozen),this.namespace[t]=n,this):Jy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_i("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=Kr(t),r=this.parser||this.Parser;return wi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),wi("process",this.parser||this.Parser),Ei("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Kr(t),l=r.parse(o);r.run(l,o,function(c,f,p){if(c||!f||!p)return u(c);const h=f,g=r.stringify(h,p);t1(g)?p.value=g:p.result=g,u(c,p)});function u(c,f){c||!f?s(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),wi("processSync",this.parser||this.Parser),Ei("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=Kr(n);a.run(t,l,u);function u(c,f,p){const h=f||t;c?o(c):s?s(h):r(void 0,h,p)}}}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=Kr(n),a=this.compiler||this.Compiler;return Ei("stringify",a),fl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(_i("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,...f]=u;l(c,f)}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=yi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...c]);else if(c.length>0){let[h,...g]=c;const m=r[p][1];ps(m)&&ps(h)&&(h=yi(!0,m,h)),r[p]=[u,h,...g]}}}}const Xy=new Js().freeze();function wi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ei(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _i(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(!ps(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 Kr(e){return e1(e)?e:new Yy(e)}function e1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function t1(e){return typeof e=="string"||n1(e)}function n1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r1={};function a1(e,t){const n=t||r1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Rd(e,r,a)}function Rd(e,t,n){if(i1(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]=Rd(e[a],t,n);return r.join("")}function i1(e){return!!(e&&typeof e=="object")}const pl=document.createElement("i");function Xs(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 Ot(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 yt(e,t){return e.length>0?(Ot(e,e.length,0,t),e):t}const gl={}.hasOwnProperty;function s1(e){const t={};let n=-1;for(;++n<e.length;)o1(t,e[n]);return t}function o1(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];u1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function u1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ot(e,0,0,r)}function Md(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 $n(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const St=sn(/[A-Za-z]/),_t=sn(/[\dA-Za-z]/),l1=sn(/[#-'*+\--9=?A-Z^-~]/);function bs(e){return e!==null&&(e<32||e===127)}const ys=sn(/\d/),c1=sn(/[\dA-Fa-f]/),d1=sn(/[!-/:-@[-`{-~]/);function ge(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function ke(e){return e===-2||e===-1||e===32}const f1=sn(/\p{P}|\p{S}/u),h1=sn(/\s/);function sn(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 ke(l)?(e.enter(n),o(l)):t(l)}function o(l){return ke(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const m1={tokenize:p1};function p1(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 ge(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const g1={tokenize:v1},vl={tokenize:b1};function v1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const k=t.events.length;let E=k,B;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){B=t.events[E][1].end;break}v(r);let P=k;for(;P<t.events.length;)t.events[P][1].end=Object.assign({},B),P++;return Ot(t.events,E+1,0,t.events.slice(k)),t.events.length=P,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return p(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(vl,c,f)(A)}function c(A){return a&&x(),v(r),p(A)}function f(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function p(A){return t.containerState={},e.attempt(vl,h,g)(A)}function h(A){return r++,n.push([t.currentConstruct,t.containerState]),p(A)}function g(A){if(A===null){a&&x(),v(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),m(A)}function m(A){if(A===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(A);return}return ge(A)?(e.consume(A),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),m)}function b(A,k){const E=t.sliceStream(A);if(k&&E.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(E),t.parser.lazy[A.start.line]){let B=a.events.length;for(;B--;)if(a.events[B][1].start.offset<s&&(!a.events[B][1].end||a.events[B][1].end.offset>s))return;const P=t.events.length;let z=P,I,N;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(I){N=t.events[z][1].end;break}I=!0}for(v(r),B=P;B<t.events.length;)t.events[B][1].end=Object.assign({},N),B++;Ot(t.events,z+1,0,t.events.slice(P)),t.events.length=B}}function v(A){let k=n.length;for(;k-- >A;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=A}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function b1(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)||h1(e))return 1;if(f1(e))return 2}function eo(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 Ds={name:"attention",tokenize:D1,resolveAll:y1};function y1(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 f=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);yl(f,-l),yl(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},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=yt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=yt(u,eo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yt(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=yt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Ot(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 D1(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),f=!c||c===2&&a||n.includes(l),p=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(a||!p)),u._close=!!(i===42?p:p&&(c||!f)),t(l)}}function yl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const C1={name:"autolink",tokenize:x1};function x1(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return St(h)?(e.consume(h),s):u(h)}function s(h){return h===43||h===45||h===46||_t(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||_t(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||bs(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),c):l1(h)?(e.consume(h),u):n(h)}function c(h){return _t(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,c):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||_t(h))&&r++<63){const g=h===45?p:f;return e.consume(h),g}return n(h)}}const Wa={tokenize:w1,partial:!0};function w1(e,t,n){return r;function r(i){return ke(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ge(i)?t(i):n(i)}}const Id={name:"blockQuote",tokenize:E1,continuation:{tokenize:_1},exit:B1};function E1(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 ke(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function _1(e,t,n){const r=this;return a;function a(s){return ke(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Id,t,n)(s)}}function B1(e){e.exit("blockQuote")}const $d={name:"characterEscape",tokenize:k1};function k1(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 d1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Ld={name:"characterReference",tokenize:A1};function A1(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=_t,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=c1,c):(e.enter("characterReferenceValue"),i=7,s=ys,c(f))}function c(f){if(f===59&&a){const p=e.exit("characterReferenceValue");return s===_t&&!Xs(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),c):n(f)}}const Dl={tokenize:T1,partial:!0},Cl={name:"codeFenced",tokenize:F1,concrete:!0};function F1(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(B){return u(B)}function u(B){const P=r.events[r.events.length-1];return i=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,o=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(B)}function c(B){return B===o?(s++,e.consume(B),c):s<3?n(B):(e.exit("codeFencedFenceSequence"),ke(B)?Ne(e,f,"whitespace")(B):f(B))}function f(B){return B===null||ge(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(Dl,m,k)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(B))}function p(B){return B===null||ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(B)):ke(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,h,"whitespace")(B)):B===96&&B===o?n(B):(e.consume(B),p)}function h(B){return B===null||ge(B)?f(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(B))}function g(B){return B===null||ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(B)):B===96&&B===o?n(B):(e.consume(B),g)}function m(B){return e.attempt(a,k,b)(B)}function b(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v}function v(B){return i>0&&ke(B)?Ne(e,x,"linePrefix",i+1)(B):x(B)}function x(B){return B===null||ge(B)?e.check(Dl,m,k)(B):(e.enter("codeFlowValue"),A(B))}function A(B){return B===null||ge(B)?(e.exit("codeFlowValue"),x(B)):(e.consume(B),A)}function k(B){return e.exit("codeFenced"),t(B)}function E(B,P,z){let I=0;return N;function N(M){return B.enter("lineEnding"),B.consume(M),B.exit("lineEnding"),O}function O(M){return B.enter("codeFencedFence"),ke(M)?Ne(B,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M)}function w(M){return M===o?(B.enter("codeFencedFenceSequence"),T(M)):z(M)}function T(M){return M===o?(I++,B.consume(M),T):I>=s?(B.exit("codeFencedFenceSequence"),ke(M)?Ne(B,R,"whitespace")(M):R(M)):z(M)}function R(M){return M===null||ge(M)?(B.exit("codeFencedFence"),P(M)):z(M)}}}function T1(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 Bi={name:"codeIndented",tokenize:j1},S1={tokenize:O1,partial:!0};function j1(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):ge(u)?e.attempt(S1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ge(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function O1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ge(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):ge(s)?a(s):n(s)}}const P1={name:"codeText",tokenize:M1,resolve:N1,previous:R1};function N1(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 R1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function M1(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,c(f)):ge(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ge(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function zd(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,I1(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),Ot(e,a,n-a+1,o))}}return!u}function I1(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,f,p=-1,h=n,g=0,m=0;const b=[m];for(;h;){for(;e[++a][1]!==h;);i.push(a),h._tokenizer||(c=r.sliceStream(h),h.next||c.push(null),f&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(m=p+1,b.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),x=i.pop();l.unshift([x,x+v.length-1]),Ot(e,x,2,v)}for(p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const $1={tokenize:q1,resolve:z1},L1={tokenize:W1,partial:!0};function z1(e){return zd(e),e}function q1(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):ge(o)?e.check(L1,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 W1(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||ge(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 qd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||bs(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(v))}function p(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"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||ge(v)?n(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function m(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++,m):v===41?(e.consume(v),c--,m):v===null||v===32||v===40||bs(v)?n(v):(e.consume(v),v===92?b:m)}function b(v){return v===40||v===41||v===92?(e.consume(v),m):m(v)}}function Wd(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),c}function c(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):ge(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||ge(h)||o++>999?(e.exit("chunkString"),c(h)):(e.consume(h),l||(l=!ke(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,f):f(h)}}function Hd(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):ge(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||ge(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:c)}function f(p){return p===s||p===92?(e.consume(p),c):c(p)}}function vr(e,t){let n;return r;function r(a){return ge(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):ke(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const H1={name:"definition",tokenize:V1},U1={tokenize:K1,partial:!0};function V1(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return Wd.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=$n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ct(h)?vr(e,u)(h):u(h)}function u(h){return qd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(U1,f,f)(h)}function f(h){return ke(h)?Ne(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ge(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function K1(e,t,n){return r;function r(o){return ct(o)?vr(e,a)(o):n(o)}function a(o){return Hd(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return ke(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ge(o)?t(o):n(o)}}const Z1={name:"hardBreakEscape",tokenize:Y1};function Y1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ge(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const G1={name:"headingAtx",tokenize:J1,resolve:Q1};function Q1(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"},Ot(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function J1(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||ge(c)?(e.exit("atxHeading"),t(c)):ke(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 X1=["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"],eD={name:"htmlFlow",tokenize:aD,resolveTo:rD,concrete:!0},tD={tokenize:sD,partial:!0},nD={tokenize:iD,partial:!0};function rD(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 aD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),f}function f(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,m):_===63?(e.consume(_),a=3,r.interrupt?t:D):St(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),a=2,h):_===91?(e.consume(_),a=5,o=0,g):St(_)?(e.consume(_),a=4,r.interrupt?t:D):n(_)}function h(_){return _===45?(e.consume(_),r.interrupt?t:D):n(_)}function g(_){const F="CDATA[";return _===F.charCodeAt(o++)?(e.consume(_),o===F.length?r.interrupt?t:w:g):n(_)}function m(_){return St(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||ct(_)){const F=_===47,L=s.toLowerCase();return!F&&!i&&xl.includes(L)?(a=1,r.interrupt?t(_):w(_)):X1.includes(s.toLowerCase())?(a=6,F?(e.consume(_),v):r.interrupt?t(_):w(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?x(_):A(_))}return _===45||_t(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:w):n(_)}function x(_){return ke(_)?(e.consume(_),x):N(_)}function A(_){return _===47?(e.consume(_),N):_===58||_===95||St(_)?(e.consume(_),k):ke(_)?(e.consume(_),A):N(_)}function k(_){return _===45||_===46||_===58||_===95||_t(_)?(e.consume(_),k):E(_)}function E(_){return _===61?(e.consume(_),B):ke(_)?(e.consume(_),E):A(_)}function B(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,P):ke(_)?(e.consume(_),B):z(_)}function P(_){return _===l?(e.consume(_),l=null,I):_===null||ge(_)?n(_):(e.consume(_),P)}function z(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ct(_)?E(_):(e.consume(_),z)}function I(_){return _===47||_===62||ke(_)?A(_):n(_)}function N(_){return _===62?(e.consume(_),O):n(_)}function O(_){return _===null||ge(_)?w(_):ke(_)?(e.consume(_),O):n(_)}function w(_){return _===45&&a===2?(e.consume(_),K):_===60&&a===1?(e.consume(_),V):_===62&&a===4?(e.consume(_),U):_===63&&a===3?(e.consume(_),D):_===93&&a===5?(e.consume(_),Q):ge(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(tD,X,T)(_)):_===null||ge(_)?(e.exit("htmlFlowData"),T(_)):(e.consume(_),w)}function T(_){return e.check(nD,R,X)(_)}function R(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return _===null||ge(_)?T(_):(e.enter("htmlFlowData"),w(_))}function K(_){return _===45?(e.consume(_),D):w(_)}function V(_){return _===47?(e.consume(_),s="",ie):w(_)}function ie(_){if(_===62){const F=s.toLowerCase();return xl.includes(F)?(e.consume(_),U):w(_)}return St(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ie):w(_)}function Q(_){return _===93?(e.consume(_),D):w(_)}function D(_){return _===62?(e.consume(_),U):_===45&&a===2?(e.consume(_),D):w(_)}function U(_){return _===null||ge(_)?(e.exit("htmlFlowData"),X(_)):(e.consume(_),U)}function X(_){return e.exit("htmlFlow"),t(_)}}function iD(e,t,n){const r=this;return a;function a(s){return ge(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 sD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Wa,t,n)}}const oD={name:"htmlText",tokenize:uD};function uD(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),E):D===63?(e.consume(D),A):St(D)?(e.consume(D),z):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):St(D)?(e.consume(D),x):n(D)}function c(D){return D===45?(e.consume(D),h):n(D)}function f(D){return D===null?n(D):D===45?(e.consume(D),p):ge(D)?(s=f,V(D)):(e.consume(D),f)}function p(D){return D===45?(e.consume(D),h):f(D)}function h(D){return D===62?K(D):D===45?p(D):f(D)}function g(D){const U="CDATA[";return D===U.charCodeAt(i++)?(e.consume(D),i===U.length?m:g):n(D)}function m(D){return D===null?n(D):D===93?(e.consume(D),b):ge(D)?(s=m,V(D)):(e.consume(D),m)}function b(D){return D===93?(e.consume(D),v):m(D)}function v(D){return D===62?K(D):D===93?(e.consume(D),v):m(D)}function x(D){return D===null||D===62?K(D):ge(D)?(s=x,V(D)):(e.consume(D),x)}function A(D){return D===null?n(D):D===63?(e.consume(D),k):ge(D)?(s=A,V(D)):(e.consume(D),A)}function k(D){return D===62?K(D):A(D)}function E(D){return St(D)?(e.consume(D),B):n(D)}function B(D){return D===45||_t(D)?(e.consume(D),B):P(D)}function P(D){return ge(D)?(s=P,V(D)):ke(D)?(e.consume(D),P):K(D)}function z(D){return D===45||_t(D)?(e.consume(D),z):D===47||D===62||ct(D)?I(D):n(D)}function I(D){return D===47?(e.consume(D),K):D===58||D===95||St(D)?(e.consume(D),N):ge(D)?(s=I,V(D)):ke(D)?(e.consume(D),I):K(D)}function N(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),N):O(D)}function O(D){return D===61?(e.consume(D),w):ge(D)?(s=O,V(D)):ke(D)?(e.consume(D),O):I(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,T):ge(D)?(s=w,V(D)):ke(D)?(e.consume(D),w):(e.consume(D),R)}function T(D){return D===a?(e.consume(D),a=void 0,M):D===null?n(D):ge(D)?(s=T,V(D)):(e.consume(D),T)}function R(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ct(D)?I(D):(e.consume(D),R)}function M(D){return D===47||D===62||ct(D)?I(D):n(D)}function K(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function V(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ie}function ie(D){return ke(D)?Ne(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):Q(D)}function Q(D){return e.enter("htmlTextData"),s(D)}}const to={name:"labelEnd",tokenize:mD,resolveTo:hD,resolveAll:fD},lD={tokenize:pD},cD={tokenize:gD},dD={tokenize:vD};function fD(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 hD(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=yt(o,e.slice(i+1,i+r+3)),o=yt(o,[["enter",c,t]]),o=yt(o,eo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=yt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=yt(o,e.slice(s+1)),o=yt(o,[["exit",l,t]]),Ot(e,i,e.length,o),e}function mD(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(p){return i?i._inactive?f(p):(s=r.parser.defined.includes($n(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(lD,c,s?c:f)(p):p===91?e.attempt(cD,c,s?u:f)(p):s?c(p):f(p)}function u(p){return e.attempt(dD,c,f)(p)}function c(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function pD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ct(f)?vr(e,i)(f):i(f)}function i(f){return f===41?c(f):qd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ct(f)?vr(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Hd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ct(f)?vr(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function gD(e,t,n){const r=this;return a;function a(o){return Wd.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes($n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function vD(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 bD={name:"labelStartImage",tokenize:yD,resolveAll:to.resolveAll};function yD(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 DD={name:"labelStartLink",tokenize:CD,resolveAll:to.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:xD};function xD(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:wD};function wD(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||ge(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),ke(u)?Ne(e,o,"whitespace")(u):o(u))}}const ot={name:"list",tokenize:BD,continuation:{tokenize:kD},exit:FD},ED={tokenize:TD,partial:!0},_D={tokenize:AD,partial:!0};function BD(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(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ys(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(la,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return ys(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Wa,r.interrupt?n:c,e.attempt(ED,p,f))}function c(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function f(h){return ke(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function kD(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||!ke(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(_D,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 AD(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 FD(e){e.exit(this.containerState.type)}function TD(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!ke(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const wl={name:"setextUnderline",tokenize:jD,resolveTo:SD};function SD(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 jD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),ke(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ge(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const OD={tokenize:PD};function PD(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($1,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 ND={resolveAll:Vd()},RD=Ud("string"),MD=Ud("text");function Ud(e){return{tokenize:t,resolveAll:Vd(e==="text"?ID: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 f=a[c];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Vd(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 ID(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 $D(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:A,exit:k,attempt:P(E),check:P(B),interrupt:P(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:p,now:g,defineSkip:m,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(O){return s=yt(s,O),b(),s[s.length-1]!==null?[]:(z(t,0),u.events=eo(i,u.events,u),u.events)}function p(O,w){return zD(h(O),w)}function h(O){return LD(s,O)}function g(){const{line:O,column:w,offset:T,_index:R,_bufferIndex:M}=r;return{line:O,column:w,offset:T,_index:R,_bufferIndex:M}}function m(O){a[O.line]=O.column,N()}function b(){let O;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<w.length;)v(w.charCodeAt(r._bufferIndex));else v(w)}}function v(O){c=c(O)}function x(O){ge(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,N()):O!==-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=O}function A(O,w){const T=w||{};return T.type=O,T.start=g(),u.events.push(["enter",T,u]),o.push(T),T}function k(O){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function E(O,w){z(O,w.from)}function B(O,w){w.restore()}function P(O,w){return T;function T(R,M,K){let V,ie,Q,D;return Array.isArray(R)?X(R):"tokenize"in R?X([R]):U(R);function U($){return q;function q(ne){const te=ne!==null&&$[ne],Z=ne!==null&&$.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return X(le)(ne)}}function X($){return V=$,ie=0,$.length===0?K:_($[ie])}function _($){return q;function q(ne){return D=I(),Q=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?L():$.tokenize.call(w?Object.assign(Object.create(u),w):u,l,F,L)(ne)}}function F($){return O(Q,D),M}function L($){return D.restore(),++ie<V.length?_(V[ie]):K}}}function z(O,w){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Ot(u.events,w,u.events.length-w,O.resolve(u.events.slice(w),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function I(){const O=g(),w=u.previous,T=u.currentConstruct,R=u.events.length,M=Array.from(o);return{restore:K,from:R};function K(){r=O,u.previous=w,u.currentConstruct=T,u.events.length=R,o=M,N()}}function N(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function LD(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 zD(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=`
|
|
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 k=Y.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!k)return null;var E=f?k:Y.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!E)return null;var w={anchor:k,focus:E};return q.isExpanded(w)&&q.isForward(w)&&yt(u)&&b.void(e,{at:w.focus,mode:"highest"})&&(w=b.unhangRange(e,w,{voids:!0})),w}};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=O.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 yd(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 Dd(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=yd(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 Dd(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||!O.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(q.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:f}=c;return O.equals(f,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"&&O.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(q.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!O.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!O.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!O.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:O.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:O.transform(n,t,{affinity:"forward"})};case"merge_node":return O.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:O.transform(n,t)}:{diff:r,id:a,path:O.transform(n,t)}}var i=O.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 Hr(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 _=Kt.get(t);if(Kt.delete(t),_){var{selection:T}=t,N=$u(t,_);N&&(!T||!q.equals(N,T))&&X.select(t,N)}},f=()=>{var _=Vt.get(t);if(Vt.delete(t),!!_){if(_.at){var T=Ce.isPoint(_.at)?hs(t,_.at):$u(t,_.at);if(!T)return;var N=b.range(t,T);(!t.selection||!q.equals(t.selection,N))&&X.select(t,T)}_.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!E()&&!k()){c();return}a||(a=!0,setTimeout(()=>a=!1)),k()&&(a="action");var _=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});$t.set(t,t.marks),hb("flush",Vt.get(t),ut.get(t));for(var T=E(),N;N=(M=ut.get(t))===null||M===void 0?void 0:M[0];){var M,Q,Z=wt.get(t);Z!==void 0&&(wt.delete(t),t.marks=Z),Z&&u===!1&&(u=null);var oe=lb(N);(!t.selection||!q.equals(t.selection,oe))&&X.select(t,oe),N.diff.text?b.insertText(t,N.diff.text):b.deleteFragment(t),ut.set(t,(Q=ut.get(t))===null||Q===void 0?void 0:Q.filter(z=>{var{id:J}=z;return J!==N.id})),ib(t,N)||(T=!1,Vt.delete(t),$t.delete(t),a="action",Kt.delete(t),n.cancel(),r.cancel(),_==null||_.unref())}var ne=_==null?void 0:_.unref();if(ne&&!Kt.get(t)&&(!t.selection||!q.equals(ne,t.selection))&&X.select(t,ne),k()){f();return}T&&n(),n.flush(),r.flush(),c();var D=$t.get(t);$t.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=_=>{i&&clearTimeout(i),i=setTimeout(()=>{ln.set(t,!1),m()},db)},g=_=>{ln.set(t,!0),i&&(clearTimeout(i),i=null)},h=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,N=ls.get(t);if(N){if(E()||T){N.style.display="none";return}N.style.removeProperty("display")}},y=(_,T)=>{var N,M=(N=ut.get(t))!==null&&N!==void 0?N:[];ut.set(t,M);var Q=ie.leaf(t,_),Z=M.findIndex(D=>O.equals(D.path,_));if(Z<0){var oe=Dd(Q.text,T);oe&&M.push({path:_,diff:T,id:l++}),h();return}var ne=ub(Q.text,M[Z].diff,T);if(!ne){M.splice(Z,1),h();return}M[Z]=Hr(Hr({},M[Z]),{},{diff:ne})},v=function(T){var{at:N}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Kt.delete(t),n.cancel(),r.cancel(),k()&&m(),Vt.set(t,{at:N,run:T}),o=setTimeout(m)},x=_=>{var T;s&&(clearTimeout(s),s=null);var{inputType:N}=_,M=null,Q=_.dataTransfer||_.data||void 0;u!==!1&&N!=="insertText"&&N!=="insertCompositionText"&&(u=!1);var[Z]=_.getTargetRanges();Z&&(M=Y.toSlateRange(t,Z,{exactMatch:!1,suppressThrow:!0}));var oe=Y.getWindow(t),ne=oe.getSelection();if(!M&&ne&&(Z=ne,M=Y.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),M=(T=M)!==null&&T!==void 0?T:t.selection,!!M){var D=!0;if(N.startsWith("delete")){if(q.isExpanded(M)){var[z,J]=q.edges(M),B=ie.leaf(t,z.path);if(B.text.length===z.offset&&J.offset===0){var F=b.next(t,{at:z.path,match:de.isText});F&&O.equals(F[1],J.path)&&(M={anchor:J,focus:J})}}var L=N.endsWith("Backward")?"backward":"forward",[I,H]=q.edges(M),[te,ee]=b.leaf(t,I.path),K={text:"",start:I.offset,end:H.offset},ue=ut.get(t),G=ue==null?void 0:ue.find(pe=>O.equals(pe.path,ee)),ge=G?[G.diff,K]:[K],me=yd(te.text,...ge);if(me.length===0&&(D=!1),q.isExpanded(M)){if(D&&O.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:I.offset},Se=b.range(t,_e,_e);return P(Se),y(M.anchor.path,{text:"",end:H.offset,start:I.offset})}return v(()=>b.deleteFragment(t,{direction:L}),{at:M})}}switch(N){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Pe}=M;if(D&&q.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(Z)?Z.isCollapsed:!!((Ke=Z)!==null&&Ke!==void 0&&Ke.collapsed);return D&&tt&&q.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(Q))return v(()=>Y.insertData(t,Q),{at:M});var Ae=Q??"";if(wt.get(t)&&(Ae=Ae.replace("\uFEFF","")),N==="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(O.equals(M.anchor.path,M.focus.path)){var[We,$e]=q.edges(M),W={start:We.offset,end:$e.offset,text:Ae};if(Ae&&u&&N==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),fe=W.start+W.text.search(/\S|$/);fe===ae+1&&W.end===u.start+u.text.length?(W.start-=1,u=null,j()):u=!1}else N==="insertText"?u===null?u=W:u&&q.isCollapsed(M)&&u.end+u.text.length===We.offset?u=Hr(Hr({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(D){y(We.path,W);return}}return v(()=>b.insertText(t,Ae),{at:M})}}}},k=()=>!!Vt.get(t),E=()=>{var _;return!!((_=ut.get(t))!==null&&_!==void 0&&_.length)},w=()=>k()||E(),A=()=>a,P=_=>{Kt.set(t,_),s&&(clearTimeout(s),s=null);var{selection:T}=t;if(_){var N=!T||!O.equals(T.anchor.path,_.anchor.path),M=!T||!O.equals(T.anchor.path.slice(0,-1),_.anchor.path.slice(0,-1));(N&&u||M)&&(u=!1),(N||E())&&(s=setTimeout(m,fb))}},U=()=>{(k()||!E())&&m()},$=_=>{E()||(h(!0),setTimeout(h))},j=()=>{k()||(o=setTimeout(m))},R=_=>{if(!(E()||k())&&_.some(N=>Qs(t,N,_))){var T;(T=md.get(t))===null||T===void 0||T()}};return{flush:m,scheduleFlush:j,hasPendingDiffs:E,hasPendingAction:k,hasPendingChanges:w,isFlushing:A,handleUserSelect:P,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:x,handleKeyDown:$,handleDomMutations:R,handleInput:U}}function gb(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Br=ia?C.useLayoutEffect:C.useEffect;function vb(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));Br(()=>{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]),Cd=(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(!q.equals(r,a)||!Cd(r,a))return!1}return!0},Bb=(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||!Cd(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 kb(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=Y.findPath(i,a),o=O.parent(s),l=!!n[pd];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 Br(()=>{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",kb({},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 xd(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,xd({},x))}=e,o=nn(),l=C.useRef(null),u=C.useRef(null),[c,f]=C.useState(!1),m=C.useRef(null),p=C.useCallback(x=>{if(Sb(l,x==null),x==null){var k;ls.delete(o),(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,null)}else{if(ls.set(o,x),!l.current){var E=window.ResizeObserver||I0;l.current=new E(()=>{var w;(w=t.onPlaceholderResize)===null||w===void 0||w.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}),h=!!t[Hn];if(C.useEffect(()=>(h?m.current||(m.current=setTimeout(()=>{f(!0),m.current=null},Tb)):(Vu(m),f(!1)),()=>Vu(m)),[h,f]),h&&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",xd({},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=Y.findKey(o,s),f=[],m=0;m<u.length;m++){var p=u[m];f.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(h=>{var y=qa.get(o);h?(y==null||y.set(c,h),hn.set(s,h),_r.set(h,s)):(y==null||y.delete(c),hn.delete(s),l.current&&_r.delete(l.current)),l.current=h},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},wd=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&&Bb(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=Y.findKey(o,n),f=C.useCallback(x=>{var k=qa.get(o);x?(k==null||k.set(c,x),hn.set(n,x),_r.set(x,n)):(k==null||k.delete(c),hn.delete(n))},[o,c,n]),m=_d({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:f};if(u&&(p["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=ie.string(n),h=ed(g);h==="rtl"&&(p.dir=h)}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(wd,{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&&q.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)},Ed=C.createContext(()=>[]),$b=()=>C.useContext(Ed),Lb=C.createContext(!1),_d=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=$b(),l=nn(),u=Y.findPath(l,n),c=[],f=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],h=Y.findKey(l,g),y=b.range(l,p),v=s&&q.intersection(y,s),x=o([g,p]);for(var k of t){var E=q.intersection(k,y);E&&x.push(E)}ce.isElement(g)?c.push(C.createElement(Lb.Provider,{key:"provider-".concat(h.id),value:!!v},C.createElement(Mb,{decorations:x,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(wd,{decorations:x,key:h.id,isLast:f&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Ks.set(g,m),Zs.set(g,n)}return c},Bd=C.createContext(!1),zb=()=>C.useContext(Bd),kd=C.createContext(null),Jn=()=>{var e=C.useContext(kd);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=Y.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))},Ie={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 Ad 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(Ad,"contextType",Vs);var Yb=at?Ad: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,_d(e)),Xb=e=>{var t=C.useCallback(F=>C.createElement(ey,At({},F)),[]),{autoFocus:n,decorate:r=ty,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=ny,style:f={},as:m="div",disableDefaultStyles:p=!1}=e,g=Wn(e,Gb),h=Jn(),[y,v]=C.useState(!1),x=C.useRef(null),k=C.useRef([]),[E,w]=C.useState(),{onUserInput:A,receivedUserInput:P}=qb(),[,U]=C.useReducer(F=>F+1,0);md.set(h,U),cs.set(h,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(),R=C.useMemo(()=>m0(()=>{var F=j.current;if((at||!Y.isComposing(h))&&(!$.isUpdatingSelection||F!=null&&F.isFlushing())&&!$.isDraggingInternally){var L=Y.findDocumentOrShadowRoot(h),{activeElement:I}=L,H=Y.toDOMNode(h,h),te=L.getSelection();if(I===H?($.latestElement=I,Gt.set(h,!0)):Gt.delete(h),!te)return X.deselect(h);var{anchorNode:ee,focusNode:K}=te,ue=Y.hasEditableTarget(h,ee)||Y.isTargetInsideNonReadonlyVoid(h,ee),G=Y.hasEditableTarget(h,K)||Y.isTargetInsideNonReadonlyVoid(h,K);if(ue&&G){var ge=Y.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});ge&&(!Y.isComposing(h)&&!(F!=null&&F.hasPendingChanges())&&!(F!=null&&F.isFlushing())?X.select(h,ge):F==null||F.handleUserSelect(ge))}s&&(!ue||!G)&&X.deselect(h)}},100),[h,s,$]),_=C.useMemo(()=>u0(R,0),[R]);j.current=Cb({node:x,onDOMSelectionChange:R,scheduleOnDOMSelectionChange:_}),Br(()=>{var F,L,I;x.current&&(I=Gs(x.current))?(hd.set(h,I),sa.set(h,x.current),hn.set(h,x.current),_r.set(x.current,h)):hn.delete(h);var{selection:H}=h,te=Y.findDocumentOrShadowRoot(h),ee=te.getSelection();if(!(!ee||!Y.isFocused(h)||(F=j.current)!==null&&F!==void 0&&F.hasPendingAction())){var K=me=>{var _e=ee.type!=="None";if(!(!H&&!_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=sa.get(h),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&H&&!me){var Ae=Y.toSlateRange(h,ee,{exactMatch:!0,suppressThrow:!0});if(Ae&&q.equals(Ae,H)){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(H&&!Y.hasRange(h,H)){h.selection=Y.toSlateRange(h,ee,{exactMatch:!1,suppressThrow:!0});return}$.isUpdatingSelection=!0;var $e=H&&Y.toDOMRange(h,H);return $e?(Y.isComposing(h)&&!at?ee.collapseToEnd():q.isBackward(H)?ee.setBaseAndExtent($e.endContainer,$e.endOffset,$e.startContainer,$e.startOffset):ee.setBaseAndExtent($e.startContainer,$e.startOffset,$e.endContainer,$e.endOffset),c(h,$e)):ee.removeAllRanges(),$e}};ee.rangeCount<=1&&K();var ue=((L=j.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!at||!ue){setTimeout(()=>{$.isUpdatingSelection=!1});return}var G=null,ge=requestAnimationFrame(()=>{if(ue){var me=_e=>{try{var Se=Y.toDOMNode(h,h);Se.focus(),K(_e)}catch{}};me(),G=setTimeout(()=>{me(!0),$.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),G&&clearTimeout(G)}}});var T=C.useCallback(F=>{if(A(),!s&&Y.hasEditableTarget(h,F.target)&&!ry(F,a)){var L;if(j.current)return j.current.handleDOMBeforeInput(F);_.flush(),R.flush();var{selection:I}=h,{inputType:H}=F,te=F.dataTransfer||F.data||void 0,ee=H==="insertCompositionText"||H==="deleteCompositionText";if(ee&&Y.isComposing(h))return;var K=!1;if(H==="insertText"&&I&&q.isCollapsed(I)&&F.data&&F.data.length===1&&/[a-z ]/i.test(F.data)&&I.anchor.offset!==0){var ue,G;K=!0,h.marks&&(K=!1);var{anchor:ge}=I,[me,_e]=Y.toDOMPoint(h,ge),Se=(ue=me.parentElement)===null||ue===void 0?void 0:ue.closest("a"),Pe=Y.getWindow(h);if(K&&Se&&Y.hasDOMNode(h,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&&(K=!1)}if(K&&me.parentElement&&(Pe==null||(G=Pe.getComputedStyle(me.parentElement))===null||G===void 0?void 0:G.whiteSpace)==="pre"){var Ze=b.above(h,{at:ge.path,match:ae=>ce.isElement(ae)&&b.isBlock(h,ae)});Ze&&ie.string(Ze[0]).includes(" ")&&(K=!1)}}if(!H.startsWith("delete")||H.startsWith("deleteBy")){var[tt]=F.getTargetRanges();if(tt){var Ae=Y.toSlateRange(h,tt,{exactMatch:!1,suppressThrow:!1});if(!I||!q.equals(I,Ae)){K=!1;var We=!ee&&h.selection&&b.rangeRef(h,h.selection);X.select(h,Ae),We&&hr.set(h,We)}}}if(ee)return;if(K||F.preventDefault(),I&&q.isExpanded(I)&&H.startsWith("delete")){var $e=H.endsWith("Backward")?"backward":"forward";b.deleteFragment(h,{direction:$e});return}switch(H){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(h);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(h);break}case"deleteContentBackward":{b.deleteBackward(h);break}case"deleteEntireSoftLine":{b.deleteBackward(h,{unit:"line"}),b.deleteForward(h,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(h,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(h,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(h,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(h,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(h,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(h,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(h);break;case"insertParagraph":{b.insertBreak(h);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{H==="insertFromComposition"&&Y.isComposing(h)&&(v(!1),ln.set(h,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?Y.insertData(h,te):typeof te=="string"&&(K?k.current.push(()=>b.insertText(h,te)):b.insertText(h,te));break}}var W=(L=hr.get(h))===null||L===void 0?void 0:L.unref();hr.delete(h),W&&(!h.selection||!q.equals(h.selection,W))&&X.select(h,W)}},[h,R,A,a,s,_]),N=C.useCallback(F=>{F==null?(R.cancel(),_.cancel(),sa.delete(h),hn.delete(h),x.current&&Ht&&x.current.removeEventListener("beforeinput",T)):Ht&&F.addEventListener("beforeinput",T),x.current=F},[R,_,h,T]);Br(()=>{var F=Y.getWindow(h);return F.document.addEventListener("selectionchange",_),()=>{F.document.removeEventListener("selectionchange",_)}},[_]);var M=r([h,[]]),Q=i&&h.children.length===1&&Array.from(ie.texts(h)).length===1&&ie.string(h)===""&&!y,Z=C.useCallback(F=>{if(F&&Q){var L;w((L=F.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else w(void 0)},[Q]);if(Q){var oe=b.start(h,[]);M.push({[Hn]:!0,placeholder:i,onPlaceholderResize:Z,anchor:oe,focus:oe})}var{marks:ne}=h;if($.hasMarkPlaceholder=!1,h.selection&&q.isCollapsed(h.selection)&&ne){var{anchor:D}=h.selection,z=ie.leaf(h,D.path),J=Wn(z,Qb);if(!de.equals(z,ne,{loose:!0})){$.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(J).map(F=>[F,null]));M.push(At(At(At({[pd]:!0},B),ne),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:F}=h;if(F){var{anchor:L}=F,I=ie.leaf(h,L.path);if(ne&&!de.equals(I,ne,{loose:!0})){wt.set(h,ne);return}}wt.delete(h)})}),C.createElement(Bd.Provider,{value:s},C.createElement(Ed.Provider,{value:r},C.createElement(Yb,{node:x,receivedUserInput:P},C.createElement(m,At(At({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Ht||!ia?g.spellCheck:!1,autoCorrect:Ht||!ia?g.autoCorrect:"false",autoCapitalize:Ht||!ia?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:N,style:At(At({},p?{}:At({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},E?{minHeight:E}:{})),f),onBeforeInput:C.useCallback(F=>{if(!Ht&&!s&&!rt(F,g.onBeforeInput)&&Y.hasSelectableTarget(h,F.target)&&(F.preventDefault(),!Y.isComposing(h))){var L=F.data;b.insertText(h,L)}},[g.onBeforeInput,h,s]),onInput:C.useCallback(F=>{if(!rt(F,g.onInput)){if(j.current){j.current.handleInput();return}for(var L of k.current)L();k.current=[]}},[g.onInput]),onBlur:C.useCallback(F=>{if(!(s||$.isUpdatingSelection||!Y.hasSelectableTarget(h,F.target)||rt(F,g.onBlur))){var L=Y.findDocumentOrShadowRoot(h);if($.latestElement!==L.activeElement){var{relatedTarget:I}=F,H=Y.toDOMNode(h,h);if(I!==H&&!(yt(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&Jt(I)&&Y.hasDOMNode(h,I)){var te=Y.toSlateNode(h,I);if(ce.isElement(te)&&!h.isVoid(te))return}if(lr){var ee=L.getSelection();ee==null||ee.removeAllRanges()}Gt.delete(h)}}}},[s,$.isUpdatingSelection,$.latestElement,h,g.onBlur]),onClick:C.useCallback(F=>{if(Y.hasTarget(h,F.target)&&!rt(F,g.onClick)&&Jt(F.target)){var L=Y.toSlateNode(h,F.target),I=Y.findPath(h,L);if(!b.hasPath(h,I)||ie.get(h,I)!==L)return;if(F.detail===Wb&&I.length>=1){var H=I;if(!(ce.isElement(L)&&b.isBlock(h,L))){var te,ee=b.above(h,{match:Se=>ce.isElement(Se)&&b.isBlock(h,Se),at:I});H=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:I.slice(0,1)}var K=b.range(h,H);X.select(h,K);return}if(s)return;var ue=b.start(h,I),G=b.end(h,I),ge=b.void(h,{at:ue}),me=b.void(h,{at:G});if(ge&&me&&O.equals(ge[1],me[1])){var _e=b.range(h,ue);X.select(h,_e)}}},[h,g.onClick,s]),onCompositionEnd:C.useCallback(F=>{if(Y.hasSelectableTarget(h,F.target)){var L;if(Y.isComposing(h)&&Promise.resolve().then(()=>{v(!1),ln.set(h,!1)}),(L=j.current)===null||L===void 0||L.handleCompositionEnd(F),rt(F,g.onCompositionEnd)||at)return;if(!lr&&!V0&&!q0&&!Z0&&!K0&&F.data){var I=wt.get(h);wt.delete(h),I!==void 0&&($t.set(h,h.marks),h.marks=I),b.insertText(h,F.data);var H=$t.get(h);$t.delete(h),H!==void 0&&(h.marks=H)}}},[g.onCompositionEnd,h]),onCompositionUpdate:C.useCallback(F=>{Y.hasSelectableTarget(h,F.target)&&!rt(F,g.onCompositionUpdate)&&(Y.isComposing(h)||(v(!0),ln.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:C.useCallback(F=>{if(Y.hasSelectableTarget(h,F.target)){var L;if((L=j.current)===null||L===void 0||L.handleCompositionStart(F),rt(F,g.onCompositionStart)||at)return;v(!0);var{selection:I}=h;if(I&&q.isExpanded(I)){b.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:C.useCallback(F=>{Y.hasSelectableTarget(h,F.target)&&!rt(F,g.onCopy)&&!Yu(F)&&(F.preventDefault(),Y.setFragmentData(h,F.clipboardData,"copy"))},[g.onCopy,h]),onCut:C.useCallback(F=>{if(!s&&Y.hasSelectableTarget(h,F.target)&&!rt(F,g.onCut)&&!Yu(F)){F.preventDefault(),Y.setFragmentData(h,F.clipboardData,"cut");var{selection:L}=h;if(L)if(q.isExpanded(L))b.deleteFragment(h);else{var I=ie.parent(h,L.anchor.path);b.isVoid(h,I)&&X.delete(h)}}},[s,h,g.onCut]),onDragOver:C.useCallback(F=>{if(Y.hasTarget(h,F.target)&&!rt(F,g.onDragOver)){var L=Y.toSlateNode(h,F.target);ce.isElement(L)&&b.isVoid(h,L)&&F.preventDefault()}},[g.onDragOver,h]),onDragStart:C.useCallback(F=>{if(!s&&Y.hasTarget(h,F.target)&&!rt(F,g.onDragStart)){var L=Y.toSlateNode(h,F.target),I=Y.findPath(h,L),H=ce.isElement(L)&&b.isVoid(h,L)||b.void(h,{at:I,voids:!0});if(H){var te=b.range(h,I);X.select(h,te)}$.isDraggingInternally=!0,Y.setFragmentData(h,F.dataTransfer,"drag")}},[s,h,g.onDragStart,$]),onDrop:C.useCallback(F=>{if(!s&&Y.hasTarget(h,F.target)&&!rt(F,g.onDrop)){F.preventDefault();var L=h.selection,I=Y.findEventRange(h,F),H=F.dataTransfer;X.select(h,I),$.isDraggingInternally&&L&&!q.equals(L,I)&&!b.void(h,{at:I,voids:!0})&&X.delete(h,{at:L}),Y.insertData(h,H),Y.isFocused(h)||Y.focus(h)}$.isDraggingInternally=!1},[s,h,g.onDrop,$]),onDragEnd:C.useCallback(F=>{!s&&$.isDraggingInternally&&g.onDragEnd&&Y.hasTarget(h,F.target)&&g.onDragEnd(F),$.isDraggingInternally=!1},[s,$,g,h]),onFocus:C.useCallback(F=>{if(!s&&!$.isUpdatingSelection&&Y.hasEditableTarget(h,F.target)&&!rt(F,g.onFocus)){var L=Y.toDOMNode(h,h),I=Y.findDocumentOrShadowRoot(h);if($.latestElement=I.activeElement,On&&F.target!==L){L.focus();return}Gt.set(h,!0)}},[s,$,h,g.onFocus]),onKeyDown:C.useCallback(F=>{if(!s&&Y.hasEditableTarget(h,F.target)){var L;(L=j.current)===null||L===void 0||L.handleKeyDown(F);var{nativeEvent:I}=F;if(Y.isComposing(h)&&I.isComposing===!1&&(ln.set(h,!1),v(!1)),rt(F,g.onKeyDown)||Y.isComposing(h))return;var{selection:H}=h,te=h.children[H!==null?H.focus.path[0]:0],ee=ed(ie.string(te))==="rtl";if(Ie.isRedo(I)){F.preventDefault();var K=h;typeof K.redo=="function"&&K.redo();return}if(Ie.isUndo(I)){F.preventDefault();var ue=h;typeof ue.undo=="function"&&ue.undo();return}if(Ie.isMoveLineBackward(I)){F.preventDefault(),X.move(h,{unit:"line",reverse:!0});return}if(Ie.isMoveLineForward(I)){F.preventDefault(),X.move(h,{unit:"line"});return}if(Ie.isExtendLineBackward(I)){F.preventDefault(),X.move(h,{unit:"line",edge:"focus",reverse:!0});return}if(Ie.isExtendLineForward(I)){F.preventDefault(),X.move(h,{unit:"line",edge:"focus"});return}if(Ie.isMoveBackward(I)){F.preventDefault(),H&&q.isCollapsed(H)?X.move(h,{reverse:!ee}):X.collapse(h,{edge:ee?"end":"start"});return}if(Ie.isMoveForward(I)){F.preventDefault(),H&&q.isCollapsed(H)?X.move(h,{reverse:ee}):X.collapse(h,{edge:ee?"start":"end"});return}if(Ie.isMoveWordBackward(I)){F.preventDefault(),H&&q.isExpanded(H)&&X.collapse(h,{edge:"focus"}),X.move(h,{unit:"word",reverse:!ee});return}if(Ie.isMoveWordForward(I)){F.preventDefault(),H&&q.isExpanded(H)&&X.collapse(h,{edge:"focus"}),X.move(h,{unit:"word",reverse:ee});return}if(Ht){if((fd||lr)&&H&&(Ie.isDeleteBackward(I)||Ie.isDeleteForward(I))&&q.isCollapsed(H)){var G=ie.parent(h,H.anchor.path);if(ce.isElement(G)&&b.isVoid(h,G)&&(b.isInline(h,G)||b.isBlock(h,G))){F.preventDefault(),b.deleteBackward(h,{unit:"block"});return}}}else{if(Ie.isBold(I)||Ie.isItalic(I)||Ie.isTransposeCharacter(I)){F.preventDefault();return}if(Ie.isSoftBreak(I)){F.preventDefault(),b.insertSoftBreak(h);return}if(Ie.isSplitBlock(I)){F.preventDefault(),b.insertBreak(h);return}if(Ie.isDeleteBackward(I)){F.preventDefault(),H&&q.isExpanded(H)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h);return}if(Ie.isDeleteForward(I)){F.preventDefault(),H&&q.isExpanded(H)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h);return}if(Ie.isDeleteLineBackward(I)){F.preventDefault(),H&&q.isExpanded(H)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"line"});return}if(Ie.isDeleteLineForward(I)){F.preventDefault(),H&&q.isExpanded(H)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"line"});return}if(Ie.isDeleteWordBackward(I)){F.preventDefault(),H&&q.isExpanded(H)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"word"});return}if(Ie.isDeleteWordForward(I)){F.preventDefault(),H&&q.isExpanded(H)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"word"});return}}}},[s,h,g.onKeyDown]),onPaste:C.useCallback(F=>{!s&&Y.hasEditableTarget(h,F.target)&&!rt(F,g.onPaste)&&(!Ht||Q0(F.nativeEvent)||lr)&&(F.preventDefault(),Y.insertData(h,F.clipboardData))},[s,h,g.onPaste])}),C.createElement(Jb,{decorations:M,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.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&&q.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},Fd=C.createContext(!1),ay=()=>C.useContext(Fd),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:f}=sy(t),m=C.useCallback(h=>{var y;switch(r&&r(t.children),h==null||(y=h.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})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(ds.set(t,m),()=>{ds.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(Y.isFocused(t));return C.useEffect(()=>{g(Y.isFocused(t))},[t]),Br(()=>{var h=()=>g(Y.isFocused(t));return dd>=17?(document.addEventListener("focusin",h),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",h)}):(document.addEventListener("focus",h,!0),document.addEventListener("blur",h,!0),()=>{document.removeEventListener("focus",h,!0),document.removeEventListener("blur",h,!0)})},[]),C.createElement(iy.Provider,{value:c},C.createElement(kd.Provider,{value:l},C.createElement(Vs.Provider,{value:l.editor},C.createElement(Fd.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=Y.toDOMRange(e,t).getBoundingClientRect(),a=Y.toDOMRange(e,n).getBoundingClientRect();return Gu(r,a)&&Gu(a,r)},ly=(e,t)=>{var n=b.range(e,q.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 f,m;(f=Ys.get(r))===null||f===void 0||f(),!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&&q.isCollapsed(r.selection)){var c=b.above(r,{match:g=>ce.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,f]=c,m=b.range(r,f,r.selection.anchor),p=ly(r,m);q.isCollapsed(p)||X.delete(r,{at:p})}}},r.apply=u=>{var c=[],f=[],m=ut.get(r);if(m!=null&&m.length){var p=m.map(N=>cb(N,u)).filter(Boolean);ut.set(r,p)}var g=Kt.get(r);g&&Kt.set(r,Lu(r,g,u));var h=Vt.get(r);if(h!=null&&h.at){var y=Ce.isPoint(h==null?void 0:h.at)?ms(r,h.at,u):Lu(r,h.at,u);Vt.set(r,y?Xu(Xu({},h),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Bn(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(...Bn(r,O.parent(u.path)));break}case"merge_node":{var x=O.previous(u.path);c.push(...Bn(r,x));break}case"move_node":{var k=O.common(O.parent(u.path),O.parent(u.newPath));c.push(...Bn(r,k));var E;O.isBefore(u.path,u.newPath)?(c.push(...Bn(r,O.parent(u.path))),E=u.newPath):(c.push(...Bn(r,O.parent(u.newPath))),E=u.path);var w=ie.get(t,O.parent(E)),A=Y.findKey(r,w),P=b.pathRef(r,O.parent(E));f.push([P,A]);break}}a(u);for(var[U,$]of c){var[j]=b.node(r,U);Da.set(j,$)}for(var[R,_]of f)if(R.current){var[T]=b.node(r,R.current);Da.set(T,_)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[f,m]=q.edges(c),p=b.void(r,{at:f.path}),g=b.void(r,{at:m.path});if(!(q.isCollapsed(c)&&!p)){var h=Y.toDOMRange(r,c),y=h.cloneContents(),v=y.childNodes[0];if(y.childNodes.forEach(j=>{j.textContent&&j.textContent.trim()!==""&&(v=j)}),g){var[x]=g,k=h.cloneRange(),E=Y.toDOMNode(r,x);k.setEndAfter(E),y=k.cloneContents()}if(p&&(v=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(j=>{var R=j.getAttribute("data-slate-zero-width")==="n";j.textContent=R?`
|
|
112
|
+
`:""}),gd(v)){var w=v.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(v),y.appendChild(w),v=w}var A=r.getFragment(),P=JSON.stringify(A),U=window.btoa(encodeURIComponent(P));v.setAttribute("data-slate-fragment",U),u.setData("application/".concat(n),U);var $=y.ownerDocument.createElement("div");return $.appendChild(y),$.setAttribute("hidden","true"),y.ownerDocument.body.appendChild($),u.setData("text/html",$.innerHTML),u.setData("text/plain",bd($)),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 f=decodeURIComponent(window.atob(c)),m=JSON.parse(f);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var f=c.split(/\r\n|\r|\n/),m=!1;for(var p of f)m&&X.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=dd<18?eh.unstable_batchedUpdates:f=>f();c(()=>{var f=ds.get(r);f&&f(u),i(u)})},r},Bn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=Y.findKey(e,r);n.push([a,i])}return n};const dy={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,lastAnchor:null,domSelection: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=se.useIntl(),l=Jn(),{id:u,tabbableOption:c,setFocus:f,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:h=>{h.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:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var y,v,x,k;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const E=h.currentTarget.closest("li");let w=E==null?void 0:E.nextElementSibling;if(h.key==="ArrowLeft"){const U=E==null?void 0:E.previousElementSibling;U?w=U:w=(y=E==null?void 0:E.parentElement)==null?void 0:y.lastElementChild}else w||(w=(v=E==null?void 0:E.parentElement)==null?void 0:v.firstElementChild);const A=w==null?void 0:w.className.split(" ")[0];A&&(f(A),(x=w==null?void 0:w.querySelector("button"))==null||x.focus());break;default:const P=h.currentTarget.closest("fieldset");if(P){(k=P==null?void 0:P.previousElementSibling)==null||k.focus();break}}},children:[d.jsx(Le,{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"],Td=(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},Sd=(e,t)=>{const n=Td(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=Td(r,e);return d.jsx(Js,{id:e,active:a,hasDivider:t,callback:()=>{Sd(r,e),n(a?null:e)}})},tl=52,py=(e,t,n)=>{const r=C.useRef(null),{id:a,showLinkEditor:i,domSelection:s}=C.useContext(Cn),o=ay(),l=document.getElementById(a),u=t==="link-editor"?i:!1,c=f=>{var g;const m=r==null?void 0:r.current;if(!m)return;f||(f=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect()),m.style.top=`${((f==null?void 0:f.top)||0)-((l==null?void 0:l.offsetTop)||0)-tl}px`;let p=((f==null?void 0:f.left)||0)/2+((f==null?void 0:f.width)||0)+((l==null?void 0:l.offsetLeft)||0);((f==null?void 0:f.width)||0)+((l==null?void 0:l.offsetLeft)||0)+tl>=((f==null?void 0:f.left)||0)/2&&(p=((f==null?void 0:f.left)||0)/2),p<0&&(p=0),m.style.left=`${p}px`};return C.useEffect(()=>{if(!a||!(r!=null&&r.current)||!i)return;const{selection:f}=e;if(!f||!o||q.isCollapsed(f)||b.string(e,f)===""){c();return}const m=s||window.getSelection();if(!m||m.rangeCount<1){c();return}const g=m.getRangeAt(0).getBoundingClientRect();c(g)},[u,e.selection]),r},gy=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=`http://${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},vy=(e,t)=>{e.selection&&jd(e,t)},jd=(e,t)=>{mr(e)&&Od(e);const{selection:n}=e,r=n&&q.isCollapsed(n),a={type:"link",link:t,children:r?[{text:t}]:[]};r?X.insertNodes(e,a):(X.wrapNodes(e,a,{split:!0}),X.collapse(e,{edge:"end"}))},Od=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};let vi=null;const by=()=>{const e=se.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a}=C.useContext(Cn),i=Jn(),{selection:s}=i,o=gy(i),[l,u]=C.useState(mr(i)),c=py(i,"link-editor",`${n}-link`),f=C.useRef(null);C.useEffect(()=>{var h;!l&&r&&((h=f.current)==null||h.focus())},[l]),C.useEffect(()=>{vi&&clearTimeout(vi),vi=setTimeout(()=>{u(mr(i))},500)},[i.selection]);const m=s&&q.isCollapsed(s),p=[],g=["open","edit","remove"].map(h=>{const y={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${h}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:h}),h){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(Le,{children:e.formatMessage({id:`${t}${h}_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)&&(Od(i),v.push({type:"lastAnchor",value:null})),a(v)};break}return y});return 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 h;return(h=f.current)==null?void 0:h.focus()})}},children:l?d.jsx(yn,{wrappers:p,buttons:g}):d.jsx(Gn,{element:"fieldset",id:`${n}-link-editor`,functions:{onSuccess:async h=>{setTimeout(()=>{const y=[{type:"showLinkEditor",value:!1}];h.url&&(vy(i,h.url),y.push({type:"lastAnchor",value:null})),a(y)})}},fields:[{id:"url",type:"url",inputRef:f,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"}})})},yy=()=>{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)}})},Dy=e=>["bold","italic","strikeThrough"].includes(e),Pd=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Nd=(e,t)=>{Pd(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)},Cy=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(Cn),r=Jn(),a=Pd(r,e);return d.jsx(Js,{id:e,active:a,hasDivider:t,callback:()=>{Nd(r,e),n(a?null:e)}})},Ca=["bold","italic","strikeThrough"],xy=["ol_list","ul_list","block_quote"];const wy=({...e})=>{const t=se.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx(Le,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[Ca.map((n,r)=>d.jsx(Cy,{format:n,hasDivider:r===Ca.length-1},n)),d.jsx(yy,{}),xy.map((n,r)=>d.jsx(my,{format:n,hasDivider:r===1},n))]})]}),d.jsx(by,{})]})},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 oa=Object.prototype.hasOwnProperty,Rd=Object.prototype.toString,rl=Object.defineProperty,al=Object.getOwnPropertyDescriptor,il=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Rd.call(t)==="[object Array]"},sl=function(t){if(!t||Rd.call(t)!=="[object Object]")return!1;var n=oa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&oa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||oa.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(oa.call(t,n)){if(al)return al(t,n).value}else return;return t[n]},Ey=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(Ey);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 _y(){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 f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);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:ky,dirname:Ay,extname:Fy,join:Ty,sep:"/"};function ky(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fr(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 Ay(e){if(Fr(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 Fy(e){Fr(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 Ty(...e){let t=-1,n;for(;++t<e.length;)Fr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Sy(n)}function Sy(e){Fr(e);const t=e.codePointAt(0)===47;let n=jy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function jy(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 Fr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Oy={cwd:Py};function Py(){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 Ny(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 Ry(e)}function Ry(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 My{constructor(t){let n;t?bs(t)?n={path:t}:typeof t=="string"||Iy(t)?n={value:t}:n=t:n={},this.cwd=Oy.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=Ny(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 Iy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $y=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},Ly={}.hasOwnProperty;class Xs extends $y{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=_y()}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):Ly.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=Ur(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=Ur(t),l=r.parse(o);r.run(l,o,function(c,f,m){if(c||!f||!m)return u(c);const p=f,g=r.stringify(p,m);Wy(g)?m.value=g:m.result=g,u(c,m)});function u(c,f){c||!f?s(c):i?i(f):n(void 0,f)}}}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=Ur(n);a.run(t,l,u);function u(c,f,m){const p=f||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=Ur(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,...f]=u;l(c,f)}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 f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===u){m=f;break}if(m===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const h=r[m][1];gs(h)&&gs(p)&&(p=bi(!0,h,p)),r[m]=[u,p,...g]}}}}const zy=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 Ur(e){return qy(e)?e:new My(e)}function qy(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Wy(e){return typeof e=="string"||Hy(e)}function Hy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Uy={};function Vy(e,t){const n=t||Uy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Md(e,r,a)}function Md(e,t,n){if(Ky(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]=Md(e[a],t,n);return r.join("")}function Ky(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 Zy(e){const t={};let n=-1;for(;++n<e.length;)Yy(t,e[n]);return t}function Yy(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];Gy(a[s],Array.isArray(o)?o:o?[o]:[])}}}function Gy(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 Id(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]/),Qy=rn(/[#-'*+\--9=?A-Z^-~]/);function ys(e){return e!==null&&(e<32||e===127)}const Ds=rn(/\d/),Jy=rn(/[\dA-Fa-f]/),Xy=rn(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function ke(e){return e===-2||e===-1||e===32}const e1=rn(/\p{P}|\p{S}/u),t1=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 ke(l)?(e.enter(n),o(l)):t(l)}function o(l){return ke(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const n1={tokenize:r1};function r1(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 a1={tokenize:i1},vl={tokenize:s1};function i1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(k){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,l,u)(k)}return u(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const E=t.events.length;let w=E,A;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){A=t.events[w][1].end;break}v(r);let P=E;for(;P<t.events.length;)t.events[P][1].end=Object.assign({},A),P++;return jt(t.events,w+1,0,t.events.slice(E)),t.events.length=P,u(k)}return o(k)}function u(k){if(r===n.length){if(!a)return m(k);if(a.currentConstruct&&a.currentConstruct.concrete)return g(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(vl,c,f)(k)}function c(k){return a&&x(),v(r),m(k)}function f(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(k)}function m(k){return t.containerState={},e.attempt(vl,p,g)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),m(k)}function g(k){if(k===null){a&&x(),v(0),e.consume(k);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(k)}function h(k){if(k===null){y(e.exit("chunkFlow"),!0),v(0),e.consume(k);return}return ve(k)?(e.consume(k),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(k),h)}function y(k,E){const w=t.sliceStream(k);if(E&&w.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(w),t.parser.lazy[k.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 P=t.events.length;let U=P,$,j;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){if($){j=t.events[U][1].end;break}$=!0}for(v(r),A=P;A<t.events.length;)t.events[A][1].end=Object.assign({},j),A++;jt(t.events,U+1,0,t.events.slice(P)),t.events.length=A}}function v(k){let E=n.length;for(;E-- >k;){const w=n[E];t.containerState=w[1],w[0].exit.call(t,e)}n.length=k}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function s1(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)||t1(e))return 1;if(e1(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:u1,resolveAll:o1};function o1(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 f=Object.assign({},e[r][1].end),m=Object.assign({},e[n][1].start);yl(f,-l),yl(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,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 u1(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),f=!c||c===2&&a||n.includes(l),m=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(a||!m)),u._close=!!(i===42?m:m&&(c||!f)),t(l)}}function yl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const l1={name:"autolink",tokenize:c1};function c1(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):Qy(p)?(e.consume(p),u):n(p)}function c(p){return Et(p)?f(p):n(p)}function f(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:f;return e.consume(p),g}return n(p)}}const Wa={tokenize:d1,partial:!0};function d1(e,t,n){return r;function r(i){return ke(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ve(i)?t(i):n(i)}}const $d={name:"blockQuote",tokenize:f1,continuation:{tokenize:h1},exit:m1};function f1(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 ke(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function h1(e,t,n){const r=this;return a;function a(s){return ke(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt($d,t,n)(s)}}function m1(e){e.exit("blockQuote")}const Ld={name:"characterEscape",tokenize:p1};function p1(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 Xy(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const zd={name:"characterReference",tokenize:g1};function g1(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Et,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=Jy,c):(e.enter("characterReferenceValue"),i=7,s=Ds,c(f))}function c(f){if(f===59&&a){const m=e.exit("characterReferenceValue");return s===Et&&!eo(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),c):n(f)}}const Dl={tokenize:b1,partial:!0},Cl={name:"codeFenced",tokenize:v1,concrete:!0};function v1(e,t,n){const r=this,a={tokenize:w,partial:!0};let i=0,s=0,o;return l;function l(A){return u(A)}function u(A){const P=r.events[r.events.length-1];return i=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[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"),ke(A)?Ne(e,f,"whitespace")(A):f(A))}function f(A){return A===null||ve(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(Dl,h,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"),f(A)):ke(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)?f(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"),f(A)):A===96&&A===o?n(A):(e.consume(A),g)}function h(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&&ke(A)?Ne(e,x,"linePrefix",i+1)(A):x(A)}function x(A){return A===null||ve(A)?e.check(Dl,h,E)(A):(e.enter("codeFlowValue"),k(A))}function k(A){return A===null||ve(A)?(e.exit("codeFlowValue"),x(A)):(e.consume(A),k)}function E(A){return e.exit("codeFenced"),t(A)}function w(A,P,U){let $=0;return j;function j(M){return A.enter("lineEnding"),A.consume(M),A.exit("lineEnding"),R}function R(M){return A.enter("codeFencedFence"),ke(M)?Ne(A,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):_(M)}function _(M){return M===o?(A.enter("codeFencedFenceSequence"),T(M)):U(M)}function T(M){return M===o?($++,A.consume(M),T):$>=s?(A.exit("codeFencedFenceSequence"),ke(M)?Ne(A,N,"whitespace")(M):N(M)):U(M)}function N(M){return M===null||ve(M)?(A.exit("codeFencedFence"),P(M)):U(M)}}}function b1(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:D1},y1={tokenize:C1,partial:!0};function D1(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(y1,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 C1(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 x1={name:"codeText",tokenize:_1,resolve:w1,previous:E1};function w1(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 E1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _1(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,c(f)):ve(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ve(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function qd(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,f,m=-1,p=n,g=0,h=0;const y=[h];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),f&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=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&&(h=m+1,y.push(h),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 k1={tokenize:T1,resolve:F1},A1={tokenize:S1,partial:!0};function F1(e){return qd(e),e}function T1(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(A1,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 S1(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 Wd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(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"}),h(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 h(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++,h):v===41?(e.consume(v),c--,h):v===null||v===32||v===40||ys(v)?n(v):(e.consume(v),v===92?y:h)}function y(v){return v===40||v===41||v===92?(e.consume(v),h):h(v)}}function Hd(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"}),f(p))}function f(p){return p===null||p===91||p===93||ve(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!ke(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function Ud(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?f:c)}function f(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):ke(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const j1={name:"definition",tokenize:P1},O1={tokenize:N1,partial:!0};function P1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Hd.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 Wd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(O1,f,f)(p)}function f(p){return ke(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 N1(e,t,n){return r;function r(o){return ct(o)?gr(e,a)(o):n(o)}function a(o){return Ud(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return ke(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ve(o)?t(o):n(o)}}const R1={name:"hardBreakEscape",tokenize:M1};function M1(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 I1={name:"headingAtx",tokenize:L1,resolve:$1};function $1(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 L1(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)):ke(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 z1=["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"],q1={name:"htmlFlow",tokenize:V1,resolveTo:U1,concrete:!0},W1={tokenize:Z1,partial:!0},H1={tokenize:K1,partial:!0};function U1(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 V1(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return c(B)}function c(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),i=!0,h):B===63?(e.consume(B),a=3,r.interrupt?t:D):Tt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function m(B){return B===45?(e.consume(B),a=2,p):B===91?(e.consume(B),a=5,o=0,g):Tt(B)?(e.consume(B),a=4,r.interrupt?t:D):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:D):n(B)}function g(B){const F="CDATA[";return B===F.charCodeAt(o++)?(e.consume(B),o===F.length?r.interrupt?t:_:g):n(B)}function h(B){return Tt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function y(B){if(B===null||B===47||B===62||ct(B)){const F=B===47,L=s.toLowerCase();return!F&&!i&&xl.includes(L)?(a=1,r.interrupt?t(B):_(B)):z1.includes(s.toLowerCase())?(a=6,F?(e.consume(B),v):r.interrupt?t(B):_(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?x(B):k(B))}return B===45||Et(B)?(e.consume(B),s+=String.fromCharCode(B),y):n(B)}function v(B){return B===62?(e.consume(B),r.interrupt?t:_):n(B)}function x(B){return ke(B)?(e.consume(B),x):j(B)}function k(B){return B===47?(e.consume(B),j):B===58||B===95||Tt(B)?(e.consume(B),E):ke(B)?(e.consume(B),k):j(B)}function E(B){return B===45||B===46||B===58||B===95||Et(B)?(e.consume(B),E):w(B)}function w(B){return B===61?(e.consume(B),A):ke(B)?(e.consume(B),w):k(B)}function A(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,P):ke(B)?(e.consume(B),A):U(B)}function P(B){return B===l?(e.consume(B),l=null,$):B===null||ve(B)?n(B):(e.consume(B),P)}function U(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ct(B)?w(B):(e.consume(B),U)}function $(B){return B===47||B===62||ke(B)?k(B):n(B)}function j(B){return B===62?(e.consume(B),R):n(B)}function R(B){return B===null||ve(B)?_(B):ke(B)?(e.consume(B),R):n(B)}function _(B){return B===45&&a===2?(e.consume(B),Q):B===60&&a===1?(e.consume(B),Z):B===62&&a===4?(e.consume(B),z):B===63&&a===3?(e.consume(B),D):B===93&&a===5?(e.consume(B),ne):ve(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(W1,J,T)(B)):B===null||ve(B)?(e.exit("htmlFlowData"),T(B)):(e.consume(B),_)}function T(B){return e.check(H1,N,J)(B)}function N(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return B===null||ve(B)?T(B):(e.enter("htmlFlowData"),_(B))}function Q(B){return B===45?(e.consume(B),D):_(B)}function Z(B){return B===47?(e.consume(B),s="",oe):_(B)}function oe(B){if(B===62){const F=s.toLowerCase();return xl.includes(F)?(e.consume(B),z):_(B)}return Tt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),oe):_(B)}function ne(B){return B===93?(e.consume(B),D):_(B)}function D(B){return B===62?(e.consume(B),z):B===45&&a===2?(e.consume(B),D):_(B)}function z(B){return B===null||ve(B)?(e.exit("htmlFlowData"),J(B)):(e.consume(B),z)}function J(B){return e.exit("htmlFlow"),t(B)}}function K1(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 Z1(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Wa,t,n)}}const Y1={name:"htmlText",tokenize:G1};function G1(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),w):D===63?(e.consume(D),k):Tt(D)?(e.consume(D),U):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 f(D){return D===null?n(D):D===45?(e.consume(D),m):ve(D)?(s=f,Z(D)):(e.consume(D),f)}function m(D){return D===45?(e.consume(D),p):f(D)}function p(D){return D===62?Q(D):D===45?m(D):f(D)}function g(D){const z="CDATA[";return D===z.charCodeAt(i++)?(e.consume(D),i===z.length?h:g):n(D)}function h(D){return D===null?n(D):D===93?(e.consume(D),y):ve(D)?(s=h,Z(D)):(e.consume(D),h)}function y(D){return D===93?(e.consume(D),v):h(D)}function v(D){return D===62?Q(D):D===93?(e.consume(D),v):h(D)}function x(D){return D===null||D===62?Q(D):ve(D)?(s=x,Z(D)):(e.consume(D),x)}function k(D){return D===null?n(D):D===63?(e.consume(D),E):ve(D)?(s=k,Z(D)):(e.consume(D),k)}function E(D){return D===62?Q(D):k(D)}function w(D){return Tt(D)?(e.consume(D),A):n(D)}function A(D){return D===45||Et(D)?(e.consume(D),A):P(D)}function P(D){return ve(D)?(s=P,Z(D)):ke(D)?(e.consume(D),P):Q(D)}function U(D){return D===45||Et(D)?(e.consume(D),U):D===47||D===62||ct(D)?$(D):n(D)}function $(D){return D===47?(e.consume(D),Q):D===58||D===95||Tt(D)?(e.consume(D),j):ve(D)?(s=$,Z(D)):ke(D)?(e.consume(D),$):Q(D)}function j(D){return D===45||D===46||D===58||D===95||Et(D)?(e.consume(D),j):R(D)}function R(D){return D===61?(e.consume(D),_):ve(D)?(s=R,Z(D)):ke(D)?(e.consume(D),R):$(D)}function _(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,T):ve(D)?(s=_,Z(D)):ke(D)?(e.consume(D),_):(e.consume(D),N)}function T(D){return D===a?(e.consume(D),a=void 0,M):D===null?n(D):ve(D)?(s=T,Z(D)):(e.consume(D),T)}function N(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),N)}function M(D){return D===47||D===62||ct(D)?$(D):n(D)}function Q(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function Z(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),oe}function oe(D){return ke(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:nD,resolveTo:tD,resolveAll:eD},Q1={tokenize:rD},J1={tokenize:aD},X1={tokenize:iD};function eD(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 tD(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 nD(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?f(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(Q1,c,s?c:f)(m):m===91?e.attempt(J1,c,s?u:f)(m):s?c(m):f(m)}function u(m){return e.attempt(X1,c,f)(m)}function c(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function rD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ct(f)?gr(e,i)(f):i(f)}function i(f){return f===41?c(f):Wd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ct(f)?gr(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Ud(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ct(f)?gr(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function aD(e,t,n){const r=this;return a;function a(o){return Hd.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 iD(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 sD={name:"labelStartImage",tokenize:oD,resolveAll:no.resolveAll};function oD(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 uD={name:"labelStartLink",tokenize:lD,resolveAll:no.resolveAll};function lD(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 Bi={name:"lineEnding",tokenize:cD};function cD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const ua={name:"thematicBreak",tokenize:dD};function dD(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"),ke(u)?Ne(e,o,"whitespace")(u):o(u))}}const ot={name:"list",tokenize:mD,continuation:{tokenize:pD},exit:vD},fD={tokenize:bD,partial:!0},hD={tokenize:gD,partial:!0};function mD(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(ua,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(fD,m,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return ke(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 pD(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||!ke(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(hD,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 gD(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 vD(e){e.exit(this.containerState.type)}function bD(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!ke(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const wl={name:"setextUnderline",tokenize:DD,resolveTo:yD};function yD(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 DD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),ke(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ve(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const CD={tokenize:xD};function xD(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(k1,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 wD={resolveAll:Kd()},ED=Vd("string"),_D=Vd("text");function Vd(e){return{tokenize:t,resolveAll:Kd(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 f=a[c];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Kd(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 kD(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:k,exit:E,attempt:P(w),check:P(A),interrupt:P(A,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:h,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(R){return s=bt(s,R),y(),s[s.length-1]!==null?[]:(U(t,0),u.events=to(i,u.events,u),u.events)}function m(R,_){return FD(p(R),_)}function p(R){return AD(s,R)}function g(){const{line:R,column:_,offset:T,_index:N,_bufferIndex:M}=r;return{line:R,column:_,offset:T,_index:N,_bufferIndex:M}}function h(R){a[R.line]=R.column,j()}function y(){let R;for(;r._index<s.length;){const _=s[r._index];if(typeof _=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<_.length;)v(_.charCodeAt(r._bufferIndex));else v(_)}}function v(R){c=c(R)}function x(R){ve(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,j()):R!==-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=R}function k(R,_){const T=_||{};return T.type=R,T.start=g(),u.events.push(["enter",T,u]),o.push(T),T}function E(R){const _=o.pop();return _.end=g(),u.events.push(["exit",_,u]),_}function w(R,_){U(R,_.from)}function A(R,_){_.restore()}function P(R,_){return T;function T(N,M,Q){let Z,oe,ne,D;return Array.isArray(N)?J(N):"tokenize"in N?J([N]):z(N);function z(I){return H;function H(te){const ee=te!==null&&I[te],K=te!==null&&I.null,ue=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(K)?K:K?[K]:[]];return J(ue)(te)}}function J(I){return Z=I,oe=0,I.length===0?Q:B(I[oe])}function B(I){return H;function H(te){return D=$(),ne=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?L():I.tokenize.call(_?Object.assign(Object.create(u),_):u,l,F,L)(te)}}function F(I){return R(ne,D),M}function L(I){return D.restore(),++oe<Z.length?B(Z[oe]):Q}}}function U(R,_){R.resolveAll&&!i.includes(R)&&i.push(R),R.resolve&&jt(u.events,_,u.events.length-_,R.resolve(u.events.slice(_),u)),R.resolveTo&&(u.events=R.resolveTo(u.events,u))}function $(){const R=g(),_=u.previous,T=u.currentConstruct,N=u.events.length,M=Array.from(o);return{restore:Q,from:N};function Q(){r=R,u.previous=_,u.currentConstruct=T,u.events.length=N,o=M,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function AD(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 FD(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=`
|
|
134
113
|
`;break}case-3:{s=`\r
|
|
135
|
-
`;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 qD={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:Id},WD={91:H1},HD={[-2]:Bi,[-1]:Bi,32:Bi},UD={35:G1,42:la,45:[wl,la],60:eD,61:wl,95:la,96:Cl,126:Cl},VD={38:Ld,92:$d},KD={[-5]:ki,[-4]:ki,[-3]:ki,33:bD,38:Ld,42:Ds,60:[C1,oD],91:DD,92:[Z1,$d],93:to,95:Ds,96:P1},ZD={null:[Ds,ND]},YD={null:[42,95]},GD={null:[]},QD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YD,contentInitial:WD,disable:GD,document:qD,flow:UD,flowInitial:HD,insideSpan:ZD,string:VD,text:KD},Symbol.toStringTag,{value:"Module"}));function JD(e){const n=s1([QD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(m1),document:a(g1),flow:a(OD),string:a(RD),text:a(MD)};return r;function a(i){return s;function s(o){return $D(r,i,o)}}}function XD(e){for(;!zd(e););return e}const El=/[\0\t\n\r]/g;function eC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,f,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(El.lastIndex=f,u=El.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(f);break}if(h===10&&f===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<p&&(l.push(i.slice(f,p)),e+=p-f),h){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}f=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const tC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nC(e){return e.replace(tC,rC)}function rC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Md(n.slice(i?2:1),i?16:10)}return Xs(n)||e}const Kd={}.hasOwnProperty;function aC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),iC(n)(XD(JD(n).document().write(eC()(e,t,!0))))}function iC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(pe),blockQuote:i(te),characterEscape:I,characterReference:I,codeFenced:i(Z),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Z,s),codeText:i(le,s),codeTextData:I,data:I,codeFlowValue:I,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(be),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Se,s),htmlFlowData:I,htmlText:i(Se,s),htmlTextData:I,image:i(Pe),label:s,link:i(Ge),listItem:i(Ze),listItemValue:p,listOrdered:i(Ke,f),listUnordered:i(Ke),paragraph:i(tt),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Ae),thematicBreak:i($e)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:ne,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:$,codeFenced:l(b),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:l(v),codeText:l(M),codeTextData:N,data:N,definition:l(),definitionDestinationString:k,definitionLabelString:x,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(T),htmlFlowData:N,htmlText:l(R),htmlTextData:N,image:l(V),label:Q,labelText:ie,lineEnding:O,link:l(K),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:D,resourceTitleString:U,resource:X,setextHeading:l(z),setextHeadingLineSequence:P,setextHeadingText:B,strong:l(),thematicBreak:l()}};Zd(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},me=[];let De=-1;for(;++De<H.length;)if(H[De][1].type==="listOrdered"||H[De][1].type==="listUnordered")if(H[De][0]==="enter")me.push(De);else{const Ue=me.pop();De=a(H,Ue,De)}for(De=-1;++De<H.length;){const Ue=t[H[De][0]];Kd.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 me=ae-1,De=-1,Ue=!1,Ve,ft,Nt,wt;for(;++me<=fe;){const Qe=H[me];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?De++:De--,wt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Ve&&!wt&&!De&&!Nt&&(Nt=me),wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:wt=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 Bt=me;for(ft=void 0;Bt--;){const ht=H[Bt];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=Bt}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}Nt&&(!ft||Nt<ft)&&(Ve._spread=!0),Ve.end=Object.assign({},ft?H[ft][1].start:Qe[1].end),H.splice(ft||me,0,["exit",Ve,Qe[2]]),me++,fe++}if(Qe[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Ve=Bt,H.splice(me,0,["enter",Bt,Qe[2]]),me++,fe++,Nt=void 0,wt=!0}}}return H[ae][1]._spread=Ue,fe}function i(H,ae){return fe;function fe(me){o.call(this,H(me),me),ae&&ae.call(this,me)}}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(),me=this.tokenStack.pop();if(me)me[0].type!==H.type&&(ae?ae.call(this,H,me[0]):(me[1]||_l).call(this,H,me[0]));else throw new Error("Cannot close `"+H.type+"` ("+gr({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Ut(H.end)}function c(){return a1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(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 h(){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 m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){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=$n(this.sliceSerialize(H)).toLowerCase()}function A(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function k(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function E(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const fe=this.sliceSerialize(H).length;ae.depth=fe}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function P(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function I(H){const fe=this.stack[this.stack.length-1].children;let me=fe[fe.length-1];(!me||me.type!=="text")&&(me=We(),me.position={start:Ut(H.start),end:void 0},fe.push(me)),this.stack.push(me)}function N(H){const ae=this.stack.pop();ae.value+=this.sliceSerialize(H),ae.position.end=Ut(H.end)}function O(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)&&(I.call(this,H),N.call(this,H))}function w(){this.data.atHardBreak=!0}function T(){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 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 V(){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 ie(H){const ae=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=nC(ae),fe.identifier=$n(ae).toLowerCase()}function Q(){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 me=H.children;fe.children=me}else fe.alt=ae}function D(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function U(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function X(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function F(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=$n(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function L(H){this.data.characterReferenceType=H.type}function $(H){const ae=this.sliceSerialize(H),fe=this.data.characterReferenceType;let me;fe?(me=Md(ae,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Xs(ae);const De=this.stack.pop();De.value+=me,De.position.end=Ut(H.end)}function q(H){N.call(this,H);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(H)}function ne(H){N.call(this,H);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(H)}function te(){return{type:"blockquote",children:[]}}function Z(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function be(){return{type:"emphasis",children:[]}}function pe(){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 $e(){return{type:"thematicBreak"}}}function Ut(e){return{line:e.line,column:e.column,offset:e.offset}}function Zd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Zd(e,r):sC(e,r)}}function sC(e,t){let n;for(n in t)if(Kd.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+"` ("+gr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+gr({start:t.start,end:t.end})+") is still open")}function oC(e){const t=this;t.parser=n;function n(r){return aC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}const Bl={"mod+b":"bold","mod+i":"italic","mod+s":"strikeThrough"},uC=(e,t=n=>{})=>{Xy().use(oC).use(Am).process(e).then(n=>{const r=fn(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),f=i.text.substring(0,c),p=i.text.substring(c+l.length),h=[{text:f},{text:u,strikeThrough:!0},{text:p}];a.children.splice(s,1,...h)})}})}),t(r)})};const Yd=C.forwardRef(({id:e="rich-text-editor",value:t,placeholder:n,onChange:r=()=>{},autoFocus:a=!0,...i},s)=>{const o=oe.useIntl(),l=C.useRef(null),u=s||l,[c,f]=C.useState(t?null:[{children:[{text:""}]}]),[p,h]=C.useState(xa[0]),[g,m]=C.useState(null),[b,v]=C.useState(!1),[x,A]=C.useState(null),k=z=>{h(z||xa[0])};C.useEffect(()=>{if(t){let z=fn(t);z.includes("<")&&(z=new pa().turndown(z)),uC(z,I=>{f(I)})}},[]);const E=C.useCallback(z=>d.jsx(gy,{...z}),[]),B=C.useCallback(z=>d.jsx(vy,{...z}),[]),P=C.useMemo(()=>Ny(ov(my(iv()))),[]);return c?d.jsx("div",{className:"rich-text-editor",children:d.jsx(xn.Provider,{value:{id:e,tabbableOption:p,setFocus:k,openTooltip:g,setOpenTooltip:m,showLinkEditor:b,setShowLinkEditor:v,lastAnchor:x,setLastAnchor:A},children:d.jsxs(fy,{editor:P,initialValue:c,onChange:z=>{if(P.operations.some(N=>N.type!=="set_selection")){const N=z.map(O=>zc(O)).join("");r(N),u.current=N}},...i,children:[d.jsx(ry,{className:"input",renderElement:E,renderLeaf:B,placeholder:n||o.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:0,onKeyDown:z=>{for(const I in Bl)if(Qh(I,z)){z.stopPropagation(),z.preventDefault();const N=Bl[I];Pd(P,N)}},onBlur:()=>{P.selection&&A(P.selection.anchor)},onFocus:()=>{x&&y.hasPath(P,x.path)&&ee.select(P,{anchor:x,focus:x})}}),d.jsx(Ay,{})]})})}):null});const lC=({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:Y("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:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function cC({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),f=async p=>{o(!0),u(!1);try{const h=p.target.files&&p.target.files[0];if(!h||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:h,userId:t});a(m=>({...m,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(rn,{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:f,hidden:!0,"data-testid":"file-input"}),d.jsx(we,{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 Gd=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Qn,{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 Qd=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[p,h]=C.useState(!0),[g,m]=C.useState(u),{formatMessage:b}=oe.useIntl(),v=async k=>{k.preventDefault();try{await l(c),f([]),m("SUCCESS")}catch(E){m("ERROR"),o(E)}},x=k=>{k.preventDefault(),m("NOT_SUBMITTED"),h(!0),f([])},A=k=>{k.preventDefault(),s(),m("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:b({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),d.jsx(Jt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(we,{variant:"secondary",onClick:x,children:b({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(we,{onClick:A,children:b({id:"inviteForm_ctaDone"})})]}):d.jsx(we,{onClick:x,children:b({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Y("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(Gf.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:c,onChange:k=>{f(k),h(!k.length)},autoFocus:!1,getLabel:(k,E,B)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:k}),d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(E),h(!c.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},E)})]}),d.jsx(Jt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(we,{className:"sendEmailsButton",disabled:p,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"},dC=({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=h=>h[vt.NEW_PASSWORD]!==h[vt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=h=>!Gi(h[vt.NEW_PASSWORD]).isValid,f=[{"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:h=>l(Gi(h).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&&f.unshift({"data-testid":vt.CURRENT_PASSWORD,id:vt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ca(["required"])}),i&&f.push({component:Ac,props:{matchingRules:o}});const p={id:vt.FORM_ID,fields:f,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,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(Qn,{...p}),r&&d.jsx(nn,{variant:"error",text:r})]})};const Jd=({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);zn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.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:Y("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(Le,{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:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Le,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Le,{children:l.formatMessage({id:"search_cta"})})})]})})})},kl=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}])},fC=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"]}},hC=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=fC(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}])},mC=({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,f=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(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:()=>{kl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,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:wc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(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:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>d.jsx("small",{children:h})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:h=>d.jsx("small",{className:"notes text-small",children:h})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:h=>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:h}),privacy:h=>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:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)return;const g=[];["name","email"].forEach(m=>{s.validFields[m]!==i[m].current.validity.valid&&(g.push({type:`validFields.${m}`,value:i[m].current.validity.valid}),m==="email"&&kl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const pC=({className:e=""})=>d.jsxs("div",{className:Y("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 gC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},vC=({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:f=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:c,url:f,logInButton:p,successMessage:h},[m,b]=C.useReducer(Bs,gC),{validFields:v,emailDetails:x,shouldManuallyApprove:A,shouldDisableButton:k,showSuccessMessage:E,showError:B}=m,[P,z]=_s.useCookies(["signup-this-session","functional-cookie-consent"]),I={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&I.jobTitle.current&&I.jobTitle.current.focus()},[A]),C.useEffect(()=>{P["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[P]),C.useEffect(()=>{E&&P["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const N=C.useMemo(()=>mC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:I,state:m,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,I,g,m]),O=k?!0:A?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&E?d.jsx(pC,{className:e}):d.jsxs("fieldset",{className:Y("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"})}),B&&d.jsx(nn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Qn,{className:"signup-form",formRef:I.form,id:"sign-up-form",fields:N,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:O?{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 hC({refs:I,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:m})},onCatch:w=>{r.handleError(w),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:I.hiddenValidation})]})};var Cs={exports:{}},Zr={exports:{}},Fe={};/** @license React v16.13.1
|
|
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 TD={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:$d},SD={91:j1},jD={[-2]:_i,[-1]:_i,32:_i},OD={35:I1,42:ua,45:[wl,ua],60:q1,61:wl,95:ua,96:Cl,126:Cl},PD={38:zd,92:Ld},ND={[-5]:Bi,[-4]:Bi,[-3]:Bi,33:sD,38:zd,42:Cs,60:[l1,Y1],91:uD,92:[R1,Ld],93:no,95:Cs,96:x1},RD={null:[Cs,wD]},MD={null:[42,95]},ID={null:[]},$D=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:MD,contentInitial:SD,disable:ID,document:TD,flow:OD,flowInitial:jD,insideSpan:RD,string:PD,text:ND},Symbol.toStringTag,{value:"Module"}));function LD(e){const n=Zy([$D,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(n1),document:a(a1),flow:a(CD),string:a(ED),text:a(_D)};return r;function a(i){return s;function s(o){return kD(r,i,o)}}}function zD(e){for(;!qd(e););return e}const El=/[\0\t\n\r]/g;function qD(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(El.lastIndex=f,u=El.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(f);break}if(p===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(i.slice(f,m)),e+=m-f),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}f=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const WD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function HD(e){return e.replace(WD,UD)}function UD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Id(n.slice(i?2:1),i?16:10)}return eo(n)||e}const Zd={}.hasOwnProperty;function VD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),KD(n)(zD(LD(n).document().write(qD()(e,t,!0))))}function KD(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(K),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(K,s),codeText:i(ue,s),codeTextData:$,data:$,codeFlowValue:$,definition:i(G),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,f),listUnordered:i(Ke),paragraph:i(tt),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(Ae),thematicBreak:i($e)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:te,autolinkProtocol:H,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:I,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:l(v),codeText:l(M),codeTextData:j,data:j,definition:l(),definitionDestinationString:E,definitionLabelString:x,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(_),hardBreakTrailing:l(_),htmlFlow:l(T),htmlFlowData:j,htmlText:l(N),htmlTextData:j,image:l(Z),label:ne,labelText:oe,lineEnding:R,link:l(Q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:D,resourceTitleString:z,resource:J,setextHeading:l(U),setextHeadingLineSequence:P,setextHeadingText:A,strong:l(),thematicBreak:l()}};Yd(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){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<W.length;)if(W[De][1].type==="listOrdered"||W[De][1].type==="listUnordered")if(W[De][0]==="enter")pe.push(De);else{const Ue=pe.pop();De=a(W,Ue,De)}for(De=-1;++De<W.length;){const Ue=t[W[De][0]];Zd.call(Ue,W[De][1].type)&&Ue[W[De][1].type].call(Object.assign({sliceSerialize:W[De][2].sliceSerialize},fe),W[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(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Ut(W.length>0?W[W.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(W,ae,fe){let pe=ae-1,De=-1,Ue=!1,Ve,ft,Pt,xt;for(;++pe<=fe;){const Qe=W[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=W[_t];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;ft&&(W[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?W[ft][1].start:Qe[1].end),W.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,W.splice(pe,0,["enter",_t,Qe[2]]),pe++,fe++,Pt=void 0,xt=!0}}}return W[ae][1]._spread=Ue,fe}function i(W,ae){return fe;function fe(pe){o.call(this,W(pe),pe),ae&&ae.call(this,pe)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(W,ae,fe){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ae,fe]),W.position={start:Ut(ae.start),end:void 0}}function l(W){return ae;function ae(fe){W&&W.call(this,fe),u.call(this,fe)}}function u(W,ae){const fe=this.stack.pop(),pe=this.tokenStack.pop();if(pe)pe[0].type!==W.type&&(ae?ae.call(this,W,pe[0]):(pe[1]||_l).call(this,W,pe[0]));else throw new Error("Cannot close `"+W.type+"` ("+pr({start:W.start,end:W.end})+"): it’s not open");fe.position.end=Ut(W.end)}function c(){return Vy(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(W){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=W}function g(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=W}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.value=W.replace(/(\r?\n|\r)$/g,"")}function x(W){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=In(this.sliceSerialize(W)).toLowerCase()}function k(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.title=W}function E(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.url=W}function w(W){const ae=this.stack[this.stack.length-1];if(!ae.depth){const fe=this.sliceSerialize(W).length;ae.depth=fe}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function P(W){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function $(W){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(W.start),end:void 0},fe.push(pe)),this.stack.push(pe)}function j(W){const ae=this.stack.pop();ae.value+=this.sliceSerialize(W),ae.position.end=Ut(W.end)}function R(W){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=ae.children[ae.children.length-1];fe.position.end=Ut(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&($.call(this,W),j.call(this,W))}function _(){this.data.atHardBreak=!0}function T(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.value=W}function N(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.value=W}function M(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.value=W}function Q(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ae,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function Z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ae,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function oe(W){const ae=this.sliceSerialize(W),fe=this.stack[this.stack.length-2];fe.label=HD(ae),fe.identifier=In(ae).toLowerCase()}function ne(){const W=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=W.children;fe.children=pe}else fe.alt=ae}function D(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.url=W}function z(){const W=this.resume(),ae=this.stack[this.stack.length-1];ae.title=W}function J(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function F(W){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=In(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function L(W){this.data.characterReferenceType=W.type}function I(W){const ae=this.sliceSerialize(W),fe=this.data.characterReferenceType;let pe;fe?(pe=Id(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(W.end)}function H(W){j.call(this,W);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(W)}function te(W){j.call(this,W);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(W)}function ee(){return{type:"blockquote",children:[]}}function K(){return{type:"code",lang:null,meta:null,value:""}}function ue(){return{type:"inlineCode",value:""}}function G(){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(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Ze(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function Ut(e){return{line:e.line,column:e.column,offset:e.offset}}function Yd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Yd(e,r):ZD(e,r)}}function ZD(e,t){let n;for(n in t)if(Zd.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 YD(e){const t=this;t.parser=n;function n(r){return VD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Gd(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(f=>Gd({...f,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,...ki(s),...Vr(s)};case"strong":return{[n.strong_mark]:!0,...ki(s),...Vr(s)};case"delete":return{[n.delete_mark]:!0,...ki(s),...Vr(s)};case"inlineCode":return{[n.inline_code_mark]:!0,text:e.value,...Vr(s)};case"thematicBreak":return{type:n.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}const ki=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Vr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const GD=function(t){const n=r=>r.children.map(a=>Gd(a,t));this.Compiler=n},QD=(e,t=n=>{})=>{zy().use(YD).use(GD).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),f=i.text.substring(0,c),m=i.text.substring(c+l.length),p=[{text:f},{text:u,strikeThrough:!0},{text:m}];a.children.splice(s,1,...p)})}})}),t(r)})},Bl={"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"},kn=e=>typeof e.text=="string",JD=["thematic_break","image"],kl="<br>";function Qd(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(kn(e)||(u=e.children.map(c=>{const f=kn(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!kn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!kn(g)&&g.type===o.link)),Qd({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||f||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=kl),!(u===""&&!JD.find(c=>o[c]===s)))switch(u!==kl&&kn(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,f=e.children.length===1&&kn(e.children[0]);let m="";for(let p=0;a>p;p++)c?m+=" ":m+=" ";return`${m}${c?"1.":"-"} ${u}${f?`
|
|
129
|
+
`:""}`;case o.paragraph:return`${u}
|
|
130
|
+
`;case o.thematic_break:return`---
|
|
131
|
+
`;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("");var XD=rC,eC=/^(?:\w+:)?\/\/(\S+)$/,tC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,nC=/^[^\s\.]+\.\S{2,}$/;function rC(e){if(typeof e!="string")return!1;var t=e.match(eC);if(!t)return!1;var n=t[1];return n?!!(tC.test(n)||nC.test(n)):!1}const aC=bn(XD),iC=e=>{const{insertText:t,isInline:n}=e;return e.isInline=r=>{const a=r;return["link"].includes(a.type)||n(r)},e.insertText=r=>{r&&aC(r)?jd(e,r):t(r)},e};const Jd=({id:e="rich-text-editor",value:t,placeholder:n,onChange:r=()=>{},autoFocus:a=!0,...i})=>{const s=se.useIntl(),o=[{type:"paragraph",children:[{text:""}]}],l={originalValue:t||"",initialValue:t?null:o,tabbableOption:Ca[0],openTooltip:null,showLinkEditor:!1,lastAnchor:null,domSelection:null,hasInteracted:!1},[u,c]=C.useReducer(Pa,l),{originalValue:f,initialValue:m,lastAnchor:p,hasInteracted:g}=u,h=k=>{const E=k||Ca[0];k&&c([{type:"tabbableOption",value:E}])};C.useEffect(()=>{if(t){let k=cn(t);k.includes("<")&&(k=new ma().turndown(k)),QD(k,E=>{c([{type:"initialValue",value:E}])})}},[]),C.useEffect(()=>{t!==""||!x||nc(f,t)&&!g||(b.withoutNormalizing(x,()=>{X.delete(x,{at:{anchor:b.start(x,[]),focus:b.end(x,[])}}),X.deselect(x),x.children.length!==0&&X.unwrapNodes(x,{at:[0]}),X.insertNodes(x,o,{at:[0]})}),c([{type:"initialValue",value:o},{type:"lastAnchor",value:null}]))},[t]);const y=C.useCallback(k=>d.jsx(fy,{...k}),[]),v=C.useCallback(k=>d.jsx(hy,{...k}),[]),x=C.useMemo(()=>iC(rv(cy(tv()))),[]);return m?d.jsx("div",{id:`rte-${e}`,className:"rich-text-editor",children:d.jsx(Cn.Provider,{value:{...u,id:`rte-${e}`,setFocus:h,dispatch:c},children:d.jsxs(uy,{editor:x,initialValue:m,onChange:k=>{if(x.operations.some(w=>w.type!=="set_selection")){const w=k.map(A=>Qd(A)).join("").trim();r(w),g||c([{type:"hasInteracted",value:!0}])}},...i,children:[d.jsx(Xb,{className:"input",renderElement:y,renderLeaf:v,placeholder:n||s.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:0,onKeyDown:k=>{for(const E in Bl)if(Xh(E,k)){k.stopPropagation(),k.preventDefault();const w=Bl[E];if(w==="link"){c([{type:"showLinkEditor",value:!0}]);return}if(Dy(w)){Nd(x,w);return}Sd(x,w)}},onBlur:()=>{x.selection&&c([{type:"lastAnchor",value:x.selection.anchor}])},onMouseUp:()=>{window.getSelection()&&c([{type:"domSelection",value:window.getSelection()}])},onFocus:()=>{p&&b.hasPath(x,p.path)&&X.select(x,{anchor:p,focus:p})}}),d.jsx(wy,{})]})})}):null};const sC=({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 f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function oC({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),f=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(h=>({...h,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(se.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,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(se.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Xd=({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 ef=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[m,p]=C.useState(!0),[g,h]=C.useState(u),{formatMessage:y}=se.useIntl(),v=async E=>{E.preventDefault();try{await l(c),f([]),h("SUCCESS")}catch(w){h("ERROR"),o(w)}},x=E=>{E.preventDefault(),h("NOT_SUBMITTED"),p(!0),f([])},k=E=>{E.preventDefault(),s(),h("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:k,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(Jf.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:E=>{f(E),p(!E.length)},autoFocus:!1,getLabel:(E,w,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(w),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},w)})]}),d.jsx(Qt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(xe,{className:"sendEmailsButton",disabled:m,children:n})})]})})},la=e=>e.map(t=>({condition:t})),vt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},uC=({functions:e,...t})=>{const{formatMessage:n}=se.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,f=[{"data-testid":vt.NEW_PASSWORD,id:vt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:la(["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:la(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":vt.CURRENT_PASSWORD,id:vt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:la(["required"])}),i&&f.push({component:Tc,props:{matchingRules:o}});const m={id:vt.FORM_ID,fields:f,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 tf=({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=se.useIntl(),u=C.useRef(null);Ln(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.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(Le,{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:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Le,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Le,{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}])},lC=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"]}},cC=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=lC(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}])},dC=({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,f=(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:()=>f(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:_c,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:()=>f(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:()=>{f(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(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Fl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const fC=({className:e=""})=>d.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(se.FormattedMessage,{id:"signup_success_title"})}),d.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const hC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},mC=({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=se.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:m=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:f,logInButton:m,successMessage:p},[h,y]=C.useReducer(Pa,hC),{validFields:v,emailDetails:x,shouldManuallyApprove:k,shouldDisableButton:E,showSuccessMessage:w,showError:A}=h,[P,U]=Bs.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(()=>{k===!0&&$.jobTitle.current&&$.jobTitle.current.focus()},[k]),C.useEffect(()=>{P["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[P]),C.useEffect(()=>{w&&P["functional-cookie-consent"]&&U("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const j=C.useMemo(()=>dC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:$,state:h,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,$,g,h]),R=E?!0:k?!Object.values(v).every(_=>_===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&w?d.jsx(fC,{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(se.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:R?{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 cC({refs:$,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:h})},onCatch:_=>{r.handleError(_),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:$.hiddenValidation})]})};var xs={exports:{}},Kr={exports:{}},Fe={};/** @license React v16.13.1
|
|
136
132
|
* react-is.production.min.js
|
|
137
133
|
*
|
|
138
134
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
139
135
|
*
|
|
140
136
|
* This source code is licensed under the MIT license found in the
|
|
141
137
|
* LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/var
|
|
138
|
+
*/var Tl;function pC(){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,f=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,h=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 k(w){if(typeof w=="object"&&w!==null){var A=w.$$typeof;switch(A){case t:switch(w=w.type,w){case l:case u:case r:case i:case a:case f:return w;default:switch(w=w&&w.$$typeof,w){case o:case c:case g:case p:case s:return w;default:return A}}case n:return A}}}function E(w){return k(w)===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=f,Fe.isAsyncMode=function(w){return E(w)||k(w)===l},Fe.isConcurrentMode=E,Fe.isContextConsumer=function(w){return k(w)===o},Fe.isContextProvider=function(w){return k(w)===s},Fe.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===t},Fe.isForwardRef=function(w){return k(w)===c},Fe.isFragment=function(w){return k(w)===r},Fe.isLazy=function(w){return k(w)===g},Fe.isMemo=function(w){return k(w)===p},Fe.isPortal=function(w){return k(w)===n},Fe.isProfiler=function(w){return k(w)===i},Fe.isStrictMode=function(w){return k(w)===a},Fe.isSuspense=function(w){return k(w)===f},Fe.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===u||w===i||w===a||w===f||w===m||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===p||w.$$typeof===s||w.$$typeof===o||w.$$typeof===c||w.$$typeof===y||w.$$typeof===v||w.$$typeof===x||w.$$typeof===h)},Fe.typeOf=k,Fe}var Te={};/** @license React v16.13.1
|
|
143
139
|
* react-is.development.js
|
|
144
140
|
*
|
|
145
141
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
146
142
|
*
|
|
147
143
|
* This source code is licensed under the MIT license found in the
|
|
148
144
|
* LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/var
|
|
145
|
+
*/var Sl;function gC(){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,f=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,h=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 k(G){return typeof G=="string"||typeof G=="function"||G===r||G===u||G===i||G===a||G===f||G===m||typeof G=="object"&&G!==null&&(G.$$typeof===g||G.$$typeof===p||G.$$typeof===s||G.$$typeof===o||G.$$typeof===c||G.$$typeof===y||G.$$typeof===v||G.$$typeof===x||G.$$typeof===h)}function E(G){if(typeof G=="object"&&G!==null){var ge=G.$$typeof;switch(ge){case t:var me=G.type;switch(me){case l:case u:case r:case i:case a:case f: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 w=l,A=u,P=o,U=s,$=t,j=c,R=r,_=g,T=p,N=n,M=i,Q=a,Z=f,oe=!1;function ne(G){return oe||(oe=!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(G)||E(G)===l}function D(G){return E(G)===u}function z(G){return E(G)===o}function J(G){return E(G)===s}function B(G){return typeof G=="object"&&G!==null&&G.$$typeof===t}function F(G){return E(G)===c}function L(G){return E(G)===r}function I(G){return E(G)===g}function H(G){return E(G)===p}function te(G){return E(G)===n}function ee(G){return E(G)===i}function K(G){return E(G)===a}function ue(G){return E(G)===f}Te.AsyncMode=w,Te.ConcurrentMode=A,Te.ContextConsumer=P,Te.ContextProvider=U,Te.Element=$,Te.ForwardRef=j,Te.Fragment=R,Te.Lazy=_,Te.Memo=T,Te.Portal=N,Te.Profiler=M,Te.StrictMode=Q,Te.Suspense=Z,Te.isAsyncMode=ne,Te.isConcurrentMode=D,Te.isContextConsumer=z,Te.isContextProvider=J,Te.isElement=B,Te.isForwardRef=F,Te.isFragment=L,Te.isLazy=I,Te.isMemo=H,Te.isPortal=te,Te.isProfiler=ee,Te.isStrictMode=K,Te.isSuspense=ue,Te.isValidElementType=k,Te.typeOf=E}()),Te}var jl;function nf(){return jl||(jl=1,process.env.NODE_ENV==="production"?Kr.exports=pC():Kr.exports=gC()),Kr.exports}/*
|
|
150
146
|
object-assign
|
|
151
147
|
(c) Sindre Sorhus
|
|
152
148
|
@license MIT
|
|
153
|
-
*/var Ai,
|
|
154
|
-
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var
|
|
149
|
+
*/var Ai,Ol;function vC(){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 f in o)t.call(o,f)&&(l[f]=o[f]);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 rf(){return Nl||(Nl=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Rl;function bC(){if(Rl)return Si;Rl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ro(),n={},r=rf();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 f;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}f=i[c](s,c,l,o,null,t)}catch(g){f=g}if(f&&!(f 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 f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var p=u?u():"";e("Failed "+o+" type: "+f.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Si=a,Si}var ji,Ml;function yC(){if(Ml)return ji;Ml=1;var e=nf(),t=vC(),n=ro(),r=rf(),a=bC(),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 f(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:k,element:E(),elementType:w(),instanceOf:A,node:j(),objectOf:U,oneOf:P,oneOfType:$,shape:_,exact:T};function g(D,z){return D===z?D!==0||1/D===1/z:D!==D&&z!==z}function h(D,z){this.message=D,this.data=z&&typeof z=="object"?z:{},this.stack=""}h.prototype=Error.prototype;function y(D){if(process.env.NODE_ENV!=="production")var z={},J=0;function B(L,I,H,te,ee,K,ue){if(te=te||m,K=K||H,ue!==n){if(l){var G=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 G.name="Invariant Violation",G}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ge=te+":"+H;!z[ge]&&J<3&&(i("You are manually calling a React.PropTypes validation function for the `"+K+"` 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[H]==null?L?I[H]===null?new h("The "+ee+" `"+K+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new h("The "+ee+" `"+K+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:D(I,H,te,ee,K)}var F=B.bind(null,!1);return F.isRequired=B.bind(null,!0),F}function v(D){function z(J,B,F,L,I,H){var te=J[B],ee=Q(te);if(ee!==D){var K=Z(te);return new h("Invalid "+L+" `"+I+"` of type "+("`"+K+"` supplied to `"+F+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return y(z)}function x(){return y(s)}function k(D){function z(J,B,F,L,I){if(typeof D!="function")return new h("Property `"+I+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var H=J[B];if(!Array.isArray(H)){var te=Q(H);return new h("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+F+"`, expected an array."))}for(var ee=0;ee<H.length;ee++){var K=D(H,ee,F,L,I+"["+ee+"]",n);if(K instanceof Error)return K}return null}return y(z)}function E(){function D(z,J,B,F,L){var I=z[J];if(!o(I)){var H=Q(I);return new h("Invalid "+F+" `"+L+"` of type "+("`"+H+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return y(D)}function w(){function D(z,J,B,F,L){var I=z[J];if(!e.isValidElementType(I)){var H=Q(I);return new h("Invalid "+F+" `"+L+"` of type "+("`"+H+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return y(D)}function A(D){function z(J,B,F,L,I){if(!(J[B]instanceof D)){var H=D.name||m,te=ne(J[B]);return new h("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+F+"`, expected ")+("instance of `"+H+"`."))}return null}return y(z)}function P(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,B,F,L,I){for(var H=J[B],te=0;te<D.length;te++)if(g(H,D[te]))return null;var ee=JSON.stringify(D,function(ue,G){var ge=Z(G);return ge==="symbol"?String(G):G});return new h("Invalid "+L+" `"+I+"` of value `"+String(H)+"` "+("supplied to `"+F+"`, expected one of "+ee+"."))}return y(z)}function U(D){function z(J,B,F,L,I){if(typeof D!="function")return new h("Property `"+I+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var H=J[B],te=Q(H);if(te!=="object")return new h("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+F+"`, expected an object."));for(var ee in H)if(r(H,ee)){var K=D(H,ee,F,L,I+"."+ee,n);if(K instanceof Error)return K}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 "+oe(J)+" at index "+z+"."),s}function B(F,L,I,H,te){for(var ee=[],K=0;K<D.length;K++){var ue=D[K],G=ue(F,L,I,H,te,n);if(G==null)return null;G.data&&r(G.data,"expectedType")&&ee.push(G.data.expectedType)}var ge=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new h("Invalid "+H+" `"+te+"` supplied to "+("`"+I+"`"+ge+"."))}return y(B)}function j(){function D(z,J,B,F,L){return N(z[J])?null:new h("Invalid "+F+" `"+L+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return y(D)}function R(D,z,J,B,F){return new h((D||"React class")+": "+z+" type `"+J+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function _(D){function z(J,B,F,L,I){var H=J[B],te=Q(H);if(te!=="object")return new h("Invalid "+L+" `"+I+"` of type `"+te+"` "+("supplied to `"+F+"`, expected `object`."));for(var ee in D){var K=D[ee];if(typeof K!="function")return R(F,L,I,ee,Z(K));var ue=K(H,ee,F,L,I+"."+ee,n);if(ue)return ue}return null}return y(z)}function T(D){function z(J,B,F,L,I){var H=J[B],te=Q(H);if(te!=="object")return new h("Invalid "+L+" `"+I+"` of type `"+te+"` "+("supplied to `"+F+"`, expected `object`."));var ee=t({},J[B],D);for(var K in ee){var ue=D[K];if(r(D,K)&&typeof ue!="function")return R(F,L,I,K,Z(ue));if(!ue)return new h("Invalid "+L+" `"+I+"` key `"+K+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(J[B],null," ")+`
|
|
150
|
+
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var G=ue(H,K,F,L,I+"."+K,n);if(G)return G}return null}return y(z)}function N(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(N);if(D===null||o(D))return!0;var z=f(D);if(z){var J=z.call(D),B;if(z!==D.entries){for(;!(B=J.next()).done;)if(!N(B.value))return!1}else for(;!(B=J.next()).done;){var F=B.value;if(F&&!N(F[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 Q(D){var z=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":M(z,D)?"symbol":z}function Z(D){if(typeof D>"u"||D===null)return""+D;var z=Q(D);if(z==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return z}function oe(D){var z=Z(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 DC(){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,f){if(f!==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 CC=nf(),xC=!0;xs.exports=yC()(CC.isElement,xC)}else xs.exports=DC()();var wC=xs.exports;/*!
|
|
155
151
|
* tabbable 6.2.0
|
|
156
152
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
157
|
-
*/var
|
|
153
|
+
*/var af=["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])"],xa=af.join(","),sf=typeof Element>"u",vn=sf?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,wa=!sf&&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},Ea=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},EC=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},of=function(t,n,r){if(Ea(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(xa));return n&&vn.call(t,xa)&&a.unshift(t),a=a.filter(r),a},uf=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Ea(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,xa);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!Ea(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(f&&m){var p=e(f===!0?s.children:f.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},lf=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)||EC(t))&&!lf(t)?0:t.tabIndex},_C=function(t,n){var r=Zt(t);return r<0&&n&&!lf(t)?0:r},BC=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},cf=function(t){return t.tagName==="INPUT"},kC=function(t){return cf(t)&&t.type==="hidden"},AC=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},FC=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},TC=function(t){if(!t.name)return!0;var n=t.form||wa(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=FC(a,t.form);return!i||i===t},SC=function(t){return cf(t)&&t.type==="radio"},jC=function(t){return SC(t)&&!TC(t)},OC=function(t){var n,r=t&&wa(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,f;r=wa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(a))}}return i},$l=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},PC=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=wa(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(OC(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return $l(t);return!1},NC=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},_a=function(t,n){return!(n.disabled||Ea(n)||kC(n)||PC(n,t)||AC(n)||NC(n))},ws=function(t,n){return!(jC(n)||Zt(n)<0||!_a(t,n))},RC=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},MC=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=_C(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(BC).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},df=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uf([t],n.includeContainer,{filter:ws.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:RC}):r=of(t,n.includeContainer,ws.bind(null,n)),MC(r)},ff=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uf([t],n.includeContainer,{filter:_a.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=of(t,n.includeContainer,_a.bind(null,n)),r},on=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return vn.call(t,xa)===!1?!1:ws(n,t)},IC=af.concat("iframe").join(","),ca=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return vn.call(t,IC)===!1?!1:_a(n,t)};const $C=Object.freeze(Object.defineProperty({__proto__:null,focusable:ff,getTabIndex:Zt,isFocusable:ca,isTabbable:on,tabbable:df},Symbol.toStringTag,{value:"Module"}));/*!
|
|
158
154
|
* focus-trap 7.5.4
|
|
159
155
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
160
|
-
*/function Il(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 $l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(n),!0).forEach(function(r){WC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function WC(e,t,n){return t=UC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HC(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 UC(e){var t=HC(e,"string");return typeof t=="symbol"?t:String(t)}var Ll={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()}},VC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},KC=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},br=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},ZC=function(t){return br(t)&&!t.shiftKey},YC=function(t){return br(t)&&t.shiftKey},zl=function(t){return setTimeout(t,0)},ql=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},ir=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},GC=[],QC=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||GC,i=$l({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:ZC,isKeyBackward:YC},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,T,R){return w&&w[T]!==void 0?w[T]:i[R||T]},u=function(w,T){var R=typeof(T==null?void 0:T.composedPath)=="function"?T.composedPath():void 0;return s.containerGroups.findIndex(function(M){var K=M.container,V=M.tabbableNodes;return K.contains(w)||(R==null?void 0:R.includes(K))||V.find(function(ie){return ie===w})})},c=function(w){var T=i[w];if(typeof T=="function"){for(var R=arguments.length,M=new Array(R>1?R-1:0),K=1;K<R;K++)M[K-1]=arguments[K];T=T.apply(void 0,M)}if(T===!0&&(T=void 0),!T){if(T===void 0||T===!1)return T;throw new Error("`".concat(w,"` 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(w,"` as selector refers to no known node"));return V},f=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 T=s.tabbableGroups[0],R=T&&T.firstTabbableNode;w=R||c("fallbackFocus")}if(!w)throw new Error("Your focus-trap needs to have at least one focusable element");return w},p=function(){if(s.containerGroups=s.containers.map(function(w){var T=uf(w,i.tabbableOptions),R=lf(w,i.tabbableOptions),M=T.length>0?T[0]:void 0,K=T.length>0?T[T.length-1]:void 0,V=R.find(function(D){return ln(D)}),ie=R.slice().reverse().find(function(D){return ln(D)}),Q=!!T.find(function(D){return Zt(D)>0});return{container:w,tabbableNodes:T,focusableNodes:R,posTabIndexesFound:Q,firstTabbableNode:M,lastTabbableNode:K,firstDomTabbableNode:V,lastDomTabbableNode:ie,nextTabbableNode:function(U){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=T.indexOf(U);return _<0?X?R.slice(R.indexOf(U)+1).find(function(F){return ln(F)}):R.slice(0,R.indexOf(U)).reverse().find(function(F){return ln(F)}):T[_+(X?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.")},h=function O(w){var T=w.activeElement;if(T)return T.shadowRoot&&T.shadowRoot.activeElement!==null?O(T.shadowRoot):T},g=function O(w){if(w!==!1&&w!==h(document)){if(!w||!w.focus){O(f());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,VC(w)&&w.select()}},m=function(w){var T=c("setReturnFocus",w);return T||(T===!1?!1:w)},b=function(w){var T=w.target,R=w.event,M=w.isBackward,K=M===void 0?!1:M;T=T||Yr(R),p();var V=null;if(s.tabbableGroups.length>0){var ie=u(T,R),Q=ie>=0?s.containerGroups[ie]:void 0;if(ie<0)K?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(K){var D=ql(s.tabbableGroups,function($){var q=$.firstTabbableNode;return T===q});if(D<0&&(Q.container===T||da(T,i.tabbableOptions)&&!ln(T,i.tabbableOptions)&&!Q.nextTabbableNode(T,!1))&&(D=ie),D>=0){var U=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[U];V=Zt(T)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else br(R)||(V=Q.nextTabbableNode(T,!1))}else{var _=ql(s.tabbableGroups,function($){var q=$.lastTabbableNode;return T===q});if(_<0&&(Q.container===T||da(T,i.tabbableOptions)&&!ln(T,i.tabbableOptions)&&!Q.nextTabbableNode(T))&&(_=ie),_>=0){var F=_===s.tabbableGroups.length-1?0:_+1,L=s.tabbableGroups[F];V=Zt(T)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else br(R)||(V=Q.nextTabbableNode(T))}}else V=c("fallbackFocus");return V},v=function(w){var T=Yr(w);if(!(u(T,w)>=0)){if(ir(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ir(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var T=Yr(w),R=u(T,w)>=0;if(R||T instanceof Document)R&&(s.mostRecentlyFocusedNode=T);else{w.stopImmediatePropagation();var M,K=!0;if(s.mostRecentlyFocusedNode)if(Zt(s.mostRecentlyFocusedNode)>0){var V=u(s.mostRecentlyFocusedNode),ie=s.containerGroups[V].tabbableNodes;if(ie.length>0){var Q=ie.findIndex(function(D){return D===s.mostRecentlyFocusedNode});Q>=0&&(i.isKeyForward(s.recentNavEvent)?Q+1<ie.length&&(M=ie[Q+1],K=!1):Q-1>=0&&(M=ie[Q-1],K=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(U){return Zt(U)>0})})||(K=!1);else K=!1;K&&(M=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},A=function(w){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var R=b({event:w,isBackward:T});R&&(br(w)&&w.preventDefault(),g(R))},k=function(w){if(KC(w)&&ir(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&A(w,i.isKeyBackward(w))},E=function(w){var T=Yr(w);u(T,w)>=0||ir(i.clickOutsideDeactivates,w)||ir(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},B=function(){if(s.active)return Ll.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?zl(function(){g(f())}):g(f()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},P=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",k,!0),o},z=function(w){var T=w.some(function(R){var M=Array.from(R.removedNodes);return M.some(function(K){return K===s.mostRecentlyFocusedNode})});T&&g(f())},I=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,N=function(){I&&(I.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){I.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 T=l(w,"onActivate"),R=l(w,"onPostActivate"),M=l(w,"checkCanFocusTrap");M||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,T==null||T();var K=function(){M&&p(),B(),N(),R==null||R()};return M?(M(s.containers.concat()).then(K,K),this):(K(),this)},deactivate:function(w){if(!s.active)return this;var T=$l({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,P(),s.active=!1,s.paused=!1,N(),Ll.deactivateTrap(a,o);var R=l(T,"onDeactivate"),M=l(T,"onPostDeactivate"),K=l(T,"checkCanReturnFocus"),V=l(T,"returnFocus","returnFocusOnDeactivate");R==null||R();var ie=function(){zl(function(){V&&g(m(s.nodeFocusedBeforeActivation)),M==null||M()})};return V&&K?(K(m(s.nodeFocusedBeforeActivation)).then(ie,ie),this):(ie(),this)},pause:function(w){if(s.paused||!s.active)return this;var T=l(w,"onPause"),R=l(w,"onPostPause");return s.paused=!0,T==null||T(),P(),N(),R==null||R(),this},unpause:function(w){if(!s.paused||!s.active)return this;var T=l(w,"onUnpause"),R=l(w,"onPostUnpause");return s.paused=!1,T==null||T(),p(),B(),N(),R==null||R(),this},updateContainerElements:function(w){var T=[].concat(w).filter(Boolean);return s.containers=T.map(function(R){return typeof R=="string"?r.querySelector(R):R}),s.active&&p(),N(),this}},o.updateContainerElements(t),o};const JC=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:QC},Symbol.toStringTag,{value:"Module"})),XC=tc(JC),ex=tc(qC);function Vn(e){"@babel/helpers - typeof";return Vn=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},Vn(e)}function tx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wl(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,cf(r.key),r)}}function nx(e,t,n){return t&&Wl(e.prototype,t),n&&Wl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function rx(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&&ws(e,t)}function ws(e,t){return ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},ws(e,t)}function ax(e){var t=sx();return function(){var r=ka(e),a;if(t){var i=ka(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return ix(this,a)}}function ix(e,t){if(t&&(Vn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dr(e)}function dr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sx(){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 ka(e){return ka=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ka(e)}function ox(e,t,n){return t=cf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cf(e){var t=ux(e,"string");return Vn(t)==="symbol"?t:String(t)}function ux(e,t){if(Vn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Vn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gr=C,he=BC,lx=XC,cx=lx.createFocusTrap,dx=ex,fx=dx.isFocusable,ro=function(e){rx(n,e);var t=ax(n);function n(r){var a;tx(this,n),a=t.call(this,r),ox(dr(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,f=new Array(c>1?c-1:0),p=1;p<c;p++)f[p-1]=arguments[p];u=u.apply(void 0,f)}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 h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(dr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(dr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(dr(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 nx(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&&!fx(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),sr=typeof Element>"u"?Function:Element;ro.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(sr),he.string,he.bool,he.func]),fallbackFocus:he.oneOfType([he.instanceOf(sr),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(sr),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(sr)),children:he.oneOfType([he.element,he.instanceOf(sr)])};ro.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:cx};var hx=ro;const mx=tn(hx),df=({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(Zf.ReactQueryDevtools,{initialIsOpen:!1})]})};var px=C.createContext({client:na});function gx(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(px.Provider,{value:{client:i}},t)}const ff=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(gx,{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}),hf=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...fh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},ao=C.createContext({}),fa={en:"English",es:"Español",fr:"Français",pt:"Português"},Pt=C.createContext({isLoading:!0});function Ha(){return C.useContext(Pt)}const mf=({children:e,user:t})=>d.jsx(Pt.Provider,{value:t,children:e}),io=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),pf=()=>C.useContext(io),gf=({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(io.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},vx=({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}),pc(5e3)}).catch(c=>{c.message===fc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(ao.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(hf,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(_s.CookiesProvider,{children:d.jsx(mf,{user:a,children:d.jsx(gf,{children:d.jsx(df,{showDevTools:r,children:d.jsx(ff,{user:a,children:t})})})})})})})};const so=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Y("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:f="Modal"})=>{const p=oe.useIntl(),{registerOverlay:h,unregisterOverlay:g}=pf(),[m,b]=C.useState(t),v=k=>{k.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",v),()=>{window.removeEventListener("keyup",v)}));const x=k=>{b(k),k?(a(),h(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{m&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Y("overlay",{open:m}),role:"dialog",children:d.jsx(so,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!m,style:A,children:t&&d.jsx(mx,{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(we,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(Jt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(Jt,{}),d.jsx(Dn,{buttons:u})]}),s&&d.jsx(Dr,{className:"error",children:s})]})})})})},vf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const bx=({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:Y("invite-modal",e,{success:!!n}),children:d.jsx(Qd,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const yx=({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(rn,{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(qn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Dx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Qt,{className:"testimonial",children:n}),r?d.jsx(Fr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Y("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Y("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Cx=C.memo(Dx);const xx=({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(jt,{variant:"subtle",className:Y("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 f=c/60,p=Math.floor(f),h=(f-p)*60,g=Math.round(h),m=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:m}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};let or=!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),f=l||c,[p,h]=C.useState(t?"open":"hidden"),{extraPadding:g=!0,hasPointer:m=!1,hasForm:b=!1}=e,{onOpen:v=()=>{},onClose:x=()=>{}}=s;C.useEffect(()=>{const B=f==null?void 0:f.current;if(B)return B.addEventListener("transitionend",A),B.addEventListener("keydown",k),()=>{B.removeEventListener("transitionend",A),B.removeEventListener("keydown",k)}},[]);const A=({propertyName:B})=>{B==="opacity"&&(or!==!1&&clearTimeout(or),h(P=>(P==="open"?v():P==="closed"&&x(),P==="opening"?"open":P==="closing"?"closed":P==="closed"?"hidden":P)))},k=B=>{B.key==="Escape"&&(B.stopPropagation(),B.preventDefault(),h("closing"))};zn(()=>{or!==!1&&clearTimeout(or);let B="open";t?h("opening"):(h("closing"),B="hidden"),or=setTimeout(()=>{h(B)},300)},[t]);const E={...o};return i&&i.onBlur&&(E.onBlur=i.onBlur),d.jsx("aside",{ref:f,className:Y("tooltip text-medium",p,a,{loading:n,"extra-padding":g,"has-pointer":m,bottom:m==="bottom","has-form":b}),hidden:p==="hidden",...E,children:n?d.jsx("p",{children:u.formatMessage({id:"tooltip_loading"})}):typeof r=="string"?d.jsx("p",{children:r}):r})});const wx=({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(Gn,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const on=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Y("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Ex=({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(on,{className:Y("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(Dn,{buttons:r})]})})};function bf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const _x=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=oe.useIntl();return d.jsxs("div",{className:Y("edit-section-placeholder",{"has-icon":!!e}),style:hc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(we,{href:r,variant:"secondary",size:"small",onClick:()=>bf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},Bx=({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,f=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(Sr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:Y("edit-section-modal"),children:d.jsx(Qn,{...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 p=>{var h,g;(h=n==null?void 0:n.functions)!=null&&h.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:f}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(we,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>bf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(_x,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Jt,{})]})};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:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:Y("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Y({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:f,link:p=!1,description:h=!1},g)=>{if(!c||!c.url)return null;const m=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:f});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:p?d.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:m}):m}),h&&d.jsx("small",{children:h})]},window.btoa(`${c.url}_${g}`))})})]})};const Ax=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Fx=({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,m;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},p={};c.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:x}=t[b];if(x&&Ax.includes(x.toLowerCase()))return;p[b]={text:v,element:f[b]};return}p[b]={text:t[b],element:f[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(on,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:x=""}=p[b];return b==="text"?d.jsx(qn,{overrideType:"text-only",className:"text",children:v},b):C.createElement(x,{key:b,className:b},v)}return null}),l,h&&d.jsx(we,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Y({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(m=o.props)==null?void 0:m.className}),children:o.text})]}),n&&d.jsx(Gn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Tx=C.memo(Fx);const Sx=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(on,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const jx=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(qn,{children:n}):n;return d.jsxs(on,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(Gn,{image:r})}),d.jsx("div",{className:Y("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Y("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},Ox=C.memo(jx);const Px=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Y("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(we,{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})]}),Nx=({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 f=a&&Yi(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:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):ks(c)});if(o)return d.jsx(Mn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&Yi(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:f?n.formatMessage({id:`dates_${f.path}`},{number:f.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"}},Rx=({data:e,cta:t,link:n,gtmContext:r})=>{var m,b;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:f}=e,p=e.contentType;let h="";if((m=Aa[p])!=null&&m.gtmEvent&&(h=Aa[p].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":`${h}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?d.jsx(we,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&c!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),x=async A=>{if(A.preventDefault(),A.stopPropagation(),!(v||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return d.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(we,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${f}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const Mx={title:66,text:3e3,secondaryText:1e3,partner:25},oo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var P,z,I;const o=oe.useIntl(),l=C.useContext(Pt),u=l&&typeof l.id=="string",[c,f]=C.useState({data:null,isLoading:!0}),{data:p,isLoading:h}=c,g=C.useCallback(()=>{n(t,u).then(N=>{f(()=>({data:N,isLoading:!1}))}).catch(()=>f(N=>({...N,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),h||!p)return d.jsx(xt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:m}=p;if(!m||!Aa[m])return d.jsx(xt,{element:"li",className:"card-wrapper"});const{basePath:b="",className:v,length:x,gtmEvent:A}=Aa[m];let k=p.slug?`${b}${p.slug}`:!1;p.slug&&(p.slug.slice(0,4)==="http"||p.slug.slice(0,2)==="//"||p.slug.slice(0,6)==="mailto"||p.slug.slice(0,3)==="tel")&&(k=p.slug);const E={...Mx,...x};let B={className:"card"};return k&&(B={href:k,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},p.openInNewTab&&(B.target="_blank")),d.jsx("li",{className:Y("card-wrapper text-medium",v,i,{"has-link":k,"no-link":!k,"has-image":p.banner}),"data-testid":`${m}-card`,children:C.createElement(k?"a":"div",B,d.jsxs(d.Fragment,{children:[d.jsx(gc,{className:"card-label",contentType:m,customIcon:p.customIcon,customLabel:p.customLabel}),p.startDate&&!p.isOngoingEvent&&d.jsx(Mn,{size:"small",variant:p.dateHasPassed?"default":"information","data-testid":"date",children:p.dateHasPassed?o.formatMessage({id:"card_ended"}):mc(p.startDate)}),p.banner?d.jsxs("p",{className:"img",children:[p.registered&&d.jsx(Mn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Gn,{image:p.banner})]}):v==="people"?d.jsx(rn,{name:p.title||"",src:p.profile,"data-testid":"people-profile-picture"}):null,p.contributors&&d.jsx(Ss,{contributors:{data:p.contributors},styling:{size:"small",showGap:v!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(m)?o.formatMessage({id:`card_contributors_${m}`}):void 0,"data-testid":"contributors"}),p.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:p.partner.length>1?o.formatMessage({id:"card_partner"},{partner:p.partner[0],number:p.partner.length-1}):Ln(p.partner[0],E.partner)}),["title","text","secondaryText"].map(N=>{const O=p[N];if(!O)return null;const w=lc(N);return d.jsx("p",{className:w,"data-testid":w,children:Ln(O,E[N])},N)}),(l==null?void 0:l.id)&&(p==null?void 0:p.members)&&d.jsxs("span",{className:"member-information",children:[((P=p==null?void 0:p.members)==null?void 0:P.isMember)&&d.jsx(Mn,{size:"small",variant:"registered",icon:((z=p==null?void 0:p.members)==null?void 0:z.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(I=p==null?void 0:p.members)==null?void 0:I.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:p==null?void 0:p.members.count})})]}),d.jsx(Nx,{type:v||"",data:p}),d.jsx(Rx,{data:p,cta:r,link:k||"",gtmContext:a})]}))})};const yf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Y("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(oo,{id:s,card:{...a,contentType:t[i]},...r},s)})}),Ix=(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},$x=({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:Y("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 Lx=({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:f,isLoading:p}=u,[h,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:m,loadedPages:b}=h,v=t.length,x=Math.ceil(v/f),A=C.useRef(null),k=Zn(!0,!0,A==null?void 0:A.current);C.useEffect(()=>{let N=1;k&&(k>=Pi.fourCards?N=4:k>=Pi.threeCards?N=3:k>=Pi.twoCards&&(N=2),N>v&&(N=v)),c(O=>({...O,cardsPerPage:N,isLoading:!1}))},[k,v]);const E=(N="next")=>{let O=m;if(typeof N=="string")if(N==="next")if(m<x-1)O=m+1;else return;else if(m>0)O=m-1;else return;else O=N;g(w=>({...w,currentPage:O,loadedPages:[...new Set([...b,O])]}))},B=N=>{Qr=N.touches[0].clientX},P=N=>{if(Qr===null)return;const O=N.touches[0].clientX,w=Qr-O;w>5?E("next"):w<-5&&E("previous"),Qr=null},z={"--width":`${k||0}px`,"--total-cards":v,"--cards-per-page":f,"--page":m};if(p)return d.jsx(Fs,{layout:`carousel${a?"-with-title":""}`});const I=(N,O)=>{var T;let w=null;return(T=N==null?void 0:N.sys)!=null&&T.id?w=`card-${N.sys.id}`:N!=null&&N.slug?w=`card-${N.slug}`:[n[O],N.contentType].includes("customCard")&&(w=`card-${window.btoa(`${N.title} ${N.createdAt}`)}-${O}`),w};return d.jsxs("section",{ref:A,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx($x,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:B,onTouchMove:P,style:z,"data-testid":"carousel-list",children:t.map((N,O)=>{let w=I(N,O);return w&&Ix(O,f,m,b)?d.jsx(oo,{id:w,card:{...N,contentType:n[O]},buildCardData:r,gtmContext:s,...o},w):(w=w||`${e}-card-${O}`,d.jsx(xt,{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(we,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:N=>{N.preventDefault(),N.stopPropagation(),E("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:m<=0})}),[...Array(x)].map((N,O)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:O===m}),onClick:w=>{w.preventDefault(),w.stopPropagation(),E(O)},children:d.jsx(Le,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:O+1,total:x})})})},`page-indicator-${O}`)),d.jsx("li",{className:"arrow next",children:d.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:N=>{N.preventDefault(),N.stopPropagation(),E("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:m>=x-1})})]})]})},zx=({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}`,f=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Fs,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(Jt,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(Lx,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(Jt,{})]},`carousel-${c}`)});const Ni="joinCommunityButton",uo=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const a=oe.useIntl(),i=C.useContext(Pt),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 f={},p={};return o&&u!=="leaving"&&(f["data-hover-text"]=a.formatMessage({id:`${Ni}_leave`}),f["aria-label"]=a.formatMessage({id:`${Ni}_member_aria`}),p["aria-hidden"]="true"),d.jsx(we,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&u!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async h=>{s&&(h.currentTarget.blur(),o?(c("leaving"),typeof r=="function"&&await r()):(c("joining"),typeof n=="function"&&await n()),l(!o))},className:Y("join-community-button",u,{active:u==="joining"}),disabled:!s,...f,children:d.jsx("span",{className:"text",...p,children:a.formatMessage({id:`${Ni}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Ri="communityDetails_",qx=({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({}),f=`/communities/${n}/members`===window.location.pathname;return d.jsxs("div",{className:Y("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})]}),!f&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${n}/members`,children:o.formatMessage({id:`${Ri}viewAll`})})})]}),d.jsx(Ss,{contributors:{total:r,data:c},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:l})]}),d.jsx(uo,{isMember:t,functions:{...s}}),t&&d.jsx(we,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${Ri}invite`})})]})};const Wx=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Le,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Y("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(Le,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(Cn,{href:s?void 0:i,...l,children:Ln(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Hx=({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,f)=>{let p=[];o.includes(c)?p=o.filter(h=>h!==c):c==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),c]:p=[c],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),f&&typeof f=="function"&&f()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:f,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),d.jsx("li",{children:d.jsx("button",{className:Y(c,{selected:o.includes(c)}),onClick:m=>{m.preventDefault(),m.stopPropagation(),u(c,h)},...g,children:f})},c)})})},Ux=(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_",Vx=({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(ao),[f,p]=C.useState(e);if(C.useEffect(()=>{e!==f&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),m=f!==e;return d.jsxs("div",{className:Y("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(b=>{var A;if(!fa[b])return null;const v=(A=r[b])==null?void 0:A.post_name;let x={className:b};if(f===b)x["aria-label"]=u.formatMessage({id:`${Jr}selected`},{language:fa[b]});else{const k=Ux(b,v,i);x={...x,href:typeof k=="string"?k:k.url,onClick:E=>{p(b),c(b),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(b,typeof k=="string"?k:k.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Cn,{...x,fallbackElement:"span",children:fa[b]})},b)})}),s!=="short"&&!m&&d.jsx("p",{children:u.formatMessage({id:`${Jr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!m&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Jr}disclaimer`},{email:Tn.support,link:b=>{const v=`mailto:${b}`;return d.jsx("a",{href:v,children:b})}})})]})};const Mi=oe.createIntl({locale:"en",messages:Yn}),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,f]=C.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?f(g.message):f("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Y("load-more",l),children:!c&&e?d.jsx(we,{variant:r,size:a,styling:i,icon:s,onClick:p,"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 lo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Y("logo",e,t,n),...r,children:d.jsx(Le,{children:d.jsx(oe.FormattedMessage,{id:"apolitical"})})})});let Xr=!1;const Df=({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:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(we,{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:f,icon:p,...h},g)=>{const m={...h,onClick:b=>{o(!1),typeof c=="function"&&c(b)},onFocus:()=>{Xr&&(clearTimeout(Xr),Xr=!1)},onBlur:()=>{Xr=setTimeout(()=>{o(!1)},100)}};return u&&(m.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(we,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...m,children:f})},`${window.btoa(f)}_${g}`)})})]})})},Kx=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Zx=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Cf=({activeLink:e})=>{const t=oe.useIntl(),n=C.useContext(Pt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Zx.map(({key:a,href:i})=>{const s=Kx(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Y(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(rn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},ur=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Yx=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${ur(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(`${ur(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(`${ur(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
156
|
+
*/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){LC(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 LC(e,t,n){return t=qC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zC(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 qC(e){var t=zC(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()}},WC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},HC=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},UC=function(t){return vr(t)&&!t.shiftKey},VC=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},Zr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},KC=[],ZC=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||KC,i=zl({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:UC,isKeyBackward:VC},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(_,T,N){return _&&_[T]!==void 0?_[T]:i[N||T]},u=function(_,T){var N=typeof(T==null?void 0:T.composedPath)=="function"?T.composedPath():void 0;return s.containerGroups.findIndex(function(M){var Q=M.container,Z=M.tabbableNodes;return Q.contains(_)||(N==null?void 0:N.includes(Q))||Z.find(function(oe){return oe===_})})},c=function(_){var T=i[_];if(typeof T=="function"){for(var N=arguments.length,M=new Array(N>1?N-1:0),Q=1;Q<N;Q++)M[Q-1]=arguments[Q];T=T.apply(void 0,M)}if(T===!0&&(T=void 0),!T){if(T===void 0||T===!1)return T;throw new Error("`".concat(_,"` was specified but was not a node, or did not return a node"))}var Z=T;if(typeof T=="string"&&(Z=r.querySelector(T),!Z))throw new Error("`".concat(_,"` as selector refers to no known node"));return Z},f=function(){var _=c("initialFocus");if(_===!1)return!1;if(_===void 0||!ca(_,i.tabbableOptions))if(u(r.activeElement)>=0)_=r.activeElement;else{var T=s.tabbableGroups[0],N=T&&T.firstTabbableNode;_=N||c("fallbackFocus")}if(!_)throw new Error("Your focus-trap needs to have at least one focusable element");return _},m=function(){if(s.containerGroups=s.containers.map(function(_){var T=df(_,i.tabbableOptions),N=ff(_,i.tabbableOptions),M=T.length>0?T[0]:void 0,Q=T.length>0?T[T.length-1]:void 0,Z=N.find(function(D){return on(D)}),oe=N.slice().reverse().find(function(D){return on(D)}),ne=!!T.find(function(D){return Zt(D)>0});return{container:_,tabbableNodes:T,focusableNodes:N,posTabIndexesFound:ne,firstTabbableNode:M,lastTabbableNode:Q,firstDomTabbableNode:Z,lastDomTabbableNode:oe,nextTabbableNode:function(z){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=T.indexOf(z);return B<0?J?N.slice(N.indexOf(z)+1).find(function(F){return on(F)}):N.slice(0,N.indexOf(z)).reverse().find(function(F){return on(F)}):T[B+(J?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(_){return _.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(_){return _.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 R(_){var T=_.activeElement;if(T)return T.shadowRoot&&T.shadowRoot.activeElement!==null?R(T.shadowRoot):T},g=function R(_){if(_!==!1&&_!==p(document)){if(!_||!_.focus){R(f());return}_.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=_,WC(_)&&_.select()}},h=function(_){var T=c("setReturnFocus",_);return T||(T===!1?!1:_)},y=function(_){var T=_.target,N=_.event,M=_.isBackward,Q=M===void 0?!1:M;T=T||Zr(N),m();var Z=null;if(s.tabbableGroups.length>0){var oe=u(T,N),ne=oe>=0?s.containerGroups[oe]:void 0;if(oe<0)Q?Z=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:Z=s.tabbableGroups[0].firstTabbableNode;else if(Q){var D=Hl(s.tabbableGroups,function(I){var H=I.firstTabbableNode;return T===H});if(D<0&&(ne.container===T||ca(T,i.tabbableOptions)&&!on(T,i.tabbableOptions)&&!ne.nextTabbableNode(T,!1))&&(D=oe),D>=0){var z=D===0?s.tabbableGroups.length-1:D-1,J=s.tabbableGroups[z];Z=Zt(T)>=0?J.lastTabbableNode:J.lastDomTabbableNode}else vr(N)||(Z=ne.nextTabbableNode(T,!1))}else{var B=Hl(s.tabbableGroups,function(I){var H=I.lastTabbableNode;return T===H});if(B<0&&(ne.container===T||ca(T,i.tabbableOptions)&&!on(T,i.tabbableOptions)&&!ne.nextTabbableNode(T))&&(B=oe),B>=0){var F=B===s.tabbableGroups.length-1?0:B+1,L=s.tabbableGroups[F];Z=Zt(T)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else vr(N)||(Z=ne.nextTabbableNode(T))}}else Z=c("fallbackFocus");return Z},v=function(_){var T=Zr(_);if(!(u(T,_)>=0)){if(ar(i.clickOutsideDeactivates,_)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ar(i.allowOutsideClick,_)||_.preventDefault()}},x=function(_){var T=Zr(_),N=u(T,_)>=0;if(N||T instanceof Document)N&&(s.mostRecentlyFocusedNode=T);else{_.stopImmediatePropagation();var M,Q=!0;if(s.mostRecentlyFocusedNode)if(Zt(s.mostRecentlyFocusedNode)>0){var Z=u(s.mostRecentlyFocusedNode),oe=s.containerGroups[Z].tabbableNodes;if(oe.length>0){var ne=oe.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<oe.length&&(M=oe[ne+1],Q=!1):ne-1>=0&&(M=oe[ne-1],Q=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(z){return Zt(z)>0})})||(Q=!1);else Q=!1;Q&&(M=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},k=function(_){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=_;var N=y({event:_,isBackward:T});N&&(vr(_)&&_.preventDefault(),g(N))},E=function(_){if(HC(_)&&ar(i.escapeDeactivates,_)!==!1){_.preventDefault(),o.deactivate();return}(i.isKeyForward(_)||i.isKeyBackward(_))&&k(_,i.isKeyBackward(_))},w=function(_){var T=Zr(_);u(T,_)>=0||ar(i.clickOutsideDeactivates,_)||ar(i.allowOutsideClick,_)||(_.preventDefault(),_.stopImmediatePropagation())},A=function(){if(s.active)return ql.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Wl(function(){g(f())}):g(f()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",E,{capture:!0,passive:!1}),o},P=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",E,!0),o},U=function(_){var T=_.some(function(N){var M=Array.from(N.removedNodes);return M.some(function(Q){return Q===s.mostRecentlyFocusedNode})});T&&g(f())},$=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(U):void 0,j=function(){$&&($.disconnect(),s.active&&!s.paused&&s.containers.map(function(_){$.observe(_,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(_){if(s.active)return this;var T=l(_,"onActivate"),N=l(_,"onPostActivate"),M=l(_,"checkCanFocusTrap");M||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,T==null||T();var Q=function(){M&&m(),A(),j(),N==null||N()};return M?(M(s.containers.concat()).then(Q,Q),this):(Q(),this)},deactivate:function(_){if(!s.active)return this;var T=zl({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},_);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,P(),s.active=!1,s.paused=!1,j(),ql.deactivateTrap(a,o);var N=l(T,"onDeactivate"),M=l(T,"onPostDeactivate"),Q=l(T,"checkCanReturnFocus"),Z=l(T,"returnFocus","returnFocusOnDeactivate");N==null||N();var oe=function(){Wl(function(){Z&&g(h(s.nodeFocusedBeforeActivation)),M==null||M()})};return Z&&Q?(Q(h(s.nodeFocusedBeforeActivation)).then(oe,oe),this):(oe(),this)},pause:function(_){if(s.paused||!s.active)return this;var T=l(_,"onPause"),N=l(_,"onPostPause");return s.paused=!0,T==null||T(),P(),j(),N==null||N(),this},unpause:function(_){if(!s.paused||!s.active)return this;var T=l(_,"onUnpause"),N=l(_,"onPostUnpause");return s.paused=!1,T==null||T(),m(),A(),j(),N==null||N(),this},updateContainerElements:function(_){var T=[].concat(_).filter(Boolean);return s.containers=T.map(function(N){return typeof N=="string"?r.querySelector(N):N}),s.active&&m(),j(),this}},o.updateContainerElements(t),o};const YC=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:ZC},Symbol.toStringTag,{value:"Module"})),GC=ac(YC),QC=ac($C);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 JC(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,hf(r.key),r)}}function XC(e,t,n){return t&&Ul(e.prototype,t),n&&Ul(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ex(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 tx(e){var t=rx();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 nx(this,a)}}function nx(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 rx(){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 ax(e,t,n){return t=hf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hf(e){var t=ix(e,"string");return Un(t)==="symbol"?t:String(t)}function ix(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 Yr=C,he=wC,sx=GC,ox=sx.createFocusTrap,ux=QC,lx=ux.isFocusable,ao=function(e){ex(n,e);var t=tx(n);function n(r){var a;JC(this,n),a=t.call(this,r),ax(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,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];u=u.apply(void 0,f)}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 XC(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&&!lx(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?Yr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Yr.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=Yr.cloneElement(i,{ref:s});return o}return null}}]),n}(Yr.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:ox};var cx=ao;const dx=bn(cx),mf=({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(Qf.ReactQueryDevtools,{initialIsOpen:!1})]})};var fx=C.createContext({client:ta});function hx(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&&(ta.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ta.init(r,a)),ta)},[n,r]);return C.createElement(fx.Provider,{value:{client:i}},t)}const pf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(hx,{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}),gf=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...mh[r],...n||{}};return d.jsx(se.IntlProvider,{locale:r,messages:a,children:e})},io=C.createContext({}),da={en:"English",es:"Español",fr:"Français",pt:"Português"},Ot=C.createContext({isLoading:!0});function Ha(){return C.useContext(Ot)}const vf=({children:e,user:t})=>d.jsx(Ot.Provider,{value:t,children:e}),so=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),bf=()=>C.useContext(so),yf=({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})},mx=({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}),vc(5e3)}).catch(c=>{c.message===mc&&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(gf,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Bs.CookiesProvider,{children:d.jsx(vf,{user:a,children:d.jsx(yf,{children:d.jsx(mf,{showDevTools:r,children:d.jsx(pf,{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 Tr=({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:f="Modal"})=>{const m=se.useIntl(),{registerOverlay:p,unregisterOverlay:g}=bf(),[h,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),()=>{h&&g(e)}),[t]);const k=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:V("overlay",{open:h}),role:"dialog",children:d.jsx(oo,{id:e,className:V("overlay-modal",c,{"has-max-width":r}),hidden:!h,style:k,children:t&&d.jsx(dx,{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":f,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})]})})})})},Df=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const px=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=se.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(Tr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:d.jsx(ef,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const gx=({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(Tr,{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 vx=({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(Ar,{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})})]})]}),bx=C.memo(vx);const yx=({items:e=[],selector:t="",className:n=""})=>{const r=se.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=se.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const f=c/60,m=Math.floor(f),p=(f-m)*60,g=Math.round(p),h=`${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:h}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}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=se.useIntl(),c=C.useRef(null),f=l||c,[m,p]=C.useState(t?"open":"hidden"),{extraPadding:g=!0,hasPointer:h=!1,hasForm:y=!1}=e,{onOpen:v=()=>{},onClose:x=()=>{}}=s;C.useEffect(()=>{const A=f==null?void 0:f.current;if(A)return A.addEventListener("transitionend",k),A.addEventListener("keydown",E),()=>{A.removeEventListener("transitionend",k),A.removeEventListener("keydown",E)}},[]);const k=({propertyName:A})=>{A==="opacity"&&(sr!==!1&&clearTimeout(sr),p(P=>(P==="open"?v():P==="closed"&&x(),P==="opening"?"open":P==="closing"?"closed":P==="closed"?"hidden":P)))},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 w={...o};return i&&i.onBlur&&(w.onBlur=i.onBlur),d.jsx("aside",{ref:f,className:V("tooltip text-medium",m,a,{loading:n,"extra-padding":g,"has-pointer":h,bottom:h==="bottom","has-form":y}),...w,children:d.jsx("div",{hidden:m==="hidden",children:n?d.jsx("p",{children:u.formatMessage({id:"tooltip_loading"})}):typeof r=="string"?d.jsx("p",{children:r}):r})})});const Dx=({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 Cx=({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 Cf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const xx=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return d.jsxs("div",{className:V("edit-section-placeholder",{"has-icon":!!e}),style:pc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(xe,{href:r,variant:"secondary",size:"small",onClick:()=>Cf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},wx=({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,f=()=>u(!1);return d.jsxs("section",{className:V("edit-section",t),children:[n&&d.jsx(Tr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},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:f}})}),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:()=>Cf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(xx,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Qt,{})]})};const Ex=({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:f,link:m=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const h=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:f});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:h}):h}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const _x=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Bx=({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,h;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],f={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&&_x.includes(x.toLowerCase()))return;m[y]={text:v,element:f[y]};return}m[y]={text:t[y],element:f[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]:(h=o.props)==null?void 0:h.className}),children:o.text})]}),n&&d.jsx(Yn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},kx=C.memo(Bx);const Ax=({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 Fx=({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})})})]})},Tx=C.memo(Fx);const Sx=({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})]}),jx=({type:e,data:t})=>{const n=se.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const f=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:f?n.formatMessage({id:`dates_${f.path}`},{number:f.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 f=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:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},ka={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"}},Ox=({data:e,cta:t,link:n,gtmContext:r})=>{var h,y;const a=se.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:f}=e,m=e.contentType;let p="";if((h=ka[m])!=null&&h.gtmEvent&&(p=ka[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 k=>{if(k.preventDefault(),k.stopPropagation(),!(v||!t||!t.onClick)){s(E=>({...E,loading:!0}));try{const E=await t.onClick(e);s(E==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,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}: ${f}`,"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 Px={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 P,U,$;const o=se.useIntl(),l=C.useContext(Ot),u=l&&typeof l.id=="string",[c,f]=C.useState({data:null,isLoading:!0}),{data:m,isLoading:p}=c,g=C.useCallback(()=>{n(t,u).then(j=>{f(()=>({data:j,isLoading:!1}))}).catch(()=>f(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:h}=m;if(!h||!ka[h])return d.jsx(Ct,{element:"li",className:"card-wrapper"});const{basePath:y="",className:v,length:x,gtmEvent:k}=ka[h];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 w={...Px,...x};let A={className:"card"};return E&&(A={href:E,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-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":`${h}-card`,children:C.createElement(E?"a":"div",A,d.jsxs(d.Fragment,{children:[d.jsx(bc,{className:"card-label",contentType:h,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"}):gc(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(h)?o.formatMessage({id:`card_contributors_${h}`}):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],w.partner)}),["title","text","secondaryText"].map(j=>{const R=m[j];if(!R)return null;const _=dc(j);return d.jsx(Lt,{className:_,options:{wrapper:"p",forceWrapper:!0,forceInline:!0},"data-testid":_,children:$n(R,w[j])},j)}),(l==null?void 0:l.id)&&(m==null?void 0:m.members)&&d.jsxs("span",{className:"member-information",children:[((P=m==null?void 0:m.members)==null?void 0:P.isMember)&&d.jsx(Rn,{size:"small",variant:"registered",icon:((U=m==null?void 0:m.members)==null?void 0:U.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(jx,{type:v||"",data:m}),d.jsx(Ox,{data:m,cta:r,link:E||"",gtmContext:a})]}))})};const xf=({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)})}),Nx=(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},Rx=({id:e,title:t})=>{const n=se.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 Gr=null;const Mx=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=se.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:m}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:h,loadedPages:y}=p,v=t.length,x=Math.ceil(v/f),k=C.useRef(null),E=Kn(!0,!0,k==null?void 0:k.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(R=>({...R,cardsPerPage:j,isLoading:!1}))},[E,v]);const w=(j="next")=>{let R=h;if(typeof j=="string")if(j==="next")if(h<x-1)R=h+1;else return;else if(h>0)R=h-1;else return;else R=j;g(_=>({..._,currentPage:R,loadedPages:[...new Set([...y,R])]}))},A=j=>{Gr=j.touches[0].clientX},P=j=>{if(Gr===null)return;const R=j.touches[0].clientX,_=Gr-R;_>5?w("next"):_<-5&&w("previous"),Gr=null},U={"--width":`${E||0}px`,"--total-cards":v,"--cards-per-page":f,"--page":h};if(m)return d.jsx(Ts,{layout:`carousel${a?"-with-title":""}`});const $=(j,R)=>{var T;let _=null;return(T=j==null?void 0:j.sys)!=null&&T.id?_=`card-${j.sys.id}`:j!=null&&j.slug?_=`card-${j.slug}`:[n[R],j.contentType].includes("customCard")&&(_=`card-${window.btoa(`${j.title} ${j.createdAt}`)}-${R}`),_};return d.jsxs("section",{ref:k,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(Rx,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:A,onTouchMove:P,style:U,"data-testid":"carousel-list",children:t.map((j,R)=>{let _=$(j,R);return _&&Nx(R,f,h,y)?d.jsx(uo,{id:_,card:{...j,contentType:n[R]},buildCardData:r,gtmContext:s,...o},_):(_=_||`${e}-card-${R}`,d.jsx(Ct,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},_))})}),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(),w("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(x)].map((j,R)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:V("page-indicator",{selected:R===h}),onClick:_=>{_.preventDefault(),_.stopPropagation(),w(R)},children:d.jsx(Le,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:R+1,total:x})})})},`page-indicator-${R}`)),d.jsx("li",{className:"arrow next",children:d.jsx(xe,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:j=>{j.preventDefault(),j.stopPropagation(),w("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:h>=x-1})})]})]})},Ix=({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}`,f=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ts,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(Qt,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(Mx,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?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=se.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 f={},m={};return o&&u!=="leaving"&&(f["data-hover-text"]=a.formatMessage({id:`${Ni}_leave`}),f["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,...f,children:d.jsx("span",{className:"text",...m,children:a.formatMessage({id:`${Ni}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Ri="communityDetails_",$x=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:a=[]}={number:0,data:[]},functions:{invite:i,...s}})=>{const o=se.useIntl(),l=5,u=r||a.length,c=a.length?a:Array(l).fill({}),f=`/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})]}),!f&&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 Lx=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=se.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Le,{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(Le,{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 zx=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=se.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,f)=>{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)),f&&typeof f=="function"&&f()};return d.jsx("ul",{className:V("filters",a),children:s.map(({id:c,text:f,disabled:m=!1,callback:p=()=>{}})=>{let g={};return m&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),d.jsx("li",{children:d.jsx("button",{className:V(c,{selected:o.includes(c)}),onClick:h=>{h.preventDefault(),h.stopPropagation(),u(c,p)},...g,children:f})},c)})})},qx=(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 Qr="languageSwitcher_",Wx=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=se.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(io),[f,m]=C.useState(e);if(C.useEffect(()=>{e!==f&&m(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),h=f!==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:`${Qr}label`})}),d.jsx("ul",{children:g.map(y=>{var k;if(!da[y])return null;const v=(k=r[y])==null?void 0:k.post_name;let x={className:y};if(f===y)x["aria-label"]=u.formatMessage({id:`${Qr}selected`},{language:da[y]});else{const E=qx(y,v,i);x={...x,href:typeof E=="string"?E:E.url,onClick:w=>{m(y),c(y),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(y,typeof E=="string"?E:E.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Dn,{...x,fallbackElement:"span",children:da[y]})},y)})}),s!=="short"&&!h&&d.jsx("p",{children:u.formatMessage({id:`${Qr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Qr}disclaimer`},{email:Fn.support,link:y=>{const v=`mailto:${y}`;return d.jsx("a",{href:v,children:y})}})})]})};const Mi=se.createIntl({locale:"en",messages:Zn}),Sr=({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,f]=C.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?f(g.message):f("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(Le,{children:d.jsx(se.FormattedMessage,{id:"apolitical"})})})});let Jr=!1;const wf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=se.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:f,icon:m,...p},g)=>{const h={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{Jr&&(clearTimeout(Jr),Jr=!1)},onBlur:()=>{Jr=setTimeout(()=>{o(!1)},100)}};return u&&(h.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,...h,children:f})},`${window.btoa(f)}_${g}`)})})]})})},Hx=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Ux=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Ef=({activeLink:e})=>{const t=se.useIntl(),n=C.useContext(Ot),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Ux.map(({key:a,href:i})=>{const s=Hx(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}`:""}`,Vx=({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}
|
|
161
157
|
|
|
162
|
-
${ur(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ur(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Gx="shareLinks_",Qx=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=Yx({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Y("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:f,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=m=>h(m,f)),d.jsx("li",{children:d.jsx(we,{size:a,variant:"tertiary",icon:{icon:c||u},href:f,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:`${Gx}link_${u}`}),...g})},u)})})]})};const Jx=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,f,p)=>(c||(c=`panel-${window.btoa(f)}-${p}`),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(p=>p.id===c)){for(let p=0;p<e.length;p++)if(r(e[p].id,e[p].text,p)===c){a=p;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:f,content:p,href:h,hasCarousel:g},m)=>{c=r(c,f,m);const b=i===c,v={};h||(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:!b,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":b?"assertive":"off",children:typeof p=="string"?d.jsx("p",{children:p}):p},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:h||`#${c}`,id:`tab-${c}`,className:Y({selected:b}),role:"tab","aria-selected":b,...v,children:f})},`tab-${c}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Xx={"2-1":901,"1-3":769,"1-1":769},xf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Zn(!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:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Xx[e]?null:o)})};let Ii;const $i="contactFooter_",ew=({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(on,{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(Cn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${$i}email`})})]}),d.jsx(Gd,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},tw=({activeLink:e,...t})=>d.jsx(on,{children:d.jsx(xf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Cf,{activeLink:e}),d.jsx(Dc,{...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),wf=()=>{const e=oe.useIntl(),[t,n,r]=_s.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(Dn,{buttons:u})]})},$t={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"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Tn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Tn["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:Tn.support,gtmType:"concierge-email-click"},business:{email:Tn.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 Rn="footer_",Fa="SiteFooter",Hl=({group:e})=>{const t=$t[e].order||[];let n=!1;return"text"in $t[e]&&(n=$t[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(oe.FormattedMessage,{id:`${Rn}${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}=$t[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:`${Rn}${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:`${Rn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}${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)},co=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Pa,{element:"hr"}),d.jsx(lo,{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(Hl,{group:e}),Object.keys($t[e]).includes("child")&&d.jsx(Hl,{group:$t[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray($t.social.order)&&$t.social.order.map(e=>{const t=$t.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:`${Rn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(oe.FormattedMessage,{id:`${Rn}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=ec(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)}}},Ar={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=ec(Ar,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 f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const A=x.split("."),k=A[A.length-2];x=`${k==="topics"?`${k}-`:""}${A[A.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,m=p&&window.location.pathname===o.href;let b={},v={};if(m&&(b={...b,"aria-current":"page"}),h){const x=o.menuId||e,A={onClick:k=>je.events.onClick(k,{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&&(b={...A,onKeyPress:k=>{k.key==="Enter"&&je.events.onClick(k,{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,...A})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":h,parent:g,active:m}),...b,children:[p?C.createElement(c?we:"a",p,s.formatMessage({id:f})):s.formatMessage({id:f}),o.order&&d.jsx("ul",{...v,children:o.order.map(x=>{if(!o[x])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[x].order?d.jsxs("li",{className:Y({[o[x].className]:o[x].className}),children:[s.formatMessage({id:`${f}_${x}`}),d.jsx("ul",{children:o[x].order.map(k=>d.jsx(Ta,{id:`${e}.${x}.${k}`,...A},k))})]},x):d.jsx(Ta,{id:`${e}.${x}`,...A},x)})})]},e)};const nw={height:67,height_desktop:83},fo=({showNavigation:e=!0})=>{const t=oe.useIntl(),n=C.useContext(Pt),r=Zn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>je.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Bs,{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,f=C.useRef(s);C.useEffect(()=>{f.current=s},[s]),ic({scrollPosition:nw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const m=f.current.menus;!i&&m.navigation||je.shouldChangeHeaderIsVisible(!0,m,o)},scrollDown:()=>{const m=f.current.menus;!i&&m.navigation||je.shouldChangeHeaderIsVisible(!1,m,o)}}});const p=(m,b,v=!1)=>{je.handleMenus({id:m,value:b,menus:f.current.menus,dispatch:o,forceHandle:v})},h=C.useRef(null),g=m=>{m.key==="Escape"&&["navigation","search","account"].forEach(b=>{f.current.menus[b]&&p(b,!1,!0)})};return C.useEffect(()=>{var m;return(m=document.getElementById("header"))==null||m.addEventListener("keydown",g),()=>{var b;(b=document.getElementById("header"))==null||b.removeEventListener("keydown",g)}},[]),zn(()=>{u.navigation&&je.autoFocus({menu:"navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),zn(()=>{u.account&&je.autoFocus({menu:"account",navigationRef:h,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Le,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(lo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:m=>{m.preventDefault(),m.stopPropagation(),p("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(Le,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Ar.order.map(m=>d.jsx(Ta,{id:m,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:p},m))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:m=>{m.preventDefault(),m.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Le,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(Jd,{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:m=>je.events.onClick(m,{id:"account",callback:p,isOpen:u.account}),onMouseEnter:()=>je.events.onMouseEnter({id:"account",callback:p}),onMouseLeave:()=>je.events.onBlur({id:"account",callback:p}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Le,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(rn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Ar.buttons.order.map(m=>d.jsx(Ta,{id:`buttons.${m}`},m))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const rw=()=>{const e=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(fo,{}),d.jsx("div",{id:"content",children:d.jsx(nn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(co,{})]})},Ef=({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:f="default",circle:p="default",modal:h="default"}=i,g=rc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const m=ra(e,{locale:o}),b=ra(t,{locale:o}),v=ra(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),p!=="default"&&(x[p]=!0),d.jsx(Qf.ErrorBoundary,{onError:r,fallback:d.jsx(rw,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:Y(s,x,{"has-footer":u}),children:[d.jsx(fo,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[b&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":h==="large"}),children:b}),C.createElement(c==="bold"?so:"div",{id:"content",children:m,className:Y({"large-modal":h==="large"})})]}),v&&d.jsx("div",{className:"additional-content appended",children:v}),u&&d.jsx(co,{}),d.jsx(wf,{})]})})})},Ul={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"},aw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Wi.topic[e.replace("topic_","")],e){const t=Ar.topics.topics[e].href;return t?{id:e,href:t,text:`${Ul.headerTopics}${e}`}:null}return null}return Wi[e]?(e=Wi[e],{id:e,text:`${Ul.default}${e}`}):null}};const iw=({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=aw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Y("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 sw=({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:Y("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(Mn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(jr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const ow=({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:Y("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:f=>d.jsx("strong",{children:f}),number:u})}),u<100&&a&&d.jsx(Ua,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(As,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const _f=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Bf=({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}`}):dc(a||"");return d.jsxs("small",{className:Y("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Y("type",n),children:o})," ",t>0&&!r&&d.jsx(Ua,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const uw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const f=oe.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return d.jsxs(Ra,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[f.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${p}time_completed`}):d.jsx(Ua,{time:s,appendedText:a?f.formatMessage({id:`${p}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:m,contentType:b,icon:v,image:x,isIntroduction:A,optional:k,slug:E,subsectionId:B,title:P,type:z})=>{const I=a&&t||A,N={};return x&&(N.style={"--image":`url(${x})`}),d.jsx("li",{className:Y({article:b===lr.ARTICLE,discussion:b===lr.DISCUSSION,quiz:b===lr.QUIZ,completed:g&&b===lr.ARTICLE,locked:!I}),...N,children:d.jsx(Cn,{href:I?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${cc(P)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(_f,{sectionId:i,subsectionId:B,title:P,className:"course-title"})," ",d.jsx(Bf,{completionTime:m,icon:v,optional:k,type:z,children:c&&c[E]&&d.jsx("span",{className:"quiz-score",children:`${c[E]}%`})})]})})},E)})})]})};const lw=({isComplete:e=!1,onClick:t,...n})=>{const r=oe.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(we,{...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:Y("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=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},editorRef:r,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 I,N,O;const u=oe.useIntl(),c=C.useContext(Pt),[f,p]=C.useState(n.isEditing&&n.isEditing.text||""),[h,g]=C.useState(s.error||!1),[m,b]=C.useState(!1),v=C.useRef(null);if(r||(r=v),n.isLoading)return d.jsx(xt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const x=w=>{p(w);let T;!c||!c.id?T=At(u.formatMessage,`${st}error_loggedOut`,e.type,"action"):t?w.length>=i&&(T=`${st}error_tooLong`):T=At(u.formatMessage,`${st}error_noPermission`,e.type,"action"),T?g(T):h&&g(!1)};let A=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const w=((I=e.slugs)==null?void 0:I.reply)||((N=e.slugs)==null?void 0:N.answer)||((O=e.slugs)==null?void 0:O.question)||"";w&&(A=`${A}-${w.slice(-15)}`)}const k=async w=>{var R;if(w.preventDefault(),w.stopPropagation(),!c||!c.id||!t||B)return;ea&&clearTimeout(ea),b("submitting");const T=window.location.pathname;try{let M;switch(e.type){case"post":M=await o.create({content:f});break;case"question":M=await o.create({title:f,authorId:c&&c.id,...(R=o.props)==null?void 0:R.create});break;case"response":M=await o.create({questionSlug:e.slugs.question},{body:f,authorId:c&&c.id,contentPath:T});break;case"reply":M=await o.create({questionSlug:e.slugs.question,answerSlug:e.slugs.answer},{body:f,authorId:c&&c.id,contentPath:T});break;default:break}await uh(1e3),o.callback&&await o.callback(M),ea=setTimeout(()=>{p(""),b("submitted");const K=new Event("discussionFormSubmitted");document.dispatchEvent(K),E()},500)}catch(M){const K=M;let V=`${st}error`;K!=null&&K.message.includes("entry already exists")&&(V=At(u.formatMessage,`${st}error_alreadyExists`,e.type,"action")),K!=null&&K.message.includes("429")?V=At(u.formatMessage,`${st}error_tooMany`,e.type,"action"):K!=null&&K.message.includes("400")&&(V=`${st}error`),g(V),E()}},E=()=>{ea=setTimeout(()=>{g(!1),b(!1)},5e3)},B=!f||!mh(f),P=m==="submitting",z=[];return(n.isEditing&&!P||s.cancel)&&z.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!s.cancel&&(!c||!c.id||!f),children:u.formatMessage({id:`${st}cancel`})}),z.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:w=>{if(n.isEditing){b("submitting");const T=r!=null&&r.current&&(r!=null&&r.current)?r==null?void 0:r.current:"";o.handleSaveEdit&&o.handleSaveEdit(T);return}k(w)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!t||B||P||n.isEditing&&f===n.isEditing.text,children:u.formatMessage({id:`${st}${P?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),d.jsxs("form",{id:A,className:Y("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&d.jsx("h2",{children:At(u.formatMessage,`${st}title`,e.type,"action")}),d.jsx(Fr,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx(Le,{element:"label",showOnFocus:!1,htmlFor:`${A}-input`,children:At(u.formatMessage,`${st}label`,e.type,"action")}),d.jsx(Yd,{ref:r,id:`${A}-input`,value:m==="submitting"&&!h?"":f,placeholder:a||At(u.formatMessage,`${st}placeholder`,e.type,"action"),onChange:x,autoFocus:!!n.isEditing,"aria-invalid":!!h,"aria-errormessage":"error-message"}),d.jsx("small",{children:At(u.formatMessage,`${st}explainer`,e.type,"action",{a:w=>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:w})})}),d.jsx(Dn,{buttons:z}),m==="submitted"&&n.showSuccessMessage&&d.jsx(Dr,{className:"success","data-testid":"success",children:At(u.formatMessage,`${st}success`,e.type,"action")}),h&&d.jsx(Dr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof h=="string"?h.includes(" ")?h:u.formatMessage({id:h},{action:u.formatMessage({id:`discussion_action_${e.type}`}),maxLength:i}):h})]})},ho=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(nn,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(uo,{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})},cw={showForm:!1},Za=C.createContext(cw),kf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Za.Provider,{value:{...t,updateConversation:n},children:e})},dw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),fw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Es=({icon:e,...t})=>d.jsx(we,{className:"discussion-button",variant:"tertiary",icon:e,...t});let yr=!1;const Hi=()=>{yr!==!1&&(clearTimeout(yr),yr=!1)},Ui=5,Af=({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.useEffect(()=>{h(a)},[a]);const[c,f]=C.useState(t),[p,h]=C.useState(a),[g,m]=C.useState(!1),[b,v]=C.useState(!1),x=C.useMemo(()=>fw(n,Ui),[n]),A=E=>{if(E.preventDefault(),E.stopPropagation(),v(!1),yr)return Hi(),!1;if(Hi(),g||!s)return!1;yr=setTimeout(k,350)},k=async()=>{if(Hi(),g||!s)return!1;let E=p?c-1:c+1;E<0&&(E=0),m(!0),f(E),h(!p);try{if(i&&i.slugs){const B=dw(i.slugs);p?await l(B):await o({...B,payload:{contentPath:window.location.pathname}})}}catch{f(t),h(a)}finally{m(!1)}};return d.jsxs("div",{className:"likes-wrapper",onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onFocus:()=>{v(!0)},onBlur:()=>{v(!1)},children:[d.jsx(Es,{className:Y("discussion-button text-medium action-button",{"show-spinner":g,"is-liked":p,disabled:!s}),icon:{icon:p?"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:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${p?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":p,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:c})})}),n&&d.jsx(Va,{isOpen:b,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map(E=>typeof E=="string"||!E.name?null:d.jsx("li",{children:d.jsx(Cn,{href:E.id?`/profiles/${E.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:B=>B==null?void 0:B.stopPropagation(),children:E.name})},E.id||window.btoa(E.name))),t>Ui&&d.jsx("li",{children:u.formatMessage({id:"discussion_likes_more"},{number:t-Ui})})]})})]})},Vl=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 It="discussion_",hw=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:f}={openComments:()=>{}}},links:p={},className:h,gtmContext:g="DiscussionAnswer",children:m,isTruncated:b=!1})=>{const v=oe.useIntl(),x=C.useContext(Pt),A=C.useContext(Za),{author:k,canLike:E,createdAt:B,id:P,likes:z=0,userLiked:I,comments:N=0}=t,O=x&&x.id&&typeof k!="string"&&k.id&&k.id===x.id||!1,w=typeof E=="boolean"?E:n?!O:!1,T=O&&(!t.createdAt||oh(t.createdAt,10,"seconds")),R=C.useRef(null),[M,K]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[V,ie]=C.useState(!1),[Q,D]=C.useState(T?"highlighted":"default"),[U,X]=C.useState("");C.useEffect(()=>{const Z=R.current;if(!(!Z||Q==="default"))return document.addEventListener("discussionFormSubmitted",_),Z.addEventListener("transitionend",F),()=>{document.removeEventListener("discussionFormSubmitted",_),Z.removeEventListener("transitionend",F)}},[]),C.useEffect(()=>{K({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const _=()=>{setTimeout(()=>{D("fading")},1e3)},F=({propertyName:Z})=>{Z==="background-color"&&D(le=>(le==="default"&&(document.removeEventListener("discussionFormSubmitted",_),R.current&&R.current.removeEventListener("transitionend",F)),le==="fading"?"default":le))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return d.jsx(xt,{className:"discussion-card discussion-post"});const L=b?Ln(M.body,hw):M.body,$=async Z=>{Z||(Z=""),X("");try{if(!Jf(Z,M.body)){const le=t.type==="question"?{title:Z}:{body:Z};await l(Vl(t.slugs),le)}K({body:Z,isEditing:!1,didEdit:!0})}catch{X(`${It}form_error`)}},q=()=>{A&&A.updateConversation&&A.updateConversation({showForm:!0}),setTimeout(()=>{var pe,_e,Se;const le=`reply-form-${(t.type==="answer"?t.slug:((pe=t.slugs)==null?void 0:pe.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((Se=t.slugs)==null?void 0:Se.question)||"").toLowerCase().slice(-15)}`,J=document.getElementById(le),be=document.getElementById(`${le}-input`);be&&be.focus(),J&&J.scrollIntoView({behavior:"smooth"})},0)},ne=async()=>{ie(!1);try{await o(Vl(t.slugs))}catch{X("delete-error")}},te=[{text:v.formatMessage({id:`${It}moreMenu_report`}),onClick:Z=>{Z.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${It}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${It}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&&O&&te.push({text:v.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>K({...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:`${It}moreMenu_delete`}),onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),ie(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...vf(`delete-${t.slug}-modal`,V)}),C.createElement(e,{className:Y("discussion-post",h,{[Q]:!h||!h.includes("highlighted-text-box"),"has-link":p.post&&!M.isEditing}),ref:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Z=>{!p.post||M.isEditing||(Z.preventDefault(),Z.stopPropagation(),window.location.href=p.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:P||t.slug,className:Y("discussion-card",t.type,{editing:M.isEditing,"has-link":p.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(Fr,{member:k,additionalContent:{createdAt:B,didEdit:M.didEdit},className:typeof k!="string"&&k.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Ka,{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:U!==""&&U!=="delete-error"?v.formatMessage({id:U},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:$,handleCancel:()=>{X(""),K({...M,isEditing:!1})}},gtmContext:`${g}Form`}):p.post?d.jsxs("a",{href:p.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(yc,{text:t==null?void 0:t.body,markdownOptions:{overrides:{a:Ji}}}):d.jsx(qn,{options:{overrides:{a:Ji}},children:L})]}):d.jsx(qn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:L}),!M.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Af,{element:"li",likes:z,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs},canLike:w,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||p.comments||typeof f=="function")&&d.jsx(Es,{onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),p.comments&&(window.location.href=p.comments),typeof f=="function"&&f()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${It}comments_screenReader`},{count:N}),children:v.formatMessage({id:`${It}comments`},{count:N})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Es,{styling:{muted:!0},onClick:q,children:v.formatMessage({id:`${It}reply`})})}),d.jsx(Df,{element:"li",id:`more-${t.slug}`,options:te})]})]}),m,d.jsx(Sr,{id:`delete-${t.slug}-modal`,isOpen:V,functions:{onOpen:()=>{},onClose:()=>ie(!1)},forceShow:{error:U==="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:()=>ie(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ne,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 Vi="discussion_responses_",Ff=({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:`${Vi}title`},{action:n.formatMessage({id:`${Vi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:At(n.formatMessage,`${Vi}empty`,e,e)})]})};const Tf=({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:Y("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})]})},mw="post",pw="reply",Sf="00000000-0000-0000-0000-000000000000";function mo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function po({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 gw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function jf(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 bw({content:e}){return{content:e,id:Sf,time:new Date().toISOString(),verb:mw}}function Kl({activity:e,user:t}){return{...e,actor:jf(t),...gw()}}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 Of({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 yw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Sf,kind:pw,parent:t||""}}function Zl({reply:e,user:t}){const n=jf(t);return{...e,user_id:n.id,user:n,...vw()}}function Yl({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 Dw({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 Pf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Gl,Ki=0;const Nf=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(Gl);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Ki=0;return}Ki++,!(Ki>10)&&(Gl=setTimeout(()=>{e(t)},50))}},Kn=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}),en=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}),Rf=Object.freeze({actor:`SU:${Kn.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"}),Cw=Object.freeze({actor:`SU:${en.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"}),xw=Object.freeze({actor:`SU:${Kn.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"}),ww=Object.freeze({actor:`SU:${en.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:Rf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:en.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:en.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:en.id,user:{id:en.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Rf.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:Kn.id,user:{id:Kn.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 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:en.id,user:{id:en.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 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:Kn.id,user:{id:Kn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ww.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Ew({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=Kl({activity:bw(o),user:i});return Ql(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Kl({activity:o,user:i});r.setQueryData(a,Ql(c,u,!0)),setTimeout(()=>{Pf(c.id)},0)}});return s}function _w({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 Bw({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:mo(u),mutate:po(u)},user:l,...u},f=Ew({...c,mutationFn:e}),p=_w({...c,mutationFn:t}),h=kw({...c,mutationFn:n}),g=Fw({...c,mutationFn:a}),m=Tw({...c,mutationFn:i}),{activities:b,...v}=Aw({queryKey:s,queryFn:r});return{activities:b,mutations:{create:f,edit:p,remove:g,like:h,unlike:m},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 Aw({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:jw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Fw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Sw(a,i)),onError:n});return r}function Tw({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&&Of({activity:o,user:r}),s}),onError:n});return a}function Ql(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 Sw(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 jw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Ow=({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:f,mutations:{create:p,edit:h,remove:g,like:m,unlike:b},user:v}=Bw({queryKey:[e,t,"activities"],queryFns:r});return Nf(),l?d.jsx(nn,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(ho,{form:{content:{type:"post",slugs:{}},functions:{create:p},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,A)=>{var R,M,K,V,ie,Q,D,U;const{id:k,own_reactions:E,latest_reactions:B,reaction_counts:P}=x,z=(((R=B==null?void 0:B.like)==null?void 0:R.length)||0)>0,I=(((M=E==null?void 0:E.like)==null?void 0:M.length)||0)>0,N=I?E==null?void 0:E.like[0].id:"",O=z?(K=B==null?void 0:B.like)==null?void 0:K.map(X=>{var _,F,L;return{id:(_=X==null?void 0:X.user)==null?void 0:_.id,name:(L=(F=X==null?void 0:X.user)==null?void 0:F.data)==null?void 0:L.name}}):!1,w=x==null?void 0:x.actor,T=(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,T),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:k},slug:k,author:{id:w==null?void 0:w.id,name:(V=w==null?void 0:w.data)==null?void 0:V.name,organization:(ie=w==null?void 0:w.data)==null?void 0:ie.organization,jobTitle:(Q=w==null?void 0:w.data)==null?void 0:Q.jobTitle,location:(D=w==null?void 0:w.data)==null?void 0:D.location,image:{thumbnail:((U=w==null?void 0:w.data)==null?void 0:U.thumbnail)||void 0}},userLiked:I,likes:(P==null?void 0:P.like)||0,comments:(P==null?void 0:P.reply)||0,peopleWhoLiked:O},links:{post:`${e}/${t}/${k}`,comments:`${e}/${t}/${k}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:k}),updateContent:(X,{body:_})=>h({activityId:k,content:_})},likes:{createLike:()=>m({activityId:k}),deleteLike:()=>b({activityId:k,reactionId:N})},comments:{openComments:()=>null}},isTruncated:!0})},k)}),!f&&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"})}})]})},Pw={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 Nw({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=Zl({reply:yw(o),user:i});return Jl(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Zl({reply:o,user:i});r.setQueryData(a,Jl(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Pf(c.id)},0)}});return s}function Rw({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 Mf({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:mo(u),mutate:po(u)},user:l,...u},f=Nw({...c,mutationFn:e}),p=Rw({...c,mutationFn:t}),h=Mw({...c,mutationFn:n}),g=$w({...c,mutationFn:a}),m=Lw({...c,mutationFn:i}),{replies:b,...v}=Iw({queryKey:s,queryFn:r});return{replies:b,mutations:{create:f,edit:p,remove:g,like:h,unlike:m},user:l,...v}}function Mw({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&&Yl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Oa(o,l);u&&Yl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Iw({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=Uw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function $w({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Hw(a,i)),onError:n});return r}function Lw({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&&Dw({reply:o,user:r}),s}),onError:n});return a}function zw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function qw(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 Ww(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 Jl(e,t,n){return t?n!=null&&n.append?qw(e,t,n):Ww(e,t,n):zw(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 Hw(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 Uw(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 Vw=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const{replies:s,fetchNextPage:o,hasNextPage:l,isLoading:u,mutations:{create:c,edit:f,like:p,remove:h,unlike:g},user:m}=Mf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:b=>i.list({...b,reactionId:r})}});return d.jsx(Tf,{loadMore:{isLoading:u,hasNextPage:l,loadNextPage:()=>o()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(b,{body:v})=>c({activityId:n,replyId:r,content:v})},meta:{isEditing:!1,showSuccessMessage:!1}},children:s&&s.length>0?s==null?void 0:s.map(b=>{var M,K,V,ie,Q,D,U,X,_,F,L,$;const{id:v,own_children:x,latest_children:A,children_counts:k}=b,B=(((M=x==null?void 0:x.like)==null?void 0:M.length)||0)>0?(K=x==null?void 0:x.like)==null?void 0:K.find(q=>{var ne;return((ne=q==null?void 0:q.user)==null?void 0:ne.id)===(m==null?void 0:m.id)}):!1,P=B?B==null?void 0:B.id:"",z=!!B,N=(((V=A==null?void 0:A.like)==null?void 0:V.length)||0)>0?(ie=A==null?void 0:A.like)==null?void 0:ie.map(q=>{var ne,te,Z;return{id:(ne=q==null?void 0:q.user)==null?void 0:ne.id,name:(Z=(te=q==null?void 0:q.user)==null?void 0:te.data)==null?void 0:Z.name}}):!1,O=b==null?void 0:b.user,w=(O==null?void 0:O.id)===(m==null?void 0:m.id),T=Ya(a,w),R=typeof b.data.content=="string"?(Q=b==null?void 0:b.data)==null?void 0:Q.content:((U=(D=b==null?void 0:b.data)==null?void 0:D.content)==null?void 0:U.text)||"";return d.jsx(Or,{content:{id:v,type:"reply",body:R,canLike:T,createdAt:b==null?void 0:b.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:b==null?void 0:b.parent},slug:"",author:{id:O==null?void 0:O.id,name:(X=O.data)==null?void 0:X.name,organization:(_=O.data)==null?void 0:_.organization,jobTitle:(F=O.data)==null?void 0:F.jobTitle,location:(L=O.data)==null?void 0:L.location,image:{thumbnail:(($=O.data)==null?void 0:$.thumbnail)||void 0}},userLiked:z,likes:(k==null?void 0:k.like)||0,peopleWhoLiked:N},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:v}),updateContent:(q,{body:ne})=>f({replyId:v,content:ne})},likes:{createLike:()=>p({replyId:v}),deleteLike:()=>g({replyId:v,reactionId:P})},comments:{}}},v)}):null})};const If=({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:f,isLoading:p,mutations:{create:h,edit:g,like:m,remove:b,unlike:v},user:x}=Mf({queryKey:[e,t,n,"replies"],queryFns:a});return sc(),Nf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Ff,{type:"comment",responses:u}),d.jsx(ho,{form:{content:{type:"reply",slugs:{}},functions:{create:(A,{body:k})=>h({activityId:n,content:k})},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(A=>{var ie,Q,D,U,X,_,F,L,$,q,ne,te;const{id:k,own_children:E,latest_children:B,children_counts:P}=A,I=(((ie=E==null?void 0:E.like)==null?void 0:ie.length)||0)>0?(Q=E==null?void 0:E.like)==null?void 0:Q.find(Z=>{var le;return((le=Z==null?void 0:Z.user)==null?void 0:le.id)===(x==null?void 0:x.id)}):!1,N=I?I==null?void 0:I.id:"",O=!!I,T=(((D=B==null?void 0:B.like)==null?void 0:D.length)||0)>0?(U=B==null?void 0:B.like)==null?void 0:U.map(Z=>{var le,J,be;return{id:(le=Z==null?void 0:Z.user)==null?void 0:le.id,name:(be=(J=Z==null?void 0:Z.user)==null?void 0:J.data)==null?void 0:be.name}}):!1,R=A==null?void 0:A.user,M=(R==null?void 0:R.id)===(x==null?void 0:x.id),K=Ya(r,M),V=typeof A.data.content=="string"?(X=A==null?void 0:A.data)==null?void 0:X.content:((F=(_=A==null?void 0:A.data)==null?void 0:_.content)==null?void 0:F.text)||"";return d.jsx(kf,{children:d.jsx(Or,{content:{id:k,type:"reply",body:V,canLike:K,createdAt:A==null?void 0:A.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k},slug:k,author:{id:R==null?void 0:R.id,name:(L=R.data)==null?void 0:L.name,organization:($=R.data)==null?void 0:$.organization,jobTitle:(q=R.data)==null?void 0:q.jobTitle,location:(ne=R.data)==null?void 0:ne.location,image:{thumbnail:((te=R.data)==null?void 0:te.thumbnail)||void 0}},userLiked:O,likes:(P==null?void 0:P.like)||0,peopleWhoLiked:T},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:k}),updateContent:(Z,{body:le})=>g({replyId:k,content:le})},likes:{createLike:()=>m({replyId:k}),deleteLike:()=>v({replyId:k,reactionId:N})},comments:{}},children:d.jsx(Vw,{basePath:e,parentId:t,activityId:n,replyId:k,isMember:r,functions:{...a}})},k)},k)}),!p&&d.jsx(jr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Kw({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 Zw({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 Yw({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:mo(o),mutate:po(o)},user:s,...o},u=Kw({...l,mutationFn:t}),c=Gw({...l,mutationFn:n}),f=Qw({...l,mutationFn:r}),{activity:p,...h}=Zw({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:c,unlike:f},user:s,...h}}function Gw({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 Qw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Of({activity:s,user:r}),s)),onError:n});return a}const Jw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var I,N,O,w,T,R,M,K,V,ie;const u=oe.useIntl(),c=C.useContext(Pt),{activity:f,error:p,isLoading:h,mutations:{edit:g,like:m,unlike:b}}=Yw({queryFns:i,queryKey:[e,t,n]});if(h)return d.jsx(xt,{style:{height:"400px"}});if(p||!f)return d.jsx(nn,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:x}=f,A=(((I=x==null?void 0:x.like)==null?void 0:I.length)||0)>0,k=(((N=v==null?void 0:v.like)==null?void 0:N.length)||0)>0,E=k?v==null?void 0:v.like[0].id:"",B=A?(O=x==null?void 0:x.like)==null?void 0:O.map(Q=>{var D,U,X;return{id:(D=Q==null?void 0:Q.user)==null?void 0:D.id,name:(X=(U=Q==null?void 0:Q.user)==null?void 0:U.data)==null?void 0:X.name}}):!1,P=f==null?void 0:f.actor,z=(P==null?void 0:P.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:f==null?void 0:f.content,canLike:Ya(r,z),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:P.id,name:(w=P.data)==null?void 0:w.name,organization:(T=P.data)==null?void 0:T.organization,jobTitle:(R=P.data)==null?void 0:R.jobTitle,location:(M=P.data)==null?void 0:M.location,image:{thumbnail:((K=P.data)==null?void 0:K.thumbnail)||void 0}},userLiked:k,likes:((V=f==null?void 0:f.reaction_counts)==null?void 0:V.like)||0,comments:((ie=f==null?void 0:f.reaction_counts)==null?void 0:ie.reply)||0,peopleWhoLiked:B},originalAuthorId:P==null?void 0:P.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(Q,{body:D})=>g({content:D})},likes:{createLike:()=>m({activityId:n}),deleteLike:()=>b({activityId:n,reactionId:E})},comments:{openComments:()=>{}}}},n),d.jsx(If,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},Xw=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Xl=[{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_",eE=()=>{const e=oe.useIntl(),t=[];return Xl.forEach((n,r)=>{n.title=e.formatMessage({id:`${ta}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Ef,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(on,{children:[d.jsx(yf,{cards:Xl,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(we,{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=Ow;exports.ActivitySection=Jw;exports.AddPost=ho;exports.Banner=wx;exports.BannerSection=Tx;exports.Breadcrumbs=Wx;exports.Buckets=Dh;exports.Button=we;exports.ButtonWrapper=Dn;exports.COURSE_CONTENT_TYPES=lr;exports.CacheProvider=df;exports.Card=oo;exports.CardBlock=yf;exports.Carousel=zx;exports.CollapsibleSection=Ra;exports.Columns=xf;exports.CommunityDetails=qx;exports.ContactFooter=ew;exports.ContactForm=Gd;exports.ContentTypeLabel=gc;exports.Contributors=Ss;exports.ConversationContext=Za;exports.CookieBanner=wf;exports.CourseProgression=ow;exports.CourseStructure=uw;exports.CustomContentBanner=Sx;exports.Directory=yx;exports.DiscussionConversation=kf;exports.DiscussionForm=Ka;exports.DiscussionLikes=Af;exports.DiscussionPost=Or;exports.DiscussionThread=Tf;exports.Divider=Jt;exports.DownloadSection=Ex;exports.EMAILS=Tn;exports.EditSection=Bx;exports.EmailHelperTextBox=wc;exports.EmptyStateBox=nn;exports.Filters=Hx;exports.FlagsProvider=ff;exports.Footer=co;exports.Form=Qn;exports.FullWidthSection=on;exports.GlobalProviders=vx;exports.Header=fo;exports.HelperTextBox=bc;exports.HiddenFromScreenReaders=Pa;exports.HideShowTextBox=yc;exports.HighlightSection=Ox;exports.HighlightedTextBox=jt;exports.INVALID_TOKEN=fc;exports.IconBulletedList=wh;exports.ImageContainer=vh;exports.IntlProvider=hf;exports.InviteForm=Qd;exports.InviteModal=bx;exports.JoinButton=uo;exports.LanguageContext=ao;exports.LanguageSwitcher=Vx;exports.LessonName=_f;exports.LessonType=Bf;exports.Link=Cn;exports.LoadMore=jr;exports.LoadingBlock=Ph;exports.LoadingPlaceholder=xt;exports.LoadingState=Fs;exports.Logo=lo;exports.LogoSection=kx;exports.MarkCompleteButton=lw;exports.MarkdownText=qn;exports.MarketingBlock=Px;exports.Member=Fr;exports.MembersList=sw;exports.Modal=so;exports.MoreMenu=Df;exports.NUMBER_OF_COUNTRIES=sh;exports.NUMBER_OF_USERS=ih;exports.NavigationMenu=Cf;exports.NotFoundError=eE;exports.Overlay=Sr;exports.OverlayContext=io;exports.OverlayProvider=gf;exports.PageHeading=Dc;exports.PageLayout=Ef;exports.PasswordForm=dC;exports.PasswordRules=Ac;exports.Pill=Mn;exports.ProfileImageChange=cC;exports.ProfilePicture=rn;exports.ProgressBar=As;exports.ProgressTracker=bh;exports.Rating=Kh;exports.RepliesFeed=If;exports.ResponsesHeading=Ff;exports.ResponsiveImage=Gn;exports.ReturnToNavButton=yh;exports.RichTextEditor=Yd;exports.SearchForm=Jd;exports.ShareLinks=Qx;exports.SignupForm=vC;exports.Span=Ji;exports.StatusBanner=Dr;exports.TableOfContents=xx;exports.Tabs=Jx;exports.Tags=iw;exports.TestimonialBlock=Cx;exports.TimeToComplete=Ua;exports.Toggle=lC;exports.Tooltip=Va;exports.TopLevelPage=tw;exports.UserContext=Pt;exports.UserProvider=mf;exports.VisuallyHidden=Le;exports.addAriaProps=vf;exports.basicReducer=Bs;exports.camelCaseToDashCase=lc;exports.checkIntlPathExists=Na;exports.generateConditions=ca;exports.generateCssIcon=hc;exports.getLongDate=ks;exports.getMember=Ts;exports.getShortDate=mc;exports.headerData=Ar;exports.mapGetStreamData=Xw;exports.pageReady=pc;exports.passwordValidator=Gi;exports.repliesFeedMock=Pw;exports.supportedLanguages=fa;exports.toCamelCase=cc;exports.toSentenceCase=dc;exports.useCurrentPath=rc;exports.useEffectAfterMount=zn;exports.useElementWidth=Zn;exports.useOverlay=pf;exports.useScrollListener=ic;exports.useScrollToHash=sc;exports.useUser=Ha;
|
|
158
|
+
${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 Kx="shareLinks_",Zx=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=Vx({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:f,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=h=>p(h,f)),d.jsx("li",{children:d.jsx(xe,{size:a,variant:"tertiary",icon:{icon:c||u},href:f,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:`${Kx}link_${u}`}),...g})},u)})})]})};const Yx=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,f,m)=>(c||(c=`panel-${window.btoa(f)}-${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:f,content:m,href:p,hasCarousel:g},h)=>{c=r(c,f,h);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:f})},`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 Gx={"2-1":901,"1-3":769,"1-1":769},_f=({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<Gx[e]?null:o)})};let Ii;const $i="contactFooter_",Qx=({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(se.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(se.FormattedMessage,{id:`${$i}text`})}),d.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(se.FormattedMessage,{id:`${$i}email`})})]}),d.jsx(Xd,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Jx=({activeLink:e,...t})=>d.jsx(an,{children:d.jsx(_f,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Ef,{activeLink:e}),d.jsx(xc,{...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=se.useIntl(),[t,n,r]=Bs.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"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email: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_",Aa="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(se.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":Aa,"data-gtm-event-type":i,...s,children:d.jsx(se.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(se.FormattedMessage,{id:`${Nn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(se.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":Aa,"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(Oa,{element:"hr"}),d.jsx(co,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Aa,"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":Aa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(se.FormattedMessage,{id:`${Nn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(se.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=rc(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)}}},kr={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"}}}},Fa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=rc(kr,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 f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const k=x.split("."),E=k[k.length-2];x=`${E==="topics"?`${E}-`:""}${k[k.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,h=m&&window.location.pathname===o.href;let y={},v={};if(h&&(y={...y,"aria-current":"page"}),p){const x=o.menuId||e,k={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={...k,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,...k})}return d.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:g,active:h}),...y,children:[m?C.createElement(c?xe:"a",m,s.formatMessage({id:f})):s.formatMessage({id:f}),o.order&&d.jsx("ul",{...v,children:o.order.map(x=>{if(!o[x])return null;const k={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:`${f}_${x}`}),d.jsx("ul",{children:o[x].order.map(E=>d.jsx(Fa,{id:`${e}.${x}.${E}`,...k},E))})]},x):d.jsx(Fa,{id:`${e}.${x}`,...k},x)})})]},e)};const Xx={height:67,height_desktop:83},ho=({showNavigation:e=!0})=>{const t=se.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(Pa,{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,f=C.useRef(s);C.useEffect(()=>{f.current=s},[s]),uc({scrollPosition:Xx[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const h=f.current.menus;!i&&h.navigation||je.shouldChangeHeaderIsVisible(!0,h,o)},scrollDown:()=>{const h=f.current.menus;!i&&h.navigation||je.shouldChangeHeaderIsVisible(!1,h,o)}}});const m=(h,y,v=!1)=>{je.handleMenus({id:h,value:y,menus:f.current.menus,dispatch:o,forceHandle:v})},p=C.useRef(null),g=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(y=>{f.current.menus[y]&&m(y,!1,!0)})};return C.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.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(Le,{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:h=>{h.preventDefault(),h.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(Le,{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:kr.order.map(h=>d.jsx(Fa,{id:h,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:m},h))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Le,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(tf,{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:h=>je.events.onClick(h,{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(Le,{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:kr.buttons.order.map(h=>d.jsx(Fa,{id:`buttons.${h}`},h))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:V("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const ew=()=>{const e=se.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,{})]})},kf=({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:f="default",circle:m="default",modal:p="default"}=i,g=sc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const h=na(e,{locale:o}),y=na(t,{locale:o}),v=na(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),m!=="default"&&(x[m]=!0),d.jsx(Xf.ErrorBoundary,{onError:r,fallback:d.jsx(ew,{}),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:h,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"},tw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Wi.topic[e.replace("topic_","")],e){const t=kr.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 nw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=se.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=tw.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 rw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=se.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(Ar,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(Rn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Sr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const aw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=se.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:f=>d.jsx("strong",{children:f}),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 Af=({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 Ff=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=se.useIntl(),o=Na(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):hc(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 iw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const f=se.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:[f.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${m}time_completed`}):d.jsx(Ua,{time:s,appendedText:a?f.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:h,contentType:y,icon:v,image:x,isIntroduction:k,optional:E,slug:w,subsectionId:A,title:P,type:U})=>{const $=a&&t||k,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}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${fc(P)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Af,{sectionId:i,subsectionId:A,title:P,className:"course-title"})," ",d.jsx(Ff,{completionTime:h,icon:v,optional:E,type:U,children:c&&c[w]&&d.jsx("span",{className:"quiz-score",children:`${c[w]}%`})})]})})},w)})})]})};const sw=({isComplete:e=!1,onClick:t,...n})=>{const r=se.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 Xr=null;const st="discussion_form_",Ka=({content:e={type:"response",slugs:{}},userHasPermissions:t=!0,meta:n={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:r,maxLength:a=1e11,forceShow:i={cancel:!1,error:!1},functions:s={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:o="DiscussionForm"})=>{var P,U,$;const l=se.useIntl(),u=C.useContext(Ot),[c,f]=C.useState(n.isEditing&&n.isEditing.text||""),[m,p]=C.useState(i.error||!1),[g,h]=C.useState(!1);if(n.isLoading)return d.jsx(Ct,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const y=j=>{f(j);let R;!u||!u.id?R=kt(l.formatMessage,`${st}error_loggedOut`,e.type,"action"):t?j.length>=a&&(R=`${st}error_tooLong`):R=kt(l.formatMessage,`${st}error_noPermission`,e.type,"action"),R?p(R):m&&p(!1)};let v=`${e.type}-form`;if(e.type==="response"||e.type==="reply"){const j=((P=e.slugs)==null?void 0:P.reply)||((U=e.slugs)==null?void 0:U.answer)||(($=e.slugs)==null?void 0:$.question)||"";j&&(v=`${v}-${j.slice(-15)}`)}const x=async j=>{var _;if(j.preventDefault(),j.stopPropagation(),!u||!u.id||!t||E)return;Xr&&clearTimeout(Xr),h("submitting");const R=window.location.pathname;try{let T;switch(e.type){case"post":T=await s.create({content:c});break;case"question":T=await s.create({title:c,authorId:u&&u.id,...(_=s.props)==null?void 0:_.create});break;case"response":T=await s.create({questionSlug:e.slugs.question},{body:c,authorId:u&&u.id,contentPath:R});break;case"reply":T=await s.create({questionSlug:e.slugs.question,answerSlug:e.slugs.answer},{body:c,authorId:u&&u.id,contentPath:R});break;default:break}await ch(1e3),s.callback&&await s.callback(T),Xr=setTimeout(()=>{f(""),h("submitted");const N=new Event("discussionFormSubmitted");document.dispatchEvent(N),k()},500)}catch(T){const N=T;let M=`${st}error`;N!=null&&N.message.includes("entry already exists")&&(M=kt(l.formatMessage,`${st}error_alreadyExists`,e.type,"action")),N!=null&&N.message.includes("429")?M=kt(l.formatMessage,`${st}error_tooMany`,e.type,"action"):N!=null&&N.message.includes("400")&&(M=`${st}error`),p(M),k()}},k=()=>{Xr=setTimeout(()=>{p(!1),h(!1)},5e3)},E=!c||!gh(c),w=g==="submitting",A=[];return(n.isEditing&&!w||i.cancel)&&A.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:s.handleCancel,className:"gtm-trackable","data-gtm-event-context":o,"data-gtm-event-type":`cancel-${e.type}-click`,disabled:!i.cancel&&(!u||!u.id||!c),children:l.formatMessage({id:`${st}cancel`})}),A.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:j=>{if(n.isEditing){h("submitting"),s.handleSaveEdit&&s.handleSaveEdit(c);return}x(j)},className:"gtm-trackable","data-gtm-event-context":o,"data-gtm-event-type":`${n.isEditing?"save":"submit"}-${e.type}-click`,"data-testid":"save-button",disabled:!u||!u.id||!t||E||w||n.isEditing&&c===n.isEditing.text,children:l.formatMessage({id:`${st}${w?n.isEditing?"saving":"posting":n.isEditing?"save":"post"}`})}),d.jsxs("form",{id:v,className:V("discussion-card discussion-form",{"no-styling":n.isInWrapper&&n.isEditing}),"data-testid":`discussion-${e.type}-form`,children:[(n==null?void 0:n.showTitle)&&!n.isEditing&&["question"].includes(e.type)&&d.jsx("h2",{children:kt(l.formatMessage,`${st}title`,e.type,"action")}),d.jsx(Ar,{member:u||"community",gtmContext:o,gtmType:"profile-click"}),d.jsx(Le,{element:"label",showOnFocus:!1,htmlFor:`${v}-input`,children:kt(l.formatMessage,`${st}label`,e.type,"action")}),d.jsx(Jd,{id:`${v}-input`,value:g==="submitting"&&!m?"":c,placeholder:r||kt(l.formatMessage,`${st}placeholder`,e.type,"action"),onChange:y,autoFocus:!!n.isEditing,"aria-invalid":!!m,"aria-errormessage":"error-message"}),d.jsx("small",{children:kt(l.formatMessage,`${st}explainer`,e.type,"action",{a:j=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":o,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:j})})}),d.jsx(yn,{buttons:A}),g==="submitted"&&n.showSuccessMessage&&d.jsx(yr,{className:"success","data-testid":"success",children:kt(l.formatMessage,`${st}success`,e.type,"action")}),m&&d.jsx(yr,{id:"error-message",className:"error","data-testid":"error",children:i.error?i.error:typeof m=="string"?m.includes(" ")?m:l.formatMessage({id:m},{action:l.formatMessage({id:`discussion_action_${e.type}`}),maxLength:a}):m})]})},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})},ow={showForm:!1},Za=C.createContext(ow),Tf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Za.Provider,{value:{...t,updateConversation:n},children:e})},uw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),lw=(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 Sf=({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=se.useIntl();C.useEffect(()=>{p(a)},[a]);const[c,f]=C.useState(t),[m,p]=C.useState(a),[g,h]=C.useState(!1),[y,v]=C.useState(!1),x=C.useMemo(()=>lw(n,Ui),[n]),k=w=>{if(w.preventDefault(),w.stopPropagation(),v(!1),br)return Hi(),!1;if(Hi(),g||!s)return!1;br=setTimeout(E,350)},E=async()=>{if(Hi(),g||!s)return!1;let w=m?c-1:c+1;w<0&&(w=0),h(!0),f(w),p(!m);try{if(i&&i.slugs){const A=uw(i.slugs);m?await l(A):await o({...A,payload:{contentPath:window.location.pathname}})}}catch{f(t),p(a)}finally{h(!1)}};return C.createElement(e,{className:"likes-wrapper",onKeyDown:w=>{w.key==="Escape"&&v(!1)},onMouseEnter:()=>{v(!0)},onMouseLeave:()=>{v(!1)},onBlur:()=>{Vi=setTimeout(()=>{v(!1)},500)}},d.jsxs(d.Fragment,{children:[d.jsx(_s,{className:V("discussion-button text-medium action-button",{"show-spinner":g,"is-liked":m,disabled:!s}),icon:{icon:m?"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:k,screenreaderText:s?u.formatMessage({id:`discussion_likes_${m?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,onKeyDown:w=>{w.key==="ArrowDown"&&v(!0)},"aria-pressed":m,"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:c})})}),n&&d.jsx(Va,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map(w=>typeof w=="string"||!w.name?null:d.jsx("li",{children:d.jsx(Dn,{href:w.id?`/profiles/${w.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:A=>A==null?void 0:A.stopPropagation(),onFocus:()=>{Vi&&clearTimeout(Vi)},children:w.name})},w.id||window.btoa(w.name))),t>Ui&&d.jsx("li",{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_",cw=280,jr=({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:f}={openComments:()=>{}}},links:m={},className:p,gtmContext:g="DiscussionAnswer",children:h,isTruncated:y=!1})=>{const v=se.useIntl(),x=C.useContext(Ot),k=C.useContext(Za),{author:E,canLike:w,createdAt:A,id:P,likes:U=0,userLiked:$,comments:j=0}=t,R=x&&x.id&&typeof E!="string"&&E.id&&E.id===x.id||!1,_=typeof w=="boolean"?w:n?!R:!1,T=R&&(!t.createdAt||lh(t.createdAt,10,"seconds")),N=C.useRef(null),[M,Q]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[Z,oe]=C.useState(!1),[ne,D]=C.useState(T?"highlighted":"default"),[z,J]=C.useState("");C.useEffect(()=>{const K=N.current;if(!(!K||ne==="default"))return document.addEventListener("discussionFormSubmitted",B),K.addEventListener("transitionend",F),()=>{document.removeEventListener("discussionFormSubmitted",B),K.removeEventListener("transitionend",F)}},[]),C.useEffect(()=>{Q({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const B=()=>{setTimeout(()=>{D("fading")},1e3)},F=({propertyName:K})=>{K==="background-color"&&D(ue=>(ue==="default"&&(document.removeEventListener("discussionFormSubmitted",B),N.current&&N.current.removeEventListener("transitionend",F)),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,cw):M.body,I=async K=>{K||(K=""),J("");try{if(!nc(K,M.body)){const ue=t.type==="question"?{title:K}:{body:K};await l(Zl(t.slugs),ue)}Q({body:K,isEditing:!1,didEdit:!0})}catch{J(`${Mt}form_error`)}},H=()=>{k&&k.updateConversation&&k.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)}`,G=document.getElementById(ue),ge=document.getElementById(`${ue}-input`);ge&&ge.focus(),G&&G.scrollIntoView({behavior:"smooth"})},0)},te=async()=>{oe(!1);try{await o(Zl(t.slugs))}catch{J("delete-error")}},ee=[{text:v.formatMessage({id:`${Mt}moreMenu_report`}),onClick:K=>{K.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&&R&&ee.push({text:v.formatMessage({id:`${Mt}moreMenu_edit`}),onClick:()=>Q({...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:K=>{K.preventDefault(),K.stopPropagation(),oe(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...Df(`delete-${t.slug}-modal`,Z)}),C.createElement(e,{className:V("discussion-post",p,{[ne]:!p||!p.includes("highlighted-text-box"),"has-link":m.post&&!M.isEditing}),ref:N,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:K=>{!m.post||M.isEditing||(K.preventDefault(),K.stopPropagation(),window.location.href=m.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:P||t.slug,className:V("discussion-card",t.type,{editing:M.isEditing,"has-link":m.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(Ar,{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,{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(""),Q({...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(Cc,{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(Sf,{element:"li",likes:U,isShort:!1,userLiked:$,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:_,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||m.comments||typeof f=="function")&&d.jsx(_s,{onClick:K=>{K.preventDefault(),K.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof f=="function"&&f()},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:H,icon:{icon:"speech-bubble_square_thick"},children:v.formatMessage({id:`${Mt}reply`})})}),d.jsx(wf,{element:"li",id:`more-${t.slug}`,options:ee})]})]}),h,d.jsx(Tr,{id:`delete-${t.slug}-modal`,isOpen:Z,functions:{onOpen:()=>{},onClose:()=>oe(!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:()=>oe(!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(se.FormattedMessage,{id:"discussion_delete_text",values:{p:K=>d.jsx("p",{children:K}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Ki="discussion_responses_",jf=({type:e="answer",responses:t=0})=>{const n=se.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:kt(n.formatMessage,`${Ki}empty`,e,e)})]})};const Of=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=se.useIntl(),s=C.useContext(Za),o=na(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(Sr,{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})]})},dw="post",fw="reply",Pf="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 hw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function mw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Nf(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 pw({content:e}){return{content:e,id:Pf,time:new Date().toISOString(),verb:dw}}function Yl({activity:e,user:t}){return{...e,actor:Nf(t),...hw()}}function Ta({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 Rf({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 gw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Pf,kind:fw,parent:t||""}}function Gl({reply:e,user:t}){const n=Nf(t);return{...e,user_id:n.id,user:n,...mw()}}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 vw({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 Mf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Jl,Zi=0;const If=()=>{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}),$f=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"}),bw=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"}),yw=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"}),Dw=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:$f.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:$f.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:bw.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:yw.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:Dw.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Cw({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:pw(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(()=>{Mf(c.id)},0)}});return s}function xw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Sa(a,s);return o&&(o.content=i),s}),onError:n});return r}function ww({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},f=Cw({...c,mutationFn:e}),m=xw({...c,mutationFn:t}),p=Ew({...c,mutationFn:n}),g=Bw({...c,mutationFn:a}),h=kw({...c,mutationFn:i}),{activities:y,...v}=_w({queryKey:s,queryFn:r});return{activities:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function Ew({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=Sa(s,o);return l&&Ta({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sa(o,l);u&&Ta({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function _w({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:Fw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Bw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Aw(a,i)),onError:n});return r}function kw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sa(i,s);return o&&Rf({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 Sa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Aw(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 Fw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Tw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:a,leave:i}})=>{const s=se.useIntl(),{activities:o,error:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,remove:g,like:h,unlike:y},user:v}=ww({queryKey:[e,t,"activities"],queryFns:r});return If(),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,k)=>{var N,M,Q,Z,oe,ne,D,z;const{id:E,own_reactions:w,latest_reactions:A,reaction_counts:P}=x,U=(((N=A==null?void 0:A.like)==null?void 0:N.length)||0)>0,$=(((M=w==null?void 0:w.like)==null?void 0:M.length)||0)>0,j=$?w==null?void 0:w.like[0].id:"",R=U?(Q=A==null?void 0:A.like)==null?void 0:Q.map(J=>{var B,F,L;return{id:(B=J==null?void 0:J.user)==null?void 0:B.id,name:(L=(F=J==null?void 0:J.user)==null?void 0:F.data)==null?void 0:L.name}}):!1,_=x==null?void 0:x.actor,T=(_==null?void 0:_.id)===(v==null?void 0:v.id);return d.jsx(C.Fragment,{children:d.jsx(jr,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Ya(n,T),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:_==null?void 0:_.id,name:(Z=_==null?void 0:_.data)==null?void 0:Z.name,organization:(oe=_==null?void 0:_.data)==null?void 0:oe.organization,jobTitle:(ne=_==null?void 0:_.data)==null?void 0:ne.jobTitle,location:(D=_==null?void 0:_.data)==null?void 0:D.location,image:{thumbnail:((z=_==null?void 0:_.data)==null?void 0:z.thumbnail)||void 0}},userLiked:$,likes:(P==null?void 0:P.like)||0,comments:(P==null?void 0:P.reply)||0,peopleWhoLiked:R},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:E}),updateContent:(J,{body:B})=>p({activityId:E,content:B})},likes:{createLike:()=>h({activityId:E}),deleteLike:()=>y({activityId:E,reactionId:j})},comments:{openComments:()=>null}},isTruncated:!0})},E)}),!f&&d.jsx(Sr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},Sw={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 jw({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:gw(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(()=>{Mf(c.id)},0)}});return s}function Ow({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=ja(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Lf({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},f=jw({...c,mutationFn:e}),m=Ow({...c,mutationFn:t}),p=Pw({...c,mutationFn:n}),g=Rw({...c,mutationFn:a}),h=Mw({...c,mutationFn:i}),{replies:y,...v}=Nw({queryKey:s,queryFn:r});return{replies:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function Pw({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=ja(s,o);return l&&Ql({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=ja(o,l);u&&Ql({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Nw({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=qw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Rw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>zw(a,i)),onError:n});return r}function Mw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=ja(i,s);return o&&vw({reply:o,user:r}),s}),onError:n});return a}function Iw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function $w(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 Lw(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?$w(e,t,n):Lw(e,t,n):Iw(e)}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 zw(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 qw(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 Ww=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=se.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,like:g,remove:h,unlike:y},user:v}=Lf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:r})}});ks([f]);const[x,k]=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:()=>k(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&d.jsx(Of,{loadMore:{isLoading:f,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(E,{body:w})=>m({activityId:n,replyId:r,content:w})},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(E=>{var ne,D,z,J,B,F,L,I,H,te,ee,K;const{id:w,own_children:A,latest_children:P,children_counts:U}=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 G;return((G=ue==null?void 0:ue.user)==null?void 0:G.id)===(v==null?void 0:v.id)}):!1,R=j?j==null?void 0:j.id:"",_=!!j,N=(((z=P==null?void 0:P.like)==null?void 0:z.length)||0)>0?(J=P==null?void 0:P.like)==null?void 0:J.map(ue=>{var G,ge,me;return{id:(G=ue==null?void 0:ue.user)==null?void 0:G.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,Q=(M==null?void 0:M.id)===(v==null?void 0:v.id),Z=Ya(a,Q),oe=typeof E.data.content=="string"?(B=E==null?void 0:E.data)==null?void 0:B.content:((L=(F=E==null?void 0:E.data)==null?void 0:F.content)==null?void 0:L.text)||"";return d.jsx(jr,{content:{id:w,type:"reply",body:oe,canLike:Z,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:(H=M.data)==null?void 0:H.organization,jobTitle:(te=M.data)==null?void 0:te.jobTitle,location:(ee=M.data)==null?void 0:ee.location,image:{thumbnail:((K=M.data)==null?void 0:K.thumbnail)||void 0}},userLiked:_,likes:(U==null?void 0:U.like)||0,peopleWhoLiked:N},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:w}),updateContent:(ue,{body:G})=>p({replyId:w,content:G})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>y({replyId:w,reactionId:R})},comments:{}}},w)}):null})]})};const zf=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,join:i,leave:s}})=>{const o=se.useIntl(),{replies:l,repliesCount:u,fetchNextPage:c,hasNextPage:f,isLoading:m,mutations:{create:p,edit:g,like:h,remove:y,unlike:v},user:x}=Lf({queryKey:[e,t,n,"replies"],queryFns:a});return ks([m]),If(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(jf,{type:"comment",responses:u}),d.jsx(mo,{form:{content:{type:"reply",slugs:{}},functions:{create:(k,{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(k=>{var oe,ne,D,z,J,B,F,L,I,H,te,ee;const{id:E,own_children:w,latest_children:A,children_counts:P}=k,$=(((oe=w==null?void 0:w.like)==null?void 0:oe.length)||0)>0?(ne=w==null?void 0:w.like)==null?void 0:ne.find(K=>{var ue;return((ue=K==null?void 0:K.user)==null?void 0:ue.id)===(x==null?void 0:x.id)}):!1,j=$?$==null?void 0:$.id:"",R=!!$,T=(((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(K=>{var ue,G,ge;return{id:(ue=K==null?void 0:K.user)==null?void 0:ue.id,name:(ge=(G=K==null?void 0:K.user)==null?void 0:G.data)==null?void 0:ge.name}}):!1,N=k==null?void 0:k.user,M=(N==null?void 0:N.id)===(x==null?void 0:x.id),Q=Ya(r,M),Z=typeof k.data.content=="string"?(J=k==null?void 0:k.data)==null?void 0:J.content:((F=(B=k==null?void 0:k.data)==null?void 0:B.content)==null?void 0:F.text)||"";return d.jsx(Tf,{children:d.jsx(jr,{content:{id:E,type:"reply",body:Z,canLike:Q,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:N==null?void 0:N.id,name:(L=N.data)==null?void 0:L.name,organization:(I=N.data)==null?void 0:I.organization,jobTitle:(H=N.data)==null?void 0:H.jobTitle,location:(te=N.data)==null?void 0:te.location,image:{thumbnail:((ee=N.data)==null?void 0:ee.thumbnail)||void 0}},userLiked:R,likes:(P==null?void 0:P.like)||0,peopleWhoLiked:T},functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:E}),updateContent:(K,{body:ue})=>g({replyId:E,content:ue})},likes:{createLike:()=>h({replyId:E}),deleteLike:()=>v({replyId:E,reactionId:j})},comments:{}},children:d.jsx(Ww,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a}})},E)},E)}),!m&&d.jsx(Sr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Hw({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 Uw({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 Vw({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=Hw({...l,mutationFn:t}),c=Kw({...l,mutationFn:n}),f=Zw({...l,mutationFn:r}),{activity:m,...p}=Uw({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:f},user:s,...p}}function Kw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ta({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ta({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function Zw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Rf({activity:s,user:r}),s)),onError:n});return a}const Yw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var $,j,R,_,T,N,M,Q,Z,oe;const u=se.useIntl(),c=C.useContext(Ot),{activity:f,error:m,isLoading:p,mutations:{edit:g,like:h,unlike:y}}=Vw({queryFns:i,queryKey:[e,t,n]});if(p)return d.jsx(Ct,{style:{height:"400px"}});if(m||!f)return d.jsx(en,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:x}=f,k=((($=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,w=E?v==null?void 0:v.like[0].id:"",A=k?(R=x==null?void 0:x.like)==null?void 0:R.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,P=f==null?void 0:f.actor,U=(P==null?void 0:P.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(jr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Ya(r,U),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:P.id,name:(_=P.data)==null?void 0:_.name,organization:(T=P.data)==null?void 0:T.organization,jobTitle:(N=P.data)==null?void 0:N.jobTitle,location:(M=P.data)==null?void 0:M.location,image:{thumbnail:((Q=P.data)==null?void 0:Q.thumbnail)||void 0}},userLiked:E,likes:((Z=f==null?void 0:f.reaction_counts)==null?void 0:Z.like)||0,comments:((oe=f==null?void 0:f.reaction_counts)==null?void 0:oe.reply)||0,peopleWhoLiked:A},originalAuthorId:P==null?void 0:P.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ne,{body:D})=>g({content:D})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:w})},comments:{openComments:()=>{}}}},n),d.jsx(zf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},Gw=({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 ea="notFoundError_",Qw=()=>{const e=se.useIntl(),t=[];return tc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ea}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(kf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(an,{children:[d.jsx(xf,{cards:tc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(xe,{href:"/solution-articles/",children:e.formatMessage({id:`${ea}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ea}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ea}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=Tw;exports.ActivitySection=Yw;exports.AddPost=mo;exports.Banner=Dx;exports.BannerSection=kx;exports.Breadcrumbs=Lx;exports.Buckets=xh;exports.Button=xe;exports.ButtonWrapper=yn;exports.COURSE_CONTENT_TYPES=ur;exports.CacheProvider=mf;exports.Card=uo;exports.CardBlock=xf;exports.Carousel=Ix;exports.CollapsibleSection=Ra;exports.Columns=_f;exports.CommunityDetails=$x;exports.ContactFooter=Qx;exports.ContactForm=Xd;exports.ContentTypeLabel=bc;exports.Contributors=js;exports.ConversationContext=Za;exports.CookieBanner=Bf;exports.CourseProgression=aw;exports.CourseStructure=iw;exports.CustomContentBanner=Ax;exports.Directory=gx;exports.DiscussionConversation=Tf;exports.DiscussionForm=Ka;exports.DiscussionLikes=Sf;exports.DiscussionPost=jr;exports.DiscussionThread=Of;exports.Divider=Qt;exports.DownloadSection=Cx;exports.EMAILS=Fn;exports.EditSection=wx;exports.EmailHelperTextBox=_c;exports.EmptyStateBox=en;exports.Filters=zx;exports.FlagsProvider=pf;exports.Footer=fo;exports.Form=Gn;exports.FullWidthSection=an;exports.GlobalProviders=mx;exports.Header=ho;exports.HelperTextBox=Dc;exports.HiddenFromScreenReaders=Oa;exports.HideShowTextBox=Cc;exports.HighlightSection=Tx;exports.HighlightedTextBox=St;exports.INVALID_TOKEN=mc;exports.IconBulletedList=_h;exports.ImageContainer=yh;exports.IntlProvider=gf;exports.InviteForm=ef;exports.InviteModal=px;exports.JoinButton=lo;exports.LanguageContext=io;exports.LanguageSwitcher=Wx;exports.LessonName=Af;exports.LessonType=Ff;exports.Link=Dn;exports.LoadMore=Sr;exports.LoadingBlock=Rh;exports.LoadingPlaceholder=Ct;exports.LoadingState=Ts;exports.Logo=co;exports.LogoSection=Ex;exports.MarkCompleteButton=sw;exports.MarkdownText=zn;exports.MarketingBlock=Sx;exports.Member=Ar;exports.MembersList=rw;exports.Modal=oo;exports.MoreMenu=wf;exports.NUMBER_OF_COUNTRIES=uh;exports.NUMBER_OF_USERS=oh;exports.NavigationMenu=Ef;exports.NotFoundError=Qw;exports.Overlay=Tr;exports.OverlayContext=so;exports.OverlayProvider=yf;exports.PageHeading=xc;exports.PageLayout=kf;exports.PasswordForm=uC;exports.PasswordRules=Tc;exports.Pill=Rn;exports.ProfileImageChange=oC;exports.ProfilePicture=tn;exports.ProgressBar=Fs;exports.ProgressTracker=Dh;exports.Rating=Yh;exports.RepliesFeed=zf;exports.ResponsesHeading=jf;exports.ResponsiveImage=Yn;exports.ReturnToNavButton=Ch;exports.RichTextEditor=Jd;exports.SearchForm=tf;exports.ShareLinks=Zx;exports.SignupForm=mC;exports.Span=Xi;exports.StatusBanner=yr;exports.TableOfContents=yx;exports.Tabs=Yx;exports.Tags=nw;exports.TestimonialBlock=bx;exports.TimeToComplete=Ua;exports.Toggle=sC;exports.Tooltip=Va;exports.TopLevelPage=Jx;exports.UserContext=Ot;exports.UserProvider=vf;exports.VisuallyHidden=Le;exports.addAriaProps=Df;exports.basicReducer=Pa;exports.camelCaseToDashCase=dc;exports.checkIntlPathExists=Na;exports.generateConditions=la;exports.generateCssIcon=pc;exports.getLongDate=As;exports.getMember=Ss;exports.getShortDate=gc;exports.headerData=kr;exports.mapGetStreamData=Gw;exports.pageReady=vc;exports.passwordValidator=Qi;exports.repliesFeedMock=Sw;exports.supportedLanguages=da;exports.toCamelCase=fc;exports.toSentenceCase=hc;exports.useCurrentPath=sc;exports.useEffectAfterMount=Ln;exports.useElementWidth=Kn;exports.useOverlay=bf;exports.useScrollListener=uc;exports.useScrollToHash=ks;exports.useUser=Ha;
|