@apolitical/component-library 5.1.2-SW.2 → 5.1.2-SW.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/post/index.d.ts +1 -0
- package/discussion/components/post/post.d.ts +8 -4
- package/discussion/index.d.ts +2 -2
- package/discussion/shared/interfaces/activity.interface.d.ts +2 -1
- package/discussion/shared/interfaces/discussion.interface.d.ts +84 -0
- package/discussion/shared/interfaces/index.d.ts +1 -0
- package/index.js +49 -49
- package/index.mjs +3548 -3517
- package/package.json +4 -1
- package/style.css +1 -1
- package/user/member/member.d.ts +3 -0
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ie=require("react-intl"),wn=require("lodash.clonedeep"),Hh=require("lodash.set"),Nc=require("react-dom"),qt=require("markdown-to-jsx"),Xn=require("truncate"),qe=require("@tanstack/react-query"),Vh=require("@tanstack/react-query-devtools"),Da=require("posthog-js"),Gs=require("react-cookie"),ps=require("lodash.isequal"),Kh=require("react-multi-email"),Ic=require("lodash.get"),Zh=require("react-error-boundary");var Qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function On(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Rc(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 $c={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})()})($c);var Yh=$c.exports;const
|
|
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})()})($c);var Yh=$c.exports;const V=On(Yh),Gh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:V("hidden",r,{"show-on-focus":t}),children:n}),Ne=y.memo(Gh),Qh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),Ja=y.memo(Qh);var gs={exports:{}},dr={};/**
|
|
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 tu;function Jh(){if(tu)return dr;tu=1;var e=y,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 d,h={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(h[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)h[d]===void 0&&(h[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:m,props:h,_owner:a.current}}return dr.Fragment=n,dr.jsx=s,dr.jsxs=s,dr}var fr={};/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.development.js
|
|
16
16
|
*
|
|
@@ -18,51 +18,51 @@
|
|
|
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
|
-
`+U+
|
|
21
|
+
*/var nu;function Xh(){return nu||(nu=1,process.env.NODE_ENV!=="production"&&function(){var e=y,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"),d=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function b(P){if(P===null||typeof P!="object")return null;var se=g&&P[g]||P[f];return typeof se=="function"?se:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(P){{for(var se=arguments.length,de=new Array(se>1?se-1:0),ye=1;ye<se;ye++)de[ye-1]=arguments[ye];k("error",P,de)}}function k(P,se,de){{var ye=v.ReactDebugCurrentFrame,je=ye.getStackAddendum();je!==""&&(se+="%s",de=de.concat([je]));var $e=de.map(function(Ae){return String(Ae)});$e.unshift("Warning: "+se),Function.prototype.apply.call(console[P],console,$e)}}var _=!1,w=!1,F=!1,S=!1,q=!1,N;N=Symbol.for("react.module.reference");function z(P){return!!(typeof P=="string"||typeof P=="function"||P===r||P===i||q||P===a||P===u||P===d||S||P===m||_||w||F||typeof P=="object"&&P!==null&&(P.$$typeof===p||P.$$typeof===h||P.$$typeof===s||P.$$typeof===o||P.$$typeof===l||P.$$typeof===N||P.getModuleId!==void 0))}function I(P,se,de){var ye=P.displayName;if(ye)return ye;var je=se.displayName||se.name||"";return je!==""?de+"("+je+")":de}function A(P){return P.displayName||"Context"}function E(P){if(P==null)return null;if(typeof P.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof P=="function")return P.displayName||P.name||null;if(typeof P=="string")return P;switch(P){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof P=="object")switch(P.$$typeof){case o:var se=P;return A(se)+".Consumer";case s:var de=P;return A(de._context)+".Provider";case l:return I(P,P.render,"ForwardRef");case h:var ye=P.displayName||null;return ye!==null?ye:E(P.type)||"Memo";case p:{var je=P,$e=je._payload,Ae=je._init;try{return E(Ae($e))}catch{return null}}}return null}var j=Object.assign,R=0,W,H,G,ne,C,L,ee;function B(){}B.__reactDisabledLog=!0;function T(){{if(R===0){W=console.log,H=console.info,G=console.warn,ne=console.error,C=console.group,L=console.groupCollapsed,ee=console.groupEnd;var P={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:P,log:P,warn:P,error:P,group:P,groupCollapsed:P,groupEnd:P})}R++}}function O(){{if(R--,R===0){var P={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},P,{value:W}),info:j({},P,{value:H}),warn:j({},P,{value:G}),error:j({},P,{value:ne}),group:j({},P,{value:C}),groupCollapsed:j({},P,{value:L}),groupEnd:j({},P,{value:ee})})}R<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=v.ReactCurrentDispatcher,U;function re(P,se,de){{if(U===void 0)try{throw Error()}catch(je){var ye=je.stack.trim().match(/\n( *(at )?)/);U=ye&&ye[1]||""}return`
|
|
22
|
+
`+U+P}}var X=!1,ae;{var he=typeof WeakMap=="function"?WeakMap:Map;ae=new he}function Q(P,se){if(!P||X)return"";{var de=ae.get(P);if(de!==void 0)return de}var ye;X=!0;var je=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $e;$e=$.current,$.current=null,T();try{if(se){var Ae=function(){throw Error()};if(Object.defineProperty(Ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ae,[])}catch(Vt){ye=Vt}Reflect.construct(P,[],Ae)}else{try{Ae.call()}catch(Vt){ye=Vt}P.call(Ae.prototype)}}else{try{throw Error()}catch(Vt){ye=Vt}P()}}catch(Vt){if(Vt&&ye&&typeof Vt.stack=="string"){for(var ke=Vt.stack.split(`
|
|
23
23
|
`),ot=ye.stack.split(`
|
|
24
|
-
`),Ge=ke.length-1,Qe=ot.length-1;Ge>=1&&Qe>=0&&ke[Ge]!==ot[Qe];)Qe--;for(;Ge>=1&&Qe>=0;Ge--,Qe--)if(ke[Ge]!==ot[Qe]){if(Ge!==1||Qe!==1)do if(Ge--,Qe--,Qe<0||ke[Ge]!==ot[Qe]){var
|
|
25
|
-
`+ke[Ge].replace(" at new "," at ");return
|
|
24
|
+
`),Ge=ke.length-1,Qe=ot.length-1;Ge>=1&&Qe>=0&&ke[Ge]!==ot[Qe];)Qe--;for(;Ge>=1&&Qe>=0;Ge--,Qe--)if(ke[Ge]!==ot[Qe]){if(Ge!==1||Qe!==1)do if(Ge--,Qe--,Qe<0||ke[Ge]!==ot[Qe]){var wt=`
|
|
25
|
+
`+ke[Ge].replace(" at new "," at ");return P.displayName&&wt.includes("<anonymous>")&&(wt=wt.replace("<anonymous>",P.displayName)),typeof P=="function"&&ae.set(P,wt),wt}while(Ge>=1&&Qe>=0);break}}}finally{X=!1,$.current=$e,O(),Error.prepareStackTrace=je}var Rn=P?P.displayName||P.name:"",eu=Rn?re(Rn):"";return typeof P=="function"&&ae.set(P,eu),eu}function ve(P,se,de){return Q(P,!1)}function pe(P){var se=P.prototype;return!!(se&&se.isReactComponent)}function _e(P,se,de){if(P==null)return"";if(typeof P=="function")return Q(P,pe(P));if(typeof P=="string")return re(P);switch(P){case u:return re("Suspense");case d:return re("SuspenseList")}if(typeof P=="object")switch(P.$$typeof){case l:return ve(P.render);case h:return _e(P.type,se,de);case p:{var ye=P,je=ye._payload,$e=ye._init;try{return _e($e(je),se,de)}catch{}}}return""}var Fe=Object.prototype.hasOwnProperty,Se={},We=v.ReactDebugCurrentFrame;function Ue(P){if(P){var se=P._owner,de=_e(P.type,P._source,se?se.type:null);We.setExtraStackFrame(de)}else We.setExtraStackFrame(null)}function Be(P,se,de,ye,je){{var $e=Function.call.bind(Fe);for(var Ae in P)if($e(P,Ae)){var ke=void 0;try{if(typeof P[Ae]!="function"){var ot=Error((ye||"React class")+": "+de+" type `"+Ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof P[Ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ot.name="Invariant Violation",ot}ke=P[Ae](se,Ae,ye,de,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ge){ke=Ge}ke&&!(ke instanceof Error)&&(Ue(je),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).",ye||"React class",de,Ae,typeof ke),Ue(null)),ke instanceof Error&&!(ke.message in Se)&&(Se[ke.message]=!0,Ue(je),x("Failed %s type: %s",de,ke.message),Ue(null))}}}var Te=Array.isArray;function De(P){return Te(P)}function Re(P){{var se=typeof Symbol=="function"&&Symbol.toStringTag,de=se&&P[Symbol.toStringTag]||P.constructor.name||"Object";return de}}function ze(P){try{return Y(P),!1}catch{return!0}}function Y(P){return""+P}function oe(P){if(ze(P))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Re(P)),Y(P)}var le=v.ReactCurrentOwner,ce={key:!0,ref:!0,__self:!0,__source:!0},Ce,Ze,Ye;Ye={};function rt(P){if(Fe.call(P,"ref")){var se=Object.getOwnPropertyDescriptor(P,"ref").get;if(se&&se.isReactWarning)return!1}return P.ref!==void 0}function xt(P){if(Fe.call(P,"key")){var se=Object.getOwnPropertyDescriptor(P,"key").get;if(se&&se.isReactWarning)return!1}return P.key!==void 0}function Tt(P,se){if(typeof P.ref=="string"&&le.current&&se&&le.current.stateNode!==se){var de=E(le.current.type);Ye[de]||(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',E(le.current.type),P.ref),Ye[de]=!0)}}function tt(P,se){{var de=function(){Ce||(Ce=!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)",se))};de.isReactWarning=!0,Object.defineProperty(P,"key",{get:de,configurable:!0})}}function Mt(P,se){{var de=function(){Ze||(Ze=!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)",se))};de.isReactWarning=!0,Object.defineProperty(P,"ref",{get:de,configurable:!0})}}var bt=function(P,se,de,ye,je,$e,Ae){var ke={$$typeof:t,type:P,key:se,ref:de,props:Ae,_owner:$e};return ke._store={},Object.defineProperty(ke._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ke,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ye}),Object.defineProperty(ke,"_source",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.freeze&&(Object.freeze(ke.props),Object.freeze(ke)),ke};function mi(P,se,de,ye,je){{var $e,Ae={},ke=null,ot=null;de!==void 0&&(oe(de),ke=""+de),xt(se)&&(oe(se.key),ke=""+se.key),rt(se)&&(ot=se.ref,Tt(se,je));for($e in se)Fe.call(se,$e)&&!ce.hasOwnProperty($e)&&(Ae[$e]=se[$e]);if(P&&P.defaultProps){var Ge=P.defaultProps;for($e in Ge)Ae[$e]===void 0&&(Ae[$e]=Ge[$e])}if(ke||ot){var Qe=typeof P=="function"?P.displayName||P.name||"Unknown":P;ke&&tt(Ae,Qe),ot&&Mt(Ae,Qe)}return bt(P,ke,ot,je,ye,le.current,Ae)}}var cr=v.ReactCurrentOwner,Gr=v.ReactDebugCurrentFrame;function In(P){if(P){var se=P._owner,de=_e(P.type,P._source,se?se.type:null);Gr.setExtraStackFrame(de)}else Gr.setExtraStackFrame(null)}var pi;pi=!1;function gi(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function Yo(){{if(cr.current){var P=E(cr.current.type);if(P)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+
|
|
27
|
+
Check the render method of \``+P+"`."}return""}}function Ih(P){{if(P!==void 0){var se=P.fileName.replace(/^.*[\\\/]/,""),de=P.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+
|
|
29
|
+
Check your code at `+se+":"+de+"."}return""}}var Go={};function Rh(P){{var se=Yo();if(!se){var de=typeof P=="string"?P:P.displayName||P.name;de&&(se=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+ce+">.")}return oe}}function Go(O,oe){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=Rh(oe);if(Yo[ce])return;Yo[ce]=!0;var ye="";O&&O._owner&&O._owner!==cr.current&&(ye=" It was passed a child from "+E(O._owner.type)+"."),In(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,ye),In(null)}}function Qo(O,oe){{if(typeof O!="object")return;if(De(O))for(var ce=0;ce<O.length;ce++){var ye=O[ce];gi(ye)&&Go(ye,oe)}else if(gi(O))O._store&&(O._store.validated=!0);else if(O){var je=b(O);if(typeof je=="function"&&je!==O.entries)for(var $e=je.call(O),Ae;!(Ae=$e.next()).done;)gi(Ae.value)&&Go(Ae.value,oe)}}}function $h(O){{var oe=O.type;if(oe==null||typeof oe=="string")return;var ce;if(typeof oe=="function")ce=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===l||oe.$$typeof===h))ce=oe.propTypes;else return;if(ce){var ye=E(oe);Be(ce,O.props,"prop",ye,O)}else if(oe.PropTypes!==void 0&&!pi){pi=!0;var je=E(oe);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",je||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Lh(O){{for(var oe=Object.keys(O.props),ce=0;ce<oe.length;ce++){var ye=oe[ce];if(ye!=="children"&&ye!=="key"){In(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ye),In(null);break}}O.ref!==null&&(In(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),In(null))}}function Jo(O,oe,ce,ye,je,$e){{var Ae=q(O);if(!Ae){var ke="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(ke+=" 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 ot=Ih(je);ot?ke+=ot:ke+=Zo();var Ge;O===null?Ge="null":De(O)?Ge="array":O!==void 0&&O.$$typeof===t?(Ge="<"+(E(O.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):Ge=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ge,ke)}var Qe=mi(O,oe,ce,je,$e);if(Qe==null)return Qe;if(Ae){var xt=oe.children;if(xt!==void 0)if(ye)if(De(xt)){for(var Rn=0;Rn<xt.length;Rn++)Qo(xt[Rn],O);Object.freeze&&Object.freeze(xt)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Qo(xt,O)}return O===r?Lh(Qe):$h(Qe),Qe}}function zh(O,oe,ce){return Jo(O,oe,ce,!0)}function qh(O,oe,ce){return Jo(O,oe,ce,!1)}var Wh=qh,Uh=zh;fr.Fragment=r,fr.jsx=Wh,fr.jsxs=Uh}()),fr}process.env.NODE_ENV==="production"?gs.exports=Jh():gs.exports=Xh();var c=gs.exports;const Lc=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},er=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function zc(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),h=y.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,w=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var A=y.useMemo(function(){var _=function(q){var I=o.current,B=l.current;return o.current=l.current=null,i.current=q,u.current=d.current.apply(B,I)},x=function(q,I){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(q):setTimeout(q,I)},T=function(q){if(!h.current)return!1;var I=q-a.current;return!a.current||I>=t||I<0||b&&q-i.current>=w},S=function(q){return s.current=null,f&&o.current?_(q):(o.current=l.current=null,u.current)},z=function q(){var I=Date.now();if(T(I))return S(I);if(h.current){var B=t-(I-a.current),E=b?Math.min(B,w-(I-i.current)):B;x(q,E)}},M=function(){if(p||v){var q=Date.now(),I=T(q);if(o.current=[].slice.call(arguments),l.current=r,a.current=q,I){if(!s.current&&h.current)return i.current=a.current,x(z,t),g?_(a.current):u.current;if(b)return x(z,t),_(a.current)}return s.current||x(z,t),u.current}};return M.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},M.isPending=function(){return!!s.current},M.flush=function(){return s.current?S(Date.now()):u.current},M},[g,b,t,w,f,m,p,v]);return A}function qc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return zc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let vi;const Pn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(vi),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:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=qc(()=>{s()!==r&&(t&&(clearTimeout(vi),document.body.classList.add("is-resizing"),vi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Wc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,h=a.current,p=d-h,m=p>0?"down":"up";if(i({current:d,past:h}),m==="down"){d>=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=qc(()=>{l()},250);return a},Gs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);er(()=>{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)},Qs=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const nu={},Mn=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const h=se.useIntl(),[p]=y.useState(e||Date.now().toString()),m=y.useRef(null),g=d||m,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:v=!0,hasPointer:w=!1,hasForm:A=!1}=t,{onOpen:_=()=>{},onClose:x=()=>{}}=o,{readToScreenreadersWhenClosed:T=!1,...S}=l,z=nu[p];y.useEffect(()=>{const B=g==null?void 0:g.current;if(B)return B.addEventListener("transitionend",M),()=>{B.removeEventListener("transitionend",M)}},[]),y.useEffect(()=>{if(f!=="open")return;const B=E=>{E.key==="Escape"&&(E.stopPropagation(),E.preventDefault(),b("closed"))};return document.addEventListener("keyup",B),()=>{document.removeEventListener("keyup",B)}},[f]);const M=({propertyName:B})=>{B==="opacity"&&(z!==!1&&clearTimeout(z),b(E=>(E==="open"?_():E==="closed"&&x(),E==="opening"?"open":E==="closing"?"closed":E==="closed"?"hidden":E)))};er(()=>{z!==!1&&clearTimeout(z);let B="open";n?b("opening"):(b("closing"),B="hidden"),nu[p||""]=setTimeout(()=>{b(B)},300)},[n]);const q={...u,...S};s&&s.onBlur&&(q.onBlur=s.onBlur);const I={className:"content"};return T?I.className=Z("content",{hidden:f==="hidden"}):I.hidden=f==="hidden",c.jsx("aside",{ref:g,className:Z("tooltip text-medium",f,i,{loading:r,"extra-padding":v,"has-pointer":w,bottom:w==="bottom","has-form":A}),...q,children:c.jsx("div",{...I,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Wr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=wn(e);return t.forEach(({type:r,value:a})=>{Hh(n,r,a)}),n},Uc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Hc=(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},Vc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Kc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Zc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),em=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),qt="https://storage.googleapis.com/apolitical-assets/",Un={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Dr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},vs="SU:",Sr="DELETED",Yc="Invalid token error: Logging user out...",tm="200,000+",nm="160+",jr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Gc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function rm(e){return e?{"--icon":`url(${qt}icons/${e}.svg)`}:{}}const Cn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Qc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Js=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),bs=e=>{let t;const n=Ta(),r=Ta(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)}},Ta=e=>{const n=(e||new Date).toUTCString();return new Date(n)},am=(e,t,n)=>{let r;const a=Ta(),i=Ta(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},im=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},sm=e=>new Promise(t=>setTimeout(t,e)),om=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},sr={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_new:"New",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_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",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 <`+de+">.")}return se}}function Qo(P,se){{if(!P._store||P._store.validated||P.key!=null)return;P._store.validated=!0;var de=Rh(se);if(Go[de])return;Go[de]=!0;var ye="";P&&P._owner&&P._owner!==cr.current&&(ye=" It was passed a child from "+E(P._owner.type)+"."),In(P),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,ye),In(null)}}function Jo(P,se){{if(typeof P!="object")return;if(De(P))for(var de=0;de<P.length;de++){var ye=P[de];gi(ye)&&Qo(ye,se)}else if(gi(P))P._store&&(P._store.validated=!0);else if(P){var je=b(P);if(typeof je=="function"&&je!==P.entries)for(var $e=je.call(P),Ae;!(Ae=$e.next()).done;)gi(Ae.value)&&Qo(Ae.value,se)}}}function $h(P){{var se=P.type;if(se==null||typeof se=="string")return;var de;if(typeof se=="function")de=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===l||se.$$typeof===h))de=se.propTypes;else return;if(de){var ye=E(se);Be(de,P.props,"prop",ye,P)}else if(se.PropTypes!==void 0&&!pi){pi=!0;var je=E(se);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",je||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Lh(P){{for(var se=Object.keys(P.props),de=0;de<se.length;de++){var ye=se[de];if(ye!=="children"&&ye!=="key"){In(P),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ye),In(null);break}}P.ref!==null&&(In(P),x("Invalid attribute `ref` supplied to `React.Fragment`."),In(null))}}function Xo(P,se,de,ye,je,$e){{var Ae=z(P);if(!Ae){var ke="";(P===void 0||typeof P=="object"&&P!==null&&Object.keys(P).length===0)&&(ke+=" 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 ot=Ih(je);ot?ke+=ot:ke+=Yo();var Ge;P===null?Ge="null":De(P)?Ge="array":P!==void 0&&P.$$typeof===t?(Ge="<"+(E(P.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):Ge=typeof P,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ge,ke)}var Qe=mi(P,se,de,je,$e);if(Qe==null)return Qe;if(Ae){var wt=se.children;if(wt!==void 0)if(ye)if(De(wt)){for(var Rn=0;Rn<wt.length;Rn++)Jo(wt[Rn],P);Object.freeze&&Object.freeze(wt)}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 Jo(wt,P)}return P===r?Lh(Qe):$h(Qe),Qe}}function zh(P,se,de){return Xo(P,se,de,!0)}function qh(P,se,de){return Xo(P,se,de,!1)}var Wh=qh,Uh=zh;fr.Fragment=r,fr.jsx=Wh,fr.jsxs=Uh}()),fr}process.env.NODE_ENV==="production"?gs.exports=Jh():gs.exports=Xh();var c=gs.exports;const Lc=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},er=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function zc(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),h=y.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,x=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var k=y.useMemo(function(){var _=function(z){var I=o.current,A=l.current;return o.current=l.current=null,i.current=z,u.current=d.current.apply(A,I)},w=function(z,I){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(z):setTimeout(z,I)},F=function(z){if(!h.current)return!1;var I=z-a.current;return!a.current||I>=t||I<0||b&&z-i.current>=x},S=function(z){return s.current=null,f&&o.current?_(z):(o.current=l.current=null,u.current)},q=function z(){var I=Date.now();if(F(I))return S(I);if(h.current){var A=t-(I-a.current),E=b?Math.min(A,x-(I-i.current)):A;w(z,E)}},N=function(){if(p||v){var z=Date.now(),I=F(z);if(o.current=[].slice.call(arguments),l.current=r,a.current=z,I){if(!s.current&&h.current)return i.current=a.current,w(q,t),g?_(a.current):u.current;if(b)return w(q,t),_(a.current)}return s.current||w(q,t),u.current}};return N.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?S(Date.now()):u.current},N},[g,b,t,x,f,m,p,v]);return k}function qc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return zc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let vi;const Pn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(vi),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:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=qc(()=>{s()!==r&&(t&&(clearTimeout(vi),document.body.classList.add("is-resizing"),vi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Wc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,h=a.current,p=d-h,m=p>0?"down":"up";if(i({current:d,past:h}),m==="down"){d>=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=qc(()=>{l()},250);return a},Qs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);er(()=>{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)},Js=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const ru={},Mn=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const h=ie.useIntl(),[p]=y.useState(e||Date.now().toString()),m=y.useRef(null),g=d||m,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:v=!0,hasPointer:x=!1,hasForm:k=!1}=t,{onOpen:_=()=>{},onClose:w=()=>{}}=o,{readToScreenreadersWhenClosed:F=!1,...S}=l,q=ru[p];y.useEffect(()=>{const A=g==null?void 0:g.current;if(A)return A.addEventListener("transitionend",N),()=>{A.removeEventListener("transitionend",N)}},[]),y.useEffect(()=>{if(f!=="open")return;const A=E=>{E.key==="Escape"&&(E.stopPropagation(),E.preventDefault(),b("closed"))};return document.addEventListener("keyup",A),()=>{document.removeEventListener("keyup",A)}},[f]);const N=({propertyName:A})=>{A==="opacity"&&(q!==!1&&clearTimeout(q),b(E=>(E==="open"?_():E==="closed"&&w(),E==="opening"?"open":E==="closing"?"closed":E==="closed"?"hidden":E)))};er(()=>{q!==!1&&clearTimeout(q);let A="open";n?b("opening"):(b("closing"),A="hidden"),ru[p||""]=setTimeout(()=>{b(A)},300)},[n]);const z={...u,...S};s&&s.onBlur&&(z.onBlur=s.onBlur);const I={className:"content"};return F?I.className=V("content",{hidden:f==="hidden"}):I.hidden=f==="hidden",c.jsx("aside",{ref:g,className:V("tooltip text-medium",f,i,{loading:r,"extra-padding":v,"has-pointer":x,bottom:x==="bottom","has-form":k}),...z,children:c.jsx("div",{...I,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Wr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=wn(e);return t.forEach(({type:r,value:a})=>{Hh(n,r,a)}),n},Uc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Hc=(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},Vc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Kc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Zc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),em=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Wt="https://storage.googleapis.com/apolitical-assets/",Un={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Dr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},vs="SU:",Sr="DELETED",Yc="Invalid token error: Logging user out...",tm="200,000+",nm="160+",jr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Gc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function rm(e){return e?{"--icon":`url(${Wt}icons/${e}.svg)`}:{}}const Cn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Qc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Xs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),bs=e=>{let t;const n=Sa(),r=Sa(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)}},Sa=e=>{const n=(e||new Date).toUTCString();return new Date(n)},am=(e,t,n)=>{let r;const a=Sa(),i=Sa(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},im=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},sm=e=>new Promise(t=>setTimeout(t,e)),om=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},sr={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_new:"New",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_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",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.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"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:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",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_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",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_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",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 email addresses 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",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_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_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"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",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",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_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",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",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",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 email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",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",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",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",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"},um={...sr,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>"},lm={...sr,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"},cm={...sr,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>"},dm=Object.freeze(Object.defineProperty({__proto__:null,en:sr,es:um,fr:lm,pt:cm},Symbol.toStringTag,{value:"Module"})),Ja=(e,t=sr)=>e in t,Tt=(e,t,n,r,a={})=>{let i="";return Ja(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},fm=(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},Da=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Jc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},hm=e=>{var i,s,o;const n=["name","organization","jobTitle","biography"].every(l=>{const u=e[l];return u!=null&&u!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0||((o=e.location)==null?void 0:o.country)!==void 0;return n&&r&&a},mm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Sr).replace(/{{id}}/g,Sr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Xc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(jr);if(!a)return e;for(const s of a){const o=s.replace(jr,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(vs))try{const h=d.replace(vs,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:g}=p;u.name=g||m||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?mm(e,u,t):s)}return e},ed=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},td=e=>new URLSearchParams(window.location.search).get(e),ru=(e="")=>e.replace(/\s+/g,"").length>0,ys=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}}};const Ee=({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,tooltip:u="",screenreaderText:d=!1,children:h=!1,...p})=>{const g=Pn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Qs(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),x=Uc(Object.keys(_));t=Hc(g,x,_)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const w={...p,className:Z(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const A=y.createElement(i,w,h||(d?c.jsx(Ne,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Mn,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),A]}):A},or=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:Z("button-wrapper",n),...r,children:i})};const Wt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:Z(e,{"has-max-width":t}),style:n})},au={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"}},pm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?au[e]:au.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},gm=({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},bi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${gm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ur=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=pm(e),g=bi({format:"avif",query:s,range:p,url:o}),f=bi({format:"webp",query:s,range:p,url:o}),b=bi({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const vm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(ur,{image:{...e},className:"image"})}),fn=({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),c.jsx("a",{href:e,className:Z("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const nd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:Z("popover",e),"aria-live":"polite",children:t})}),Ur=({parent:e=document.body,children:t})=>typeof document=="object"?Nc.createPortal(t,e):null,bm=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"}));const ym=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ne,{children:c.jsx(se.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:Z("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:Z("line",{active:a<e})})]},r)})})})]});const Dm=({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 c.jsx(Ee,{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 Cm=({items:e,className:t="",...n})=>c.jsx("ul",{className:Z("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),iu=300,su="ease-in-out";class xm{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:iu,easing:su}),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:iu,easing:su}),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 Xa=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=se.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new xm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:Z("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},ou={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},wm=e=>{let t=e;return Object.keys(ou).includes(e)&&(t=ou[e]),`url(${qt}icons/${t}.svg)`};const uu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},rd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=se.useIntl(),i=t?{"--custom-icon":wm(t)}:{},s=Ja(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:Z("content-type-label text-small",e in uu?uu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Ot=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${qt}icons/${t}.svg)`}:{};return c.jsx("div",{className:Z("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const hn=({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=Pn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=Uc(Object.keys(h));a=Hc(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Ot,{variant:"subtle",className:Z("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(zt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ds=({children:e,...t})=>c.jsx("p",{...t,children:e}),ad={q:Ds,blockquote:Ds};for(let e=1;e<=6;e++)ad[`h${e}`]={component:Ds,props:{className:"title"}};const id=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:Z("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(zt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:ad},children:r}):c.jsx("p",{children:r})]});const sd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=se.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"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:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",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_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",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_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",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 email addresses 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",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_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_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"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",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",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_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",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",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",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 email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",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",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",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",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"},um={...sr,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>"},lm={...sr,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"},cm={...sr,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>"},dm=Object.freeze(Object.defineProperty({__proto__:null,en:sr,es:um,fr:lm,pt:cm},Symbol.toStringTag,{value:"Module"})),Xa=(e,t=sr)=>e in t,St=(e,t,n,r,a={})=>{let i="";return Xa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},fm=(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},Ca=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Jc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},hm=e=>{var i,s,o;const n=["name","organization","jobTitle","biography"].every(l=>{const u=e[l];return u!=null&&u!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0||((o=e.location)==null?void 0:o.country)!==void 0;return n&&r&&a},mm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Sr).replace(/{{id}}/g,Sr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Xc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(jr);if(!a)return e;for(const s of a){const o=s.replace(jr,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(vs))try{const h=d.replace(vs,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:g}=p;u.name=g||m||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?mm(e,u,t):s)}return e},ed=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},td=e=>new URLSearchParams(window.location.search).get(e),au=(e="")=>e.replace(/\s+/g,"").length>0,ys=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}}};const Ee=({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,tooltip:u="",screenreaderText:d=!1,children:h=!1,...p})=>{const g=Pn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Js(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),w=Uc(Object.keys(_));t=Hc(g,w,_)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const x={...p,className:V(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",x.href=a);const k=y.createElement(i,x,h||(d?c.jsx(Ne,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Mn,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),k]}):k},or=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const Ut=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},iu={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"}},pm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?iu[e]:iu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},gm=({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},bi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${gm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ur=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=pm(e),g=bi({format:"avif",query:s,range:p,url:o}),f=bi({format:"webp",query:s,range:p,url:o}),b=bi({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const vm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(ur,{image:{...e},className:"image"})}),fn=({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),c.jsx("a",{href:e,className:V("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const nd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:V("popover",e),"aria-live":"polite",children:t})}),Ur=({parent:e=document.body,children:t})=>typeof document=="object"?Nc.createPortal(t,e):null,bm=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"}));const ym=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ne,{children:c.jsx(ie.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const Dm=({elementId:e,offset:t=20})=>{const n=ie.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 c.jsx(Ee,{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 Cm=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),su=300,ou="ease-in-out";class xm{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:su,easing:ou}),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:su,easing:ou}),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 ei=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ie.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new xm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},uu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},wm=e=>{let t=e;return Object.keys(uu).includes(e)&&(t=uu[e]),`url(${Wt}icons/${t}.svg)`};const lu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},rd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ie.useIntl(),i=t?{"--custom-icon":wm(t)}:{},s=Xa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in lu?lu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Pt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Wt}icons/${t}.svg)`}:{};return c.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const hn=({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=Pn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=Uc(Object.keys(h));a=Hc(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Pt,{variant:"subtle",className:V("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(qt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ds=({children:e,...t})=>c.jsx("p",{...t,children:e}),ad={q:Ds,blockquote:Ds};for(let e=1;e<=6;e++)ad[`h${e}`]={component:Ds,props:{className:"title"}};const id=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:V("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(qt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:ad},children:r}):c.jsx("p",{children:r})]});const sd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ie.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
|
|
36
36
|
`);h(b.length<3?`${a.substring(0,400)}...`:b.slice(0,3).join(`
|
|
37
|
-
`))},[a]),y.useEffect(()=>{p==="ready-to-close"&&m("closing")},[p]);const g=({propertyName:b})=>{b==="max-height"&&m(v=>v==="opening"?"open":v==="closing"?"closed":v)},f=["opening","open"].includes(p);return c.jsxs(Ot,{variant:"subtle",className:Z("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:Z("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(zt,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Z({"rotate-180":f}),onClick:()=>{m(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Em=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:Z("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},h={"--icon":`url(${qt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(zt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(zt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(zt,{options:d,children:l.text}):l.text},u)})})},at=()=>y.Fragment,_m=({children:e})=>c.jsx(Ot,{variant:"secondary",children:e}),km=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Fm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Bm=({children:e})=>{const t=se.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Fm.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 c.jsx(Xa,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Am=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Ot,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Ot,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Ot,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},Et=({children:e})=>c.jsx(c.Fragment,{children:e}),Tm=e=>{const t=se.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ne,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},lu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Sm=({children:e,...t})=>{const n=se.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||lu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&lu(a)==="button"&&(i=!0);else break}const s=`@${Sr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Cs=({children:e,...t})=>c.jsx("span",{className:Z({url:t==null?void 0:t.href}),children:e});const jm={default:{a:Sm,CollapsibleSection:Xa,TextBox:Ot,CaseStudy:_m,style:at,details:Bm,div:Am,iframe:Tm,center:km},"text-only":{h1:at,h2:at,h3:at,h4:at,h5:at,h6:at,style:at,details:at,div:at,TextBox:at,CollapsibleSection:at,CaseStudy:at,blockquote:at,iframe:at,button:at}},Fn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=jm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:Z("markdown-text",t,{"highlight-titles":s}),children:c.jsx(zt,{options:{...o,...n,overrides:l},children:r})})};const od=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:Z("page-heading",a),children:[c.jsxs("div",{className:Z("content",{"has-max-width":e}),style:i,children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Gt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${qt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=Qs(!!a),h=y.createElement(s,{className:Z("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...o});return a?c.jsxs("span",{className:"pill-wrapper",children:[h,c.jsx(Mn,{isOpen:u,accessibility:{readToScreenreadersWhenClosed:!0},children:a})]}):h};const Or=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:Z("status-banner text-small",n),"aria-live":"assertive"},t);const Om=({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,d={"--progress":`${t}%`};return c.jsx("span",{className:Z(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Ne,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Xs=y.memo(Om);const yi="loadingBlock_",Pm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=se.useIntl();t||(t={0:{text:r.formatMessage({id:`${yi}loading`})},75:{text:r.formatMessage({id:`${yi}almostDone`})},100:{text:r.formatMessage({id:`${yi}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(${qt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Ot,{className:Z("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(Xs,{progress:e})]})},Mm=y.memo(Pm);const Bt=({element:e="div",className:t="",...n})=>c.jsx(Qa,{element:e,className:Z("loading-placeholder",t),...n});const xs={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"]},ud=(e,t)=>e in xs?c.jsx("div",{className:e,children:xs[e].map((n,r)=>ud(n,r))},t):c.jsx(Bt,{className:e},t),eo=({layout:e="overview-page",...t})=>c.jsx("div",{className:Z("loading-state",e),...t,children:xs[e].map((n,r)=>ud(n,r))}),ld=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):""},Qr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Nm=e=>{const t=Math.ceil(26/Qr.length),n=ld(e).toLowerCase();if(n==="")return Qr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Qr.length;a++)if(r<=t*(a+1))return Qr[a]};const cu=256,mn=({className:e="",src:t="",name:n,alt:r,width:a=cu,height:i=cu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const m=d.current;if(!m)return;const g=m.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=f*window.devicePixelRatio,m.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Nm(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(ld(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:Z("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:h,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})},to=y.createContext({badges:[],isLoading:!0});function cd(){return y.useContext(to)}const dd=({children:e,badges:t})=>c.jsx(to.Provider,{value:t,children:e}),fd=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&c.jsx(Vh.ReactQueryDevtools,{initialIsOpen:!1})]})};var hd=y.createContext({client:ya});function Im(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.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&&(ya.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ya.init(r,a)),ya)},[n,r]);return y.createElement(hd.Provider,{value:{client:i}},t)}var Rm=function(){var e=y.useContext(hd).client;return e};function $m(e){var t=Rm(),n=y.useState(),r=n[0],a=n[1];return y.useEffect(function(){return t.onFeatureFlags(function(){a(t.getFeatureFlagPayload(e))})},[t,e]),r}const md=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Im,{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}):c.jsx(c.Fragment,{children:e});var no=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(no||{});const pd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...dm[r],...n||{}};return c.jsx(se.IntlProvider,{locale:r,messages:a,children:e})},ro=y.createContext({}),Ca={en:"English",es:"Español",fr:"Français",pt:"Português"},it=y.createContext({isLoading:!0});function ei(){return y.useContext(it)}const gd=({children:e,user:t,updateDetails:n})=>c.jsx(it.Provider,{value:{...t,updateDetails:n},children:e}),ao=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),vd=()=>y.useContext(ao),bd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(ao.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Lm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),h=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(i({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):i({...p,isLoading:!1}),Jc(5e3)}).catch(p=>{p.message===Yc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(ro.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(pd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(Ys.CookiesProvider,{children:c.jsx(gd,{user:a,updateDetails:i,children:c.jsx(dd,{badges:s,children:c.jsx(bd,{children:c.jsx(fd,{showDevTools:r,children:c.jsx(md,{user:a,children:t})})})})})})})})};var Xe=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(Xe||{});const ti=e=>e==="apolitical"?{image:`${qt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${qt}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,badges:e.badges},zm=({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=Xn(l,r)),l};const qm={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Wm=({slug:e})=>{const{badges:t}=cd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Gt,{className:Z("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&qm[a],element:"li",tooltip:s,children:r})};const Um=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(Wm,{slug:s},o))}))})},Hm=y.lazy(()=>Promise.resolve().then(()=>bm)),Vm=y.lazy(()=>Promise.resolve().then(()=>i_));let Jr=null;const Qt=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{const h=se.useIntl(),{profile:p,...m}=i,{size:g="medium",variant:f="inline",isCondensed:b=!0}=a,v=y.useContext(it),w=p&&v&&typeof v.id=="string",[A,_]=y.useState(!1),x=ti(t);x.name||(x.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:S}=x;let{url:z}=x;typeof t=="object"&&t.link!==void 0&&(t.link===!1?z=void 0:z=t.link);const M=zm(x),q=r&&r.createdAt?bs(r.createdAt):!1,I=r&&r.createdAt?Js(r.createdAt):"";return y.createElement(e,{...d,className:Z("member text-medium",g,f,l,{"has-profile-link":w}),...m,children:c.jsxs(c.Fragment,{children:[c.jsxs(fn,{href:z,gtmType:o,gtmContext:s,onClick:B=>{if(B==null||B.preventDefault(),B==null||B.stopPropagation(),!z)return;Jr&&clearTimeout(Jr),Jr=setTimeout(()=>{window.location.href=z},150);const E=new CustomEvent(Xe.MEMBER_CLICKED,{detail:{link:z,timeout:Jr}});document.dispatchEvent(E)},children:[c.jsx(mn,{name:T,src:S,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:"name","data-testid":"member-name",children:[T,(u==null?void 0:u.showBadges)&&(x==null?void 0:x.badges)&&c.jsx(Um,{userBadges:x.badges,badgeOptions:u}),r&&c.jsxs("span",{className:"additional-content",children:[r.createdAt&&q&&c.jsx("span",{className:"date",title:I,"aria-label":I,"data-testid":"date",children:h.formatMessage({id:`dates_${q.path}`},{number:q.number})}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),M&&c.jsx("small",{className:Z({"text-medium":g==="large"}),"data-testid":"member-details",children:b?M:c.jsxs(c.Fragment,{children:[x.role,x.organisation?` — ${x.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:x.country})]})})]})]}),M&&p&&w?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:B=>{B.preventDefault(),B.stopPropagation(),_(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(Hm,{children:c.jsx(Vm,{form:p,showModal:A,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{_(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},Km=Object.freeze(Object.defineProperty({__proto__:null,default:Qt},Symbol.toStringTag,{value:"Module"}));const du={small:24,medium:48},io=({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="",...d})=>{const h=se.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:Z("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let g,f="";if(m<o){const{name:b="",image:v=""}=ti(p);if(s)return c.jsx(Bt,{element:"li",className:"contributor"},m);g=c.jsx(mn,{name:b,src:v,width:du[a||"medium"],height:du[a||"medium"]})}else if(m===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:Z({"large-number":b>99}),children:["+",fm(b,0)]}),f="number-left"}return g?c.jsx("li",{className:Z("contributor",f),children:g},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):Xn(n[0].name||"",20):l||null})]})})};const so=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:Z("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var ws={exports:{}},Xr={exports:{}},Pe={};/** @license React v16.13.1
|
|
37
|
+
`))},[a]),y.useEffect(()=>{p==="ready-to-close"&&m("closing")},[p]);const g=({propertyName:b})=>{b==="max-height"&&m(v=>v==="opening"?"open":v==="closing"?"closed":v)},f=["opening","open"].includes(p);return c.jsxs(Pt,{variant:"subtle",className:V("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:V("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(qt,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":f}),onClick:()=>{m(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Em=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.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 d={wrapper:y.Fragment,forceInline:!0},h={"--icon":`url(${Wt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(qt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(qt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(qt,{options:d,children:l.text}):l.text},u)})})},at=()=>y.Fragment,_m=({children:e})=>c.jsx(Pt,{variant:"secondary",children:e}),km=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Fm=["span","strong","h1","h2","h3","h4","h5","h6","p"],Bm=({children:e})=>{const t=ie.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Fm.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 c.jsx(ei,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Am=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Pt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Pt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Pt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},_t=({children:e})=>c.jsx(c.Fragment,{children:e}),Tm=e=>{const t=ie.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ne,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},cu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Sm=({children:e,...t})=>{const n=ie.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||cu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&cu(a)==="button"&&(i=!0);else break}const s=`@${Sr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Cs=({children:e,...t})=>c.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const jm={default:{a:Sm,CollapsibleSection:ei,TextBox:Pt,CaseStudy:_m,style:at,details:Bm,div:Am,iframe:Tm,center:km},"text-only":{h1:at,h2:at,h3:at,h4:at,h5:at,h6:at,style:at,details:at,div:at,TextBox:at,CollapsibleSection:at,CaseStudy:at,blockquote:at,iframe:at,button:at}},Fn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=jm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:V("markdown-text",t,{"highlight-titles":s}),children:c.jsx(qt,{options:{...o,...n,overrides:l},children:r})})};const od=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:V("page-heading",a),children:[c.jsxs("div",{className:V("content",{"has-max-width":e}),style:i,children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Gt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Wt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=Js(!!a),h=y.createElement(s,{className:V("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...o});return a?c.jsxs("span",{className:"pill-wrapper",children:[h,c.jsx(Mn,{isOpen:u,accessibility:{readToScreenreadersWhenClosed:!0},children:a})]}):h};const Or=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t);const Om=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ie.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,d={"--progress":`${t}%`};return c.jsx("span",{className:V(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Ne,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},eo=y.memo(Om);const yi="loadingBlock_",Pm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ie.useIntl();t||(t={0:{text:r.formatMessage({id:`${yi}loading`})},75:{text:r.formatMessage({id:`${yi}almostDone`})},100:{text:r.formatMessage({id:`${yi}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(${Wt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Pt,{className:V("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(eo,{progress:e})]})},Mm=y.memo(Pm);const At=({element:e="div",className:t="",...n})=>c.jsx(Ja,{element:e,className:V("loading-placeholder",t),...n});const xs={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"]},ud=(e,t)=>e in xs?c.jsx("div",{className:e,children:xs[e].map((n,r)=>ud(n,r))},t):c.jsx(At,{className:e},t),to=({layout:e="overview-page",...t})=>c.jsx("div",{className:V("loading-state",e),...t,children:xs[e].map((n,r)=>ud(n,r))}),ld=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):""},Jr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Nm=e=>{const t=Math.ceil(26/Jr.length),n=ld(e).toLowerCase();if(n==="")return Jr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Jr.length;a++)if(r<=t*(a+1))return Jr[a]};const du=256,mn=({className:e="",src:t="",name:n,alt:r,width:a=du,height:i=du,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const m=d.current;if(!m)return;const g=m.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=f*window.devicePixelRatio,m.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Nm(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(ld(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:V("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:h,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})},no=y.createContext({badges:[],isLoading:!0});function cd(){return y.useContext(no)}const dd=({children:e,badges:t})=>c.jsx(no.Provider,{value:t,children:e}),fd=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&c.jsx(Vh.ReactQueryDevtools,{initialIsOpen:!1})]})};var hd=y.createContext({client:Da});function Im(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.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&&(Da.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Da.init(r,a)),Da)},[n,r]);return y.createElement(hd.Provider,{value:{client:i}},t)}var Rm=function(){var e=y.useContext(hd).client;return e};function $m(e){var t=Rm(),n=y.useState(),r=n[0],a=n[1];return y.useEffect(function(){return t.onFeatureFlags(function(){a(t.getFeatureFlagPayload(e))})},[t,e]),r}const md=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Im,{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}):c.jsx(c.Fragment,{children:e});var ro=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(ro||{});const pd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...dm[r],...n||{}};return c.jsx(ie.IntlProvider,{locale:r,messages:a,children:e})},ao=y.createContext({}),xa={en:"English",es:"Español",fr:"Français",pt:"Português"},it=y.createContext({isLoading:!0});function ti(){return y.useContext(it)}const gd=({children:e,user:t,updateDetails:n})=>c.jsx(it.Provider,{value:{...t,updateDetails:n},children:e}),io=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),vd=()=>y.useContext(io),bd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(io.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Lm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),h=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(i({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):i({...p,isLoading:!1}),Jc(5e3)}).catch(p=>{p.message===Yc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(ao.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(pd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(Gs.CookiesProvider,{children:c.jsx(gd,{user:a,updateDetails:i,children:c.jsx(dd,{badges:s,children:c.jsx(bd,{children:c.jsx(fd,{showDevTools:r,children:c.jsx(md,{user:a,children:t})})})})})})})})};var Xe=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(Xe||{});const ni=e=>e==="apolitical"?{image:`${Wt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Wt}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,badges:e.badges},zm=({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=Xn(l,r)),l};const qm={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Wm=({slug:e})=>{const{badges:t}=cd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Gt,{className:V("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&qm[a],element:"li",tooltip:s,children:r})};const Um=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(Wm,{slug:s},o))}))})},Hm=y.lazy(()=>Promise.resolve().then(()=>bm)),Vm=y.lazy(()=>Promise.resolve().then(()=>i_));let Xr=null;const Qt=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{const h=ie.useIntl(),{profile:p,...m}=i,{size:g="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:v=!1}=a,x=y.useContext(it),k=p&&x&&typeof x.id=="string",[_,w]=y.useState(!1),F=ni(t);F.name||(F.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:S,image:q}=F;let{url:N}=F;typeof t=="object"&&t.link!==void 0&&(t.link===!1?N=void 0:N=t.link);const z=zm(F),I=r&&r.createdAt?bs(r.createdAt):!1,A=r&&r.createdAt?Xs(r.createdAt):"";return y.createElement(e,{...d,className:V("member text-medium",g,f,l,{"has-profile-link":k}),...m,children:c.jsxs(c.Fragment,{children:[c.jsxs(fn,{href:N,gtmType:o,gtmContext:s,onClick:E=>{if(E==null||E.preventDefault(),E==null||E.stopPropagation(),!N)return;Xr&&clearTimeout(Xr),Xr=setTimeout(()=>{window.location.href=N},150);const j=new CustomEvent(Xe.MEMBER_CLICKED,{detail:{link:N,timeout:Xr}});document.dispatchEvent(j)},children:[c.jsx(mn,{name:S,src:q,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:V("name",{"new-line":v}),"data-testid":"member-name",children:[c.jsx("span",{children:S}),(u==null?void 0:u.showBadges)&&(F==null?void 0:F.badges)&&c.jsx(Um,{userBadges:F.badges,badgeOptions:u}),r&&c.jsxs("span",{className:V("additional-content",{"new-line":v}),children:[r.createdAt&&I&&c.jsx("span",{className:"date",title:A,"aria-label":A,"data-testid":"date",children:h.formatMessage({id:`dates_${I.path}`},{number:I.number})}),r.customMessage&&c.jsx("span",{children:r.customMessage}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),z&&!v&&c.jsx("small",{className:V({"text-medium":g==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[F.role,F.organisation?` — ${F.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:F.country})]})})]})]}),z&&p&&k?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:E=>{E.preventDefault(),E.stopPropagation(),w(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(Hm,{children:c.jsx(Vm,{form:p,showModal:_,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{w(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},Km=Object.freeze(Object.defineProperty({__proto__:null,default:Qt},Symbol.toStringTag,{value:"Module"}));const fu={small:24,medium:48},so=({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="",...d})=>{const h=ie.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:V("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let g,f="";if(m<o){const{name:b="",image:v=""}=ni(p);if(s)return c.jsx(At,{element:"li",className:"contributor"},m);g=c.jsx(mn,{name:b,src:v,width:fu[a||"medium"],height:fu[a||"medium"]})}else if(m===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:V({"large-number":b>99}),children:["+",fm(b,0)]}),f="number-left"}return g?c.jsx("li",{className:V("contributor",f),children:g},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):Xn(n[0].name||"",20):l||null})]})})};const oo=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:V("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var ws={exports:{}},ea={exports:{}},Pe={};/** @license React v16.13.1
|
|
38
38
|
* react-is.production.min.js
|
|
39
39
|
*
|
|
40
40
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/var
|
|
44
|
+
*/var hu;function Zm(){if(hu)return Pe;hu=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,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=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 F=w.$$typeof;switch(F){case t:switch(w=w.type,w){case l:case u:case r:case i:case a:case h:return w;default:switch(w=w&&w.$$typeof,w){case o:case d:case g:case m:case s:return w;default:return F}}case n:return F}}}function _(w){return k(w)===u}return Pe.AsyncMode=l,Pe.ConcurrentMode=u,Pe.ContextConsumer=o,Pe.ContextProvider=s,Pe.Element=t,Pe.ForwardRef=d,Pe.Fragment=r,Pe.Lazy=g,Pe.Memo=m,Pe.Portal=n,Pe.Profiler=i,Pe.StrictMode=a,Pe.Suspense=h,Pe.isAsyncMode=function(w){return _(w)||k(w)===l},Pe.isConcurrentMode=_,Pe.isContextConsumer=function(w){return k(w)===o},Pe.isContextProvider=function(w){return k(w)===s},Pe.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===t},Pe.isForwardRef=function(w){return k(w)===d},Pe.isFragment=function(w){return k(w)===r},Pe.isLazy=function(w){return k(w)===g},Pe.isMemo=function(w){return k(w)===m},Pe.isPortal=function(w){return k(w)===n},Pe.isProfiler=function(w){return k(w)===i},Pe.isStrictMode=function(w){return k(w)===a},Pe.isSuspense=function(w){return k(w)===h},Pe.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===u||w===i||w===a||w===h||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===m||w.$$typeof===s||w.$$typeof===o||w.$$typeof===d||w.$$typeof===b||w.$$typeof===v||w.$$typeof===x||w.$$typeof===f)},Pe.typeOf=k,Pe}var Me={};/** @license React v16.13.1
|
|
45
45
|
* react-is.development.js
|
|
46
46
|
*
|
|
47
47
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the MIT license found in the
|
|
50
50
|
* LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/var
|
|
51
|
+
*/var mu;function Ym(){return mu||(mu=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,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function k(Q){return typeof Q=="string"||typeof Q=="function"||Q===r||Q===u||Q===i||Q===a||Q===h||Q===p||typeof Q=="object"&&Q!==null&&(Q.$$typeof===g||Q.$$typeof===m||Q.$$typeof===s||Q.$$typeof===o||Q.$$typeof===d||Q.$$typeof===b||Q.$$typeof===v||Q.$$typeof===x||Q.$$typeof===f)}function _(Q){if(typeof Q=="object"&&Q!==null){var ve=Q.$$typeof;switch(ve){case t:var pe=Q.type;switch(pe){case l:case u:case r:case i:case a:case h:return pe;default:var _e=pe&&pe.$$typeof;switch(_e){case o:case d:case g:case m:case s:return _e;default:return ve}}case n:return ve}}}var w=l,F=u,S=o,q=s,N=t,z=d,I=r,A=g,E=m,j=n,R=i,W=a,H=h,G=!1;function ne(Q){return G||(G=!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.")),C(Q)||_(Q)===l}function C(Q){return _(Q)===u}function L(Q){return _(Q)===o}function ee(Q){return _(Q)===s}function B(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===t}function T(Q){return _(Q)===d}function O(Q){return _(Q)===r}function $(Q){return _(Q)===g}function U(Q){return _(Q)===m}function re(Q){return _(Q)===n}function X(Q){return _(Q)===i}function ae(Q){return _(Q)===a}function he(Q){return _(Q)===h}Me.AsyncMode=w,Me.ConcurrentMode=F,Me.ContextConsumer=S,Me.ContextProvider=q,Me.Element=N,Me.ForwardRef=z,Me.Fragment=I,Me.Lazy=A,Me.Memo=E,Me.Portal=j,Me.Profiler=R,Me.StrictMode=W,Me.Suspense=H,Me.isAsyncMode=ne,Me.isConcurrentMode=C,Me.isContextConsumer=L,Me.isContextProvider=ee,Me.isElement=B,Me.isForwardRef=T,Me.isFragment=O,Me.isLazy=$,Me.isMemo=U,Me.isPortal=re,Me.isProfiler=X,Me.isStrictMode=ae,Me.isSuspense=he,Me.isValidElementType=k,Me.typeOf=_}()),Me}var pu;function yd(){return pu||(pu=1,process.env.NODE_ENV==="production"?ea.exports=Zm():ea.exports=Ym()),ea.exports}/*
|
|
52
52
|
object-assign
|
|
53
53
|
(c) Sindre Sorhus
|
|
54
54
|
@license MIT
|
|
55
|
-
*/var Di,
|
|
56
|
-
Valid keys: `+JSON.stringify(Object.keys(C),null," "));var Q=
|
|
55
|
+
*/var Di,gu;function Gm(){if(gu)return Di;gu=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(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Di=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},Di}var Ci,vu;function uo(){if(vu)return Ci;vu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ci=e,Ci}var xi,bu;function Dd(){return bu||(bu=1,xi=Function.call.bind(Object.prototype.hasOwnProperty)),xi}var wi,yu;function Qm(){if(yu)return wi;yu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=uo(),n={},r=Dd();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 d in i)if(r(i,d)){var h;try{if(typeof i[d]!="function"){var p=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=i[d](s,d,l,o,null,t)}catch(g){h=g}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var m=u?u():"";e("Failed "+o+" type: "+h.message+(m??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},wi=a,wi}var Ei,Du;function Jm(){if(Du)return Ei;Du=1;var e=yd(),t=Gm(),n=uo(),r=Dd(),a=Qm(),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 Ei=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(C){var L=C&&(u&&C[u]||C[d]);if(typeof L=="function")return L}var p="<<anonymous>>",m={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:_(),elementType:w(),instanceOf:F,node:z(),objectOf:q,oneOf:S,oneOfType:N,shape:A,exact:E};function g(C,L){return C===L?C!==0||1/C===1/L:C!==C&&L!==L}function f(C,L){this.message=C,this.data=L&&typeof L=="object"?L:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var L={},ee=0;function B(O,$,U,re,X,ae,he){if(re=re||p,ae=ae||U,he!==n){if(l){var Q=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw Q.name="Invariant Violation",Q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=re+":"+U;!L[ve]&&ee<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ae+"` prop on `"+re+"`. 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."),L[ve]=!0,ee++)}}return $[U]==null?O?$[U]===null?new f("The "+X+" `"+ae+"` is marked as required "+("in `"+re+"`, but its value is `null`.")):new f("The "+X+" `"+ae+"` is marked as required in "+("`"+re+"`, but its value is `undefined`.")):null:C($,U,re,X,ae)}var T=B.bind(null,!1);return T.isRequired=B.bind(null,!0),T}function v(C){function L(ee,B,T,O,$,U){var re=ee[B],X=W(re);if(X!==C){var ae=H(re);return new f("Invalid "+O+" `"+$+"` of type "+("`"+ae+"` supplied to `"+T+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(L)}function x(){return b(s)}function k(C){function L(ee,B,T,O,$){if(typeof C!="function")return new f("Property `"+$+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var U=ee[B];if(!Array.isArray(U)){var re=W(U);return new f("Invalid "+O+" `"+$+"` of type "+("`"+re+"` supplied to `"+T+"`, expected an array."))}for(var X=0;X<U.length;X++){var ae=C(U,X,T,O,$+"["+X+"]",n);if(ae instanceof Error)return ae}return null}return b(L)}function _(){function C(L,ee,B,T,O){var $=L[ee];if(!o($)){var U=W($);return new f("Invalid "+T+" `"+O+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return b(C)}function w(){function C(L,ee,B,T,O){var $=L[ee];if(!e.isValidElementType($)){var U=W($);return new f("Invalid "+T+" `"+O+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return b(C)}function F(C){function L(ee,B,T,O,$){if(!(ee[B]instanceof C)){var U=C.name||p,re=ne(ee[B]);return new f("Invalid "+O+" `"+$+"` of type "+("`"+re+"` supplied to `"+T+"`, expected ")+("instance of `"+U+"`."))}return null}return b(L)}function S(C){if(!Array.isArray(C))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 L(ee,B,T,O,$){for(var U=ee[B],re=0;re<C.length;re++)if(g(U,C[re]))return null;var X=JSON.stringify(C,function(he,Q){var ve=H(Q);return ve==="symbol"?String(Q):Q});return new f("Invalid "+O+" `"+$+"` of value `"+String(U)+"` "+("supplied to `"+T+"`, expected one of "+X+"."))}return b(L)}function q(C){function L(ee,B,T,O,$){if(typeof C!="function")return new f("Property `"+$+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var U=ee[B],re=W(U);if(re!=="object")return new f("Invalid "+O+" `"+$+"` of type "+("`"+re+"` supplied to `"+T+"`, expected an object."));for(var X in U)if(r(U,X)){var ae=C(U,X,T,O,$+"."+X,n);if(ae instanceof Error)return ae}return null}return b(L)}function N(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var L=0;L<C.length;L++){var ee=C[L];if(typeof ee!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+G(ee)+" at index "+L+"."),s}function B(T,O,$,U,re){for(var X=[],ae=0;ae<C.length;ae++){var he=C[ae],Q=he(T,O,$,U,re,n);if(Q==null)return null;Q.data&&r(Q.data,"expectedType")&&X.push(Q.data.expectedType)}var ve=X.length>0?", expected one of type ["+X.join(", ")+"]":"";return new f("Invalid "+U+" `"+re+"` supplied to "+("`"+$+"`"+ve+"."))}return b(B)}function z(){function C(L,ee,B,T,O){return j(L[ee])?null:new f("Invalid "+T+" `"+O+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return b(C)}function I(C,L,ee,B,T){return new f((C||"React class")+": "+L+" type `"+ee+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function A(C){function L(ee,B,T,O,$){var U=ee[B],re=W(U);if(re!=="object")return new f("Invalid "+O+" `"+$+"` of type `"+re+"` "+("supplied to `"+T+"`, expected `object`."));for(var X in C){var ae=C[X];if(typeof ae!="function")return I(T,O,$,X,H(ae));var he=ae(U,X,T,O,$+"."+X,n);if(he)return he}return null}return b(L)}function E(C){function L(ee,B,T,O,$){var U=ee[B],re=W(U);if(re!=="object")return new f("Invalid "+O+" `"+$+"` of type `"+re+"` "+("supplied to `"+T+"`, expected `object`."));var X=t({},ee[B],C);for(var ae in X){var he=C[ae];if(r(C,ae)&&typeof he!="function")return I(T,O,$,ae,H(he));if(!he)return new f("Invalid "+O+" `"+$+"` key `"+ae+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(ee[B],null," ")+`
|
|
56
|
+
Valid keys: `+JSON.stringify(Object.keys(C),null," "));var Q=he(U,ae,T,O,$+"."+ae,n);if(Q)return Q}return null}return b(L)}function j(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(j);if(C===null||o(C))return!0;var L=h(C);if(L){var ee=L.call(C),B;if(L!==C.entries){for(;!(B=ee.next()).done;)if(!j(B.value))return!1}else for(;!(B=ee.next()).done;){var T=B.value;if(T&&!j(T[1]))return!1}}else return!1;return!0;default:return!1}}function R(C,L){return C==="symbol"?!0:L?L["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&L instanceof Symbol:!1}function W(C){var L=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":R(L,C)?"symbol":L}function H(C){if(typeof C>"u"||C===null)return""+C;var L=W(C);if(L==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return L}function G(C){var L=H(C);switch(L){case"array":case"object":return"an "+L;case"boolean":case"date":case"regexp":return"a "+L;default:return L}}function ne(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return m.checkPropTypes=a,m.resetWarningCache=a.resetWarningCache,m.PropTypes=m,m},Ei}var _i,Cu;function Xm(){if(Cu)return _i;Cu=1;var e=uo();function t(){}function n(){}return n.resetWarningCache=t,_i=function(){function r(s,o,l,u,d,h){if(h!==e){var p=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 p.name="Invariant Violation",p}}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},_i}if(process.env.NODE_ENV!=="production"){var ep=yd(),tp=!0;ws.exports=Jm()(ep.isElement,tp)}else ws.exports=Xm()();var np=ws.exports;/*!
|
|
57
57
|
* tabbable 6.2.0
|
|
58
58
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
59
|
-
*/var Cd=["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])"],
|
|
59
|
+
*/var Cd=["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])"],ja=Cd.join(","),xd=typeof Element>"u",Bn=xd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Oa=!xd&&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},Pa=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},rp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},wd=function(t,n,r){if(Pa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(ja));return n&&Bn.call(t,ja)&&a.unshift(t),a=a.filter(r),a},Ed=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Pa(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 d=Bn.call(s,ja);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Pa(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var m=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:s,candidates:m})}else i.unshift.apply(i,s.children)}}return a},_d=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},un=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||rp(t))&&!_d(t)?0:t.tabIndex},ap=function(t,n){var r=un(t);return r<0&&n&&!_d(t)?0:r},ip=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},kd=function(t){return t.tagName==="INPUT"},sp=function(t){return kd(t)&&t.type==="hidden"},op=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},up=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},lp=function(t){if(!t.name)return!0;var n=t.form||Oa(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=up(a,t.form);return!i||i===t},cp=function(t){return kd(t)&&t.type==="radio"},dp=function(t){return cp(t)&&!lp(t)},fp=function(t){var n,r=t&&Oa(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,d,h;r=Oa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(a))}}return i},xu=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},hp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Bn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Bn.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=Oa(t);if(l&&!l.shadowRoot&&a(l)===!0)return xu(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(fp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return xu(t);return!1},mp=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 Bn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ma=function(t,n){return!(n.disabled||Pa(n)||sp(n)||hp(n,t)||op(n)||mp(n))},Es=function(t,n){return!(dp(n)||un(n)<0||!Ma(t,n))},pp=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gp=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=ap(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(ip).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Fd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ed([t],n.includeContainer,{filter:Es.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:pp}):r=wd(t,n.includeContainer,Es.bind(null,n)),gp(r)},Bd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ed([t],n.includeContainer,{filter:Ma.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=wd(t,n.includeContainer,Ma.bind(null,n)),r},yn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,ja)===!1?!1:Es(n,t)},vp=Cd.concat("iframe").join(","),wa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,vp)===!1?!1:Ma(n,t)};const bp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Bd,getTabIndex:un,isFocusable:wa,isTabbable:yn,tabbable:Fd},Symbol.toStringTag,{value:"Module"}));/*!
|
|
60
60
|
* focus-trap 7.5.4
|
|
61
61
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
62
|
-
*/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 wu(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){yp(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}function yp(e,t,n){return t=Cp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dp(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 Cp(e){var t=Dp(e,"string");return typeof t=="symbol"?t:String(t)}var Eu={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()}},xp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},wp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},wr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Ep=function(t){return wr(t)&&!t.shiftKey},_p=function(t){return wr(t)&&t.shiftKey},_u=function(t){return setTimeout(t,0)},ku=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},hr=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},ea=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},kp=[],Fp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||kp,i=wu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ep,isKeyBackward:_p},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(B,E,j){return B&&B[E]!==void 0?B[E]:i[j||E]},u=function(B,E){var j=typeof(E==null?void 0:E.composedPath)=="function"?E.composedPath():void 0;return s.containerGroups.findIndex(function(N){var W=N.container,H=N.tabbableNodes;return W.contains(B)||(j==null?void 0:j.includes(W))||H.find(function(G){return G===B})})},d=function(B){var E=i[B];if(typeof E=="function"){for(var j=arguments.length,N=new Array(j>1?j-1:0),W=1;W<j;W++)N[W-1]=arguments[W];E=E.apply(void 0,N)}if(E===!0&&(E=void 0),!E){if(E===void 0||E===!1)return E;throw new Error("`".concat(B,"` was specified but was not a node, or did not return a node"))}var H=E;if(typeof E=="string"&&(H=r.querySelector(E),!H))throw new Error("`".concat(B,"` as selector refers to no known node"));return H},h=function(){var B=d("initialFocus");if(B===!1)return!1;if(B===void 0||!xa(B,i.tabbableOptions))if(u(r.activeElement)>=0)B=r.activeElement;else{var E=s.tabbableGroups[0],j=E&&E.firstTabbableNode;B=j||d("fallbackFocus")}if(!B)throw new Error("Your focus-trap needs to have at least one focusable element");return B},p=function(){if(s.containerGroups=s.containers.map(function(B){var E=Fd(B,i.tabbableOptions),j=Bd(B,i.tabbableOptions),N=E.length>0?E[0]:void 0,W=E.length>0?E[E.length-1]:void 0,H=j.find(function(C){return yn(C)}),G=j.slice().reverse().find(function(C){return yn(C)}),re=!!E.find(function(C){return un(C)>0});return{container:B,tabbableNodes:E,focusableNodes:j,posTabIndexesFound:re,firstTabbableNode:N,lastTabbableNode:W,firstDomTabbableNode:H,lastDomTabbableNode:G,nextTabbableNode:function(L){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,F=E.indexOf(L);return F<0?ee?j.slice(j.indexOf(L)+1).find(function(k){return yn(k)}):j.slice(0,j.indexOf(L)).reverse().find(function(k){return yn(k)}):E[F+(ee?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(B){return B.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(B){return B.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.")},m=function I(B){var E=B.activeElement;if(E)return E.shadowRoot&&E.shadowRoot.activeElement!==null?I(E.shadowRoot):E},g=function I(B){if(B!==!1&&B!==m(document)){if(!B||!B.focus){I(h());return}B.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=B,xp(B)&&B.select()}},f=function(B){var E=d("setReturnFocus",B);return E||(E===!1?!1:B)},b=function(B){var E=B.target,j=B.event,N=B.isBackward,W=N===void 0?!1:N;E=E||ea(j),p();var H=null;if(s.tabbableGroups.length>0){var G=u(E,j),re=G>=0?s.containerGroups[G]:void 0;if(G<0)W?H=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:H=s.tabbableGroups[0].firstTabbableNode;else if(W){var C=ku(s.tabbableGroups,function(R){var U=R.firstTabbableNode;return E===U});if(C<0&&(re.container===E||xa(E,i.tabbableOptions)&&!yn(E,i.tabbableOptions)&&!re.nextTabbableNode(E,!1))&&(C=G),C>=0){var L=C===0?s.tabbableGroups.length-1:C-1,ee=s.tabbableGroups[L];H=un(E)>=0?ee.lastTabbableNode:ee.lastDomTabbableNode}else wr(j)||(H=re.nextTabbableNode(E,!1))}else{var F=ku(s.tabbableGroups,function(R){var U=R.lastTabbableNode;return E===U});if(F<0&&(re.container===E||xa(E,i.tabbableOptions)&&!yn(E,i.tabbableOptions)&&!re.nextTabbableNode(E))&&(F=G),F>=0){var k=F===s.tabbableGroups.length-1?0:F+1,$=s.tabbableGroups[k];H=un(E)>=0?$.firstTabbableNode:$.firstDomTabbableNode}else wr(j)||(H=re.nextTabbableNode(E))}}else H=d("fallbackFocus");return H},v=function(B){var E=ea(B);if(!(u(E,B)>=0)){if(hr(i.clickOutsideDeactivates,B)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}hr(i.allowOutsideClick,B)||B.preventDefault()}},w=function(B){var E=ea(B),j=u(E,B)>=0;if(j||E instanceof Document)j&&(s.mostRecentlyFocusedNode=E);else{B.stopImmediatePropagation();var N,W=!0;if(s.mostRecentlyFocusedNode)if(un(s.mostRecentlyFocusedNode)>0){var H=u(s.mostRecentlyFocusedNode),G=s.containerGroups[H].tabbableNodes;if(G.length>0){var re=G.findIndex(function(C){return C===s.mostRecentlyFocusedNode});re>=0&&(i.isKeyForward(s.recentNavEvent)?re+1<G.length&&(N=G[re+1],W=!1):re-1>=0&&(N=G[re-1],W=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(L){return un(L)>0})})||(W=!1);else W=!1;W&&(N=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(N||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},A=function(B){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=B;var j=b({event:B,isBackward:E});j&&(wr(B)&&B.preventDefault(),g(j))},_=function(B){if(wp(B)&&hr(i.escapeDeactivates,B)!==!1){B.preventDefault(),o.deactivate();return}(i.isKeyForward(B)||i.isKeyBackward(B))&&A(B,i.isKeyBackward(B))},x=function(B){var E=ea(B);u(E,B)>=0||hr(i.clickOutsideDeactivates,B)||hr(i.allowOutsideClick,B)||(B.preventDefault(),B.stopImmediatePropagation())},T=function(){if(s.active)return Eu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?_u(function(){g(h())}):g(h()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",x,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",x,!0),r.removeEventListener("keydown",_,!0),o},z=function(B){var E=B.some(function(j){var N=Array.from(j.removedNodes);return N.some(function(W){return W===s.mostRecentlyFocusedNode})});E&&g(h())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,q=function(){M&&(M.disconnect(),s.active&&!s.paused&&s.containers.map(function(B){M.observe(B,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(B){if(s.active)return this;var E=l(B,"onActivate"),j=l(B,"onPostActivate"),N=l(B,"checkCanFocusTrap");N||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,E==null||E();var W=function(){N&&p(),T(),q(),j==null||j()};return N?(N(s.containers.concat()).then(W,W),this):(W(),this)},deactivate:function(B){if(!s.active)return this;var E=wu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},B);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,q(),Eu.deactivateTrap(a,o);var j=l(E,"onDeactivate"),N=l(E,"onPostDeactivate"),W=l(E,"checkCanReturnFocus"),H=l(E,"returnFocus","returnFocusOnDeactivate");j==null||j();var G=function(){_u(function(){H&&g(f(s.nodeFocusedBeforeActivation)),N==null||N()})};return H&&W?(W(f(s.nodeFocusedBeforeActivation)).then(G,G),this):(G(),this)},pause:function(B){if(s.paused||!s.active)return this;var E=l(B,"onPause"),j=l(B,"onPostPause");return s.paused=!0,E==null||E(),S(),q(),j==null||j(),this},unpause:function(B){if(!s.paused||!s.active)return this;var E=l(B,"onUnpause"),j=l(B,"onPostUnpause");return s.paused=!1,E==null||E(),p(),T(),q(),j==null||j(),this},updateContainerElements:function(B){var E=[].concat(B).filter(Boolean);return s.containers=E.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),q(),this}},o.updateContainerElements(t),o};const Bp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Fp},Symbol.toStringTag,{value:"Module"})),Ap=Rc(Bp),Tp=Rc(bp);function tr(e){"@babel/helpers - typeof";return tr=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},tr(e)}function Sp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fu(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,Ad(r.key),r)}}function jp(e,t,n){return t&&Fu(e.prototype,t),n&&Fu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Op(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&&_s(e,t)}function _s(e,t){return _s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},_s(e,t)}function Pp(e){var t=Np();return function(){var r=Ma(e),a;if(t){var i=Ma(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Mp(this,a)}}function Mp(e,t){if(t&&(tr(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 Np(){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 Ma(e){return Ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ma(e)}function Ip(e,t,n){return t=Ad(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ad(e){var t=Rp(e,"string");return tr(t)==="symbol"?t:String(t)}function Rp(e,t){if(tr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(tr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ta=y,ge=np,$p=Ap,Lp=$p.createFocusTrap,zp=Tp,qp=zp.isFocusable,uo=function(e){Op(n,e);var t=Pp(n);function n(r){var a;Sp(this,n),a=t.call(this,r),Ip(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 d=arguments.length,h=new Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var g;if(m=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),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 jp(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&&!qp(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),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?ta.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ta.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 d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ta.cloneElement(i,{ref:s});return o}return null}}]),n}(ta.Component),mr=typeof Element>"u"?Function:Element;uo.propTypes={active:ge.bool,paused:ge.bool,focusTrapOptions:ge.shape({document:ge.object,onActivate:ge.func,onPostActivate:ge.func,checkCanFocusTrap:ge.func,onPause:ge.func,onPostPause:ge.func,onUnpause:ge.func,onPostUnpause:ge.func,onDeactivate:ge.func,onPostDeactivate:ge.func,checkCanReturnFocus:ge.func,initialFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.bool,ge.func]),fallbackFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.func]),escapeDeactivates:ge.oneOfType([ge.bool,ge.func]),clickOutsideDeactivates:ge.oneOfType([ge.bool,ge.func]),returnFocusOnDeactivate:ge.bool,setReturnFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.bool,ge.func]),allowOutsideClick:ge.oneOfType([ge.bool,ge.func]),preventScroll:ge.bool,tabbableOptions:ge.shape({displayCheck:ge.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ge.oneOfType([ge.bool,ge.func])}),trapStack:ge.array,isKeyForward:ge.func,isKeyBackward:ge.func}),containerElements:ge.arrayOf(ge.instanceOf(mr)),children:ge.oneOfType([ge.element,ge.instanceOf(mr)])};uo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Lp};var Wp=uo;const Up=On(Wp);const pn=({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:d="",gtmContext:h="Modal"})=>{const p=se.useIntl(),{registerOverlay:m,unregisterOverlay:g}=vd(),[f,b]=y.useState(t),[v,w]=y.useState(null),A=y.useRef(null),_=M=>{f&&M.key==="Escape"&&S(!1)},x=M=>{w(M.target)},T=M=>{v===A.current&&M.target===A.current&&S(!1),w(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",_),()=>{window.removeEventListener("keyup",_)}},[f]),y.useEffect(()=>{const M=A.current;return M&&(M.addEventListener("mousedown",x),M.addEventListener("mouseup",T)),()=>{M&&(M.removeEventListener("mousedown",x),M.removeEventListener("mouseup",T))}},[v]);const S=M=>{if(b(M),M)a(),m(e);else{if(f===M)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const z=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:A,className:Z("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(so,{id:e,className:Z("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:z,children:t&&c.jsx(Up,{containerElements:[A.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Wt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Wt,{}),c.jsx(or,{buttons:u})]}),s&&c.jsx(Or,{className:"error",children:s})]})})})})},Td=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const pr="joinCommunityButton",lo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=se.useIntl(),o=y.useContext(it),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[p,m]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${pr}_leave`}),g["aria-label"]=s.formatMessage({id:`${pr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${pr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),m(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${pr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const w=d?i:a;typeof w=="function"&&setTimeout(async()=>{await w()},500),h(!d)},className:Z("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${pr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const ki="communityDetails_",Hp=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=se.useIntl(),{id:u}=y.useContext(it),d=u,h=5,p=a||i.length,m=i.length?i:Array(h).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:Z("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${ki}members`}),c.jsx("span",{className:"count",children:p})]}),g?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${ki}viewAll`})})})]}),d&&c.jsx(io,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:p===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(lo,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${ki}invite`})})]}):c.jsx(c.Fragment,{})]})};const Vp=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ne,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:Z("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Ne,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(fn,{href:s?void 0:i,...l,children:Xn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Kp=({variant:e="default",data:{image:t,url:n,title:r,description:a},gtm:i})=>{const s=n.split("//")[1].split("/")[0],{context:o="EnrichedLink",event:l="enriched-link-click"}=i??{};return c.jsxs("aside",{className:Z("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:u=>{u.preventDefault(),u.stopPropagation(),window.location.href=n},"data-gtm-event-context":o,"data-gtm-event-type":l,children:[c.jsx("small",{children:s}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{href:n,target:"_blank",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const Zp=({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]=y.useState(t?["all"]:[]),u=(d,h)=>{let p=[];o.includes(d)?p=o.filter(m=>m!==d):d==="all"?p=["all"]:n?p=[...o.filter(m=>m!=="all"),d]:p=[d],l(m=>(r&&typeof r=="function"&&r({current:p,previous:m}),p)),h&&typeof h=="function"&&h()};return c.jsx("ul",{className:Z("filters",a),children:s.map(({id:d,text:h,disabled:p=!1,callback:m=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),c.jsx("li",{children:c.jsx("button",{className:Z(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,m)},...g,children:h})},d)})})},Yp=(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 na="languageSwitcher_",Gp=({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:d=()=>{}}=y.useContext(ro),[h,p]=y.useState(e);if(y.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=h!==e;return c.jsxs("div",{className:Z("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${na}label`})}),c.jsx("ul",{children:g.map(b=>{var A;if(!Ca[b])return null;const v=(A=r[b])==null?void 0:A.post_name;let w={className:b};if(h===b)w["aria-label"]=u.formatMessage({id:`${na}selected`},{language:Ca[b]});else{const _=Yp(b,v,i);w={...w,href:typeof _=="string"?_:_.url,onClick:x=>{p(b),d(b),typeof a<"u"&&(x.preventDefault(),x.stopPropagation(),a(b,typeof _=="string"?_:_.urlForRouter))}}}return c.jsx("li",{children:c.jsx(fn,{...w,fallbackElement:"span",children:Ca[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Un.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Fi=se.createIntl({locale:"en",messages:sr}),Hr=({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:Fi.formatMessage({id:"loadMore_button"}),endOfFeed:Fi.formatMessage({id:"loadMore_endOfFeed"}),error:Fi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),p=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:Z("load-more",l),children:!d&&e?c.jsx(Ee,{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&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const co=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:Z("logo",e,t,n),...r,children:c.jsx(Ne,{children:c.jsx(se.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Sd=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=se.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:Z("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{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"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},g)=>{const f={...m,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Qp=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Jp=y.lazy(()=>Promise.resolve().then(()=>Km)),Xp=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],jd=({activeLink:e,profile:t})=>{const n=se.useIntl(),r=y.useContext(it),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Xp.map(({key:i,href:s})=>{const o=Qp(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:Z(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(Jp,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},gr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,eg=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${gr(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(`${gr(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(`${gr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
62
|
+
*/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 Eu(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){yp(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}function yp(e,t,n){return t=Cp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dp(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 Cp(e){var t=Dp(e,"string");return typeof t=="symbol"?t:String(t)}var _u={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()}},xp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},wp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},wr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Ep=function(t){return wr(t)&&!t.shiftKey},_p=function(t){return wr(t)&&t.shiftKey},ku=function(t){return setTimeout(t,0)},Fu=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},hr=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},ta=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},kp=[],Fp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||kp,i=Eu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ep,isKeyBackward:_p},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(A,E,j){return A&&A[E]!==void 0?A[E]:i[j||E]},u=function(A,E){var j=typeof(E==null?void 0:E.composedPath)=="function"?E.composedPath():void 0;return s.containerGroups.findIndex(function(R){var W=R.container,H=R.tabbableNodes;return W.contains(A)||(j==null?void 0:j.includes(W))||H.find(function(G){return G===A})})},d=function(A){var E=i[A];if(typeof E=="function"){for(var j=arguments.length,R=new Array(j>1?j-1:0),W=1;W<j;W++)R[W-1]=arguments[W];E=E.apply(void 0,R)}if(E===!0&&(E=void 0),!E){if(E===void 0||E===!1)return E;throw new Error("`".concat(A,"` was specified but was not a node, or did not return a node"))}var H=E;if(typeof E=="string"&&(H=r.querySelector(E),!H))throw new Error("`".concat(A,"` as selector refers to no known node"));return H},h=function(){var A=d("initialFocus");if(A===!1)return!1;if(A===void 0||!wa(A,i.tabbableOptions))if(u(r.activeElement)>=0)A=r.activeElement;else{var E=s.tabbableGroups[0],j=E&&E.firstTabbableNode;A=j||d("fallbackFocus")}if(!A)throw new Error("Your focus-trap needs to have at least one focusable element");return A},p=function(){if(s.containerGroups=s.containers.map(function(A){var E=Fd(A,i.tabbableOptions),j=Bd(A,i.tabbableOptions),R=E.length>0?E[0]:void 0,W=E.length>0?E[E.length-1]:void 0,H=j.find(function(C){return yn(C)}),G=j.slice().reverse().find(function(C){return yn(C)}),ne=!!E.find(function(C){return un(C)>0});return{container:A,tabbableNodes:E,focusableNodes:j,posTabIndexesFound:ne,firstTabbableNode:R,lastTabbableNode:W,firstDomTabbableNode:H,lastDomTabbableNode:G,nextTabbableNode:function(L){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=E.indexOf(L);return B<0?ee?j.slice(j.indexOf(L)+1).find(function(T){return yn(T)}):j.slice(0,j.indexOf(L)).reverse().find(function(T){return yn(T)}):E[B+(ee?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(A){return A.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(A){return A.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.")},m=function I(A){var E=A.activeElement;if(E)return E.shadowRoot&&E.shadowRoot.activeElement!==null?I(E.shadowRoot):E},g=function I(A){if(A!==!1&&A!==m(document)){if(!A||!A.focus){I(h());return}A.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=A,xp(A)&&A.select()}},f=function(A){var E=d("setReturnFocus",A);return E||(E===!1?!1:A)},b=function(A){var E=A.target,j=A.event,R=A.isBackward,W=R===void 0?!1:R;E=E||ta(j),p();var H=null;if(s.tabbableGroups.length>0){var G=u(E,j),ne=G>=0?s.containerGroups[G]:void 0;if(G<0)W?H=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:H=s.tabbableGroups[0].firstTabbableNode;else if(W){var C=Fu(s.tabbableGroups,function($){var U=$.firstTabbableNode;return E===U});if(C<0&&(ne.container===E||wa(E,i.tabbableOptions)&&!yn(E,i.tabbableOptions)&&!ne.nextTabbableNode(E,!1))&&(C=G),C>=0){var L=C===0?s.tabbableGroups.length-1:C-1,ee=s.tabbableGroups[L];H=un(E)>=0?ee.lastTabbableNode:ee.lastDomTabbableNode}else wr(j)||(H=ne.nextTabbableNode(E,!1))}else{var B=Fu(s.tabbableGroups,function($){var U=$.lastTabbableNode;return E===U});if(B<0&&(ne.container===E||wa(E,i.tabbableOptions)&&!yn(E,i.tabbableOptions)&&!ne.nextTabbableNode(E))&&(B=G),B>=0){var T=B===s.tabbableGroups.length-1?0:B+1,O=s.tabbableGroups[T];H=un(E)>=0?O.firstTabbableNode:O.firstDomTabbableNode}else wr(j)||(H=ne.nextTabbableNode(E))}}else H=d("fallbackFocus");return H},v=function(A){var E=ta(A);if(!(u(E,A)>=0)){if(hr(i.clickOutsideDeactivates,A)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}hr(i.allowOutsideClick,A)||A.preventDefault()}},x=function(A){var E=ta(A),j=u(E,A)>=0;if(j||E instanceof Document)j&&(s.mostRecentlyFocusedNode=E);else{A.stopImmediatePropagation();var R,W=!0;if(s.mostRecentlyFocusedNode)if(un(s.mostRecentlyFocusedNode)>0){var H=u(s.mostRecentlyFocusedNode),G=s.containerGroups[H].tabbableNodes;if(G.length>0){var ne=G.findIndex(function(C){return C===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<G.length&&(R=G[ne+1],W=!1):ne-1>=0&&(R=G[ne-1],W=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(L){return un(L)>0})})||(W=!1);else W=!1;W&&(R=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(R||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},k=function(A){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=A;var j=b({event:A,isBackward:E});j&&(wr(A)&&A.preventDefault(),g(j))},_=function(A){if(wp(A)&&hr(i.escapeDeactivates,A)!==!1){A.preventDefault(),o.deactivate();return}(i.isKeyForward(A)||i.isKeyBackward(A))&&k(A,i.isKeyBackward(A))},w=function(A){var E=ta(A);u(E,A)>=0||hr(i.clickOutsideDeactivates,A)||hr(i.allowOutsideClick,A)||(A.preventDefault(),A.stopImmediatePropagation())},F=function(){if(s.active)return _u.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?ku(function(){g(h())}):g(h()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",_,!0),o},q=function(A){var E=A.some(function(j){var R=Array.from(j.removedNodes);return R.some(function(W){return W===s.mostRecentlyFocusedNode})});E&&g(h())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(q):void 0,z=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(A){N.observe(A,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(A){if(s.active)return this;var E=l(A,"onActivate"),j=l(A,"onPostActivate"),R=l(A,"checkCanFocusTrap");R||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,E==null||E();var W=function(){R&&p(),F(),z(),j==null||j()};return R?(R(s.containers.concat()).then(W,W),this):(W(),this)},deactivate:function(A){if(!s.active)return this;var E=Eu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},A);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,z(),_u.deactivateTrap(a,o);var j=l(E,"onDeactivate"),R=l(E,"onPostDeactivate"),W=l(E,"checkCanReturnFocus"),H=l(E,"returnFocus","returnFocusOnDeactivate");j==null||j();var G=function(){ku(function(){H&&g(f(s.nodeFocusedBeforeActivation)),R==null||R()})};return H&&W?(W(f(s.nodeFocusedBeforeActivation)).then(G,G),this):(G(),this)},pause:function(A){if(s.paused||!s.active)return this;var E=l(A,"onPause"),j=l(A,"onPostPause");return s.paused=!0,E==null||E(),S(),z(),j==null||j(),this},unpause:function(A){if(!s.paused||!s.active)return this;var E=l(A,"onUnpause"),j=l(A,"onPostUnpause");return s.paused=!1,E==null||E(),p(),F(),z(),j==null||j(),this},updateContainerElements:function(A){var E=[].concat(A).filter(Boolean);return s.containers=E.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),z(),this}},o.updateContainerElements(t),o};const Bp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Fp},Symbol.toStringTag,{value:"Module"})),Ap=Rc(Bp),Tp=Rc(bp);function tr(e){"@babel/helpers - typeof";return tr=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},tr(e)}function Sp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bu(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,Ad(r.key),r)}}function jp(e,t,n){return t&&Bu(e.prototype,t),n&&Bu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Op(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&&_s(e,t)}function _s(e,t){return _s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},_s(e,t)}function Pp(e){var t=Np();return function(){var r=Na(e),a;if(t){var i=Na(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Mp(this,a)}}function Mp(e,t){if(t&&(tr(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 Np(){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 Na(e){return Na=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Na(e)}function Ip(e,t,n){return t=Ad(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ad(e){var t=Rp(e,"string");return tr(t)==="symbol"?t:String(t)}function Rp(e,t){if(tr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(tr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var na=y,ge=np,$p=Ap,Lp=$p.createFocusTrap,zp=Tp,qp=zp.isFocusable,lo=function(e){Op(n,e);var t=Pp(n);function n(r){var a;Sp(this,n),a=t.call(this,r),Ip(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 d=arguments.length,h=new Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var g;if(m=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),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 jp(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&&!qp(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),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?na.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===na.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 d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=na.cloneElement(i,{ref:s});return o}return null}}]),n}(na.Component),mr=typeof Element>"u"?Function:Element;lo.propTypes={active:ge.bool,paused:ge.bool,focusTrapOptions:ge.shape({document:ge.object,onActivate:ge.func,onPostActivate:ge.func,checkCanFocusTrap:ge.func,onPause:ge.func,onPostPause:ge.func,onUnpause:ge.func,onPostUnpause:ge.func,onDeactivate:ge.func,onPostDeactivate:ge.func,checkCanReturnFocus:ge.func,initialFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.bool,ge.func]),fallbackFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.func]),escapeDeactivates:ge.oneOfType([ge.bool,ge.func]),clickOutsideDeactivates:ge.oneOfType([ge.bool,ge.func]),returnFocusOnDeactivate:ge.bool,setReturnFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.bool,ge.func]),allowOutsideClick:ge.oneOfType([ge.bool,ge.func]),preventScroll:ge.bool,tabbableOptions:ge.shape({displayCheck:ge.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ge.oneOfType([ge.bool,ge.func])}),trapStack:ge.array,isKeyForward:ge.func,isKeyBackward:ge.func}),containerElements:ge.arrayOf(ge.instanceOf(mr)),children:ge.oneOfType([ge.element,ge.instanceOf(mr)])};lo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Lp};var Wp=lo;const Up=On(Wp);const pn=({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:d="",gtmContext:h="Modal"})=>{const p=ie.useIntl(),{registerOverlay:m,unregisterOverlay:g}=vd(),[f,b]=y.useState(t),[v,x]=y.useState(null),k=y.useRef(null),_=N=>{f&&N.key==="Escape"&&S(!1)},w=N=>{x(N.target)},F=N=>{v===k.current&&N.target===k.current&&S(!1),x(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",_),()=>{window.removeEventListener("keyup",_)}},[f]),y.useEffect(()=>{const N=k.current;return N&&(N.addEventListener("mousedown",w),N.addEventListener("mouseup",F)),()=>{N&&(N.removeEventListener("mousedown",w),N.removeEventListener("mouseup",F))}},[v]);const S=N=>{if(b(N),N)a(),m(e);else{if(f===N)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const q=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:k,className:V("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(oo,{id:e,className:V("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:q,children:t&&c.jsx(Up,{containerElements:[k.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Ut,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Ut,{}),c.jsx(or,{buttons:u})]}),s&&c.jsx(Or,{className:"error",children:s})]})})})})},Td=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const pr="joinCommunityButton",co=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ie.useIntl(),o=y.useContext(it),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[p,m]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${pr}_leave`}),g["aria-label"]=s.formatMessage({id:`${pr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${pr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),m(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${pr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const x=d?i:a;typeof x=="function"&&setTimeout(async()=>{await x()},500),h(!d)},className:V("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${pr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const ki="communityDetails_",Hp=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ie.useIntl(),{id:u}=y.useContext(it),d=u,h=5,p=a||i.length,m=i.length?i:Array(h).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:V("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${ki}members`}),c.jsx("span",{className:"count",children:p})]}),g?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${ki}viewAll`})})})]}),d&&c.jsx(so,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:p===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(co,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${ki}invite`})})]}):c.jsx(c.Fragment,{})]})};const Vp=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ne,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.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"),c.jsxs("li",{children:[s&&c.jsx(Ne,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(fn,{href:s?void 0:i,...l,children:Xn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Kp=({variant:e="default",data:{image:t,url:n,title:r,description:a},gtm:i})=>{const s=n.split("//")[1].split("/")[0],{context:o="EnrichedLink",event:l="enriched-link-click"}=i??{};return c.jsxs("aside",{className:V("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:u=>{u.preventDefault(),u.stopPropagation(),window.location.href=n},"data-gtm-event-context":o,"data-gtm-event-type":l,children:[c.jsx("small",{children:s}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{href:n,target:"_blank",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const Zp=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ie.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=y.useState(t?["all"]:[]),u=(d,h)=>{let p=[];o.includes(d)?p=o.filter(m=>m!==d):d==="all"?p=["all"]:n?p=[...o.filter(m=>m!=="all"),d]:p=[d],l(m=>(r&&typeof r=="function"&&r({current:p,previous:m}),p)),h&&typeof h=="function"&&h()};return c.jsx("ul",{className:V("filters",a),children:s.map(({id:d,text:h,disabled:p=!1,callback:m=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),c.jsx("li",{children:c.jsx("button",{className:V(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,m)},...g,children:h})},d)})})},Yp=(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 ra="languageSwitcher_",Gp=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ie.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(ao),[h,p]=y.useState(e);if(y.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=h!==e;return c.jsxs("div",{className:V("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${ra}label`})}),c.jsx("ul",{children:g.map(b=>{var k;if(!xa[b])return null;const v=(k=r[b])==null?void 0:k.post_name;let x={className:b};if(h===b)x["aria-label"]=u.formatMessage({id:`${ra}selected`},{language:xa[b]});else{const _=Yp(b,v,i);x={...x,href:typeof _=="string"?_:_.url,onClick:w=>{p(b),d(b),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(b,typeof _=="string"?_:_.urlForRouter))}}}return c.jsx("li",{children:c.jsx(fn,{...x,fallbackElement:"span",children:xa[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ra}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ra}disclaimer`},{email:Un.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Fi=ie.createIntl({locale:"en",messages:sr}),Hr=({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:Fi.formatMessage({id:"loadMore_button"}),endOfFeed:Fi.formatMessage({id:"loadMore_endOfFeed"}),error:Fi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),p=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:V("load-more",l),children:!d&&e?c.jsx(Ee,{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&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const fo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:V("logo",e,t,n),...r,children:c.jsx(Ne,{children:c.jsx(ie.FormattedMessage,{id:"apolitical"})})})});let aa=!1;const Sd=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ie.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:V("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{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"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},g)=>{const f={...m,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{aa&&(clearTimeout(aa),aa=!1)},onBlur:()=>{aa=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Qp=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Jp=y.lazy(()=>Promise.resolve().then(()=>Km)),Xp=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],jd=({activeLink:e,profile:t})=>{const n=ie.useIntl(),r=y.useContext(it),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Xp.map(({key:i,href:s})=>{const o=Qp(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:V(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(Jp,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},gr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,eg=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${gr(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(`${gr(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(`${gr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
63
63
|
|
|
64
|
-
${gr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:gr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const tg="shareLinks_",ng=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=eg({title:e,link:t,referrer:n});return c.jsxs("aside",{className:Z("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const g={};return m&&(g.onClick=f=>m(f,h)),c.jsx("li",{children:c.jsx(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${tg}link_${u}`}),...g})},u)})})]})};const rg=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=Pn(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const w=r(e[v].id,e[v].text,v),A=document.getElementById(`tab-${w}`);A==null||A.focus(),u(w);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],m=[];return e.forEach(({id:f,text:b,content:v,href:w,hasCarousel:A,breakpoint:_},x)=>{if(_&&!h(_))return;f=r(f,b,x);const T=s===f,S={};w||(S["aria-controls"]=f,S.onClick=z=>{z.preventDefault(),z.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},m.push(c.jsx("section",{id:f,hidden:!T,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":T?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:w||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:Z({selected:T}),role:"tab",tabIndex:T?0:-1,"aria-selected":T,onKeyDown:z=>d(z,x),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:Z("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:m})]})};const ag={"2-1":901,"1-3":769,"1-1":769},Od=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Pn(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:Z("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<ag[e]?null:o)})};const fo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=se.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:Z("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Ne,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ni=e=>(e==null?void 0:e.toString().length)||0,Pd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ni(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const aa="emailHelperTextBox_",Md=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=se.useIntl(),[s,o]=y.useState({path:`${aa}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${aa}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${aa}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=aa,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>d(w),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const h={};return["link","mail"].forEach(g=>{h[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(id,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Bt,{element:"span"}),c.jsx(Bt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Hn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...d})=>{const h=y.useRef(),p=r||h;return y.useEffect(()=>{var m;u&&((m=p.current)==null||m.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:Z(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:m=>{const g=m.target;a.onChange(g.value)}})};const $n={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},ig=500,sg=({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:d},h]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=se.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const _=setTimeout(()=>{g||h(x=>({...x,debouncedInput:l}))},ig);return()=>{clearTimeout(_)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const x=await o(d)||[];f(T=>({...T,predictions:x}))}catch(x){console.error("Error fetching predictions:",x),f(T=>({...T,predictions:[]}))}})():f(_=>({..._,predictions:[]}))},[d,g]),y.useEffect(()=>{m>=0&&p[m]&&h(_=>({..._,displayInput:p[m].description}))},[m,p]);const v=_=>{[$n.DOWN,$n.UP,$n.ENTER].includes(_.key)&&(_.preventDefault(),_.key===$n.DOWN&&m<p.length-1?f(x=>({...x,activePredictionIndex:m+1})):_.key===$n.UP&&m>0?f(x=>({...x,activePredictionIndex:m-1})):_.key===$n.ENTER&&m>-1&&(s(p[m].description),h(x=>({...x,input:p[m].description})),f(x=>({...x,predictions:[],isPredictionSelected:!0}))))},w=_=>{s(_.target.value),h(x=>({...x,input:_.target.value,displayInput:_.target.value})),f(x=>({...x,activePredictionIndex:-1,isPredictionSelected:!1}))},A=_=>{s(_.description),h(x=>({...x,input:_.description,displayInput:_.description})),f(x=>({...x,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((_,x)=>c.jsx("li",{onClick:()=>A(_),onMouseEnter:()=>f(T=>({...T,activePredictionIndex:x})),className:Z("predictions-list-item",{active:x===m}),children:_.description},x))})]})};const Nd=({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:d,...h})=>{const p=se.useIntl(),{onChange:m,...g}=r,f=()=>{t||m(d?null:l)},b=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:v=>{const w=v.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:Z("checkbox-wrapper",e),...h,...g},b)};const og=y.memo(function({direction:t="down"}){return c.jsx(Qa,{className:Z("rotating-chevron",`direction-${t}`)})});const ug=({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 d=se.useIntl(),[h,p]=y.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:w,onMultiSelectSubmit:A,..._}=a,x=S=>{if(o){let z=[];f!=null&&f.includes(S.id)?z=f.filter(M=>M!==S.id):z=[...f,S.id],b([...z]),w&&w([...z])}else b([S]),w&&w(S.id),p(!1)},T=S=>{if(S==="all"){const z=(t==null?void 0:t.map(M=>M.id))||[];b(z),w&&w(z)}else b([]),w&&w([])};return c.jsxs("div",{className:Z("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${f.length}`:v.label,c.jsx(og,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(M=>M.id===S.target.value);x(z)},hidden:!h,..._,children:t==null?void 0:t.map(S=>c.jsx("option",{value:S.id,className:"gtm-trackable","data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,children:S.label},S.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>T("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:Z("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:M=>{M.preventDefault(),M.stopPropagation(),x(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:Z({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ee,{variant:"secondary",onClick:()=>{A&&A(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const lg=({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:d,...h})=>{const p=se.useIntl(),m=i?d:[],g=d;return c.jsx("ul",{...h,className:Z("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:w=!1})=>{const A=`${r}_${f}`,_=()=>{if(w)return;let x;if(i){const T=m==null?void 0:m.indexOf(v);Array.isArray(m)&&T>=0?(x=m,x.splice(T,1)):(!m||m.length===0?x=[]:x=m,x.push(v))}else x=g===v?void 0:v;t.onChange(x)};return c.jsx(Nd,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?m==null?void 0:m.includes(v):g===v,functions:{...t,onChange:_},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:w},A)})})};const cg=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=se.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,h]=y.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:Z("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Hn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Ln={text:{component:Hn},email:{component:Hn},url:{component:Hn},textarea:{component:Hn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Nd},checkboxes:{component:lg,props:{multiSelect:!0}},select:{component:ug},password:{component:cg},autocomplete:{component:sg}},dg=({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:d,...h})=>{const p=se.useIntl(),m=l&&l.some(({condition:I})=>I==="required"),g=ni(u),f=o&&Ln[o]&&Ln[o].component?Ln[o].component:Hn,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),w=r&&`error-${e}`,A=`character-limit-${e}`,_={};b?_.element="legend":_.htmlFor=e;let x={...h,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:wn(a),value:u};const T=I=>{x["aria-describedby"]?x["aria-describedby"]+=` ${I}`:x["aria-describedby"]=I};if(i>0){const I=Pd(i,a.onChange);T(`${A}-info`),x={...x,...I},I.functions&&typeof I.functions=="object"&&(x.functions={...x.functions,...I.functions})}o&&Ln[o]&&Ln[o].props&&(x={...x,...Ln[o].props}),b&&(x.intlPath=`${t}_${e}`),r&&(x["aria-invalid"]=!0,x["aria-errormessage"]=w,T(w));const S=h.label||p.formatMessage({id:t?`${t}_${e}`:e}),z=({...I})=>r?y.createElement(I.as||"p",{id:w,className:"error text-small",...I},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...x,label:S,className:Z("field-wrapper",n)}),c.jsx(z,{as:"p"})]});const M={};b||(M.className="field-label");const q=I=>y.createElement(I.element||"label",{...I,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:Z("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?y.Fragment:"p",M,c.jsxs(q,{..._,children:[S,m&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(b||v?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...x}),c.jsx(fo,{id:A,limit:i,valueLength:g})]})),c.jsx(z,{})]}))})},fg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?wn(e.errors):{},i=e.values?wn(e.values):{};switch(n){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:d}=r,h=wn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:f=!1}=p.validation[m];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(d==null?void 0:d.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=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(v)&&(b=f||(d==null?void 0:d.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}}),h.push(p.id);break}}return h.length===0?l(i):u(i,h),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Bi=null;const en=({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,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:h,...p})=>{const{customOnSubmit:m,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:w=!0,shouldHide:A=!0,showRequiredLabels:_=!0,showSuccessMessage:x=!1}=l||{},{onSuccess:T=async()=>{},onCancel:S=()=>{},onCatch:z=()=>{},onFailure:M=()=>{}}=h||{},q=se.useIntl(),I={};t.length&&t.forEach(k=>{const $=k.id||k.name;$&&(I[$]=k.value||"")});const[B,E]=y.useReducer(fg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:I}),{errors:j,isSubmitting:N,formSubmitted:W,values:H}=B;y.useEffect(()=>{w&&W&&(Bi=setTimeout(()=>{E({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[W]),y.useEffect(()=>()=>{Bi&&clearTimeout(Bi)},[]),y.useEffect(()=>{const k=$=>{E({type:"updateValue",payload:{key:$.detail.id,value:$.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",k),()=>{document.removeEventListener("dropdownMultiSelectSubmit",k)}},[]);const G=y.useRef(null),re=a||G;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(k=>{f.text&&typeof f.text!="string"&&k in f.text?C[k]=f.text[k]:C[k]||(C[k]=q.formatMessage({id:`form_${k==="default"?"submit":k}`}))}),delete f.text;const L=()=>{if(!N){if(E({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&E({type:"submitForm",payload:{fields:t,dispatch:E,intl:q}});return}E({type:"submitForm",payload:{fields:t,dispatch:E,onSuccess:async k=>{try{await T(k),E({type:w?"formSubmittedAndReset":"formSubmitted"})}catch($){z($),E({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(k,$)=>{M(k,$),E({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:q}})}},F=[{...f,icon:W?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:k=>{var U;if(k.preventDefault(),k.stopPropagation(),N)return;let $=0;if((U=re==null?void 0:re.current)!=null&&U.id){const ae=document.getElementById(re.current.id);ae&&($=ae.getBoundingClientRect().top+window.scrollY)}const R=document.getElementById("header");R&&($=$-R.offsetHeight-b),$<0&&($=0),window.scrollTo({top:$,behavior:"smooth"}),L()},disabled:N||W||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[N?"submitting":W?"submitted":"default"]}];return v&&F.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:N||W,onClick:S,children:o.text||q.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:Z("form",n),ref:re},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(hn,{variant:"error",text:q.formatMessage({id:"form_error_generalError"})}):null,u,(!A||!N&&!W||m)&&t.map((k,$)=>{const{id:R=k.name||$,component:U,functions:ae={onChange:()=>{}},submitOnEnter:X=!1}=k;if(U)return c.jsx(U,{...k.props||{}},`component-${R}-${$}`);const ie=(H==null?void 0:H[R])||"",fe={...ae,onChange:Q=>{E({type:"updateValue",payload:{key:R,value:Q}}),ae.onChange(Q&&Q.toString(),E)}};return X&&(fe.onKeyDown=Q=>{Q.key==="Enter"&&(Q.stopPropagation(),Q.preventDefault(),L()),ae.onKeyDown&&ae.onKeyDown(Q)}),c.jsx(dg,{intlPath:i,...k,showRequiredLabels:_,value:ie,error:j==null?void 0:j[R],functions:fe},R)}),g?null:(N||W)&&m?m:c.jsx(or,{className:Z("cta",{center:N||W,submitted:W}),buttons:F})]})),x&&W&&c.jsx(Or,{className:"success",children:typeof x=="string"?x:q.formatMessage({id:"form_success"})})]})};const ia="passwordRules_",Id="isMoreThanEightCharacters",Rd="includesNumberAndSymbol",$d="includesLowerAndUppercase",hg={[Id]:"8Characters",[Rd]:"numberSymbol",[$d]:"lowercaseUppercase"},mg=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return c.jsxs("aside",{className:Z("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${ia}intro`})}),c.jsx("ul",{children:[Id,Rd,$d].map(r=>c.jsxs("li",{className:Z({matches:e[r]}),children:[c.jsxs(Ne,{children:[n.formatMessage({id:`${ia}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${ia}rule_${hg[r]}`})}),!e[r]&&c.jsxs(Ne,{element:"strong",children:[" ",n.formatMessage({id:`${ia}notMet`})]})]},`rule-${r}`))})]})},Ld=y.memo(mg);const pg=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=se.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(w=>({...w,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(w=>({...w,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Bt,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!h||m))try{u(w=>({...w,rating:v,disabled:!0})),await r({id:h,value:v})}catch(w){u(A=>({...A,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return c.jsxs("div",{className:Z("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const w=v+1;return c.jsx("li",{className:Z({selected:p&&w<=p}),children:c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!p||w>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:w,total:t})}${w===1||w===t?` - ${f[w===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),b(w)},disabled:m})},`rating-${w}`)})})]})};function gg(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 ks(e,t){return Array(t+1).join(e)}function vg(e){return e.replace(/^\n*/,"")}function bg(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
65
|
-
`;)t--;return e.substring(0,t)}var yg=["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
|
|
64
|
+
${gr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:gr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const tg="shareLinks_",ng=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ie.useIntl(),l=eg({title:e,link:t,referrer:n});return c.jsxs("aside",{className:V("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const g={};return m&&(g.onClick=f=>m(f,h)),c.jsx("li",{children:c.jsx(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${tg}link_${u}`}),...g})},u)})})]})};const rg=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=Pn(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const x=r(e[v].id,e[v].text,v),k=document.getElementById(`tab-${x}`);k==null||k.focus(),u(x);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],m=[];return e.forEach(({id:f,text:b,content:v,href:x,hasCarousel:k,breakpoint:_},w)=>{if(_&&!h(_))return;f=r(f,b,w);const F=s===f,S={};x||(S["aria-controls"]=f,S.onClick=q=>{q.preventDefault(),q.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},m.push(c.jsx("section",{id:f,hidden:!F,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":F?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:x||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:V({selected:F}),role:"tab",tabIndex:F?0:-1,"aria-selected":F,onKeyDown:q=>d(q,w),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:V("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:m})]})};const ag={"2-1":901,"1-3":769,"1-1":769},Od=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Pn(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:V("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<ag[e]?null:o)})};const ho=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ie.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:V("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Ne,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ri=e=>(e==null?void 0:e.toString().length)||0,Pd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ri(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const ia="emailHelperTextBox_",Md=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ie.useIntl(),[s,o]=y.useState({path:`${ia}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${ia}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${ia}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=ia,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>d(x),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const h={};return["link","mail"].forEach(g=>{h[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(id,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(At,{element:"span"}),c.jsx(At,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Hn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...d})=>{const h=y.useRef(),p=r||h;return y.useEffect(()=>{var m;u&&((m=p.current)==null||m.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:V(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:m=>{const g=m.target;a.onChange(g.value)}})};const $n={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},ig=500,sg=({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:d},h]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ie.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const _=setTimeout(()=>{g||h(w=>({...w,debouncedInput:l}))},ig);return()=>{clearTimeout(_)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const w=await o(d)||[];f(F=>({...F,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),f(F=>({...F,predictions:[]}))}})():f(_=>({..._,predictions:[]}))},[d,g]),y.useEffect(()=>{m>=0&&p[m]&&h(_=>({..._,displayInput:p[m].description}))},[m,p]);const v=_=>{[$n.DOWN,$n.UP,$n.ENTER].includes(_.key)&&(_.preventDefault(),_.key===$n.DOWN&&m<p.length-1?f(w=>({...w,activePredictionIndex:m+1})):_.key===$n.UP&&m>0?f(w=>({...w,activePredictionIndex:m-1})):_.key===$n.ENTER&&m>-1&&(s(p[m].description),h(w=>({...w,input:p[m].description})),f(w=>({...w,predictions:[],isPredictionSelected:!0}))))},x=_=>{s(_.target.value),h(w=>({...w,input:_.target.value,displayInput:_.target.value})),f(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},k=_=>{s(_.description),h(w=>({...w,input:_.description,displayInput:_.description})),f(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((_,w)=>c.jsx("li",{onClick:()=>k(_),onMouseEnter:()=>f(F=>({...F,activePredictionIndex:w})),className:V("predictions-list-item",{active:w===m}),children:_.description},w))})]})};const Nd=({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:d,...h})=>{const p=ie.useIntl(),{onChange:m,...g}=r,f=()=>{t||m(d?null:l)},b=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:v=>{const x=v.target;x.nodeName.toLowerCase()==="a"||x.parentNode&&x.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:V("checkbox-wrapper",e),...h,...g},b)};const og=y.memo(function({direction:t="down"}){return c.jsx(Ja,{className:V("rotating-chevron",`direction-${t}`)})});const ug=({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 d=ie.useIntl(),[h,p]=y.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:k,..._}=a,w=S=>{if(o){let q=[];f!=null&&f.includes(S.id)?q=f.filter(N=>N!==S.id):q=[...f,S.id],b([...q]),x&&x([...q])}else b([S]),x&&x(S.id),p(!1)},F=S=>{if(S==="all"){const q=(t==null?void 0:t.map(N=>N.id))||[];b(q),x&&x(q)}else b([]),x&&x([])};return c.jsxs("div",{className:V("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${f.length}`:v.label,c.jsx(og,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const q=t&&t.find(N=>N.id===S.target.value);w(q)},hidden:!h,..._,children:t==null?void 0:t.map(S=>c.jsx("option",{value:S.id,className:"gtm-trackable","data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,children:S.label},S.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const q=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:V("gtm-trackable",{selected:q,"selected-single":q&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),w(S)},role:"menuitem","aria-current":q,"data-testid":q?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:V({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ee,{variant:"secondary",onClick:()=>{k&&k(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const lg=({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:d,...h})=>{const p=ie.useIntl(),m=i?d:[],g=d;return c.jsx("ul",{...h,className:V("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:x=!1})=>{const k=`${r}_${f}`,_=()=>{if(x)return;let w;if(i){const F=m==null?void 0:m.indexOf(v);Array.isArray(m)&&F>=0?(w=m,w.splice(F,1)):(!m||m.length===0?w=[]:w=m,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return c.jsx(Nd,{element:"li",id:k,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?m==null?void 0:m.includes(v):g===v,functions:{...t,onChange:_},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:x},k)})})};const cg=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ie.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,h]=y.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:V("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Hn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Ln={text:{component:Hn},email:{component:Hn},url:{component:Hn},textarea:{component:Hn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Nd},checkboxes:{component:lg,props:{multiSelect:!0}},select:{component:ug},password:{component:cg},autocomplete:{component:sg}},dg=({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:d,...h})=>{const p=ie.useIntl(),m=l&&l.some(({condition:I})=>I==="required"),g=ri(u),f=o&&Ln[o]&&Ln[o].component?Ln[o].component:Hn,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),x=r&&`error-${e}`,k=`character-limit-${e}`,_={};b?_.element="legend":_.htmlFor=e;let w={...h,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:wn(a),value:u};const F=I=>{w["aria-describedby"]?w["aria-describedby"]+=` ${I}`:w["aria-describedby"]=I};if(i>0){const I=Pd(i,a.onChange);F(`${k}-info`),w={...w,...I},I.functions&&typeof I.functions=="object"&&(w.functions={...w.functions,...I.functions})}o&&Ln[o]&&Ln[o].props&&(w={...w,...Ln[o].props}),b&&(w.intlPath=`${t}_${e}`),r&&(w["aria-invalid"]=!0,w["aria-errormessage"]=x,F(x));const S=h.label||p.formatMessage({id:t?`${t}_${e}`:e}),q=({...I})=>r?y.createElement(I.as||"p",{id:x,className:"error text-small",...I},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...w,label:S,className:V("field-wrapper",n)}),c.jsx(q,{as:"p"})]});const N={};b||(N.className="field-label");const z=I=>y.createElement(I.element||"label",{...I,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:V("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?y.Fragment:"p",N,c.jsxs(z,{..._,children:[S,m&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(b||v?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...w}),c.jsx(ho,{id:k,limit:i,valueLength:g})]})),c.jsx(q,{})]}))})},fg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?wn(e.errors):{},i=e.values?wn(e.values):{};switch(n){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:d}=r,h=wn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:f=!1}=p.validation[m];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(d==null?void 0:d.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=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(v)&&(b=f||(d==null?void 0:d.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}}),h.push(p.id);break}}return h.length===0?l(i):u(i,h),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Bi=null;const en=({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,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:h,...p})=>{const{customOnSubmit:m,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:x=!0,shouldHide:k=!0,showRequiredLabels:_=!0,showSuccessMessage:w=!1}=l||{},{onSuccess:F=async()=>{},onCancel:S=()=>{},onCatch:q=()=>{},onFailure:N=()=>{}}=h||{},z=ie.useIntl(),I={};t.length&&t.forEach(T=>{const O=T.id||T.name;O&&(I[O]=T.value||"")});const[A,E]=y.useReducer(fg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:I}),{errors:j,isSubmitting:R,formSubmitted:W,values:H}=A;y.useEffect(()=>{x&&W&&(Bi=setTimeout(()=>{E({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[W]),y.useEffect(()=>()=>{Bi&&clearTimeout(Bi)},[]),y.useEffect(()=>{const T=O=>{E({type:"updateValue",payload:{key:O.detail.id,value:O.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const G=y.useRef(null),ne=a||G;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(T=>{f.text&&typeof f.text!="string"&&T in f.text?C[T]=f.text[T]:C[T]||(C[T]=z.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete f.text;const L=()=>{if(!R){if(E({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&E({type:"submitForm",payload:{fields:t,dispatch:E,intl:z}});return}E({type:"submitForm",payload:{fields:t,dispatch:E,onSuccess:async T=>{try{await F(T),E({type:x?"formSubmittedAndReset":"formSubmitted"})}catch(O){q(O),E({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,O)=>{N(T,O),E({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:z}})}},B=[{...f,icon:W?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:T=>{var U;if(T.preventDefault(),T.stopPropagation(),R)return;let O=0;if((U=ne==null?void 0:ne.current)!=null&&U.id){const re=document.getElementById(ne.current.id);re&&(O=re.getBoundingClientRect().top+window.scrollY)}const $=document.getElementById("header");$&&(O=O-$.offsetHeight-b),O<0&&(O=0),window.scrollTo({top:O,behavior:"smooth"}),L()},disabled:R||W||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[R?"submitting":W?"submitted":"default"]}];return v&&B.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:R||W,onClick:S,children:o.text||z.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:V("form",n),ref:ne},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(hn,{variant:"error",text:z.formatMessage({id:"form_error_generalError"})}):null,u,(!k||!R&&!W||m)&&t.map((T,O)=>{const{id:$=T.name||O,component:U,functions:re={onChange:()=>{}},submitOnEnter:X=!1}=T;if(U)return c.jsx(U,{...T.props||{}},`component-${$}-${O}`);const ae=(H==null?void 0:H[$])||"",he={...re,onChange:Q=>{E({type:"updateValue",payload:{key:$,value:Q}}),re.onChange(Q&&Q.toString(),E)}};return X&&(he.onKeyDown=Q=>{Q.key==="Enter"&&(Q.stopPropagation(),Q.preventDefault(),L()),re.onKeyDown&&re.onKeyDown(Q)}),c.jsx(dg,{intlPath:i,...T,showRequiredLabels:_,value:ae,error:j==null?void 0:j[$],functions:he},$)}),g?null:(R||W)&&m?m:c.jsx(or,{className:V("cta",{center:R||W,submitted:W}),buttons:B})]})),w&&W&&c.jsx(Or,{className:"success",children:typeof w=="string"?w:z.formatMessage({id:"form_success"})})]})};const sa="passwordRules_",Id="isMoreThanEightCharacters",Rd="includesNumberAndSymbol",$d="includesLowerAndUppercase",hg={[Id]:"8Characters",[Rd]:"numberSymbol",[$d]:"lowercaseUppercase"},mg=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:V("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${sa}intro`})}),c.jsx("ul",{children:[Id,Rd,$d].map(r=>c.jsxs("li",{className:V({matches:e[r]}),children:[c.jsxs(Ne,{children:[n.formatMessage({id:`${sa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${sa}rule_${hg[r]}`})}),!e[r]&&c.jsxs(Ne,{element:"strong",children:[" ",n.formatMessage({id:`${sa}notMet`})]})]},`rule-${r}`))})]})},Ld=y.memo(mg);const pg=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ie.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=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(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(At,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!h||m))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:h,value:v})}catch(x){u(k=>({...k,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return c.jsxs("div",{className:V("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const x=v+1;return c.jsx("li",{className:V({selected:p&&x<=p}),children:c.jsx(Ee,{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?` - ${f[x===1?"low":"high"]}`:""}`,onClick:k=>{k.preventDefault(),k.stopPropagation(),b(x)},disabled:m})},`rating-${x}`)})})]})};function gg(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 ks(e,t){return Array(t+1).join(e)}function vg(e){return e.replace(/^\n*/,"")}function bg(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
65
|
+
`;)t--;return e.substring(0,t)}var yg=["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 mo(e){return po(e,yg)}var zd=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function qd(e){return po(e,zd)}function Dg(e){return Ud(e,zd)}var Wd=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Cg(e){return po(e,Wd)}function xg(e){return Ud(e,Wd)}function po(e,t){return t.indexOf(e.nodeName)>=0}function Ud(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var st={};st.paragraph={filter:"p",replacement:function(e){return`
|
|
66
66
|
|
|
67
67
|
`+e+`
|
|
68
68
|
|
|
@@ -103,13 +103,13 @@ ${gr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
|
|
|
103
103
|
|
|
104
104
|
`+n.hr+`
|
|
105
105
|
|
|
106
|
-
`}};st.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=
|
|
106
|
+
`}};st.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=Ia(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};st.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=Ia(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=`
|
|
107
107
|
|
|
108
108
|
`+this.references.join(`
|
|
109
109
|
`)+`
|
|
110
110
|
|
|
111
|
-
`,this.references=[]),t}};st.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};st.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};st.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}};st.image={filter:"img",replacement:function(e,t){var n=
|
|
112
|
-
`):""}function Hd(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])}Hd.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=Ai(this.array,e,this.options))||(t=Ai(this._keep,e,this.options))||(t=Ai(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 Ai(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(wg(a,t,n))return a}}function wg(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 Eg(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=
|
|
111
|
+
`,this.references=[]),t}};st.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};st.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};st.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}};st.image={filter:"img",replacement:function(e,t){var n=Ia(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=Ia(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"":""}};function Ia(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
112
|
+
`):""}function Hd(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])}Hd.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=Ai(this.array,e,this.options))||(t=Ai(this._keep,e,this.options))||(t=Ai(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 Ai(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(wg(a,t,n))return a}}function wg(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 Eg(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Au(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=Ti(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=Ti(l);continue}var d=Au(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||Ti(i))}}function Ti(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Au(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var go=typeof window<"u"?window:{};function _g(){var e=go.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function kg(){var e=function(){};return Fg()?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 Fg(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{go.ActiveXObject&&(e=!0)}return e}var Bg=_g()?go.DOMParser:kg();function Ag(e,t){var n;if(typeof e=="string"){var r=Tg().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return Eg({element:n,isBlock:mo,isVoid:qd,isPre:t.preformattedCode?Sg:null}),n}var Si;function Tg(){return Si=Si||new Bg,Si}function Sg(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function jg(e,t){return e.isBlock=mo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Og(e),e.flankingWhitespace=Pg(e,t),e}function Og(e){return!qd(e)&&!Cg(e)&&/^\s*$/i.test(e.textContent)&&!Dg(e)&&!xg(e)}function Pg(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=Mg(e.textContent);return n.leadingAscii&&Tu("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Tu("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Mg(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 Tu(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&&!mo(r)&&(i=a.test(r.textContent))),i}var Ng=Array.prototype.reduce,Ig=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Pr(e){if(!(this instanceof Pr))return new Pr(e);var t={rules:st,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
|
|
113
113
|
|
|
114
114
|
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
115
115
|
|
|
@@ -126,40 +126,40 @@ ${gr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
|
|
|
126
126
|
*
|
|
127
127
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
128
128
|
* Released under the MIT License.
|
|
129
|
-
*/function Tu(e){return Object.prototype.toString.call(e)==="[object Object]"}function nt(e){var t,n;return Tu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Tu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Zd=Symbol.for("immer-nothing"),Su=Symbol.for("immer-draftable"),Dt=Symbol.for("immer-state"),zg=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 pt(e,...t){if(process.env.NODE_ENV!=="production"){const n=zg[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 nr=Object.getPrototypeOf;function An(e){return!!e&&!!e[Dt]}function Tn(e){var t;return e?Yd(e)||Array.isArray(e)||!!e[Su]||!!((t=e.constructor)!=null&&t[Su])||ai(e)||ii(e):!1}var qg=Object.prototype.constructor.toString();function Yd(e){if(!e||typeof e!="object")return!1;const t=nr(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)===qg}function Ia(e,t){ri(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ri(e){const t=e[Dt];return t?t.type_:Array.isArray(e)?1:ai(e)?2:ii(e)?3:0}function Fs(e,t){return ri(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Gd(e,t,n){const r=ri(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Wg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ai(e){return e instanceof Map}function ii(e){return e instanceof Set}function Dn(e){return e.copy_||e.base_}function Bs(e,t){if(ai(e))return new Map(e);if(ii(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Yd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Dt];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(nr(e),r)}else{const r=nr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function go(e,t=!1){return si(e)||An(e)||!Tn(e)||(ri(e)>1&&(e.set=e.add=e.clear=e.delete=Ug),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>go(r,!0))),e}function Ug(){pt(2)}function si(e){return Object.isFrozen(e)}var Hg={};function Sn(e){const t=Hg[e];return t||pt(0,e),t}var Mr;function Qd(){return Mr}function Vg(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ju(e,t){t&&(Sn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function As(e){Ts(e),e.drafts_.forEach(Kg),e.drafts_=null}function Ts(e){e===Mr&&(Mr=e.parent_)}function Ou(e){return Mr=Vg(Mr,e)}function Kg(e){const t=e[Dt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Pu(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Dt].modified_&&(As(t),pt(4)),Tn(e)&&(e=Ra(t,e),t.parent_||$a(t,e)),t.patches_&&Sn("Patches").generateReplacementPatches_(n[Dt].base_,e,t.patches_,t.inversePatches_)):e=Ra(t,n,[]),As(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zd?e:void 0}function Ra(e,t,n){if(si(t))return t;const r=t[Dt];if(!r)return Ia(t,(a,i)=>Mu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return $a(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),Ia(i,(o,l)=>Mu(e,r,a,o,l,n,s)),$a(e,a,!1),n&&e.patches_&&Sn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Mu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&pt(5),An(a)){const o=i&&t&&t.type_!==3&&!Fs(t.assigned_,r)?i.concat(r):void 0,l=Ra(e,a,o);if(Gd(n,r,l),An(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Tn(a)&&!si(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ra(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&$a(e,a)}}function $a(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&go(t,n)}function Zg(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Qd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=vo;n&&(a=[r],i=Nr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var vo={get(e,t){if(t===Dt)return e;const n=Dn(e);if(!Fs(n,t))return Yg(e,n,t);const r=n[t];return e.finalized_||!Tn(r)?r:r===ji(e.base_,t)?(Oi(e),e.copy_[t]=js(r,e)):r},has(e,t){return t in Dn(e)},ownKeys(e){return Reflect.ownKeys(Dn(e))},set(e,t,n){const r=Jd(Dn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ji(Dn(e),t),i=a==null?void 0:a[Dt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Wg(n,a)&&(n!==void 0||Fs(e.base_,t)))return!0;Oi(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 ji(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Oi(e),Ss(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Dn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){pt(11)},getPrototypeOf(e){return nr(e.base_)},setPrototypeOf(){pt(12)}},Nr={};Ia(vo,(e,t)=>{Nr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Nr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&pt(13),Nr.set.call(this,e,t,void 0)};Nr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&pt(14),vo.set.call(this,e[0],t,n,e[0])};function ji(e,t){const n=e[Dt];return(n?Dn(n):e)[t]}function Yg(e,t,n){var a;const r=Jd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Jd(e,t){if(!(t in e))return;let n=nr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=nr(n)}}function Ss(e){e.modified_||(e.modified_=!0,e.parent_&&Ss(e.parent_))}function Oi(e){e.copy_||(e.copy_=Bs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Gg=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,d=>n.call(this,d,...u))}}typeof n!="function"&&pt(6),r!==void 0&&typeof r!="function"&&pt(7);let a;if(Tn(t)){const i=Ou(this),s=js(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?As(i):Ts(i)}return ju(i,r),Pu(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Zd&&(a=void 0),this.autoFreeze_&&go(a,!0),r){const i=[],s=[];Sn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else pt(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){Tn(e)||pt(8),An(e)&&(e=Qg(e));const t=Ou(this),n=js(e,void 0);return n[Dt].isManual_=!0,Ts(t),n}finishDraft(e,t){const n=e&&e[Dt];(!n||!n.isManual_)&&pt(9);const{scope_:r}=n;return ju(r,t),Pu(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=Sn("Patches").applyPatches_;return An(e)?r(e,t):this.produce(e,a=>r(a,t))}};function js(e,t){const n=ai(e)?Sn("MapSet").proxyMap_(e,t):ii(e)?Sn("MapSet").proxySet_(e,t):Zg(e,t);return(t?t.scope_:Qd()).drafts_.push(n),n}function Qg(e){return An(e)||pt(10,e),Xd(e)}function Xd(e){if(!Tn(e)||si(e))return e;const t=e[Dt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Bs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Bs(e,!0);return Ia(n,(r,a)=>{Gd(n,r,Xd(a))}),t&&(t.finalized_=!1),n}var Ct=new Gg,bo=Ct.produce;Ct.produceWithPatches.bind(Ct);Ct.setAutoFreeze.bind(Ct);Ct.setUseStrictShallowCopy.bind(Ct);Ct.applyPatches.bind(Ct);var Nu=Ct.createDraft.bind(Ct),Iu=Ct.finishDraft.bind(Ct),Jg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=P.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Xg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=we.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ev={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=V.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},La=new WeakMap,za=new WeakMap,Er=new WeakMap,ef=new WeakMap,Ru=new WeakMap,$u=new WeakMap,Lu=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:p}=t;if(P.equals(h,p))return r;if(P.isAncestor(h,r)||P.equals(h,r)){var m=p.slice();return P.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else P.isSibling(h,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):P.endsBefore(h,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Ir(e){"@babel/helpers - typeof";return Ir=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},Ir(e)}function tv(e,t){if(Ir(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ir(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nv(e){var t=tv(e,"string");return Ir(t)==="symbol"?t:String(t)}function ft(e,t,n){return t=nv(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 vr(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){ft(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 rv=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.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 V.points(t))t[l]=we.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var p=ue.leaf(e,u),m=p.text.slice(0,d),g=p.text.slice(d);if(p.text=m+h+g,t)for(var[f,b]of V.points(t))t[b]=we.transform(f,n);break}case"merge_node":{var{path:v}=n,w=ue.get(e,v),A=P.previous(v),_=ue.get(e,A),x=ue.parent(e,v),T=v[v.length-1];if(he.isText(w)&&he.isText(_))_.text+=w.text;else if(!he.isText(w)&&!he.isText(_))_.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(et.stringify(w)," ").concat(et.stringify(_)));if(x.children.splice(T,1),t)for(var[S,z]of V.points(t))t[z]=we.transform(S,n);break}case"move_node":{var{path:M,newPath:q}=n;if(P.isAncestor(M,q))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat(q,"] because the destination is inside itself."));var I=ue.get(e,M),B=ue.parent(e,M),E=M[M.length-1];B.children.splice(E,1);var j=P.transform(M,n),N=ue.get(e,P.parent(j)),W=j[j.length-1];if(N.children.splice(W,0,I),t)for(var[H,G]of V.points(t))t[G]=we.transform(H,n);break}case"remove_node":{var{path:re}=n,C=re[re.length-1],L=ue.parent(e,re);if(L.children.splice(C,1),t)for(var[ee,F]of V.points(t)){var k=we.transform(ee,n);if(t!=null&&k!=null)t[F]=k;else{var $=void 0,R=void 0;for(var[U,ae]of ue.texts(e))if(P.compare(ae,re)===-1)$=[U,ae];else{R=[U,ae];break}var X=!1;$&&R&&(P.equals(R[1],re)?X=!P.hasPrevious(R[1]):X=P.common($[1],re).length<P.common(R[1],re).length),$&&!X?(ee.path=$[1],ee.offset=$[0].text.length):R?(ee.path=R[1],ee.offset=0):t=null}}break}case"remove_text":{var{path:ie,offset:fe,text:Q}=n;if(Q.length===0)break;var ve=ue.leaf(e,ie),pe=ve.text.slice(0,fe),_e=ve.text.slice(fe+Q.length);if(ve.text=pe+_e,t)for(var[Fe,Te]of V.points(t))t[Te]=we.transform(Fe,n);break}case"set_node":{var{path:Ve,properties:We,newProperties:Be}=n;if(Ve.length===0)throw new Error("Cannot set properties on the root node!");var Se=ue.get(e,Ve);for(var De in Be){if(De==="children"||De==="text")throw new Error('Cannot set the "'.concat(De,'" property of nodes!'));var Re=Be[De];Re==null?delete Se[De]:Se[De]=Re}for(var ze in We)Be.hasOwnProperty(ze)||delete Se[ze];break}case"set_selection":{var{newProperties:Y}=n;if(Y==null)t=Y;else{if(t==null){if(!V.isRange(Y))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(et.stringify(Y)," when there is no current selection."));t=vr({},Y)}for(var te in Y){var le=Y[te];if(le==null){if(te==="anchor"||te==="focus")throw new Error('Cannot remove the "'.concat(te,'" selection property'));delete t[te]}else t[te]=le}}break}case"split_node":{var{path:me,position:xe,properties:Ze}=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 Ye=ue.get(e,me),rt=ue.parent(e,me),Ht=me[me.length-1],At;if(he.isText(Ye)){var tt=Ye.text.slice(0,xe),Pt=Ye.text.slice(xe);Ye.text=tt,At=vr(vr({},Ze),{},{text:Pt})}else{var bt=Ye.children.slice(0,xe),mi=Ye.children.slice(xe);Ye.children=bt,At=vr(vr({},Ze),{},{children:mi})}if(rt.children.splice(Ht+1,0,At),t)for(var[cr,Yr]of V.points(t))t[Yr]=we.transform(cr,n);break}}return t},av={transform(e,t){e.children=Nu(e.children);var n=e.selection&&Nu(e.selection);try{n=rv(e,n,t)}finally{e.children=Iu(e.children),n?e.selection=An(n)?Iu(n):n:e.selection=null}}},iv={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)}},sv={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)}},tf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(nt(r)&&nt(a)){if(!tf(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 ov(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 Jt(e,t){if(e==null)return{};var n=ov(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 uv=["anchor","focus"];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 lv(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){ft(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 V={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return V.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=V.edges(e);return t},equals(e,t){return we.equals(e.anchor,t.anchor)&&we.equals(e.focus,t.focus)},includes(e,t){if(V.isRange(t)){if(V.includes(e,t.anchor)||V.includes(e,t.focus))return!0;var[n,r]=V.edges(e),[a,i]=V.edges(t);return we.isBefore(n,a)&&we.isAfter(r,i)}var[s,o]=V.edges(e),l=!1,u=!1;return we.isPoint(t)?(l=we.compare(t,s)>=0,u=we.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Jt(e,uv),[r,a]=V.edges(e),[i,s]=V.edges(t),o=we.isBefore(r,i)?i:r,l=we.isBefore(a,s)?a:s;return we.isBefore(l,o)?null:lv({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return we.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return we.equals(t,n)},isExpanded(e){return!V.isCollapsed(e)},isForward(e){return!V.isBackward(e)},isRange(e){return nt(e)&&we.isPoint(e.anchor)&&we.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=V.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return bo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=V.isCollapsed(r);V.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?V.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=we.transform(r.anchor,t,{affinity:i}),u=we.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Wu=e=>nt(e)&&ue.isNodeList(e.children)&&!D.isEditor(e),de={isAncestor(e){return nt(e)&&ue.isNodeList(e.children)},isElement:Wu,isElementList(e){return Array.isArray(e)&&e.every(t=>de.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 Wu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},cv=["children"],dv=["text"],Uu=new WeakMap,ue={ancestor(e,t){var n=ue.get(e,t);if(he.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(et.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(he.isText(e))throw new Error("Cannot get the child of a text node: ".concat(et.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(et.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=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(D.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(et.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.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 ue.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Jt(e,cv);return t}else{var t=Jt(e,dv);return t}},first(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(he.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(et.stringify(e)));var n=bo({children:e.children},r=>{var[a,i]=V.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!V.includes(t,m)}});for(var[,o]of s){if(!V.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(P.equals(o,a.path)){var h=ue.leaf(r,o);h.text=h.text.slice(a.offset)}}D.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(he.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(et.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(he.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return he.isText(e)||de.isElement(e)||D.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Uu.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return Uu.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.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=ue.get(e,t);if(!he.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(et.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=ue.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||he.isText(e)&&he.isTextProps(t)&&he.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!he.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ue.get(e,o);continue}if(o.length===0)break;if(!r){var d=P.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=P.previous(o);o=h,l=ue.get(e,o);continue}o=P.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ue.get(e,n);if(he.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 he.isText(e)?e.text:e.children.map(ue.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))he.isText(n)&&(yield[n,r])}()}};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 Ue(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){ft(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 ln={isNodeOperation(e){return ln.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!nt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&nt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&nt(e.properties)&&nt(e.newProperties);case"set_selection":return e.properties===null&&V.isRange(e.newProperties)||e.newProperties===null&&V.isRange(e.properties)||nt(e.properties)&&nt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&nt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>ln.isOperation(t))},isSelectionOperation(e){return ln.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return ln.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ue(Ue({},e),{},{type:"remove_node"});case"insert_text":return Ue(Ue({},e),{},{type:"remove_text"});case"merge_node":return Ue(Ue({},e),{},{type:"split_node",path:P.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(P.equals(t,n))return e;if(P.isSibling(n,t))return Ue(Ue({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Ue(Ue({},e),{},{path:r,newPath:a})}case"remove_node":return Ue(Ue({},e),{},{type:"insert_node"});case"remove_text":return Ue(Ue({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ue(Ue({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ue(Ue({},e),{},{properties:l,newProperties:null}):l==null?Ue(Ue({},e),{},{properties:null,newProperties:o}):Ue(Ue({},e),{},{properties:l,newProperties:o})}case"split_node":return Ue(Ue({},e),{},{type:"merge_node",path:P.next(e.path)})}}},Vu=new WeakMap,fv=e=>{var t=Vu.get(e);if(t!==void 0)return t;if(!nt(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||nt(e.marks))&&(e.selection===null||V.isRange(e.selection))&&ue.isNodeList(e.children)&&ln.isOperationList(e.operations);return Vu.set(e,n),n},D={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 fv(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)}},hv={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};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 Zu(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){ft(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 we={compare(e,t){var n=P.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return we.compare(e,t)===1},isBefore(e,t){return we.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return nt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return bo(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=P.transform(i,t,n);break}case"insert_text":{P.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{P.equals(t.path,i)&&(r.offset+=t.position),r.path=P.transform(i,t,n);break}case"remove_text":{P.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(P.equals(t.path,i)||P.isAncestor(t.path,i))return null;r.path=P.transform(i,t,n);break}case"split_node":{if(P.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=P.transform(i,t,Zu(Zu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},Yu=void 0,et={setScrubber(e){Yu=e},stringify(e){return JSON.stringify(e,Yu)}},mv=["text"],pv=["anchor","focus"];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 Kt(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){ft(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 he={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Jt(i,mv);return s}return tf(r?a(e):e,r?a(t):t)},isText(e){return nt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>he.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=[Kt({},e)];for(var r of t){var a=Jt(r,pv),[i,s]=V.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(h);continue}var g=h,f=void 0,b=void 0;if(d<l){var v=d-m;b=Kt(Kt({},g),{},{text:g.text.slice(v)}),g=Kt(Kt({},g),{},{text:g.text.slice(0,v)})}if(u>m){var w=u-m;f=Kt(Kt({},g),{},{text:g.text.slice(0,w)}),g=Kt(Kt({},g),{},{text:g.text.slice(w)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},yo=e=>e.selection?e.selection:e.children.length>0?D.end(e,[]):[0],lr=(e,t)=>{var[n]=D.node(e,t);return r=>r===n},Do=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?Cv(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var d of a){var h=d.codePointAt(0);if(!h)break;var p=Ov(d,h);if([i,s]=r?[s,p]:[p,i],Vn(i,Ce.ZWJ)&&Vn(s,Ce.ExtPict)&&(r?l=Qu(t.substring(0,o)):l=Qu(t.substring(0,t.length-o)),!l)||Vn(i,Ce.RI)&&Vn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Rv(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Mv(i,s))break;o+=d.length}return o||1},gv=/\s/,vv=/[\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]/,bv=/['\u2018\u2019]/,yv=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Do(t,n),[s,o]=Co(t,i,n);if(Dv(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Co=(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)]},Dv=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(gv.test(t))return!1;if(bv.test(t)){var a=Do(n,r),[i,s]=Co(n,a,r);if(e(i,s,r))return!0}return!vv.test(t)},Cv=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(wv(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(xv(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},xv=e=>e>=55296&&e<=56319,wv=e=>e>=56320&&e<=57343,Ce;(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"})(Ce||(Ce={}));var Ev=/^(?:[\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])$/,_v=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,kv=/^(?:[\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])$/,Fv=/^[\u1100-\u115F\uA960-\uA97C]$/,Bv=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Av=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Tv=/^[\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]$/,Sv=/^[\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]$/,jv=/^(?:[\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])$/,Ov=(e,t)=>{var n=Ce.Any;return e.search(Ev)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(_v)!==-1&&(n|=Ce.Prepend),e.search(kv)!==-1&&(n|=Ce.SpacingMark),e.search(Fv)!==-1&&(n|=Ce.L),e.search(Bv)!==-1&&(n|=Ce.V),e.search(Av)!==-1&&(n|=Ce.T),e.search(Tv)!==-1&&(n|=Ce.LV),e.search(Sv)!==-1&&(n|=Ce.LVT),e.search(jv)!==-1&&(n|=Ce.ExtPict),n};function Vn(e,t){return(e&t)!==0}var Pv=[[Ce.L,Ce.L|Ce.V|Ce.LV|Ce.LVT],[Ce.LV|Ce.V,Ce.V|Ce.T],[Ce.LVT|Ce.T,Ce.T],[Ce.Any,Ce.Extend|Ce.ZWJ],[Ce.Any,Ce.SpacingMark],[Ce.Prepend,Ce.Any],[Ce.ZWJ,Ce.ExtPict],[Ce.RI,Ce.RI]];function Mv(e,t){return Pv.findIndex(n=>Vn(e,n[0])&&Vn(t,n[1]))===-1}var Nv=/(?:[\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$/,Qu=e=>e.search(Nv)!==-1,Iv=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Rv=e=>{var t=e.match(Iv);if(t===null)return!1;var n=t[0].length/2;return n%2===1},$v={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]:{};D.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=yo(e)}=n;if(P.isPath(a)&&(a=D.range(e,a)),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var i=V.end(a);if(!r&&D.void(e,{at:i}))return;var s=V.start(a),o=D.pointRef(e,s),l=D.pointRef(e,i);J.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,J.setSelection(e,{anchor:a,focus:a})}if(!(!r&&D.void(e,{at:a})||D.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};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 sa(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){ft(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 J=sa(sa(sa(sa({},av),iv),sv),$v),wa=new WeakMap,Lv=e=>wa.get(e)||!1,zv=(e,t,n)=>{var r=wa.get(e)||!1;wa.set(e,!0);try{t(),n()}finally{wa.set(e,r)}};function nf(e,t,n){var r=La.get(e)||[],a=za.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);La.set(e,i),za.set(e,s)}var qv=(e,t)=>{for(var n of D.pathRefs(e))Jg.transform(n,t);for(var r of D.pointRefs(e))Xg.transform(r,t);for(var a of D.rangeRefs(e))ev.transform(a,t);if(!Lv(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;nf(e,e.getDirtyPaths(t),i)}J.transform(e,t),e.operations.push(t),D.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Er.get(e)||(Er.set(e,!0),Promise.resolve().then(()=>{Er.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Wv=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=he.isText(r)?[]:Array.from(ue.nodes(r),q=>{var[,I]=q;return a.concat(I)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(P.equals(d,h))return[];var p=[],m=[];for(var g of P.ancestors(d)){var f=P.transform(g,t);p.push(f)}for(var b of P.ancestors(h)){var v=P.transform(b,t);m.push(v)}var w=m[m.length-1],A=h[h.length-1],_=w.concat(A);return[...p,...m,_]}case"remove_node":{var{path:x}=t,T=P.ancestors(x);return[...T]}case"split_node":{var{path:S}=t,z=P.levels(S),M=P.next(S);return[...z,M]}default:return[]}},Uv=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},Hv=(e,t)=>{var[n,r]=t;if(!he.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};J.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=D.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||he.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ue.get(e,r);if(!he.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,p=he.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)J.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!he.isText(d)){var m={text:""};J.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};J.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&he.isText(d)&&(he.equals(u,d,{loose:!0})?(J.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(J.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(J.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Vv=(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},Kv=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=D.path(t,i),l=a==="lowest";for(var[u,d]of D.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!he.isText(u)){if(V.isRange(i)){if(P.isAncestor(d,i.anchor.path)&&P.isAncestor(d,i.focus.path))return[u,d]}else if(!P.equals(o,d))return[u,d]}}};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){ft(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 Zv=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!he.isText(h))return!1;var[m,g]=D.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=V.isExpanded(r),s=!1;if(!i){var[o,l]=D.node(e,r);if(o&&a(o,l)){var[u]=D.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)J.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=el(el({},D.marks(e)||{}),{},{[t]:n});e.marks=d,Er.get(e)||e.onChange()}}};function tl(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 nl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.point(t,n,{edge:"end"}),i=D.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,nl(nl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function rl(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 al(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Gv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.start(t,[]),i=D.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,al(al({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Qv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&J.delete(e,{unit:t,reverse:!0})},Jv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&J.delete(e,{unit:t})},Xv=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&V.isExpanded(r)&&J.delete(t,{reverse:n==="backward"})},e0=(e,t)=>[D.start(e,t),D.end(e,t)];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 sl(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){ft(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}var t0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,sl(sl({},n),{},{match:r=>de.isElement(r)&&D.isElementReadOnly(t,r)}))},n0=(e,t)=>D.point(e,t,{edge:"end"}),r0=(e,t)=>{var n=D.path(e,t,{edge:"start"});return D.node(e,n)},a0=(e,t)=>{var n=D.range(e,t);return ue.fragment(e,n)};function ol(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 ul(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ol(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var i0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,ul(ul({},n),{},{match:r=>de.isElement(r)&&D.isVoid(t,r)}))},s0=(e,t)=>t.children.some(n=>de.isElement(n)&&D.isBlock(e,n)),o0=(e,t)=>t.children.some(n=>he.isText(n)||D.isInline(e,n)),u0=(e,t)=>ue.has(e,t),l0=(e,t)=>t.children.every(n=>he.isText(n)),c0=e=>{J.splitNodes(e,{always:!0})},d0=(e,t,n)=>{J.insertNodes(e,t,n)},f0=e=>{J.splitNodes(e,{always:!0})};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 h0(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){ft(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}var m0=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=h0({text:n},i);J.insertNodes(t,s,{at:r.at,voids:r.voids})}else J.insertText(t,n,r);t.marks=null}},p0=(e,t)=>!e.isInline(t),g0=(e,t,n)=>D.isStart(e,t,n)||D.isEnd(e,t,n),v0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&he.isText(r)&&r.text===""&&!e.isVoid(t)},b0=(e,t,n)=>{var r=D.end(e,n);return we.equals(t,r)},y0=e=>{var t=ef.get(e);return t===void 0?!0:t},D0=(e,t,n)=>{if(t.offset!==0)return!1;var r=D.start(e,n);return we.equals(t,r)},C0=(e,t)=>{var n=D.path(e,t,{edge:"end"});return D.node(e,n)},x0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function w0(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=D.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&D.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var E0=["text"],_0=["text"],k0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(V.isExpanded(r)){var s=D.isEnd(t,a,a.path);if(s){var o=D.after(t,a);o&&(a=o)}var[l]=D.nodes(t,{match:he.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=Jt(u,E0);return d}else return{}}var{path:h}=a,[p]=D.leaf(t,h);if(a.offset===0){var m=D.previous(t,{at:h,match:he.isText}),g=D.above(t,{match:_=>de.isElement(_)&&D.isVoid(t,_)&&t.markableVoid(_)});if(!g){var f=D.above(t,{match:_=>de.isElement(_)&&D.isBlock(t,_)});if(m&&f){var[b,v]=m,[,w]=f;P.isAncestor(w,v)&&(p=b)}}}var A=Jt(p,_0);return A},F0=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=D.after(t,s,{voids:a});if(o){var[,l]=D.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[d]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=D.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},B0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.get(t,a);return[i,a]};function A0(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,d;if(hv.isSpan(n))u=n[0],d=n[1];else{var h=D.path(e,n,{edge:"start"}),p=D.path(e,n,{edge:"end"});u=i?p:h,d=i?h:p}var m=ue.nodes(e,{reverse:i,from:u,to:d,pass:_=>{var[x]=_;return de.isElement(x)?!!(!s&&(D.isVoid(e,x)||D.isElementReadOnly(e,x))||o&&!D.isSelectable(e,x)):!1}}),g=[],f;for(var[b,v]of m)if(!(o&&de.isElement(b)&&!D.isSelectable(e,b))){var w=f&&P.compare(v,f[1])===0;if(!(r==="highest"&&w)){if(!l(b,v)){if(a&&!w&&he.isText(b))return;continue}if(r==="lowest"&&w){f=[b,v];continue}var A=r==="lowest"?f:[b,v];A&&(a?g.push(A):yield A),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var T0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>La.get(d)||[],s=d=>za.get(d)||new Set,o=d=>{var h=i(d).pop(),p=h.join(",");return s(d).delete(p),h};if(D.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),d=>{var[,h]=d;return h}),u=new Set(l.map(d=>d.join(",")));La.set(t,l),za.set(t,u)}i(t).length!==0&&D.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var h=D.node(t,d),[p,m]=h;de.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(ue.has(t,v)){var w=D.node(t,v);t.normalizeNode(w,{operation:a})}b++,g=i(t)}})}},S0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=P.parent(a),s=D.node(t,i);return s},j0=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=D.pathRefs(t);return l.delete(i),i.current=null,o}},s=D.pathRefs(t);return s.add(i),i},O0=e=>{var t=Ru.get(e);return t||(t=new Set,Ru.set(e,t)),t},P0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.isPath(n)){if(i==="start"){var[,s]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return V.isRange(n)&&(i==="start"?n=V.start(n):i==="end"?n=V.end(n):n=P.common(n.anchor.path,n.focus.path)),we.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},M0=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=D.pointRefs(t);return l.delete(i),i.current=null,o}},s=D.pointRefs(t);return s.add(i),i},N0=e=>{var t=$u.get(e);return t||(t=new Set,$u.set(e,t)),t},I0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.isPath(n)){var i;if(a==="end"){var[,s]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.get(t,i);if(!he.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(V.isRange(n)){var[u,d]=V.edges(n);return a==="start"?u:d}return n};function R0(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=D.range(e,n),[l,u]=V.edges(o),d=a?u:l,h=!1,p="",m=0,g=0,f=0;for(var[b,v]of D.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield D.start(e,v);continue}if(e.isInline(b))continue;if(D.hasInlines(e,b)){var w=P.isAncestor(v,u.path)?u:D.end(e,v),A=P.isAncestor(v,l.path)?l:D.start(e,v);p=D.string(e,{anchor:A,focus:w},{voids:i}),h=!0}}if(he.isText(b)){var _=P.equals(v,d.path);for(_?(g=a?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=a?g:0),(_||h||r==="offset")&&(yield{path:v,offset:f},h=!1);;){if(m===0){if(p==="")break;m=x(p,r,a),p=Co(p,m,a)[1]}if(f=a?f-m:f+m,g=g-m,g<0){m=-g;break}m=0,yield{path:v,offset:f}}}}function x(T,S,z){return S==="character"?Do(T,z):S==="word"?yv(T,z):S==="line"||S==="block"?T.length:1}}()}var $0=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=D.before(t,s,{voids:a});if(o){var[,l]=D.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[d]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=D.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},L0=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=D.rangeRefs(t);return l.delete(i),i.current=null,o}},s=D.rangeRefs(t);return s.add(i),i},z0=e=>{var t=Lu.get(e);return t||(t=new Set,Lu.set(e,t)),t},q0=(e,t,n)=>{if(V.isRange(t)&&!n)return t;var r=D.start(e,t),a=D.end(e,n||t);return{anchor:r,focus:a}};function cl(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 W0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var U0=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!he.isText(d))return!1;var[p,m]=D.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=V.isExpanded(n),i=!1;if(!a){var[s,o]=D.node(e,n);if(s&&r(s,o)){var[l]=D.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)J.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=W0({},D.marks(e)||{});delete u[t],e.marks=u,Er.get(e)||e.onChange()}}},H0=(e,t)=>{ef.set(e,t)},V0=(e,t)=>D.point(e,t,{edge:"start"}),K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=D.range(t,n),[s,o]=V.edges(i),l="";for(var[u,d]of D.nodes(t,{at:i,match:he.isText,voids:a})){var h=u.text;P.equals(d,o.path)&&(h=h.slice(0,o.offset)),P.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},Z0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=V.edges(n);if(i.offset!==0||s.offset!==0||V.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=D.above(t,{at:s,match:g=>de.isElement(g)&&D.isBlock(t,g),voids:a}),l=o?o[1]:[],u=D.start(t,i),d={anchor:u,focus:s},h=!0;for(var[p,m]of D.nodes(t,{at:d,match:he.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||P.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},Y0=(e,t)=>{var n=D.isNormalizing(e);D.setNormalizing(e,!1);try{t()}finally{D.setNormalizing(e,n)}D.normalize(e)},G0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var h=!1;if(V.isRange(u)&&V.isCollapsed(u)&&(h=!0,u=u.anchor),we.isPoint(u)){var p=D.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var g={unit:s,distance:o},f=i?D.before(t,u,g)||D.start(t,[]):D.after(t,u,g)||D.end(t,[]);u={anchor:u,focus:f},d=!0}}if(P.isPath(u)){J.removeNodes(t,{at:u,voids:l});return}if(!V.isCollapsed(u)){if(!d){var[,b]=V.edges(u),v=D.end(t,[]);we.equals(b,v)||(u=D.unhangRange(t,u,{voids:l}))}var[w,A]=V.edges(u),_=D.above(t,{match:pe=>de.isElement(pe)&&D.isBlock(t,pe),at:w,voids:l}),x=D.above(t,{match:pe=>de.isElement(pe)&&D.isBlock(t,pe),at:A,voids:l}),T=_&&x&&!P.equals(_[1],x[1]),S=P.equals(w.path,A.path),z=l?null:(r=D.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:D.elementReadOnly(t,{at:w,mode:"highest"}),M=l?null:(a=D.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:D.elementReadOnly(t,{at:A,mode:"highest"});if(z){var q=D.before(t,w);q&&_&&P.isAncestor(_[1],q.path)&&(w=q)}if(M){var I=D.after(t,A);I&&x&&P.isAncestor(x[1],I.path)&&(A=I)}var B=[],E;for(var j of D.nodes(t,{at:u,voids:l})){var[N,W]=j;E&&P.compare(W,E)===0||(!l&&de.isElement(N)&&(D.isVoid(t,N)||D.isElementReadOnly(t,N))||!P.isCommon(W,w.path)&&!P.isCommon(W,A.path))&&(B.push(j),E=W)}var H=Array.from(B,pe=>{var[,_e]=pe;return D.pathRef(t,_e)}),G=D.pointRef(t,w),re=D.pointRef(t,A),C="";if(!S&&!z){var L=G.current,[ee]=D.leaf(t,L),{path:F}=L,{offset:k}=w,$=ee.text.slice(k);$.length>0&&(t.apply({type:"remove_text",path:F,offset:k,text:$}),C=$)}if(H.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>J.removeNodes(t,{at:pe,voids:l})),!M){var R=re.current,[U]=D.leaf(t,R),{path:ae}=R,X=S?w.offset:0,ie=U.text.slice(X,A.offset);ie.length>0&&(t.apply({type:"remove_text",path:ae,offset:X,text:ie}),C=ie)}!S&&T&&re.current&&G.current&&J.mergeNodes(t,{at:re.current,hanging:!0,voids:l}),h&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&J.insertText(t,C.slice(0,C.length-o));var fe=G.unref(),Q=re.unref(),ve=i?fe||Q:Q||fe;n.at==null&&ve&&J.select(t,ve)}}})},Q0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=yo(t),batchDirty:o=!0}=r;if(n.length){if(V.isRange(s))if(a||(s=D.unhangRange(t,s,{voids:i})),V.isCollapsed(s))s=s.anchor;else{var[,l]=V.edges(s);if(!i&&D.void(t,{at:l}))return;var u=D.pointRef(t,l);J.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=D.start(t,s));if(!(!i&&D.void(t,{at:s}))){var d=D.above(t,{at:s,match:$=>de.isElement($)&&D.isInline(t,$),mode:"highest",voids:i});if(d){var[,h]=d;if(D.isEnd(t,s,h)){var p=D.after(t,h);s=p}else if(D.isStart(t,s,h)){var m=D.before(t,h);s=m}}var g=D.above(t,{match:$=>de.isElement($)&&D.isBlock(t,$),at:s,voids:i}),[,f]=g,b=D.isStart(t,s,f),v=D.isEnd(t,s,f),w=b&&v,A=!b||b&&v,_=!v,[,x]=ue.first({children:n},[]),[,T]=ue.last({children:n},[]),S=[],z=$=>{var[R,U]=$,ae=U.length===0;return ae?!1:w?!0:!(A&&P.isAncestor(U,x)&&de.isElement(R)&&!t.isVoid(R)&&!t.isInline(R)||_&&P.isAncestor(U,T)&&de.isElement(R)&&!t.isVoid(R)&&!t.isInline(R))};for(var M of ue.nodes({children:n},{pass:z}))z(M)&&S.push(M);var q=[],I=[],B=[],E=!0,j=!1;for(var[N]of S)de.isElement(N)&&!t.isInline(N)?(E=!1,j=!0,I.push(N)):E?q.push(N):B.push(N);var[W]=D.nodes(t,{at:s,match:$=>he.isText($)||D.isInline(t,$),mode:"highest",voids:i}),[,H]=W,G=D.isStart(t,s,H),re=D.isEnd(t,s,H),C=D.pathRef(t,v&&!B.length?P.next(f):f),L=D.pathRef(t,re?P.next(H):H);J.splitNodes(t,{at:s,match:$=>j?de.isElement($)&&D.isBlock(t,$):he.isText($)||D.isInline(t,$),mode:j?"lowest":"highest",always:j&&(!b||q.length>0)&&(!v||B.length>0),voids:i});var ee=D.pathRef(t,!G||G&&re?P.next(H):H);if(J.insertNodes(t,q,{at:ee.current,match:$=>he.isText($)||D.isInline(t,$),mode:"highest",voids:i,batchDirty:o}),w&&!q.length&&I.length&&!B.length&&J.delete(t,{at:f,voids:i}),J.insertNodes(t,I,{at:C.current,match:$=>de.isElement($)&&D.isBlock(t,$),mode:"lowest",voids:i,batchDirty:o}),J.insertNodes(t,B,{at:L.current,match:$=>he.isText($)||D.isInline(t,$),mode:"highest",voids:i,batchDirty:o}),!r.at){var F;if(B.length>0&&L.current?F=P.previous(L.current):I.length>0&&C.current?F=P.previous(C.current):ee.current&&(F=P.previous(ee.current)),F){var k=D.end(t,F);J.select(t,k)}}ee.unref(),C.unref(),L.unref()}}})},J0=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")J.select(t,a.anchor);else if(r==="focus")J.select(t,a.focus);else if(r==="start"){var[i]=V.edges(a);J.select(t,i)}else if(r==="end"){var[,s]=V.edges(a);J.select(t,s)}}else return},X0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},eb=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=V.isBackward(r)?"focus":"anchor"),o==="end"&&(o=V.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?D.before(t,l,d):D.after(t,l,d);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?D.before(t,u,d):D.after(t,u,d);m&&(h.focus=m)}J.setSelection(t,h)}},tb=(e,t)=>{var{selection:n}=e;if(t=D.range(e,t),n){J.setSelection(e,t);return}if(!V.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(et.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function dl(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 fl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nb=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=V.isBackward(a)?"focus":"anchor"),i==="end"&&(i=V.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;J.setSelection(t,{[i==="anchor"?"anchor":"focus"]:fl(fl({},l),n)})}},rb=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!we.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!we.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})}},ab=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=yo(t),d!==!1&&(d=!0)),d==null&&(d=!1),V.isRange(l))if(a||(l=D.unhangRange(t,l,{voids:i})),V.isCollapsed(l))l=l.anchor;else{var[,p]=V.edges(l),m=D.pointRef(t,p);J.delete(t,{at:l}),l=m.unref()}if(we.isPoint(l)){u==null&&(he.isText(h)?u=q=>he.isText(q):t.isInline(h)?u=q=>he.isText(q)||D.isInline(t,q):u=q=>de.isElement(q)&&D.isBlock(t,q));var[g]=D.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=D.pathRef(t,f),v=D.isEnd(t,l,f);J.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=b.unref();l=v?P.next(w):w}else return}var A=P.parent(l),_=l[l.length-1];if(!(!i&&D.void(t,{at:A}))){if(o){var x=[],T=P.levels(A);zv(t,()=>{var q=function(){var E=A.concat(_);_++;var j={type:"insert_node",path:E,node:I};t.apply(j),l=P.next(l),x.push(j),he.isText?T.push(...Array.from(ue.nodes(I),N=>{var[,W]=N;return E.concat(W)})):T.push(E)};for(var I of n)q()},()=>{nf(t,T,q=>{var I=q;for(var B of x)if(P.operationCanTransformPath(B)&&(I=P.transform(I,B),!I))return null;return I})})}else for(var S of n){var z=A.concat(_);_++,t.apply({type:"insert_node",path:z,node:S}),l=P.next(l)}if(l=P.previous(l),d){var M=D.end(t,l);M&&J.select(t,M)}}}})},ib=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?lr(t,r):_=>de.isElement(_)&&D.isBlock(t,_)),!!r){var o=D.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,_=>{var[,x]=_;return D.pathRef(t,x)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var h=D.node(t,P.parent(d)),[p,m]=h,g=d[d.length-1],{length:f}=p.children;if(f===1){var b=P.next(m);J.moveNodes(t,{at:d,to:b,voids:i}),J.removeNodes(t,{at:m,voids:i})}else if(g===0)J.moveNodes(t,{at:d,to:m,voids:i});else if(g===f-1){var v=P.next(m);J.moveNodes(t,{at:d,to:v,voids:i})}else{var w=P.next(d),A=P.next(m);J.splitNodes(t,{at:w,voids:i}),J.moveNodes(t,{at:d,to:A,voids:i})}}}})},sb=["text"],ob=["children"],rf=(e,t)=>{if(de.isElement(t)){var n=t;return D.isVoid(e,t)?!0:n.children.length===1?rf(e,n.children[0]):!1}else return!D.isEditor(t)},ub=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(P.isPath(a)){var[l]=D.parent(t,a);r=q=>l.children.includes(q)}else r=q=>de.isElement(q)&&D.isBlock(t,q);if(!i&&V.isRange(a)&&(a=D.unhangRange(t,a,{voids:s})),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var[,u]=V.edges(a),d=D.pointRef(t,u);J.delete(t,{at:a}),a=d.unref(),n.at==null&&J.select(t,a)}var[h]=D.nodes(t,{at:a,match:r,voids:s,mode:o}),p=D.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,g]=h,[f,b]=p;if(!(g.length===0||b.length===0)){var v=P.next(b),w=P.common(g,b),A=P.isSibling(g,b),_=Array.from(D.levels(t,{at:g}),q=>{var[I]=q;return I}).slice(w.length).slice(0,-1),x=D.above(t,{at:g,mode:"highest",match:q=>_.includes(q)&&rf(t,q)}),T=x&&D.pathRef(t,x[1]),S,z;if(he.isText(m)&&he.isText(f)){var M=Jt(m,sb);z=f.text.length,S=M}else if(de.isElement(m)&&de.isElement(f)){var M=Jt(m,ob);z=f.children.length,S=M}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(et.stringify(m)," ").concat(et.stringify(f)));A||J.moveNodes(t,{at:g,to:v,voids:s}),T&&J.removeNodes(t,{at:T.current,voids:s}),de.isElement(f)&&D.isEmpty(t,f)||he.isText(f)&&f.text===""&&b[b.length-1]!==0?J.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:z,properties:S}),T&&T.unref()}}}})},lb=(e,t)=>{D.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=P.isPath(r)?lr(e,r):m=>de.isElement(m)&&D.isBlock(e,m));var o=D.pathRef(e,n),l=D.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,g]=m;return D.pathRef(e,g)});for(var d of u){var h=d.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&P.isSibling(p,h)&&P.isAfter(p,h)&&(o.current=P.next(o.current))}o.unref()}})},cb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?lr(t,s):m=>de.isElement(m)&&D.isBlock(t,m)),!r&&V.isRange(s)&&(s=D.unhangRange(t,s,{voids:a}));var l=D.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,m=>{var[,g]=m;return D.pathRef(t,g)});for(var d of u){var h=d.unref();if(h){var[p]=D.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},db=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:h=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?lr(t,i):z=>de.isElement(z)&&D.isBlock(t,z)),!l&&V.isRange(i)&&(i=D.unhangRange(t,i,{voids:h})),d&&V.isRange(i)){if(V.isCollapsed(i)&&D.leaf(t,i.anchor)[0].text.length>0)return;var p=D.rangeRef(t,i,{affinity:"inward"}),[m,g]=V.edges(i),f=u==="lowest"?"lowest":"highest",b=D.isEnd(t,g,g.path);J.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!b});var v=D.isStart(t,m,m.path);J.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!v}),i=p.unref(),r.at==null&&J.select(t,i)}s||(s=(z,M)=>z!==M);for(var[w,A]of D.nodes(t,{at:i,match:a,mode:u,voids:h})){var _={},x={};if(A.length!==0){var T=!1;for(var S in n)S==="children"||S==="text"||s(n[S],w[S])&&(T=!0,w.hasOwnProperty(S)&&(_[S]=w[S]),o?n[S]!=null&&(x[S]=o(w[S],n[S])):n[S]!=null&&(x[S]=n[S]));T&&t.apply({type:"set_node",path:A,properties:_,newProperties:x})}}}})},fb=(e,t)=>{if(V.isCollapsed(t))return t.anchor;var[,n]=V.edges(t),r=D.pointRef(e,n);return J.delete(e,{at:t}),r.unref()},hb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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=re=>de.isElement(re)&&D.isBlock(t,re)),V.isRange(s)&&(s=fb(t,s)),P.isPath(s)){var u=s,d=D.point(t,u),[h]=D.parent(t,u);i=re=>re===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=D.pointRef(t,s,{affinity:"backward"}),m;try{var[g]=D.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=D.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,w]=f;if(de.isElement(v)&&t.isInline(v)){var A=D.after(t,w);if(!A){var _={text:""},x=P.next(w);J.insertNodes(t,_,{at:x,voids:a}),A=D.point(t,x)}s=A,l=!0}var T=s.path.length-w.length;o=T+1,l=!0}m=D.pointRef(t,s);var S=s.path.length-o,[,z]=g,M=s.path.slice(0,S),q=o===0?s.offset:s.path[S]+b;for(var[I,B]of D.levels(t,{at:M,reverse:!0,voids:a})){var E=!1;if(B.length<z.length||B.length===0||!a&&de.isElement(I)&&D.isVoid(t,I))break;var j=p.current,N=D.isEnd(t,j,B);if(l||!p||!D.isEdge(t,j,B)){E=!0;var W=ue.extractProps(I);t.apply({type:"split_node",path:B,position:q,properties:W})}q=B[B.length-1]+(E||N?1:0)}if(n.at==null){var H=m.current||D.end(t,[]);J.select(t,H)}}finally{var G;p.unref(),(G=m)===null||G===void 0||G.unref()}}})},mb=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;J.setNodes(t,a,r)},pb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?lr(t,s):m=>de.isElement(m)&&D.isBlock(t,m)),P.isPath(s)&&(s=D.range(t,s));var l=V.isRange(s)?D.rangeRef(t,s):null,u=D.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,m=>{var[,g]=m;return D.pathRef(t,g)}).reverse(),h=function(){var g=p.unref(),[f]=D.node(t,g),b=D.range(t,g);a&&l&&(b=V.intersection(l.current,b)),J.liftNodes(t,{at:b,match:v=>de.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of d)h();l&&l.unref()}})};function hl(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 ml(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(P.isPath(l)?o=lr(t,l):t.isInline(n)?o=b=>de.isElement(b)&&D.isInline(t,b)||he.isText(b):o=b=>de.isElement(b)&&D.isBlock(t,b)),i&&V.isRange(l)){var[u,d]=V.edges(l),h=D.rangeRef(t,l,{affinity:"inward"});J.splitNodes(t,{at:d,match:o,voids:s}),J.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&J.select(t,l)}var p=Array.from(D.nodes(t,{at:l,match:t.isInline(n)?b=>de.isElement(b)&&D.isBlock(t,b):b=>D.isEditor(b),mode:"lowest",voids:s})),m=function(){var v=V.isRange(l)?V.intersection(l,D.range(t,f)):l;if(!v)return 0;var w=Array.from(D.nodes(t,{at:v,match:o,mode:a,voids:s}));if(w.length>0){var[A]=w,_=w[w.length-1],[,x]=A,[,T]=_;if(x.length===0&&T.length===0)return 0;var S=P.equals(x,T)?P.parent(x):P.common(x,T),z=D.range(t,x,T),M=D.node(t,S),[q]=M,I=S.length+1,B=P.next(T.slice(0,I)),E=ml(ml({},n),{},{children:[]});J.insertNodes(t,E,{at:B,voids:s}),J.moveNodes(t,{at:z,match:j=>de.isAncestor(q)&&q.children.includes(j),to:B.concat(0),voids:s})}},g;for(var[,f]of p)g=m()}})},vb=()=>{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 qv(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zv(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qv(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jv(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xv(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uv(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return d0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return m0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wv(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vv(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kv(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yv(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gv(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return n0(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return a0(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l0(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ab(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return p0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return g0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return D0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return x0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return w0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ib(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ub(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eb(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lb(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return P0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return j0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return z0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cb(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tb(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return db(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nb(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rb(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hb(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mb(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pb(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gb(e,...r)}};return e},bb={isHistory(e){return nt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||ln.isOperationList(e.redos[0].operations))&&(e.undos.length===0||ln.isOperationList(e.undos[0].operations))}},Pi=new WeakMap,Mi=new WeakMap,Kn={isHistoryEditor(e){return bb.isHistory(e.history)&&D.isEditor(e)},isMerging(e){return Mi.get(e)},isSaving(e){return Pi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Kn.isMerging(e);Mi.set(e,!1),t(),Mi.set(e,n)},withoutSaving(e,t){var n=Kn.isSaving(e);Pi.set(e,!1),t(),Pi.set(e,n)}},yb=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&&J.setSelection(t,i.selectionBefore),Kn.withoutSaving(t,()=>{D.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];Kn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{var s=i.operations.map(ln.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&J.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=Kn.isSaving(t),d=Kn.isMerging(t);if(u==null&&(u=Cb(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=Db(r,l)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},Db=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&P.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&P.equals(e.path,t.path)),Cb=(e,t)=>e.type!=="set_selection",xb=_b,af="֑-߿יִ-﷽ﹰ-ﻼ",sf="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",wb=new RegExp("^[^"+sf+"]*["+af+"]"),Eb=new RegExp("^[^"+af+"]*["+sf+"]");function _b(e){return e=String(e||""),wb.test(e)?"rtl":Eb.test(e)?"ltr":"neutral"}const of=On(xb);function kb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var xo=kb,Fb=typeof Gr=="object"&&Gr&&Gr.Object===Object&&Gr,Bb=Fb,Ab=Bb,Tb=typeof self=="object"&&self&&self.Object===Object&&self,Sb=Ab||Tb||Function("return this")(),uf=Sb,jb=uf,Ob=function(){return jb.Date.now()},Pb=Ob,Mb=/\s/;function Nb(e){for(var t=e.length;t--&&Mb.test(e.charAt(t)););return t}var Ib=Nb,Rb=Ib,$b=/^\s+/;function Lb(e){return e&&e.slice(0,Rb(e)+1).replace($b,"")}var zb=Lb,qb=uf,Wb=qb.Symbol,lf=Wb,pl=lf,cf=Object.prototype,Ub=cf.hasOwnProperty,Hb=cf.toString,br=pl?pl.toStringTag:void 0;function Vb(e){var t=Ub.call(e,br),n=e[br];try{e[br]=void 0;var r=!0}catch{}var a=Hb.call(e);return r&&(t?e[br]=n:delete e[br]),a}var Kb=Vb,Zb=Object.prototype,Yb=Zb.toString;function Gb(e){return Yb.call(e)}var Qb=Gb,gl=lf,Jb=Kb,Xb=Qb,ey="[object Null]",ty="[object Undefined]",vl=gl?gl.toStringTag:void 0;function ny(e){return e==null?e===void 0?ty:ey:vl&&vl in Object(e)?Jb(e):Xb(e)}var ry=ny;function ay(e){return e!=null&&typeof e=="object"}var iy=ay,sy=ry,oy=iy,uy="[object Symbol]";function ly(e){return typeof e=="symbol"||oy(e)&&sy(e)==uy}var cy=ly,dy=zb,bl=xo,fy=cy,yl=0/0,hy=/^[-+]0x[0-9a-f]+$/i,my=/^0b[01]+$/i,py=/^0o[0-7]+$/i,gy=parseInt;function vy(e){if(typeof e=="number")return e;if(fy(e))return yl;if(bl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=bl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=dy(e);var n=my.test(e);return n||py.test(e)?gy(e.slice(2),n?2:8):hy.test(e)?yl:+e}var by=vy,yy=xo,Ni=Pb,Dl=by,Dy="Expected a function",Cy=Math.max,xy=Math.min;function wy(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(Dy);t=Dl(t)||0,yy(n)&&(d=!!n.leading,h="maxWait"in n,i=h?Cy(Dl(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(T){var S=r,z=a;return r=a=void 0,u=T,s=e.apply(z,S),s}function g(T){return u=T,o=setTimeout(v,t),d?m(T):s}function f(T){var S=T-l,z=T-u,M=t-S;return h?xy(M,i-z):M}function b(T){var S=T-l,z=T-u;return l===void 0||S>=t||S<0||h&&z>=i}function v(){var T=Ni();if(b(T))return w(T);o=setTimeout(v,f(T))}function w(T){return o=void 0,p&&r?m(T):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function _(){return o===void 0?s:w(Ni())}function x(){var T=Ni(),S=b(T);if(r=arguments,a=this,l=T,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(v,t),m(l)}return o===void 0&&(o=setTimeout(v,t)),s}return x.cancel=A,x.flush=_,x}var df=wy;const Ey=On(df);var _y=df,ky=xo,Fy="Expected a function";function By(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Fy);return ky(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),_y(e,t,{leading:r,maxWait:t,trailing:a})}var Ay=By;const Ty=On(Ay),Cl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,xl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ii=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return xl(n.overflowY,t)||xl(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},oa=(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,Sy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},wl=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,h=typeof u=="function"?u:W=>W!==u;if(!Cl(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let g=e;for(;Cl(g)&&h(g);){if(g=Sy(g),g===p){m.push(g);break}g!=null&&g===document.body&&Ii(g)&&!Ii(document.documentElement)||g!=null&&Ii(g,d)&&m.push(g)}const f=(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:w}=window,{height:A,width:_,top:x,right:T,bottom:S,left:z}=e.getBoundingClientRect(),{top:M,right:q,bottom:I,left:B}=(W=>{const H=window.getComputedStyle(W);return{top:parseFloat(H.scrollMarginTop)||0,right:parseFloat(H.scrollMarginRight)||0,bottom:parseFloat(H.scrollMarginBottom)||0,left:parseFloat(H.scrollMarginLeft)||0}})(e);let E=o==="start"||o==="nearest"?x-M:o==="end"?S+I:x+A/2-M+I,j=l==="center"?z+_/2-B+q:l==="end"?T+q:z-B;const N=[];for(let W=0;W<m.length;W++){const H=m[W],{height:G,width:re,top:C,right:L,bottom:ee,left:F}=H.getBoundingClientRect();if(s==="if-needed"&&x>=0&&z>=0&&S<=b&&T<=f&&x>=C&&S<=ee&&z>=F&&T<=L)return N;const k=getComputedStyle(H),$=parseInt(k.borderLeftWidth,10),R=parseInt(k.borderTopWidth,10),U=parseInt(k.borderRightWidth,10),ae=parseInt(k.borderBottomWidth,10);let X=0,ie=0;const fe="offsetWidth"in H?H.offsetWidth-H.clientWidth-$-U:0,Q="offsetHeight"in H?H.offsetHeight-H.clientHeight-R-ae:0,ve="offsetWidth"in H?H.offsetWidth===0?0:re/H.offsetWidth:0,pe="offsetHeight"in H?H.offsetHeight===0?0:G/H.offsetHeight:0;if(p===H)X=o==="start"?E:o==="end"?E-b:o==="nearest"?oa(w,w+b,b,R,ae,w+E,w+E+A,A):E-b/2,ie=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:oa(v,v+f,f,$,U,v+j,v+j+_,_),X=Math.max(0,X+w),ie=Math.max(0,ie+v);else{X=o==="start"?E-C-R:o==="end"?E-ee+ae+Q:o==="nearest"?oa(C,ee,G,R,ae+Q,E,E+A,A):E-(C+G/2)+Q/2,ie=l==="start"?j-F-$:l==="center"?j-(F+re/2)+fe/2:l==="end"?j-L+U+fe:oa(F,L,re,$,U+fe,j,j+_,_);const{scrollLeft:_e,scrollTop:Fe}=H;X=pe===0?0:Math.max(0,Math.min(Fe+X/pe,H.scrollHeight-G/pe+Q)),ie=ve===0?0:Math.max(0,Math.min(_e+ie/ve,H.scrollWidth-re/ve+fe)),E+=Fe-X,j+=_e-ie}N.push({el:H,top:X,left:ie})}return N},jy=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Oy(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(wl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of wl(e,jy(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var En=[],Py=function(){return En.some(function(e){return e.activeTargets.length>0})},My=function(){return En.some(function(e){return e.skippedTargets.length>0})},El="ResizeObserver loop completed with undelivered notifications.",Ny=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:El}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=El),window.dispatchEvent(e)},Rr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Rr||(Rr={}));var _n=function(e){return Object.freeze(e)},Iy=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,_n(this)}return e}(),ff=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,_n(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}(),wo=function(e){return e instanceof SVGElement&&"getBBox"in e},hf=function(e){if(wo(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)},_l=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)},Ry=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},_r=typeof window<"u"?window:{},ua=new WeakMap,kl=/auto|scroll/,$y=/^tb|vertical/,Ly=/msie|trident/i.test(_r.navigator&&_r.navigator.userAgent),Mt=function(e){return parseFloat(e||"0")},Qn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Iy((n?t:e)||0,(n?e:t)||0)},Fl=_n({devicePixelContentBoxSize:Qn(),borderBoxSize:Qn(),contentBoxSize:Qn(),contentRect:new ff(0,0,0,0)}),mf=function(e,t){if(t===void 0&&(t=!1),ua.has(e)&&!t)return ua.get(e);if(hf(e))return ua.set(e,Fl),Fl;var n=getComputedStyle(e),r=wo(e)&&e.ownerSVGElement&&e.getBBox(),a=!Ly&&n.boxSizing==="border-box",i=$y.test(n.writingMode||""),s=!r&&kl.test(n.overflowY||""),o=!r&&kl.test(n.overflowX||""),l=r?0:Mt(n.paddingTop),u=r?0:Mt(n.paddingRight),d=r?0:Mt(n.paddingBottom),h=r?0:Mt(n.paddingLeft),p=r?0:Mt(n.borderTopWidth),m=r?0:Mt(n.borderRightWidth),g=r?0:Mt(n.borderBottomWidth),f=r?0:Mt(n.borderLeftWidth),b=h+u,v=l+d,w=f+m,A=p+g,_=o?e.offsetHeight-A-e.clientHeight:0,x=s?e.offsetWidth-w-e.clientWidth:0,T=a?b+w:0,S=a?v+A:0,z=r?r.width:Mt(n.width)-T-x,M=r?r.height:Mt(n.height)-S-_,q=z+b+x+w,I=M+v+_+A,B=_n({devicePixelContentBoxSize:Qn(Math.round(z*devicePixelRatio),Math.round(M*devicePixelRatio),i),borderBoxSize:Qn(q,I,i),contentBoxSize:Qn(z,M,i),contentRect:new ff(h,l,z,M)});return ua.set(e,B),B},pf=function(e,t,n){var r=mf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Rr.DEVICE_PIXEL_CONTENT_BOX:return s;case Rr.BORDER_BOX:return a;default:return i}},zy=function(){function e(t){var n=mf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=_n([n.borderBoxSize]),this.contentBoxSize=_n([n.contentBoxSize]),this.devicePixelContentBoxSize=_n([n.devicePixelContentBoxSize])}return e}(),gf=function(e){if(hf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},qy=function(){var e=1/0,t=[];En.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new zy(u.target),h=gf(u.target);o.push(d),u.lastReportedSize=pf(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Bl=function(e){En.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(gf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Wy=function(){var e=0;for(Bl(e);Py();)e=qy(),Bl(e);return My()&&Ny(),e>0},Ri,vf=[],Uy=function(){return vf.splice(0).forEach(function(e){return e()})},Hy=function(e){if(!Ri){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Uy()}).observe(n,r),Ri=function(){n.textContent="".concat(t?t--:t++)}}vf.push(e),Ri()},Vy=function(e){Hy(function(){requestAnimationFrame(e)})},Ea=0,Ky=function(){return!!Ea},Zy=250,Yy={attributes:!0,characterData:!0,childList:!0,subtree:!0},Al=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Tl=function(e){return e===void 0&&(e=0),Date.now()+e},$i=!1,Gy=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=Zy),!$i){$i=!0;var r=Tl(t);Vy(function(){var a=!1;try{a=Wy()}finally{if($i=!1,t=r-Tl(),!Ky())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,Yy)};document.body?n():_r.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Al.forEach(function(n){return _r.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Al.forEach(function(n){return _r.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Os=new Gy,Sl=function(e){!Ea&&e>0&&Os.start(),Ea+=e,!Ea&&Os.stop()},Qy=function(e){return!wo(e)&&!Ry(e)&&getComputedStyle(e).display==="inline"},Jy=function(){function e(t,n){this.target=t,this.observedBox=n||Rr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=pf(this.target,this.observedBox,!0);return Qy(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Xy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),la=new WeakMap,jl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ca=function(){function e(){}return e.connect=function(t,n){var r=new Xy(t,n);la.set(t,r)},e.observe=function(t,n,r){var a=la.get(t),i=a.observationTargets.length===0;jl(a.observationTargets,n)<0&&(i&&En.push(a),a.observationTargets.push(new Jy(n,r&&r.box)),Sl(1),Os.schedule())},e.unobserve=function(t,n){var r=la.get(t),a=jl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&En.splice(En.indexOf(r),1),r.observationTargets.splice(a,1),Sl(-1))},e.disconnect=function(t){var n=this,r=la.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),e1=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.");ca.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(!_l(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ca.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(!_l(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ca.unobserve(this,t)},e.prototype.disconnect=function(){ca.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),tn={};Object.defineProperty(tn,"__esModule",{value:!0});var t1=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Li={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},bf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:t1?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Eo={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 da=1;da<20;da++)Eo["f"+da]=111+da;function oi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return yf(s,t)}),a=function(o){return r.some(function(l){return Df(l,o)})},i=n==null?a:a(n);return i}function n1(e,t){return oi(e,t)}function r1(e,t){return oi(e,{byKey:!0},t)}function yf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Li)r[Li[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var g=_o(p),f=Li[g];if(p.length>1&&!f&&!bf[p]&&!Eo[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=Cf(p)),f&&(r[f]=m?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Df(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 Cf(e){e=_o(e);var t=Eo[e]||e.toUpperCase().charCodeAt(0);return t}function _o(e){return e=e.toLowerCase(),e=bf[e]||e,e}var a1=tn.default=oi,zi=tn.isHotkey=oi;tn.isCodeHotkey=n1;tn.isKeyHotkey=r1;tn.parseHotkey=yf;tn.compareHotkey=Df;tn.toKeyCode=Cf;tn.toKeyName=_o;function i1(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 rr(e,t){if(e==null)return{};var n=i1(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 s1(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 o1(e){var t=s1(e,"string");return $r(t)==="symbol"?t:String(t)}function Ft(e,t,n){return t=o1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ko=y.createContext(null),gn=()=>{var e=y.useContext(ko);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},xf=parseInt(y.version.split(".")[0],10),u1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ol=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ct=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Zn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),xr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),l1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),wf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),c1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),d1=ct&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),f1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),h1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),m1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),_a=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rn=(!c1||!d1)&&!l1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Fo=new WeakMap,Bo=new WeakMap,Ef=new WeakMap,ka=new WeakMap,Ps=new WeakMap,Lr=new WeakMap,kn=new WeakMap,qa=new WeakMap,ui=new WeakMap,Ms=new WeakMap,cn=new WeakMap,xn=new WeakMap,kr=new WeakMap,Ns=new WeakMap,Ao=new WeakMap,St=new WeakMap,Yt=new WeakMap,mt=new WeakMap,sn=new WeakMap,on=new WeakMap,_f=new WeakMap,ar=Symbol("placeholder"),kf=Symbol("mark-placeholder"),p1=globalThis.Text,To=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,g1=e=>dn(e)&&e.nodeType===8,kt=e=>dn(e)&&e.nodeType===1,dn=e=>{var t=To(e);return!!t&&e instanceof t.Node},Is=e=>{var t=e&&e.anchorNode&&To(e.anchorNode);return!!t&&e instanceof t.Selection},Ff=e=>dn(e)&&e.nodeType===3,v1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,b1=e=>{var[t,n]=e;if(kt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Bf(t,a,r?"backward":"forward"),r=a<n;kt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=D1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},y1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Bf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(g1(a)||kt(a)&&a.childNodes.length===0||kt(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]},D1=(e,t,n)=>{var[r]=Bf(e,t,n);return r},Af=e=>{var t="";if(Ff(e)&&e.nodeValue)return e.nodeValue;if(kt(e)){for(var n of Array.from(e.childNodes))t+=Af(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
130
|
-
`)}return t},C1=/data-slate-fragment="(.+?)"/m,x1=e=>{var t=e.getData("text/html"),[,n]=t.match(C1)||[];return n},
|
|
129
|
+
*/function Su(e){return Object.prototype.toString.call(e)==="[object Object]"}function nt(e){var t,n;return Su(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Su(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Zd=Symbol.for("immer-nothing"),ju=Symbol.for("immer-draftable"),Dt=Symbol.for("immer-state"),zg=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 pt(e,...t){if(process.env.NODE_ENV!=="production"){const n=zg[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 nr=Object.getPrototypeOf;function An(e){return!!e&&!!e[Dt]}function Tn(e){var t;return e?Yd(e)||Array.isArray(e)||!!e[ju]||!!((t=e.constructor)!=null&&t[ju])||ii(e)||si(e):!1}var qg=Object.prototype.constructor.toString();function Yd(e){if(!e||typeof e!="object")return!1;const t=nr(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)===qg}function Ra(e,t){ai(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ai(e){const t=e[Dt];return t?t.type_:Array.isArray(e)?1:ii(e)?2:si(e)?3:0}function Fs(e,t){return ai(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Gd(e,t,n){const r=ai(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Wg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ii(e){return e instanceof Map}function si(e){return e instanceof Set}function Dn(e){return e.copy_||e.base_}function Bs(e,t){if(ii(e))return new Map(e);if(si(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Yd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Dt];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(nr(e),r)}else{const r=nr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function vo(e,t=!1){return oi(e)||An(e)||!Tn(e)||(ai(e)>1&&(e.set=e.add=e.clear=e.delete=Ug),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>vo(r,!0))),e}function Ug(){pt(2)}function oi(e){return Object.isFrozen(e)}var Hg={};function Sn(e){const t=Hg[e];return t||pt(0,e),t}var Mr;function Qd(){return Mr}function Vg(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ou(e,t){t&&(Sn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function As(e){Ts(e),e.drafts_.forEach(Kg),e.drafts_=null}function Ts(e){e===Mr&&(Mr=e.parent_)}function Pu(e){return Mr=Vg(Mr,e)}function Kg(e){const t=e[Dt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Mu(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Dt].modified_&&(As(t),pt(4)),Tn(e)&&(e=$a(t,e),t.parent_||La(t,e)),t.patches_&&Sn("Patches").generateReplacementPatches_(n[Dt].base_,e,t.patches_,t.inversePatches_)):e=$a(t,n,[]),As(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zd?e:void 0}function $a(e,t,n){if(oi(t))return t;const r=t[Dt];if(!r)return Ra(t,(a,i)=>Nu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return La(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),Ra(i,(o,l)=>Nu(e,r,a,o,l,n,s)),La(e,a,!1),n&&e.patches_&&Sn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Nu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&pt(5),An(a)){const o=i&&t&&t.type_!==3&&!Fs(t.assigned_,r)?i.concat(r):void 0,l=$a(e,a,o);if(Gd(n,r,l),An(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Tn(a)&&!oi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;$a(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&La(e,a)}}function La(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&vo(t,n)}function Zg(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Qd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=bo;n&&(a=[r],i=Nr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var bo={get(e,t){if(t===Dt)return e;const n=Dn(e);if(!Fs(n,t))return Yg(e,n,t);const r=n[t];return e.finalized_||!Tn(r)?r:r===ji(e.base_,t)?(Oi(e),e.copy_[t]=js(r,e)):r},has(e,t){return t in Dn(e)},ownKeys(e){return Reflect.ownKeys(Dn(e))},set(e,t,n){const r=Jd(Dn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ji(Dn(e),t),i=a==null?void 0:a[Dt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Wg(n,a)&&(n!==void 0||Fs(e.base_,t)))return!0;Oi(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 ji(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Oi(e),Ss(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Dn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){pt(11)},getPrototypeOf(e){return nr(e.base_)},setPrototypeOf(){pt(12)}},Nr={};Ra(bo,(e,t)=>{Nr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Nr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&pt(13),Nr.set.call(this,e,t,void 0)};Nr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&pt(14),bo.set.call(this,e[0],t,n,e[0])};function ji(e,t){const n=e[Dt];return(n?Dn(n):e)[t]}function Yg(e,t,n){var a;const r=Jd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Jd(e,t){if(!(t in e))return;let n=nr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=nr(n)}}function Ss(e){e.modified_||(e.modified_=!0,e.parent_&&Ss(e.parent_))}function Oi(e){e.copy_||(e.copy_=Bs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Gg=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,d=>n.call(this,d,...u))}}typeof n!="function"&&pt(6),r!==void 0&&typeof r!="function"&&pt(7);let a;if(Tn(t)){const i=Pu(this),s=js(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?As(i):Ts(i)}return Ou(i,r),Mu(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Zd&&(a=void 0),this.autoFreeze_&&vo(a,!0),r){const i=[],s=[];Sn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else pt(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){Tn(e)||pt(8),An(e)&&(e=Qg(e));const t=Pu(this),n=js(e,void 0);return n[Dt].isManual_=!0,Ts(t),n}finishDraft(e,t){const n=e&&e[Dt];(!n||!n.isManual_)&&pt(9);const{scope_:r}=n;return Ou(r,t),Mu(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=Sn("Patches").applyPatches_;return An(e)?r(e,t):this.produce(e,a=>r(a,t))}};function js(e,t){const n=ii(e)?Sn("MapSet").proxyMap_(e,t):si(e)?Sn("MapSet").proxySet_(e,t):Zg(e,t);return(t?t.scope_:Qd()).drafts_.push(n),n}function Qg(e){return An(e)||pt(10,e),Xd(e)}function Xd(e){if(!Tn(e)||oi(e))return e;const t=e[Dt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Bs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Bs(e,!0);return Ra(n,(r,a)=>{Gd(n,r,Xd(a))}),t&&(t.finalized_=!1),n}var Ct=new Gg,yo=Ct.produce;Ct.produceWithPatches.bind(Ct);Ct.setAutoFreeze.bind(Ct);Ct.setUseStrictShallowCopy.bind(Ct);Ct.applyPatches.bind(Ct);var Iu=Ct.createDraft.bind(Ct),Ru=Ct.finishDraft.bind(Ct),Jg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=M.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Xg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=we.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ev={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=K.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},za=new WeakMap,qa=new WeakMap,Er=new WeakMap,ef=new WeakMap,$u=new WeakMap,Lu=new WeakMap,zu=new WeakMap,M={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=M.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 M.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return M.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 M.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 M.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&M.compare(e,t)===0},isBefore(e,t){return M.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&M.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&M.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&M.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&M.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&&M.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(!M.isAncestor(t,e)&&!M.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;(M.equals(i,r)||M.endsBefore(i,r)||M.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(M.equals(s,r)||M.isAncestor(s,r))return null;M.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;M.equals(o,r)||M.endsBefore(o,r)?r[o.length-1]-=1:M.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(M.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else M.endsBefore(u,r)?r[u.length-1]+=1:M.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:p}=t;if(M.equals(h,p))return r;if(M.isAncestor(h,r)||M.equals(h,r)){var m=p.slice();return M.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else M.isSibling(h,p)&&(M.isAncestor(p,r)||M.equals(p,r))?M.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:M.endsBefore(p,r)||M.equals(p,r)||M.isAncestor(p,r)?(M.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):M.endsBefore(h,r)&&(M.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Ir(e){"@babel/helpers - typeof";return Ir=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},Ir(e)}function tv(e,t){if(Ir(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ir(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nv(e){var t=tv(e,"string");return Ir(t)==="symbol"?t:String(t)}function ft(e,t,n){return t=nv(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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){ft(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 rv=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.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 K.points(t))t[l]=we.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var p=ue.leaf(e,u),m=p.text.slice(0,d),g=p.text.slice(d);if(p.text=m+h+g,t)for(var[f,b]of K.points(t))t[b]=we.transform(f,n);break}case"merge_node":{var{path:v}=n,x=ue.get(e,v),k=M.previous(v),_=ue.get(e,k),w=ue.parent(e,v),F=v[v.length-1];if(me.isText(x)&&me.isText(_))_.text+=x.text;else if(!me.isText(x)&&!me.isText(_))_.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(et.stringify(x)," ").concat(et.stringify(_)));if(w.children.splice(F,1),t)for(var[S,q]of K.points(t))t[q]=we.transform(S,n);break}case"move_node":{var{path:N,newPath:z}=n;if(M.isAncestor(N,z))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat(z,"] because the destination is inside itself."));var I=ue.get(e,N),A=ue.parent(e,N),E=N[N.length-1];A.children.splice(E,1);var j=M.transform(N,n),R=ue.get(e,M.parent(j)),W=j[j.length-1];if(R.children.splice(W,0,I),t)for(var[H,G]of K.points(t))t[G]=we.transform(H,n);break}case"remove_node":{var{path:ne}=n,C=ne[ne.length-1],L=ue.parent(e,ne);if(L.children.splice(C,1),t)for(var[ee,B]of K.points(t)){var T=we.transform(ee,n);if(t!=null&&T!=null)t[B]=T;else{var O=void 0,$=void 0;for(var[U,re]of ue.texts(e))if(M.compare(re,ne)===-1)O=[U,re];else{$=[U,re];break}var X=!1;O&&$&&(M.equals($[1],ne)?X=!M.hasPrevious($[1]):X=M.common(O[1],ne).length<M.common($[1],ne).length),O&&!X?(ee.path=O[1],ee.offset=O[0].text.length):$?(ee.path=$[1],ee.offset=0):t=null}}break}case"remove_text":{var{path:ae,offset:he,text:Q}=n;if(Q.length===0)break;var ve=ue.leaf(e,ae),pe=ve.text.slice(0,he),_e=ve.text.slice(he+Q.length);if(ve.text=pe+_e,t)for(var[Fe,Se]of K.points(t))t[Se]=we.transform(Fe,n);break}case"set_node":{var{path:We,properties:Ue,newProperties:Be}=n;if(We.length===0)throw new Error("Cannot set properties on the root node!");var Te=ue.get(e,We);for(var De in Be){if(De==="children"||De==="text")throw new Error('Cannot set the "'.concat(De,'" property of nodes!'));var Re=Be[De];Re==null?delete Te[De]:Te[De]=Re}for(var ze in Ue)Be.hasOwnProperty(ze)||delete Te[ze];break}case"set_selection":{var{newProperties:Y}=n;if(Y==null)t=Y;else{if(t==null){if(!K.isRange(Y))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(et.stringify(Y)," when there is no current selection."));t=vr({},Y)}for(var oe in Y){var le=Y[oe];if(le==null){if(oe==="anchor"||oe==="focus")throw new Error('Cannot remove the "'.concat(oe,'" selection property'));delete t[oe]}else t[oe]=le}}break}case"split_node":{var{path:ce,position:Ce,properties:Ze}=n;if(ce.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var Ye=ue.get(e,ce),rt=ue.parent(e,ce),xt=ce[ce.length-1],Tt;if(me.isText(Ye)){var tt=Ye.text.slice(0,Ce),Mt=Ye.text.slice(Ce);Ye.text=tt,Tt=vr(vr({},Ze),{},{text:Mt})}else{var bt=Ye.children.slice(0,Ce),mi=Ye.children.slice(Ce);Ye.children=bt,Tt=vr(vr({},Ze),{},{children:mi})}if(rt.children.splice(xt+1,0,Tt),t)for(var[cr,Gr]of K.points(t))t[Gr]=we.transform(cr,n);break}}return t},av={transform(e,t){e.children=Iu(e.children);var n=e.selection&&Iu(e.selection);try{n=rv(e,n,t)}finally{e.children=Ru(e.children),n?e.selection=An(n)?Ru(n):n:e.selection=null}}},iv={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)}},sv={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)}},tf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(nt(r)&&nt(a)){if(!tf(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 ov(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 Jt(e,t){if(e==null)return{};var n=ov(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 uv=["anchor","focus"];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 lv(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){ft(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 K={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return K.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=K.edges(e);return t},equals(e,t){return we.equals(e.anchor,t.anchor)&&we.equals(e.focus,t.focus)},includes(e,t){if(K.isRange(t)){if(K.includes(e,t.anchor)||K.includes(e,t.focus))return!0;var[n,r]=K.edges(e),[a,i]=K.edges(t);return we.isBefore(n,a)&&we.isAfter(r,i)}var[s,o]=K.edges(e),l=!1,u=!1;return we.isPoint(t)?(l=we.compare(t,s)>=0,u=we.compare(t,o)<=0):(l=M.compare(t,s.path)>=0,u=M.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Jt(e,uv),[r,a]=K.edges(e),[i,s]=K.edges(t),o=we.isBefore(r,i)?i:r,l=we.isBefore(a,s)?a:s;return we.isBefore(l,o)?null:lv({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return we.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return we.equals(t,n)},isExpanded(e){return!K.isCollapsed(e)},isForward(e){return!K.isBackward(e)},isRange(e){return nt(e)&&we.isPoint(e.anchor)&&we.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=K.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return yo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=K.isCollapsed(r);K.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?K.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=we.transform(r.anchor,t,{affinity:i}),u=we.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Uu=e=>nt(e)&&ue.isNodeList(e.children)&&!D.isEditor(e),fe={isAncestor(e){return nt(e)&&ue.isNodeList(e.children)},isElement:Uu,isElementList(e){return Array.isArray(e)&&e.every(t=>fe.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 Uu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},cv=["children"],dv=["text"],Hu=new WeakMap,ue={ancestor(e,t){var n=ue.get(e,t);if(me.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(et.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of M.ancestors(t,n)){var a=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(me.isText(e))throw new Error("Cannot get the child of a text node: ".concat(et.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(et.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=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=M.common(t,n),a=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(D.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(et.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.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 ue.nodes(e,t))fe.isElement(n)&&(yield[n,r])}()},extractProps(e){if(fe.isAncestor(e)){var t=Jt(e,cv);return t}else{var t=Jt(e,dv);return t}},first(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(me.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(me.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(et.stringify(e)));var n=yo({children:e.children},r=>{var[a,i]=K.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!K.includes(t,m)}});for(var[,o]of s){if(!K.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(M.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(M.equals(o,a.path)){var h=ue.leaf(r,o);h.text=h.text.slice(a.offset)}}D.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(me.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(et.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(me.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return me.isText(e)||fe.isElement(e)||D.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Hu.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return Hu.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(me.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=ue.get(e,t);if(!me.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(et.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of M.levels(t,n)){var a=ue.get(e,r);yield[a,r]}}()},matches(e,t){return fe.isElement(e)&&fe.isElementProps(t)&&fe.matches(e,t)||me.isText(e)&&me.isTextProps(t)&&me.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?M.isBefore(o,i):M.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!me.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;M.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ue.get(e,o);continue}if(o.length===0)break;if(!r){var d=M.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=M.previous(o);o=h,l=ue.get(e,o);continue}o=M.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=M.parent(t),r=ue.get(e,n);if(me.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 me.isText(e)?e.text:e.children.map(ue.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))me.isText(n)&&(yield[n,r])}()}};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 He(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){ft(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 ln={isNodeOperation(e){return ln.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!nt(e))return!1;switch(e.type){case"insert_node":return M.isPath(e.path)&&ue.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&M.isPath(e.path);case"merge_node":return typeof e.position=="number"&&M.isPath(e.path)&&nt(e.properties);case"move_node":return M.isPath(e.path)&&M.isPath(e.newPath);case"remove_node":return M.isPath(e.path)&&ue.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&M.isPath(e.path);case"set_node":return M.isPath(e.path)&&nt(e.properties)&&nt(e.newProperties);case"set_selection":return e.properties===null&&K.isRange(e.newProperties)||e.newProperties===null&&K.isRange(e.properties)||nt(e.properties)&&nt(e.newProperties);case"split_node":return M.isPath(e.path)&&typeof e.position=="number"&&nt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>ln.isOperation(t))},isSelectionOperation(e){return ln.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return ln.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return He(He({},e),{},{type:"remove_node"});case"insert_text":return He(He({},e),{},{type:"remove_text"});case"merge_node":return He(He({},e),{},{type:"split_node",path:M.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(M.equals(t,n))return e;if(M.isSibling(n,t))return He(He({},e),{},{path:t,newPath:n});var r=M.transform(n,e),a=M.transform(M.next(n),e);return He(He({},e),{},{path:r,newPath:a})}case"remove_node":return He(He({},e),{},{type:"insert_node"});case"remove_text":return He(He({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return He(He({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?He(He({},e),{},{properties:l,newProperties:null}):l==null?He(He({},e),{},{properties:null,newProperties:o}):He(He({},e),{},{properties:l,newProperties:o})}case"split_node":return He(He({},e),{},{type:"merge_node",path:M.next(e.path)})}}},Ku=new WeakMap,fv=e=>{var t=Ku.get(e);if(t!==void 0)return t;if(!nt(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||nt(e.marks))&&(e.selection===null||K.isRange(e.selection))&&ue.isNodeList(e.children)&&ln.isOperationList(e.operations);return Ku.set(e,n),n},D={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 fv(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)}},hv={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(M.isPath)}};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 Yu(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){ft(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 we={compare(e,t){var n=M.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return we.compare(e,t)===1},isBefore(e,t){return we.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&M.equals(e.path,t.path)},isPoint(e){return nt(e)&&typeof e.offset=="number"&&M.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return yo(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=M.transform(i,t,n);break}case"insert_text":{M.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{M.equals(t.path,i)&&(r.offset+=t.position),r.path=M.transform(i,t,n);break}case"remove_text":{M.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(M.equals(t.path,i)||M.isAncestor(t.path,i))return null;r.path=M.transform(i,t,n);break}case"split_node":{if(M.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=M.transform(i,t,Yu(Yu({},n),{},{affinity:"forward"})))}else r.path=M.transform(i,t,n);break}}})}},Gu=void 0,et={setScrubber(e){Gu=e},stringify(e){return JSON.stringify(e,Gu)}},mv=["text"],pv=["anchor","focus"];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 Kt(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){ft(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 me={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Jt(i,mv);return s}return tf(r?a(e):e,r?a(t):t)},isText(e){return nt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>me.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=[Kt({},e)];for(var r of t){var a=Jt(r,pv),[i,s]=K.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(h);continue}var g=h,f=void 0,b=void 0;if(d<l){var v=d-m;b=Kt(Kt({},g),{},{text:g.text.slice(v)}),g=Kt(Kt({},g),{},{text:g.text.slice(0,v)})}if(u>m){var x=u-m;f=Kt(Kt({},g),{},{text:g.text.slice(0,x)}),g=Kt(Kt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},Do=e=>e.selection?e.selection:e.children.length>0?D.end(e,[]):[0],lr=(e,t)=>{var[n]=D.node(e,t);return r=>r===n},Co=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?Cv(t):t,i=xe.None,s=xe.None,o=0,l=null,u=null;for(var d of a){var h=d.codePointAt(0);if(!h)break;var p=Ov(d,h);if([i,s]=r?[s,p]:[p,i],Vn(i,xe.ZWJ)&&Vn(s,xe.ExtPict)&&(r?l=Ju(t.substring(0,o)):l=Ju(t.substring(0,t.length-o)),!l)||Vn(i,xe.RI)&&Vn(s,xe.RI)&&(u!==null?u=!u:r?u=!0:u=Rv(t.substring(0,t.length-o)),!u)||i!==xe.None&&s!==xe.None&&Mv(i,s))break;o+=d.length}return o||1},gv=/\s/,vv=/[\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]/,bv=/['\u2018\u2019]/,yv=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Co(t,n),[s,o]=xo(t,i,n);if(Dv(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},xo=(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)]},Dv=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(gv.test(t))return!1;if(bv.test(t)){var a=Co(n,r),[i,s]=xo(n,a,r);if(e(i,s,r))return!0}return!vv.test(t)},Cv=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(wv(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(xv(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},xv=e=>e>=55296&&e<=56319,wv=e=>e>=56320&&e<=57343,xe;(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"})(xe||(xe={}));var Ev=/^(?:[\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])$/,_v=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,kv=/^(?:[\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])$/,Fv=/^[\u1100-\u115F\uA960-\uA97C]$/,Bv=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Av=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Tv=/^[\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]$/,Sv=/^[\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]$/,jv=/^(?:[\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])$/,Ov=(e,t)=>{var n=xe.Any;return e.search(Ev)!==-1&&(n|=xe.Extend),t===8205&&(n|=xe.ZWJ),t>=127462&&t<=127487&&(n|=xe.RI),e.search(_v)!==-1&&(n|=xe.Prepend),e.search(kv)!==-1&&(n|=xe.SpacingMark),e.search(Fv)!==-1&&(n|=xe.L),e.search(Bv)!==-1&&(n|=xe.V),e.search(Av)!==-1&&(n|=xe.T),e.search(Tv)!==-1&&(n|=xe.LV),e.search(Sv)!==-1&&(n|=xe.LVT),e.search(jv)!==-1&&(n|=xe.ExtPict),n};function Vn(e,t){return(e&t)!==0}var Pv=[[xe.L,xe.L|xe.V|xe.LV|xe.LVT],[xe.LV|xe.V,xe.V|xe.T],[xe.LVT|xe.T,xe.T],[xe.Any,xe.Extend|xe.ZWJ],[xe.Any,xe.SpacingMark],[xe.Prepend,xe.Any],[xe.ZWJ,xe.ExtPict],[xe.RI,xe.RI]];function Mv(e,t){return Pv.findIndex(n=>Vn(e,n[0])&&Vn(t,n[1]))===-1}var Nv=/(?:[\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$/,Ju=e=>e.search(Nv)!==-1,Iv=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Rv=e=>{var t=e.match(Iv);if(t===null)return!1;var n=t[0].length/2;return n%2===1},$v={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]:{};D.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Do(e)}=n;if(M.isPath(a)&&(a=D.range(e,a)),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var i=K.end(a);if(!r&&D.void(e,{at:i}))return;var s=K.start(a),o=D.pointRef(e,s),l=D.pointRef(e,i);J.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,J.setSelection(e,{anchor:a,focus:a})}if(!(!r&&D.void(e,{at:a})||D.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};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 oa(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){ft(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 J=oa(oa(oa(oa({},av),iv),sv),$v),Ea=new WeakMap,Lv=e=>Ea.get(e)||!1,zv=(e,t,n)=>{var r=Ea.get(e)||!1;Ea.set(e,!0);try{t(),n()}finally{Ea.set(e,r)}};function nf(e,t,n){var r=za.get(e)||[],a=qa.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);za.set(e,i),qa.set(e,s)}var qv=(e,t)=>{for(var n of D.pathRefs(e))Jg.transform(n,t);for(var r of D.pointRefs(e))Xg.transform(r,t);for(var a of D.rangeRefs(e))ev.transform(a,t);if(!Lv(e)){var i=M.operationCanTransformPath(t)?s=>M.transform(s,t):void 0;nf(e,e.getDirtyPaths(t),i)}J.transform(e,t),e.operations.push(t),D.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Er.get(e)||(Er.set(e,!0),Promise.resolve().then(()=>{Er.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Wv=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return M.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=M.levels(a),s=me.isText(r)?[]:Array.from(ue.nodes(r),z=>{var[,I]=z;return a.concat(I)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=M.ancestors(o),u=M.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(M.equals(d,h))return[];var p=[],m=[];for(var g of M.ancestors(d)){var f=M.transform(g,t);p.push(f)}for(var b of M.ancestors(h)){var v=M.transform(b,t);m.push(v)}var x=m[m.length-1],k=h[h.length-1],_=x.concat(k);return[...p,...m,_]}case"remove_node":{var{path:w}=t,F=M.ancestors(w);return[...F]}case"split_node":{var{path:S}=t,q=M.levels(S),N=M.next(S);return[...q,N]}default:return[]}},Uv=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},Hv=(e,t)=>{var[n,r]=t;if(!me.isText(n)){if(fe.isElement(n)&&n.children.length===0){var a={text:""};J.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=D.isEditor(n)?!1:fe.isElement(n)&&(e.isInline(n)||n.children.length===0||me.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ue.get(e,r);if(!me.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,p=me.isText(u)||fe.isElement(u)&&e.isInline(u);if(p!==i)J.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(fe.isElement(u)){if(e.isInline(u)){if(d==null||!me.isText(d)){var m={text:""};J.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};J.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&me.isText(d)&&(me.equals(u,d,{loose:!0})?(J.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(J.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(J.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Vv=(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},Kv=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=D.path(t,i),l=a==="lowest";for(var[u,d]of D.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!me.isText(u)){if(K.isRange(i)){if(M.isAncestor(d,i.anchor.path)&&M.isAncestor(d,i.focus.path))return[u,d]}else if(!M.equals(o,d))return[u,d]}}};function el(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 tl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Zv=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!me.isText(h))return!1;var[m,g]=D.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=K.isExpanded(r),s=!1;if(!i){var[o,l]=D.node(e,r);if(o&&a(o,l)){var[u]=D.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)J.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=tl(tl({},D.marks(e)||{}),{},{[t]:n});e.marks=d,Er.get(e)||e.onChange()}}};function nl(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 rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.point(t,n,{edge:"end"}),i=D.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,rl(rl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function al(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 il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?al(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Gv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.start(t,[]),i=D.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,il(il({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Qv=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&J.delete(e,{unit:t,reverse:!0})},Jv=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&J.delete(e,{unit:t})},Xv=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&K.isExpanded(r)&&J.delete(t,{reverse:n==="backward"})},e0=(e,t)=>[D.start(e,t),D.end(e,t)];function sl(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 ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var t0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,ol(ol({},n),{},{match:r=>fe.isElement(r)&&D.isElementReadOnly(t,r)}))},n0=(e,t)=>D.point(e,t,{edge:"end"}),r0=(e,t)=>{var n=D.path(e,t,{edge:"start"});return D.node(e,n)},a0=(e,t)=>{var n=D.range(e,t);return ue.fragment(e,n)};function ul(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 ll(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ul(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ul(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var i0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,ll(ll({},n),{},{match:r=>fe.isElement(r)&&D.isVoid(t,r)}))},s0=(e,t)=>t.children.some(n=>fe.isElement(n)&&D.isBlock(e,n)),o0=(e,t)=>t.children.some(n=>me.isText(n)||D.isInline(e,n)),u0=(e,t)=>ue.has(e,t),l0=(e,t)=>t.children.every(n=>me.isText(n)),c0=e=>{J.splitNodes(e,{always:!0})},d0=(e,t,n)=>{J.insertNodes(e,t,n)},f0=e=>{J.splitNodes(e,{always:!0})};function cl(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 h0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var m0=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=h0({text:n},i);J.insertNodes(t,s,{at:r.at,voids:r.voids})}else J.insertText(t,n,r);t.marks=null}},p0=(e,t)=>!e.isInline(t),g0=(e,t,n)=>D.isStart(e,t,n)||D.isEnd(e,t,n),v0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&me.isText(r)&&r.text===""&&!e.isVoid(t)},b0=(e,t,n)=>{var r=D.end(e,n);return we.equals(t,r)},y0=e=>{var t=ef.get(e);return t===void 0?!0:t},D0=(e,t,n)=>{if(t.offset!==0)return!1;var r=D.start(e,n);return we.equals(t,r)},C0=(e,t)=>{var n=D.path(e,t,{edge:"end"});return D.node(e,n)},x0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function w0(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=D.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&fe.isElement(l)&&D.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var E0=["text"],_0=["text"],k0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(K.isExpanded(r)){var s=D.isEnd(t,a,a.path);if(s){var o=D.after(t,a);o&&(a=o)}var[l]=D.nodes(t,{match:me.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=Jt(u,E0);return d}else return{}}var{path:h}=a,[p]=D.leaf(t,h);if(a.offset===0){var m=D.previous(t,{at:h,match:me.isText}),g=D.above(t,{match:_=>fe.isElement(_)&&D.isVoid(t,_)&&t.markableVoid(_)});if(!g){var f=D.above(t,{match:_=>fe.isElement(_)&&D.isBlock(t,_)});if(m&&f){var[b,v]=m,[,x]=f;M.isAncestor(x,v)&&(p=b)}}}var k=Jt(p,_0);return k},F0=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=D.after(t,s,{voids:a});if(o){var[,l]=D.last(t,[]),u=[o.path,l];if(M.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(M.isPath(s)){var[d]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=D.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},B0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.get(t,a);return[i,a]};function A0(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,d;if(hv.isSpan(n))u=n[0],d=n[1];else{var h=D.path(e,n,{edge:"start"}),p=D.path(e,n,{edge:"end"});u=i?p:h,d=i?h:p}var m=ue.nodes(e,{reverse:i,from:u,to:d,pass:_=>{var[w]=_;return fe.isElement(w)?!!(!s&&(D.isVoid(e,w)||D.isElementReadOnly(e,w))||o&&!D.isSelectable(e,w)):!1}}),g=[],f;for(var[b,v]of m)if(!(o&&fe.isElement(b)&&!D.isSelectable(e,b))){var x=f&&M.compare(v,f[1])===0;if(!(r==="highest"&&x)){if(!l(b,v)){if(a&&!x&&me.isText(b))return;continue}if(r==="lowest"&&x){f=[b,v];continue}var k=r==="lowest"?f:[b,v];k&&(a?g.push(k):yield k),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var T0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>za.get(d)||[],s=d=>qa.get(d)||new Set,o=d=>{var h=i(d).pop(),p=h.join(",");return s(d).delete(p),h};if(D.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),d=>{var[,h]=d;return h}),u=new Set(l.map(d=>d.join(",")));za.set(t,l),qa.set(t,u)}i(t).length!==0&&D.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var h=D.node(t,d),[p,m]=h;fe.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(ue.has(t,v)){var x=D.node(t,v);t.normalizeNode(x,{operation:a})}b++,g=i(t)}})}},S0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=M.parent(a),s=D.node(t,i);return s},j0=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=D.pathRefs(t);return l.delete(i),i.current=null,o}},s=D.pathRefs(t);return s.add(i),i},O0=e=>{var t=$u.get(e);return t||(t=new Set,$u.set(e,t)),t},P0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(M.isPath(n)){if(i==="start"){var[,s]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return K.isRange(n)&&(i==="start"?n=K.start(n):i==="end"?n=K.end(n):n=M.common(n.anchor.path,n.focus.path)),we.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},M0=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=D.pointRefs(t);return l.delete(i),i.current=null,o}},s=D.pointRefs(t);return s.add(i),i},N0=e=>{var t=Lu.get(e);return t||(t=new Set,Lu.set(e,t)),t},I0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(M.isPath(n)){var i;if(a==="end"){var[,s]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.get(t,i);if(!me.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(K.isRange(n)){var[u,d]=K.edges(n);return a==="start"?u:d}return n};function R0(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=D.range(e,n),[l,u]=K.edges(o),d=a?u:l,h=!1,p="",m=0,g=0,f=0;for(var[b,v]of D.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(fe.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield D.start(e,v);continue}if(e.isInline(b))continue;if(D.hasInlines(e,b)){var x=M.isAncestor(v,u.path)?u:D.end(e,v),k=M.isAncestor(v,l.path)?l:D.start(e,v);p=D.string(e,{anchor:k,focus:x},{voids:i}),h=!0}}if(me.isText(b)){var _=M.equals(v,d.path);for(_?(g=a?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=a?g:0),(_||h||r==="offset")&&(yield{path:v,offset:f},h=!1);;){if(m===0){if(p==="")break;m=w(p,r,a),p=xo(p,m,a)[1]}if(f=a?f-m:f+m,g=g-m,g<0){m=-g;break}m=0,yield{path:v,offset:f}}}}function w(F,S,q){return S==="character"?Co(F,q):S==="word"?yv(F,q):S==="line"||S==="block"?F.length:1}}()}var $0=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=D.before(t,s,{voids:a});if(o){var[,l]=D.first(t,[]),u=[o.path,l];if(M.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(M.isPath(s)){var[d]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=D.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},L0=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=D.rangeRefs(t);return l.delete(i),i.current=null,o}},s=D.rangeRefs(t);return s.add(i),i},z0=e=>{var t=zu.get(e);return t||(t=new Set,zu.set(e,t)),t},q0=(e,t,n)=>{if(K.isRange(t)&&!n)return t;var r=D.start(e,t),a=D.end(e,n||t);return{anchor:r,focus:a}};function dl(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 W0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var U0=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!me.isText(d))return!1;var[p,m]=D.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=K.isExpanded(n),i=!1;if(!a){var[s,o]=D.node(e,n);if(s&&r(s,o)){var[l]=D.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)J.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=W0({},D.marks(e)||{});delete u[t],e.marks=u,Er.get(e)||e.onChange()}}},H0=(e,t)=>{ef.set(e,t)},V0=(e,t)=>D.point(e,t,{edge:"start"}),K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=D.range(t,n),[s,o]=K.edges(i),l="";for(var[u,d]of D.nodes(t,{at:i,match:me.isText,voids:a})){var h=u.text;M.equals(d,o.path)&&(h=h.slice(0,o.offset)),M.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},Z0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=K.edges(n);if(i.offset!==0||s.offset!==0||K.isCollapsed(n)||M.hasPrevious(s.path))return n;var o=D.above(t,{at:s,match:g=>fe.isElement(g)&&D.isBlock(t,g),voids:a}),l=o?o[1]:[],u=D.start(t,i),d={anchor:u,focus:s},h=!0;for(var[p,m]of D.nodes(t,{at:d,match:me.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||M.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},Y0=(e,t)=>{var n=D.isNormalizing(e);D.setNormalizing(e,!1);try{t()}finally{D.setNormalizing(e,n)}D.normalize(e)},G0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var h=!1;if(K.isRange(u)&&K.isCollapsed(u)&&(h=!0,u=u.anchor),we.isPoint(u)){var p=D.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var g={unit:s,distance:o},f=i?D.before(t,u,g)||D.start(t,[]):D.after(t,u,g)||D.end(t,[]);u={anchor:u,focus:f},d=!0}}if(M.isPath(u)){J.removeNodes(t,{at:u,voids:l});return}if(!K.isCollapsed(u)){if(!d){var[,b]=K.edges(u),v=D.end(t,[]);we.equals(b,v)||(u=D.unhangRange(t,u,{voids:l}))}var[x,k]=K.edges(u),_=D.above(t,{match:pe=>fe.isElement(pe)&&D.isBlock(t,pe),at:x,voids:l}),w=D.above(t,{match:pe=>fe.isElement(pe)&&D.isBlock(t,pe),at:k,voids:l}),F=_&&w&&!M.equals(_[1],w[1]),S=M.equals(x.path,k.path),q=l?null:(r=D.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:D.elementReadOnly(t,{at:x,mode:"highest"}),N=l?null:(a=D.void(t,{at:k,mode:"highest"}))!==null&&a!==void 0?a:D.elementReadOnly(t,{at:k,mode:"highest"});if(q){var z=D.before(t,x);z&&_&&M.isAncestor(_[1],z.path)&&(x=z)}if(N){var I=D.after(t,k);I&&w&&M.isAncestor(w[1],I.path)&&(k=I)}var A=[],E;for(var j of D.nodes(t,{at:u,voids:l})){var[R,W]=j;E&&M.compare(W,E)===0||(!l&&fe.isElement(R)&&(D.isVoid(t,R)||D.isElementReadOnly(t,R))||!M.isCommon(W,x.path)&&!M.isCommon(W,k.path))&&(A.push(j),E=W)}var H=Array.from(A,pe=>{var[,_e]=pe;return D.pathRef(t,_e)}),G=D.pointRef(t,x),ne=D.pointRef(t,k),C="";if(!S&&!q){var L=G.current,[ee]=D.leaf(t,L),{path:B}=L,{offset:T}=x,O=ee.text.slice(T);O.length>0&&(t.apply({type:"remove_text",path:B,offset:T,text:O}),C=O)}if(H.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>J.removeNodes(t,{at:pe,voids:l})),!N){var $=ne.current,[U]=D.leaf(t,$),{path:re}=$,X=S?x.offset:0,ae=U.text.slice(X,k.offset);ae.length>0&&(t.apply({type:"remove_text",path:re,offset:X,text:ae}),C=ae)}!S&&F&&ne.current&&G.current&&J.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),h&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&J.insertText(t,C.slice(0,C.length-o));var he=G.unref(),Q=ne.unref(),ve=i?he||Q:Q||he;n.at==null&&ve&&J.select(t,ve)}}})},Q0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Do(t),batchDirty:o=!0}=r;if(n.length){if(K.isRange(s))if(a||(s=D.unhangRange(t,s,{voids:i})),K.isCollapsed(s))s=s.anchor;else{var[,l]=K.edges(s);if(!i&&D.void(t,{at:l}))return;var u=D.pointRef(t,l);J.delete(t,{at:s}),s=u.unref()}else M.isPath(s)&&(s=D.start(t,s));if(!(!i&&D.void(t,{at:s}))){var d=D.above(t,{at:s,match:O=>fe.isElement(O)&&D.isInline(t,O),mode:"highest",voids:i});if(d){var[,h]=d;if(D.isEnd(t,s,h)){var p=D.after(t,h);s=p}else if(D.isStart(t,s,h)){var m=D.before(t,h);s=m}}var g=D.above(t,{match:O=>fe.isElement(O)&&D.isBlock(t,O),at:s,voids:i}),[,f]=g,b=D.isStart(t,s,f),v=D.isEnd(t,s,f),x=b&&v,k=!b||b&&v,_=!v,[,w]=ue.first({children:n},[]),[,F]=ue.last({children:n},[]),S=[],q=O=>{var[$,U]=O,re=U.length===0;return re?!1:x?!0:!(k&&M.isAncestor(U,w)&&fe.isElement($)&&!t.isVoid($)&&!t.isInline($)||_&&M.isAncestor(U,F)&&fe.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var N of ue.nodes({children:n},{pass:q}))q(N)&&S.push(N);var z=[],I=[],A=[],E=!0,j=!1;for(var[R]of S)fe.isElement(R)&&!t.isInline(R)?(E=!1,j=!0,I.push(R)):E?z.push(R):A.push(R);var[W]=D.nodes(t,{at:s,match:O=>me.isText(O)||D.isInline(t,O),mode:"highest",voids:i}),[,H]=W,G=D.isStart(t,s,H),ne=D.isEnd(t,s,H),C=D.pathRef(t,v&&!A.length?M.next(f):f),L=D.pathRef(t,ne?M.next(H):H);J.splitNodes(t,{at:s,match:O=>j?fe.isElement(O)&&D.isBlock(t,O):me.isText(O)||D.isInline(t,O),mode:j?"lowest":"highest",always:j&&(!b||z.length>0)&&(!v||A.length>0),voids:i});var ee=D.pathRef(t,!G||G&&ne?M.next(H):H);if(J.insertNodes(t,z,{at:ee.current,match:O=>me.isText(O)||D.isInline(t,O),mode:"highest",voids:i,batchDirty:o}),x&&!z.length&&I.length&&!A.length&&J.delete(t,{at:f,voids:i}),J.insertNodes(t,I,{at:C.current,match:O=>fe.isElement(O)&&D.isBlock(t,O),mode:"lowest",voids:i,batchDirty:o}),J.insertNodes(t,A,{at:L.current,match:O=>me.isText(O)||D.isInline(t,O),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(A.length>0&&L.current?B=M.previous(L.current):I.length>0&&C.current?B=M.previous(C.current):ee.current&&(B=M.previous(ee.current)),B){var T=D.end(t,B);J.select(t,T)}}ee.unref(),C.unref(),L.unref()}}})},J0=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")J.select(t,a.anchor);else if(r==="focus")J.select(t,a.focus);else if(r==="start"){var[i]=K.edges(a);J.select(t,i)}else if(r==="end"){var[,s]=K.edges(a);J.select(t,s)}}else return},X0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},eb=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=K.isBackward(r)?"focus":"anchor"),o==="end"&&(o=K.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?D.before(t,l,d):D.after(t,l,d);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?D.before(t,u,d):D.after(t,u,d);m&&(h.focus=m)}J.setSelection(t,h)}},tb=(e,t)=>{var{selection:n}=e;if(t=D.range(e,t),n){J.setSelection(e,t);return}if(!K.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(et.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function fl(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 hl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fl(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nb=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=K.isBackward(a)?"focus":"anchor"),i==="end"&&(i=K.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;J.setSelection(t,{[i==="anchor"?"anchor":"focus"]:hl(hl({},l),n)})}},rb=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!we.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!we.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})}},ab=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=Do(t),d!==!1&&(d=!0)),d==null&&(d=!1),K.isRange(l))if(a||(l=D.unhangRange(t,l,{voids:i})),K.isCollapsed(l))l=l.anchor;else{var[,p]=K.edges(l),m=D.pointRef(t,p);J.delete(t,{at:l}),l=m.unref()}if(we.isPoint(l)){u==null&&(me.isText(h)?u=z=>me.isText(z):t.isInline(h)?u=z=>me.isText(z)||D.isInline(t,z):u=z=>fe.isElement(z)&&D.isBlock(t,z));var[g]=D.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=D.pathRef(t,f),v=D.isEnd(t,l,f);J.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=b.unref();l=v?M.next(x):x}else return}var k=M.parent(l),_=l[l.length-1];if(!(!i&&D.void(t,{at:k}))){if(o){var w=[],F=M.levels(k);zv(t,()=>{var z=function(){var E=k.concat(_);_++;var j={type:"insert_node",path:E,node:I};t.apply(j),l=M.next(l),w.push(j),me.isText?F.push(...Array.from(ue.nodes(I),R=>{var[,W]=R;return E.concat(W)})):F.push(E)};for(var I of n)z()},()=>{nf(t,F,z=>{var I=z;for(var A of w)if(M.operationCanTransformPath(A)&&(I=M.transform(I,A),!I))return null;return I})})}else for(var S of n){var q=k.concat(_);_++,t.apply({type:"insert_node",path:q,node:S}),l=M.next(l)}if(l=M.previous(l),d){var N=D.end(t,l);N&&J.select(t,N)}}}})},ib=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=M.isPath(r)?lr(t,r):_=>fe.isElement(_)&&D.isBlock(t,_)),!!r){var o=D.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,_=>{var[,w]=_;return D.pathRef(t,w)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var h=D.node(t,M.parent(d)),[p,m]=h,g=d[d.length-1],{length:f}=p.children;if(f===1){var b=M.next(m);J.moveNodes(t,{at:d,to:b,voids:i}),J.removeNodes(t,{at:m,voids:i})}else if(g===0)J.moveNodes(t,{at:d,to:m,voids:i});else if(g===f-1){var v=M.next(m);J.moveNodes(t,{at:d,to:v,voids:i})}else{var x=M.next(d),k=M.next(m);J.splitNodes(t,{at:x,voids:i}),J.moveNodes(t,{at:d,to:k,voids:i})}}}})},sb=["text"],ob=["children"],rf=(e,t)=>{if(fe.isElement(t)){var n=t;return D.isVoid(e,t)?!0:n.children.length===1?rf(e,n.children[0]):!1}else return!D.isEditor(t)},ub=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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(M.isPath(a)){var[l]=D.parent(t,a);r=z=>l.children.includes(z)}else r=z=>fe.isElement(z)&&D.isBlock(t,z);if(!i&&K.isRange(a)&&(a=D.unhangRange(t,a,{voids:s})),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var[,u]=K.edges(a),d=D.pointRef(t,u);J.delete(t,{at:a}),a=d.unref(),n.at==null&&J.select(t,a)}var[h]=D.nodes(t,{at:a,match:r,voids:s,mode:o}),p=D.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,g]=h,[f,b]=p;if(!(g.length===0||b.length===0)){var v=M.next(b),x=M.common(g,b),k=M.isSibling(g,b),_=Array.from(D.levels(t,{at:g}),z=>{var[I]=z;return I}).slice(x.length).slice(0,-1),w=D.above(t,{at:g,mode:"highest",match:z=>_.includes(z)&&rf(t,z)}),F=w&&D.pathRef(t,w[1]),S,q;if(me.isText(m)&&me.isText(f)){var N=Jt(m,sb);q=f.text.length,S=N}else if(fe.isElement(m)&&fe.isElement(f)){var N=Jt(m,ob);q=f.children.length,S=N}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(et.stringify(m)," ").concat(et.stringify(f)));k||J.moveNodes(t,{at:g,to:v,voids:s}),F&&J.removeNodes(t,{at:F.current,voids:s}),fe.isElement(f)&&D.isEmpty(t,f)||me.isText(f)&&f.text===""&&b[b.length-1]!==0?J.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:q,properties:S}),F&&F.unref()}}}})},lb=(e,t)=>{D.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=M.isPath(r)?lr(e,r):m=>fe.isElement(m)&&D.isBlock(e,m));var o=D.pathRef(e,n),l=D.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,g]=m;return D.pathRef(e,g)});for(var d of u){var h=d.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&M.isSibling(p,h)&&M.isAfter(p,h)&&(o.current=M.next(o.current))}o.unref()}})},cb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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=M.isPath(s)?lr(t,s):m=>fe.isElement(m)&&D.isBlock(t,m)),!r&&K.isRange(s)&&(s=D.unhangRange(t,s,{voids:a}));var l=D.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,m=>{var[,g]=m;return D.pathRef(t,g)});for(var d of u){var h=d.unref();if(h){var[p]=D.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},db=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:h=!1}=r;if(i){if(a==null&&(a=M.isPath(i)?lr(t,i):q=>fe.isElement(q)&&D.isBlock(t,q)),!l&&K.isRange(i)&&(i=D.unhangRange(t,i,{voids:h})),d&&K.isRange(i)){if(K.isCollapsed(i)&&D.leaf(t,i.anchor)[0].text.length>0)return;var p=D.rangeRef(t,i,{affinity:"inward"}),[m,g]=K.edges(i),f=u==="lowest"?"lowest":"highest",b=D.isEnd(t,g,g.path);J.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!b});var v=D.isStart(t,m,m.path);J.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!v}),i=p.unref(),r.at==null&&J.select(t,i)}s||(s=(q,N)=>q!==N);for(var[x,k]of D.nodes(t,{at:i,match:a,mode:u,voids:h})){var _={},w={};if(k.length!==0){var F=!1;for(var S in n)S==="children"||S==="text"||s(n[S],x[S])&&(F=!0,x.hasOwnProperty(S)&&(_[S]=x[S]),o?n[S]!=null&&(w[S]=o(x[S],n[S])):n[S]!=null&&(w[S]=n[S]));F&&t.apply({type:"set_node",path:k,properties:_,newProperties:w})}}}})},fb=(e,t)=>{if(K.isCollapsed(t))return t.anchor;var[,n]=K.edges(t),r=D.pointRef(e,n);return J.delete(e,{at:t}),r.unref()},hb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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=>fe.isElement(ne)&&D.isBlock(t,ne)),K.isRange(s)&&(s=fb(t,s)),M.isPath(s)){var u=s,d=D.point(t,u),[h]=D.parent(t,u);i=ne=>ne===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=D.pointRef(t,s,{affinity:"backward"}),m;try{var[g]=D.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=D.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,x]=f;if(fe.isElement(v)&&t.isInline(v)){var k=D.after(t,x);if(!k){var _={text:""},w=M.next(x);J.insertNodes(t,_,{at:w,voids:a}),k=D.point(t,w)}s=k,l=!0}var F=s.path.length-x.length;o=F+1,l=!0}m=D.pointRef(t,s);var S=s.path.length-o,[,q]=g,N=s.path.slice(0,S),z=o===0?s.offset:s.path[S]+b;for(var[I,A]of D.levels(t,{at:N,reverse:!0,voids:a})){var E=!1;if(A.length<q.length||A.length===0||!a&&fe.isElement(I)&&D.isVoid(t,I))break;var j=p.current,R=D.isEnd(t,j,A);if(l||!p||!D.isEdge(t,j,A)){E=!0;var W=ue.extractProps(I);t.apply({type:"split_node",path:A,position:z,properties:W})}z=A[A.length-1]+(E||R?1:0)}if(n.at==null){var H=m.current||D.end(t,[]);J.select(t,H)}}finally{var G;p.unref(),(G=m)===null||G===void 0||G.unref()}}})},mb=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;J.setNodes(t,a,r)},pb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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=M.isPath(s)?lr(t,s):m=>fe.isElement(m)&&D.isBlock(t,m)),M.isPath(s)&&(s=D.range(t,s));var l=K.isRange(s)?D.rangeRef(t,s):null,u=D.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,m=>{var[,g]=m;return D.pathRef(t,g)}).reverse(),h=function(){var g=p.unref(),[f]=D.node(t,g),b=D.range(t,g);a&&l&&(b=K.intersection(l.current,b)),J.liftNodes(t,{at:b,match:v=>fe.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of d)h();l&&l.unref()}})};function ml(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 pl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ml(Object(n),!0).forEach(function(r){ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ml(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.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&&(M.isPath(l)?o=lr(t,l):t.isInline(n)?o=b=>fe.isElement(b)&&D.isInline(t,b)||me.isText(b):o=b=>fe.isElement(b)&&D.isBlock(t,b)),i&&K.isRange(l)){var[u,d]=K.edges(l),h=D.rangeRef(t,l,{affinity:"inward"});J.splitNodes(t,{at:d,match:o,voids:s}),J.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&J.select(t,l)}var p=Array.from(D.nodes(t,{at:l,match:t.isInline(n)?b=>fe.isElement(b)&&D.isBlock(t,b):b=>D.isEditor(b),mode:"lowest",voids:s})),m=function(){var v=K.isRange(l)?K.intersection(l,D.range(t,f)):l;if(!v)return 0;var x=Array.from(D.nodes(t,{at:v,match:o,mode:a,voids:s}));if(x.length>0){var[k]=x,_=x[x.length-1],[,w]=k,[,F]=_;if(w.length===0&&F.length===0)return 0;var S=M.equals(w,F)?M.parent(w):M.common(w,F),q=D.range(t,w,F),N=D.node(t,S),[z]=N,I=S.length+1,A=M.next(F.slice(0,I)),E=pl(pl({},n),{},{children:[]});J.insertNodes(t,E,{at:A,voids:s}),J.moveNodes(t,{at:q,match:j=>fe.isAncestor(z)&&z.children.includes(j),to:A.concat(0),voids:s})}},g;for(var[,f]of p)g=m()}})},vb=()=>{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 qv(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zv(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qv(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jv(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xv(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uv(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return d0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return m0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wv(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vv(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kv(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yv(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gv(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return n0(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return a0(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l0(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ab(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return p0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return g0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return D0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return x0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return w0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ib(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ub(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eb(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lb(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return P0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return j0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return z0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cb(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tb(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return db(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nb(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rb(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hb(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mb(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pb(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gb(e,...r)}};return e},bb={isHistory(e){return nt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||ln.isOperationList(e.redos[0].operations))&&(e.undos.length===0||ln.isOperationList(e.undos[0].operations))}},Pi=new WeakMap,Mi=new WeakMap,Kn={isHistoryEditor(e){return bb.isHistory(e.history)&&D.isEditor(e)},isMerging(e){return Mi.get(e)},isSaving(e){return Pi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Kn.isMerging(e);Mi.set(e,!1),t(),Mi.set(e,n)},withoutSaving(e,t){var n=Kn.isSaving(e);Pi.set(e,!1),t(),Pi.set(e,n)}},yb=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&&J.setSelection(t,i.selectionBefore),Kn.withoutSaving(t,()=>{D.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];Kn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{var s=i.operations.map(ln.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&J.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=Kn.isSaving(t),d=Kn.isMerging(t);if(u==null&&(u=Cb(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=Db(r,l)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},Db=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&M.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&M.equals(e.path,t.path)),Cb=(e,t)=>e.type!=="set_selection",xb=_b,af="֑-߿יִ-﷽ﹰ-ﻼ",sf="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",wb=new RegExp("^[^"+sf+"]*["+af+"]"),Eb=new RegExp("^[^"+af+"]*["+sf+"]");function _b(e){return e=String(e||""),wb.test(e)?"rtl":Eb.test(e)?"ltr":"neutral"}const of=On(xb);function kb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var wo=kb,Fb=typeof Qr=="object"&&Qr&&Qr.Object===Object&&Qr,Bb=Fb,Ab=Bb,Tb=typeof self=="object"&&self&&self.Object===Object&&self,Sb=Ab||Tb||Function("return this")(),uf=Sb,jb=uf,Ob=function(){return jb.Date.now()},Pb=Ob,Mb=/\s/;function Nb(e){for(var t=e.length;t--&&Mb.test(e.charAt(t)););return t}var Ib=Nb,Rb=Ib,$b=/^\s+/;function Lb(e){return e&&e.slice(0,Rb(e)+1).replace($b,"")}var zb=Lb,qb=uf,Wb=qb.Symbol,lf=Wb,gl=lf,cf=Object.prototype,Ub=cf.hasOwnProperty,Hb=cf.toString,br=gl?gl.toStringTag:void 0;function Vb(e){var t=Ub.call(e,br),n=e[br];try{e[br]=void 0;var r=!0}catch{}var a=Hb.call(e);return r&&(t?e[br]=n:delete e[br]),a}var Kb=Vb,Zb=Object.prototype,Yb=Zb.toString;function Gb(e){return Yb.call(e)}var Qb=Gb,vl=lf,Jb=Kb,Xb=Qb,ey="[object Null]",ty="[object Undefined]",bl=vl?vl.toStringTag:void 0;function ny(e){return e==null?e===void 0?ty:ey:bl&&bl in Object(e)?Jb(e):Xb(e)}var ry=ny;function ay(e){return e!=null&&typeof e=="object"}var iy=ay,sy=ry,oy=iy,uy="[object Symbol]";function ly(e){return typeof e=="symbol"||oy(e)&&sy(e)==uy}var cy=ly,dy=zb,yl=wo,fy=cy,Dl=0/0,hy=/^[-+]0x[0-9a-f]+$/i,my=/^0b[01]+$/i,py=/^0o[0-7]+$/i,gy=parseInt;function vy(e){if(typeof e=="number")return e;if(fy(e))return Dl;if(yl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=yl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=dy(e);var n=my.test(e);return n||py.test(e)?gy(e.slice(2),n?2:8):hy.test(e)?Dl:+e}var by=vy,yy=wo,Ni=Pb,Cl=by,Dy="Expected a function",Cy=Math.max,xy=Math.min;function wy(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(Dy);t=Cl(t)||0,yy(n)&&(d=!!n.leading,h="maxWait"in n,i=h?Cy(Cl(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(F){var S=r,q=a;return r=a=void 0,u=F,s=e.apply(q,S),s}function g(F){return u=F,o=setTimeout(v,t),d?m(F):s}function f(F){var S=F-l,q=F-u,N=t-S;return h?xy(N,i-q):N}function b(F){var S=F-l,q=F-u;return l===void 0||S>=t||S<0||h&&q>=i}function v(){var F=Ni();if(b(F))return x(F);o=setTimeout(v,f(F))}function x(F){return o=void 0,p&&r?m(F):(r=a=void 0,s)}function k(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function _(){return o===void 0?s:x(Ni())}function w(){var F=Ni(),S=b(F);if(r=arguments,a=this,l=F,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(v,t),m(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=k,w.flush=_,w}var df=wy;const Ey=On(df);var _y=df,ky=wo,Fy="Expected a function";function By(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Fy);return ky(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),_y(e,t,{leading:r,maxWait:t,trailing:a})}var Ay=By;const Ty=On(Ay),xl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,wl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ii=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return wl(n.overflowY,t)||wl(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},ua=(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,Sy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},El=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,h=typeof u=="function"?u:W=>W!==u;if(!xl(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let g=e;for(;xl(g)&&h(g);){if(g=Sy(g),g===p){m.push(g);break}g!=null&&g===document.body&&Ii(g)&&!Ii(document.documentElement)||g!=null&&Ii(g,d)&&m.push(g)}const f=(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:k,width:_,top:w,right:F,bottom:S,left:q}=e.getBoundingClientRect(),{top:N,right:z,bottom:I,left:A}=(W=>{const H=window.getComputedStyle(W);return{top:parseFloat(H.scrollMarginTop)||0,right:parseFloat(H.scrollMarginRight)||0,bottom:parseFloat(H.scrollMarginBottom)||0,left:parseFloat(H.scrollMarginLeft)||0}})(e);let E=o==="start"||o==="nearest"?w-N:o==="end"?S+I:w+k/2-N+I,j=l==="center"?q+_/2-A+z:l==="end"?F+z:q-A;const R=[];for(let W=0;W<m.length;W++){const H=m[W],{height:G,width:ne,top:C,right:L,bottom:ee,left:B}=H.getBoundingClientRect();if(s==="if-needed"&&w>=0&&q>=0&&S<=b&&F<=f&&w>=C&&S<=ee&&q>=B&&F<=L)return R;const T=getComputedStyle(H),O=parseInt(T.borderLeftWidth,10),$=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),re=parseInt(T.borderBottomWidth,10);let X=0,ae=0;const he="offsetWidth"in H?H.offsetWidth-H.clientWidth-O-U:0,Q="offsetHeight"in H?H.offsetHeight-H.clientHeight-$-re:0,ve="offsetWidth"in H?H.offsetWidth===0?0:ne/H.offsetWidth:0,pe="offsetHeight"in H?H.offsetHeight===0?0:G/H.offsetHeight:0;if(p===H)X=o==="start"?E:o==="end"?E-b:o==="nearest"?ua(x,x+b,b,$,re,x+E,x+E+k,k):E-b/2,ae=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:ua(v,v+f,f,O,U,v+j,v+j+_,_),X=Math.max(0,X+x),ae=Math.max(0,ae+v);else{X=o==="start"?E-C-$:o==="end"?E-ee+re+Q:o==="nearest"?ua(C,ee,G,$,re+Q,E,E+k,k):E-(C+G/2)+Q/2,ae=l==="start"?j-B-O:l==="center"?j-(B+ne/2)+he/2:l==="end"?j-L+U+he:ua(B,L,ne,O,U+he,j,j+_,_);const{scrollLeft:_e,scrollTop:Fe}=H;X=pe===0?0:Math.max(0,Math.min(Fe+X/pe,H.scrollHeight-G/pe+Q)),ae=ve===0?0:Math.max(0,Math.min(_e+ae/ve,H.scrollWidth-ne/ve+he)),E+=Fe-X,j+=_e-ae}R.push({el:H,top:X,left:ae})}return R},jy=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Oy(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(El(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of El(e,jy(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var En=[],Py=function(){return En.some(function(e){return e.activeTargets.length>0})},My=function(){return En.some(function(e){return e.skippedTargets.length>0})},_l="ResizeObserver loop completed with undelivered notifications.",Ny=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:_l}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=_l),window.dispatchEvent(e)},Rr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Rr||(Rr={}));var _n=function(e){return Object.freeze(e)},Iy=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,_n(this)}return e}(),ff=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,_n(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}(),Eo=function(e){return e instanceof SVGElement&&"getBBox"in e},hf=function(e){if(Eo(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)},kl=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)},Ry=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},_r=typeof window<"u"?window:{},la=new WeakMap,Fl=/auto|scroll/,$y=/^tb|vertical/,Ly=/msie|trident/i.test(_r.navigator&&_r.navigator.userAgent),Nt=function(e){return parseFloat(e||"0")},Qn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Iy((n?t:e)||0,(n?e:t)||0)},Bl=_n({devicePixelContentBoxSize:Qn(),borderBoxSize:Qn(),contentBoxSize:Qn(),contentRect:new ff(0,0,0,0)}),mf=function(e,t){if(t===void 0&&(t=!1),la.has(e)&&!t)return la.get(e);if(hf(e))return la.set(e,Bl),Bl;var n=getComputedStyle(e),r=Eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!Ly&&n.boxSizing==="border-box",i=$y.test(n.writingMode||""),s=!r&&Fl.test(n.overflowY||""),o=!r&&Fl.test(n.overflowX||""),l=r?0:Nt(n.paddingTop),u=r?0:Nt(n.paddingRight),d=r?0:Nt(n.paddingBottom),h=r?0:Nt(n.paddingLeft),p=r?0:Nt(n.borderTopWidth),m=r?0:Nt(n.borderRightWidth),g=r?0:Nt(n.borderBottomWidth),f=r?0:Nt(n.borderLeftWidth),b=h+u,v=l+d,x=f+m,k=p+g,_=o?e.offsetHeight-k-e.clientHeight:0,w=s?e.offsetWidth-x-e.clientWidth:0,F=a?b+x:0,S=a?v+k:0,q=r?r.width:Nt(n.width)-F-w,N=r?r.height:Nt(n.height)-S-_,z=q+b+w+x,I=N+v+_+k,A=_n({devicePixelContentBoxSize:Qn(Math.round(q*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:Qn(z,I,i),contentBoxSize:Qn(q,N,i),contentRect:new ff(h,l,q,N)});return la.set(e,A),A},pf=function(e,t,n){var r=mf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Rr.DEVICE_PIXEL_CONTENT_BOX:return s;case Rr.BORDER_BOX:return a;default:return i}},zy=function(){function e(t){var n=mf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=_n([n.borderBoxSize]),this.contentBoxSize=_n([n.contentBoxSize]),this.devicePixelContentBoxSize=_n([n.devicePixelContentBoxSize])}return e}(),gf=function(e){if(hf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},qy=function(){var e=1/0,t=[];En.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new zy(u.target),h=gf(u.target);o.push(d),u.lastReportedSize=pf(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Al=function(e){En.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(gf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Wy=function(){var e=0;for(Al(e);Py();)e=qy(),Al(e);return My()&&Ny(),e>0},Ri,vf=[],Uy=function(){return vf.splice(0).forEach(function(e){return e()})},Hy=function(e){if(!Ri){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Uy()}).observe(n,r),Ri=function(){n.textContent="".concat(t?t--:t++)}}vf.push(e),Ri()},Vy=function(e){Hy(function(){requestAnimationFrame(e)})},_a=0,Ky=function(){return!!_a},Zy=250,Yy={attributes:!0,characterData:!0,childList:!0,subtree:!0},Tl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Sl=function(e){return e===void 0&&(e=0),Date.now()+e},$i=!1,Gy=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=Zy),!$i){$i=!0;var r=Sl(t);Vy(function(){var a=!1;try{a=Wy()}finally{if($i=!1,t=r-Sl(),!Ky())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,Yy)};document.body?n():_r.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Tl.forEach(function(n){return _r.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Tl.forEach(function(n){return _r.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Os=new Gy,jl=function(e){!_a&&e>0&&Os.start(),_a+=e,!_a&&Os.stop()},Qy=function(e){return!Eo(e)&&!Ry(e)&&getComputedStyle(e).display==="inline"},Jy=function(){function e(t,n){this.target=t,this.observedBox=n||Rr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=pf(this.target,this.observedBox,!0);return Qy(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Xy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ca=new WeakMap,Ol=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},da=function(){function e(){}return e.connect=function(t,n){var r=new Xy(t,n);ca.set(t,r)},e.observe=function(t,n,r){var a=ca.get(t),i=a.observationTargets.length===0;Ol(a.observationTargets,n)<0&&(i&&En.push(a),a.observationTargets.push(new Jy(n,r&&r.box)),jl(1),Os.schedule())},e.unobserve=function(t,n){var r=ca.get(t),a=Ol(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&En.splice(En.indexOf(r),1),r.observationTargets.splice(a,1),jl(-1))},e.disconnect=function(t){var n=this,r=ca.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),e1=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.");da.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(!kl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");da.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(!kl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");da.unobserve(this,t)},e.prototype.disconnect=function(){da.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),tn={};Object.defineProperty(tn,"__esModule",{value:!0});var t1=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Li={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},bf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:t1?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},_o={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 fa=1;fa<20;fa++)_o["f"+fa]=111+fa;function ui(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return yf(s,t)}),a=function(o){return r.some(function(l){return Df(l,o)})},i=n==null?a:a(n);return i}function n1(e,t){return ui(e,t)}function r1(e,t){return ui(e,{byKey:!0},t)}function yf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Li)r[Li[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var g=ko(p),f=Li[g];if(p.length>1&&!f&&!bf[p]&&!_o[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=Cf(p)),f&&(r[f]=m?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Df(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 Cf(e){e=ko(e);var t=_o[e]||e.toUpperCase().charCodeAt(0);return t}function ko(e){return e=e.toLowerCase(),e=bf[e]||e,e}var a1=tn.default=ui,zi=tn.isHotkey=ui;tn.isCodeHotkey=n1;tn.isKeyHotkey=r1;tn.parseHotkey=yf;tn.compareHotkey=Df;tn.toKeyCode=Cf;tn.toKeyName=ko;function i1(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 rr(e,t){if(e==null)return{};var n=i1(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 s1(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 o1(e){var t=s1(e,"string");return $r(t)==="symbol"?t:String(t)}function Bt(e,t,n){return t=o1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fo=y.createContext(null),gn=()=>{var e=y.useContext(Fo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},xf=parseInt(y.version.split(".")[0],10),u1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ct=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Zn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),xr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),l1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),wf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),c1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),d1=ct&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),f1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),h1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),m1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ka=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rn=(!c1||!d1)&&!l1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Bo=new WeakMap,Ao=new WeakMap,Ef=new WeakMap,Fa=new WeakMap,Ps=new WeakMap,Lr=new WeakMap,kn=new WeakMap,Wa=new WeakMap,li=new WeakMap,Ms=new WeakMap,cn=new WeakMap,xn=new WeakMap,kr=new WeakMap,Ns=new WeakMap,To=new WeakMap,jt=new WeakMap,Yt=new WeakMap,mt=new WeakMap,sn=new WeakMap,on=new WeakMap,_f=new WeakMap,ar=Symbol("placeholder"),kf=Symbol("mark-placeholder"),p1=globalThis.Text,So=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,g1=e=>dn(e)&&e.nodeType===8,Ft=e=>dn(e)&&e.nodeType===1,dn=e=>{var t=So(e);return!!t&&e instanceof t.Node},Is=e=>{var t=e&&e.anchorNode&&So(e.anchorNode);return!!t&&e instanceof t.Selection},Ff=e=>dn(e)&&e.nodeType===3,v1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,b1=e=>{var[t,n]=e;if(Ft(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Bf(t,a,r?"backward":"forward"),r=a<n;Ft(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=D1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},y1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Bf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(g1(a)||Ft(a)&&a.childNodes.length===0||Ft(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]},D1=(e,t,n)=>{var[r]=Bf(e,t,n);return r},Af=e=>{var t="";if(Ff(e)&&e.nodeValue)return e.nodeValue;if(Ft(e)){for(var n of Array.from(e.childNodes))t+=Af(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
130
|
+
`)}return t},C1=/data-slate-fragment="(.+?)"/m,x1=e=>{var t=e.getData("text/html"),[,n]=t.match(C1)||[];return n},jo=(e,t,n)=>{var{target:r}=t;if(Ft(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=te.getWindow(e);if(a.contains(r))return te.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 d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:jo(e,i,n)},w1=0;class E1{constructor(){Bt(this,"id",void 0),this.id="".concat(w1++)}}var te={androidPendingDiffs:e=>mt.get(e),androidScheduleFlush:e=>{var t;(t=To.get(e))===null||t===void 0||t()},blur:e=>{var t=te.toDOMNode(e,e),n=te.findDocumentOrShadowRoot(e);cn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=te.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&J.deselect(e)},findDocumentOrShadowRoot:e=>{var t=te.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=te.toSlateNode(e,t.target),s=te.findPath(e,i);if(fe.isElement(i)&&D.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=D.point(e,s,{edge:l?"start":"end"}),d=l?D.before(e,u):D.after(e,u);if(d){var h=D.range(e,d);return h}}var p,{document:m}=te.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var g=m.caretPositionFromPoint(n,r);g&&(p=m.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=te.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Wa.get(t);return n||(n=new E1,Wa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Ao.get(r);if(a==null){if(D.isEditor(r))return n;break}var i=Bo.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(et.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!cn.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(()=>{te.focus(t,{retries:n.retries-1})},10);return}var r=te.toDOMNode(t,t),a=te.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=te.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(J.select(t,D.start(t,[])),t.onChange()),cn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Ef.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=te.toDOMNode(t,t),s;try{s=Ft(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)=>dn(t)&&te.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return D.hasPath(e,n.path)&&D.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>te.hasEditableTarget(e,t)||te.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>dn(t)&&te.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!xn.get(e),isFocused:e=>!!cn.get(e),isReadOnly:e=>!!Ms.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Ms.get(e))return!1;var n=te.hasTarget(e,t)&&te.toSlateNode(e,t);return fe.isElement(n)&&D.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=li.get(e),r=D.isEditor(t)?Fa.get(e):n==null?void 0:n.get(te.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(et.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=D.node(e,t.path),r=te.toDOMNode(e,n),a;D.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],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:h}=d.textContent,p=u.getAttribute("data-slate-length"),m=p==null?h:parseInt(p,10),g=o+m,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];a=[v instanceof p1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var x=Math.min(h,Math.max(0,t.offset-o));a=[d,x];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(et.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=K.isBackward(t),i=te.toDOMPoint(e,n),s=K.isCollapsed(t)?i:te.toDOMPoint(e,r),o=te.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[h,p]=a?i:s,m=Ft(u)?u:u.parentElement,g=!!m.getAttribute("data-slate-zero-width"),f=Ft(h)?h:h.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(h,b?1:p),l},toSlateNode:(e,t)=>{var n=Ft(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Lr.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:b1(t),o=i.parentNode,l=null,u=0;if(o){var d,h,p=te.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),g=m&&p.contains(m)?m:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=te.getWindow(e),x=v.document.createRange();x.setStart(l,0),x.setEnd(i,s);var k=x.cloneContents(),_=[...Array.prototype.slice.call(k.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(k.querySelectorAll("[contenteditable=false]"))];_.forEach(j=>{if(ct&&!r&&j.hasAttribute("data-slate-zero-width")&&j.textContent.length>0&&j.textContext!=="\uFEFF"){j.textContent.startsWith("\uFEFF")&&(j.textContent=j.textContent.slice(1));return}j.parentNode.removeChild(j)}),u=k.textContent.length,b=l}}else if(g){for(var w=g.querySelectorAll("[data-slate-leaf]"),F=0;F<w.length;F++){var S=w[F];if(te.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}b&&u===b.textContent.length&&ct&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Zn&&(h=b.textContent)!==null&&h!==void 0&&h.endsWith(`
|
|
131
131
|
|
|
132
|
-
`))&&u--}if(ct&&!l&&!r){var
|
|
132
|
+
`))&&u--}if(ct&&!l&&!r){var q=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(q&&te.hasDOMNode(e,q,{editable:!0})){var N=te.toSlateNode(e,q),{path:z,offset:I}=D.start(e,te.findPath(e,N));return q.querySelector("[data-slate-leaf]")||(I=s),{path:z,offset:I}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var A=te.toSlateNode(e,l),E=te.findPath(e,A);return{path:E,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Is(t)?t.anchorNode:t.startContainer,o,l,u,d,h;if(s)if(Is(t)){if(Zn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let F=function(S){return S.childElementCount>0?F(S.children[0]):S};var g=p.startContainer,f=m.startContainer,b=F(g.children[p.startOffset]),v=F(f.children[m.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;wf&&y1(o)||Zn?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Zn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
|
|
133
133
|
|
|
134
|
-
`)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,d=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var A=ne.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var _=h?A:ne.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!_)return null;var x={anchor:A,focus:_};return V.isExpanded(x)&&V.isForward(x)&&kt(u)&&D.void(e,{at:x.focus,mode:"highest"})&&(x=D.unhangRange(e,x,{voids:!0})),x}};function _1(e,t){var{path:n,diff:r}=t;if(!D.hasPath(e,n))return!1;var a=ue.get(e,n);if(!he.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=P.next(n);if(!D.hasPath(e,i))return!1;var s=ue.get(e,i);return he.isText(s)&&s.text.startsWith(r.text)}function Tf(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 k1(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 F1(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 Sf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=k1(i,a),o=Math.min(i.length-s,a.length-s),l=F1(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 B1(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=Tf(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 Sf(e,{start:r,end:l,text:o})}function A1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Rs(e,t){var{path:n,offset:r}=t;if(!D.hasPath(e,n))return null;var a=ue.get(e,n);if(!he.isText(a))return null;var i=D.above(e,{match:o=>de.isElement(o)&&D.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=D.next(e,{at:n,match:he.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Pl(e,t){var n=Rs(e,t.anchor);if(!n)return null;if(V.isCollapsed(t))return{anchor:n,focus:n};var r=Rs(e,t.focus);return r?{anchor:n,focus:r}:null}function $s(e,t,n){var r=mt.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return P.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return we.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=we.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=we.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&P.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Ml(e,t,n){var r=$s(e,t.anchor,n);if(!r)return null;if(V.isCollapsed(t))return{anchor:r,focus:r};var a=$s(e,t.focus,n);return a?{anchor:r,focus:a}:null}function T1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!P.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!P.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:P.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:P.transform(n,t,{affinity:"forward"})};case"merge_node":return P.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:P.transform(n,t)}:{diff:r,id:a,path:P.transform(n,t)}}var i=P.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Nl(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 fa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var S1=25,j1=200,O1=function(){},P1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function M1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var B=on.get(t);if(on.delete(t),B){var{selection:E}=t,j=Pl(t,B);j&&(!E||!V.equals(j,E))&&J.select(t,j)}},h=()=>{var B=sn.get(t);if(sn.delete(t),!!B){if(B.at){var E=we.isPoint(B.at)?Rs(t,B.at):Pl(t,B.at);if(!E)return;var j=D.range(t,E);(!t.selection||!V.equals(t.selection,j))&&J.select(t,E)}B.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!_()&&!A()){d();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var B=t.selection&&D.rangeRef(t,t.selection,{affinity:"forward"});Yt.set(t,t.marks),O1("flush",sn.get(t),mt.get(t));for(var E=_(),j;j=(N=mt.get(t))===null||N===void 0?void 0:N[0];){var N,W,H=St.get(t);H!==void 0&&(St.delete(t),t.marks=H),H&&u===!1&&(u=null);var G=A1(j);(!t.selection||!V.equals(t.selection,G))&&J.select(t,G),j.diff.text?D.insertText(t,j.diff.text):D.deleteFragment(t),mt.set(t,(W=mt.get(t))===null||W===void 0?void 0:W.filter(L=>{var{id:ee}=L;return ee!==j.id})),_1(t,j)||(E=!1,sn.delete(t),Yt.delete(t),a="action",on.delete(t),n.cancel(),r.cancel(),B==null||B.unref())}var re=B==null?void 0:B.unref();if(re&&!on.get(t)&&(!t.selection||!V.equals(re,t.selection))&&J.select(t,re),A()){h();return}E&&n(),n.flush(),r.flush(),d();var C=Yt.get(t);Yt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},m=B=>{i&&clearTimeout(i),i=setTimeout(()=>{xn.set(t,!1),p()},S1)},g=B=>{xn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Ps.get(t);if(j){if(_()||E){j.style.display="none";return}j.style.removeProperty("display")}},b=(B,E)=>{var j,N=(j=mt.get(t))!==null&&j!==void 0?j:[];mt.set(t,N);var W=ue.leaf(t,B),H=N.findIndex(C=>P.equals(C.path,B));if(H<0){var G=Sf(W.text,E);G&&N.push({path:B,diff:E,id:l++}),f();return}var re=B1(W.text,N[H].diff,E);if(!re){N.splice(H,1),f();return}N[H]=fa(fa({},N[H]),{},{diff:re})},v=function(E){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,on.delete(t),n.cancel(),r.cancel(),A()&&p(),sn.set(t,{at:j,run:E}),o=setTimeout(p)},w=B=>{var E;s&&(clearTimeout(s),s=null);var{inputType:j}=B,N=null,W=B.dataTransfer||B.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[H]=B.getTargetRanges();H&&(N=ne.toSlateRange(t,H,{exactMatch:!1,suppressThrow:!0}));var G=ne.getWindow(t),re=G.getSelection();if(!N&&re&&(H=re,N=ne.toSlateRange(t,re,{exactMatch:!1,suppressThrow:!0})),N=(E=N)!==null&&E!==void 0?E:t.selection,!!N){var C=!0;if(j.startsWith("delete")){if(V.isExpanded(N)){var[L,ee]=V.edges(N),F=ue.leaf(t,L.path);if(F.text.length===L.offset&&ee.offset===0){var k=D.next(t,{at:L.path,match:he.isText});k&&P.equals(k[1],ee.path)&&(N={anchor:ee,focus:ee})}}var $=j.endsWith("Backward")?"backward":"forward",[R,U]=V.edges(N),[ae,X]=D.leaf(t,R.path),ie={text:"",start:R.offset,end:U.offset},fe=mt.get(t),Q=fe==null?void 0:fe.find(me=>P.equals(me.path,X)),ve=Q?[Q.diff,ie]:[ie],pe=Tf(ae.text,...ve);if(pe.length===0&&(C=!1),V.isExpanded(N)){if(C&&P.equals(N.anchor.path,N.focus.path)){var _e={path:N.anchor.path,offset:R.offset},Fe=D.range(t,_e,_e);return S(Fe),b(N.anchor.path,{text:"",end:U.offset,start:R.offset})}return v(()=>D.deleteFragment(t,{direction:$}),{at:N})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>D.deleteFragment(t),{at:N});case"deleteContent":case"deleteContentForward":{var{anchor:Te}=N;if(C&&V.isCollapsed(N)){var Ve=ue.leaf(t,Te.path);if(Te.offset<Ve.text.length)return b(Te.path,{text:"",start:Te.offset,end:Te.offset+1})}return v(()=>D.deleteForward(t),{at:N})}case"deleteContentBackward":{var We,{anchor:Be}=N,Se=Is(H)?H.isCollapsed:!!((We=H)!==null&&We!==void 0&&We.collapsed);return C&&Se&&V.isCollapsed(N)&&Be.offset>0?b(Be.path,{text:"",start:Be.offset-1,end:Be.offset}):v(()=>D.deleteBackward(t),{at:N})}case"deleteEntireSoftLine":return v(()=>{D.deleteBackward(t,{unit:"line"}),D.deleteForward(t,{unit:"line"})},{at:N});case"deleteHardLineBackward":return v(()=>D.deleteBackward(t,{unit:"block"}),{at:N});case"deleteSoftLineBackward":return v(()=>D.deleteBackward(t,{unit:"line"}),{at:N});case"deleteHardLineForward":return v(()=>D.deleteForward(t,{unit:"block"}),{at:N});case"deleteSoftLineForward":return v(()=>D.deleteForward(t,{unit:"line"}),{at:N});case"deleteWordBackward":return v(()=>D.deleteBackward(t,{unit:"word"}),{at:N});case"deleteWordForward":return v(()=>D.deleteForward(t,{unit:"word"}),{at:N});case"insertLineBreak":return v(()=>D.insertSoftBreak(t),{at:N});case"insertParagraph":return v(()=>D.insertBreak(t),{at:N});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(P1(W))return v(()=>ne.insertData(t,W),{at:N});var De=W??"";if(St.get(t)&&(De=De.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(De)&&(De=De.slice(0,-1)),De.includes(`
|
|
135
|
-
`))return v(()=>{var
|
|
136
|
-
`);
|
|
137
|
-
`?y.createElement(
|
|
138
|
-
`:""),[i]=y.useState(a);return zr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(Y1,{ref:r},i)},Y1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),qi=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),y.createElement("span",K1({},a),!ct||!n?"\uFEFF":null,n?y.createElement("br",null):null)};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 Of(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){Ft(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}var G1=ct?300:0;function Q1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function zl(e){e.current&&(clearTimeout(e.current),e.current=null)}var J1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>y.createElement(eD,Of({},w))}=e,o=gn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),p=y.useRef(null),m=y.useCallback(w=>{if(Q1(l,w==null),w==null){var A;Ps.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(Ps.set(o,w),!l.current){var _=window.ResizeObserver||e1;l.current=new _(()=>{var x;(x=t.onPlaceholderResize)===null||x===void 0||x.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),g=y.createElement(Z1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[ar];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},G1)):(zl(p),h(!1)),()=>zl(p)),[f,h]),f&&d){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:xr?"inherit":void 0},contentEditable:!1,ref:m}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},X1=y.memo(J1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&he.equals(t.leaf,e.leaf)&&t.leaf[ar]===e.leaf[ar]),eD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Of({},t),n)},tD=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=gn(),l=y.useRef(null),u=he.decorations(s,t),d=ne.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(y.createElement(X1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=ui.get(o);f?(b==null||b.set(d,f),kn.set(s,f),Lr.set(f,s)):(b==null||b.delete(d),kn.delete(s),l.current&&Lr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},h)},Pf=y.memo(tD,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&V1(t.decorations,e.decorations));function ql(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 Ls(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ql(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nD=e=>{var{decorations:t,element:n,renderElement:r=w=>y.createElement(aD,Ls({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=gn(),l=oD(),u=o.isInline(n),d=ne.findKey(o,n),h=y.useCallback(w=>{var A=ui.get(o);w?(A==null||A.set(d,w),kn.set(n,w),Lr.set(w,n)):(A==null||A.delete(d),kn.delete(n))},[o,d,n]),p=Nf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&D.hasInlines(o,n)){var g=ue.string(n),f=of(g);f==="rtl"&&(m.dir=f)}if(D.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var b=u?"span":"div",[[v]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Pf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Fo.set(v,0),Bo.set(v,n)}return r({attributes:m,children:p,element:n})},rD=y.memo(nD,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&H1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&V.equals(e.selection,t.selection))),aD=e=>{var{attributes:t,children:n,element:r}=e,a=gn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Ls(Ls({},t),{},{style:{position:"relative"}}),n)},Mf=y.createContext(()=>[]),iD=()=>y.useContext(Mf),sD=y.createContext(!1),Nf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=iD(),l=gn(),u=ne.findPath(l,n),d=[],h=de.isElement(n)&&!l.isInline(n)&&D.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),g=n.children[p],f=ne.findKey(l,g),b=D.range(l,m),v=s&&V.intersection(b,s),w=o([g,m]);for(var A of t){var _=V.intersection(A,b);_&&w.push(_)}de.isElement(g)?d.push(y.createElement(sD.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(rD,{decorations:w,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(y.createElement(Pf,{decorations:w,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Fo.set(g,p),Bo.set(g,n)}return d},If=y.createContext(!1),oD=()=>y.useContext(If),Rf=y.createContext(null),Nn=()=>{var e=y.useContext(Rf);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function uD(){var e=gn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ne.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var lD=3,cD={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"},dD={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"},fD={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},He=e=>{var t=cD[e],n=dD[e],r=fD[e],a=t&&zi(t),i=n&&zi(n),s=r&&zi(r);return o=>!!(a&&a(o)||Ol&&i&&i(o)||!Ol&&s&&s(o))},Ke={isBold:He("bold"),isCompose:He("compose"),isMoveBackward:He("moveBackward"),isMoveForward:He("moveForward"),isDeleteBackward:He("deleteBackward"),isDeleteForward:He("deleteForward"),isDeleteLineBackward:He("deleteLineBackward"),isDeleteLineForward:He("deleteLineForward"),isDeleteWordBackward:He("deleteWordBackward"),isDeleteWordForward:He("deleteWordForward"),isExtendBackward:He("extendBackward"),isExtendForward:He("extendForward"),isExtendLineBackward:He("extendLineBackward"),isExtendLineForward:He("extendLineForward"),isItalic:He("italic"),isMoveLineBackward:He("moveLineBackward"),isMoveLineForward:He("moveLineForward"),isMoveWordBackward:He("moveWordBackward"),isMoveWordForward:He("moveWordForward"),isRedo:He("redo"),isSoftBreak:He("insertSoftBreak"),isSplitBlock:He("splitBlock"),isTransposeCharacter:He("transposeCharacter"),isUndo:He("undo")},hD=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>So(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}},mD={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class $f extends y.Component{constructor(){super(...arguments),Ft(this,"context",null),Ft(this,"manager",null),Ft(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,mD)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=hD(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}}Ft($f,"contextType",ko);var pD=ct?$f:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},gD=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],vD=["text"];function Wl(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 It(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wl(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var bD=e=>y.createElement(y.Fragment,null,Nf(e)),yD=e=>{var t=y.useCallback(k=>y.createElement(DD,It({},k)),[]),{autoFocus:n,decorate:r=CD,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=xD,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,g=rr(e,gD),f=Nn(),[b,v]=y.useState(!1),w=y.useRef(null),A=y.useRef([]),[_,x]=y.useState(),{onUserInput:T,receivedUserInput:S}=uD(),[,z]=y.useReducer(k=>k+1,0);_f.set(f,z),Ms.set(f,s);var M=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var q=y.useRef(),I=y.useMemo(()=>Ty(()=>{var k=q.current;if((ct||!ne.isComposing(f))&&(!M.isUpdatingSelection||k!=null&&k.isFlushing())&&!M.isDraggingInternally){var $=ne.findDocumentOrShadowRoot(f),{activeElement:R}=$,U=ne.toDOMNode(f,f),ae=$.getSelection();if(R===U?(M.latestElement=R,cn.set(f,!0)):cn.delete(f),!ae)return J.deselect(f);var{anchorNode:X,focusNode:ie}=ae,fe=ne.hasEditableTarget(f,X)||ne.isTargetInsideNonReadonlyVoid(f,X),Q=ne.hasEditableTarget(f,ie)||ne.isTargetInsideNonReadonlyVoid(f,ie);if(fe&&Q){var ve=ne.toSlateRange(f,ae,{exactMatch:!1,suppressThrow:!0});ve&&(!ne.isComposing(f)&&!(k!=null&&k.hasPendingChanges())&&!(k!=null&&k.isFlushing())?J.select(f,ve):k==null||k.handleUserSelect(ve))}s&&(!fe||!Q)&&J.deselect(f)}},100),[f,s,M]),B=y.useMemo(()=>Ey(I,0),[I]);q.current=z1({node:w,onDOMSelectionChange:I,scheduleOnDOMSelectionChange:B}),zr(()=>{var k,$,R;w.current&&(R=To(w.current))?(Ef.set(f,R),ka.set(f,w.current),kn.set(f,w.current),Lr.set(w.current,f)):kn.delete(f);var{selection:U}=f,ae=ne.findDocumentOrShadowRoot(f),X=ae.getSelection();if(!(!X||!ne.isFocused(f)||(k=q.current)!==null&&k!==void 0&&k.hasPendingAction())){var ie=pe=>{var _e=X.type!=="None";if(!(!U&&!_e)){var Fe=X.focusNode,Te;if(Zn&&X.rangeCount>1){var Ve=X.getRangeAt(0),We=X.getRangeAt(X.rangeCount-1);Ve.startContainer===Fe?Te=We.endContainer:Te=Ve.startContainer}else Te=X.anchorNode;var Be=ka.get(f),Se=!1;if(Be.contains(Te)&&Be.contains(Fe)&&(Se=!0),_e&&Se&&U&&!pe){var De=ne.toSlateRange(f,X,{exactMatch:!0,suppressThrow:!0});if(De&&V.equals(De,U)){var Re;if(!M.hasMarkPlaceholder||(Re=Te)!==null&&Re!==void 0&&(Re=Re.parentElement)!==null&&Re!==void 0&&Re.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!ne.hasRange(f,U)){f.selection=ne.toSlateRange(f,X,{exactMatch:!1,suppressThrow:!0});return}M.isUpdatingSelection=!0;var ze=U&&ne.toDOMRange(f,U);return ze?(ne.isComposing(f)&&!ct?X.collapseToEnd():V.isBackward(U)?X.setBaseAndExtent(ze.endContainer,ze.endOffset,ze.startContainer,ze.startOffset):X.setBaseAndExtent(ze.startContainer,ze.startOffset,ze.endContainer,ze.endOffset),d(f,ze)):X.removeAllRanges(),ze}};X.rangeCount<=1&&ie();var fe=(($=q.current)===null||$===void 0?void 0:$.isFlushing())==="action";if(!ct||!fe){setTimeout(()=>{M.isUpdatingSelection=!1});return}var Q=null,ve=requestAnimationFrame(()=>{if(fe){var pe=_e=>{try{var Fe=ne.toDOMNode(f,f);Fe.focus(),ie(_e)}catch{}};pe(),Q=setTimeout(()=>{pe(!0),M.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ve),Q&&clearTimeout(Q)}}});var E=y.useCallback(k=>{if(T(),!s&&ne.hasEditableTarget(f,k.target)&&!wD(k,a)){var $;if(q.current)return q.current.handleDOMBeforeInput(k);B.flush(),I.flush();var{selection:R}=f,{inputType:U}=k,ae=k.dataTransfer||k.data||void 0,X=U==="insertCompositionText"||U==="deleteCompositionText";if(X&&ne.isComposing(f))return;var ie=!1;if(U==="insertText"&&R&&V.isCollapsed(R)&&k.data&&k.data.length===1&&/[a-z ]/i.test(k.data)&&R.anchor.offset!==0){var fe,Q;ie=!0,f.marks&&(ie=!1);var{anchor:ve}=R,[pe,_e]=ne.toDOMPoint(f,ve),Fe=(fe=pe.parentElement)===null||fe===void 0?void 0:fe.closest("a"),Te=ne.getWindow(f);if(ie&&Fe&&ne.hasDOMNode(f,Fe)){var Ve,We=Te==null?void 0:Te.document.createTreeWalker(Fe,NodeFilter.SHOW_TEXT).lastChild();We===pe&&((Ve=We.textContent)===null||Ve===void 0?void 0:Ve.length)===_e&&(ie=!1)}if(ie&&pe.parentElement&&(Te==null||(Q=Te.getComputedStyle(pe.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Be=D.above(f,{at:ve.path,match:te=>de.isElement(te)&&D.isBlock(f,te)});Be&&ue.string(Be[0]).includes(" ")&&(ie=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Se]=k.getTargetRanges();if(Se){var De=ne.toSlateRange(f,Se,{exactMatch:!1,suppressThrow:!1});if(!R||!V.equals(R,De)){ie=!1;var Re=!X&&f.selection&&D.rangeRef(f,f.selection);J.select(f,De),Re&&kr.set(f,Re)}}}if(X)return;if(ie||k.preventDefault(),R&&V.isExpanded(R)&&U.startsWith("delete")){var ze=U.endsWith("Backward")?"backward":"forward";D.deleteFragment(f,{direction:ze});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{D.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{D.deleteForward(f);break}case"deleteContentBackward":{D.deleteBackward(f);break}case"deleteEntireSoftLine":{D.deleteBackward(f,{unit:"line"}),D.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{D.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{D.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{D.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{D.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{D.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{D.deleteForward(f,{unit:"word"});break}case"insertLineBreak":D.insertSoftBreak(f);break;case"insertParagraph":{D.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&ne.isComposing(f)&&(v(!1),xn.set(f,!1)),(ae==null?void 0:ae.constructor.name)==="DataTransfer"?ne.insertData(f,ae):typeof ae=="string"&&(ie?A.current.push(()=>D.insertText(f,ae)):D.insertText(f,ae));break}}var Y=($=kr.get(f))===null||$===void 0?void 0:$.unref();kr.delete(f),Y&&(!f.selection||!V.equals(f.selection,Y))&&J.select(f,Y)}},[f,I,T,a,s,B]),j=y.useCallback(k=>{k==null?(I.cancel(),B.cancel(),ka.delete(f),kn.delete(f),w.current&&rn&&w.current.removeEventListener("beforeinput",E)):rn&&k.addEventListener("beforeinput",E),w.current=k},[I,B,f,E]);zr(()=>{var k=ne.getWindow(f);return k.document.addEventListener("selectionchange",B),()=>{k.document.removeEventListener("selectionchange",B)}},[B]);var N=r([f,[]]),W=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,H=y.useCallback(k=>{if(k&&W){var $;x(($=k.getBoundingClientRect())===null||$===void 0?void 0:$.height)}else x(void 0)},[W]);if(W){var G=D.start(f,[]);N.push({[ar]:!0,placeholder:i,onPlaceholderResize:H,anchor:G,focus:G})}var{marks:re}=f;if(M.hasMarkPlaceholder=!1,f.selection&&V.isCollapsed(f.selection)&&re){var{anchor:C}=f.selection,L=ue.leaf(f,C.path),ee=rr(L,vD);if(!he.equals(L,re,{loose:!0})){M.hasMarkPlaceholder=!0;var F=Object.fromEntries(Object.keys(ee).map(k=>[k,null]));N.push(It(It(It({[kf]:!0},F),re),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:k}=f;if(k){var{anchor:$}=k,R=ue.leaf(f,$.path);if(re&&!he.equals(R,re,{loose:!0})){St.set(f,re);return}}St.delete(f)})}),y.createElement(If.Provider,{value:s},y.createElement(Mf.Provider,{value:r},y.createElement(pD,{node:w,receivedUserInput:S},y.createElement(p,It(It({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:rn||!_a?g.spellCheck:!1,autoCorrect:rn||!_a?g.autoCorrect:"false",autoCapitalize:rn||!_a?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:It(It({},m?{}:It({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},_?{minHeight:_}:{})),h),onBeforeInput:y.useCallback(k=>{if(!rn&&!s&&!ut(k,g.onBeforeInput)&&ne.hasSelectableTarget(f,k.target)&&(k.preventDefault(),!ne.isComposing(f))){var $=k.data;D.insertText(f,$)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(k=>{if(!ut(k,g.onInput)){if(q.current){q.current.handleInput();return}for(var $ of A.current)$();A.current=[]}},[g.onInput]),onBlur:y.useCallback(k=>{if(!(s||M.isUpdatingSelection||!ne.hasSelectableTarget(f,k.target)||ut(k,g.onBlur))){var $=ne.findDocumentOrShadowRoot(f);if(M.latestElement!==$.activeElement){var{relatedTarget:R}=k,U=ne.toDOMNode(f,f);if(R!==U&&!(kt(R)&&R.hasAttribute("data-slate-spacer"))){if(R!=null&&dn(R)&&ne.hasDOMNode(f,R)){var ae=ne.toSlateNode(f,R);if(de.isElement(ae)&&!f.isVoid(ae))return}if(xr){var X=$.getSelection();X==null||X.removeAllRanges()}cn.delete(f)}}}},[s,M.isUpdatingSelection,M.latestElement,f,g.onBlur]),onClick:y.useCallback(k=>{if(ne.hasTarget(f,k.target)&&!ut(k,g.onClick)&&dn(k.target)){var $=ne.toSlateNode(f,k.target),R=ne.findPath(f,$);if(!D.hasPath(f,R)||ue.get(f,R)!==$)return;if(k.detail===lD&&R.length>=1){var U=R;if(!(de.isElement($)&&D.isBlock(f,$))){var ae,X=D.above(f,{match:Fe=>de.isElement(Fe)&&D.isBlock(f,Fe),at:R});U=(ae=X==null?void 0:X[1])!==null&&ae!==void 0?ae:R.slice(0,1)}var ie=D.range(f,U);J.select(f,ie);return}if(s)return;var fe=D.start(f,R),Q=D.end(f,R),ve=D.void(f,{at:fe}),pe=D.void(f,{at:Q});if(ve&&pe&&P.equals(ve[1],pe[1])){var _e=D.range(f,fe);J.select(f,_e)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(k=>{if(ne.hasSelectableTarget(f,k.target)){var $;if(ne.isComposing(f)&&Promise.resolve().then(()=>{v(!1),xn.set(f,!1)}),($=q.current)===null||$===void 0||$.handleCompositionEnd(k),ut(k,g.onCompositionEnd)||ct)return;if(!xr&&!f1&&!u1&&!m1&&!h1&&k.data){var R=St.get(f);St.delete(f),R!==void 0&&(Yt.set(f,f.marks),f.marks=R),D.insertText(f,k.data);var U=Yt.get(f);Yt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(k=>{ne.hasSelectableTarget(f,k.target)&&!ut(k,g.onCompositionUpdate)&&(ne.isComposing(f)||(v(!0),xn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(k=>{if(ne.hasSelectableTarget(f,k.target)){var $;if(($=q.current)===null||$===void 0||$.handleCompositionStart(k),ut(k,g.onCompositionStart)||ct)return;v(!0);var{selection:R}=f;if(R&&V.isExpanded(R)){D.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(k=>{ne.hasSelectableTarget(f,k.target)&&!ut(k,g.onCopy)&&!Ul(k)&&(k.preventDefault(),ne.setFragmentData(f,k.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(k=>{if(!s&&ne.hasSelectableTarget(f,k.target)&&!ut(k,g.onCut)&&!Ul(k)){k.preventDefault(),ne.setFragmentData(f,k.clipboardData,"cut");var{selection:$}=f;if($)if(V.isExpanded($))D.deleteFragment(f);else{var R=ue.parent(f,$.anchor.path);D.isVoid(f,R)&&J.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(k=>{if(ne.hasTarget(f,k.target)&&!ut(k,g.onDragOver)){var $=ne.toSlateNode(f,k.target);de.isElement($)&&D.isVoid(f,$)&&k.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(k=>{if(!s&&ne.hasTarget(f,k.target)&&!ut(k,g.onDragStart)){var $=ne.toSlateNode(f,k.target),R=ne.findPath(f,$),U=de.isElement($)&&D.isVoid(f,$)||D.void(f,{at:R,voids:!0});if(U){var ae=D.range(f,R);J.select(f,ae)}M.isDraggingInternally=!0,ne.setFragmentData(f,k.dataTransfer,"drag")}},[s,f,g.onDragStart,M]),onDrop:y.useCallback(k=>{if(!s&&ne.hasTarget(f,k.target)&&!ut(k,g.onDrop)){k.preventDefault();var $=f.selection,R=ne.findEventRange(f,k),U=k.dataTransfer;J.select(f,R),M.isDraggingInternally&&$&&!V.equals($,R)&&!D.void(f,{at:R,voids:!0})&&J.delete(f,{at:$}),ne.insertData(f,U),ne.isFocused(f)||ne.focus(f)}M.isDraggingInternally=!1},[s,f,g.onDrop,M]),onDragEnd:y.useCallback(k=>{!s&&M.isDraggingInternally&&g.onDragEnd&&ne.hasTarget(f,k.target)&&g.onDragEnd(k),M.isDraggingInternally=!1},[s,M,g,f]),onFocus:y.useCallback(k=>{if(!s&&!M.isUpdatingSelection&&ne.hasEditableTarget(f,k.target)&&!ut(k,g.onFocus)){var $=ne.toDOMNode(f,f),R=ne.findDocumentOrShadowRoot(f);if(M.latestElement=R.activeElement,Zn&&k.target!==$){$.focus();return}cn.set(f,!0)}},[s,M,f,g.onFocus]),onKeyDown:y.useCallback(k=>{if(!s&&ne.hasEditableTarget(f,k.target)){var $;($=q.current)===null||$===void 0||$.handleKeyDown(k);var{nativeEvent:R}=k;if(ne.isComposing(f)&&R.isComposing===!1&&(xn.set(f,!1),v(!1)),ut(k,g.onKeyDown)||ne.isComposing(f))return;var{selection:U}=f,ae=f.children[U!==null?U.focus.path[0]:0],X=of(ue.string(ae))==="rtl";if(Ke.isRedo(R)){k.preventDefault();var ie=f;typeof ie.redo=="function"&&ie.redo();return}if(Ke.isUndo(R)){k.preventDefault();var fe=f;typeof fe.undo=="function"&&fe.undo();return}if(Ke.isMoveLineBackward(R)){k.preventDefault(),J.move(f,{unit:"line",reverse:!0});return}if(Ke.isMoveLineForward(R)){k.preventDefault(),J.move(f,{unit:"line"});return}if(Ke.isExtendLineBackward(R)){k.preventDefault(),J.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ke.isExtendLineForward(R)){k.preventDefault(),J.move(f,{unit:"line",edge:"focus"});return}if(Ke.isMoveBackward(R)){k.preventDefault(),U&&V.isCollapsed(U)?J.move(f,{reverse:!X}):J.collapse(f,{edge:X?"end":"start"});return}if(Ke.isMoveForward(R)){k.preventDefault(),U&&V.isCollapsed(U)?J.move(f,{reverse:X}):J.collapse(f,{edge:X?"start":"end"});return}if(Ke.isMoveWordBackward(R)){k.preventDefault(),U&&V.isExpanded(U)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:!X});return}if(Ke.isMoveWordForward(R)){k.preventDefault(),U&&V.isExpanded(U)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:X});return}if(rn){if((wf||xr)&&U&&(Ke.isDeleteBackward(R)||Ke.isDeleteForward(R))&&V.isCollapsed(U)){var Q=ue.parent(f,U.anchor.path);if(de.isElement(Q)&&D.isVoid(f,Q)&&(D.isInline(f,Q)||D.isBlock(f,Q))){k.preventDefault(),D.deleteBackward(f,{unit:"block"});return}}}else{if(Ke.isBold(R)||Ke.isItalic(R)||Ke.isTransposeCharacter(R)){k.preventDefault();return}if(Ke.isSoftBreak(R)){k.preventDefault(),D.insertSoftBreak(f);return}if(Ke.isSplitBlock(R)){k.preventDefault(),D.insertBreak(f);return}if(Ke.isDeleteBackward(R)){k.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f);return}if(Ke.isDeleteForward(R)){k.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f);return}if(Ke.isDeleteLineBackward(R)){k.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"line"});return}if(Ke.isDeleteLineForward(R)){k.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"line"});return}if(Ke.isDeleteWordBackward(R)){k.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"word"});return}if(Ke.isDeleteWordForward(R)){k.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(k=>{!s&&ne.hasEditableTarget(f,k.target)&&!ut(k,g.onPaste)&&(!rn||v1(k.nativeEvent)||xr)&&(k.preventDefault(),ne.insertData(f,k.clipboardData))},[s,f,g.onPaste])}),y.createElement(bD,{decorations:N,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},DD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",It({},t),n,ct&&y.createElement("br",null))},CD=()=>[],xD=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&V.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Oy(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ut=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Ul=e=>dn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),wD=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},ED=y.createContext(!1),_D=y.createContext({});function kD(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var FD=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],BD=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=rr(e,FD),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(et.stringify(s)));if(!D.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(et.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=kD(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.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})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(Ns.set(t,p),()=>{Ns.set(t,()=>{})}),[t,p]);var[m,g]=y.useState(ne.isFocused(t));return y.useEffect(()=>{g(ne.isFocused(t))},[t]),zr(()=>{var f=()=>g(ne.isFocused(t));return xf>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),y.createElement(_D.Provider,{value:d},y.createElement(Rf.Provider,{value:l},y.createElement(ko.Provider,{value:l.editor},y.createElement(ED.Provider,{value:m},n))))},Hl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Vl=(e,t,n)=>{var r=ne.toDOMRange(e,t).getBoundingClientRect(),a=ne.toDOMRange(e,n).getBoundingClientRect();return Hl(r,a)&&Hl(a,r)},AD=(e,t)=>{var n=D.range(e,V.end(t)),r=Array.from(D.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Vl(e,D.range(e,r[a]),n))return D.range(e,r[a],n);if(r.length<2)return D.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Vl(e,D.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return D.range(e,r[i],n)};function Kl(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?Kl(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var TD=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 ui.set(r,new WeakMap),r.addMark=(u,d)=>{var h,p;(h=Ao.get(r))===null||h===void 0||h(),!St.get(r)&&(p=mt.get(r))!==null&&p!==void 0&&p.length&&St.set(r,null),Yt.delete(r),o(u,d)},r.removeMark=u=>{var d;!St.get(r)&&(d=mt.get(r))!==null&&d!==void 0&&d.length&&St.set(r,null),Yt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&V.isCollapsed(r.selection)){var d=D.above(r,{match:g=>de.isElement(g)&&D.isBlock(r,g),at:r.selection});if(d){var[,h]=d,p=D.range(r,h,r.selection.anchor),m=AD(r,p);V.isCollapsed(m)||J.delete(r,{at:m})}}},r.apply=u=>{var d=[],h=[],p=mt.get(r);if(p!=null&&p.length){var m=p.map(j=>T1(j,u)).filter(Boolean);mt.set(r,m)}var g=on.get(r);g&&on.set(r,Ml(r,g,u));var f=sn.get(r);if(f!=null&&f.at){var b=we.isPoint(f==null?void 0:f.at)?$s(r,f.at,u):Ml(r,f.at,u);sn.set(r,b?Zl(Zl({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...zn(r,u.path));break}case"set_selection":{var v;(v=kr.get(r))===null||v===void 0||v.unref(),kr.delete(r);break}case"insert_node":case"remove_node":{d.push(...zn(r,P.parent(u.path)));break}case"merge_node":{var w=P.previous(u.path);d.push(...zn(r,w));break}case"move_node":{var A=P.common(P.parent(u.path),P.parent(u.newPath));d.push(...zn(r,A));var _;P.isBefore(u.path,u.newPath)?(d.push(...zn(r,P.parent(u.path))),_=u.newPath):(d.push(...zn(r,P.parent(u.newPath))),_=u.path);var x=ue.get(t,P.parent(_)),T=ne.findKey(r,x),S=D.pathRef(r,P.parent(_));h.push([S,T]);break}}a(u);for(var[z,M]of d){var[q]=D.node(r,z);qa.set(q,M)}for(var[I,B]of h)if(I.current){var[E]=D.node(r,I.current);qa.set(E,B)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,p]=V.edges(d),m=D.void(r,{at:h.path}),g=D.void(r,{at:p.path});if(!(V.isCollapsed(d)&&!m)){var f=ne.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(q=>{q.textContent&&q.textContent.trim()!==""&&(v=q)}),g){var[w]=g,A=f.cloneRange(),_=ne.toDOMNode(r,w);A.setEndAfter(_),b=A.cloneContents()}if(m&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(q=>{var I=q.getAttribute("data-slate-zero-width")==="n";q.textContent=I?`
|
|
139
|
-
`:""}),Ff(v)){var x=v.ownerDocument.createElement("span");x.style.whiteSpace="pre",x.appendChild(v),b.appendChild(x),v=x}var T=r.getFragment(),S=JSON.stringify(T),z=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var M=b.ownerDocument.createElement("div");return M.appendChild(b),M.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(M),u.setData("text/html",M.innerHTML),u.setData("text/plain",Af(M)),b.ownerDocument.body.removeChild(M),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||x1(u);if(d){var h=decodeURIComponent(window.atob(d)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&J.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=xf<18?Nc.unstable_batchedUpdates:h=>h();d(()=>{var h=Ns.get(r);h&&h(u),i(u)})},r},zn=(e,t)=>{var n=[];for(var[r,a]of D.levels(e,{at:t})){var i=ne.findKey(e,r);n.push([a,i])}return n};const SD={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},onMention:()=>{},reportError:e=>{console.error(e)}},nn=y.createContext(SD);var K=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(K||{}),Lt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Lt||{});const jD=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case K.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case K.link:return c.jsx("a",{...e,children:t});case K.li:return c.jsx("li",{...e,children:t});case K.mention:const a=r;return a!=null&&a.name&&a.name===Sr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(se.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case K.ol:return c.jsx("ol",{...e,children:t});case K.ul:return c.jsx("ul",{...e,children:t});case K.span:return c.jsx("span",{...e,children:t});case K.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},OD=({attributes:e,children:t,leaf:n})=>{const r=n;return r[K.bold]&&(t=c.jsx("strong",{children:t})),r[K.italic]&&(t=c.jsx("em",{children:t})),r[K.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})},zs="MENTION: ",Lf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Yl={"mention-popover":35,default:-52},Wi=16,zf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(nn),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var m,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=A=>{if(!D.hasPath(e,A.path))return!1;const _=ue.get(e,A.path);return D.isEditor(_)||de.isElement(_)?A.offset<=_.children.length:he.isText(_)?A.offset<=_.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ne.toDOMRange(e,f||Lf).getBoundingClientRect();const w=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((w==null?void 0:w.width)||0)/Wi}rem`),d=(w==null?void 0:w.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const h=Yl[t]||Yl.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Wi}rem`,l.style.left=`${d/Wi}rem`},o),r},PD=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=D.nodes(e,{at:r,match:i=>i.type===K.link});if(a){const i=a[0],s=ed(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var lt=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e))(lt||{});const Yn={[K.paragraph]:K.paragraph,[K.blockquote]:K.blockquote,[K.codeblock]:K.codeblock,[K.link]:K.link,[K.ul]:K.ul,[K.ol]:K.ol,[K.li]:K.li,[K.mention]:K.mention,[K.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Lt.emphasis]:K.italic,[Lt.strong]:K.bold,[Lt.delete]:K.strikethrough,[Lt.code]:K.code,[K.hr]:K.hr,[K.image]:K.image};function Gl(e){if(e)throw e}var Fa=Object.prototype.hasOwnProperty,qf=Object.prototype.toString,Ql=Object.defineProperty,Jl=Object.getOwnPropertyDescriptor,Xl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):qf.call(t)==="[object Array]"},ec=function(t){if(!t||qf.call(t)!=="[object Object]")return!1;var n=Fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Fa.call(t,a)},tc=function(t,n){Ql&&n.name==="__proto__"?Ql(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},nc=function(t,n){if(n==="__proto__")if(Fa.call(t,n)){if(Jl)return Jl(t,n).value}else return;return t[n]},MD=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=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=nc(o,n),a=nc(t,n),o!==a&&(d&&a&&(ec(a)||(i=Xl(a)))?(i?(i=!1,s=r&&Xl(r)?r:[]):s=r&&ec(r)?r:{},tc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&tc(o,{name:n,newValue:a}));return o};const Ui=On(MD);function qs(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 ND(){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 d=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,d?ID(d,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 ID(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 d=u;if(o&&n)throw d;return a(d)}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 Fr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?rc(e.position):"start"in e||"end"in e?rc(e):"line"in e||"column"in e?Ws(e):""}function Ws(e){return ac(e&&e.line)+":"+ac(e&&e.column)}function rc(e){return Ws(e&&e.start)+"-"+Ws(e&&e.end)}function ac(e){return e&&typeof e=="number"?e:1}class vt 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=Fr(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}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const Rt={basename:RD,dirname:$D,extname:LD,join:zD,sep:"/"};function RD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vr(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 $D(e){if(Vr(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 LD(e){Vr(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 zD(...e){let t=-1,n;for(;++t<e.length;)Vr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":qD(n)}function qD(e){Vr(e);const t=e.codePointAt(0)===47;let n=WD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function WD(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 Vr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const UD={cwd:HD};function HD(){return"/"}function Us(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function VD(e){if(typeof e=="string")e=new URL(e);else if(!Us(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 KD(e)}function KD(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 Hi=["history","path","basename","stem","extname","dirname"];class ZD{constructor(t){let n;t?Us(t)?n={path:t}:typeof t=="string"||YD(t)?n={value:t}:n=t:n={},this.cwd=UD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Hi.length;){const i=Hi[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)Hi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Rt.basename(this.path):void 0}set basename(t){Ki(t,"basename"),Vi(t,"basename"),this.path=Rt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Rt.dirname(this.path):void 0}set dirname(t){ic(this.basename,"dirname"),this.path=Rt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Rt.extname(this.path):void 0}set extname(t){if(Vi(t,"extname"),ic(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=Rt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Us(t)&&(t=VD(t)),Ki(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Rt.basename(this.path,this.extname):void 0}set stem(t){Ki(t,"stem"),Vi(t,"stem"),this.path=Rt.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 vt(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 Vi(e,t){if(e&&e.includes(Rt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Rt.sep+"`")}function Ki(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ic(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function YD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const GD=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},QD={}.hasOwnProperty;class jo extends GD{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=ND()}copy(){const t=new jo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ui(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Gi("data",this.frozen),this.namespace[t]=n,this):QD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gi("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=ha(t),r=this.parser||this.Parser;return Zi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Zi("process",this.parser||this.Parser),Yi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ha(t),l=r.parse(o);r.run(l,o,function(d,h,p){if(d||!h||!p)return u(d);const m=h,g=r.stringify(m,p);eC(g)?p.value=g:p.result=g,u(d,p)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Zi("processSync",this.parser||this.Parser),Yi("processSync",this.compiler||this.Compiler),this.process(t,a),oc("processSync","process",n),r;function a(i,s){n=!0,Gl(i),r=s}}run(t,n,r){sc(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=ha(n);a.run(t,l,u);function u(d,h,p){const m=h||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),oc("runSync","run",r),a;function i(s,o){Gl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ha(n),a=this.compiler||this.Compiler;return Yi("stringify",a),sc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Gi("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[d,...h]=u;l(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Ui(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...g]=d;const f=r[p][1];qs(f)&&qs(m)&&(m=Ui(!0,f,m)),r[p]=[u,m,...g]}}}}const JD=new jo().freeze();function Zi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gi(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 sc(e){if(!qs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function oc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ha(e){return XD(e)?e:new ZD(e)}function XD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function eC(e){return typeof e=="string"||tC(e)}function tC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nC={};function rC(e,t){const n=t||nC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Wf(e,r,a)}function Wf(e,t,n){if(aC(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 uc(e.children,t,n)}return Array.isArray(e)?uc(e,t,n):""}function uc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Wf(e[a],t,n);return r.join("")}function aC(e){return!!(e&&typeof e=="object")}const lc=document.createElement("i");function Oo(e){const t="&"+e+";";lc.innerHTML=t;const n=lc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xt(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 _t(e,t){return e.length>0?(Xt(e,e.length,0,t),e):t}const cc={}.hasOwnProperty;function iC(e){const t={};let n=-1;for(;++n<e.length;)sC(t,e[n]);return t}function sC(e,t){let n;for(n in t){const a=(cc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){cc.call(a,s)||(a[s]=[]);const o=i[s];oC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function oC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Xt(e,0,0,r)}function Uf(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 Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=vn(/[A-Za-z]/),jt=vn(/[\dA-Za-z]/),uC=vn(/[#-'*+\--9=?A-Z^-~]/);function Hs(e){return e!==null&&(e<32||e===127)}const Vs=vn(/\d/),lC=vn(/[\dA-Fa-f]/),cC=vn(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function gt(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const dC=vn(/\p{P}|\p{S}/u),fC=vn(/\s/);function vn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Le(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Oe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Oe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const hC={tokenize:mC};function mC(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"),Le(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 be(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const pC={tokenize:gC},dc={tokenize:vC};function gC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const _=t.events.length;let x=_,T;for(;x--;)if(t.events[x][0]==="exit"&&t.events[x][1].type==="chunkFlow"){T=t.events[x][1].end;break}v(r);let S=_;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},T),S++;return Xt(t.events,x+1,0,t.events.slice(_)),t.events.length=S,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(dc,d,h)(A)}function d(A){return a&&w(),v(r),p(A)}function h(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(dc,m,g)(A)}function m(A){return r++,n.push([t.currentConstruct,t.containerState]),p(A)}function g(A){if(A===null){a&&w(),v(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(A)}function f(A){if(A===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(A);return}return be(A)?(e.consume(A),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),f)}function b(A,_){const x=t.sliceStream(A);if(_&&x.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(x),t.parser.lazy[A.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<s&&(!a.events[T][1].end||a.events[T][1].end.offset>s))return;const S=t.events.length;let z=S,M,q;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(M){q=t.events[z][1].end;break}M=!0}for(v(r),T=S;T<t.events.length;)t.events[T][1].end=Object.assign({},q),T++;Xt(t.events,z+1,0,t.events.slice(S)),t.events.length=T}}function v(A){let _=n.length;for(;_-- >A;){const x=n[_];t.containerState=x[1],x[0].exit.call(t,e)}n.length=A}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function vC(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fc(e){if(e===null||gt(e)||fC(e))return 1;if(dC(e))return 2}function Po(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 Ks={name:"attention",tokenize:yC,resolveAll:bC};function bC(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);hc(h,-l),hc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end: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=_t(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=_t(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=_t(u,Po(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=_t(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=_t(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Xt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function yC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=fc(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"),d=fc(l),h=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(l)}}function hc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const DC={name:"autolink",tokenize:CC};function CC(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return $t(m)?(e.consume(m),s):m===64?n(m):u(m)}function s(m){return m===43||m===45||m===46||jt(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||jt(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Hs(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):uC(m)?(e.consume(m),u):n(m)}function d(m){return jt(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||jt(m))&&r++<63){const g=m===45?p:h;return e.consume(m),g}return n(m)}}const li={tokenize:xC,partial:!0};function xC(e,t,n){return r;function r(i){return Oe(i)?Le(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||be(i)?t(i):n(i)}}const Hf={name:"blockQuote",tokenize:wC,continuation:{tokenize:EC},exit:_C};function wC(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 Oe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function EC(e,t,n){const r=this;return a;function a(s){return Oe(s)?Le(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Hf,t,n)(s)}}function _C(e){e.exit("blockQuote")}const Vf={name:"characterEscape",tokenize:kC};function kC(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 cC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Kf={name:"characterReference",tokenize:FC};function FC(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=jt,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=lC,d):(e.enter("characterReferenceValue"),i=7,s=Vs,d(h))}function d(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===jt&&!Oo(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const mc={tokenize:AC,partial:!0},pc={name:"codeFenced",tokenize:BC,concrete:!0};function BC(e,t,n){const r=this,a={tokenize:x,partial:!0};let i=0,s=0,o;return l;function l(T){return u(T)}function u(T){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===o?(s++,e.consume(T),d):s<3?n(T):(e.exit("codeFencedFenceSequence"),Oe(T)?Le(e,h,"whitespace")(T):h(T))}function h(T){return T===null||be(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(mc,f,_)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Oe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,m,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),p)}function m(T){return T===null||be(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===o?n(T):(e.consume(T),g)}function f(T){return e.attempt(a,_,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),v}function v(T){return i>0&&Oe(T)?Le(e,w,"linePrefix",i+1)(T):w(T)}function w(T){return T===null||be(T)?e.check(mc,f,_)(T):(e.enter("codeFlowValue"),A(T))}function A(T){return T===null||be(T)?(e.exit("codeFlowValue"),w(T)):(e.consume(T),A)}function _(T){return e.exit("codeFenced"),t(T)}function x(T,S,z){let M=0;return q;function q(N){return T.enter("lineEnding"),T.consume(N),T.exit("lineEnding"),I}function I(N){return T.enter("codeFencedFence"),Oe(N)?Le(T,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):B(N)}function B(N){return N===o?(T.enter("codeFencedFenceSequence"),E(N)):z(N)}function E(N){return N===o?(M++,T.consume(N),E):M>=s?(T.exit("codeFencedFenceSequence"),Oe(N)?Le(T,j,"whitespace")(N):j(N)):z(N)}function j(N){return N===null||be(N)?(T.exit("codeFencedFence"),S(N)):z(N)}}}function AC(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 Qi={name:"codeIndented",tokenize:SC},TC={tokenize:jC,partial:!0};function SC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Le(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):be(u)?e.attempt(TC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||be(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function jC(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Le(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):be(s)?a(s):n(s)}}const OC={name:"codeText",tokenize:NC,resolve:PC,previous:MC};function PC(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 MC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NC(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,d(h)):be(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||be(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class IC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&yr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),yr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);yr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yr(this.left,n.reverse())}}}function yr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Zf(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new IC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(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,RC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return Xt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function RC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,h,p=-1,m=n,g=0,f=0;const b=[f];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=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&&(f=p+1,b.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),w=i.pop();l.push([w,w+v.length-1]),e.splice(w,2,v)}for(l.reverse(),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 $C={tokenize:qC,resolve:zC},LC={tokenize:WC,partial:!0};function zC(e){return Zf(e),e}function qC(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):be(o)?e.check(LC,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 WC(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Le(e,i,"linePrefix")}function i(s){if(s===null||be(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 Yf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(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||Hs(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(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"}),m(v))}function m(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||be(v)?n(v):(e.consume(v),v===92?g:m)}function g(v){return v===60||v===62||v===92?(e.consume(v),m):m(v)}function f(v){return!d&&(v===null||v===41||gt(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||Hs(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Gf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):be(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||be(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Oe(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function Qf(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):be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Le(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||be(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Br(e,t){let n;return r;function r(a){return be(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Oe(a)?Le(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const UC={name:"definition",tokenize:VC},HC={tokenize:KC,partial:!0};function VC(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return Gf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return gt(m)?Br(e,u)(m):u(m)}function u(m){return Yf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(HC,h,h)(m)}function h(m){return Oe(m)?Le(e,p,"whitespace")(m):p(m)}function p(m){return m===null||be(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function KC(e,t,n){return r;function r(o){return gt(o)?Br(e,a)(o):n(o)}function a(o){return Qf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Oe(o)?Le(e,s,"whitespace")(o):s(o)}function s(o){return o===null||be(o)?t(o):n(o)}}const ZC={name:"hardBreakEscape",tokenize:YC};function YC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return be(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const GC={name:"headingAtx",tokenize:JC,resolve:QC};function QC(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"},Xt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function JC(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||gt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||be(d)?(e.exit("atxHeading"),t(d)):Oe(d)?Le(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||gt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const XC=["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"],gc=["pre","script","style","textarea"],ex={name:"htmlFlow",tokenize:ax,resolveTo:rx,concrete:!0},tx={tokenize:sx,partial:!0},nx={tokenize:ix,partial:!0};function rx(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 ax(e,t,n){const r=this;let a,i,s,o,l;return u;function u(F){return d(F)}function d(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),h}function h(F){return F===33?(e.consume(F),p):F===47?(e.consume(F),i=!0,f):F===63?(e.consume(F),a=3,r.interrupt?t:C):$t(F)?(e.consume(F),s=String.fromCharCode(F),b):n(F)}function p(F){return F===45?(e.consume(F),a=2,m):F===91?(e.consume(F),a=5,o=0,g):$t(F)?(e.consume(F),a=4,r.interrupt?t:C):n(F)}function m(F){return F===45?(e.consume(F),r.interrupt?t:C):n(F)}function g(F){const k="CDATA[";return F===k.charCodeAt(o++)?(e.consume(F),o===k.length?r.interrupt?t:B:g):n(F)}function f(F){return $t(F)?(e.consume(F),s=String.fromCharCode(F),b):n(F)}function b(F){if(F===null||F===47||F===62||gt(F)){const k=F===47,$=s.toLowerCase();return!k&&!i&&gc.includes($)?(a=1,r.interrupt?t(F):B(F)):XC.includes(s.toLowerCase())?(a=6,k?(e.consume(F),v):r.interrupt?t(F):B(F)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):i?w(F):A(F))}return F===45||jt(F)?(e.consume(F),s+=String.fromCharCode(F),b):n(F)}function v(F){return F===62?(e.consume(F),r.interrupt?t:B):n(F)}function w(F){return Oe(F)?(e.consume(F),w):q(F)}function A(F){return F===47?(e.consume(F),q):F===58||F===95||$t(F)?(e.consume(F),_):Oe(F)?(e.consume(F),A):q(F)}function _(F){return F===45||F===46||F===58||F===95||jt(F)?(e.consume(F),_):x(F)}function x(F){return F===61?(e.consume(F),T):Oe(F)?(e.consume(F),x):A(F)}function T(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),l=F,S):Oe(F)?(e.consume(F),T):z(F)}function S(F){return F===l?(e.consume(F),l=null,M):F===null||be(F)?n(F):(e.consume(F),S)}function z(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||gt(F)?x(F):(e.consume(F),z)}function M(F){return F===47||F===62||Oe(F)?A(F):n(F)}function q(F){return F===62?(e.consume(F),I):n(F)}function I(F){return F===null||be(F)?B(F):Oe(F)?(e.consume(F),I):n(F)}function B(F){return F===45&&a===2?(e.consume(F),W):F===60&&a===1?(e.consume(F),H):F===62&&a===4?(e.consume(F),L):F===63&&a===3?(e.consume(F),C):F===93&&a===5?(e.consume(F),re):be(F)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(tx,ee,E)(F)):F===null||be(F)?(e.exit("htmlFlowData"),E(F)):(e.consume(F),B)}function E(F){return e.check(nx,j,ee)(F)}function j(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),N}function N(F){return F===null||be(F)?E(F):(e.enter("htmlFlowData"),B(F))}function W(F){return F===45?(e.consume(F),C):B(F)}function H(F){return F===47?(e.consume(F),s="",G):B(F)}function G(F){if(F===62){const k=s.toLowerCase();return gc.includes(k)?(e.consume(F),L):B(F)}return $t(F)&&s.length<8?(e.consume(F),s+=String.fromCharCode(F),G):B(F)}function re(F){return F===93?(e.consume(F),C):B(F)}function C(F){return F===62?(e.consume(F),L):F===45&&a===2?(e.consume(F),C):B(F)}function L(F){return F===null||be(F)?(e.exit("htmlFlowData"),ee(F)):(e.consume(F),L)}function ee(F){return e.exit("htmlFlow"),t(F)}}function ix(e,t,n){const r=this;return a;function a(s){return be(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 sx(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(li,t,n)}}const ox={name:"htmlText",tokenize:ux};function ux(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),x):C===63?(e.consume(C),A):$t(C)?(e.consume(C),z):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):$t(C)?(e.consume(C),w):n(C)}function d(C){return C===45?(e.consume(C),m):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),p):be(C)?(s=h,H(C)):(e.consume(C),h)}function p(C){return C===45?(e.consume(C),m):h(C)}function m(C){return C===62?W(C):C===45?p(C):h(C)}function g(C){const L="CDATA[";return C===L.charCodeAt(i++)?(e.consume(C),i===L.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):be(C)?(s=f,H(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),v):f(C)}function v(C){return C===62?W(C):C===93?(e.consume(C),v):f(C)}function w(C){return C===null||C===62?W(C):be(C)?(s=w,H(C)):(e.consume(C),w)}function A(C){return C===null?n(C):C===63?(e.consume(C),_):be(C)?(s=A,H(C)):(e.consume(C),A)}function _(C){return C===62?W(C):A(C)}function x(C){return $t(C)?(e.consume(C),T):n(C)}function T(C){return C===45||jt(C)?(e.consume(C),T):S(C)}function S(C){return be(C)?(s=S,H(C)):Oe(C)?(e.consume(C),S):W(C)}function z(C){return C===45||jt(C)?(e.consume(C),z):C===47||C===62||gt(C)?M(C):n(C)}function M(C){return C===47?(e.consume(C),W):C===58||C===95||$t(C)?(e.consume(C),q):be(C)?(s=M,H(C)):Oe(C)?(e.consume(C),M):W(C)}function q(C){return C===45||C===46||C===58||C===95||jt(C)?(e.consume(C),q):I(C)}function I(C){return C===61?(e.consume(C),B):be(C)?(s=I,H(C)):Oe(C)?(e.consume(C),I):M(C)}function B(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,E):be(C)?(s=B,H(C)):Oe(C)?(e.consume(C),B):(e.consume(C),j)}function E(C){return C===a?(e.consume(C),a=void 0,N):C===null?n(C):be(C)?(s=E,H(C)):(e.consume(C),E)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||gt(C)?M(C):(e.consume(C),j)}function N(C){return C===47||C===62||gt(C)?M(C):n(C)}function W(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function H(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),G}function G(C){return Oe(C)?Le(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):re(C)}function re(C){return e.enter("htmlTextData"),s(C)}}const Mo={name:"labelEnd",tokenize:mx,resolveTo:hx,resolveAll:fx},lx={tokenize:px},cx={tokenize:gx},dx={tokenize:vx};function fx(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 hx(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)},d={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=_t(o,e.slice(i+1,i+r+3)),o=_t(o,[["enter",d,t]]),o=_t(o,Po(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=_t(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=_t(o,e.slice(s+1)),o=_t(o,[["exit",l,t]]),Xt(e,i,e.length,o),e}function mx(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?h(p):(s=r.parser.defined.includes(Jn(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(lx,d,s?d:h)(p):p===91?e.attempt(cx,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt(dx,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function px(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return gt(h)?Br(e,i)(h):i(h)}function i(h){return h===41?d(h):Yf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return gt(h)?Br(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?Qf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return gt(h)?Br(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function gx(e,t,n){const r=this;return a;function a(o){return Gf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function vx(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 bx={name:"labelStartImage",tokenize:yx,resolveAll:Mo.resolveAll};function yx(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 Dx={name:"labelStartLink",tokenize:Cx,resolveAll:Mo.resolveAll};function Cx(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 Ji={name:"lineEnding",tokenize:xx};function xx(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Ba={name:"thematicBreak",tokenize:wx};function wx(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||be(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Oe(u)?Le(e,o,"whitespace")(u):o(u))}}const ht={name:"list",tokenize:kx,continuation:{tokenize:Fx},exit:Ax},Ex={tokenize:Tx,partial:!0},_x={tokenize:Bx,partial:!0};function kx(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(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Vs(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ba,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Vs(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(li,r.interrupt?n:d,e.attempt(Ex,p,h))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Oe(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function Fx(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(li,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Oe(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(_x,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(ht,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Bx(e,t,n){const r=this;return Le(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 Ax(e){e.exit(this.containerState.type)}function Tx(e,t,n){const r=this;return Le(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!Oe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const vc={name:"setextUnderline",tokenize:jx,resolveTo:Sx};function Sx(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 jx(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Oe(u)?Le(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||be(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Ox={tokenize:Px};function Px(e){const t=this,n=e.attempt(li,r,e.attempt(this.parser.constructs.flowInitial,a,Le(e,e.attempt(this.parser.constructs.flow,a,e.attempt($C,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 Mx={resolveAll:Xf()},Nx=Jf("string"),Ix=Jf("text");function Jf(e){return{tokenize:t,resolveAll:Xf(e==="text"?Rx:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=a[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function Xf(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 Rx(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 $x(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:w,enter:A,exit:_,attempt:S(x),check:S(T),interrupt:S(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:g,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(I){return s=_t(s,I),b(),s[s.length-1]!==null?[]:(z(t,0),u.events=Po(i,u.events,u),u.events)}function p(I,B){return zx(m(I),B)}function m(I){return Lx(s,I)}function g(){const{line:I,column:B,offset:E,_index:j,_bufferIndex:N}=r;return{line:I,column:B,offset:E,_index:j,_bufferIndex:N}}function f(I){a[I.line]=I.column,q()}function b(){let I;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<B.length;)v(B.charCodeAt(r._bufferIndex));else v(B)}}function v(I){d=d(I)}function w(I){be(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,q()):I!==-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=I}function A(I,B){const E=B||{};return E.type=I,E.start=g(),u.events.push(["enter",E,u]),o.push(E),E}function _(I){const B=o.pop();return B.end=g(),u.events.push(["exit",B,u]),B}function x(I,B){z(I,B.from)}function T(I,B){B.restore()}function S(I,B){return E;function E(j,N,W){let H,G,re,C;return Array.isArray(j)?ee(j):"tokenize"in j?ee([j]):L(j);function L(R){return U;function U(ae){const X=ae!==null&&R[ae],ie=ae!==null&&R.null,fe=[...Array.isArray(X)?X:X?[X]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return ee(fe)(ae)}}function ee(R){return H=R,G=0,R.length===0?W:F(R[G])}function F(R){return U;function U(ae){return C=M(),re=R,R.partial||(u.currentConstruct=R),R.name&&u.parser.constructs.disable.null.includes(R.name)?$():R.tokenize.call(B?Object.assign(Object.create(u),B):u,l,k,$)(ae)}}function k(R){return I(re,C),N}function $(R){return C.restore(),++G<H.length?F(H[G]):W}}}function z(I,B){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&Xt(u.events,B,u.events.length-B,I.resolve(u.events.slice(B),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function M(){const I=g(),B=u.previous,E=u.currentConstruct,j=u.events.length,N=Array.from(o);return{restore:W,from:j};function W(){r=I,u.previous=B,u.currentConstruct=E,u.events.length=j,o=N,q()}}function q(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Lx(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 zx(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
|
+
`)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,d=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var k=te.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!k)return null;var _=h?k:te.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!_)return null;var w={anchor:k,focus:_};return K.isExpanded(w)&&K.isForward(w)&&Ft(u)&&D.void(e,{at:w.focus,mode:"highest"})&&(w=D.unhangRange(e,w,{voids:!0})),w}};function _1(e,t){var{path:n,diff:r}=t;if(!D.hasPath(e,n))return!1;var a=ue.get(e,n);if(!me.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=M.next(n);if(!D.hasPath(e,i))return!1;var s=ue.get(e,i);return me.isText(s)&&s.text.startsWith(r.text)}function Tf(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 k1(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 F1(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 Sf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=k1(i,a),o=Math.min(i.length-s,a.length-s),l=F1(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 B1(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=Tf(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 Sf(e,{start:r,end:l,text:o})}function A1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Rs(e,t){var{path:n,offset:r}=t;if(!D.hasPath(e,n))return null;var a=ue.get(e,n);if(!me.isText(a))return null;var i=D.above(e,{match:o=>fe.isElement(o)&&D.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=D.next(e,{at:n,match:me.isText});if(!s||!M.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Ml(e,t){var n=Rs(e,t.anchor);if(!n)return null;if(K.isCollapsed(t))return{anchor:n,focus:n};var r=Rs(e,t.focus);return r?{anchor:n,focus:r}:null}function $s(e,t,n){var r=mt.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return M.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return we.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=we.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=we.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&M.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 Nl(e,t,n){var r=$s(e,t.anchor,n);if(!r)return null;if(K.isCollapsed(t))return{anchor:r,focus:r};var a=$s(e,t.focus,n);return a?{anchor:r,focus:a}:null}function T1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!M.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!M.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!M.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:M.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:M.transform(n,t,{affinity:"forward"})};case"merge_node":return M.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:M.transform(n,t)}:{diff:r,id:a,path:M.transform(n,t)}}var i=M.transform(n,t);return i?{diff:r,path:i,id:a}:null}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 ha(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){Bt(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}var S1=25,j1=200,O1=function(){},P1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function M1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var A=on.get(t);if(on.delete(t),A){var{selection:E}=t,j=Ml(t,A);j&&(!E||!K.equals(j,E))&&J.select(t,j)}},h=()=>{var A=sn.get(t);if(sn.delete(t),!!A){if(A.at){var E=we.isPoint(A.at)?Rs(t,A.at):Ml(t,A.at);if(!E)return;var j=D.range(t,E);(!t.selection||!K.equals(t.selection,j))&&J.select(t,E)}A.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!_()&&!k()){d();return}a||(a=!0,setTimeout(()=>a=!1)),k()&&(a="action");var A=t.selection&&D.rangeRef(t,t.selection,{affinity:"forward"});Yt.set(t,t.marks),O1("flush",sn.get(t),mt.get(t));for(var E=_(),j;j=(R=mt.get(t))===null||R===void 0?void 0:R[0];){var R,W,H=jt.get(t);H!==void 0&&(jt.delete(t),t.marks=H),H&&u===!1&&(u=null);var G=A1(j);(!t.selection||!K.equals(t.selection,G))&&J.select(t,G),j.diff.text?D.insertText(t,j.diff.text):D.deleteFragment(t),mt.set(t,(W=mt.get(t))===null||W===void 0?void 0:W.filter(L=>{var{id:ee}=L;return ee!==j.id})),_1(t,j)||(E=!1,sn.delete(t),Yt.delete(t),a="action",on.delete(t),n.cancel(),r.cancel(),A==null||A.unref())}var ne=A==null?void 0:A.unref();if(ne&&!on.get(t)&&(!t.selection||!K.equals(ne,t.selection))&&J.select(t,ne),k()){h();return}E&&n(),n.flush(),r.flush(),d();var C=Yt.get(t);Yt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},m=A=>{i&&clearTimeout(i),i=setTimeout(()=>{xn.set(t,!1),p()},S1)},g=A=>{xn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Ps.get(t);if(j){if(_()||E){j.style.display="none";return}j.style.removeProperty("display")}},b=(A,E)=>{var j,R=(j=mt.get(t))!==null&&j!==void 0?j:[];mt.set(t,R);var W=ue.leaf(t,A),H=R.findIndex(C=>M.equals(C.path,A));if(H<0){var G=Sf(W.text,E);G&&R.push({path:A,diff:E,id:l++}),f();return}var ne=B1(W.text,R[H].diff,E);if(!ne){R.splice(H,1),f();return}R[H]=ha(ha({},R[H]),{},{diff:ne})},v=function(E){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,on.delete(t),n.cancel(),r.cancel(),k()&&p(),sn.set(t,{at:j,run:E}),o=setTimeout(p)},x=A=>{var E;s&&(clearTimeout(s),s=null);var{inputType:j}=A,R=null,W=A.dataTransfer||A.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[H]=A.getTargetRanges();H&&(R=te.toSlateRange(t,H,{exactMatch:!1,suppressThrow:!0}));var G=te.getWindow(t),ne=G.getSelection();if(!R&&ne&&(H=ne,R=te.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),R=(E=R)!==null&&E!==void 0?E:t.selection,!!R){var C=!0;if(j.startsWith("delete")){if(K.isExpanded(R)){var[L,ee]=K.edges(R),B=ue.leaf(t,L.path);if(B.text.length===L.offset&&ee.offset===0){var T=D.next(t,{at:L.path,match:me.isText});T&&M.equals(T[1],ee.path)&&(R={anchor:ee,focus:ee})}}var O=j.endsWith("Backward")?"backward":"forward",[$,U]=K.edges(R),[re,X]=D.leaf(t,$.path),ae={text:"",start:$.offset,end:U.offset},he=mt.get(t),Q=he==null?void 0:he.find(ce=>M.equals(ce.path,X)),ve=Q?[Q.diff,ae]:[ae],pe=Tf(re.text,...ve);if(pe.length===0&&(C=!1),K.isExpanded(R)){if(C&&M.equals(R.anchor.path,R.focus.path)){var _e={path:R.anchor.path,offset:$.offset},Fe=D.range(t,_e,_e);return S(Fe),b(R.anchor.path,{text:"",end:U.offset,start:$.offset})}return v(()=>D.deleteFragment(t,{direction:O}),{at:R})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>D.deleteFragment(t),{at:R});case"deleteContent":case"deleteContentForward":{var{anchor:Se}=R;if(C&&K.isCollapsed(R)){var We=ue.leaf(t,Se.path);if(Se.offset<We.text.length)return b(Se.path,{text:"",start:Se.offset,end:Se.offset+1})}return v(()=>D.deleteForward(t),{at:R})}case"deleteContentBackward":{var Ue,{anchor:Be}=R,Te=Is(H)?H.isCollapsed:!!((Ue=H)!==null&&Ue!==void 0&&Ue.collapsed);return C&&Te&&K.isCollapsed(R)&&Be.offset>0?b(Be.path,{text:"",start:Be.offset-1,end:Be.offset}):v(()=>D.deleteBackward(t),{at:R})}case"deleteEntireSoftLine":return v(()=>{D.deleteBackward(t,{unit:"line"}),D.deleteForward(t,{unit:"line"})},{at:R});case"deleteHardLineBackward":return v(()=>D.deleteBackward(t,{unit:"block"}),{at:R});case"deleteSoftLineBackward":return v(()=>D.deleteBackward(t,{unit:"line"}),{at:R});case"deleteHardLineForward":return v(()=>D.deleteForward(t,{unit:"block"}),{at:R});case"deleteSoftLineForward":return v(()=>D.deleteForward(t,{unit:"line"}),{at:R});case"deleteWordBackward":return v(()=>D.deleteBackward(t,{unit:"word"}),{at:R});case"deleteWordForward":return v(()=>D.deleteForward(t,{unit:"word"}),{at:R});case"insertLineBreak":return v(()=>D.insertSoftBreak(t),{at:R});case"insertParagraph":return v(()=>D.insertBreak(t),{at:R});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(P1(W))return v(()=>te.insertData(t,W),{at:R});var De=W??"";if(jt.get(t)&&(De=De.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(De)&&(De=De.slice(0,-1)),De.includes(`
|
|
135
|
+
`))return v(()=>{var ce=De.split(`
|
|
136
|
+
`);ce.forEach((Ce,Ze)=>{Ce&&D.insertText(t,Ce),Ze!==ce.length-1&&D.insertSoftBreak(t)})},{at:R});if(M.equals(R.anchor.path,R.focus.path)){var[Re,ze]=K.edges(R),Y={start:Re.offset,end:ze.offset,text:De};if(De&&u&&j==="insertCompositionText"){var oe=u.start+u.text.search(/\S|$/),le=Y.start+Y.text.search(/\S|$/);le===oe+1&&Y.end===u.start+u.text.length?(Y.start-=1,u=null,z()):u=!1}else j==="insertText"?u===null?u=Y:u&&K.isCollapsed(R)&&u.end+u.text.length===Re.offset?u=ha(ha({},u),{},{text:u.text+De}):u=!1:u=!1;if(C){b(Re.path,Y);return}}return v(()=>D.insertText(t,De),{at:R})}}}},k=()=>!!sn.get(t),_=()=>{var A;return!!((A=mt.get(t))!==null&&A!==void 0&&A.length)},w=()=>k()||_(),F=()=>a,S=A=>{on.set(t,A),s&&(clearTimeout(s),s=null);var{selection:E}=t;if(A){var j=!E||!M.equals(E.anchor.path,A.anchor.path),R=!E||!M.equals(E.anchor.path.slice(0,-1),A.anchor.path.slice(0,-1));(j&&u||R)&&(u=!1),(j||_())&&(s=setTimeout(p,j1))}},q=()=>{(k()||!_())&&p()},N=A=>{_()||(f(!0),setTimeout(f))},z=()=>{k()||(o=setTimeout(p))},I=A=>{if(!(_()||k())&&A.some(j=>jo(t,j,A))){var E;(E=_f.get(t))===null||E===void 0||E()}};return{flush:p,scheduleFlush:z,hasPendingDiffs:_,hasPendingAction:k,hasPendingChanges:w,isFlushing:F,handleUserSelect:S,handleCompositionEnd:m,handleCompositionStart:g,handleDOMBeforeInput:x,handleKeyDown:N,handleDomMutations:I,handleInput:q}}function N1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var zr=ka?y.useLayoutEffect:y.useEffect;function I1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));zr(()=>{r.takeRecords()}),y.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 R1=["node"];function Rl(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 $1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Rl(Object(n),!0).forEach(function(r){Bt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var L1={subtree:!0,childList:!0,characterData:!0},z1=ct?e=>{var{node:t}=e,n=rr(e,R1);if(!ct)return null;var r=gn(),a=N1(),[i]=y.useState(()=>M1($1({editor:r},n)));return I1(t,i.handleDomMutations,L1),To.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,q1=["anchor","focus"],W1=["anchor","focus"],U1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),jf=(e,t)=>{var n=rr(e,q1),r=rr(t,W1);return e[ar]===t[ar]&&U1(n,r)},H1=(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(!K.equals(r,a)||!jf(r,a))return!1}return!0},V1=(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||!jf(r,a))return!1}return!0};function $l(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 K1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$l(Object(n),!0).forEach(function(r){Bt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$l(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=gn(),s=te.findPath(i,a),o=M.parent(s),l=!!n[kf];return i.isVoid(r)?y.createElement(qi,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&D.string(i,o)===""?y.createElement(qi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(qi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
|
|
137
|
+
`?y.createElement(Ll,{isTrailing:!0,text:n.text}):y.createElement(Ll,{text:n.text})},Ll=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
|
|
138
|
+
`:""),[i]=y.useState(a);return zr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(Y1,{ref:r},i)},Y1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),qi=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),y.createElement("span",K1({},a),!ct||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function zl(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 Of(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zl(Object(n),!0).forEach(function(r){Bt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G1=ct?300:0;function Q1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function ql(e){e.current&&(clearTimeout(e.current),e.current=null)}var J1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>y.createElement(eD,Of({},x))}=e,o=gn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),p=y.useRef(null),m=y.useCallback(x=>{if(Q1(l,x==null),x==null){var k;Ps.delete(o),(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,null)}else{if(Ps.set(o,x),!l.current){var _=window.ResizeObserver||e1;l.current=new _(()=>{var w;(w=t.onPlaceholderResize)===null||w===void 0||w.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=y.createElement(Z1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[ar];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},G1)):(ql(p),h(!1)),()=>ql(p)),[f,h]),f&&d){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:xr?"inherit":void 0},contentEditable:!1,ref:m}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},X1=y.memo(J1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&me.equals(t.leaf,e.leaf)&&t.leaf[ar]===e.leaf[ar]),eD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Of({},t),n)},tD=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=gn(),l=y.useRef(null),u=me.decorations(s,t),d=te.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(y.createElement(X1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=li.get(o);f?(b==null||b.set(d,f),kn.set(s,f),Lr.set(f,s)):(b==null||b.delete(d),kn.delete(s),l.current&&Lr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},h)},Pf=y.memo(tD,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&V1(t.decorations,e.decorations));function Wl(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 Ls(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wl(Object(n),!0).forEach(function(r){Bt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nD=e=>{var{decorations:t,element:n,renderElement:r=x=>y.createElement(aD,Ls({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=gn(),l=oD(),u=o.isInline(n),d=te.findKey(o,n),h=y.useCallback(x=>{var k=li.get(o);x?(k==null||k.set(d,x),kn.set(n,x),Lr.set(x,n)):(k==null||k.delete(d),kn.delete(n))},[o,d,n]),p=Nf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&D.hasInlines(o,n)){var g=ue.string(n),f=of(g);f==="rtl"&&(m.dir=f)}if(D.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var b=u?"span":"div",[[v]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Pf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Bo.set(v,0),Ao.set(v,n)}return r({attributes:m,children:p,element:n})},rD=y.memo(nD,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&H1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&K.equals(e.selection,t.selection))),aD=e=>{var{attributes:t,children:n,element:r}=e,a=gn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Ls(Ls({},t),{},{style:{position:"relative"}}),n)},Mf=y.createContext(()=>[]),iD=()=>y.useContext(Mf),sD=y.createContext(!1),Nf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=iD(),l=gn(),u=te.findPath(l,n),d=[],h=fe.isElement(n)&&!l.isInline(n)&&D.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),g=n.children[p],f=te.findKey(l,g),b=D.range(l,m),v=s&&K.intersection(b,s),x=o([g,m]);for(var k of t){var _=K.intersection(k,b);_&&x.push(_)}fe.isElement(g)?d.push(y.createElement(sD.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(rD,{decorations:x,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(y.createElement(Pf,{decorations:x,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Bo.set(g,p),Ao.set(g,n)}return d},If=y.createContext(!1),oD=()=>y.useContext(If),Rf=y.createContext(null),Nn=()=>{var e=y.useContext(Rf);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function uD(){var e=gn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=te.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var lD=3,cD={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"},dD={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"},fD={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ve=e=>{var t=cD[e],n=dD[e],r=fD[e],a=t&&zi(t),i=n&&zi(n),s=r&&zi(r);return o=>!!(a&&a(o)||Pl&&i&&i(o)||!Pl&&s&&s(o))},Ke={isBold:Ve("bold"),isCompose:Ve("compose"),isMoveBackward:Ve("moveBackward"),isMoveForward:Ve("moveForward"),isDeleteBackward:Ve("deleteBackward"),isDeleteForward:Ve("deleteForward"),isDeleteLineBackward:Ve("deleteLineBackward"),isDeleteLineForward:Ve("deleteLineForward"),isDeleteWordBackward:Ve("deleteWordBackward"),isDeleteWordForward:Ve("deleteWordForward"),isExtendBackward:Ve("extendBackward"),isExtendForward:Ve("extendForward"),isExtendLineBackward:Ve("extendLineBackward"),isExtendLineForward:Ve("extendLineForward"),isItalic:Ve("italic"),isMoveLineBackward:Ve("moveLineBackward"),isMoveLineForward:Ve("moveLineForward"),isMoveWordBackward:Ve("moveWordBackward"),isMoveWordForward:Ve("moveWordForward"),isRedo:Ve("redo"),isSoftBreak:Ve("insertSoftBreak"),isSplitBlock:Ve("splitBlock"),isTransposeCharacter:Ve("transposeCharacter"),isUndo:Ve("undo")},hD=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>jo(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}},mD={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class $f extends y.Component{constructor(){super(...arguments),Bt(this,"context",null),Bt(this,"manager",null),Bt(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,mD)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=hD(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}}Bt($f,"contextType",Fo);var pD=ct?$f:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},gD=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],vD=["text"];function Ul(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?Ul(Object(n),!0).forEach(function(r){Bt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ul(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var bD=e=>y.createElement(y.Fragment,null,Nf(e)),yD=e=>{var t=y.useCallback(T=>y.createElement(DD,Rt({},T)),[]),{autoFocus:n,decorate:r=CD,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=xD,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,g=rr(e,gD),f=Nn(),[b,v]=y.useState(!1),x=y.useRef(null),k=y.useRef([]),[_,w]=y.useState(),{onUserInput:F,receivedUserInput:S}=uD(),[,q]=y.useReducer(T=>T+1,0);_f.set(f,q),Ms.set(f,s);var N=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var z=y.useRef(),I=y.useMemo(()=>Ty(()=>{var T=z.current;if((ct||!te.isComposing(f))&&(!N.isUpdatingSelection||T!=null&&T.isFlushing())&&!N.isDraggingInternally){var O=te.findDocumentOrShadowRoot(f),{activeElement:$}=O,U=te.toDOMNode(f,f),re=O.getSelection();if($===U?(N.latestElement=$,cn.set(f,!0)):cn.delete(f),!re)return J.deselect(f);var{anchorNode:X,focusNode:ae}=re,he=te.hasEditableTarget(f,X)||te.isTargetInsideNonReadonlyVoid(f,X),Q=te.hasEditableTarget(f,ae)||te.isTargetInsideNonReadonlyVoid(f,ae);if(he&&Q){var ve=te.toSlateRange(f,re,{exactMatch:!1,suppressThrow:!0});ve&&(!te.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?J.select(f,ve):T==null||T.handleUserSelect(ve))}s&&(!he||!Q)&&J.deselect(f)}},100),[f,s,N]),A=y.useMemo(()=>Ey(I,0),[I]);z.current=z1({node:x,onDOMSelectionChange:I,scheduleOnDOMSelectionChange:A}),zr(()=>{var T,O,$;x.current&&($=So(x.current))?(Ef.set(f,$),Fa.set(f,x.current),kn.set(f,x.current),Lr.set(x.current,f)):kn.delete(f);var{selection:U}=f,re=te.findDocumentOrShadowRoot(f),X=re.getSelection();if(!(!X||!te.isFocused(f)||(T=z.current)!==null&&T!==void 0&&T.hasPendingAction())){var ae=pe=>{var _e=X.type!=="None";if(!(!U&&!_e)){var Fe=X.focusNode,Se;if(Zn&&X.rangeCount>1){var We=X.getRangeAt(0),Ue=X.getRangeAt(X.rangeCount-1);We.startContainer===Fe?Se=Ue.endContainer:Se=We.startContainer}else Se=X.anchorNode;var Be=Fa.get(f),Te=!1;if(Be.contains(Se)&&Be.contains(Fe)&&(Te=!0),_e&&Te&&U&&!pe){var De=te.toSlateRange(f,X,{exactMatch:!0,suppressThrow:!0});if(De&&K.equals(De,U)){var Re;if(!N.hasMarkPlaceholder||(Re=Se)!==null&&Re!==void 0&&(Re=Re.parentElement)!==null&&Re!==void 0&&Re.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!te.hasRange(f,U)){f.selection=te.toSlateRange(f,X,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var ze=U&&te.toDOMRange(f,U);return ze?(te.isComposing(f)&&!ct?X.collapseToEnd():K.isBackward(U)?X.setBaseAndExtent(ze.endContainer,ze.endOffset,ze.startContainer,ze.startOffset):X.setBaseAndExtent(ze.startContainer,ze.startOffset,ze.endContainer,ze.endOffset),d(f,ze)):X.removeAllRanges(),ze}};X.rangeCount<=1&&ae();var he=((O=z.current)===null||O===void 0?void 0:O.isFlushing())==="action";if(!ct||!he){setTimeout(()=>{N.isUpdatingSelection=!1});return}var Q=null,ve=requestAnimationFrame(()=>{if(he){var pe=_e=>{try{var Fe=te.toDOMNode(f,f);Fe.focus(),ae(_e)}catch{}};pe(),Q=setTimeout(()=>{pe(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ve),Q&&clearTimeout(Q)}}});var E=y.useCallback(T=>{if(F(),!s&&te.hasEditableTarget(f,T.target)&&!wD(T,a)){var O;if(z.current)return z.current.handleDOMBeforeInput(T);A.flush(),I.flush();var{selection:$}=f,{inputType:U}=T,re=T.dataTransfer||T.data||void 0,X=U==="insertCompositionText"||U==="deleteCompositionText";if(X&&te.isComposing(f))return;var ae=!1;if(U==="insertText"&&$&&K.isCollapsed($)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&$.anchor.offset!==0){var he,Q;ae=!0,f.marks&&(ae=!1);var{anchor:ve}=$,[pe,_e]=te.toDOMPoint(f,ve),Fe=(he=pe.parentElement)===null||he===void 0?void 0:he.closest("a"),Se=te.getWindow(f);if(ae&&Fe&&te.hasDOMNode(f,Fe)){var We,Ue=Se==null?void 0:Se.document.createTreeWalker(Fe,NodeFilter.SHOW_TEXT).lastChild();Ue===pe&&((We=Ue.textContent)===null||We===void 0?void 0:We.length)===_e&&(ae=!1)}if(ae&&pe.parentElement&&(Se==null||(Q=Se.getComputedStyle(pe.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Be=D.above(f,{at:ve.path,match:oe=>fe.isElement(oe)&&D.isBlock(f,oe)});Be&&ue.string(Be[0]).includes(" ")&&(ae=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Te]=T.getTargetRanges();if(Te){var De=te.toSlateRange(f,Te,{exactMatch:!1,suppressThrow:!1});if(!$||!K.equals($,De)){ae=!1;var Re=!X&&f.selection&&D.rangeRef(f,f.selection);J.select(f,De),Re&&kr.set(f,Re)}}}if(X)return;if(ae||T.preventDefault(),$&&K.isExpanded($)&&U.startsWith("delete")){var ze=U.endsWith("Backward")?"backward":"forward";D.deleteFragment(f,{direction:ze});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{D.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{D.deleteForward(f);break}case"deleteContentBackward":{D.deleteBackward(f);break}case"deleteEntireSoftLine":{D.deleteBackward(f,{unit:"line"}),D.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{D.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{D.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{D.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{D.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{D.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{D.deleteForward(f,{unit:"word"});break}case"insertLineBreak":D.insertSoftBreak(f);break;case"insertParagraph":{D.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&te.isComposing(f)&&(v(!1),xn.set(f,!1)),(re==null?void 0:re.constructor.name)==="DataTransfer"?te.insertData(f,re):typeof re=="string"&&(ae?k.current.push(()=>D.insertText(f,re)):D.insertText(f,re));break}}var Y=(O=kr.get(f))===null||O===void 0?void 0:O.unref();kr.delete(f),Y&&(!f.selection||!K.equals(f.selection,Y))&&J.select(f,Y)}},[f,I,F,a,s,A]),j=y.useCallback(T=>{T==null?(I.cancel(),A.cancel(),Fa.delete(f),kn.delete(f),x.current&&rn&&x.current.removeEventListener("beforeinput",E)):rn&&T.addEventListener("beforeinput",E),x.current=T},[I,A,f,E]);zr(()=>{var T=te.getWindow(f);return T.document.addEventListener("selectionchange",A),()=>{T.document.removeEventListener("selectionchange",A)}},[A]);var R=r([f,[]]),W=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,H=y.useCallback(T=>{if(T&&W){var O;w((O=T.getBoundingClientRect())===null||O===void 0?void 0:O.height)}else w(void 0)},[W]);if(W){var G=D.start(f,[]);R.push({[ar]:!0,placeholder:i,onPlaceholderResize:H,anchor:G,focus:G})}var{marks:ne}=f;if(N.hasMarkPlaceholder=!1,f.selection&&K.isCollapsed(f.selection)&&ne){var{anchor:C}=f.selection,L=ue.leaf(f,C.path),ee=rr(L,vD);if(!me.equals(L,ne,{loose:!0})){N.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(ee).map(T=>[T,null]));R.push(Rt(Rt(Rt({[kf]:!0},B),ne),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:O}=T,$=ue.leaf(f,O.path);if(ne&&!me.equals($,ne,{loose:!0})){jt.set(f,ne);return}}jt.delete(f)})}),y.createElement(If.Provider,{value:s},y.createElement(Mf.Provider,{value:r},y.createElement(pD,{node:x,receivedUserInput:S},y.createElement(p,Rt(Rt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:rn||!ka?g.spellCheck:!1,autoCorrect:rn||!ka?g.autoCorrect:"false",autoCapitalize:rn||!ka?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Rt(Rt({},m?{}:Rt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},_?{minHeight:_}:{})),h),onBeforeInput:y.useCallback(T=>{if(!rn&&!s&&!ut(T,g.onBeforeInput)&&te.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!te.isComposing(f))){var O=T.data;D.insertText(f,O)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(T=>{if(!ut(T,g.onInput)){if(z.current){z.current.handleInput();return}for(var O of k.current)O();k.current=[]}},[g.onInput]),onBlur:y.useCallback(T=>{if(!(s||N.isUpdatingSelection||!te.hasSelectableTarget(f,T.target)||ut(T,g.onBlur))){var O=te.findDocumentOrShadowRoot(f);if(N.latestElement!==O.activeElement){var{relatedTarget:$}=T,U=te.toDOMNode(f,f);if($!==U&&!(Ft($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&dn($)&&te.hasDOMNode(f,$)){var re=te.toSlateNode(f,$);if(fe.isElement(re)&&!f.isVoid(re))return}if(xr){var X=O.getSelection();X==null||X.removeAllRanges()}cn.delete(f)}}}},[s,N.isUpdatingSelection,N.latestElement,f,g.onBlur]),onClick:y.useCallback(T=>{if(te.hasTarget(f,T.target)&&!ut(T,g.onClick)&&dn(T.target)){var O=te.toSlateNode(f,T.target),$=te.findPath(f,O);if(!D.hasPath(f,$)||ue.get(f,$)!==O)return;if(T.detail===lD&&$.length>=1){var U=$;if(!(fe.isElement(O)&&D.isBlock(f,O))){var re,X=D.above(f,{match:Fe=>fe.isElement(Fe)&&D.isBlock(f,Fe),at:$});U=(re=X==null?void 0:X[1])!==null&&re!==void 0?re:$.slice(0,1)}var ae=D.range(f,U);J.select(f,ae);return}if(s)return;var he=D.start(f,$),Q=D.end(f,$),ve=D.void(f,{at:he}),pe=D.void(f,{at:Q});if(ve&&pe&&M.equals(ve[1],pe[1])){var _e=D.range(f,he);J.select(f,_e)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(T=>{if(te.hasSelectableTarget(f,T.target)){var O;if(te.isComposing(f)&&Promise.resolve().then(()=>{v(!1),xn.set(f,!1)}),(O=z.current)===null||O===void 0||O.handleCompositionEnd(T),ut(T,g.onCompositionEnd)||ct)return;if(!xr&&!f1&&!u1&&!m1&&!h1&&T.data){var $=jt.get(f);jt.delete(f),$!==void 0&&(Yt.set(f,f.marks),f.marks=$),D.insertText(f,T.data);var U=Yt.get(f);Yt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(T=>{te.hasSelectableTarget(f,T.target)&&!ut(T,g.onCompositionUpdate)&&(te.isComposing(f)||(v(!0),xn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(T=>{if(te.hasSelectableTarget(f,T.target)){var O;if((O=z.current)===null||O===void 0||O.handleCompositionStart(T),ut(T,g.onCompositionStart)||ct)return;v(!0);var{selection:$}=f;if($&&K.isExpanded($)){D.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(T=>{te.hasSelectableTarget(f,T.target)&&!ut(T,g.onCopy)&&!Hl(T)&&(T.preventDefault(),te.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(T=>{if(!s&&te.hasSelectableTarget(f,T.target)&&!ut(T,g.onCut)&&!Hl(T)){T.preventDefault(),te.setFragmentData(f,T.clipboardData,"cut");var{selection:O}=f;if(O)if(K.isExpanded(O))D.deleteFragment(f);else{var $=ue.parent(f,O.anchor.path);D.isVoid(f,$)&&J.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(T=>{if(te.hasTarget(f,T.target)&&!ut(T,g.onDragOver)){var O=te.toSlateNode(f,T.target);fe.isElement(O)&&D.isVoid(f,O)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(T=>{if(!s&&te.hasTarget(f,T.target)&&!ut(T,g.onDragStart)){var O=te.toSlateNode(f,T.target),$=te.findPath(f,O),U=fe.isElement(O)&&D.isVoid(f,O)||D.void(f,{at:$,voids:!0});if(U){var re=D.range(f,$);J.select(f,re)}N.isDraggingInternally=!0,te.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,N]),onDrop:y.useCallback(T=>{if(!s&&te.hasTarget(f,T.target)&&!ut(T,g.onDrop)){T.preventDefault();var O=f.selection,$=te.findEventRange(f,T),U=T.dataTransfer;J.select(f,$),N.isDraggingInternally&&O&&!K.equals(O,$)&&!D.void(f,{at:$,voids:!0})&&J.delete(f,{at:O}),te.insertData(f,U),te.isFocused(f)||te.focus(f)}N.isDraggingInternally=!1},[s,f,g.onDrop,N]),onDragEnd:y.useCallback(T=>{!s&&N.isDraggingInternally&&g.onDragEnd&&te.hasTarget(f,T.target)&&g.onDragEnd(T),N.isDraggingInternally=!1},[s,N,g,f]),onFocus:y.useCallback(T=>{if(!s&&!N.isUpdatingSelection&&te.hasEditableTarget(f,T.target)&&!ut(T,g.onFocus)){var O=te.toDOMNode(f,f),$=te.findDocumentOrShadowRoot(f);if(N.latestElement=$.activeElement,Zn&&T.target!==O){O.focus();return}cn.set(f,!0)}},[s,N,f,g.onFocus]),onKeyDown:y.useCallback(T=>{if(!s&&te.hasEditableTarget(f,T.target)){var O;(O=z.current)===null||O===void 0||O.handleKeyDown(T);var{nativeEvent:$}=T;if(te.isComposing(f)&&$.isComposing===!1&&(xn.set(f,!1),v(!1)),ut(T,g.onKeyDown)||te.isComposing(f))return;var{selection:U}=f,re=f.children[U!==null?U.focus.path[0]:0],X=of(ue.string(re))==="rtl";if(Ke.isRedo($)){T.preventDefault();var ae=f;typeof ae.redo=="function"&&ae.redo();return}if(Ke.isUndo($)){T.preventDefault();var he=f;typeof he.undo=="function"&&he.undo();return}if(Ke.isMoveLineBackward($)){T.preventDefault(),J.move(f,{unit:"line",reverse:!0});return}if(Ke.isMoveLineForward($)){T.preventDefault(),J.move(f,{unit:"line"});return}if(Ke.isExtendLineBackward($)){T.preventDefault(),J.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ke.isExtendLineForward($)){T.preventDefault(),J.move(f,{unit:"line",edge:"focus"});return}if(Ke.isMoveBackward($)){T.preventDefault(),U&&K.isCollapsed(U)?J.move(f,{reverse:!X}):J.collapse(f,{edge:X?"end":"start"});return}if(Ke.isMoveForward($)){T.preventDefault(),U&&K.isCollapsed(U)?J.move(f,{reverse:X}):J.collapse(f,{edge:X?"start":"end"});return}if(Ke.isMoveWordBackward($)){T.preventDefault(),U&&K.isExpanded(U)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:!X});return}if(Ke.isMoveWordForward($)){T.preventDefault(),U&&K.isExpanded(U)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:X});return}if(rn){if((wf||xr)&&U&&(Ke.isDeleteBackward($)||Ke.isDeleteForward($))&&K.isCollapsed(U)){var Q=ue.parent(f,U.anchor.path);if(fe.isElement(Q)&&D.isVoid(f,Q)&&(D.isInline(f,Q)||D.isBlock(f,Q))){T.preventDefault(),D.deleteBackward(f,{unit:"block"});return}}}else{if(Ke.isBold($)||Ke.isItalic($)||Ke.isTransposeCharacter($)){T.preventDefault();return}if(Ke.isSoftBreak($)){T.preventDefault(),D.insertSoftBreak(f);return}if(Ke.isSplitBlock($)){T.preventDefault(),D.insertBreak(f);return}if(Ke.isDeleteBackward($)){T.preventDefault(),U&&K.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f);return}if(Ke.isDeleteForward($)){T.preventDefault(),U&&K.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f);return}if(Ke.isDeleteLineBackward($)){T.preventDefault(),U&&K.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"line"});return}if(Ke.isDeleteLineForward($)){T.preventDefault(),U&&K.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"line"});return}if(Ke.isDeleteWordBackward($)){T.preventDefault(),U&&K.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"word"});return}if(Ke.isDeleteWordForward($)){T.preventDefault(),U&&K.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(T=>{!s&&te.hasEditableTarget(f,T.target)&&!ut(T,g.onPaste)&&(!rn||v1(T.nativeEvent)||xr)&&(T.preventDefault(),te.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),y.createElement(bD,{decorations:R,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},DD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Rt({},t),n,ct&&y.createElement("br",null))},CD=()=>[],xD=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&K.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Oy(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ut=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Hl=e=>dn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),wD=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},ED=y.createContext(!1),_D=y.createContext({});function kD(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var FD=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],BD=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=rr(e,FD),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(et.stringify(s)));if(!D.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(et.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=kD(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.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})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(Ns.set(t,p),()=>{Ns.set(t,()=>{})}),[t,p]);var[m,g]=y.useState(te.isFocused(t));return y.useEffect(()=>{g(te.isFocused(t))},[t]),zr(()=>{var f=()=>g(te.isFocused(t));return xf>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),y.createElement(_D.Provider,{value:d},y.createElement(Rf.Provider,{value:l},y.createElement(Fo.Provider,{value:l.editor},y.createElement(ED.Provider,{value:m},n))))},Vl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Kl=(e,t,n)=>{var r=te.toDOMRange(e,t).getBoundingClientRect(),a=te.toDOMRange(e,n).getBoundingClientRect();return Vl(r,a)&&Vl(a,r)},AD=(e,t)=>{var n=D.range(e,K.end(t)),r=Array.from(D.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Kl(e,D.range(e,r[a]),n))return D.range(e,r[a],n);if(r.length<2)return D.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Kl(e,D.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return D.range(e,r[i],n)};function Zl(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 Yl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zl(Object(n),!0).forEach(function(r){Bt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var TD=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 li.set(r,new WeakMap),r.addMark=(u,d)=>{var h,p;(h=To.get(r))===null||h===void 0||h(),!jt.get(r)&&(p=mt.get(r))!==null&&p!==void 0&&p.length&&jt.set(r,null),Yt.delete(r),o(u,d)},r.removeMark=u=>{var d;!jt.get(r)&&(d=mt.get(r))!==null&&d!==void 0&&d.length&&jt.set(r,null),Yt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&K.isCollapsed(r.selection)){var d=D.above(r,{match:g=>fe.isElement(g)&&D.isBlock(r,g),at:r.selection});if(d){var[,h]=d,p=D.range(r,h,r.selection.anchor),m=AD(r,p);K.isCollapsed(m)||J.delete(r,{at:m})}}},r.apply=u=>{var d=[],h=[],p=mt.get(r);if(p!=null&&p.length){var m=p.map(j=>T1(j,u)).filter(Boolean);mt.set(r,m)}var g=on.get(r);g&&on.set(r,Nl(r,g,u));var f=sn.get(r);if(f!=null&&f.at){var b=we.isPoint(f==null?void 0:f.at)?$s(r,f.at,u):Nl(r,f.at,u);sn.set(r,b?Yl(Yl({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...zn(r,u.path));break}case"set_selection":{var v;(v=kr.get(r))===null||v===void 0||v.unref(),kr.delete(r);break}case"insert_node":case"remove_node":{d.push(...zn(r,M.parent(u.path)));break}case"merge_node":{var x=M.previous(u.path);d.push(...zn(r,x));break}case"move_node":{var k=M.common(M.parent(u.path),M.parent(u.newPath));d.push(...zn(r,k));var _;M.isBefore(u.path,u.newPath)?(d.push(...zn(r,M.parent(u.path))),_=u.newPath):(d.push(...zn(r,M.parent(u.newPath))),_=u.path);var w=ue.get(t,M.parent(_)),F=te.findKey(r,w),S=D.pathRef(r,M.parent(_));h.push([S,F]);break}}a(u);for(var[q,N]of d){var[z]=D.node(r,q);Wa.set(z,N)}for(var[I,A]of h)if(I.current){var[E]=D.node(r,I.current);Wa.set(E,A)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,p]=K.edges(d),m=D.void(r,{at:h.path}),g=D.void(r,{at:p.path});if(!(K.isCollapsed(d)&&!m)){var f=te.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(v=z)}),g){var[x]=g,k=f.cloneRange(),_=te.toDOMNode(r,x);k.setEndAfter(_),b=k.cloneContents()}if(m&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var I=z.getAttribute("data-slate-zero-width")==="n";z.textContent=I?`
|
|
139
|
+
`:""}),Ff(v)){var w=v.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(v),b.appendChild(w),v=w}var F=r.getFragment(),S=JSON.stringify(F),q=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",q),u.setData("application/".concat(n),q);var N=b.ownerDocument.createElement("div");return N.appendChild(b),N.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",Af(N)),b.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||x1(u);if(d){var h=decodeURIComponent(window.atob(d)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&J.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=xf<18?Nc.unstable_batchedUpdates:h=>h();d(()=>{var h=Ns.get(r);h&&h(u),i(u)})},r},zn=(e,t)=>{var n=[];for(var[r,a]of D.levels(e,{at:t})){var i=te.findKey(e,r);n.push([a,i])}return n};const SD={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},onMention:()=>{},reportError:e=>{console.error(e)}},nn=y.createContext(SD);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(Z||{}),zt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(zt||{});const jD=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return c.jsx("a",{...e,children:t});case Z.li:return c.jsx("li",{...e,children:t});case Z.mention:const a=r;return a!=null&&a.name&&a.name===Sr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ie.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Z.ol:return c.jsx("ol",{...e,children:t});case Z.ul:return c.jsx("ul",{...e,children:t});case Z.span:return c.jsx("span",{...e,children:t});case Z.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},OD=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=c.jsx("strong",{children:t})),r[Z.italic]&&(t=c.jsx("em",{children:t})),r[Z.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})},zs="MENTION: ",Lf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Gl={"mention-popover":35,default:-52},Wi=16,zf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(nn),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var m,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=k=>{if(!D.hasPath(e,k.path))return!1;const _=ue.get(e,k.path);return D.isEditor(_)||fe.isElement(_)?k.offset<=_.children.length:me.isText(_)?k.offset<=_.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=te.toDOMRange(e,f||Lf).getBoundingClientRect();const x=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((x==null?void 0:x.width)||0)/Wi}rem`),d=(x==null?void 0:x.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const h=Gl[t]||Gl.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Wi}rem`,l.style.left=`${d/Wi}rem`},o),r},PD=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=D.nodes(e,{at:r,match:i=>i.type===Z.link});if(a){const i=a[0],s=ed(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var lt=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e))(lt||{});const Yn={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[zt.emphasis]:Z.italic,[zt.strong]:Z.bold,[zt.delete]:Z.strikethrough,[zt.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function Ql(e){if(e)throw e}var Ba=Object.prototype.hasOwnProperty,qf=Object.prototype.toString,Jl=Object.defineProperty,Xl=Object.getOwnPropertyDescriptor,ec=function(t){return typeof Array.isArray=="function"?Array.isArray(t):qf.call(t)==="[object Array]"},tc=function(t){if(!t||qf.call(t)!=="[object Object]")return!1;var n=Ba.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ba.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Ba.call(t,a)},nc=function(t,n){Jl&&n.name==="__proto__"?Jl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},rc=function(t,n){if(n==="__proto__")if(Ba.call(t,n)){if(Xl)return Xl(t,n).value}else return;return t[n]},MD=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=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=rc(o,n),a=rc(t,n),o!==a&&(d&&a&&(tc(a)||(i=ec(a)))?(i?(i=!1,s=r&&ec(r)?r:[]):s=r&&tc(r)?r:{},nc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&nc(o,{name:n,newValue:a}));return o};const Ui=On(MD);function qs(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 ND(){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 d=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,d?ID(d,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 ID(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 d=u;if(o&&n)throw d;return a(d)}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 Fr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ac(e.position):"start"in e||"end"in e?ac(e):"line"in e||"column"in e?Ws(e):""}function Ws(e){return ic(e&&e.line)+":"+ic(e&&e.column)}function ac(e){return Ws(e&&e.start)+"-"+Ws(e&&e.end)}function ic(e){return e&&typeof e=="number"?e:1}class vt 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=Fr(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}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const $t={basename:RD,dirname:$D,extname:LD,join:zD,sep:"/"};function RD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vr(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 $D(e){if(Vr(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 LD(e){Vr(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 zD(...e){let t=-1,n;for(;++t<e.length;)Vr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":qD(n)}function qD(e){Vr(e);const t=e.codePointAt(0)===47;let n=WD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function WD(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 Vr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const UD={cwd:HD};function HD(){return"/"}function Us(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function VD(e){if(typeof e=="string")e=new URL(e);else if(!Us(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 KD(e)}function KD(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 Hi=["history","path","basename","stem","extname","dirname"];class ZD{constructor(t){let n;t?Us(t)?n={path:t}:typeof t=="string"||YD(t)?n={value:t}:n=t:n={},this.cwd=UD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Hi.length;){const i=Hi[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)Hi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?$t.basename(this.path):void 0}set basename(t){Ki(t,"basename"),Vi(t,"basename"),this.path=$t.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?$t.dirname(this.path):void 0}set dirname(t){sc(this.basename,"dirname"),this.path=$t.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?$t.extname(this.path):void 0}set extname(t){if(Vi(t,"extname"),sc(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=$t.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Us(t)&&(t=VD(t)),Ki(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?$t.basename(this.path,this.extname):void 0}set stem(t){Ki(t,"stem"),Vi(t,"stem"),this.path=$t.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 vt(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 Vi(e,t){if(e&&e.includes($t.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+$t.sep+"`")}function Ki(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function YD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const GD=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},QD={}.hasOwnProperty;class Oo extends GD{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=ND()}copy(){const t=new Oo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ui(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Gi("data",this.frozen),this.namespace[t]=n,this):QD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gi("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=ma(t),r=this.parser||this.Parser;return Zi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Zi("process",this.parser||this.Parser),Yi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ma(t),l=r.parse(o);r.run(l,o,function(d,h,p){if(d||!h||!p)return u(d);const m=h,g=r.stringify(m,p);eC(g)?p.value=g:p.result=g,u(d,p)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Zi("processSync",this.parser||this.Parser),Yi("processSync",this.compiler||this.Compiler),this.process(t,a),uc("processSync","process",n),r;function a(i,s){n=!0,Ql(i),r=s}}run(t,n,r){oc(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=ma(n);a.run(t,l,u);function u(d,h,p){const m=h||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),uc("runSync","run",r),a;function i(s,o){Ql(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ma(n),a=this.compiler||this.Compiler;return Yi("stringify",a),oc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Gi("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[d,...h]=u;l(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Ui(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...g]=d;const f=r[p][1];qs(f)&&qs(m)&&(m=Ui(!0,f,m)),r[p]=[u,m,...g]}}}}const JD=new Oo().freeze();function Zi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gi(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 oc(e){if(!qs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function uc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ma(e){return XD(e)?e:new ZD(e)}function XD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function eC(e){return typeof e=="string"||tC(e)}function tC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nC={};function rC(e,t){const n=t||nC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Wf(e,r,a)}function Wf(e,t,n){if(aC(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 lc(e.children,t,n)}return Array.isArray(e)?lc(e,t,n):""}function lc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Wf(e[a],t,n);return r.join("")}function aC(e){return!!(e&&typeof e=="object")}const cc=document.createElement("i");function Po(e){const t="&"+e+";";cc.innerHTML=t;const n=cc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xt(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 kt(e,t){return e.length>0?(Xt(e,e.length,0,t),e):t}const dc={}.hasOwnProperty;function iC(e){const t={};let n=-1;for(;++n<e.length;)sC(t,e[n]);return t}function sC(e,t){let n;for(n in t){const a=(dc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){dc.call(a,s)||(a[s]=[]);const o=i[s];oC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function oC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Xt(e,0,0,r)}function Uf(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 Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Lt=vn(/[A-Za-z]/),Ot=vn(/[\dA-Za-z]/),uC=vn(/[#-'*+\--9=?A-Z^-~]/);function Hs(e){return e!==null&&(e<32||e===127)}const Vs=vn(/\d/),lC=vn(/[\dA-Fa-f]/),cC=vn(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function gt(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const dC=vn(/\p{P}|\p{S}/u),fC=vn(/\s/);function vn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Le(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Oe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Oe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const hC={tokenize:mC};function mC(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"),Le(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 be(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const pC={tokenize:gC},fc={tokenize:vC};function gC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(k){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,l,u)(k)}return u(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const _=t.events.length;let w=_,F;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){F=t.events[w][1].end;break}v(r);let S=_;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},F),S++;return Xt(t.events,w+1,0,t.events.slice(_)),t.events.length=S,u(k)}return o(k)}function u(k){if(r===n.length){if(!a)return p(k);if(a.currentConstruct&&a.currentConstruct.concrete)return g(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(fc,d,h)(k)}function d(k){return a&&x(),v(r),p(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(k)}function p(k){return t.containerState={},e.attempt(fc,m,g)(k)}function m(k){return r++,n.push([t.currentConstruct,t.containerState]),p(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}),f(k)}function f(k){if(k===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(k);return}return be(k)?(e.consume(k),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(k),f)}function b(k,_){const w=t.sliceStream(k);if(_&&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 F=a.events.length;for(;F--;)if(a.events[F][1].start.offset<s&&(!a.events[F][1].end||a.events[F][1].end.offset>s))return;const S=t.events.length;let q=S,N,z;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(N){z=t.events[q][1].end;break}N=!0}for(v(r),F=S;F<t.events.length;)t.events[F][1].end=Object.assign({},z),F++;Xt(t.events,q+1,0,t.events.slice(S)),t.events.length=F}}function v(k){let _=n.length;for(;_-- >k;){const w=n[_];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 vC(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hc(e){if(e===null||gt(e)||fC(e))return 1;if(dC(e))return 2}function Mo(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 Ks={name:"attention",tokenize:yC,resolveAll:bC};function bC(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);mc(h,-l),mc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end: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=kt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=kt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=kt(u,Mo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=kt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=kt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Xt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function yC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=hc(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"),d=hc(l),h=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(l)}}function mc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const DC={name:"autolink",tokenize:CC};function CC(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Lt(m)?(e.consume(m),s):m===64?n(m):u(m)}function s(m){return m===43||m===45||m===46||Ot(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||Ot(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Hs(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):uC(m)?(e.consume(m),u):n(m)}function d(m){return Ot(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||Ot(m))&&r++<63){const g=m===45?p:h;return e.consume(m),g}return n(m)}}const ci={tokenize:xC,partial:!0};function xC(e,t,n){return r;function r(i){return Oe(i)?Le(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||be(i)?t(i):n(i)}}const Hf={name:"blockQuote",tokenize:wC,continuation:{tokenize:EC},exit:_C};function wC(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 Oe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function EC(e,t,n){const r=this;return a;function a(s){return Oe(s)?Le(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Hf,t,n)(s)}}function _C(e){e.exit("blockQuote")}const Vf={name:"characterEscape",tokenize:kC};function kC(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 cC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Kf={name:"characterReference",tokenize:FC};function FC(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Ot,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=lC,d):(e.enter("characterReferenceValue"),i=7,s=Vs,d(h))}function d(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===Ot&&!Po(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const pc={tokenize:AC,partial:!0},gc={name:"codeFenced",tokenize:BC,concrete:!0};function BC(e,t,n){const r=this,a={tokenize:w,partial:!0};let i=0,s=0,o;return l;function l(F){return u(F)}function u(F){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(F)}function d(F){return F===o?(s++,e.consume(F),d):s<3?n(F):(e.exit("codeFencedFenceSequence"),Oe(F)?Le(e,h,"whitespace")(F):h(F))}function h(F){return F===null||be(F)?(e.exit("codeFencedFence"),r.interrupt?t(F):e.check(pc,f,_)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(F))}function p(F){return F===null||be(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(F)):Oe(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,m,"whitespace")(F)):F===96&&F===o?n(F):(e.consume(F),p)}function m(F){return F===null||be(F)?h(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(F))}function g(F){return F===null||be(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(F)):F===96&&F===o?n(F):(e.consume(F),g)}function f(F){return e.attempt(a,_,b)(F)}function b(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),v}function v(F){return i>0&&Oe(F)?Le(e,x,"linePrefix",i+1)(F):x(F)}function x(F){return F===null||be(F)?e.check(pc,f,_)(F):(e.enter("codeFlowValue"),k(F))}function k(F){return F===null||be(F)?(e.exit("codeFlowValue"),x(F)):(e.consume(F),k)}function _(F){return e.exit("codeFenced"),t(F)}function w(F,S,q){let N=0;return z;function z(R){return F.enter("lineEnding"),F.consume(R),F.exit("lineEnding"),I}function I(R){return F.enter("codeFencedFence"),Oe(R)?Le(F,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):A(R)}function A(R){return R===o?(F.enter("codeFencedFenceSequence"),E(R)):q(R)}function E(R){return R===o?(N++,F.consume(R),E):N>=s?(F.exit("codeFencedFenceSequence"),Oe(R)?Le(F,j,"whitespace")(R):j(R)):q(R)}function j(R){return R===null||be(R)?(F.exit("codeFencedFence"),S(R)):q(R)}}}function AC(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 Qi={name:"codeIndented",tokenize:SC},TC={tokenize:jC,partial:!0};function SC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Le(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):be(u)?e.attempt(TC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||be(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function jC(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Le(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):be(s)?a(s):n(s)}}const OC={name:"codeText",tokenize:NC,resolve:PC,previous:MC};function PC(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 MC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NC(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,d(h)):be(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||be(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class IC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&yr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),yr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);yr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yr(this.left,n.reverse())}}}function yr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Zf(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new IC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(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,RC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return Xt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function RC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,h,p=-1,m=n,g=0,f=0;const b=[f];for(;m;){for(;e.get(++a)[1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=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&&(f=p+1,b.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),x=i.pop();l.push([x,x+v.length-1]),e.splice(x,2,v)}for(l.reverse(),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 $C={tokenize:qC,resolve:zC},LC={tokenize:WC,partial:!0};function zC(e){return Zf(e),e}function qC(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):be(o)?e.check(LC,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 WC(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Le(e,i,"linePrefix")}function i(s){if(s===null||be(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 Yf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(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||Hs(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(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"}),m(v))}function m(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||be(v)?n(v):(e.consume(v),v===92?g:m)}function g(v){return v===60||v===62||v===92?(e.consume(v),m):m(v)}function f(v){return!d&&(v===null||v===41||gt(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||Hs(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Gf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):be(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||be(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Oe(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function Qf(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):be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Le(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||be(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Br(e,t){let n;return r;function r(a){return be(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Oe(a)?Le(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const UC={name:"definition",tokenize:VC},HC={tokenize:KC,partial:!0};function VC(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return Gf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return gt(m)?Br(e,u)(m):u(m)}function u(m){return Yf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(HC,h,h)(m)}function h(m){return Oe(m)?Le(e,p,"whitespace")(m):p(m)}function p(m){return m===null||be(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function KC(e,t,n){return r;function r(o){return gt(o)?Br(e,a)(o):n(o)}function a(o){return Qf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Oe(o)?Le(e,s,"whitespace")(o):s(o)}function s(o){return o===null||be(o)?t(o):n(o)}}const ZC={name:"hardBreakEscape",tokenize:YC};function YC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return be(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const GC={name:"headingAtx",tokenize:JC,resolve:QC};function QC(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"},Xt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function JC(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||gt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||be(d)?(e.exit("atxHeading"),t(d)):Oe(d)?Le(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||gt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const XC=["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"],vc=["pre","script","style","textarea"],ex={name:"htmlFlow",tokenize:ax,resolveTo:rx,concrete:!0},tx={tokenize:sx,partial:!0},nx={tokenize:ix,partial:!0};function rx(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 ax(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),h}function h(B){return B===33?(e.consume(B),p):B===47?(e.consume(B),i=!0,f):B===63?(e.consume(B),a=3,r.interrupt?t:C):Lt(B)?(e.consume(B),s=String.fromCharCode(B),b):n(B)}function p(B){return B===45?(e.consume(B),a=2,m):B===91?(e.consume(B),a=5,o=0,g):Lt(B)?(e.consume(B),a=4,r.interrupt?t:C):n(B)}function m(B){return B===45?(e.consume(B),r.interrupt?t:C):n(B)}function g(B){const T="CDATA[";return B===T.charCodeAt(o++)?(e.consume(B),o===T.length?r.interrupt?t:A:g):n(B)}function f(B){return Lt(B)?(e.consume(B),s=String.fromCharCode(B),b):n(B)}function b(B){if(B===null||B===47||B===62||gt(B)){const T=B===47,O=s.toLowerCase();return!T&&!i&&vc.includes(O)?(a=1,r.interrupt?t(B):A(B)):XC.includes(s.toLowerCase())?(a=6,T?(e.consume(B),v):r.interrupt?t(B):A(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?x(B):k(B))}return B===45||Ot(B)?(e.consume(B),s+=String.fromCharCode(B),b):n(B)}function v(B){return B===62?(e.consume(B),r.interrupt?t:A):n(B)}function x(B){return Oe(B)?(e.consume(B),x):z(B)}function k(B){return B===47?(e.consume(B),z):B===58||B===95||Lt(B)?(e.consume(B),_):Oe(B)?(e.consume(B),k):z(B)}function _(B){return B===45||B===46||B===58||B===95||Ot(B)?(e.consume(B),_):w(B)}function w(B){return B===61?(e.consume(B),F):Oe(B)?(e.consume(B),w):k(B)}function F(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,S):Oe(B)?(e.consume(B),F):q(B)}function S(B){return B===l?(e.consume(B),l=null,N):B===null||be(B)?n(B):(e.consume(B),S)}function q(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||gt(B)?w(B):(e.consume(B),q)}function N(B){return B===47||B===62||Oe(B)?k(B):n(B)}function z(B){return B===62?(e.consume(B),I):n(B)}function I(B){return B===null||be(B)?A(B):Oe(B)?(e.consume(B),I):n(B)}function A(B){return B===45&&a===2?(e.consume(B),W):B===60&&a===1?(e.consume(B),H):B===62&&a===4?(e.consume(B),L):B===63&&a===3?(e.consume(B),C):B===93&&a===5?(e.consume(B),ne):be(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(tx,ee,E)(B)):B===null||be(B)?(e.exit("htmlFlowData"),E(B)):(e.consume(B),A)}function E(B){return e.check(nx,j,ee)(B)}function j(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),R}function R(B){return B===null||be(B)?E(B):(e.enter("htmlFlowData"),A(B))}function W(B){return B===45?(e.consume(B),C):A(B)}function H(B){return B===47?(e.consume(B),s="",G):A(B)}function G(B){if(B===62){const T=s.toLowerCase();return vc.includes(T)?(e.consume(B),L):A(B)}return Lt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),G):A(B)}function ne(B){return B===93?(e.consume(B),C):A(B)}function C(B){return B===62?(e.consume(B),L):B===45&&a===2?(e.consume(B),C):A(B)}function L(B){return B===null||be(B)?(e.exit("htmlFlowData"),ee(B)):(e.consume(B),L)}function ee(B){return e.exit("htmlFlow"),t(B)}}function ix(e,t,n){const r=this;return a;function a(s){return be(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 sx(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ci,t,n)}}const ox={name:"htmlText",tokenize:ux};function ux(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),w):C===63?(e.consume(C),k):Lt(C)?(e.consume(C),q):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):Lt(C)?(e.consume(C),x):n(C)}function d(C){return C===45?(e.consume(C),m):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),p):be(C)?(s=h,H(C)):(e.consume(C),h)}function p(C){return C===45?(e.consume(C),m):h(C)}function m(C){return C===62?W(C):C===45?p(C):h(C)}function g(C){const L="CDATA[";return C===L.charCodeAt(i++)?(e.consume(C),i===L.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):be(C)?(s=f,H(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),v):f(C)}function v(C){return C===62?W(C):C===93?(e.consume(C),v):f(C)}function x(C){return C===null||C===62?W(C):be(C)?(s=x,H(C)):(e.consume(C),x)}function k(C){return C===null?n(C):C===63?(e.consume(C),_):be(C)?(s=k,H(C)):(e.consume(C),k)}function _(C){return C===62?W(C):k(C)}function w(C){return Lt(C)?(e.consume(C),F):n(C)}function F(C){return C===45||Ot(C)?(e.consume(C),F):S(C)}function S(C){return be(C)?(s=S,H(C)):Oe(C)?(e.consume(C),S):W(C)}function q(C){return C===45||Ot(C)?(e.consume(C),q):C===47||C===62||gt(C)?N(C):n(C)}function N(C){return C===47?(e.consume(C),W):C===58||C===95||Lt(C)?(e.consume(C),z):be(C)?(s=N,H(C)):Oe(C)?(e.consume(C),N):W(C)}function z(C){return C===45||C===46||C===58||C===95||Ot(C)?(e.consume(C),z):I(C)}function I(C){return C===61?(e.consume(C),A):be(C)?(s=I,H(C)):Oe(C)?(e.consume(C),I):N(C)}function A(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,E):be(C)?(s=A,H(C)):Oe(C)?(e.consume(C),A):(e.consume(C),j)}function E(C){return C===a?(e.consume(C),a=void 0,R):C===null?n(C):be(C)?(s=E,H(C)):(e.consume(C),E)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||gt(C)?N(C):(e.consume(C),j)}function R(C){return C===47||C===62||gt(C)?N(C):n(C)}function W(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function H(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),G}function G(C){return Oe(C)?Le(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ne(C)}function ne(C){return e.enter("htmlTextData"),s(C)}}const No={name:"labelEnd",tokenize:mx,resolveTo:hx,resolveAll:fx},lx={tokenize:px},cx={tokenize:gx},dx={tokenize:vx};function fx(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 hx(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)},d={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=kt(o,e.slice(i+1,i+r+3)),o=kt(o,[["enter",d,t]]),o=kt(o,Mo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=kt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=kt(o,e.slice(s+1)),o=kt(o,[["exit",l,t]]),Xt(e,i,e.length,o),e}function mx(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?h(p):(s=r.parser.defined.includes(Jn(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(lx,d,s?d:h)(p):p===91?e.attempt(cx,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt(dx,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function px(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return gt(h)?Br(e,i)(h):i(h)}function i(h){return h===41?d(h):Yf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return gt(h)?Br(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?Qf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return gt(h)?Br(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function gx(e,t,n){const r=this;return a;function a(o){return Gf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function vx(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 bx={name:"labelStartImage",tokenize:yx,resolveAll:No.resolveAll};function yx(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 Dx={name:"labelStartLink",tokenize:Cx,resolveAll:No.resolveAll};function Cx(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 Ji={name:"lineEnding",tokenize:xx};function xx(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Aa={name:"thematicBreak",tokenize:wx};function wx(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||be(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Oe(u)?Le(e,o,"whitespace")(u):o(u))}}const ht={name:"list",tokenize:kx,continuation:{tokenize:Fx},exit:Ax},Ex={tokenize:Tx,partial:!0},_x={tokenize:Bx,partial:!0};function kx(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(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Vs(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Aa,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Vs(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(ci,r.interrupt?n:d,e.attempt(Ex,p,h))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Oe(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function Fx(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ci,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Oe(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(_x,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(ht,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Bx(e,t,n){const r=this;return Le(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 Ax(e){e.exit(this.containerState.type)}function Tx(e,t,n){const r=this;return Le(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!Oe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const bc={name:"setextUnderline",tokenize:jx,resolveTo:Sx};function Sx(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 jx(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Oe(u)?Le(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||be(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Ox={tokenize:Px};function Px(e){const t=this,n=e.attempt(ci,r,e.attempt(this.parser.constructs.flowInitial,a,Le(e,e.attempt(this.parser.constructs.flow,a,e.attempt($C,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 Mx={resolveAll:Xf()},Nx=Jf("string"),Ix=Jf("text");function Jf(e){return{tokenize:t,resolveAll:Xf(e==="text"?Rx:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=a[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function Xf(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 Rx(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 $x(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:_,attempt:S(w),check:S(F),interrupt:S(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:g,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(I){return s=kt(s,I),b(),s[s.length-1]!==null?[]:(q(t,0),u.events=Mo(i,u.events,u),u.events)}function p(I,A){return zx(m(I),A)}function m(I){return Lx(s,I)}function g(){const{line:I,column:A,offset:E,_index:j,_bufferIndex:R}=r;return{line:I,column:A,offset:E,_index:j,_bufferIndex:R}}function f(I){a[I.line]=I.column,z()}function b(){let I;for(;r._index<s.length;){const A=s[r._index];if(typeof A=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<A.length;)v(A.charCodeAt(r._bufferIndex));else v(A)}}function v(I){d=d(I)}function x(I){be(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,z()):I!==-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=I}function k(I,A){const E=A||{};return E.type=I,E.start=g(),u.events.push(["enter",E,u]),o.push(E),E}function _(I){const A=o.pop();return A.end=g(),u.events.push(["exit",A,u]),A}function w(I,A){q(I,A.from)}function F(I,A){A.restore()}function S(I,A){return E;function E(j,R,W){let H,G,ne,C;return Array.isArray(j)?ee(j):"tokenize"in j?ee([j]):L(j);function L($){return U;function U(re){const X=re!==null&&$[re],ae=re!==null&&$.null,he=[...Array.isArray(X)?X:X?[X]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return ee(he)(re)}}function ee($){return H=$,G=0,$.length===0?W:B($[G])}function B($){return U;function U(re){return C=N(),ne=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?O():$.tokenize.call(A?Object.assign(Object.create(u),A):u,l,T,O)(re)}}function T($){return I(ne,C),R}function O($){return C.restore(),++G<H.length?B(H[G]):W}}}function q(I,A){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&Xt(u.events,A,u.events.length-A,I.resolve(u.events.slice(A),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function N(){const I=g(),A=u.previous,E=u.currentConstruct,j=u.events.length,R=Array.from(o);return{restore:W,from:j};function W(){r=I,u.previous=A,u.currentConstruct=E,u.events.length=j,o=R,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Lx(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 zx(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=`
|
|
140
140
|
`;break}case-3:{s=`\r
|
|
141
|
-
`;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 qx={42:ht,43:ht,45:ht,48:ht,49:ht,50:ht,51:ht,52:ht,53:ht,54:ht,55:ht,56:ht,57:ht,62:Hf},Wx={91:UC},Ux={[-2]:Qi,[-1]:Qi,32:Qi},Hx={35:GC,42:Ba,45:[vc,Ba],60:ex,61:vc,95:Ba,96:pc,126:pc},Vx={38:Kf,92:Vf},Kx={[-5]:Ji,[-4]:Ji,[-3]:Ji,33:bx,38:Kf,42:Ks,60:[DC,ox],91:Dx,92:[ZC,Vf],93:Mo,95:Ks,96:OC},Zx={null:[Ks,Mx]},Yx={null:[42,95]},Gx={null:[]},Qx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Yx,contentInitial:Wx,disable:Gx,document:qx,flow:Hx,flowInitial:Ux,insideSpan:Zx,string:Vx,text:Kx},Symbol.toStringTag,{value:"Module"}));function Jx(e){const n=iC([Qx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(hC),document:a(pC),flow:a(Ox),string:a(Nx),text:a(Ix)};return r;function a(i){return s;function s(o){return $x(r,i,o)}}}function Xx(e){for(;!Zf(e););return e}const bc=/[\0\t\n\r]/g;function ew(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(bc.lastIndex=h,u=bc.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const tw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nw(e){return e.replace(tw,rw)}function rw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Uf(n.slice(i?2:1),i?16:10)}return Oo(n)||e}const eh={}.hasOwnProperty;function aw(e,t,n){return typeof t!="string"&&(n=t,t=void 0),iw(n)(Xx(Jx(n).document().write(ew()(e,t,!0))))}function iw(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ve),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(pe),blockQuote:i(X),characterEscape:M,characterReference:M,codeFenced:i(ie),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ie,s),codeText:i(fe,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ve),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Fe,s),htmlFlowData:M,htmlText:i(Fe,s),htmlTextData:M,image:i(Te),label:s,link:i(Ve),listItem:i(Be),listItemValue:p,listOrdered:i(We,h),listUnordered:i(We),paragraph:i(Se),reference:F,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(De),thematicBreak:i(ze)},exit:{atxHeading:l(),atxHeadingSequence:x,autolink:l(),autolinkEmail:ae,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:R,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:q,codeIndented:l(v),codeText:l(N),codeTextData:q,data:q,definition:l(),definitionDestinationString:_,definitionLabelString:w,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(E),htmlFlowData:q,htmlText:l(j),htmlTextData:q,image:l(H),label:re,labelText:G,lineEnding:I,link:l(W),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:k,resourceDestinationString:C,resourceTitleString:L,resource:ee,setextHeading:l(z),setextHeadingLineSequence:S,setextHeadingText:T,strong:l(),thematicBreak:l()}};th(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let te={type:"root",children:[]};const le={stack:[te],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},me=[];let xe=-1;for(;++xe<Y.length;)if(Y[xe][1].type==="listOrdered"||Y[xe][1].type==="listUnordered")if(Y[xe][0]==="enter")me.push(xe);else{const Ze=me.pop();xe=a(Y,Ze,xe)}for(xe=-1;++xe<Y.length;){const Ze=t[Y[xe][0]];eh.call(Ze,Y[xe][1].type)&&Ze[Y[xe][1].type].call(Object.assign({sliceSerialize:Y[xe][2].sliceSerialize},le),Y[xe][1])}if(le.tokenStack.length>0){const Ze=le.tokenStack[le.tokenStack.length-1];(Ze[1]||yc).call(le,void 0,Ze[0])}for(te.position={start:an(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:an(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)te=t.transforms[xe](te)||te;return te}function a(Y,te,le){let me=te-1,xe=-1,Ze=!1,Ye,rt,Ht,At;for(;++me<=le;){const tt=Y[me];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?xe++:xe--,At=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Ye&&!At&&!xe&&!Ht&&(Ht=me),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!xe&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||xe===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Ye){let Pt=me;for(rt=void 0;Pt--;){const bt=Y[Pt];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;rt&&(Y[rt][1].type="lineEndingBlank",Ze=!0),bt[1].type="lineEnding",rt=Pt}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}Ht&&(!rt||Ht<rt)&&(Ye._spread=!0),Ye.end=Object.assign({},rt?Y[rt][1].start:tt[1].end),Y.splice(rt||me,0,["exit",Ye,tt[2]]),me++,le++}if(tt[1].type==="listItemPrefix"){const Pt={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Ye=Pt,Y.splice(me,0,["enter",Pt,tt[2]]),me++,le++,Ht=void 0,At=!0}}}return Y[te][1]._spread=Ze,le}function i(Y,te){return le;function le(me){o.call(this,Y(me),me),te&&te.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Y,te,le){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([te,le]),Y.position={start:an(te.start),end:void 0}}function l(Y){return te;function te(le){Y&&Y.call(this,le),u.call(this,le)}}function u(Y,te){const le=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==Y.type&&(te?te.call(this,Y,me[0]):(me[1]||yc).call(this,Y,me[0]));else throw new Error("Cannot close `"+Y.type+"` ("+Fr({start:Y.start,end:Y.end})+"): it’s not open");le.position.end=an(Y.end)}function d(){return rC(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(Y){if(this.data.expectingFirstListItemValue){const te=this.stack[this.stack.length-2];te.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function m(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.lang=Y}function g(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.meta=Y}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.value=Y.replace(/(\r?\n|\r)$/g,"")}function w(Y){const te=this.resume(),le=this.stack[this.stack.length-1];le.label=te,le.identifier=Jn(this.sliceSerialize(Y)).toLowerCase()}function A(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.title=Y}function _(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.url=Y}function x(Y){const te=this.stack[this.stack.length-1];if(!te.depth){const le=this.sliceSerialize(Y).length;te.depth=le}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function S(Y){const te=this.stack[this.stack.length-1];te.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function M(Y){const le=this.stack[this.stack.length-1].children;let me=le[le.length-1];(!me||me.type!=="text")&&(me=Re(),me.position={start:an(Y.start),end:void 0},le.push(me)),this.stack.push(me)}function q(Y){const te=this.stack.pop();te.value+=this.sliceSerialize(Y),te.position.end=an(Y.end)}function I(Y){const te=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=te.children[te.children.length-1];le.position.end=an(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(te.type)&&(M.call(this,Y),q.call(this,Y))}function B(){this.data.atHardBreak=!0}function E(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.value=Y}function j(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.value=Y}function N(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.value=Y}function W(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=te,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function H(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=te,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function G(Y){const te=this.sliceSerialize(Y),le=this.stack[this.stack.length-2];le.label=nw(te),le.identifier=Jn(te).toLowerCase()}function re(){const Y=this.stack[this.stack.length-1],te=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const me=Y.children;le.children=me}else le.alt=te}function C(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.url=Y}function L(){const Y=this.resume(),te=this.stack[this.stack.length-1];te.title=Y}function ee(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function k(Y){const te=this.resume(),le=this.stack[this.stack.length-1];le.label=te,le.identifier=Jn(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function $(Y){this.data.characterReferenceType=Y.type}function R(Y){const te=this.sliceSerialize(Y),le=this.data.characterReferenceType;let me;le?(me=Uf(te,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Oo(te);const xe=this.stack.pop();xe.value+=me,xe.position.end=an(Y.end)}function U(Y){q.call(this,Y);const te=this.stack[this.stack.length-1];te.url=this.sliceSerialize(Y)}function ae(Y){q.call(this,Y);const te=this.stack[this.stack.length-1];te.url="mailto:"+this.sliceSerialize(Y)}function X(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Ve(){return{type:"link",title:null,url:"",children:[]}}function We(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Be(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function Se(){return{type:"paragraph",children:[]}}function De(){return{type:"strong",children:[]}}function Re(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function an(e){return{line:e.line,column:e.column,offset:e.offset}}function th(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?th(e,r):sw(e,r)}}function sw(e,t){let n;for(n in t)if(eh.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 yc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Fr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Fr({start:t.start,end:t.end})+") is still open")}function ow(e){const t=this;t.parser=n;function n(r){return aw(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function nh(e,t){var l,u,d;const n={...Yn,...t==null?void 0:t.nodeTypes,[K.heading]:{...Yn[K.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[K.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>nh({...h,ordered:e.ordered||!1},t))),e.type){case lt.heading:return{type:n[K.heading][e.depth||1],children:s};case lt.list:return{type:e.ordered?n[K.ol]:n[K.ul],children:s};case lt.listItem:return{type:n[K.li],children:s};case lt.paragraph:return{type:n[K.paragraph],children:s};case lt.link:return{type:n[K.link],[r]:e.url,children:s};case lt.image:return{type:n[K.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case lt.blockquote:return{type:n[K.blockquote],children:s};case lt.code:return{type:n[K.codeblock],language:e.lang,children:[{text:e.value}]};case lt.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[K.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:K.paragraph,children:[{text:e.value||""}]};case lt.emphasis:return{[n[Lt.emphasis]]:!0,...Xi(s),...ma(s)};case lt.strong:return{[n[Lt.strong]]:!0,...Xi(s),...ma(s)};case lt.delete:return{[n[Lt.delete]]:!0,...Xi(s),...ma(s)};case lt.inlineCode:return{[n[Lt.code]]:!0,text:e.value,...ma(s)};case lt.thematicBreak:return{type:n[K.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Xi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function ma(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const uw=function(t){const n=r=>r.children.map(a=>nh(a,t));this.Compiler=n},lw=(e,t=n=>{})=>{JD().use(ow).use(uw).process(e).then(n=>{const r=wn(n.result),a=s=>{const o=s;[K.li,K.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===K.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===K.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(zs)){const h=u,p=d.text.replace(zs,""),m="link"in h&&h.link?h.link:"";h.type=K.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const h=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),g=o.text.substring(p+d.length),f=[{text:m},{text:h,[K.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},No=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},cw=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=D.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},dw=e=>{const{selection:t}=e;return t?D.string(e,t):null},Dc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Cc={"mod+b":K.bold,"mod+i":K.italic,"mod+shift+x":K.strikethrough,"mod+k":K.link,"mod+shift+7":K.ol,"mod+shift+8":K.ul,"mod+shift+9":K.blockquote},fw=(e,t,n,r)=>{for(const a in Cc)if(a1(a,e)){e.stopPropagation(),e.preventDefault();const i=Cc[a];if(i===K.link){n([{type:"showLinkEditor",value:!0}]);return}if(ww(i)){ch(t,i,r);return}oh(t,i,r)}},rh=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:K.mention,id:o,name:l,children:[{text:""}]};J.select(e,(t==null?void 0:t.position)||Lf),J.insertNodes(e,[u,{text:" "}]),J.move(e,{distance:1,unit:"offset"}),No(r)},hw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&V.isCollapsed(i)){const[s]=V.edges(i),o=D.start(e,s.path),l=D.range(e,o,s),d=D.string(e,l).match(Gc);if(d){const h=d.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+d[0].length},g=D.range(e,p,m),f=D.after(e,s),b=D.range(e,s,f);if(D.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const A=d[1];let _=[];r&&(_=await r({name:A})),a([{type:"mentionPopover",value:{show:_.length>0?!0:n!==null,selectedUser:0,possibleUsers:_,position:_.length>0?g:null,numberOfUsers:_.length>0?_.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},ah=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},qn=e=>typeof e.text=="string",mw=[K.hr,K.image,K.mention],xc="<br>";function ih(e,t={nodeTypes:Yn}){const{nodeTypes:n=Yn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Yn,...n,heading:{...Yn[K.heading],...n[K.heading]}},l=[o[K.ul],o[K.ol]];let u=i;if(!qn(e)&&s!==K.mention&&(u=e.children.map(d=>{const h=qn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!qn(e)&&Array.isArray(e.children)&&(m=e.children.some(g=>!qn(g)&&g.type===o.link)),ih({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[K.blockquote]||e.parentType===o[K.blockquote]})}).join("")),!r&&(i===""||i===`
|
|
142
|
-
`)&&e.parentType===o[
|
|
143
|
-
`;case o[
|
|
144
|
-
`;case o[
|
|
145
|
-
`;case o[
|
|
146
|
-
`;case o[
|
|
147
|
-
`;case o[
|
|
148
|
-
`;case o[
|
|
149
|
-
|
|
150
|
-
`;case o[
|
|
141
|
+
`;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 qx={42:ht,43:ht,45:ht,48:ht,49:ht,50:ht,51:ht,52:ht,53:ht,54:ht,55:ht,56:ht,57:ht,62:Hf},Wx={91:UC},Ux={[-2]:Qi,[-1]:Qi,32:Qi},Hx={35:GC,42:Aa,45:[bc,Aa],60:ex,61:bc,95:Aa,96:gc,126:gc},Vx={38:Kf,92:Vf},Kx={[-5]:Ji,[-4]:Ji,[-3]:Ji,33:bx,38:Kf,42:Ks,60:[DC,ox],91:Dx,92:[ZC,Vf],93:No,95:Ks,96:OC},Zx={null:[Ks,Mx]},Yx={null:[42,95]},Gx={null:[]},Qx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Yx,contentInitial:Wx,disable:Gx,document:qx,flow:Hx,flowInitial:Ux,insideSpan:Zx,string:Vx,text:Kx},Symbol.toStringTag,{value:"Module"}));function Jx(e){const n=iC([Qx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(hC),document:a(pC),flow:a(Ox),string:a(Nx),text:a(Ix)};return r;function a(i){return s;function s(o){return $x(r,i,o)}}}function Xx(e){for(;!Zf(e););return e}const yc=/[\0\t\n\r]/g;function ew(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(yc.lastIndex=h,u=yc.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const tw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nw(e){return e.replace(tw,rw)}function rw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Uf(n.slice(i?2:1),i?16:10)}return Po(n)||e}const eh={}.hasOwnProperty;function aw(e,t,n){return typeof t!="string"&&(n=t,t=void 0),iw(n)(Xx(Jx(n).document().write(ew()(e,t,!0))))}function iw(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(We),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(pe),blockQuote:i(X),characterEscape:N,characterReference:N,codeFenced:i(ae),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ae,s),codeText:i(he,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ve),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Fe,s),htmlFlowData:N,htmlText:i(Fe,s),htmlTextData:N,image:i(Se),label:s,link:i(We),listItem:i(Be),listItemValue:p,listOrdered:i(Ue,h),listUnordered:i(Ue),paragraph:i(Te),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(De),thematicBreak:i(ze)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:re,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:O,characterReferenceMarkerNumeric:O,characterReferenceValue:$,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:l(v),codeText:l(R),codeTextData:z,data:z,definition:l(),definitionDestinationString:_,definitionLabelString:x,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(E),htmlFlowData:z,htmlText:l(j),htmlTextData:z,image:l(H),label:ne,labelText:G,lineEnding:I,link:l(W),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:C,resourceTitleString:L,resource:ee,setextHeading:l(q),setextHeadingLineSequence:S,setextHeadingText:F,strong:l(),thematicBreak:l()}};th(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let oe={type:"root",children:[]};const le={stack:[oe],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ce=[];let Ce=-1;for(;++Ce<Y.length;)if(Y[Ce][1].type==="listOrdered"||Y[Ce][1].type==="listUnordered")if(Y[Ce][0]==="enter")ce.push(Ce);else{const Ze=ce.pop();Ce=a(Y,Ze,Ce)}for(Ce=-1;++Ce<Y.length;){const Ze=t[Y[Ce][0]];eh.call(Ze,Y[Ce][1].type)&&Ze[Y[Ce][1].type].call(Object.assign({sliceSerialize:Y[Ce][2].sliceSerialize},le),Y[Ce][1])}if(le.tokenStack.length>0){const Ze=le.tokenStack[le.tokenStack.length-1];(Ze[1]||Dc).call(le,void 0,Ze[0])}for(oe.position={start:an(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:an(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<t.transforms.length;)oe=t.transforms[Ce](oe)||oe;return oe}function a(Y,oe,le){let ce=oe-1,Ce=-1,Ze=!1,Ye,rt,xt,Tt;for(;++ce<=le;){const tt=Y[ce];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?Ce++:Ce--,Tt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Ye&&!Tt&&!Ce&&!xt&&(xt=ce),Tt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Tt=void 0}if(!Ce&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||Ce===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Ye){let Mt=ce;for(rt=void 0;Mt--;){const bt=Y[Mt];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;rt&&(Y[rt][1].type="lineEndingBlank",Ze=!0),bt[1].type="lineEnding",rt=Mt}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}xt&&(!rt||xt<rt)&&(Ye._spread=!0),Ye.end=Object.assign({},rt?Y[rt][1].start:tt[1].end),Y.splice(rt||ce,0,["exit",Ye,tt[2]]),ce++,le++}if(tt[1].type==="listItemPrefix"){const Mt={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Ye=Mt,Y.splice(ce,0,["enter",Mt,tt[2]]),ce++,le++,xt=void 0,Tt=!0}}}return Y[oe][1]._spread=Ze,le}function i(Y,oe){return le;function le(ce){o.call(this,Y(ce),ce),oe&&oe.call(this,ce)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Y,oe,le){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([oe,le]),Y.position={start:an(oe.start),end:void 0}}function l(Y){return oe;function oe(le){Y&&Y.call(this,le),u.call(this,le)}}function u(Y,oe){const le=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==Y.type&&(oe?oe.call(this,Y,ce[0]):(ce[1]||Dc).call(this,Y,ce[0]));else throw new Error("Cannot close `"+Y.type+"` ("+Fr({start:Y.start,end:Y.end})+"): it’s not open");le.position.end=an(Y.end)}function d(){return rC(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(Y){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function m(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Y}function g(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Y}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/(\r?\n|\r)$/g,"")}function x(Y){const oe=this.resume(),le=this.stack[this.stack.length-1];le.label=oe,le.identifier=Jn(this.sliceSerialize(Y)).toLowerCase()}function k(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function _(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function w(Y){const oe=this.stack[this.stack.length-1];if(!oe.depth){const le=this.sliceSerialize(Y).length;oe.depth=le}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function S(Y){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function N(Y){const le=this.stack[this.stack.length-1].children;let ce=le[le.length-1];(!ce||ce.type!=="text")&&(ce=Re(),ce.position={start:an(Y.start),end:void 0},le.push(ce)),this.stack.push(ce)}function z(Y){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Y),oe.position.end=an(Y.end)}function I(Y){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=oe.children[oe.children.length-1];le.position.end=an(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(N.call(this,Y),z.call(this,Y))}function A(){this.data.atHardBreak=!0}function E(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function j(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function R(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function W(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function H(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function G(Y){const oe=this.sliceSerialize(Y),le=this.stack[this.stack.length-2];le.label=nw(oe),le.identifier=Jn(oe).toLowerCase()}function ne(){const Y=this.stack[this.stack.length-1],oe=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const ce=Y.children;le.children=ce}else le.alt=oe}function C(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function L(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function ee(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function T(Y){const oe=this.resume(),le=this.stack[this.stack.length-1];le.label=oe,le.identifier=Jn(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function O(Y){this.data.characterReferenceType=Y.type}function $(Y){const oe=this.sliceSerialize(Y),le=this.data.characterReferenceType;let ce;le?(ce=Uf(oe,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=Po(oe);const Ce=this.stack.pop();Ce.value+=ce,Ce.position.end=an(Y.end)}function U(Y){z.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Y)}function re(Y){z.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Y)}function X(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function he(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Se(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function Ue(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Be(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function Te(){return{type:"paragraph",children:[]}}function De(){return{type:"strong",children:[]}}function Re(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function an(e){return{line:e.line,column:e.column,offset:e.offset}}function th(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?th(e,r):sw(e,r)}}function sw(e,t){let n;for(n in t)if(eh.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 Dc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Fr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Fr({start:t.start,end:t.end})+") is still open")}function ow(e){const t=this;t.parser=n;function n(r){return aw(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function nh(e,t){var l,u,d;const n={...Yn,...t==null?void 0:t.nodeTypes,[Z.heading]:{...Yn[Z.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>nh({...h,ordered:e.ordered||!1},t))),e.type){case lt.heading:return{type:n[Z.heading][e.depth||1],children:s};case lt.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case lt.listItem:return{type:n[Z.li],children:s};case lt.paragraph:return{type:n[Z.paragraph],children:s};case lt.link:return{type:n[Z.link],[r]:e.url,children:s};case lt.image:return{type:n[Z.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case lt.blockquote:return{type:n[Z.blockquote],children:s};case lt.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case lt.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case lt.emphasis:return{[n[zt.emphasis]]:!0,...Xi(s),...pa(s)};case lt.strong:return{[n[zt.strong]]:!0,...Xi(s),...pa(s)};case lt.delete:return{[n[zt.delete]]:!0,...Xi(s),...pa(s)};case lt.inlineCode:return{[n[zt.code]]:!0,text:e.value,...pa(s)};case lt.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Xi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function pa(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const uw=function(t){const n=r=>r.children.map(a=>nh(a,t));this.Compiler=n},lw=(e,t=n=>{})=>{JD().use(ow).use(uw).process(e).then(n=>{const r=wn(n.result),a=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===Z.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===Z.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(zs)){const h=u,p=d.text.replace(zs,""),m="link"in h&&h.link?h.link:"";h.type=Z.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const h=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),g=o.text.substring(p+d.length),f=[{text:m},{text:h,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Io=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},cw=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=D.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=M.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},dw=e=>{const{selection:t}=e;return t?D.string(e,t):null},Cc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},xc={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},fw=(e,t,n,r)=>{for(const a in xc)if(a1(a,e)){e.stopPropagation(),e.preventDefault();const i=xc[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(ww(i)){ch(t,i,r);return}oh(t,i,r)}},rh=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:Z.mention,id:o,name:l,children:[{text:""}]};J.select(e,(t==null?void 0:t.position)||Lf),J.insertNodes(e,[u,{text:" "}]),J.move(e,{distance:1,unit:"offset"}),Io(r)},hw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&K.isCollapsed(i)){const[s]=K.edges(i),o=D.start(e,s.path),l=D.range(e,o,s),d=D.string(e,l).match(Gc);if(d){const h=d.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+d[0].length},g=D.range(e,p,m),f=D.after(e,s),b=D.range(e,s,f);if(D.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const k=d[1];let _=[];r&&(_=await r({name:k})),a([{type:"mentionPopover",value:{show:_.length>0?!0:n!==null,selectedUser:0,possibleUsers:_,position:_.length>0?g:null,numberOfUsers:_.length>0?_.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},ah=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},qn=e=>typeof e.text=="string",mw=[Z.hr,Z.image,Z.mention],wc="<br>";function ih(e,t={nodeTypes:Yn}){const{nodeTypes:n=Yn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Yn,...n,heading:{...Yn[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!qn(e)&&s!==Z.mention&&(u=e.children.map(d=>{const h=qn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!qn(e)&&Array.isArray(e.children)&&(m=e.children.some(g=>!qn(g)&&g.type===o.link)),ih({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
|
|
142
|
+
`)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],u=wc),!(u===""&&!mw.find(d=>o[d]===s)))switch(u!==wc&&qn(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?u=Wn(u,"~~***"):e[Z.bold]&&e[Z.italic]?u=Wn(u,"***"):(e[Z.bold]&&(u=Wn(u,"**")),e[Z.italic]&&(u=Wn(u,"_")),e[Z.strikethrough]&&(u=Wn(u,"~~")),e[Z.code]&&(u=Wn(u,"`")))),s){case o[Z.heading][1]:return`# ${u}
|
|
143
|
+
`;case o[Z.heading][2]:return`## ${u}
|
|
144
|
+
`;case o[Z.heading][3]:return`### ${u}
|
|
145
|
+
`;case o[Z.heading][4]:return`#### ${u}
|
|
146
|
+
`;case o[Z.heading][5]:return`##### ${u}
|
|
147
|
+
`;case o[Z.heading][6]:return`###### ${u}
|
|
148
|
+
`;case o[Z.blockquote]:return`> ${u}
|
|
149
|
+
|
|
150
|
+
`;case o[Z.codeblock]:return`\`\`\`${e.language||""}
|
|
151
151
|
${u}
|
|
152
152
|
\`\`\`
|
|
153
|
-
`;case o[
|
|
153
|
+
`;case o[Z.link]:return`[${u}](${e.link||""})`;case o.image:return``;case o[Z.mention]:const{id:d}=e;return e?`@{{${d}}}`:u;case o[Z.ul]:case o[Z.ol]:return`
|
|
154
154
|
${u}
|
|
155
155
|
|
|
156
|
-
`;case o[
|
|
156
|
+
`;case o[Z.li]:const h=e&&e.parentType===o[Z.ol],p=e.children.length===1&&qn(e.children[0]);let m="";for(let g=0;a>g;g++)h?m+=" ":m+=" ";return t.inBlockquote&&(m="> "+m),`
|
|
157
157
|
${m}${h?"1.":"-"} ${u}${p?`
|
|
158
|
-
`:""}`;case o[
|
|
158
|
+
`:""}`;case o[Z.paragraph]:return`${u}
|
|
159
159
|
|
|
160
|
-
`;case o[
|
|
161
|
-
`;default:return u}}function Wn(e,t){const n=e.trim(),r=n,a=`${t}${r}${wc(t)}`;if(r.length===e.length)return a;const i=t+r+wc(t);return e.replace(n,i)}const wc=e=>e.split("").reverse().join(""),pw=e=>e.map(t=>ih(t)).join("").trim();const gw=({onFallbackClick:e=()=>{}})=>{const t=se.useIntl(),n=Nn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(nn),{show:l,selectedUser:u,possibleUsers:d}=i,h=zf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=ah(a);return c.jsx(Ur,{parent:p,children:c.jsx(nd,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:m,user:g},f)=>c.jsx(Qt,{element:"li",className:Z({selected:f===u}),member:{id:m,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),rh(n,v,r,s),o&&o({id:m||"",name:g.name||""})}}},m)),c.jsx(Qt,{element:"li",className:Z("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${qt}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},Io=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=se.useIntl(),u=Nn(),{id:d,tabbableOption:h,setFocus:p,openTooltip:m,dispatch:g}=y.useContext(nn),f={};return e!==h&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:Z(e,{"has-divider":n}),onMouseEnter:()=>{g([{type:"openTooltip",value:e}])},onMouseLeave:()=>{g([{type:"openTooltip",value:null}])},onFocus:()=>{g([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const v=[{type:"openTooltip",value:null}];u.selection&&v.push({type:"lastAnchor",value:u.selection.anchor}),g(v)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:Z(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var v,w,A,_;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const x=b.currentTarget.closest("li");let T=x==null?void 0:x.nextElementSibling;if(b.key==="ArrowLeft"){const M=x==null?void 0:x.previousElementSibling;M?T=M:T=(v=x==null?void 0:x.parentElement)==null?void 0:v.lastElementChild}else T||(T=(w=x==null?void 0:x.parentElement)==null?void 0:w.firstElementChild);const S=T==null?void 0:T.className.split(" ")[0];S&&(p(S),(A=T==null?void 0:T.querySelector("button"))==null||A.focus());break;default:const z=b.currentTarget.closest("fieldset");if(z){(_=z==null?void 0:z.previousElementSibling)==null||_.focus();break}}},children:[c.jsx(Ne,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Mn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Ec=[K.ol,K.ul],sh=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(D.nodes(e,{at:D.unhangRange(e,n),match:a=>{const i=a;return!D.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},vw=e=>{const[t]=D.nodes(e,{match:n=>n.type===K.blockquote});return!!t},oh=(e,t,n)=>{try{const r=vw(e),a=sh(e,t),i=Ec.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!D.isEditor(u)&&de.isElement(u)&&Ec.includes(u.type)},split:!0});const o={type:a?K.paragraph:i?K.li:t};if(J.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=D.parent(e,l,{edge:"end"});Array.from(D.nodes(e,{at:d,match:p=>{const m=p;return!D.isEditor(p)&&de.isElement(p)&&m.type===K.li}})).forEach(([p,m])=>{ue.string(p).trim()===""&&J.removeNodes(e,{at:m})})}else{if(r){const u={type:K.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},bw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(nn),a=Nn(),i=sh(a,e);return c.jsx(Io,{id:e,active:i,hasDivider:t,callback:()=>{oh(a,e,r),n(i?null:e)}})},Ar=e=>{const[t]=D.nodes(e,{match:n=>{const r=n;return!D.isEditor(n)&&de.isElement(n)&&r.type===K.link}});return!!t},yw=(e,t,n,r)=>{e.selection&&Ro(e,t,n,r)},Dw=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=D.nodes(e,{match:o=>{const l=o;return!D.isEditor(o)&&de.isElement(o)&&l.type===K.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),No(n)}}else Ro(e,t,n,r)},Ro=(e,t,n,r=a=>{console.error(a)})=>{try{Ar(e)&&uh(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:K.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),No(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},uh=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!D.isEditor(t)&&de.isElement(t)&&n.type===K.link}})};let es=null;const Cw=()=>{const e=se.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(nn),o=Nn(),l=PD(o),u=(l==null?void 0:l.text)||dw(o),[d,h]=y.useState(Ar(o)),p=zf(o,"link-editor",`${n}-link`),m=y.useRef(null);y.useEffect(()=>{var w;!d&&r&&((w=m.current)==null||w.focus())},[d]),y.useEffect(()=>{es&&clearTimeout(es),es=setTimeout(()=>{h(Ar(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(w=>{const A={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${w}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:w}),w){case"open":A.href=(l==null?void 0:l.full)||"",A.onClick=_=>{_.preventDefault(),_.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},A.children=c.jsxs(c.Fragment,{children:[A.children,c.jsx(Ne,{children:e.formatMessage({id:`${t}${w}_text`})})]});break;case"edit":A.onClick=()=>{h(!1)};break;case"remove":A.onClick=()=>{const _=[{type:"showLinkEditor",value:!1}];Ar(o)&&(uh(o),_.push({type:"lastAnchor",value:null})),i(_)};break}return A}),b=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),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,functions:{onChange:()=>{},onKeyDown:w=>{if(w.key==="Tab"){if(!o)return;w.preventDefault(),w.stopPropagation();const A=D.end(o,[]);J.select(o,A),ne.focus(o)}}}}];u&&b.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=ah(a);return c.jsx(Ur,{parent:v,children:c.jsx(Mn,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var w;return(w=m.current)==null?void 0:w.focus()})}},children:d?c.jsx(or,{wrappers:g,buttons:f}):c.jsx(en,{element:"fieldset",id:`${n}-link-editor`,className:Z({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async w=>{setTimeout(()=>{const A=[{type:"showLinkEditor",value:!1}];if(w.url){const{full:_}=ed(w.url);l!=null&&l.full?Dw(o,_,n,s):yw(o,_,n,s),A.push({type:"lastAnchor",value:null})}i(A)})}},fields:b,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},xw=()=>{const e=Nn(),{setFocus:t,dispatch:n}=y.useContext(nn),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Ar(e))},[e.selection]),c.jsx(Io,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},ww=e=>[K.bold,K.italic,K.strikethrough].includes(e),lh=(e,t)=>{const n=D.marks(e);return n?n[t]===!0:!1},ch=(e,t,n)=>{try{lh(e,t)?D.removeMark(e,t):D.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},Ew=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(nn),a=Nn(),i=lh(a,e);return c.jsx(Io,{id:e,active:i,hasDivider:t,callback:()=>{ch(a,e,r),n(i?null:e)}})},Wa=[K.bold,K.italic,K.strikethrough],_w=[K.ol,K.ul,K.blockquote];const kw=({...e})=>{const t=se.useIntl(),{id:n}=y.useContext(nn);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Ne,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Wa.map((r,a)=>c.jsx(Ew,{format:r,hasDivider:a===Wa.length-1},r)),c.jsx(xw,{}),_w.map((r,a)=>c.jsx(bw,{format:r,hasDivider:a===1},r))]})]}),c.jsx(Cw,{})]})};var Fw=Sw,Bw=/^(?:\w+:)?\/\/(\S+)$/,Aw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Tw=/^[^\s\.]+\.\S{2,}$/;function Sw(e){if(typeof e!="string")return!1;var t=e.match(Bw);if(!t)return!1;var n=t[1];return n?!!(Aw.test(n)||Tw.test(n)):!1}const jw=On(Fw),Ow=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[K.link].includes(s.type)||a(i)},e.insertText=i=>{i&&jw(i)?Ro(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},Pw=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===K.mention?!0:n(i),e.isVoid=i=>i.type===K.mention?!0:r(i),e.markableVoid=i=>i.type===K.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},Mw=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===K.link&&ue.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const dh=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=se.useIntl(),d=om();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:m,onChange:g=()=>{},onMention:f=()=>{},reportError:b=L=>{console.error(L)}}=i||{},v=[{type:K.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const w={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:Wa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[A,_]=y.useReducer(Wr,w),{editorKey:x,originalValue:T,initialValue:S,stringValue:z,lastAnchor:M,lastKey:q,hasInteracted:I,hasLoaded:B,mentionPopover:E}=A,j=L=>{const ee=L||Wa[0];L&&_([{type:"tabbableOption",value:ee}])},N=`rte-${e}`,W=y.useCallback(L=>c.jsx(jD,{...L}),[]),H=y.useCallback(L=>c.jsx(OD,{...L}),[]),G=y.useMemo(()=>Ow(Pw(Mw(yb(TD(vb())),b),b),N,b),[]);y.useEffect(()=>{if(!t)return;jr.lastIndex=0;const L=t.match(jr);!L||L.length>1||L[0].length!==t.length||I||_([{type:"originalValue",value:t}])},[t]);const re=L=>{if(!G||L!==N)return;const ee=D.end(G,[]);J.select(G,ee),ne.focus(G)};y.useEffect(()=>{const L=ee=>{var $;const F=ee,k=(($=F==null?void 0:F.detail)==null?void 0:$.id)||null;k&&re(k)};return window.addEventListener("focusEditor",L),()=>{window.removeEventListener("focusEditor",L)}},[]),y.useEffect(()=>{if(G.children.length>0&&!B){if(_([{type:"hasLoaded",value:!0}]),!s)return;re(N)}},[G.children.length,S]),y.useEffect(()=>{T&&(async()=>{let ee=wn(T);if(ee.includes("<")){Pr.prototype.escape=k=>k;const F=new Pr;F.addRule("br",{filter:["br"],replacement:k=>k+`
|
|
160
|
+
`;case o[Z.hr]:return`---
|
|
161
|
+
`;default:return u}}function Wn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Ec(t)}`;if(r.length===e.length)return a;const i=t+r+Ec(t);return e.replace(n,i)}const Ec=e=>e.split("").reverse().join(""),pw=e=>e.map(t=>ih(t)).join("").trim();const gw=({onFallbackClick:e=()=>{}})=>{const t=ie.useIntl(),n=Nn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(nn),{show:l,selectedUser:u,possibleUsers:d}=i,h=zf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=ah(a);return c.jsx(Ur,{parent:p,children:c.jsx(nd,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:m,user:g},f)=>c.jsx(Qt,{element:"li",className:V({selected:f===u}),member:{id:m,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),rh(n,v,r,s),o&&o({id:m||"",name:g.name||""})}}},m)),c.jsx(Qt,{element:"li",className:V("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Wt}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},Ro=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ie.useIntl(),u=Nn(),{id:d,tabbableOption:h,setFocus:p,openTooltip:m,dispatch:g}=y.useContext(nn),f={};return e!==h&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:V(e,{"has-divider":n}),onMouseEnter:()=>{g([{type:"openTooltip",value:e}])},onMouseLeave:()=>{g([{type:"openTooltip",value:null}])},onFocus:()=>{g([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const v=[{type:"openTooltip",value:null}];u.selection&&v.push({type:"lastAnchor",value:u.selection.anchor}),g(v)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:V(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var v,x,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 w=b.currentTarget.closest("li");let F=w==null?void 0:w.nextElementSibling;if(b.key==="ArrowLeft"){const N=w==null?void 0:w.previousElementSibling;N?F=N:F=(v=w==null?void 0:w.parentElement)==null?void 0:v.lastElementChild}else F||(F=(x=w==null?void 0:w.parentElement)==null?void 0:x.firstElementChild);const S=F==null?void 0:F.className.split(" ")[0];S&&(p(S),(k=F==null?void 0:F.querySelector("button"))==null||k.focus());break;default:const q=b.currentTarget.closest("fieldset");if(q){(_=q==null?void 0:q.previousElementSibling)==null||_.focus();break}}},children:[c.jsx(Ne,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Mn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},_c=[Z.ol,Z.ul],sh=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(D.nodes(e,{at:D.unhangRange(e,n),match:a=>{const i=a;return!D.isEditor(a)&&fe.isElement(a)&&i.type===t}}));return!!r},vw=e=>{const[t]=D.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},oh=(e,t,n)=>{try{const r=vw(e),a=sh(e,t),i=_c.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!D.isEditor(u)&&fe.isElement(u)&&_c.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(J.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=D.parent(e,l,{edge:"end"});Array.from(D.nodes(e,{at:d,match:p=>{const m=p;return!D.isEditor(p)&&fe.isElement(p)&&m.type===Z.li}})).forEach(([p,m])=>{ue.string(p).trim()===""&&J.removeNodes(e,{at:m})})}else{if(r){const u={type:Z.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},bw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(nn),a=Nn(),i=sh(a,e);return c.jsx(Ro,{id:e,active:i,hasDivider:t,callback:()=>{oh(a,e,r),n(i?null:e)}})},Ar=e=>{const[t]=D.nodes(e,{match:n=>{const r=n;return!D.isEditor(n)&&fe.isElement(n)&&r.type===Z.link}});return!!t},yw=(e,t,n,r)=>{e.selection&&$o(e,t,n,r)},Dw=(e,t,n,r)=>{const{selection:a}=e;if(a&&K.isCollapsed(a)){const[s]=D.nodes(e,{match:o=>{const l=o;return!D.isEditor(o)&&fe.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),Io(n)}}else $o(e,t,n,r)},$o=(e,t,n,r=a=>{console.error(a)})=>{try{Ar(e)&&uh(e);const{selection:a}=e,i=a&&K.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),Io(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},uh=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!D.isEditor(t)&&fe.isElement(t)&&n.type===Z.link}})};let es=null;const Cw=()=>{const e=ie.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(nn),o=Nn(),l=PD(o),u=(l==null?void 0:l.text)||dw(o),[d,h]=y.useState(Ar(o)),p=zf(o,"link-editor",`${n}-link`),m=y.useRef(null);y.useEffect(()=>{var x;!d&&r&&((x=m.current)==null||x.focus())},[d]),y.useEffect(()=>{es&&clearTimeout(es),es=setTimeout(()=>{h(Ar(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(x=>{const k={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${x}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:x}),x){case"open":k.href=(l==null?void 0:l.full)||"",k.onClick=_=>{_.preventDefault(),_.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},k.children=c.jsxs(c.Fragment,{children:[k.children,c.jsx(Ne,{children:e.formatMessage({id:`${t}${x}_text`})})]});break;case"edit":k.onClick=()=>{h(!1)};break;case"remove":k.onClick=()=>{const _=[{type:"showLinkEditor",value:!1}];Ar(o)&&(uh(o),_.push({type:"lastAnchor",value:null})),i(_)};break}return k}),b=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),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,functions:{onChange:()=>{},onKeyDown:x=>{if(x.key==="Tab"){if(!o)return;x.preventDefault(),x.stopPropagation();const k=D.end(o,[]);J.select(o,k),te.focus(o)}}}}];u&&b.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=ah(a);return c.jsx(Ur,{parent:v,children:c.jsx(Mn,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var x;return(x=m.current)==null?void 0:x.focus()})}},children:d?c.jsx(or,{wrappers:g,buttons:f}):c.jsx(en,{element:"fieldset",id:`${n}-link-editor`,className:V({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async x=>{setTimeout(()=>{const k=[{type:"showLinkEditor",value:!1}];if(x.url){const{full:_}=ed(x.url);l!=null&&l.full?Dw(o,_,n,s):yw(o,_,n,s),k.push({type:"lastAnchor",value:null})}i(k)})}},fields:b,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},xw=()=>{const e=Nn(),{setFocus:t,dispatch:n}=y.useContext(nn),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Ar(e))},[e.selection]),c.jsx(Ro,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},ww=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),lh=(e,t)=>{const n=D.marks(e);return n?n[t]===!0:!1},ch=(e,t,n)=>{try{lh(e,t)?D.removeMark(e,t):D.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},Ew=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(nn),a=Nn(),i=lh(a,e);return c.jsx(Ro,{id:e,active:i,hasDivider:t,callback:()=>{ch(a,e,r),n(i?null:e)}})},Ua=[Z.bold,Z.italic,Z.strikethrough],_w=[Z.ol,Z.ul,Z.blockquote];const kw=({...e})=>{const t=ie.useIntl(),{id:n}=y.useContext(nn);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Ne,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Ua.map((r,a)=>c.jsx(Ew,{format:r,hasDivider:a===Ua.length-1},r)),c.jsx(xw,{}),_w.map((r,a)=>c.jsx(bw,{format:r,hasDivider:a===1},r))]})]}),c.jsx(Cw,{})]})};var Fw=Sw,Bw=/^(?:\w+:)?\/\/(\S+)$/,Aw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Tw=/^[^\s\.]+\.\S{2,}$/;function Sw(e){if(typeof e!="string")return!1;var t=e.match(Bw);if(!t)return!1;var n=t[1];return n?!!(Aw.test(n)||Tw.test(n)):!1}const jw=On(Fw),Ow=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&jw(i)?$o(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},Pw=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},Mw=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&ue.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const dh=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=ie.useIntl(),d=om();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:m,onChange:g=()=>{},onMention:f=()=>{},reportError:b=L=>{console.error(L)}}=i||{},v=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const x={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:Ua[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[k,_]=y.useReducer(Wr,x),{editorKey:w,originalValue:F,initialValue:S,stringValue:q,lastAnchor:N,lastKey:z,hasInteracted:I,hasLoaded:A,mentionPopover:E}=k,j=L=>{const ee=L||Ua[0];L&&_([{type:"tabbableOption",value:ee}])},R=`rte-${e}`,W=y.useCallback(L=>c.jsx(jD,{...L}),[]),H=y.useCallback(L=>c.jsx(OD,{...L}),[]),G=y.useMemo(()=>Ow(Pw(Mw(yb(TD(vb())),b),b),R,b),[]);y.useEffect(()=>{if(!t)return;jr.lastIndex=0;const L=t.match(jr);!L||L.length>1||L[0].length!==t.length||I||_([{type:"originalValue",value:t}])},[t]);const ne=L=>{if(!G||L!==R)return;const ee=D.end(G,[]);J.select(G,ee),te.focus(G)};y.useEffect(()=>{const L=ee=>{var O;const B=ee,T=((O=B==null?void 0:B.detail)==null?void 0:O.id)||null;T&&ne(T)};return window.addEventListener("focusEditor",L),()=>{window.removeEventListener("focusEditor",L)}},[]),y.useEffect(()=>{if(G.children.length>0&&!A){if(_([{type:"hasLoaded",value:!0}]),!s)return;ne(R)}},[G.children.length,S]),y.useEffect(()=>{F&&(async()=>{let ee=wn(F);if(ee.includes("<")){Pr.prototype.escape=T=>T;const B=new Pr;B.addRule("br",{filter:["br"],replacement:T=>T+`
|
|
162
162
|
|
|
163
|
-
`}),ee=F.turndown(ee)}o&&o.mentions&&(ee=await Xc({text:ee,template:`[${zs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),lw(ee,F=>{_([{type:"initialValue",value:F},{type:"editorKey",value:T.toString()}]),setTimeout(()=>{_([{type:"stringValue",value:Dc(G)}])},150)})})()},[T]),y.useEffect(()=>{t!==""||!G||ps(T,t)&&!I||(D.withoutNormalizing(G,()=>{J.delete(G,{at:{anchor:D.start(G,[]),focus:D.end(G,[])}}),J.deselect(G),G.children.length!==0&&J.unwrapNodes(G,{at:[0]}),J.insertNodes(G,v,{at:[0]})}),_([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=zc(()=>{hw({editor:G,isShowing:E.show,numberOfUsers:E.numberOfUsers,listMembers:p,dispatch:_})},100);return S?c.jsx("div",{id:N,className:"rich-text-editor",children:c.jsxs(nn.Provider,{value:{...A,id:N,isInOverlay:h,setFocus:j,dispatch:_,onMention:f,reportError:b},children:[c.jsxs(BD,{editor:G,initialValue:S,onChange:L=>{if(G.operations.some(F=>F.type!=="set_selection")){const F=pw(L);g(F),_([{type:"stringValue",value:Dc(G)}]),I||_([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:F,json:L})}},...l,children:[c.jsx(yD,{className:"input",renderElement:W,renderLeaf:H,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:L=>{if(L.key==="Enter"){E.show&&(L.preventDefault(),L.stopPropagation(),rh(G,E,_,N));const{selection:ee}=G;if(ee){const F=V.isCollapsed(ee),[k,$]=D.node(G,ee,{depth:1});let R=k,U=R.type;const ae=R.children[0];if(ae&&[K.ol,K.ul].includes(ae.type)&&(R=ae,U=ae.type),R&&de.isElement(R)&&U!==K.paragraph){if(U===K.blockquote&&!L.shiftKey){L.stopPropagation(),L.preventDefault(),J.insertNodes(G,v);return}if(F){const[X,ie]=D.parent(G,ee,{edge:"end"}),Q=X.type;if([K.ul,K.ol].includes(U))if(L.stopPropagation(),L.preventDefault(),Q===K.li&&q==="Enter"){X.children.length===1&&"text"in X.children[0]&&X.children[0].text===""&&J.removeNodes(G,{at:ie}),J.insertNodes(G,v,{at:P.next($)}),J.select(G,D.end(G,P.next($)));return}else{const[ve,pe]=cw(G,K.li),_e={type:K.li,children:[{text:""}]};J.insertNodes(G,_e,{at:P.next(pe)}),J.select(G,D.end(G,P.next(pe)))}}}}}else if(L.key==="Escape"){if(E.show){L.preventDefault(),L.stopPropagation(),_([{type:"mentionPopover",value:{...E,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(L.key)&&E.show){L.preventDefault(),L.stopPropagation();const{selectedUser:ee,possibleUsers:F}=E;let k=L.key==="ArrowUp"?ee-1:ee+1;k<0&&(k=F.length-1),k>=F.length+1&&(k=0),_([{type:"mentionPopover",value:{...E,selectedUser:k}}])}_([{type:"lastKey",value:L.key}]),fw(L,G,_,b)},onBlur:()=>{G.selection&&_([{type:"lastAnchor",value:G.selection.anchor}])},onFocus:()=>{if(M){if(!P.isPath(M.path)||!ue.has(G,M.path))return;const L=ue.get(G,M.path);let ee=0;if(he.isText(L)?ee=L.text.length:L.children&&(ee=L.children.length),M.offset>ee)return;try{J.select(G,{anchor:M,focus:M})}catch(F){const k=F.message;b(`Error focusing editor: ${k}`)}}}}),c.jsx(kw,{}),p?c.jsx(gw,{onFallbackClick:m}):null]},x),c.jsx(fo,{id:`character-limit-${e}`,limit:r,valueLength:ni(z)})]})}):c.jsx(c.Fragment,{})};const Nw=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:Z("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:Z("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function fh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=se.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[h,p]=y.useState(!1),[m,g]=y.useState(!1),f=y.useRef(null),b=async _=>{p(!0),g(!1);try{const x=_.target.files&&_.target.files[0];if(!x||!t)throw p(!1),new Error("Image file or userID is missing");const T=await a({fileObject:x,userId:t}),S={thumbnail:T.thumbnailURL,full:T.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:w=o.formatMessage({id:`${l}cta_change`}),uploading:A=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:Z("profile-image-change-figure",e),children:[c.jsx(mn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),m&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:h,children:h?A:u?w:v})]})}const hh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(en,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{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 mh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,h]=y.useState([]),[p,m]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=se.useIntl(),v=async _=>{_.preventDefault();try{await l(d),h([]),f("SUCCESS")}catch(x){f("ERROR"),o(x)}},w=_=>{_.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},A=_=>{_.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(Wt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:w,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:A,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:w,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Z("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(Kh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:_=>{h(_),m(!_.length)},autoFocus:!1,getLabel:(_,x,T)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:_}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(x),m(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},x)})]}),c.jsx(Wt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(Ee,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Aa=e=>e.map(t=>({condition:t})),wt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Iw=({functions:e,...t})=>{const{formatMessage:n}=se.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[wt.NEW_PASSWORD]!==m[wt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!ys(m[wt.NEW_PASSWORD]).isValid,h=[{"data-testid":wt.NEW_PASSWORD,id:wt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Aa(["required",d]),functions:{onChange:m=>l(ys(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":wt.CONFIRMED_PASSWORD,id:wt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Aa(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":wt.CURRENT_PASSWORD,id:wt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Aa(["required"])}),i&&h.push({component:Ld,props:{matchingRules:o}});const p={id:wt.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(wt.NEW_PASSWORD)||g.includes(wt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(en,{...p}),r&&c.jsx(hn,{variant:"error",text:r})]})};const ph=({hooks:e,functions:t,meta:n={},gtm:r})=>{var _,x;const a=se.useIntl(),i="profileForm_",s=y.useContext(it),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:h,onSuccess:p=async T=>{},onCancel:m=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:w="ProfileForm",event:A="profile-form-submit-click"}=r||{};return c.jsx(en,{id:"profile-details-form",fields:[{component:fh,props:{userName:s.name,userId:s.id,src:o,uploadImage:h,callback:l,button:{text:{upload:a.formatMessage({id:`${i}image`})}}}},{id:"name",type:"text",label:a.formatMessage({id:`${i}name`}),placeholder:a.formatMessage({id:`${i}name_placeholder`}),value:s.name,autoComplete:"name",validation:[{condition:"required"}]},{id:"jobTitle",type:"text",label:a.formatMessage({id:`${i}jobTitle`}),placeholder:a.formatMessage({id:`${i}jobTitle_placeholder`}),value:s.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:a.formatMessage({id:`${i}organization`}),placeholder:a.formatMessage({id:`${i}organization_placeholder`}),value:s.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:a.formatMessage({id:`${i}location`}),placeholder:a.formatMessage({id:`${i}location_placeholder`}),value:((_=s.location)==null?void 0:_.en)||((x=s.location)==null?void 0:x.country),validation:[{condition:"required"},{condition:({location:T})=>T&&!u?!1:!b(T),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:Wt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:w,event:A},functions:{onSuccess:async T=>{try{const S={...T,image:o||null,location:u?await f(T==null?void 0:T.location):s.location};s.updateDetails&&s.updateDetails(z=>({...z,...S})),await p(S)}catch{g()}},onCancel:m,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const gh=({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=y.useRef(null);er(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:Z("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Ne,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ne,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ne,{children:l.formatMessage({id:"search_cta"})})})]})})})},_c=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 d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},Rw=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"]}},$w=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=Rw(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}])},Lw=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{_c({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,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:Md,props:{email:d.email,type:d.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:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),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:m=>c.jsx("small",{className:"notes text-small",children:m})}),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:m=>c.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:m}),privacy:m=>c.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:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&_c({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const zw=({className:e=""})=>c.jsxs("div",{className:Z("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(se.FormattedMessage,{id:"signup_success_title"})}),c.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const qw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Ww=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=se.useIntl(),{title:u=!0,expectation:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,b]=y.useReducer(Wr,qw),{validFields:v,emailDetails:w,shouldManuallyApprove:A,shouldDisableButton:_,showSuccessMessage:x,showError:T}=f,[S,z]=Ys.useCookies(["signup-this-session","functional-cookie-consent"]),M={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{A===!0&&M.jobTitle.current&&M.jobTitle.current.focus()},[A]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{x&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[x]);const q=y.useMemo(()=>Lw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:M,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,M,g,f]),I=_?!0:A?!Object.values(v).every(B=>B===!0):!v.name||!v.email||["exists","pending","verify"].includes(w.boxType);return g.successMessage&&x?c.jsx(zw,{className:e}):c.jsxs("fieldset",{className:Z("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(se.FormattedMessage,{id:"signup_title"})}),T&&c.jsx(hn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(en,{className:"signup-form",formRef:M.form,id:"sign-up-form",fields:q,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:I?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/api/next-ui/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 $w({refs:M,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:M.hiddenValidation})]})};const bn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:Z("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Uw=({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})}),c.jsx(bn,{className:Z("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(or,{buttons:r})]})})};const Zs="editSection_";function vh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Hw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return c.jsxs(Ot,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Zs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>vh({href:r,setShowModal:i}),children:n||s({id:`${Zs}placeholder_cta`})})})]})},Vw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=se.useIntl(),[h,p]=y.useState(!1),m=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),c.jsxs("section",{className:Z("edit-section",t),children:[g&&c.jsx(pn,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:m},className:Z("edit-section-modal"),children:b||(n?c.jsx(en,{...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 v=>{var w,A;(w=n==null?void 0:n.functions)!=null&&w.onSuccess&&await((A=n==null?void 0:n.functions)==null?void 0:A.onSuccess(v)),p(!1)},onCancel:m}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:Z("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>vh({href:a,setShowModal:p}),children:d({id:`${Zs}edit`})})]}),e||c.jsx(Hw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(Wt,{})]})};const Kw=({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 c.jsxs("div",{className:Z("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:Z("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:Z({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${g}`))})})]})};let ts;const ns="contactFooter_",Zw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(ts),ts=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ts),window.removeEventListener("resize",l)}),[]),c.jsx(bn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(se.FormattedMessage,{id:`${ns}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(se.FormattedMessage,{id:`${ns}text`})}),c.jsx(fn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(se.FormattedMessage,{id:`${ns}email`})})]}),c.jsx(hh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Yw=({activeLink:e,profile:t,...n})=>c.jsx(bn,{children:c.jsx(Od,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(jd,{activeLink:e,profile:t}),c.jsx(od,{...n})]})})});const rs="cookieBanner_",as=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],is=new Date(Date.now()+12*30*24*60*60*1e3),bh=()=>{const e=se.useIntl(),[t,n,r]=Ys.useCookies(as),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{as.forEach(d=>{n(d,!0,{path:"/",expires:is,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:is}),as.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:is});return}r(d)}),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(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${rs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${rs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${rs}text`})}),c.jsx(or,{buttons:u})]})},Zt={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","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Un["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Un["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:Un.support,gtmType:"concierge-email-click"},business:{email:Un.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 Gn="footer_",Ua="SiteFooter",kc=({group:e})=>{const t=Zt[e].order||[];let n=!1;return"text"in Zt[e]&&(n=Zt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(se.FormattedMessage,{id:`${Gn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Zt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Ua,"data-gtm-event-type":i,...s,children:c.jsx(se.FormattedMessage,{id:`${Gn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(se.FormattedMessage,{id:`${Gn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(se.FormattedMessage,{id:`${Gn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ua,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},$o=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Qa,{element:"hr"}),c.jsx(co,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ua,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(kc,{group:e}),Object.keys(Zt[e]).includes("child")&&c.jsx(kc,{group:Zt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Zt.social.order)&&Zt.social.order.map(e=>{const t=Zt.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ua,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(se.FormattedMessage,{id:`${Gn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(se.FormattedMessage,{id:`${Gn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ie={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===yt.ACCOUNT&&t===!1&&n[yt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Ie.handlerCalled[e]&&i-Ie.handlerCalled[e]<500)return;Ie.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 yt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case yt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case yt.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=Ic(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?Ie.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 yt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ie.findFirstChild(u.children,"id",yt.SITE);s=Ie.findFirstChild(d.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case yt.ACCOUNT:if(o=Ie.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ie.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(Ie.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ie.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ie.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ie.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},qr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-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:{menuId:"account-navigation",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:"/api/next-ui/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Ha=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=Ic(qr,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,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let A=o.gtmType||`${e}-click`;if(A.includes(".")){const _=A.split("."),x=_[_.length-2];A=`${x==="topics"?`${x}-`:""}${_[_.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":A,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},w={};if(f&&(b={...b,"aria-current":"page"}),m){const A=o.menuId||e,_={onClick:x=>Ie.events.onClick(x,{id:A,callback:a,isOpen:r[A]}),onFocus:()=>Ie.events.onFocus({id:A}),onBlur:()=>Ie.events.onBlur({id:A,callback:a}),onMouseLeave:()=>Ie.events.onBlur({id:A,callback:a}),onMouseEnter:()=>Ie.events.onMouseEnter({id:A,callback:a})};v={..._,id:A===yt.SITE?yt.SITE:yt.ACCOUNT},n&&(g&&(w={..._,className:"navigation-button",onKeyPress:x=>{x.key==="Enter"&&Ie.events.onClick(x,{id:A,callback:a,isOpen:r[A]})},"aria-haspopup":!0,"aria-expanded":r[A],"aria-controls":A}),v={...v,hidden:A in r?!r[A]:!0}),g||(v={...v})}return c.jsxs("li",{className:Z({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...b,children:[p?y.createElement(d?Ee:"a",p,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...w,children:[s.formatMessage({id:h}),c.jsx(Ne,{children:s.formatMessage({id:`header_menu_${r[yt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...v,children:o.order.map(A=>{if(!o[A])return null;const _={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[A].order?c.jsxs("li",{className:Z({[o[A].className]:o[A].className}),children:[s.formatMessage({id:`${h}_${A}`}),c.jsx("ul",{children:o[A].order.map(x=>c.jsx(Ha,{id:`${e}.${A}.${x}`,..._},x))})]},A):c.jsx(Ha,{id:`${e}.${A}`,..._},A)})})]},e)};const Gw={height:67,height_desktop:83};var yt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(yt||{});const Lo=({showNavigation:e=!0})=>{const t=se.useIntl(),n=y.useContext(it),r=Pn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Wr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),Wc({scrollPosition:Gw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,w,A=!1)=>{Ie.handleMenus({id:v,value:w,menus:h.current.menus,dispatch:o,forceHandle:A})},m=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(w=>{h.current.menus[w]&&p(w,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var w;(w=document.getElementById("header"))==null||w.removeEventListener("keydown",g)}},[]),er(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),er(()=>{u["account-navigation"]&&Ie.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ne,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(gh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Ne,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:qr.order.map(v=>c.jsx(Ha,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:Z({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Ne,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(co,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Ie.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ie.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Ie.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ne,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(mn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:qr.buttons.order.map(v=>c.jsx(Ha,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:Z("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const Qw=()=>{const e=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Lo,{}),c.jsx("div",{id:"content",children:c.jsx(hn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx($o,{})]})},yh=({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:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,g=Lc(),[f,b]=y.useState(""),v=T=>{const{detail:{message:S}}=T;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const w=Da(e,{locale:o}),A=Da(t,{locale:o}),_=Da(n,{locale:o}),x={};return d!=="default"&&(x[d]=!0),h!=="default"&&(x[h]=!0),p!=="default"&&(x[p]=!0),c.jsx(Zh.ErrorBoundary,{onError:r,fallback:c.jsx(Qw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:Z(s,x,{"has-footer":u}),children:[c.jsx(Lo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[A&&c.jsx("div",{className:Z("additional-content prepended",{"large-modal":m==="large"}),children:A}),y.createElement(d==="bold"?so:"div",{id:"content",children:w,className:Z({"large-modal":m==="large"})})]}),_&&c.jsx("div",{className:"additional-content appended",children:_}),u&&c.jsx($o,{}),c.jsx(bh,{})]}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Fc={default:"tags_",headerTopics:"header_topics_topics_"},ss={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"},Jw={getTagDetails:e=>{if(e.includes("topic_")){if(e=ss.topic[e.replace("topic_","")],e){const t=qr.topics.topics[e].href;return t?{id:e,href:t,text:`${Fc.headerTopics}${e}`}:null}return null}return ss[e]?(e=ss[e],{id:e,text:`${Fc.default}${e}`}):null}};const Xw=({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 d=Jw.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:Z("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};var dt=(e=>(e.COMMUNITIES="communities",e.PLATFORM="platform",e))(dt||{});const eE=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",className:u=""})=>{const d=se.useIntl(),h="membersList",p=y.useContext(it),[m,g]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:Z("members-list",u),children:[c.jsxs("h1",{children:[d.formatMessage({id:h}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(Qt,{member:p,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:n||""},{scope:dt.PLATFORM,area:"all"}]}}),c.jsx(fn,{href:"/profiles/me",className:"text-small",onClick:f=>{f==null||f.preventDefault(),f==null||f.stopPropagation(),g(!0)},children:d.formatMessage({id:`${h}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((f,b)=>c.jsxs("li",{children:[c.jsx(Qt,{member:f,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:n||""},{scope:dt.PLATFORM,area:"all"}]}}),f.isAdmin&&c.jsx(Gt,{children:d.formatMessage({id:`${h}_admin`})})]},b))]}),a&&c.jsx(Hr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(fi,{form:s,showModal:m,content:{title:d.formatMessage({id:`${h}_modal_title`})},functions:{onClose:()=>{g(!1)}}}):c.jsx(c.Fragment,{})]})},tE={showForm:!1},ci=y.createContext(tE),Dh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(ci.Provider,{value:{...t,updateConversation:n},children:e})},Bc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},di=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"},nE=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=se.useIntl();return t?c.jsx("small",{children:Tt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},rE=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=se.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Ne,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:Tt(a.formatMessage,`${t}label_action`,r,"action")})};let pa=null;const Je="discussion_form_",Kr=({id:e,parentId:t,content:n={type:"response",slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},isCommunity:u=!1,functions:d,data:h={},gtmContext:p="DiscussionForm"})=>{var Te,Ve,We;const m=se.useIntl(),g=y.useContext(it),[f,b]=y.useState(""),{isLoading:v=!1,isInWrapper:w=!1,isInOverlay:A=!1,isAutoFocused:_=!1,isEditing:x=!1,hasTitleField:T=!1,isPrepopulated:S=!1,showTitle:z=!1,showGuidelines:M=!0,showDivider:q=!1,showSuccessMessage:I=!0}=a||{},{onChange:B=()=>{},create:E=()=>{},handleSaveEdit:j=()=>{},handleCancel:N=()=>{},callback:W=()=>{},onMention:H=()=>{},listMembers:G=()=>Promise.resolve([]),clickMentionFallback:re=()=>{},props:C={create:{projectNames:["questions-answers"]}}}=d,[L,ee]=y.useState({title:T&&T.text||"",body:x&&x.text||S&&S.text||""}),[F,k]=y.useState(l.error||!1),[$,R]=y.useState(!1);if(y.useEffect(()=>{u&&!x&&S&&S!==L.body&&ee({...L,body:S.text||""})},[S]),v)return c.jsx(Bt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const U=Be=>{ee({...L,body:Be}),B({body:Be});let Se;!g||!g.id?Se=Tt(m.formatMessage,`${Je}error_loggedOut`,n.type,"action"):r?s>0&&Be.length>=s&&(Se=`${Je}error_tooLong`):Se=Tt(m.formatMessage,`${Je}error_noPermission`,n.type,"action"),Se?k(Se):F&&k(!1)};let ae=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const Be=((Te=n.slugs)==null?void 0:Te.reply)||((Ve=n.slugs)==null?void 0:Ve.answer)||((We=n.slugs)==null?void 0:We.question)||"";Be&&(ae=`${ae}-${Be.slice(-15)}`)}e&&(ae=`${e}-${ae}`);const X=async()=>{if(!g||!g.id||!r||ve)return;pa&&clearTimeout(pa),R("submitting");const Be=window.location.pathname;try{let Se;switch(n.type){case"post":Se=await E({title:L.title,content:L.body});break;case"question":Se=await E({title:L.body,authorId:g&&g.id,...C==null?void 0:C.create});break;case"response":Se=await E({questionSlug:n.slugs.question},{body:L.body,authorId:g&&g.id,contentPath:Be});break;case"reply":Se=await E({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:L.body,authorId:g&&g.id,contentPath:Be});break;default:break}await sm(1e3),W&&await W(Se),pa=setTimeout(()=>{ee({title:"",body:""}),R("submitted"),b(Tt(m.formatMessage,`${Je}success`,n.type,"action"));const De=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(De),ie()},500)}catch(Se){const De=Se;let Re=`${Je}error`;De!=null&&De.message.includes("entry already exists")&&(Re=Tt(m.formatMessage,`${Je}error_alreadyExists`,n.type,"action")),De!=null&&De.message.includes("429")?Re=Tt(m.formatMessage,`${Je}error_tooMany`,n.type,"action"):De!=null&&De.message.includes("400")&&(Re=`${Je}error`),k(Re),ie()}},ie=()=>{pa=setTimeout(()=>{k(!1),R(!1),b("")},5e3)},fe=!L.title||!ru(L.title),Q=!L.body||!ru(L.body);let ve=Q;T&&(ve=fe&&Q);const pe=$==="submitting",_e=[{component:rE,props:{formID:ae,intlPath:Je,showLabel:T!==!1,type:n.type}},{component:dh,props:{id:`${ae}-input`,value:$==="submitting"&&!F?"":L.body,placeholder:i||Tt(m.formatMessage,`${Je}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:A},functions:{onChange:U,onMention:H,listMembers:G,clickMentionFallback:re},data:h,autoFocus:x!==!1||_&&!T,"aria-invalid":!!F,"aria-errormessage":"error-message"}},{component:nE,props:{intlPath:Je,showGuidelines:M,type:n.type,gtmContext:p}}];q&&_e.push({component:Wt}),T&&_e.unshift({id:"title",type:"text",value:T.text,limit:250,autoFocus:_,label:m.formatMessage({id:`${Je}titleField_label`}),placeholder:m.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Be=>{ee({...L,title:Be}),B({title:Be})}},validation:[{condition:()=>ve,error:m.formatMessage({id:`${Je}titleField_error`})}]});let Fe=!g||!g.id||!r||ve||pe;return x&&(T?Fe=Fe||L.body===x.text&&L.title===T.text:Fe=Fe||L.body===x.text),c.jsxs(c.Fragment,{children:[c.jsxs(en,{id:ae,className:Z("discussion-card discussion-form",{"no-styling":w&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!pe||l.cancel},functions:{onSuccess:async()=>{if(x){R("submitting"),j(L);return}await X()},onCancel:N},fields:_e,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`${x?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:Fe,text:{default:!x&&(o!=null&&o.submit)?o==null?void 0:o.submit:m.formatMessage({id:`${Je}${x?"save":"post"}`}),submitting:m.formatMessage({id:`${Je}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!g||!g.id||!L.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:m.formatMessage({id:`${Je}cancel`})},gtm:{context:p,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[z&&!x&&["question"].includes(n.type)&&c.jsx("h2",{children:Tt(m.formatMessage,`${Je}title`,n.type,"action")}),c.jsx(Qt,{member:g?{...g,link:!1}:"community",gtmContext:p,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}})]}),$==="submitted"&&I&&c.jsx(Or,{className:"success","data-testid":"success",children:Tt(m.formatMessage,`${Je}success`,n.type,"action")}),F&&c.jsx(Or,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof F=="string"?F.includes(" ")?F:m.formatMessage({id:F},{action:m.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):F}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,children:f})]})},aE=Object.freeze(Object.defineProperty({__proto__:null,default:Kr},Symbol.toStringTag,{value:"Module"})),iE=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),sE=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Va=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:Z("discussion-button",t),variant:"tertiary",icon:e,...n});let Tr=!1;const os=()=>{Tr!==!1&&(clearTimeout(Tr),Tr=!1)},us=5;let ls=null;const Ch=({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(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,p]=y.useReducer(Wr,d),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=h;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const w=y.useMemo(()=>sE(n,us),[n]),A=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Tr)return os(),!1;if(os(),f||!s)return!1;Tr=setTimeout(_,350)},_=async()=>{if(os(),f||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=iE(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},x=()=>{ls=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},T=()=>{ls&&clearTimeout(ls)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{x()}},c.jsxs(c.Fragment,{children:[c.jsx(Va,{className:Z("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ne,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>x,onClick:S=>{var M;S.preventDefault(),S.stopPropagation(),T(),p([{type:"showLikers",value:!0}]);const z=(M=S.currentTarget.nextSibling)==null?void 0:M.childNodes[0];if(z){const q=z.querySelector("li:first-child a");q&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{q.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),x())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ne,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Mn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[w.map((S,z)=>{if(typeof S=="string")return null;const M={};return v!==z&&(M.tabIndex=-1),c.jsx("li",{"data-index":z,children:c.jsx(fn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:q=>q==null?void 0:q.stopPropagation(),onFocus:()=>T(),onKeyDown:q=>{var N,W,H,G;if(!q||!["ArrowUp","ArrowDown"].includes(q.key||""))return;q.stopPropagation(),q.preventDefault();const I=q.key==="ArrowUp"?"up":"down",B=(N=q.currentTarget)==null?void 0:N.parentElement;let E=B==null?void 0:B.nextElementSibling;if(I==="up"){const re=B==null?void 0:B.previousElementSibling;re?E=re:(E=(W=B==null?void 0:B.parentElement)==null?void 0:W.lastElementChild,(E==null?void 0:E.getAttribute("data-index"))==="-1"&&(E=E==null?void 0:E.previousElementSibling))}else(!E||(E==null?void 0:E.getAttribute("data-index"))==="-1")&&(E=(H=B==null?void 0:B.parentElement)==null?void 0:H.firstElementChild);if(!E)return;const j=(E==null?void 0:E.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(G=E==null?void 0:E.querySelector("a"))==null||G.focus()},...M,children:S.name?S.name:c.jsx("span",{className:"deleted-user",children:u.formatMessage({id:"member_deleted"})})})},S.id||window.btoa(S.name||""))}),t>us&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-us})})]})})]})]}))},cs=({children:e,class:t,...n})=>{const r={...n,class:Z("subtle",t)};return c.jsx("blockquote",{...r,children:e})},oE=280,zo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Xn(e,typeof t=="number"?t:oE):e;a=a.trim();const i=`<br>
|
|
163
|
+
`}),ee=B.turndown(ee)}o&&o.mentions&&(ee=await Xc({text:ee,template:`[${zs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),lw(ee,B=>{_([{type:"initialValue",value:B},{type:"editorKey",value:F.toString()}]),setTimeout(()=>{_([{type:"stringValue",value:Cc(G)}])},150)})})()},[F]),y.useEffect(()=>{t!==""||!G||ps(F,t)&&!I||(D.withoutNormalizing(G,()=>{J.delete(G,{at:{anchor:D.start(G,[]),focus:D.end(G,[])}}),J.deselect(G),G.children.length!==0&&J.unwrapNodes(G,{at:[0]}),J.insertNodes(G,v,{at:[0]})}),_([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=zc(()=>{hw({editor:G,isShowing:E.show,numberOfUsers:E.numberOfUsers,listMembers:p,dispatch:_})},100);return S?c.jsx("div",{id:R,className:"rich-text-editor",children:c.jsxs(nn.Provider,{value:{...k,id:R,isInOverlay:h,setFocus:j,dispatch:_,onMention:f,reportError:b},children:[c.jsxs(BD,{editor:G,initialValue:S,onChange:L=>{if(G.operations.some(B=>B.type!=="set_selection")){const B=pw(L);g(B),_([{type:"stringValue",value:Cc(G)}]),I||_([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:B,json:L})}},...l,children:[c.jsx(yD,{className:"input",renderElement:W,renderLeaf:H,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:L=>{if(L.key==="Enter"){E.show&&(L.preventDefault(),L.stopPropagation(),rh(G,E,_,R));const{selection:ee}=G;if(ee){const B=K.isCollapsed(ee),[T,O]=D.node(G,ee,{depth:1});let $=T,U=$.type;const re=$.children[0];if(re&&[Z.ol,Z.ul].includes(re.type)&&($=re,U=re.type),$&&fe.isElement($)&&U!==Z.paragraph){if(U===Z.blockquote&&!L.shiftKey){L.stopPropagation(),L.preventDefault(),J.insertNodes(G,v);return}if(B){const[X,ae]=D.parent(G,ee,{edge:"end"}),Q=X.type;if([Z.ul,Z.ol].includes(U))if(L.stopPropagation(),L.preventDefault(),Q===Z.li&&z==="Enter"){X.children.length===1&&"text"in X.children[0]&&X.children[0].text===""&&J.removeNodes(G,{at:ae}),J.insertNodes(G,v,{at:M.next(O)}),J.select(G,D.end(G,M.next(O)));return}else{const[ve,pe]=cw(G,Z.li),_e={type:Z.li,children:[{text:""}]};J.insertNodes(G,_e,{at:M.next(pe)}),J.select(G,D.end(G,M.next(pe)))}}}}}else if(L.key==="Escape"){if(E.show){L.preventDefault(),L.stopPropagation(),_([{type:"mentionPopover",value:{...E,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(L.key)&&E.show){L.preventDefault(),L.stopPropagation();const{selectedUser:ee,possibleUsers:B}=E;let T=L.key==="ArrowUp"?ee-1:ee+1;T<0&&(T=B.length-1),T>=B.length+1&&(T=0),_([{type:"mentionPopover",value:{...E,selectedUser:T}}])}_([{type:"lastKey",value:L.key}]),fw(L,G,_,b)},onBlur:()=>{G.selection&&_([{type:"lastAnchor",value:G.selection.anchor}])},onFocus:()=>{if(N){if(!M.isPath(N.path)||!ue.has(G,N.path))return;const L=ue.get(G,N.path);let ee=0;if(me.isText(L)?ee=L.text.length:L.children&&(ee=L.children.length),N.offset>ee)return;try{J.select(G,{anchor:N,focus:N})}catch(B){const T=B.message;b(`Error focusing editor: ${T}`)}}}}),c.jsx(kw,{}),p?c.jsx(gw,{onFallbackClick:m}):null]},w),c.jsx(ho,{id:`character-limit-${e}`,limit:r,valueLength:ri(q)})]})}):c.jsx(c.Fragment,{})};const Nw=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:V("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:V("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function fh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ie.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[h,p]=y.useState(!1),[m,g]=y.useState(!1),f=y.useRef(null),b=async _=>{p(!0),g(!1);try{const w=_.target.files&&_.target.files[0];if(!w||!t)throw p(!1),new Error("Image file or userID is missing");const F=await a({fileObject:w,userId:t}),S={thumbnail:F.thumbnailURL,full:F.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:x=o.formatMessage({id:`${l}cta_change`}),uploading:k=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:V("profile-image-change-figure",e),children:[c.jsx(mn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),m&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:h,children:h?k:u?x:v})]})}const hh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(en,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{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 mh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,h]=y.useState([]),[p,m]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=ie.useIntl(),v=async _=>{_.preventDefault();try{await l(d),h([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},x=_=>{_.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},k=_=>{_.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(Ut,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:x,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:k,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:x,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:V("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(Kh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:_=>{h(_),m(!_.length)},autoFocus:!1,getLabel:(_,w,F)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:_}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(w),m(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),c.jsx(Ut,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(Ee,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Ta=e=>e.map(t=>({condition:t})),Et={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Iw=({functions:e,...t})=>{const{formatMessage:n}=ie.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Et.NEW_PASSWORD]!==m[Et.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!ys(m[Et.NEW_PASSWORD]).isValid,h=[{"data-testid":Et.NEW_PASSWORD,id:Et.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ta(["required",d]),functions:{onChange:m=>l(ys(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Et.CONFIRMED_PASSWORD,id:Et.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ta(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Et.CURRENT_PASSWORD,id:Et.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ta(["required"])}),i&&h.push({component:Ld,props:{matchingRules:o}});const p={id:Et.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Et.NEW_PASSWORD)||g.includes(Et.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(en,{...p}),r&&c.jsx(hn,{variant:"error",text:r})]})};const ph=({hooks:e,functions:t,meta:n={},gtm:r})=>{var _,w;const a=ie.useIntl(),i="profileForm_",s=y.useContext(it),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:h,onSuccess:p=async F=>{},onCancel:m=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:x="ProfileForm",event:k="profile-form-submit-click"}=r||{};return c.jsx(en,{id:"profile-details-form",fields:[{component:fh,props:{userName:s.name,userId:s.id,src:o,uploadImage:h,callback:l,button:{text:{upload:a.formatMessage({id:`${i}image`})}}}},{id:"name",type:"text",label:a.formatMessage({id:`${i}name`}),placeholder:a.formatMessage({id:`${i}name_placeholder`}),value:s.name,autoComplete:"name",validation:[{condition:"required"}]},{id:"jobTitle",type:"text",label:a.formatMessage({id:`${i}jobTitle`}),placeholder:a.formatMessage({id:`${i}jobTitle_placeholder`}),value:s.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:a.formatMessage({id:`${i}organization`}),placeholder:a.formatMessage({id:`${i}organization_placeholder`}),value:s.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:a.formatMessage({id:`${i}location`}),placeholder:a.formatMessage({id:`${i}location_placeholder`}),value:((_=s.location)==null?void 0:_.en)||((w=s.location)==null?void 0:w.country),validation:[{condition:"required"},{condition:({location:F})=>F&&!u?!1:!b(F),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:Ut}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:x,event:k},functions:{onSuccess:async F=>{try{const S={...F,image:o||null,location:u?await f(F==null?void 0:F.location):s.location};s.updateDetails&&s.updateDetails(q=>({...q,...S})),await p(S)}catch{g()}},onCancel:m,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const gh=({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=ie.useIntl(),u=y.useRef(null);er(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:V("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Ne,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ne,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ne,{children:l.formatMessage({id:"search_cta"})})})]})})})},kc=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 d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},Rw=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"]}},$w=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=Rw(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}])},Lw=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{kc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,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:Md,props:{email:d.email,type:d.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:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),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:m=>c.jsx("small",{className:"notes text-small",children:m})}),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:m=>c.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:m}),privacy:m=>c.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:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&kc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const zw=({className:e=""})=>c.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ie.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ie.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const qw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Ww=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ie.useIntl(),{title:u=!0,expectation:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,b]=y.useReducer(Wr,qw),{validFields:v,emailDetails:x,shouldManuallyApprove:k,shouldDisableButton:_,showSuccessMessage:w,showError:F}=f,[S,q]=Gs.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{k===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[k]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{w&&S["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const z=y.useMemo(()=>Lw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),I=_?!0:k?!Object.values(v).every(A=>A===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&w?c.jsx(zw,{className:e}):c.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ie.FormattedMessage,{id:"signup_title"})}),F&&c.jsx(hn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(en,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:I?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/api/next-ui/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 $w({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:A=>{r.handleError(A),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const bn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:V("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Uw=({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})}),c.jsx(bn,{className:V("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(or,{buttons:r})]})})};const Zs="editSection_";function vh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Hw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(Pt,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Zs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>vh({href:r,setShowModal:i}),children:n||s({id:`${Zs}placeholder_cta`})})})]})},Vw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ie.useIntl(),[h,p]=y.useState(!1),m=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),c.jsxs("section",{className:V("edit-section",t),children:[g&&c.jsx(pn,{title:o||`Edit ${i}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:m},className:V("edit-section-modal"),children:b||(n?c.jsx(en,{...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 v=>{var x,k;(x=n==null?void 0:n.functions)!=null&&x.onSuccess&&await((k=n==null?void 0:n.functions)==null?void 0:k.onSuccess(v)),p(!1)},onCancel:m}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:V("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>vh({href:a,setShowModal:p}),children:d({id:`${Zs}edit`})})]}),e||c.jsx(Hw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(Ut,{})]})};const Kw=({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 c.jsxs("div",{className:V("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:V("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:V({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${g}`))})})]})};let ts;const ns="contactFooter_",Zw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(ts),ts=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ts),window.removeEventListener("resize",l)}),[]),c.jsx(bn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${ns}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ie.FormattedMessage,{id:`${ns}text`})}),c.jsx(fn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${ns}email`})})]}),c.jsx(hh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Yw=({activeLink:e,profile:t,...n})=>c.jsx(bn,{children:c.jsx(Od,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(jd,{activeLink:e,profile:t}),c.jsx(od,{...n})]})})});const rs="cookieBanner_",as=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],is=new Date(Date.now()+12*30*24*60*60*1e3),bh=()=>{const e=ie.useIntl(),[t,n,r]=Gs.useCookies(as),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{as.forEach(d=>{n(d,!0,{path:"/",expires:is,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:is}),as.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:is});return}r(d)}),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(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${rs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${rs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${rs}text`})}),c.jsx(or,{buttons:u})]})},Zt={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","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Un["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Un["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:Un.support,gtmType:"concierge-email-click"},business:{email:Un.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 Gn="footer_",Ha="SiteFooter",Fc=({group:e})=>{const t=Zt[e].order||[];let n=!1;return"text"in Zt[e]&&(n=Zt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${Gn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Zt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Ha,"data-gtm-event-type":i,...s,children:c.jsx(ie.FormattedMessage,{id:`${Gn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ie.FormattedMessage,{id:`${Gn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${Gn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ha,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Lo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Ja,{element:"hr"}),c.jsx(fo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ha,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Fc,{group:e}),Object.keys(Zt[e]).includes("child")&&c.jsx(Fc,{group:Zt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Zt.social.order)&&Zt.social.order.map(e=>{const t=Zt.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ha,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${Gn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${Gn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ie={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===yt.ACCOUNT&&t===!1&&n[yt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Ie.handlerCalled[e]&&i-Ie.handlerCalled[e]<500)return;Ie.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 yt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case yt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case yt.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=Ic(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?Ie.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 yt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ie.findFirstChild(u.children,"id",yt.SITE);s=Ie.findFirstChild(d.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case yt.ACCOUNT:if(o=Ie.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ie.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(Ie.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ie.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ie.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ie.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},qr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-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:{menuId:"account-navigation",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:"/api/next-ui/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Va=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ie.useIntl(),o=Ic(qr,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,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let k=o.gtmType||`${e}-click`;if(k.includes(".")){const _=k.split("."),w=_[_.length-2];k=`${w==="topics"?`${w}-`:""}${_[_.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":k,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},x={};if(f&&(b={...b,"aria-current":"page"}),m){const k=o.menuId||e,_={onClick:w=>Ie.events.onClick(w,{id:k,callback:a,isOpen:r[k]}),onFocus:()=>Ie.events.onFocus({id:k}),onBlur:()=>Ie.events.onBlur({id:k,callback:a}),onMouseLeave:()=>Ie.events.onBlur({id:k,callback:a}),onMouseEnter:()=>Ie.events.onMouseEnter({id:k,callback:a})};v={..._,id:k===yt.SITE?yt.SITE:yt.ACCOUNT},n&&(g&&(x={..._,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&Ie.events.onClick(w,{id:k,callback:a,isOpen:r[k]})},"aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),v={...v,hidden:k in r?!r[k]:!0}),g||(v={...v})}return c.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...b,children:[p?y.createElement(d?Ee:"a",p,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...x,children:[s.formatMessage({id:h}),c.jsx(Ne,{children:s.formatMessage({id:`header_menu_${r[yt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...v,children:o.order.map(k=>{if(!o[k])return null;const _={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[k].order?c.jsxs("li",{className:V({[o[k].className]:o[k].className}),children:[s.formatMessage({id:`${h}_${k}`}),c.jsx("ul",{children:o[k].order.map(w=>c.jsx(Va,{id:`${e}.${k}.${w}`,..._},w))})]},k):c.jsx(Va,{id:`${e}.${k}`,..._},k)})})]},e)};const Gw={height:67,height_desktop:83};var yt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(yt||{});const zo=({showNavigation:e=!0})=>{const t=ie.useIntl(),n=y.useContext(it),r=Pn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Wr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),Wc({scrollPosition:Gw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=h.current.menus;!i&&v["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,x,k=!1)=>{Ie.handleMenus({id:v,value:x,menus:h.current.menus,dispatch:o,forceHandle:k})},m=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(x=>{h.current.menus[x]&&p(x,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var x;(x=document.getElementById("header"))==null||x.removeEventListener("keydown",g)}},[]),er(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),er(()=>{u["account-navigation"]&&Ie.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ne,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(gh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Ne,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:qr.order.map(v=>c.jsx(Va,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:V({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Ne,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(fo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Ie.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ie.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Ie.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ne,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(mn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:qr.buttons.order.map(v=>c.jsx(Va,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:V("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const Qw=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(zo,{}),c.jsx("div",{id:"content",children:c.jsx(hn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Lo,{})]})},yh=({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:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,g=Lc(),[f,b]=y.useState(""),v=F=>{const{detail:{message:S}}=F;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const x=Ca(e,{locale:o}),k=Ca(t,{locale:o}),_=Ca(n,{locale:o}),w={};return d!=="default"&&(w[d]=!0),h!=="default"&&(w[h]=!0),p!=="default"&&(w[p]=!0),c.jsx(Zh.ErrorBoundary,{onError:r,fallback:c.jsx(Qw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:V(s,w,{"has-footer":u}),children:[c.jsx(zo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[k&&c.jsx("div",{className:V("additional-content prepended",{"large-modal":m==="large"}),children:k}),y.createElement(d==="bold"?oo:"div",{id:"content",children:x,className:V({"large-modal":m==="large"})})]}),_&&c.jsx("div",{className:"additional-content appended",children:_}),u&&c.jsx(Lo,{}),c.jsx(bh,{})]}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Bc={default:"tags_",headerTopics:"header_topics_topics_"},ss={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"},Jw={getTagDetails:e=>{if(e.includes("topic_")){if(e=ss.topic[e.replace("topic_","")],e){const t=qr.topics.topics[e].href;return t?{id:e,href:t,text:`${Bc.headerTopics}${e}`}:null}return null}return ss[e]?(e=ss[e],{id:e,text:`${Bc.default}${e}`}):null}};const Xw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ie.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Jw.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:V("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};var dt=(e=>(e.COMMUNITIES="communities",e.PLATFORM="platform",e))(dt||{});const eE=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",className:u=""})=>{const d=ie.useIntl(),h="membersList",p=y.useContext(it),[m,g]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:V("members-list",u),children:[c.jsxs("h1",{children:[d.formatMessage({id:h}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(Qt,{member:p,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:n||""},{scope:dt.PLATFORM,area:"all"}]}}),c.jsx(fn,{href:"/profiles/me",className:"text-small",onClick:f=>{f==null||f.preventDefault(),f==null||f.stopPropagation(),g(!0)},children:d.formatMessage({id:`${h}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((f,b)=>c.jsxs("li",{children:[c.jsx(Qt,{member:f,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:n||""},{scope:dt.PLATFORM,area:"all"}]}}),f.isAdmin&&c.jsx(Gt,{children:d.formatMessage({id:`${h}_admin`})})]},b))]}),a&&c.jsx(Hr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(fi,{form:s,showModal:m,content:{title:d.formatMessage({id:`${h}_modal_title`})},functions:{onClose:()=>{g(!1)}}}):c.jsx(c.Fragment,{})]})},tE={showForm:!1},di=y.createContext(tE),Dh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(di.Provider,{value:{...t,updateConversation:n},children:e})},Ys=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Kr=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"},nE=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ie.useIntl();return t?c.jsx("small",{children:St(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},rE=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ie.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Ne,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:St(a.formatMessage,`${t}label_action`,r,"action")})};let ga=null;const Je="discussion_form_",Zr=({id:e,parentId:t,content:n={type:"response",slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},isCommunity:u=!1,functions:d,data:h={},gtmContext:p="DiscussionForm"})=>{var Se,We,Ue;const m=ie.useIntl(),g=y.useContext(it),[f,b]=y.useState(""),{isLoading:v=!1,isInWrapper:x=!1,isInOverlay:k=!1,isAutoFocused:_=!1,isEditing:w=!1,hasTitleField:F=!1,isPrepopulated:S=!1,showTitle:q=!1,showGuidelines:N=!0,showDivider:z=!1,showSuccessMessage:I=!0}=a||{},{onChange:A=()=>{},create:E=()=>{},handleSaveEdit:j=()=>{},handleCancel:R=()=>{},callback:W=()=>{},onMention:H=()=>{},listMembers:G=()=>Promise.resolve([]),clickMentionFallback:ne=()=>{},props:C={create:{projectNames:["questions-answers"]}}}=d,[L,ee]=y.useState({title:F&&F.text||"",body:w&&w.text||S&&S.text||""}),[B,T]=y.useState(l.error||!1),[O,$]=y.useState(!1);if(y.useEffect(()=>{u&&!w&&S&&S!==L.body&&ee({...L,body:S.text||""})},[S]),v)return c.jsx(At,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const U=Be=>{ee({...L,body:Be}),A({body:Be});let Te;!g||!g.id?Te=St(m.formatMessage,`${Je}error_loggedOut`,n.type,"action"):r?s>0&&Be.length>=s&&(Te=`${Je}error_tooLong`):Te=St(m.formatMessage,`${Je}error_noPermission`,n.type,"action"),Te?T(Te):B&&T(!1)};let re=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const Be=((Se=n.slugs)==null?void 0:Se.reply)||((We=n.slugs)==null?void 0:We.answer)||((Ue=n.slugs)==null?void 0:Ue.question)||"";Be&&(re=`${re}-${Be.slice(-15)}`)}e&&(re=`${e}-${re}`);const X=async()=>{if(!g||!g.id||!r||ve)return;ga&&clearTimeout(ga),$("submitting");const Be=window.location.pathname;try{let Te;switch(n.type){case"post":Te=await E({title:L.title,content:L.body});break;case"question":Te=await E({title:L.body,authorId:g&&g.id,...C==null?void 0:C.create});break;case"response":Te=await E({questionSlug:n.slugs.question},{body:L.body,authorId:g&&g.id,contentPath:Be});break;case"reply":Te=await E({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:L.body,authorId:g&&g.id,contentPath:Be});break;default:break}await sm(1e3),W&&await W(Te),ga=setTimeout(()=>{ee({title:"",body:""}),$("submitted"),b(St(m.formatMessage,`${Je}success`,n.type,"action"));const De=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(De),ae()},500)}catch(Te){const De=Te;let Re=`${Je}error`;De!=null&&De.message.includes("entry already exists")&&(Re=St(m.formatMessage,`${Je}error_alreadyExists`,n.type,"action")),De!=null&&De.message.includes("429")?Re=St(m.formatMessage,`${Je}error_tooMany`,n.type,"action"):De!=null&&De.message.includes("400")&&(Re=`${Je}error`),T(Re),ae()}},ae=()=>{ga=setTimeout(()=>{T(!1),$(!1),b("")},5e3)},he=!L.title||!au(L.title),Q=!L.body||!au(L.body);let ve=Q;F&&(ve=he&&Q);const pe=O==="submitting",_e=[{component:rE,props:{formID:re,intlPath:Je,showLabel:F!==!1,type:n.type}},{component:dh,props:{id:`${re}-input`,value:O==="submitting"&&!B?"":L.body,placeholder:i||St(m.formatMessage,`${Je}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:U,onMention:H,listMembers:G,clickMentionFallback:ne},data:h,autoFocus:w!==!1||_&&!F,"aria-invalid":!!B,"aria-errormessage":"error-message"}},{component:nE,props:{intlPath:Je,showGuidelines:N,type:n.type,gtmContext:p}}];z&&_e.push({component:Ut}),F&&_e.unshift({id:"title",type:"text",value:F.text,limit:250,autoFocus:_,label:m.formatMessage({id:`${Je}titleField_label`}),placeholder:m.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Be=>{ee({...L,title:Be}),A({title:Be})}},validation:[{condition:()=>ve,error:m.formatMessage({id:`${Je}titleField_error`})}]});let Fe=!g||!g.id||!r||ve||pe;return w&&(F?Fe=Fe||L.body===w.text&&L.title===F.text:Fe=Fe||L.body===w.text),c.jsxs(c.Fragment,{children:[c.jsxs(en,{id:re,className:V("discussion-card discussion-form",{"no-styling":x&&w}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:w&&!pe||l.cancel},functions:{onSuccess:async()=>{if(w){$("submitting"),j(L);return}await X()},onCancel:R},fields:_e,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`${w?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:Fe,text:{default:!w&&(o!=null&&o.submit)?o==null?void 0:o.submit:m.formatMessage({id:`${Je}${w?"save":"post"}`}),submitting:m.formatMessage({id:`${Je}${w?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!g||!g.id||!L.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:m.formatMessage({id:`${Je}cancel`})},gtm:{context:p,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[q&&!w&&["question"].includes(n.type)&&c.jsx("h2",{children:St(m.formatMessage,`${Je}title`,n.type,"action")}),c.jsx(Qt,{member:g?{...g,link:!1}:"community",gtmContext:p,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}})]}),O==="submitted"&&I&&c.jsx(Or,{className:"success","data-testid":"success",children:St(m.formatMessage,`${Je}success`,n.type,"action")}),B&&c.jsx(Or,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof B=="string"?B.includes(" ")?B:m.formatMessage({id:B},{action:m.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):B}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,children:f})]})},aE=Object.freeze(Object.defineProperty({__proto__:null,default:Zr},Symbol.toStringTag,{value:"Module"})),iE=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),sE=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Ka=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:V("discussion-button",t),variant:"tertiary",icon:e,...n});let Tr=!1;const os=()=>{Tr!==!1&&(clearTimeout(Tr),Tr=!1)},us=5;let ls=null;const Ch=({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=ie.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,p]=y.useReducer(Wr,d),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=h;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const x=y.useMemo(()=>sE(n,us),[n]),k=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Tr)return os(),!1;if(os(),f||!s)return!1;Tr=setTimeout(_,350)},_=async()=>{if(os(),f||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const q=iE(i.slugs);g?await l(q):await o({...q,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{ls=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},F=()=>{ls&&clearTimeout(ls)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},c.jsxs(c.Fragment,{children:[c.jsx(Ka,{className:V("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:k,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ne,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>w,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),F(),p([{type:"showLikers",value:!0}]);const q=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(q){const z=q.querySelector("li:first-child a");z&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{z.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ne,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Mn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[x.map((S,q)=>{if(typeof S=="string")return null;const N={};return v!==q&&(N.tabIndex=-1),c.jsx("li",{"data-index":q,children:c.jsx(fn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:z=>z==null?void 0:z.stopPropagation(),onFocus:()=>F(),onKeyDown:z=>{var R,W,H,G;if(!z||!["ArrowUp","ArrowDown"].includes(z.key||""))return;z.stopPropagation(),z.preventDefault();const I=z.key==="ArrowUp"?"up":"down",A=(R=z.currentTarget)==null?void 0:R.parentElement;let E=A==null?void 0:A.nextElementSibling;if(I==="up"){const ne=A==null?void 0:A.previousElementSibling;ne?E=ne:(E=(W=A==null?void 0:A.parentElement)==null?void 0:W.lastElementChild,(E==null?void 0:E.getAttribute("data-index"))==="-1"&&(E=E==null?void 0:E.previousElementSibling))}else(!E||(E==null?void 0:E.getAttribute("data-index"))==="-1")&&(E=(H=A==null?void 0:A.parentElement)==null?void 0:H.firstElementChild);if(!E)return;const j=(E==null?void 0:E.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(G=E==null?void 0:E.querySelector("a"))==null||G.focus()},...N,children:S.name?S.name:c.jsx("span",{className:"deleted-user",children:u.formatMessage({id:"member_deleted"})})})},S.id||window.btoa(S.name||""))}),t>us&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-us})})]})})]})]}))},cs=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return c.jsx("blockquote",{...r,children:e})},oE=280,qo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Xn(e,typeof t=="number"?t:oE):e;a=a.trim();const i=`<br>
|
|
164
164
|
|
|
165
|
-
`;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Xc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const uE=3e3,lE=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=se.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Va,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},uE)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,screenreaderText:n.formatMessage({id:r})}),c.jsx(Mn,{className:Z({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})},Nt="discussion_",cE=195;let ga=null;const Zr=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s={actionBar:!1,comments:!1,likes:!1},functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,styling:{showShareLinkButton:m=!1}={},setFocus:g=!1,isCommunity:f=!1,badges:b})=>{var Ve,We,Be,Se,De,Re,ze,Y;const v=se.useIntl(),w=y.useContext(it),A=y.useContext(ci),{createContent:_=async()=>{},deleteContent:x=async()=>{},updateContent:T=async()=>{}}=o.content||{},{createLike:S=()=>{},deleteLike:z=()=>{}}=o.likes||{},{openComments:M=()=>{}}=o.comments||{},{listMembers:q=()=>Promise.resolve([]),clickMentionFallback:I=()=>{}}=o.mentions||{},{author:B,canLike:E,createdAt:j,id:N,likes:W=0,userLiked:H,comments:G=0,mentions:re}=t,C=w&&w.id&&typeof B!="string"&&B.id&&B.id===w.id||!1,L=typeof E=="boolean"?E:!0,ee=C&&(!t.createdAt||am(t.createdAt,10,"seconds")),F=y.useRef(null),[k,$]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[R,U]=y.useState(!1),[ae,X]=y.useState(ee?"highlighted":"default"),[ie,fe]=y.useState("");y.useEffect(()=>{const te=F.current;if(!(!te||ae==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,Q),te.addEventListener("transitionend",ve),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,Q),te.removeEventListener("transitionend",ve)}},[]),y.useEffect(()=>{$({...k,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const le=await zo(k.body,p,re,q);$({...k,postBody:le})})()},[k.body,re]);const Q=()=>{setTimeout(()=>{X("fading")},1e3)},ve=({propertyName:te})=>{te==="background-color"&&X(le=>(le==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,Q),F.current&&F.current.removeEventListener("transitionend",ve)),le==="fading"?"default":le))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||k.postBody===""&&t.title==="")return c.jsx(Bt,{className:"discussion-card"});const pe=async({title:te,body:le})=>{te||(te=""),le||(le=""),fe("");try{if(!ps(te,k.title)||!ps(le,k.body)){const me=t.type==="question"?{title:le}:{title:te,body:le};await T(Bc(t.slugs),me)}$({...k,title:te,body:le,isEditing:!1,didEdit:!0})}catch{fe(`${Nt}form_error`)}},_e=()=>{if(A&&A.updateConversation){const te={showForm:!0},le=t.author;le&&le.id&&(f&&(te.prepopulateForm=`@{{${le.id}}}`),te.mentionData={id:le.id,name:le.name}),A.updateConversation(te)}setTimeout(()=>{var Ze,Ye,rt;const le=`reply-form-${(t.type==="answer"?t.slug:((Ze=t.slugs)==null?void 0:Ze.reply)||((Ye=t.slugs)==null?void 0:Ye.answer)||((rt=t.slugs)==null?void 0:rt.question)||"").toLowerCase().slice(-15)}`,me=document.getElementById(le),xe=document.getElementById(`${le}-input`);xe&&xe.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},Fe=async()=>{U(!1);try{await x(Bc(t.slugs))}catch{fe("delete-error")}},Te=[{text:v.formatMessage({id:`${Nt}moreMenu_report`}),onClick:te=>{te.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Nt}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${Nt}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&&C&&Te.push({text:v.formatMessage({id:`${Nt}moreMenu_edit`}),onClick:()=>$({...k,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${Nt}moreMenu_delete`}),onClick:te=>{te.preventDefault(),te.stopPropagation(),U(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Td(`delete-${t.slug}-modal`,R)}),r&&o.pins&&Te.push({text:v.formatMessage({id:`${Nt}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),g&&((Ve=F==null?void 0:F.current)==null||Ve.focus(),(We=F==null?void 0:F.current)==null||We.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:Z("discussion-post",u,{[ae]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!k.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:F,tabIndex:g?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:te=>{if(!l.post||k.isEditing)return;te.preventDefault(),te.stopPropagation(),ga&&clearTimeout(ga),ga=setTimeout(()=>{window.location.href=l.post},150);const le=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:ga}});document.dispatchEvent(le)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:N||t.slug,className:Z("discussion-card",t.type,{editing:k.isEditing,"has-link":l.post&&!k.isEditing}),children:[!k.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Qt,{member:B,additionalContent:{createdAt:j,didEdit:k.didEdit},className:typeof B!="string"&&B.id===i?"highlighted":"",gtmContext:d,gtmType:"profile-click",badges:b}),t.pinned&&c.jsx(Gt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ne,{children:"Pinned Post"})})]}),k.isEditing?c.jsx(Kr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:k.title!==""?{text:k.title}:!1,isEditing:{text:k.body},isPrepopulated:!1},isCommunity:f,maxLength:t.type==="question"?250:5e4,forceShow:{error:ie!==""&&ie!=="delete-error"?v.formatMessage({id:ie},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:pe,handleCancel:()=>{fe(""),$({...k,isEditing:!1})},listMembers:q,clickMentionFallback:I},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(k==null?void 0:k.title)&&c.jsx("p",{className:"content-title",children:k==null?void 0:k.title}),k.postBody.length>cE?c.jsx(sd,{text:k.postBody,markdownOptions:{overrides:{a:Cs,blockquote:{component:cs}}}}):c.jsx(Fn,{options:{overrides:{a:Cs,blockquote:{component:cs}}},children:k.postBody})]}):c.jsxs(c.Fragment,{children:[(k==null?void 0:k.title)&&c.jsx("p",{className:"content-title",children:k==null?void 0:k.title}),c.jsx(Fn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:cs}}},children:k.postBody})]}),!k.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:Z("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(Ch,{element:"li",likes:W,isShort:!1,userLiked:H,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:L,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:S,deleteLike:z}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Va,{onClick:te=>{te.preventDefault(),te.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof M=="function"&&M()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${Nt}comments_screenReader`},{count:G}),children:v.formatMessage({id:`${Nt}comments`},{count:G})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Va,{styling:{muted:!0},onClick:_e,icon:{icon:"speech-bubble_square"},children:v.formatMessage({id:`${Nt}reply`})})}),m&&c.jsx(lE,{url:(Be=t.slugs)!=null&&Be.reply?`${window.location.origin}${(Se=t.slugs)==null?void 0:Se.question}/${(De=t.slugs)==null?void 0:De.answer}#${(Re=t.slugs)==null?void 0:Re.reply}`:`${window.location.origin}${(ze=t.slugs)==null?void 0:ze.question}/${(Y=t.slugs)==null?void 0:Y.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),c.jsx(Sd,{element:"li",id:`more-${t.slug}`,options:Te})]})]}),h,c.jsx(pn,{id:`delete-${t.slug}-modal`,isOpen:R,functions:{onOpen:()=>{},onClose:()=>U(!1)},forceShow:{error:ie==="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:()=>U(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Fe,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(se.FormattedMessage,{id:"discussion_delete_text",values:{p:te=>c.jsx("p",{children:te}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const dE=y.lazy(()=>Promise.resolve().then(()=>r_)),fE=65,xh=({forceShow:e,form:t,className:n})=>{const r=se.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(it)||"community",l=ti(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||td("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await zo(p.title||p.body||"",fE,p.mentions);m(w=>({...w,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const w=b;w.preventDefault(),w.stopPropagation();const _=w.target.closest("a");v=_&&_.getAttribute("href")}h(w=>({...w,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:Z("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(mn,{name:l.name,src:l.image,alt:""}),c.jsx(Fn,{className:Z("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Et,blockquote:Et,br:Et,em:Et,li:Et,ol:Et,p:Et,s:Et,span:Et,strong:Et,ul:Et}},children:f})]}),c.jsxs(Ur,{children:[c.jsx(dE,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(pn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},hE=y.lazy(()=>Promise.resolve().then(()=>aE)),qo=({isCard:e=!1,form:t,parentId:n,membershipRequiredToPost:{isMember:r,required:a,join:i,leave:s,notMemberStateText:o}})=>{if(a&&!r)return c.jsx(hn,{text:o,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(lo,{isShort:!0,functions:{join:i,leave:s}})}});const{content:l,functions:u,meta:d,...h}=t,p={content:{type:(l==null?void 0:l.type)||"reply",slugs:(l==null?void 0:l.slugs)||{}},functions:{...u,create:(u==null?void 0:u.create)||(()=>{})},parentId:n,meta:{...d,isEditing:(d==null?void 0:d.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...h,id:`add-post-${h.id||""}`};return e?c.jsx(xh,{form:p}):c.jsx(hE,{...p})},Wo=({form:e})=>{const t=y.useContext(it),n=se.useIntl(),[r,a]=y.useState(!1),i=()=>{hm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(fi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const ds="discussion_responses_",wh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=se.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${ds}title`},{action:r.formatMessage({id:`${ds}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Tt(r.formatMessage,`${ds}empty`,e,e)})]})};const Eh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=se.useIntl(),s=y.useContext(ci),o=Da(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:Z("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Hr,{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&&c.jsx(Kr,{...r})]})},mE="post",pE="reply",_h="00000000-0000-0000-0000-000000000000";function Uo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Ho({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 gE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function kh(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 bE({title:e,content:t}){return{title:e,content:t,id:_h,time:new Date().toISOString(),verb:mE}}function Ac({activity:e,user:t}){return{...e,actor:kh(t),...gE()}}function Ka({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 Fh({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 Za({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Bh({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function yE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:_h,kind:pE,parent:t||""}}function Tc({reply:e,user:t}){const n=kh(t);return{...e,user_id:n.id,user:n,...vE()}}function Sc({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 DE({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 Ah=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let jc,fs=0;const Th=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(jc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),fs=0;return}fs++,!(fs>10)&&(jc=setTimeout(()=>{e(t)},50))}},ir=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}),Ut=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}),Vo=Object.freeze({actor:`SU:${ir.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"}),CE=Object.freeze({actor:`SU:${Ut.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"}),xE=Object.freeze({actor:`SU:${ir.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"}),wE=Object.freeze({actor:`SU:${Ut.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:Vo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ut.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ut.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Vo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ut.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ut.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:Ut.id,user:{id:Ut.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Vo.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:CE.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:Ut.id,user:{id:Ut.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xE.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function EE({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=Ac({activity:bE(o),user:i});return Oc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Ac({activity:o,user:i});r.setQueryData(a,Oc(d,u,!0)),setTimeout(()=>{Ah(d.id,"activity")},0)}});return s}function _E({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=jn(a,s);return o&&(o.content=i),s}),onError:n});return r}function kE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,rankingMethod:u}){const d=qe.useQueryClient(),h=ei(),p={queryClient:d,queryKey:l},m={mutationHandlers:{error:Uo(p),mutate:Ho(p)},user:h,...p},g=EE({...m,mutationFn:e}),f=_E({...m,mutationFn:t}),b=FE({...m,mutationFn:n}),v=TE({...m,mutationFn:a}),w=SE({...m,mutationFn:i}),A=AE({...m,mutationFn:s}),_=jE({...m,mutationFn:o}),{activities:x,...T}=BE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:x,mutations:{create:g,edit:f,remove:v,like:b,unlike:w,pin:A,unpin:_},user:h,...T}}function FE({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=jn(s,o);return l&&Ka({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Ka({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function BE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:PE(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function AE({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=jn(s,o);return l&&Za({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Za({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>OE(a,i)),onError:n});return r}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Fh({activity:o,user:r}),s}),onError:n});return a}function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Bh({activity:o,user:r}),s}),onError:n});return a}function Oc(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 jn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function OE(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 PE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const ME=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=$m(no.COMMUNITY_RANKING),d=se.useIntl(),[h,p]=y.useState("community_feed_live"),[m,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:w,isLoading:A,mutations:{create:_,edit:x,remove:T,like:S,unlike:z,pin:M,unpin:q}}=kE({queryKey:[e,t,"activities",h],queryFns:a,rankingMethod:h});y.useEffect(()=>{u&&g(m.concat(u))},[u]);const[I,B]=y.useState(null),E=()=>{B(f.length),v()};return Th(),b?c.jsx(hn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(qo,{isCard:!0,parentId:t,form:{content:{type:"post",slugs:{}},functions:{create:_,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(en,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:m.map(({id:j,label:N})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${N}`})})),initialValue:h,functions:{onChange:j=>{p(j);const N=m.find(H=>H.id===j);if(!N)return;const W=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"community_sortSuccess"},{order:d.formatMessage({id:`activitiesFeed_rankingMethod_${N.label}`})})}});document.dispatchEvent(W)}},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,N)=>{var R,U,ae;const{id:W,own_reactions:H,latest_reactions:G,reaction_counts:re,mentioned_users:C,total_replies:L}=j,ee=(((R=G==null?void 0:G.like)==null?void 0:R.length)||0)>0,F=(((U=H==null?void 0:H.like)==null?void 0:U.length)||0)>0,k=F?H==null?void 0:H.like[0].id:"",$=ee?(ae=G==null?void 0:G.like)==null?void 0:ae.map(X=>{var ie,fe,Q;return{id:(ie=X==null?void 0:X.user)==null?void 0:ie.id,name:(Q=(fe=X==null?void 0:X.user)==null?void 0:fe.data)==null?void 0:Q.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(Zr,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:di(j==null?void 0:j.actor),userLiked:F,likes:(re==null?void 0:re.like)||0,comments:L||0,peopleWhoLiked:$,mentions:C,pinned:(re==null?void 0:re.pin)&&(re==null?void 0:re.pin)>0||!1},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>T({activityId:W}),updateContent:(X,{body:ie})=>x({activityId:W,content:ie})},likes:{createLike:()=>S({activityId:W}),deleteLike:()=>z({activityId:W,reactionId:k})},comments:{openComments:()=>null},pins:{createPin:()=>M({activityId:W}),deletePin:()=>q({activityId:W,reactionId:G==null?void 0:G.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:N===I,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}})},W)}),!A&&c.jsx(Hr,{hasNextPage:w,loadNextPage:E,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Wo,{form:l})]})},NE={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",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},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 IE({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=Tc({reply:yE(o),user:i});return Pc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Tc({reply:o,user:i});r.setQueryData(a,Pc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Ah(d.id,"reply")},0)}});return s}function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ya(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Sh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=ei(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Uo(u),mutate:Ho(u)},user:l,...u},h=IE({...d,mutationFn:e}),p=RE({...d,mutationFn:t}),m=$E({...d,mutationFn:n}),g=zE({...d,mutationFn:a}),f=qE({...d,mutationFn:i}),{replies:b,...v}=LE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function $E({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=Ya(s,o);return l&&Sc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ya(o,l);u&&Sc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function LE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:KE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function zE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>VE(a,i)),onError:n});return r}function qE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ya(i,s);return o&&DE({reply:o,user:r}),s}),onError:n});return a}function WE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function UE(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 HE(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 Pc(e,t,n){return t?n!=null&&n.append?UE(e,t,n):HE(e,t,n):WE(e)}function Ya(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function VE(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 KE(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 ZE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=se.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:h,mutations:{create:p,edit:m,like:g,remove:f,unlike:b},user:v}=Sh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Gs([h]);const[w,A]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!w),children:s.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:l==null?void 0:l.length})}),w&&c.jsx(Eh,{loadMore:{isLoading:h,hasNextPage:d,loadNextPage:()=>u()},form:{parentId:t,content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{body:x})=>p({activityId:n,replyId:r,content:x}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(_=>{var H,G,re,C,L,ee,F;const{id:x,own_children:T,latest_children:S,children_counts:z,data:{mentioned_users:M}}=_,I=(((H=T==null?void 0:T.like)==null?void 0:H.length)||0)>0?(G=T==null?void 0:T.like)==null?void 0:G.find(k=>{var $;return(($=k==null?void 0:k.user)==null?void 0:$.id)===(v==null?void 0:v.id)}):!1,B=I?I==null?void 0:I.id:"",E=!!I,N=(((re=S==null?void 0:S.like)==null?void 0:re.length)||0)>0?(C=S==null?void 0:S.like)==null?void 0:C.map(k=>{var $,R,U;return{id:($=k==null?void 0:k.user)==null?void 0:$.id,name:(U=(R=k==null?void 0:k.user)==null?void 0:R.data)==null?void 0:U.name}}):!1,W=typeof _.data.content=="string"?(L=_==null?void 0:_.data)==null?void 0:L.content:((F=(ee=_==null?void 0:_.data)==null?void 0:ee.content)==null?void 0:F.text)||"";return c.jsx(Zr,{isCommunity:!0,content:{id:x,type:"reply",body:W,canLike:a,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:di(_==null?void 0:_.user),userLiked:E,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:N,mentions:M},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:x}),updateContent:(k,{body:$})=>m({replyId:x,content:$})},likes:{createLike:()=>g({replyId:x}),deleteLike:()=>b({replyId:x,reactionId:B})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},x)}):null})]})};const jh=({basePath:e,parentId:t,activityId:n,activityTotalReplies:r,isMember:a,functions:{reactions:i,mentions:s,join:o,leave:l},profile:u})=>{const d=se.useIntl(),{replies:h,fetchNextPage:p,hasNextPage:m,isLoading:g,mutations:{create:f,edit:b,like:v,remove:w,unlike:A},user:_}=Sh({queryKey:[e,t,n,"replies"],queryFns:i}),x=()=>{S(h.length),p()},[T,S]=y.useState(null);return Gs([g]),Th(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(wh,{type:"comment",responses:r,isLoading:g}),c.jsx(qo,{form:{content:{type:"reply",slugs:{}},functions:{create:(z,{body:M})=>f({activityId:n,content:M}),...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:d.formatMessage({id:"discussion_responses_placeholder"})},parentId:t,membershipRequiredToPost:{isMember:a,required:!0,join:o,leave:l,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),h==null?void 0:h.map((z,M)=>{var ee,F,k,$,R,U,ae;const{id:q,own_children:I,latest_children:B,children_counts:E,data:{mentioned_users:j}}=z,W=(((ee=I==null?void 0:I.like)==null?void 0:ee.length)||0)>0?(F=I==null?void 0:I.like)==null?void 0:F.find(X=>{var ie;return((ie=X==null?void 0:X.user)==null?void 0:ie.id)===(_==null?void 0:_.id)}):!1,H=W?W==null?void 0:W.id:"",G=!!W,C=(((k=B==null?void 0:B.like)==null?void 0:k.length)||0)>0?($=B==null?void 0:B.like)==null?void 0:$.map(X=>{var ie,fe,Q;return{id:(ie=X==null?void 0:X.user)==null?void 0:ie.id,name:(Q=(fe=X==null?void 0:X.user)==null?void 0:fe.data)==null?void 0:Q.name}}):!1,L=typeof z.data.content=="string"?(R=z==null?void 0:z.data)==null?void 0:R.content:((ae=(U=z==null?void 0:z.data)==null?void 0:U.content)==null?void 0:ae.text)||"";return c.jsx(Dh,{children:c.jsx(Zr,{isCommunity:!0,content:{id:q,type:"reply",body:L,canLike:a,createdAt:z==null?void 0:z.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:q},slug:q,author:di(z==null?void 0:z.user),userLiked:G,likes:(E==null?void 0:E.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>w({replyId:q}),updateContent:(X,{body:ie})=>b({replyId:q,content:ie})},likes:{createLike:()=>v({replyId:q}),deleteLike:()=>A({replyId:q,reactionId:H})},comments:{},mentions:s},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]},children:c.jsx(ZE,{basePath:e,parentId:t,activityId:n,replyId:q,isMember:a,functions:{...i,...s}}),styling:{showShareLinkButton:!0},setFocus:M===T},q)},q)}),!g&&c.jsx(Hr,{hasNextPage:m,loadNextPage:x,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Wo,{form:u})]})};function YE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function GE({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 QE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=qe.useQueryClient(),l=ei(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Uo(u),mutate:Ho(u)},user:l,...u},h=YE({...d,mutationFn:t}),p=JE({...d,mutationFn:n}),m=XE({...d,mutationFn:r}),g=e_({...d,mutationFn:a}),f=t_({...d,mutationFn:i}),{activity:b,...v}=GE({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:g,unpin:f},user:l,...v}}function JE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ka({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ka({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function XE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Fh({activity:s,user:r}),s)),onError:n});return a}function e_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Za({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Za({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function t_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Bh({activity:s,user:r}),s))),onError:n});return a}const n_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:h})=>{var E,j,N,W,H,G;const p=se.useIntl(),{activity:m,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:w,pin:A,unpin:_}}=QE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(Bt,{style:{height:"400px"}});if(g||!m)return c.jsx(hn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:x,latest_reactions:T,mentioned_users:S}=m,z=(((E=T==null?void 0:T.like)==null?void 0:E.length)||0)>0,M=(((j=x==null?void 0:x.like)==null?void 0:j.length)||0)>0,q=M?x==null?void 0:x.like[0].id:"",I=z?(N=T==null?void 0:T.like)==null?void 0:N.map(re=>{var C,L,ee;return{id:(C=re==null?void 0:re.user)==null?void 0:C.id,name:(ee=(L=re==null?void 0:re.user)==null?void 0:L.data)==null?void 0:ee.name}}):!1,B=m==null?void 0:m.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Zr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:m==null?void 0:m.title,body:m==null?void 0:m.content,canLike:r,createdAt:(m==null?void 0:m.time)||"",slugs:{question:`${e}/${t}`,answer:m==null?void 0:m.id},slug:n,author:di(B),userLiked:M,likes:((W=m==null?void 0:m.reaction_counts)==null?void 0:W.like)||0,comments:(m==null?void 0:m.total_replies)||0,peopleWhoLiked:I,mentions:S,pinned:((H=m==null?void 0:m.reaction_counts)==null?void 0:H.pin)&&((G=m==null?void 0:m.reaction_counts)==null?void 0:G.pin)>0||!1},originalAuthorId:B==null?void 0:B.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(re,{title:C,body:L})=>b({title:C,content:L})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>w({activityId:n,reactionId:q})},comments:{openComments:()=>{}},pins:{createPin:()=>A({activityId:n}),deletePin:()=>{var re;return _({activityId:n,reactionId:(re=T==null?void 0:T.pin)==null?void 0:re[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},n),c.jsx(jh,{basePath:e,parentId:t,activityId:n,activityTotalReplies:(m==null?void 0:m.total_replies)||0,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:h})]})};const Oh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=se.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(pn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:Z("discussion-form-modal",a),children:c.jsx(Kr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const w=g||{};w[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(A=>({...A,mentions:w}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},r_=Object.freeze(Object.defineProperty({__proto__:null,default:Oh},Symbol.toStringTag,{value:"Module"}));const a_=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=se.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(pn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Z("invite-modal",e,{success:!!n}),children:c.jsx(mh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const fi=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=se.useIntl(),[l,u]=y.useState(td("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(pn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:Z("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ph,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},i_=Object.freeze(Object.defineProperty({__proto__:null,default:fi},Symbol.toStringTag,{value:"Module"}));const s_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(mn,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(pn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Fn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const o_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:Z("testimonial-block",a),children:[c.jsx(zt,{className:"testimonial",children:n}),r?c.jsx(Qt,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:Z("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:Z("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),u_=y.memo(o_);const l_=({items:e=[],selector:t="",className:n=""})=>{const r=se.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+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&&c.jsxs(Ot,{variant:"subtle",className:Z("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const hi=({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=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,g=Math.round(m),f=`${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:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:Z("time-to-complete",a),"aria-label":u,children:l})};const c_=({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",c.jsx(ur,{...n,className:Z("banner",e),image:{...t,aspect:"banner"}})):null;const d_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],f_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.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:w}=t[b];if(w&&d_.includes(w.toLowerCase()))return;p[b]={text:v,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&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"})}),c.jsx(bn,{className:Z("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:w=""}=p[b];return b==="text"?c.jsx(Fn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(w,{key:b,className:b},v)}return null}),l,m&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Z({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(ur,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},h_=y.memo(f_);const m_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(bn,{className:Z("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const p_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Fn,{children:n}):n;return c.jsxs(bn,{className:Z("highlight-section",t),children:[r&&c.jsx("div",{className:Z("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(ur,{image:{...r,description:""}})}),c.jsx("div",{className:Z("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:Z("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},g_=y.memo(p_);const v_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:Z("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{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})]}),b_=({type:e,data:t})=>{const n=se.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&bs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Js(d)});if(o)return c.jsx(Gt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&bs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},y_={title:66,text:3e3,secondaryText:1e3,partner:34},Ga={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"}},D_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=se.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=Ga[p])!=null&&f.gtmEvent&&(m=Ga[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),w=async A=>{if(A.preventDefault(),A.stopPropagation(),!(v||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{s(x=>({...x,loading:!1}))}}};return c.jsx("p",{className:Z("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"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};function C_({buildMemberData:e,communitySlug:t}){const n=se.useIntl(),r=y.useContext(it),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Gt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const Ko=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var I,B;const u=se.useIntl(),d=y.useContext(it),h=!!(d!=null&&d.id),p=y.useRef(null),[m,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(E=>{g({data:E,isLoading:!1})}).catch(()=>g(E=>({...E,isLoading:!1})))},[a,h,n]);const{data:f,isLoading:b}=m;if(b||!f)return c.jsx(Bt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Ga[v])return c.jsx(Bt,{element:"li",className:"card-wrapper"});const{basePath:w="",className:A,length:_,gtmEvent:x}=Ga[v];let T=f.slug?`${w}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(T=f.slug);const S=E=>{T&&(E.preventDefault(),E.stopPropagation(),window.location.href=T)},z={...y_,..._};let M={className:"card"},q={};return T&&(q={href:T,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${x}-click`,"data-testid":"link"},f.openInNewTab&&(q.target="_blank"),M={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${x}-click`}),l&&(M={...M,tabIndex:"0"},(I=p==null?void 0:p.current)==null||I.focus(),(B=p==null?void 0:p.current)==null||B.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:Z("card-wrapper text-medium",A,t,{"has-link":T,"no-link":!T,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...M,ref:p,children:[c.jsx(rd,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&im(f==null?void 0:f.createdAt,60)&&c.jsx(Gt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(Gt,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Qc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(Gt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(ur,{image:{...f.banner,description:""}})]}):A==="people"?c.jsx(mn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(io,{contributors:{data:f.contributors},styling:{size:"small",showGap:A!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Xn(f.partner[0],z.partner)}),["title","text","secondaryText"].map(E=>{const j=f[E];if(!j)return null;const N=Vc(E),W={key:E,className:N,"data-testid":N},H={wrapper:"p",forceWrapper:!0,forceInline:!0},G=Xn(j,z[E]);return["title","text"].includes(E)&&T?(H.wrapper="a",c.jsx("p",{...W,children:c.jsx(zt,{options:H,...q,children:G})})):c.jsx(zt,{options:H,...W,children:G})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(C_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(b_,{type:A||"",data:f}),c.jsx(D_,{data:f,cta:i,link:T||"",gtmContext:s})]})})};const Ph=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:Z("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(Ko,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),x_=(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},w_=({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 y.createElement(a,{className:Z("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.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 hs={fourCards:1024,threeCards:769,twoCards:480};let va=null,ms=null;const E_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=se.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[w,A]=y.useState(""),_=t.length,x=Math.ceil(_/p),T=y.useRef(null),S=Pn(!0,!0,T==null?void 0:T.current);y.useEffect(()=>{let E=1;S&&(S>=hs.fourCards?E=4:S>=hs.threeCards?E=3:S>=hs.twoCards&&(E=2),E>_&&(E=_)),h(j=>({...j,cardsPerPage:E,isLoading:!1}))},[S,_]);const z=(E="next")=>{ms&&clearTimeout(ms);let j=b;if(typeof E=="string")if(E==="next")if(b<x-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=E;A(""),f(W=>({...W,currentPage:j,loadedPages:[...new Set([...v,j])]}));const N=()=>{const W=j*d.cardsPerPage,H=W+d.cardsPerPage;return t.slice(W,H).length};ms=setTimeout(()=>{A(l.formatMessage({id:`${u}ariaLive${typeof E=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof E=="string"?E:"next"}`}),slide:typeof E=="string"?1:E+1,count:N()}))},500)},M=E=>{va=E.touches[0].clientX},q=E=>{if(va===null)return;const j=E.touches[0].clientX,N=va-j;N>5?z("next"):N<-5&&z("previous"),va=null},I={"--width":`${S||0}px`,"--total-cards":_,"--cards-per-page":p,"--page":b};if(m)return c.jsx(eo,{layout:`carousel${a?"-with-title":""}`});const B=(E,j)=>{var W;let N=null;return(W=E==null?void 0:E.sys)!=null&&W.id?N=`card-${E.sys.id}`:E!=null&&E.slug?N=`card-${E.slug}`:[n[j],E.contentType].includes("customCard")&&(N=`card-${window.btoa(`${E.title} ${E.createdAt}`)}-${j}`),N};return c.jsxs("section",{ref:T,className:Z("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(w_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:M,onTouchMove:q,style:I,"data-testid":"carousel-list",children:t.map((E,j)=>{let N=B(E,j);return N&&x_(j,p,b,v)?c.jsx(Ko,{id:N,card:{...E,contentType:n[j]},buildCardData:r,gtmContext:s,...o},N):(N=N||`${e}-card-${j}`,c.jsx(Bt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},N))})}),x<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:E=>{E.preventDefault(),E.stopPropagation(),z("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(x)].map((E,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:Z("page-indicator",{selected:j===b}),onClick:N=>{N.preventDefault(),N.stopPropagation(),z(j)},children:c.jsx(Ne,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:j+1,total:x})})})},`page-indicator-${j}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:E=>{E.preventDefault(),E.stopPropagation(),z("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=x-1})})]}),c.jsx(Ne,{"aria-live":w===""?"off":"polite",showOnFocus:!1,children:w})]})]})},__=({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 d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(eo,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Wt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(E_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Wt,{})]},`carousel-${d}`)});const k_=({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:d=!1}=s;return y.createElement(e,{className:Z("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(hi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Xs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Mh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:Z("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Nh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=se.useIntl(),o=Ja(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Zc(a||"");return c.jsxs("small",{className:Z("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:Z("type",n),children:o})," ",t>0&&!r&&c.jsx(hi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const F_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=se.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(Xa,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(hi,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:w,isIntroduction:A,optional:_,slug:x,subsectionId:T,title:S,type:z})=>{const M=a&&t||A,q={};return w&&(q.style={"--image":`url(${w})`}),c.jsx("li",{className:Z({article:b===Dr.ARTICLE,discussion:b===Dr.DISCUSSION,quiz:b===Dr.QUIZ,completed:g&&b===Dr.ARTICLE,locked:!M}),...q,children:c.jsx(fn,{href:M?`/microcourses/en/${o}/${x}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Kc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Mh,{sectionId:i,subsectionId:T,title:S,className:"course-title"})," ",c.jsx(Nh,{completionTime:f,icon:v,optional:_,type:z,children:d&&d[x]&&c.jsx("span",{className:"quiz-score",children:`${d[x]}%`})})]})})},x)})})]})};const B_=({isComplete:e=!1,onClick:t,...n})=>{const r=se.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...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:Z("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},A_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Mc=[{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 ba="notFoundError_",T_=()=>{const e=se.useIntl(),t=[];return Mc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ba}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(yh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(bn,{children:[c.jsx(Ph,{cards:Mc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ba}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ba}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ba}text`})})]})};exports.ASSETS_BUCKET=qt;exports.ActivitiesFeed=ME;exports.ActivitySection=n_;exports.AddPost=qo;exports.BadgesContext=to;exports.BadgesProvider=dd;exports.Banner=c_;exports.BannerSection=h_;exports.Breadcrumbs=Vp;exports.Buckets=Cm;exports.Button=Ee;exports.ButtonWrapper=or;exports.COURSE_CONTENT_TYPES=Dr;exports.CacheProvider=fd;exports.Card=Ko;exports.CardBlock=Ph;exports.Carousel=__;exports.CharacterLimit=fo;exports.CollapsibleSection=Xa;exports.Columns=Od;exports.CommunityDetails=Hp;exports.ContactFooter=Zw;exports.ContactForm=hh;exports.ContentTypeLabel=rd;exports.Contributors=io;exports.ConversationContext=ci;exports.CookieBanner=bh;exports.CourseProgression=k_;exports.CourseStructure=F_;exports.CustomContentBanner=m_;exports.CustomEvents=Xe;exports.DELETED_USER_ID=Sr;exports.Directory=s_;exports.DiscussionConversation=Dh;exports.DiscussionForm=Kr;exports.DiscussionFormCard=xh;exports.DiscussionFormModal=Oh;exports.DiscussionLikes=Ch;exports.DiscussionPost=Zr;exports.DiscussionThread=Eh;exports.Divider=Wt;exports.DownloadSection=Uw;exports.EMAILS=Un;exports.EditSection=Vw;exports.EmailHelperTextBox=Md;exports.EmptyStateBox=hn;exports.EnrichedUrl=Kp;exports.FeatureFlags=no;exports.Filters=Zp;exports.FlagsProvider=md;exports.Footer=$o;exports.Form=en;exports.Formatting=K;exports.Fragment=Et;exports.FullWidthSection=bn;exports.GET_STREAM_USER_PREFIX=vs;exports.GlobalProviders=Lm;exports.Header=Lo;exports.HelperTextBox=id;exports.HiddenFromScreenReaders=Qa;exports.HideShowTextBox=sd;exports.HighlightSection=g_;exports.HighlightedTextBox=Ot;exports.INVALID_TOKEN=Yc;exports.IconBulletedList=Em;exports.ImageContainer=vm;exports.IntlProvider=pd;exports.InviteForm=mh;exports.InviteModal=a_;exports.JoinButton=lo;exports.LanguageContext=ro;exports.LanguageSwitcher=Gp;exports.LessonName=Mh;exports.LessonType=Nh;exports.Link=fn;exports.LoadMore=Hr;exports.LoadingBlock=Mm;exports.LoadingPlaceholder=Bt;exports.LoadingState=eo;exports.Logo=co;exports.LogoSection=Kw;exports.MENTION_REGEX=Gc;exports.MarkCompleteButton=B_;exports.MarkdownText=Fn;exports.MarketingBlock=v_;exports.Marks=Lt;exports.Member=Qt;exports.MembersList=eE;exports.Modal=so;exports.MoreMenu=Sd;exports.NUMBER_OF_COUNTRIES=nm;exports.NUMBER_OF_USERS=tm;exports.NavigationMenu=jd;exports.NotFoundError=T_;exports.Overlay=pn;exports.OverlayContext=ao;exports.OverlayProvider=bd;exports.PageHeading=od;exports.PageLayout=yh;exports.PasswordForm=Iw;exports.PasswordRules=Ld;exports.Pill=Gt;exports.Popover=nd;exports.Portal=Ur;exports.ProfileForm=ph;exports.ProfileImageChange=fh;exports.ProfileModal=fi;exports.ProfileModalLauncher=Wo;exports.ProfilePicture=mn;exports.ProgressBar=Xs;exports.ProgressTracker=ym;exports.Rating=pg;exports.RepliesFeed=jh;exports.ResponsesHeading=wh;exports.ResponsiveImage=ur;exports.ReturnToNavButton=Dm;exports.RichTextEditor=dh;exports.SearchForm=gh;exports.ShareLinks=ng;exports.SignupForm=Ww;exports.Span=Cs;exports.StatusBanner=Or;exports.TableOfContents=l_;exports.Tabs=rg;exports.Tags=Xw;exports.TestimonialBlock=u_;exports.TimeToComplete=hi;exports.Toggle=Nw;exports.Tooltip=Mn;exports.TopLevelPage=Yw;exports.UUID_V4_REGEX=jr;exports.UserContext=it;exports.UserProvider=gd;exports.VisuallyHidden=Ne;exports.addAriaProps=Td;exports.basicReducer=Wr;exports.camelCaseToDashCase=Vc;exports.checkIntlPathExists=Ja;exports.generateConditions=Aa;exports.generateCssIcon=rm;exports.getCharacterLimitProps=Pd;exports.getLongDate=Js;exports.getMember=ti;exports.getPostBody=zo;exports.getShortDate=Qc;exports.getValueLength=ni;exports.headerData=qr;exports.mapGetStreamData=A_;exports.pageReady=Jc;exports.passwordValidator=ys;exports.repliesFeedMock=NE;exports.supportedLanguages=Ca;exports.toCamelCase=Kc;exports.toCapitalisedCase=em;exports.toSentenceCase=Zc;exports.useBadges=cd;exports.useCurrentPath=Lc;exports.useEffectAfterMount=er;exports.useElementWidth=Pn;exports.useOverlay=vd;exports.useScrollListener=Wc;exports.useScrollToHash=Gs;exports.useTooltips=Qs;exports.useUser=ei;
|
|
165
|
+
`;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Xc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const uE=3e3,lE=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ie.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Ka,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},uE)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,screenreaderText:n.formatMessage({id:r})}),c.jsx(Mn,{className:V({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})},It="discussion_",cE=195;let va=null;const Yr=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s={actionBar:!1,comments:!1,likes:!1},functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,styling:{showShareLinkButton:m=!1,showMoreMenuButton:g=!0}={},setFocus:f=!1,isCommunity:b=!1,badges:v})=>{var Ue,Be,Te,De,Re,ze,Y,oe;const x=ie.useIntl(),k=y.useContext(it),_=y.useContext(di),{createContent:w=async()=>{},deleteContent:F=async()=>{},updateContent:S=async()=>{}}=o.content||{},{createLike:q=()=>{},deleteLike:N=()=>{}}=o.likes||{},{openComments:z=()=>{}}=o.comments||{},{listMembers:I=()=>Promise.resolve([]),clickMentionFallback:A=()=>{}}=o.mentions||{},{author:E,canLike:j,createdAt:R,id:W,likes:H=0,userLiked:G,comments:ne=0,mentions:C}=t,L=k&&k.id&&typeof E!="string"&&E.id&&E.id===k.id||!1,ee=typeof j=="boolean"?j:!0,B=L&&(!t.createdAt||am(t.createdAt,10,"seconds")),T=y.useRef(null),[O,$]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",memberCustomMessage:(t==null?void 0:t.memberCustomMessage)||""}),[U,re]=y.useState(!1),[X,ae]=y.useState(B?"highlighted":"default"),[he,Q]=y.useState("");y.useEffect(()=>{const le=T.current;if(!(!le||X==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),le.addEventListener("transitionend",pe),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),le.removeEventListener("transitionend",pe)}},[]),y.useEffect(()=>{$({...O,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const ce=await qo(O.body,p,C,I);$({...O,postBody:ce})})()},[O.body,C]);const ve=()=>{setTimeout(()=>{ae("fading")},1e3)},pe=({propertyName:le})=>{le==="background-color"&&ae(ce=>(ce==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,ve),T.current&&T.current.removeEventListener("transitionend",pe)),ce==="fading"?"default":ce))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||O.postBody===""&&t.title==="")return c.jsx(At,{className:"discussion-card"});const _e=async({title:le,body:ce})=>{le||(le=""),ce||(ce=""),Q("");try{if(!ps(le,O.title)||!ps(ce,O.body)){const Ce=t.type==="question"?{title:ce}:{title:le,body:ce};await S(Ys(t.slugs),Ce)}$({...O,title:le,body:ce,isEditing:!1,didEdit:!0})}catch{Q(`${It}form_error`)}},Fe=()=>{if(_&&_.updateConversation){const le={showForm:!0},ce=t.author;ce&&ce.id&&(b&&(le.prepopulateForm=`@{{${ce.id}}}`),le.mentionData={id:ce.id,name:ce.name}),_.updateConversation(le)}setTimeout(()=>{var Ye,rt,xt;const ce=`reply-form-${(t.type==="answer"?t.slug:((Ye=t.slugs)==null?void 0:Ye.reply)||((rt=t.slugs)==null?void 0:rt.answer)||((xt=t.slugs)==null?void 0:xt.question)||"").toLowerCase().slice(-15)}`,Ce=document.getElementById(ce),Ze=document.getElementById(`${ce}-input`);Ze&&Ze.focus(),Ce&&Ce.scrollIntoView({behavior:"smooth"})},0)},Se=async()=>{re(!1);try{await F(Ys(t.slugs))}catch{Q("delete-error")}},We=[{text:x.formatMessage({id:`${It}moreMenu_report`}),onClick:le=>{le.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(x.formatMessage({id:`${It}report_subject`}))}&body=${encodeURI(x.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&&L&&We.push({text:x.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>$({...O,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:x.formatMessage({id:`${It}moreMenu_delete`}),onClick:le=>{le.preventDefault(),le.stopPropagation(),re(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Td(`delete-${t.slug}-modal`,U)}),r&&o.pins&&We.push({text:x.formatMessage({id:`${It}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),f&&((Ue=T==null?void 0:T.current)==null||Ue.focus(),(Be=T==null?void 0:T.current)==null||Be.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[X]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!O.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:T,tabIndex:f?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:le=>{if(!l.post||O.isEditing)return;le.preventDefault(),le.stopPropagation(),va&&clearTimeout(va),va=setTimeout(()=>{window.location.href=l.post},150);const ce=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:va}});document.dispatchEvent(ce)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:V("discussion-card",t.type,{editing:O.isEditing,"has-link":l.post&&!O.isEditing}),children:[!O.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Qt,{member:E,additionalContent:{createdAt:R,didEdit:O.didEdit,customMessage:O.memberCustomMessage},className:typeof E!="string"&&E.id===i?"highlighted":"",styling:{additionalContentNewLine:!!O.memberCustomMessage},gtmContext:d,gtmType:"profile-click",badges:v}),t.pinned&&c.jsx(Gt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ne,{children:"Pinned Post"})})]}),O.isEditing?c.jsx(Zr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:O.title!==""?{text:O.title}:!1,isEditing:{text:O.body},isPrepopulated:!1},isCommunity:b,maxLength:t.type==="question"?250:5e4,forceShow:{error:he!==""&&he!=="delete-error"?x.formatMessage({id:he},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:_e,handleCancel:()=>{Q(""),$({...O,isEditing:!1})},listMembers:I,clickMentionFallback:A},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(O==null?void 0:O.title)&&c.jsx("p",{className:"content-title",children:O==null?void 0:O.title}),O.postBody.length>cE?c.jsx(sd,{text:O.postBody,markdownOptions:{overrides:{a:Cs,blockquote:{component:cs}}}}):c.jsx(Fn,{options:{overrides:{a:Cs,blockquote:{component:cs}}},children:O.postBody})]}):c.jsxs(c.Fragment,{children:[(O==null?void 0:O.title)&&c.jsx("p",{className:"content-title",children:O==null?void 0:O.title}),c.jsx(Fn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:cs}}},children:O.postBody})]}),!O.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:V("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(Ch,{element:"li",likes:H,isShort:!1,userLiked:G,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:ee,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:q,deleteLike:N}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Ka,{onClick:le=>{le.preventDefault(),le.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof z=="function"&&z()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:x.formatMessage({id:`${It}comments_screenReader`},{count:ne}),children:x.formatMessage({id:`${It}comments`},{count:ne})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Ka,{styling:{muted:!0},onClick:Fe,icon:{icon:"speech-bubble_square"},children:x.formatMessage({id:`${It}reply`})})}),m&&c.jsx(lE,{url:(Te=t.slugs)!=null&&Te.reply?`${window.location.origin}${(De=t.slugs)==null?void 0:De.question}/${(Re=t.slugs)==null?void 0:Re.answer}#${(ze=t.slugs)==null?void 0:ze.reply}`:`${window.location.origin}${(Y=t.slugs)==null?void 0:Y.question}/${(oe=t.slugs)==null?void 0:oe.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),g&&c.jsx(Sd,{element:"li",id:`more-${t.slug}`,options:We})]})]}),h,c.jsx(pn,{id:`delete-${t.slug}-modal`,isOpen:U,functions:{onOpen:()=>{},onClose:()=>re(!1)},forceShow:{error:he==="delete-error"?x.formatMessage({id:"discussion_delete_error"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:x.formatMessage({id:"discussion_delete_title"},{action:x.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>re(!1),children:x.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Se,children:x.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:le=>c.jsx("p",{children:le}),action:x.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const dE=y.lazy(()=>Promise.resolve().then(()=>r_)),fE=65,xh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(it)||"community",l=ni(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||td("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await qo(p.title||p.body||"",fE,p.mentions);m(x=>({...x,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const x=b;x.preventDefault(),x.stopPropagation();const _=x.target.closest("a");v=_&&_.getAttribute("href")}h(x=>({...x,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:V("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(mn,{name:l.name,src:l.image,alt:""}),c.jsx(Fn,{className:V("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:_t,blockquote:_t,br:_t,em:_t,li:_t,ol:_t,p:_t,s:_t,span:_t,strong:_t,ul:_t}},children:f})]}),c.jsxs(Ur,{children:[c.jsx(dE,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(pn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},hE=y.lazy(()=>Promise.resolve().then(()=>aE)),Wo=({isCard:e=!1,form:t,parentId:n,membershipRequiredToPost:{isMember:r,required:a,join:i,leave:s,notMemberStateText:o}})=>{if(a&&!r)return c.jsx(hn,{text:o,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(co,{isShort:!0,functions:{join:i,leave:s}})}});const{content:l,functions:u,meta:d,...h}=t,p={content:{type:(l==null?void 0:l.type)||"reply",slugs:(l==null?void 0:l.slugs)||{}},functions:{...u,create:(u==null?void 0:u.create)||(()=>{})},parentId:n,meta:{...d,isEditing:(d==null?void 0:d.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...h,id:`add-post-${h.id||""}`};return e?c.jsx(xh,{form:p}):c.jsx(hE,{...p})},Uo=({form:e})=>{const t=y.useContext(it),n=ie.useIntl(),[r,a]=y.useState(!1),i=()=>{hm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(fi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const ds="discussion_responses_",wh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${ds}title`},{action:r.formatMessage({id:`${ds}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:St(r.formatMessage,`${ds}empty`,e,e)})]})};const Eh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ie.useIntl(),s=y.useContext(di),o=Ca(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Hr,{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&&c.jsx(Zr,{...r})]})},mE="post",pE="reply",_h="00000000-0000-0000-0000-000000000000";function Ho({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Vo({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 gE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function kh(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 bE({title:e,content:t}){return{title:e,content:t,id:_h,time:new Date().toISOString(),verb:mE}}function Ac({activity:e,user:t}){return{...e,actor:kh(t),...gE()}}function Za({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 Fh({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 Ya({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Bh({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function yE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:_h,kind:pE,parent:t||""}}function Tc({reply:e,user:t}){const n=kh(t);return{...e,user_id:n.id,user:n,...vE()}}function Sc({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 DE({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 Ah=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let jc,fs=0;const Th=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(jc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),fs=0;return}fs++,!(fs>10)&&(jc=setTimeout(()=>{e(t)},50))}},ir=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}),Ht=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}),Ko=Object.freeze({actor:`SU:${ir.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"}),CE=Object.freeze({actor:`SU:${Ht.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"}),xE=Object.freeze({actor:`SU:${ir.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"}),wE=Object.freeze({actor:`SU:${Ht.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:Ko.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ht.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ht.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Ko.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ht.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ht.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:Ht.id,user:{id:Ht.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ko.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:CE.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:Ht.id,user:{id:Ht.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:xE.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function EE({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=Ac({activity:bE(o),user:i});return Oc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Ac({activity:o,user:i});r.setQueryData(a,Oc(d,u,!0)),setTimeout(()=>{Ah(d.id,"activity")},0)}});return s}function _E({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=jn(a,s);return o&&(o.content=i),s}),onError:n});return r}function kE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,rankingMethod:u}){const d=qe.useQueryClient(),h=ti(),p={queryClient:d,queryKey:l},m={mutationHandlers:{error:Ho(p),mutate:Vo(p)},user:h,...p},g=EE({...m,mutationFn:e}),f=_E({...m,mutationFn:t}),b=FE({...m,mutationFn:n}),v=TE({...m,mutationFn:a}),x=SE({...m,mutationFn:i}),k=AE({...m,mutationFn:s}),_=jE({...m,mutationFn:o}),{activities:w,...F}=BE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:w,mutations:{create:g,edit:f,remove:v,like:b,unlike:x,pin:k,unpin:_},user:h,...F}}function FE({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=jn(s,o);return l&&Za({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Za({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function BE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:PE(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function AE({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=jn(s,o);return l&&Ya({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Ya({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>OE(a,i)),onError:n});return r}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Fh({activity:o,user:r}),s}),onError:n});return a}function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Bh({activity:o,user:r}),s}),onError:n});return a}function Oc(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 jn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function OE(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 PE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const ME=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=$m(ro.COMMUNITY_RANKING),d=ie.useIntl(),[h,p]=y.useState("community_feed_live"),[m,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:x,isLoading:k,mutations:{create:_,edit:w,remove:F,like:S,unlike:q,pin:N,unpin:z}}=kE({queryKey:[e,t,"activities",h],queryFns:a,rankingMethod:h});y.useEffect(()=>{u&&g(m.concat(u))},[u]);const[I,A]=y.useState(null),E=()=>{A(f.length),v()};return Th(),b?c.jsx(hn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(Wo,{isCard:!0,parentId:t,form:{content:{type:"post",slugs:{}},functions:{create:_,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(en,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:m.map(({id:j,label:R})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${R}`})})),initialValue:h,functions:{onChange:j=>{p(j);const R=m.find(H=>H.id===j);if(!R)return;const W=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"community_sortSuccess"},{order:d.formatMessage({id:`activitiesFeed_rankingMethod_${R.label}`})})}});document.dispatchEvent(W)}},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,R)=>{var $,U,re;const{id:W,own_reactions:H,latest_reactions:G,reaction_counts:ne,mentioned_users:C,total_replies:L}=j,ee=((($=G==null?void 0:G.like)==null?void 0:$.length)||0)>0,B=(((U=H==null?void 0:H.like)==null?void 0:U.length)||0)>0,T=B?H==null?void 0:H.like[0].id:"",O=ee?(re=G==null?void 0:G.like)==null?void 0:re.map(X=>{var ae,he,Q;return{id:(ae=X==null?void 0:X.user)==null?void 0:ae.id,name:(Q=(he=X==null?void 0:X.user)==null?void 0:he.data)==null?void 0:Q.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(Yr,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:Kr(j==null?void 0:j.actor),userLiked:B,likes:(ne==null?void 0:ne.like)||0,comments:L||0,peopleWhoLiked:O,mentions:C,pinned:(ne==null?void 0:ne.pin)&&(ne==null?void 0:ne.pin)>0||!1},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>F({activityId:W}),updateContent:(X,{body:ae})=>w({activityId:W,content:ae})},likes:{createLike:()=>S({activityId:W}),deleteLike:()=>q({activityId:W,reactionId:T})},comments:{openComments:()=>null},pins:{createPin:()=>N({activityId:W}),deletePin:()=>z({activityId:W,reactionId:G==null?void 0:G.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:R===I,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}})},W)}),!k&&c.jsx(Hr,{hasNextPage:x,loadNextPage:E,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Uo,{form:l})]})},NE={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",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},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 IE({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=Tc({reply:yE(o),user:i});return Pc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Tc({reply:o,user:i});r.setQueryData(a,Pc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Ah(d.id,"reply")},0)}});return s}function RE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ga(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Sh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=ti(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ho(u),mutate:Vo(u)},user:l,...u},h=IE({...d,mutationFn:e}),p=RE({...d,mutationFn:t}),m=$E({...d,mutationFn:n}),g=zE({...d,mutationFn:a}),f=qE({...d,mutationFn:i}),{replies:b,...v}=LE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function $E({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=Ga(s,o);return l&&Sc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ga(o,l);u&&Sc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function LE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:KE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function zE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>VE(a,i)),onError:n});return r}function qE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ga(i,s);return o&&DE({reply:o,user:r}),s}),onError:n});return a}function WE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function UE(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 HE(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 Pc(e,t,n){return t?n!=null&&n.append?UE(e,t,n):HE(e,t,n):WE(e)}function Ga(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function VE(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 KE(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 ZE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ie.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:h,mutations:{create:p,edit:m,like:g,remove:f,unlike:b},user:v}=Sh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Qs([h]);const[x,k]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(Ee,{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&&c.jsx(Eh,{loadMore:{isLoading:h,hasNextPage:d,loadNextPage:()=>u()},form:{parentId:t,content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{body:w})=>p({activityId:n,replyId:r,content:w}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(_=>{var H,G,ne,C,L,ee,B;const{id:w,own_children:F,latest_children:S,children_counts:q,data:{mentioned_users:N}}=_,I=(((H=F==null?void 0:F.like)==null?void 0:H.length)||0)>0?(G=F==null?void 0:F.like)==null?void 0:G.find(T=>{var O;return((O=T==null?void 0:T.user)==null?void 0:O.id)===(v==null?void 0:v.id)}):!1,A=I?I==null?void 0:I.id:"",E=!!I,R=(((ne=S==null?void 0:S.like)==null?void 0:ne.length)||0)>0?(C=S==null?void 0:S.like)==null?void 0:C.map(T=>{var O,$,U;return{id:(O=T==null?void 0:T.user)==null?void 0:O.id,name:(U=($=T==null?void 0:T.user)==null?void 0:$.data)==null?void 0:U.name}}):!1,W=typeof _.data.content=="string"?(L=_==null?void 0:_.data)==null?void 0:L.content:((B=(ee=_==null?void 0:_.data)==null?void 0:ee.content)==null?void 0:B.text)||"";return c.jsx(Yr,{isCommunity:!0,content:{id:w,type:"reply",body:W,canLike:a,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:Kr(_==null?void 0:_.user),userLiked:E,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:R,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(T,{body:O})=>m({replyId:w,content:O})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>b({replyId:w,reactionId:A})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},w)}):null})]})};const jh=({basePath:e,parentId:t,activityId:n,activityTotalReplies:r,isMember:a,functions:{reactions:i,mentions:s,join:o,leave:l},profile:u})=>{const d=ie.useIntl(),{replies:h,fetchNextPage:p,hasNextPage:m,isLoading:g,mutations:{create:f,edit:b,like:v,remove:x,unlike:k},user:_}=Sh({queryKey:[e,t,n,"replies"],queryFns:i}),w=()=>{S(h.length),p()},[F,S]=y.useState(null);return Qs([g]),Th(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(wh,{type:"comment",responses:r,isLoading:g}),c.jsx(Wo,{form:{content:{type:"reply",slugs:{}},functions:{create:(q,{body:N})=>f({activityId:n,content:N}),...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:d.formatMessage({id:"discussion_responses_placeholder"})},parentId:t,membershipRequiredToPost:{isMember:a,required:!0,join:o,leave:l,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),h==null?void 0:h.map((q,N)=>{var ee,B,T,O,$,U,re;const{id:z,own_children:I,latest_children:A,children_counts:E,data:{mentioned_users:j}}=q,W=(((ee=I==null?void 0:I.like)==null?void 0:ee.length)||0)>0?(B=I==null?void 0:I.like)==null?void 0:B.find(X=>{var ae;return((ae=X==null?void 0:X.user)==null?void 0:ae.id)===(_==null?void 0:_.id)}):!1,H=W?W==null?void 0:W.id:"",G=!!W,C=(((T=A==null?void 0:A.like)==null?void 0:T.length)||0)>0?(O=A==null?void 0:A.like)==null?void 0:O.map(X=>{var ae,he,Q;return{id:(ae=X==null?void 0:X.user)==null?void 0:ae.id,name:(Q=(he=X==null?void 0:X.user)==null?void 0:he.data)==null?void 0:Q.name}}):!1,L=typeof q.data.content=="string"?($=q==null?void 0:q.data)==null?void 0:$.content:((re=(U=q==null?void 0:q.data)==null?void 0:U.content)==null?void 0:re.text)||"";return c.jsx(Dh,{children:c.jsx(Yr,{isCommunity:!0,content:{id:z,type:"reply",body:L,canLike:a,createdAt:q==null?void 0:q.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:z},slug:z,author:Kr(q==null?void 0:q.user),userLiked:G,likes:(E==null?void 0:E.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>x({replyId:z}),updateContent:(X,{body:ae})=>b({replyId:z,content:ae})},likes:{createLike:()=>v({replyId:z}),deleteLike:()=>k({replyId:z,reactionId:H})},comments:{},mentions:s},badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]},children:c.jsx(ZE,{basePath:e,parentId:t,activityId:n,replyId:z,isMember:a,functions:{...i,...s}}),styling:{showShareLinkButton:!0},setFocus:N===F},z)},z)}),!g&&c.jsx(Hr,{hasNextPage:m,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Uo,{form:u})]})};function YE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function GE({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 QE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=qe.useQueryClient(),l=ti(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Ho(u),mutate:Vo(u)},user:l,...u},h=YE({...d,mutationFn:t}),p=JE({...d,mutationFn:n}),m=XE({...d,mutationFn:r}),g=e_({...d,mutationFn:a}),f=t_({...d,mutationFn:i}),{activity:b,...v}=GE({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:g,unpin:f},user:l,...v}}function JE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Za({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Za({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function XE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Fh({activity:s,user:r}),s)),onError:n});return a}function e_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ya({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ya({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function t_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Bh({activity:s,user:r}),s))),onError:n});return a}const n_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:h})=>{var E,j,R,W,H,G;const p=ie.useIntl(),{activity:m,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:x,pin:k,unpin:_}}=QE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(At,{style:{height:"400px"}});if(g||!m)return c.jsx(hn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:F,mentioned_users:S}=m,q=(((E=F==null?void 0:F.like)==null?void 0:E.length)||0)>0,N=(((j=w==null?void 0:w.like)==null?void 0:j.length)||0)>0,z=N?w==null?void 0:w.like[0].id:"",I=q?(R=F==null?void 0:F.like)==null?void 0:R.map(ne=>{var C,L,ee;return{id:(C=ne==null?void 0:ne.user)==null?void 0:C.id,name:(ee=(L=ne==null?void 0:ne.user)==null?void 0:L.data)==null?void 0:ee.name}}):!1,A=m==null?void 0:m.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Yr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:m==null?void 0:m.title,body:m==null?void 0:m.content,canLike:r,createdAt:(m==null?void 0:m.time)||"",slugs:{question:`${e}/${t}`,answer:m==null?void 0:m.id},slug:n,author:Kr(A),userLiked:N,likes:((W=m==null?void 0:m.reaction_counts)==null?void 0:W.like)||0,comments:(m==null?void 0:m.total_replies)||0,peopleWhoLiked:I,mentions:S,pinned:((H=m==null?void 0:m.reaction_counts)==null?void 0:H.pin)&&((G=m==null?void 0:m.reaction_counts)==null?void 0:G.pin)>0||!1},originalAuthorId:A==null?void 0:A.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(ne,{title:C,body:L})=>b({title:C,content:L})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>x({activityId:n,reactionId:z})},comments:{openComments:()=>{}},pins:{createPin:()=>k({activityId:n}),deletePin:()=>{var ne;return _({activityId:n,reactionId:(ne=F==null?void 0:F.pin)==null?void 0:ne[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:dt.COMMUNITIES,area:t||""},{scope:dt.PLATFORM,area:"all"}]}},n),c.jsx(jh,{basePath:e,parentId:t,activityId:n,activityTotalReplies:(m==null?void 0:m.total_replies)||0,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:h})]})};const Oh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(pn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",a),children:c.jsx(Zr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const x=g||{};x[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(k=>({...k,mentions:x}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},r_=Object.freeze(Object.defineProperty({__proto__:null,default:Oh},Symbol.toStringTag,{value:"Module"}));const a_=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=ie.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(pn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:c.jsx(mh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const fi=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ie.useIntl(),[l,u]=y.useState(td("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(pn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:V("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ph,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async h=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(h)}finally{d()}}}})]})})},i_=Object.freeze(Object.defineProperty({__proto__:null,default:fi},Symbol.toStringTag,{value:"Module"}));const s_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(mn,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(pn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Fn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const o_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:V("testimonial-block",a),children:[c.jsx(qt,{className:"testimonial",children:n}),r?c.jsx(Qt,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:V("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),u_=y.memo(o_);const l_=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+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&&c.jsxs(Pt,{variant:"subtle",className:V("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const hi=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,g=Math.round(m),f=`${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:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};const c_=({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",c.jsx(ur,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const d_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],f_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.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&&d_.includes(x.toLowerCase()))return;p[b]={text:v,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&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"})}),c.jsx(bn,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:x=""}=p[b];return b==="text"?c.jsx(Fn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(x,{key:b,className:b},v)}return null}),l,m&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(ur,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},h_=y.memo(f_);const m_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(bn,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const p_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Fn,{children:n}):n;return c.jsxs(bn,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(ur,{image:{...r,description:""}})}),c.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},g_=y.memo(p_);const v_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:V("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{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})]}),b_=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&bs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Xs(d)});if(o)return c.jsx(Gt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&bs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},y_={title:66,text:3e3,secondaryText:1e3,partner:34},Qa={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"}},D_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ie.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=Qa[p])!=null&&f.gtmEvent&&(m=Qa[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),x=async k=>{if(k.preventDefault(),k.stopPropagation(),!(v||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return c.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"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};function C_({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=y.useContext(it),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Gt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const Zo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var I,A;const u=ie.useIntl(),d=y.useContext(it),h=!!(d!=null&&d.id),p=y.useRef(null),[m,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,h).then(E=>{g({data:E,isLoading:!1})}).catch(()=>g(E=>({...E,isLoading:!1})))},[a,h,n]);const{data:f,isLoading:b}=m;if(b||!f)return c.jsx(At,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Qa[v])return c.jsx(At,{element:"li",className:"card-wrapper"});const{basePath:x="",className:k,length:_,gtmEvent:w}=Qa[v];let F=f.slug?`${x}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(F=f.slug);const S=E=>{F&&(E.preventDefault(),E.stopPropagation(),window.location.href=F)},q={...y_,..._};let N={className:"card"},z={};return F&&(z={href:F,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},f.openInNewTab&&(z.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),l&&(N={...N,tabIndex:"0"},(I=p==null?void 0:p.current)==null||I.focus(),(A=p==null?void 0:p.current)==null||A.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",k,t,{"has-link":F,"no-link":!F,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...N,ref:p,children:[c.jsx(rd,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&im(f==null?void 0:f.createdAt,60)&&c.jsx(Gt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(Gt,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Qc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(Gt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(ur,{image:{...f.banner,description:""}})]}):k==="people"?c.jsx(mn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(so,{contributors:{data:f.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Xn(f.partner[0],q.partner)}),["title","text","secondaryText"].map(E=>{const j=f[E];if(!j)return null;const R=Vc(E),W={key:E,className:R,"data-testid":R},H={wrapper:"p",forceWrapper:!0,forceInline:!0},G=Xn(j,q[E]);return["title","text"].includes(E)&&F?(H.wrapper="a",c.jsx("p",{...W,children:c.jsx(qt,{options:H,...z,children:G})})):c.jsx(qt,{options:H,...W,children:G})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(C_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(b_,{type:k||"",data:f}),c.jsx(D_,{data:f,cta:i,link:F||"",gtmContext:s})]})})};const Ph=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(Zo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),x_=(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},w_=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.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 hs={fourCards:1024,threeCards:769,twoCards:480};let ba=null,ms=null;const E_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ie.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[x,k]=y.useState(""),_=t.length,w=Math.ceil(_/p),F=y.useRef(null),S=Pn(!0,!0,F==null?void 0:F.current);y.useEffect(()=>{let E=1;S&&(S>=hs.fourCards?E=4:S>=hs.threeCards?E=3:S>=hs.twoCards&&(E=2),E>_&&(E=_)),h(j=>({...j,cardsPerPage:E,isLoading:!1}))},[S,_]);const q=(E="next")=>{ms&&clearTimeout(ms);let j=b;if(typeof E=="string")if(E==="next")if(b<w-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=E;k(""),f(W=>({...W,currentPage:j,loadedPages:[...new Set([...v,j])]}));const R=()=>{const W=j*d.cardsPerPage,H=W+d.cardsPerPage;return t.slice(W,H).length};ms=setTimeout(()=>{k(l.formatMessage({id:`${u}ariaLive${typeof E=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof E=="string"?E:"next"}`}),slide:typeof E=="string"?1:E+1,count:R()}))},500)},N=E=>{ba=E.touches[0].clientX},z=E=>{if(ba===null)return;const j=E.touches[0].clientX,R=ba-j;R>5?q("next"):R<-5&&q("previous"),ba=null},I={"--width":`${S||0}px`,"--total-cards":_,"--cards-per-page":p,"--page":b};if(m)return c.jsx(to,{layout:`carousel${a?"-with-title":""}`});const A=(E,j)=>{var W;let R=null;return(W=E==null?void 0:E.sys)!=null&&W.id?R=`card-${E.sys.id}`:E!=null&&E.slug?R=`card-${E.slug}`:[n[j],E.contentType].includes("customCard")&&(R=`card-${window.btoa(`${E.title} ${E.createdAt}`)}-${j}`),R};return c.jsxs("section",{ref:F,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(w_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:N,onTouchMove:z,style:I,"data-testid":"carousel-list",children:t.map((E,j)=>{let R=A(E,j);return R&&x_(j,p,b,v)?c.jsx(Zo,{id:R,card:{...E,contentType:n[j]},buildCardData:r,gtmContext:s,...o},R):(R=R||`${e}-card-${j}`,c.jsx(At,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},R))})}),w<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:E=>{E.preventDefault(),E.stopPropagation(),q("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(w)].map((E,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:j===b}),onClick:R=>{R.preventDefault(),R.stopPropagation(),q(j)},children:c.jsx(Ne,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:j+1,total:w})})})},`page-indicator-${j}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:E=>{E.preventDefault(),E.stopPropagation(),q("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=w-1})})]}),c.jsx(Ne,{"aria-live":x===""?"off":"polite",showOnFocus:!1,children:x})]})]})},__=({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 d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(to,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Ut,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(E_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Ut,{})]},`carousel-${d}`)});const k_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ie.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:V("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(hi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(eo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Mh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Nh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ie.useIntl(),o=Xa(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Zc(a||"");return c.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&c.jsx(hi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const F_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=ie.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(ei,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(hi,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:x,isIntroduction:k,optional:_,slug:w,subsectionId:F,title:S,type:q})=>{const N=a&&t||k,z={};return x&&(z.style={"--image":`url(${x})`}),c.jsx("li",{className:V({article:b===Dr.ARTICLE,discussion:b===Dr.DISCUSSION,quiz:b===Dr.QUIZ,completed:g&&b===Dr.ARTICLE,locked:!N}),...z,children:c.jsx(fn,{href:N?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Kc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Mh,{sectionId:i,subsectionId:F,title:S,className:"course-title"})," ",c.jsx(Nh,{completionTime:f,icon:v,optional:_,type:q,children:d&&d[w]&&c.jsx("span",{className:"quiz-score",children:`${d[w]}%`})})]})})},w)})})]})};const B_=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...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":""}`})})},A_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Mc=[{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 ya="notFoundError_",T_=()=>{const e=ie.useIntl(),t=[];return Mc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ya}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(yh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(bn,{children:[c.jsx(Ph,{cards:Mc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ya}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ya}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ya}text`})})]})};exports.ASSETS_BUCKET=Wt;exports.ActivitiesFeed=ME;exports.ActivitySection=n_;exports.AddPost=Wo;exports.BadgesContext=no;exports.BadgesProvider=dd;exports.Banner=c_;exports.BannerSection=h_;exports.Breadcrumbs=Vp;exports.Buckets=Cm;exports.Button=Ee;exports.ButtonWrapper=or;exports.COURSE_CONTENT_TYPES=Dr;exports.CacheProvider=fd;exports.Card=Zo;exports.CardBlock=Ph;exports.Carousel=__;exports.CharacterLimit=ho;exports.CollapsibleSection=ei;exports.Columns=Od;exports.CommunityDetails=Hp;exports.ContactFooter=Zw;exports.ContactForm=hh;exports.ContentTypeLabel=rd;exports.Contributors=so;exports.ConversationContext=di;exports.CookieBanner=bh;exports.CourseProgression=k_;exports.CourseStructure=F_;exports.CustomContentBanner=m_;exports.CustomEvents=Xe;exports.DELETED_USER_ID=Sr;exports.Directory=s_;exports.DiscussionConversation=Dh;exports.DiscussionForm=Zr;exports.DiscussionFormCard=xh;exports.DiscussionFormModal=Oh;exports.DiscussionLikes=Ch;exports.DiscussionPost=Yr;exports.DiscussionThread=Eh;exports.Divider=Ut;exports.DownloadSection=Uw;exports.EMAILS=Un;exports.EditSection=Vw;exports.EmailHelperTextBox=Md;exports.EmptyStateBox=hn;exports.EnrichedUrl=Kp;exports.FeatureFlags=ro;exports.Filters=Zp;exports.FlagsProvider=md;exports.Footer=Lo;exports.Form=en;exports.Formatting=Z;exports.Fragment=_t;exports.FullWidthSection=bn;exports.GET_STREAM_USER_PREFIX=vs;exports.GlobalProviders=Lm;exports.Header=zo;exports.HelperTextBox=id;exports.HiddenFromScreenReaders=Ja;exports.HideShowTextBox=sd;exports.HighlightSection=g_;exports.HighlightedTextBox=Pt;exports.INVALID_TOKEN=Yc;exports.IconBulletedList=Em;exports.ImageContainer=vm;exports.IntlProvider=pd;exports.InviteForm=mh;exports.InviteModal=a_;exports.JoinButton=co;exports.LanguageContext=ao;exports.LanguageSwitcher=Gp;exports.LessonName=Mh;exports.LessonType=Nh;exports.Link=fn;exports.LoadMore=Hr;exports.LoadingBlock=Mm;exports.LoadingPlaceholder=At;exports.LoadingState=to;exports.Logo=fo;exports.LogoSection=Kw;exports.MENTION_REGEX=Gc;exports.MarkCompleteButton=B_;exports.MarkdownText=Fn;exports.MarketingBlock=v_;exports.Marks=zt;exports.Member=Qt;exports.MembersList=eE;exports.Modal=oo;exports.MoreMenu=Sd;exports.NUMBER_OF_COUNTRIES=nm;exports.NUMBER_OF_USERS=tm;exports.NavigationMenu=jd;exports.NotFoundError=T_;exports.Overlay=pn;exports.OverlayContext=io;exports.OverlayProvider=bd;exports.PageHeading=od;exports.PageLayout=yh;exports.PasswordForm=Iw;exports.PasswordRules=Ld;exports.Pill=Gt;exports.Popover=nd;exports.Portal=Ur;exports.ProfileForm=ph;exports.ProfileImageChange=fh;exports.ProfileModal=fi;exports.ProfileModalLauncher=Uo;exports.ProfilePicture=mn;exports.ProgressBar=eo;exports.ProgressTracker=ym;exports.Rating=pg;exports.RepliesFeed=jh;exports.ResponsesHeading=wh;exports.ResponsiveImage=ur;exports.ReturnToNavButton=Dm;exports.RichTextEditor=dh;exports.SearchForm=gh;exports.ShareLinks=ng;exports.SignupForm=Ww;exports.Span=Cs;exports.StatusBanner=Or;exports.TableOfContents=l_;exports.Tabs=rg;exports.Tags=Xw;exports.TestimonialBlock=u_;exports.TimeToComplete=hi;exports.Toggle=Nw;exports.Tooltip=Mn;exports.TopLevelPage=Yw;exports.UUID_V4_REGEX=jr;exports.UserContext=it;exports.UserProvider=gd;exports.VisuallyHidden=Ne;exports.addAriaProps=Td;exports.basicReducer=Wr;exports.camelCaseToDashCase=Vc;exports.checkIntlPathExists=Xa;exports.generateConditions=Ta;exports.generateCssIcon=rm;exports.getAuthorData=Kr;exports.getCharacterLimitProps=Pd;exports.getLongDate=Xs;exports.getMember=ni;exports.getPostBody=qo;exports.getShortDate=Qc;exports.getValueLength=ri;exports.headerData=qr;exports.mapGetStreamData=A_;exports.pageReady=Jc;exports.passwordValidator=ys;exports.repliesFeedMock=NE;exports.supportedLanguages=xa;exports.toCamelCase=Kc;exports.toCapitalisedCase=em;exports.toSentenceCase=Zc;exports.transformSlugs=Ys;exports.useBadges=cd;exports.useCurrentPath=Lc;exports.useEffectAfterMount=er;exports.useElementWidth=Pn;exports.useOverlay=vd;exports.useScrollListener=Wc;exports.useScrollToHash=Qs;exports.useTooltips=Js;exports.useUser=ti;
|